From ccd065c117fe2868ef834dd826bc3dfe7fbe1d11 Mon Sep 17 00:00:00 2001 From: hongming Date: Tue, 1 Aug 2023 18:28:34 +0800 Subject: [PATCH] defines installation mode in extension.yaml --- cmd/publish.go | 7 +------ pkg/extension/templates/extension.yaml | 2 ++ pkg/extension/type.go | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/cmd/publish.go b/cmd/publish.go index 4082c79..296f375 100644 --- a/cmd/publish.go +++ b/cmd/publish.go @@ -12,8 +12,7 @@ import ( ) type publishOptions struct { - kubeconfig string - multiClusterMode bool + kubeconfig string } func defaultPublishOptions() *publishOptions { @@ -31,7 +30,6 @@ func publishExtensionCmd() *cobra.Command { RunE: o.publish, } cmd.Flags().StringVar(&o.kubeconfig, "kubeconfig", "", "kubeconfig file path of the target cluster") - cmd.Flags().BoolVar(&o.multiClusterMode, "multi-cluster-mode", false, "enable multi-cluster installation mode for the extension") return cmd } @@ -51,9 +49,6 @@ func (o *publishOptions) publish(cmd *cobra.Command, args []string) error { } defer os.RemoveAll(dir) // nolint - if o.multiClusterMode { - ext.Metadata.InstallationMode = "Multicluster" - } filePath := path.Join(dir, "extension.yaml") if err = os.WriteFile(filePath, ext.ToKubernetesResources(), 0644); err != nil { return err diff --git a/pkg/extension/templates/extension.yaml b/pkg/extension/templates/extension.yaml index 70b0cf2..c6dcf48 100644 --- a/pkg/extension/templates/extension.yaml +++ b/pkg/extension/templates/extension.yaml @@ -35,6 +35,8 @@ dependencies: condition: frontend.enabled - name: backend condition: backend.enabled +# installationMode describes how to install subcharts, it can be HostOnly or Multicluster. +#installationMode: Multicluster # external dependencies example #externalDependencies: # - name: a diff --git a/pkg/extension/type.go b/pkg/extension/type.go index e81e78e..1d00f2c 100644 --- a/pkg/extension/type.go +++ b/pkg/extension/type.go @@ -64,7 +64,7 @@ type Metadata struct { Icon string `json:"icon" validate:"required"` Screenshots []string `json:"screenshots,omitempty"` Dependencies []*chart.Dependency `json:"dependencies,omitempty"` - InstallationMode string `json:"-"` + InstallationMode string `json:"installationMode,omitempty"` } func (md *Metadata) Validate() error {