mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
add hostname check in kubeadm join: warning log only
Co-authored-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
4f1dd5d2fb
commit
2c89fa4a59
@ -25,6 +25,7 @@ go_library(
|
||||
"//cmd/kubeadm/app/util/runtime:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/net:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/validation:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/version:go_default_library",
|
||||
"//staging/src/k8s.io/component-base/version:go_default_library",
|
||||
"//vendor/github.com/PuerkitoBio/purell:go_default_library",
|
||||
|
@ -38,6 +38,7 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
netutil "k8s.io/apimachinery/pkg/util/net"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
"k8s.io/apimachinery/pkg/util/validation"
|
||||
versionutil "k8s.io/apimachinery/pkg/util/version"
|
||||
kubeadmversion "k8s.io/component-base/version"
|
||||
"k8s.io/klog/v2"
|
||||
@ -402,8 +403,12 @@ func (HostnameCheck) Name() string {
|
||||
}
|
||||
|
||||
// Check validates if hostname match dns sub domain regex.
|
||||
// Check hostname length and format
|
||||
func (hc HostnameCheck) Check() (warnings, errorList []error) {
|
||||
klog.V(1).Infoln("checking whether the given node name is reachable using net.LookupHost")
|
||||
klog.V(1).Infoln("checking whether the given node name is valid and reachable using net.LookupHost")
|
||||
for _, msg := range validation.IsQualifiedName(hc.nodeName) {
|
||||
warnings = append(warnings, errors.Errorf("invalid node name format %q: %s", hc.nodeName, msg))
|
||||
}
|
||||
|
||||
addr, err := net.LookupHost(hc.nodeName)
|
||||
if addr == nil {
|
||||
|
Loading…
Reference in New Issue
Block a user