diff --git a/pkg/extension/templates/extension.yaml b/pkg/extension/templates/extension.yaml index ad69a5c..b1daf72 100644 --- a/pkg/extension/templates/extension.yaml +++ b/pkg/extension/templates/extension.yaml @@ -54,3 +54,10 @@ installationMode: HostOnly # type: extension # version: ">= 2.2.0" # required: true +# Add init containers to the extension installation job to execute custom tasks (eg: CRDs upgrade). +# Support unified or separate configuration of init container image for each stage. +#annotations: +# executor-hook-image.kubesphere.io: ... +# executor-hook-image.kubesphere.io/install: ... +# executor-hook-image.kubesphere.io/upgrade: ... +# executor-hook-image.kubesphere.io/uninstall: ... diff --git a/pkg/extension/type.go b/pkg/extension/type.go index f33aaff..7d07d07 100644 --- a/pkg/extension/type.go +++ b/pkg/extension/type.go @@ -58,6 +58,7 @@ type Metadata struct { Namespace string `json:"namespace,omitempty"` Images []string `json:"images,omitempty"` ExternalDependencies []corev1alpha1.ExternalDependency `json:"externalDependencies,omitempty"` + Annotations map[string]string `json:"annotations,omitempty"` } func ParseMetadata(data []byte) (*Metadata, error) { @@ -119,6 +120,7 @@ func (md *Metadata) ToChartYaml() (*chart.Metadata, error) { Description: string(md.Description[corev1alpha1.DefaultLanguageCode]), Icon: md.Icon, Maintainers: md.Maintainers, + Annotations: md.Annotations, } return &c, nil } @@ -213,6 +215,7 @@ func (ext *Extension) ToKubernetesResources() []runtimeclient.Object { corev1alpha1.ExtensionReferenceLabel: ext.Metadata.Name, corev1alpha1.CategoryLabel: ext.Metadata.Category, }, + Annotations: ext.Metadata.Annotations, }, Spec: corev1alpha1.ExtensionVersionSpec{ InstallationMode: ext.Metadata.InstallationMode,