From 206e0f0c65a6a3b49bdf195786f3b472e4ad1aa4 Mon Sep 17 00:00:00 2001 From: ysicing Date: Wed, 11 Sep 2024 17:45:27 +0800 Subject: [PATCH] * [storage]: update local pv & longhorn --- cmd/storage/storage.go | 4 ++-- hack/manifests/storage/{local-storage.yaml => local.yaml} | 0 pkg/cluster/cluster.go | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) rename hack/manifests/storage/{local-storage.yaml => local.yaml} (100%) diff --git a/cmd/storage/storage.go b/cmd/storage/storage.go index 886504af..0d3ce845 100644 --- a/cmd/storage/storage.go +++ b/cmd/storage/storage.go @@ -74,9 +74,9 @@ func local(f factory.Factory) *cobra.Command { logpkg := f.GetLog() cmd := &cobra.Command{ Use: "local", - Short: "deploy local storage", + Short: "deploy local pv storage", RunE: func(cmd *cobra.Command, args []string) error { - kubeargs := []string{"experimental", "kubectl", "apply", "-f", common.GetCustomScripts("hack/manifests/storage/local-storage.yaml")} + kubeargs := []string{"experimental", "kubectl", "apply", "-f", common.GetCustomScripts("hack/manifests/storage/local.yaml")} output, err := qcexec.Command(os.Args[0], kubeargs...).CombinedOutput() if err != nil { logpkg.Errorf("upgrade install local storage failed: %s", string(output)) diff --git a/hack/manifests/storage/local-storage.yaml b/hack/manifests/storage/local.yaml similarity index 100% rename from hack/manifests/storage/local-storage.yaml rename to hack/manifests/storage/local.yaml diff --git a/pkg/cluster/cluster.go b/pkg/cluster/cluster.go index 7dcc8dac..95c45705 100644 --- a/pkg/cluster/cluster.go +++ b/pkg/cluster/cluster.go @@ -95,7 +95,7 @@ func (c *Cluster) getInitFlags() []types.Flag { P: &c.Storage, V: c.Storage, EnvVar: common.DefaultStorageType, - Usage: `storage, e.g: nfs,local`, + Usage: `storage, e.g: nfs,local,none`, }, { Name: "datastore", @@ -278,10 +278,12 @@ func (c *Cluster) initMaster0(cfg *config.Config, sshClient ssh.Interface) error return errors.Errorf("%s run install nfs script failed, reason: %v", cfg.Cluster.InitNode, err) } } else if c.Storage == "local" { - kubeargs := []string{"experimental", "kubectl", "apply", "-f", common.GetCustomScripts("hack/manifests/storage/local-storage.yaml")} + kubeargs := []string{"experimental", "kubectl", "apply", "-f", common.GetCustomScripts("hack/manifests/storage/local.yaml")} if err := qcexec.CommandRun(os.Args[0], kubeargs...); err != nil { return errors.Errorf("%s run install local storage failed, reason: %v", cfg.Cluster.InitNode, err) } + } else if c.Storage == "none" { + c.log.Infof("skip install storage") } kclient, _ := k8s.NewSimpleClient() if ns, _ := kclient.GetNamespace(context.TODO(), common.DefaultKubeSystem, metav1.GetOptions{}); ns != nil {