Skip to content

Commit

Permalink
Support configuring annotations in extension.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
iawia002 committed Jul 24, 2024
1 parent ac2fd83 commit 2d32f28
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/extension/templates/extension.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
3 changes: 3 additions & 0 deletions pkg/extension/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 2d32f28

Please sign in to comment.