Skip to content

Commit 58d55f3

Browse files
committed
support only etcd
Signed-off-by: pixiake <[email protected]> (cherry picked from commit ea259db) Signed-off-by: pixiake <[email protected]>
1 parent 22971d7 commit 58d55f3

File tree

3 files changed

+69
-46
lines changed

3 files changed

+69
-46
lines changed

cmd/kk/cmd/create/cluster.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ type CreateClusterOptions struct {
4747
Artifact string
4848
InstallPackages bool
4949
WithBuildx bool
50+
OnlyEtcd bool
5051

5152
localStorageChanged bool
5253
}
@@ -114,7 +115,6 @@ func (o *CreateClusterOptions) Run() error {
114115
KubernetesVersion: o.Kubernetes,
115116
KsEnable: o.EnableKubeSphere,
116117
KsVersion: o.KubeSphere,
117-
SkipInstallAddons: o.SkipInstallAddons,
118118
SkipPullImages: o.SkipPullImages,
119119
SkipPushImages: o.SkipPushImages,
120120
SecurityEnhancement: o.SecurityEnhancement,
@@ -125,7 +125,6 @@ func (o *CreateClusterOptions) Run() error {
125125
Artifact: o.Artifact,
126126
InstallPackages: o.InstallPackages,
127127
Namespace: o.CommonOptions.Namespace,
128-
WithBuildx: o.WithBuildx,
129128
}
130129

131130
if o.localStorageChanged {
@@ -141,7 +140,6 @@ func (o *CreateClusterOptions) AddFlags(cmd *cobra.Command) {
141140
cmd.Flags().StringVarP(&o.Kubernetes, "with-kubernetes", "", "", "Specify a supported version of kubernetes")
142141
cmd.Flags().BoolVarP(&o.LocalStorage, "with-local-storage", "", false, "Deploy a local PV provisioner")
143142
cmd.Flags().BoolVarP(&o.EnableKubeSphere, "with-kubesphere", "", false, fmt.Sprintf("Deploy a specific version of kubesphere (default %s)", kubesphere.Latest().Version))
144-
cmd.Flags().BoolVarP(&o.SkipInstallAddons, "skip-install-addons", "", false, "Skip install addons")
145143
cmd.Flags().BoolVarP(&o.SkipPullImages, "skip-pull-images", "", false, "Skip pre pull images")
146144
cmd.Flags().BoolVarP(&o.SkipPushImages, "skip-push-images", "", false, "Skip pre push images")
147145
cmd.Flags().BoolVarP(&o.SecurityEnhancement, "with-security-enhancement", "", false, "Security enhancement")
@@ -150,7 +148,6 @@ func (o *CreateClusterOptions) AddFlags(cmd *cobra.Command) {
150148
`The user defined command to download the necessary binary files. The first param '%s' is output path, the second param '%s', is the URL`)
151149
cmd.Flags().StringVarP(&o.Artifact, "artifact", "a", "", "Path to a KubeKey artifact")
152150
cmd.Flags().BoolVarP(&o.InstallPackages, "with-packages", "", false, "install operation system packages by artifact")
153-
cmd.Flags().BoolVarP(&o.WithBuildx, "with-buildx", "", false, "install buildx when Container runtime is docker")
154151
}
155152

156153
func completionSetting(cmd *cobra.Command) (err error) {

cmd/kk/pkg/common/kube_runtime.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ type Argument struct {
5959
Type string
6060
EtcdUpgrade bool
6161
WithBuildx bool
62+
OnlyEtcd bool
6263
}
6364

6465
func NewKubeRuntime(flag string, arg Argument) (*KubeRuntime, error) {

cmd/kk/pkg/pipelines/create_cluster.go

Lines changed: 67 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -56,48 +56,73 @@ func NewCreateClusterPipeline(runtime *common.KubeRuntime) error {
5656
skipLocalStorage = false
5757
}
5858

59-
m := []module.Module{
60-
&precheck.GreetingsModule{},
61-
&customscripts.CustomScriptsModule{Phase: "PreInstall", Scripts: runtime.Cluster.System.PreInstall},
62-
&precheck.NodePreCheckModule{},
63-
&confirm.InstallConfirmModule{},
64-
&artifact.UnArchiveModule{Skip: noArtifact},
65-
&os.RepositoryModule{Skip: noArtifact || !runtime.Arg.InstallPackages},
66-
&binaries.NodeBinariesModule{},
67-
&os.ConfigureOSModule{Skip: runtime.Cluster.System.SkipConfigureOS},
68-
&kubernetes.StatusModule{},
69-
&container.InstallContainerModule{},
70-
&container.InstallCriDockerdModule{Skip: runtime.Cluster.Kubernetes.ContainerManager != "docker"},
71-
&images.CopyImagesToRegistryModule{Skip: skipPushImages},
72-
&images.PullModule{Skip: runtime.Arg.SkipPullImages},
73-
&etcd.PreCheckModule{Skip: runtime.Cluster.Etcd.Type != kubekeyapiv1alpha2.KubeKey},
74-
&etcd.CertsModule{},
75-
&etcd.InstallETCDBinaryModule{Skip: runtime.Cluster.Etcd.Type != kubekeyapiv1alpha2.KubeKey},
76-
&etcd.ConfigureModule{Skip: runtime.Cluster.Etcd.Type != kubekeyapiv1alpha2.KubeKey},
77-
&etcd.BackupModule{Skip: runtime.Cluster.Etcd.Type != kubekeyapiv1alpha2.KubeKey},
78-
&kubernetes.InstallKubeBinariesModule{},
79-
// init kubeVip on first master
80-
&loadbalancer.KubevipModule{Skip: !runtime.Cluster.ControlPlaneEndpoint.IsInternalLBEnabledVip()},
81-
&kubernetes.InitKubernetesModule{},
82-
&dns.ClusterDNSModule{},
83-
&kubernetes.StatusModule{},
84-
&kubernetes.JoinNodesModule{},
85-
// deploy kubeVip on other masters
86-
&loadbalancer.KubevipModule{Skip: !runtime.Cluster.ControlPlaneEndpoint.IsInternalLBEnabledVip()},
87-
&loadbalancer.HaproxyModule{Skip: !runtime.Cluster.ControlPlaneEndpoint.IsInternalLBEnabled()},
88-
&network.DeployNetworkPluginModule{},
89-
&kubernetes.ConfigureKubernetesModule{},
90-
&filesystem.ChownModule{},
91-
&certs.AutoRenewCertsModule{Skip: !runtime.Cluster.Kubernetes.EnableAutoRenewCerts()},
92-
&kubernetes.SecurityEnhancementModule{Skip: !runtime.Arg.SecurityEnhancement},
93-
&kubernetes.SaveKubeConfigModule{},
94-
&plugins.DeployPluginsModule{},
95-
&customscripts.CustomScriptsModule{Phase: "PostClusterInstall", Scripts: runtime.Cluster.System.PostClusterInstall},
96-
&addons.AddonsModule{Skip: runtime.Arg.SkipInstallAddons},
97-
&storage.DeployLocalVolumeModule{Skip: skipLocalStorage},
98-
&kubesphere.DeployModule{Skip: !runtime.Cluster.KubeSphere.Enabled},
99-
&kubesphere.CheckResultModule{Skip: !runtime.Cluster.KubeSphere.Enabled},
100-
&customscripts.CustomScriptsModule{Phase: "PostInstall", Scripts: runtime.Cluster.System.PostInstall},
59+
m := []module.Module{}
60+
61+
if runtime.Arg.OnlyEtcd {
62+
m = []module.Module{
63+
&precheck.GreetingsModule{},
64+
&customscripts.CustomScriptsModule{Phase: "PreInstall", Scripts: runtime.Cluster.System.PreInstall},
65+
&precheck.NodePreCheckModule{},
66+
&confirm.InstallConfirmModule{},
67+
&artifact.UnArchiveModule{Skip: noArtifact},
68+
&os.RepositoryModule{Skip: noArtifact || !runtime.Arg.InstallPackages},
69+
&binaries.NodeBinariesModule{},
70+
&os.ConfigureOSModule{Skip: runtime.Cluster.System.SkipConfigureOS},
71+
&kubernetes.StatusModule{},
72+
&container.InstallContainerModule{},
73+
&container.InstallCriDockerdModule{Skip: runtime.Cluster.Kubernetes.ContainerManager != "docker"},
74+
&images.CopyImagesToRegistryModule{Skip: skipPushImages},
75+
&images.PullModule{Skip: runtime.Arg.SkipPullImages},
76+
&etcd.PreCheckModule{Skip: runtime.Cluster.Etcd.Type != kubekeyapiv1alpha2.KubeKey},
77+
&etcd.CertsModule{},
78+
&etcd.InstallETCDBinaryModule{Skip: runtime.Cluster.Etcd.Type != kubekeyapiv1alpha2.KubeKey},
79+
&etcd.ConfigureModule{Skip: runtime.Cluster.Etcd.Type != kubekeyapiv1alpha2.KubeKey},
80+
&etcd.BackupModule{Skip: runtime.Cluster.Etcd.Type != kubekeyapiv1alpha2.KubeKey},
81+
}
82+
} else {
83+
m = []module.Module{
84+
&precheck.GreetingsModule{},
85+
&customscripts.CustomScriptsModule{Phase: "PreInstall", Scripts: runtime.Cluster.System.PreInstall},
86+
&precheck.NodePreCheckModule{},
87+
&confirm.InstallConfirmModule{},
88+
&artifact.UnArchiveModule{Skip: noArtifact},
89+
&os.RepositoryModule{Skip: noArtifact || !runtime.Arg.InstallPackages},
90+
&binaries.NodeBinariesModule{},
91+
&os.ConfigureOSModule{Skip: runtime.Cluster.System.SkipConfigureOS},
92+
&kubernetes.StatusModule{},
93+
&container.InstallContainerModule{},
94+
&container.InstallCriDockerdModule{Skip: runtime.Cluster.Kubernetes.ContainerManager != "docker"},
95+
&images.CopyImagesToRegistryModule{Skip: skipPushImages},
96+
&images.PullModule{Skip: runtime.Arg.SkipPullImages},
97+
&etcd.PreCheckModule{Skip: runtime.Cluster.Etcd.Type != kubekeyapiv1alpha2.KubeKey},
98+
&etcd.CertsModule{},
99+
&etcd.InstallETCDBinaryModule{Skip: runtime.Cluster.Etcd.Type != kubekeyapiv1alpha2.KubeKey},
100+
&etcd.ConfigureModule{Skip: runtime.Cluster.Etcd.Type != kubekeyapiv1alpha2.KubeKey},
101+
&etcd.BackupModule{Skip: runtime.Cluster.Etcd.Type != kubekeyapiv1alpha2.KubeKey},
102+
&kubernetes.InstallKubeBinariesModule{},
103+
// init kubeVip on first master
104+
&loadbalancer.KubevipModule{Skip: !runtime.Cluster.ControlPlaneEndpoint.IsInternalLBEnabledVip()},
105+
&kubernetes.InitKubernetesModule{},
106+
&dns.ClusterDNSModule{},
107+
&kubernetes.StatusModule{},
108+
&kubernetes.JoinNodesModule{},
109+
// deploy kubeVip on other masters
110+
&loadbalancer.KubevipModule{Skip: !runtime.Cluster.ControlPlaneEndpoint.IsInternalLBEnabledVip()},
111+
&loadbalancer.HaproxyModule{Skip: !runtime.Cluster.ControlPlaneEndpoint.IsInternalLBEnabled()},
112+
&network.DeployNetworkPluginModule{},
113+
&kubernetes.ConfigureKubernetesModule{},
114+
&filesystem.ChownModule{},
115+
&certs.AutoRenewCertsModule{Skip: !runtime.Cluster.Kubernetes.EnableAutoRenewCerts()},
116+
&kubernetes.SecurityEnhancementModule{Skip: !runtime.Arg.SecurityEnhancement},
117+
&kubernetes.SaveKubeConfigModule{},
118+
&plugins.DeployPluginsModule{},
119+
&customscripts.CustomScriptsModule{Phase: "PostClusterInstall", Scripts: runtime.Cluster.System.PostClusterInstall},
120+
&addons.AddonsModule{Skip: runtime.Arg.SkipInstallAddons},
121+
&storage.DeployLocalVolumeModule{Skip: skipLocalStorage},
122+
&kubesphere.DeployModule{Skip: !runtime.Cluster.KubeSphere.Enabled},
123+
&kubesphere.CheckResultModule{Skip: !runtime.Cluster.KubeSphere.Enabled},
124+
&customscripts.CustomScriptsModule{Phase: "PostInstall", Scripts: runtime.Cluster.System.PostInstall},
125+
}
101126
}
102127

103128
p := pipeline.Pipeline{

0 commit comments

Comments
 (0)