Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: add an annotation for the addon #6256

Merged
merged 1 commit into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 7 additions & 4 deletions pkg/addon/addon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1135,13 +1135,16 @@ func TestPackageAddon(t *testing.T) {
}

func TestGenerateAnnotation(t *testing.T) {
meta := Meta{SystemRequirements: &SystemRequirements{
VelaVersion: ">1.4.0",
KubernetesVersion: ">1.20.0",
}}
meta := Meta{
Name: "test-addon",
SystemRequirements: &SystemRequirements{
VelaVersion: ">1.4.0",
KubernetesVersion: ">1.20.0",
}}
res := generateAnnotation(&meta)
assert.Equal(t, res[velaSystemRequirement], ">1.4.0")
assert.Equal(t, res[kubernetesSystemRequirement], ">1.20.0")
assert.Equal(t, res[addonSystemRequirement], meta.Name)

meta = Meta{}
meta.SystemRequirements = &SystemRequirements{KubernetesVersion: ">=1.20.1"}
Expand Down
1 change: 1 addition & 0 deletions pkg/addon/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@
res[kubernetesSystemRequirement] = meta.SystemRequirements.KubernetesVersion
}
}
res[addonSystemRequirement] = meta.Name

Check warning on line 451 in pkg/addon/utils.go

View check run for this annotation

Codecov / codecov/patch

pkg/addon/utils.go#L451

Added line #L451 was not covered by tests
return res
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/addon/versioned_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ const (
velaSystemRequirement = `system.vela`
// kubernetesSystemRequirement is the kubernetes requirement annotation key
kubernetesSystemRequirement = `system.kubernetes`
// addonSystemRequirement is the annotation key to identity an addon from helm chart structure
addonSystemRequirement = `addon.name`
)

// VersionedRegistry is the interface of support version registry
Expand Down