From c31dd9aaae63744f2919b19d81ede8bc7ce64e43 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 4855f3fc02..c331890b61 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -244,7 +244,7 @@ func NewMicroshiftConfig() *MicroshiftConfig { return &MicroshiftConfig{ LogVLevel: 2, SubjectAltNames: subjectAltNames, - NodeName: nodeName, + NodeName: strings.ToLower(nodeName), NodeIP: nodeIP, BaseDomain: "example.com", Cluster: ClusterConfig{ @@ -269,7 +269,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 @@ -393,7 +393,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