diff --git a/pkg/apis/application/v1alpha1/constants.go b/pkg/apis/application/v1alpha1/constants.go index 496ccf24d..50d4ca7bd 100644 --- a/pkg/apis/application/v1alpha1/constants.go +++ b/pkg/apis/application/v1alpha1/constants.go @@ -57,5 +57,7 @@ const ( UncategorizedId = "ctg-uncategorized" AppStoreRepoId = "repo-helm" + ApplicationInstance = "app.kubesphere.io/instance" + OriginWorkspaceLabelKey = "kubesphere.io/workspace-origin" ) diff --git a/pkg/controller/openpitrix/helmrelease/helm_release_controller.go b/pkg/controller/openpitrix/helmrelease/helm_release_controller.go index 9d6f98e75..ca30f8a0c 100644 --- a/pkg/controller/openpitrix/helmrelease/helm_release_controller.go +++ b/pkg/controller/openpitrix/helmrelease/helm_release_controller.go @@ -345,8 +345,10 @@ func (r *ReconcileHelmRelease) createOrUpgradeHelmRelease(rls *v1alpha1.HelmRele // If clusterConfig is empty, this application will be installed in current host. hw := helmwrapper.NewHelmWrapper(clusterConfig, rls.GetRlsNamespace(), rls.Spec.Name, - // We just add kubesphere.io/creator annotation now. helmwrapper.SetAnnotations(map[string]string{constants.CreatorAnnotationKey: rls.GetCreator()}), + helmwrapper.SetLabels(map[string]string{ + v1alpha1.ApplicationInstance: rls.GetTrueName(), + }), helmwrapper.SetMock(r.helmMock)) var currentState string diff --git a/pkg/simple/client/openpitrix/helmwrapper/helm_wrapper.go b/pkg/simple/client/openpitrix/helmwrapper/helm_wrapper.go index 7c17b4d73..bda37bf0b 100644 --- a/pkg/simple/client/openpitrix/helmwrapper/helm_wrapper.go +++ b/pkg/simple/client/openpitrix/helmwrapper/helm_wrapper.go @@ -239,6 +239,13 @@ func SetAnnotations(annotations map[string]string) Option { } } +// extra labels added to all resources in chart +func SetLabels(labels map[string]string) Option { + return func(wrapper *helmWrapper) { + wrapper.labels = labels + } +} + func SetMock(mock bool) Option { return func(wrapper *helmWrapper) { wrapper.mock = mock