github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/pkg/cli/cmd/infrastructure/pipeline.go (about)

     1  /*
     2  Copyright (C) 2022-2023 ApeCloud Co., Ltd
     3  
     4  This file is part of KubeBlocks project
     5  
     6  This program is free software: you can redistribute it and/or modify
     7  it under the terms of the GNU Affero General Public License as published by
     8  the Free Software Foundation, either version 3 of the License, or
     9  (at your option) any later version.
    10  
    11  This program is distributed in the hope that it will be useful
    12  but WITHOUT ANY WARRANTY; without even the implied warranty of
    13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14  GNU Affero General Public License for more details.
    15  
    16  You should have received a copy of the GNU Affero General Public License
    17  along with this program.  If not, see <http://www.gnu.org/licenses/>.
    18  */
    19  
    20  package infrastructure
    21  
    22  import (
    23  	"github.com/kubesphere/kubekey/v3/cmd/kk/pkg/bootstrap/os"
    24  	"github.com/kubesphere/kubekey/v3/cmd/kk/pkg/bootstrap/precheck"
    25  	"github.com/kubesphere/kubekey/v3/cmd/kk/pkg/certs"
    26  	"github.com/kubesphere/kubekey/v3/cmd/kk/pkg/container"
    27  	"github.com/kubesphere/kubekey/v3/cmd/kk/pkg/core/module"
    28  	"github.com/kubesphere/kubekey/v3/cmd/kk/pkg/etcd"
    29  	"github.com/kubesphere/kubekey/v3/cmd/kk/pkg/filesystem"
    30  	"github.com/kubesphere/kubekey/v3/cmd/kk/pkg/kubernetes"
    31  	"github.com/kubesphere/kubekey/v3/cmd/kk/pkg/plugins/dns"
    32  	"github.com/kubesphere/kubekey/v3/cmd/kk/pkg/plugins/network"
    33  
    34  	"github.com/1aal/kubeblocks/pkg/cli/cmd/infrastructure/tasks"
    35  )
    36  
    37  func NewCreatePipeline(o *createOptions) []module.Module {
    38  	return []module.Module{
    39  		&precheck.GreetingsModule{},
    40  		&tasks.CheckNodeArchitectureModule{},
    41  		&precheck.NodePreCheckModule{},
    42  		&tasks.InstallDependenciesModule{},
    43  		&tasks.PrepareK8sBinariesModule{BinaryVersion: o.version},
    44  		&tasks.ConfigureNodeOSModule{Nodes: o.Nodes},
    45  		&kubernetes.StatusModule{},
    46  		&tasks.InstallCRIModule{SandBoxImage: o.Cluster.Kubernetes.CRI.SandBoxImage},
    47  		&etcd.PreCheckModule{},
    48  		&etcd.CertsModule{},
    49  		&etcd.InstallETCDBinaryModule{},
    50  		&etcd.ConfigureModule{},
    51  		&etcd.BackupModule{},
    52  		&kubernetes.InstallKubeBinariesModule{},
    53  		&kubernetes.InitKubernetesModule{},
    54  		&dns.ClusterDNSModule{},
    55  		&kubernetes.StatusModule{},
    56  		&tasks.SaveKubeConfigModule{OutputKubeconfig: o.outputKubeconfig},
    57  		&kubernetes.JoinNodesModule{},
    58  		&network.DeployNetworkPluginModule{},
    59  		&kubernetes.ConfigureKubernetesModule{},
    60  		&filesystem.ChownModule{},
    61  		&kubernetes.SecurityEnhancementModule{Skip: !o.securityEnhancement},
    62  		&tasks.AddonsInstaller{Addons: o.Addons, Kubeconfig: o.outputKubeconfig},
    63  	}
    64  }
    65  
    66  func NewDeletePipeline(o *deleteOptions) []module.Module {
    67  	return []module.Module{
    68  		&precheck.GreetingsModule{},
    69  		&kubernetes.ResetClusterModule{},
    70  		&container.UninstallContainerModule{Skip: !o.deleteCRI},
    71  		&os.ClearOSEnvironmentModule{},
    72  		&certs.UninstallAutoRenewCertsModule{},
    73  	}
    74  }