Skip to content

Commit

Permalink
Merge pull request #105 from kubesphere/annotations
Browse files Browse the repository at this point in the history
Support configuring annotations in extension.yaml
  • Loading branch information
iawia002 authored Jul 26, 2024
2 parents 4b0c06d + 2d32f28 commit 215f39f
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 215f39f

Please sign in to comment.