diff --git a/cmd/kk/apis/kubekey/v1alpha2/cluster_types.go b/cmd/kk/apis/kubekey/v1alpha2/cluster_types.go index 1a304e15..13b1e2dc 100644 --- a/cmd/kk/apis/kubekey/v1alpha2/cluster_types.go +++ b/cmd/kk/apis/kubekey/v1alpha2/cluster_types.go @@ -92,6 +92,7 @@ type CustomScripts struct { // System defines the system config for each node in cluster. type System struct { + Initials []CustomScripts `yaml:"initials" json:"initials,omitempty"` NtpServers []string `yaml:"ntpServers" json:"ntpServers,omitempty"` Timezone string `yaml:"timezone" json:"timezone,omitempty"` Rpms []string `yaml:"rpms" json:"rpms,omitempty"` diff --git a/cmd/kk/pkg/pipelines/create_cluster.go b/cmd/kk/pkg/pipelines/create_cluster.go index cfe31a3b..fcf7c7e4 100644 --- a/cmd/kk/pkg/pipelines/create_cluster.go +++ b/cmd/kk/pkg/pipelines/create_cluster.go @@ -58,6 +58,7 @@ func NewCreateClusterPipeline(runtime *common.KubeRuntime) error { m := []module.Module{ &precheck.GreetingsModule{}, + &customscripts.CustomScriptsModule{Phase: "Initial", Scripts: runtime.Cluster.System.Initials}, &precheck.NodePreCheckModule{}, &confirm.InstallConfirmModule{}, &artifact.UnArchiveModule{Skip: noArtifact}, diff --git a/docs/config-example.md b/docs/config-example.md index 54dce754..479cb5c6 100644 --- a/docs/config-example.md +++ b/docs/config-example.md @@ -42,7 +42,16 @@ spec: # Specify additional packages to be installed. The ISO file which is contained in the artifact is required. debs: - nfs-common - #preInstall: # Specify custom init shell scripts for each nodes, and execute according to the list order. + # initials: + # - name: Install hd tool + # bash: curl https://gitee.com/linuxsuren/tools/raw/master/install-zh.sh|bash + # - name: Install packages + # bash: | + # hd setup --proxy ghproxy.com --provider gitee + # hd i chrony + # hd i conntrack + # hd i socat + #preInstall: # Specify custom init shell scripts for each nodes, and execute according to the list order before install container runtime. # - name: format and mount disk # bash: /bin/bash -x setup-disk.sh # materials: # scripts can has some dependency materials. those will copy to the node