-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
set agent install namespace from addon deployment config for template…
… type addons Signed-off-by: zhujian <[email protected]>
- Loading branch information
Showing
16 changed files
with
293 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package templateagent | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
addonapiv1alpha1 "open-cluster-management.io/api/addon/v1alpha1" | ||
) | ||
|
||
func TestGetAddOnTemplateSpecHash(t *testing.T) { | ||
cases := []struct { | ||
name string | ||
at *addonapiv1alpha1.AddOnTemplate | ||
expected string | ||
expectedErr string | ||
}{ | ||
{ | ||
name: "addon template is nil", | ||
at: nil, | ||
expected: "", | ||
expectedErr: "addon template is nil", | ||
}, | ||
{ | ||
name: "addon template spec is nil", | ||
at: &addonapiv1alpha1.AddOnTemplate{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: "test1", | ||
}, | ||
Spec: addonapiv1alpha1.AddOnTemplateSpec{}, | ||
}, | ||
expected: "aa3e489402ac2e99c4aef0ddc8cc2fdf1d3b6c34c7b8d040dc3fae5db60478cb", | ||
}, | ||
{ | ||
name: "addon template spec is not nil", | ||
at: &addonapiv1alpha1.AddOnTemplate{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: "test1", | ||
}, | ||
Spec: addonapiv1alpha1.AddOnTemplateSpec{ | ||
AddonName: "test1", | ||
}, | ||
}, | ||
expected: "00730aa8aa1826c9a3cfd8d6858b45e1e16bcdade5cc57070ea8089c6764285e", | ||
}, | ||
} | ||
|
||
for _, c := range cases { | ||
t.Run(c.name, func(t *testing.T) { | ||
hash, err := GetAddOnTemplateSpecHash(c.at) | ||
if c.expectedErr != "" { | ||
assert.Equal(t, c.expectedErr, err.Error(), "should be equal") | ||
} else { | ||
assert.Nil(t, err, "should be nil") | ||
} | ||
assert.Equal(t, c.expected, hash, "should be equal") | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
vendor/open-cluster-management.io/addon-framework/pkg/addonfactory/addondeploymentconfig.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
...ter-management.io/addon-framework/pkg/addonmanager/controllers/registration/controller.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
vendor/open-cluster-management.io/addon-framework/pkg/agent/inteface.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
96 changes: 96 additions & 0 deletions
96
vendor/open-cluster-management.io/addon-framework/pkg/utils/namespace.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.