From 5c9f3375f3cbe84b70c3ac7b4141e4b03a93d846 Mon Sep 17 00:00:00 2001 From: Pablo Acevedo Montserrat Date: Tue, 7 Mar 2023 13:46:24 +0100 Subject: [PATCH] OCPBUGS-8411: Use lower case node names only While hostnames may have whatever case is desired by the user, resources in kubernetes must be lower case. Node name was directly copied from the hostname, resulting in upper case characters, if any. This prevents creation of the node and many other interactions between kubelet and apiserver. --- pkg/config/config.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index a67d9a330c..1922b55a4e 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -215,7 +215,7 @@ func NewMicroshiftConfig() *MicroshiftConfig { return &MicroshiftConfig{ LogVLevel: 2, SubjectAltNames: subjectAltNames, - NodeName: nodeName, + NodeName: strings.ToLower(nodeName), NodeIP: nodeIP, BaseDomain: "example.com", Cluster: ClusterConfig{ @@ -233,7 +233,7 @@ func (c *MicroshiftConfig) isDefaultNodeName() bool { if err != nil { klog.Fatalf("Failed to get hostname %v", err) } - return c.NodeName == hostname + return c.NodeName == strings.ToLower(hostname) } // Read or set the NodeName that will be used for this MicroShift instance @@ -357,7 +357,7 @@ func (c *MicroshiftConfig) ReadFromConfigFile(configFile string) error { // Wire new Config type to existing MicroshiftConfig c.LogVLevel = config.GetVerbosity() if config.Node.HostnameOverride != "" { - c.NodeName = config.Node.HostnameOverride + c.NodeName = strings.ToLower(config.Node.HostnameOverride) } if config.Node.NodeIP != "" { c.NodeIP = config.Node.NodeIP