Skip to content

Commit

Permalink
fix: yurtadm join ignorePreflightErrors could not set all (#1837)
Browse files Browse the repository at this point in the history
Signed-off-by: Liang Deng <[email protected]>
  • Loading branch information
YTGhost authored Dec 7, 2023
1 parent bb12e2d commit 6791cc1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/yurtadm/cmd/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions pkg/yurtadm/cmd/join/join.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions pkg/yurtadm/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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}}
Expand Down

0 comments on commit 6791cc1

Please sign in to comment.