diff --git a/pkg/yurtadm/cmd/config/config.go b/pkg/yurtadm/cmd/config/config.go index 1780c7cd060..7fe7d23db10 100644 --- a/pkg/yurtadm/cmd/config/config.go +++ b/pkg/yurtadm/cmd/config/config.go @@ -90,7 +90,7 @@ func runConfigPrintActionDefaults(out io.Writer, configBytesProc func() (string, func getDefaultNodeConfigBytes() (string, error) { KubeadmJoinDiscoveryFilePath := filepath.Join(constants.KubeletWorkdir, constants.KubeadmJoinDiscoveryFileName) - ignoreErrors := sets.String{} + ignoreErrors := sets.NewString(constants.KubeletConfFileAvailableError, constants.ManifestsDirAvailableError) name, err := edgenode.GetHostname("") if err != nil { return "", err diff --git a/pkg/yurtadm/cmd/join/join.go b/pkg/yurtadm/cmd/join/join.go index bc388dd84aa..d05b9323e0a 100644 --- a/pkg/yurtadm/cmd/join/join.go +++ b/pkg/yurtadm/cmd/join/join.go @@ -279,6 +279,9 @@ func newJoinData(args []string, opt *joinOptions) (*joinData, error) { for i := range opt.ignorePreflightErrors { ignoreErrors.Insert(opt.ignorePreflightErrors[i]) } + if !ignoreErrors.Has("all") { + ignoreErrors.Insert(yurtconstants.KubeletConfFileAvailableError, yurtconstants.ManifestsDirAvailableError) + } // Either use specified nodename or get hostname from OS envs name, err := edgenode.GetHostname(opt.nodeName) diff --git a/pkg/yurtadm/constants/constants.go b/pkg/yurtadm/constants/constants.go index 2aa21459c4e..3db86db21f5 100644 --- a/pkg/yurtadm/constants/constants.go +++ b/pkg/yurtadm/constants/constants.go @@ -116,6 +116,9 @@ const ( // StaticPods flag set the specified static pods on this node want to install StaticPods = "static-pods" + KubeletConfFileAvailableError = "FileAvailable--etc-kubernetes-kubelet.conf" + ManifestsDirAvailableError = "DirAvailable--etc-kubernetes-manifests" + DefaultServerAddr = "https://127.0.0.1:6443" ServerHealthzServer = "127.0.0.1:10267" ServerHealthzURLPath = "/v1/healthz" @@ -178,8 +181,6 @@ nodeRegistration: criSocket: {{.criSocket}} name: {{.name}} ignorePreflightErrors: - - FileAvailable--etc-kubernetes-kubelet.conf - - DirAvailable--etc-kubernetes-manifests {{- range $index, $value := .ignorePreflightErrors}} - {{$value}} {{- end}}