diff --git a/common/const.go b/common/const.go index 9a9a93f4..38fb4c28 100644 --- a/common/const.go +++ b/common/const.go @@ -157,37 +157,43 @@ ExecStartPre=-/sbin/modprobe overlay ExecStart=/usr/local/bin/k3s \ {{- if .TypeMaster}} server \ - --tls-san kubeapi.corp.cc \ - --tls-san apiserver.cluster.local \ - --tls-san {{ .KubeAPI }} \ - {{if .PodCIDR }}--cluster-cidr {{ .PodCIDR }} \ {{end}} - {{if .ServiceCIDR }}--service-cidr {{ .ServiceCIDR }} \ {{end}} - {{if .CNI }}--flannel-backend {{ .CNI }} \ {{ end }} + --tls-san kubeapi.corp.cc \ + --tls-san apiserver.cluster.local \ + --tls-san {{ .KubeAPI }} \ + {{if .PodCIDR }} + --cluster-cidr {{ .PodCIDR }} \ + {{end}} + {{if .ServiceCIDR }} + --service-cidr {{ .ServiceCIDR }} \ + {{end}} + {{if .CNI }} + --flannel-backend {{ .CNI }} \ + {{ end }} {{- if .DataStore }} - --datastore-endpoint {{ .DataStore }} \ + --datastore-endpoint {{ .DataStore }} \ {{- else}} {{if not .Master0 -}} - --server https://{{ .KubeAPI }}:6443 \ - {{ end -}} - --cluster-init \ - --etcd-expose-metrics \ - --etcd-snapshot-name auto-snapshot \ - --etcd-snapshot-compress \ + --server https://{{ .KubeAPI }}:6443 \ + {{ end }} + --cluster-init \ + --etcd-expose-metrics \ + --etcd-snapshot-name auto-snapshot \ + --etcd-snapshot-compress \ {{- end}} - --disable-cloud-controller \ - --system-default-registry {{ .Registry }} \ - --disable-network-policy \ - --disable-helm-controller \ - {{if .LocalStorage }}--disable servicelb,traefik \ {{- else }}--disable servicelb,traefik,local-storage \ {{- end }} + --disable-cloud-controller \ + --system-default-registry {{ .Registry }} \ + --disable-network-policy \ + --disable-helm-controller \ + --disable servicelb,traefik,local-storage \ {{- else}} agent \ - --server https://{{ .KubeAPI }}:6443 \ + --server https://{{ .KubeAPI }}:6443 \ {{- end }} - --token {{ .KubeToken }} \ - --data-dir {{.DataDir}} \ - --pause-image {{ .Registry }}/rancher/mirrored-pause:3.6 \ - --prefer-bundled-bin \ - --kube-proxy-arg "proxy-mode=ipvs" "masquerade-all=true" \ - --kube-proxy-arg "metrics-bind-address=0.0.0.0" \ - --docker + --token {{ .KubeToken }} \ + --data-dir {{.DataDir}} \ + --pause-image {{ .Registry }}/rancher/mirrored-pause:3.6 \ + --prefer-bundled-bin \ + --kube-proxy-arg "proxy-mode=ipvs" "masquerade-all=true" \ + --kube-proxy-arg "metrics-bind-address=0.0.0.0" \ + --docker ` diff --git a/hack/manifests/scripts/cleankube.sh b/hack/manifests/scripts/cleankube.sh index a8079fb0..2e0b14a5 100755 --- a/hack/manifests/scripts/cleankube.sh +++ b/hack/manifests/scripts/cleankube.sh @@ -140,6 +140,7 @@ datadir=$(cat /root/.qc/config/cluster.yaml | grep datadir | awk '{print $2}') [ ! -z "$datadir" ] && rm -rf $datadir [ -d "/etc/rancher/k3s" ] && rm -rf /etc/rancher/k3s +[ -d "/etc/rancher/node" ] && rm -rf /etc/rancher/node [ -d "/run/k3s" ] && rm -rf /run/k3s [ -d "/run/flannel" ] && rm -rf /run/flannel [ -d "/var/lib/rancher/k3s" ] && rm -rf /var/lib/rancher/k3s diff --git a/hack/manifests/scripts/node.sh b/hack/manifests/scripts/node.sh index 17dcb897..8c88a734 100755 --- a/hack/manifests/scripts/node.sh +++ b/hack/manifests/scripts/node.sh @@ -44,6 +44,7 @@ check_docker() { which_cmd=$(command -v docker 2>/dev/null || true) if [ -z "${which_cmd}" ]; then sed -i "s#--docker \\\##g" /root/.k3s.service + sed -i "s#--docker##g" /root/.k3s.service fi } diff --git a/internal/pkg/cli/k3stpl/k3stpl.go b/internal/pkg/cli/k3stpl/k3stpl.go index 04fb5bd1..26ef4d8f 100644 --- a/internal/pkg/cli/k3stpl/k3stpl.go +++ b/internal/pkg/cli/k3stpl/k3stpl.go @@ -96,7 +96,6 @@ func EmbedCommand(f factory.Factory) *cobra.Command { rootCmd.Flags().BoolVar(&k3sargs.LocalStorage, "local-storage", true, "local-storage") rootCmd.Flags().StringVar(&k3sargs.Master0IP, "master0ip", "", "master0ip, only work offline mode") rootCmd.Flags().StringVar(&k3sargs.Registry, "registry", "hub.zentao.net", "registry") - rootCmd.Flags().StringVar(&k3sargs.DataStore, "datasource", "", "datasource") rootCmd.Flags().StringVar(&k3sargs.CNI, "cni", "", "cni") return rootCmd }