Skip to content

Commit 2e75970

Browse files
authored
fix: no run configure OS in exist node (#3068)
Signed-off-by: redscholar <[email protected]>
1 parent 7a884a4 commit 2e75970

5 files changed

Lines changed: 18 additions & 6 deletions

File tree

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,6 @@ _artifacts
3535

3636
# Used during parts of the build process. Files _should_ get cleaned up automatically.
3737
# This is also a good location for any temporary manfiests used during development
38-
tmp
38+
tmp
39+
_output
40+
skills

cmd/kk/pkg/bootstrap/os/module.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"github.com/kubesphere/kubekey/v3/cmd/kk/pkg/core/prepare"
2626
"github.com/kubesphere/kubekey/v3/cmd/kk/pkg/core/task"
2727
"github.com/kubesphere/kubekey/v3/cmd/kk/pkg/core/util"
28+
"github.com/kubesphere/kubekey/v3/cmd/kk/pkg/kubernetes"
2829
)
2930

3031
type ConfigureOSModule struct {
@@ -40,10 +41,13 @@ func (c *ConfigureOSModule) Init() {
4041
c.Name = "ConfigureOSModule"
4142
c.Desc = "Init os dependencies"
4243

44+
c.PipelineCache.GetOrSet(common.ClusterStatus, kubernetes.NewKubernetesStatus())
45+
4346
getOSData := &task.RemoteTask{
4447
Name: "GetOSData",
4548
Desc: "Get OS release",
4649
Hosts: c.Runtime.GetAllHosts(),
50+
Prepare: &kubernetes.NodeInCluster{Not: true},
4751
Action: new(GetOSData),
4852
Parallel: true,
4953
}
@@ -52,14 +56,16 @@ func (c *ConfigureOSModule) Init() {
5256
Name: "InitOS",
5357
Desc: "Prepare to init OS",
5458
Hosts: c.Runtime.GetAllHosts(),
59+
Prepare: &kubernetes.NodeInCluster{Not: true},
5560
Action: new(NodeConfigureOS),
5661
Parallel: true,
5762
}
5863

5964
GenerateScript := &task.RemoteTask{
60-
Name: "GenerateScript",
61-
Desc: "Generate init os script",
62-
Hosts: c.Runtime.GetAllHosts(),
65+
Name: "GenerateScript",
66+
Desc: "Generate init os script",
67+
Hosts: c.Runtime.GetAllHosts(),
68+
Prepare: &kubernetes.NodeInCluster{Not: true},
6369
Action: &action.Template{
6470
Template: templates.InitOsScriptTmpl,
6571
Dst: filepath.Join(common.KubeScriptDir, "initOS.sh"),
@@ -75,6 +81,7 @@ func (c *ConfigureOSModule) Init() {
7581
Name: "ExecScript",
7682
Desc: "Exec init os script",
7783
Hosts: c.Runtime.GetAllHosts(),
84+
Prepare: &kubernetes.NodeInCluster{Not: true},
7885
Action: new(NodeExecScript),
7986
Parallel: true,
8087
}

cmd/kk/pkg/pipelines/add_nodes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ func NewAddNodesPipeline(runtime *common.KubeRuntime) error {
5252
&artifact.UnArchiveModule{Skip: noArtifact},
5353
&os.RepositoryModule{Skip: noArtifact || !runtime.Arg.InstallPackages},
5454
&binaries.NodeBinariesModule{},
55+
&kubernetes.StatusModule{},
5556
&os.ConfigureOSModule{Skip: runtime.Cluster.System.SkipConfigureOS},
5657
&registry.RegistryCertsModule{Skip: len(runtime.GetHostsByRole(common.Registry)) == 0},
5758
//for one master to multi master kube-vip
5859
&loadbalancer.KubevipModule{Skip: !runtime.Cluster.ControlPlaneEndpoint.IsInternalLBEnabledVip()},
5960
&kubernetes.RestartKubeletModule{},
60-
&kubernetes.StatusModule{},
6161
&container.InstallContainerModule{},
6262
&container.InstallCriDockerdModule{Skip: runtime.Cluster.Kubernetes.ContainerManager != "docker"},
6363
&images.PullModule{Skip: runtime.Arg.SkipPullImages},

cmd/kk/pkg/pipelines/create_cluster.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ func NewCreateClusterPipeline(runtime *common.KubeRuntime) error {
6767
&artifact.UnArchiveModule{Skip: noArtifact},
6868
&os.RepositoryModule{Skip: noArtifact || !runtime.Arg.InstallPackages},
6969
&binaries.NodeBinariesModule{},
70-
&os.ConfigureOSModule{Skip: runtime.Cluster.System.SkipConfigureOS},
7170
&kubernetes.StatusModule{},
71+
&os.ConfigureOSModule{Skip: runtime.Cluster.System.SkipConfigureOS},
7272
&container.InstallContainerModule{},
7373
&container.InstallCriDockerdModule{Skip: runtime.Cluster.Kubernetes.ContainerManager != "docker"},
7474
&images.CopyImagesToRegistryModule{Skip: skipPushImages},

cmd/kk/pkg/pipelines/init_registry.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package pipelines
1818

1919
import (
2020
"fmt"
21+
2122
"github.com/kubesphere/kubekey/v3/cmd/kk/pkg/artifact"
2223
"github.com/kubesphere/kubekey/v3/cmd/kk/pkg/binaries"
2324
"github.com/kubesphere/kubekey/v3/cmd/kk/pkg/bootstrap/os"
@@ -28,6 +29,7 @@ import (
2829
"github.com/kubesphere/kubekey/v3/cmd/kk/pkg/core/module"
2930
"github.com/kubesphere/kubekey/v3/cmd/kk/pkg/core/pipeline"
3031
"github.com/kubesphere/kubekey/v3/cmd/kk/pkg/filesystem"
32+
"github.com/kubesphere/kubekey/v3/cmd/kk/pkg/kubernetes"
3133
"github.com/pkg/errors"
3234
)
3335

@@ -38,6 +40,7 @@ func NewInitRegistryPipeline(runtime *common.KubeRuntime) error {
3840
&precheck.GreetingsModule{},
3941
&artifact.UnArchiveModule{Skip: noArtifact},
4042
&binaries.RegistryPackageModule{},
43+
&kubernetes.StatusModule{},
4144
&os.ConfigureOSModule{Skip: runtime.Cluster.System.SkipConfigureOS},
4245
&registry.RegistryCertsModule{},
4346
&registry.InstallRegistryModule{},

0 commit comments

Comments
 (0)