From cc04a436b0086824d52f3b2be15665a2b9f13599 Mon Sep 17 00:00:00 2001 From: Pablo Acevedo Montserrat Date: Tue, 7 Mar 2023 13:46:24 +0100 Subject: [PATCH 1/2] 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 From a7a181cb9d501ac5b2a965ef87e8bdf1911cb4cb Mon Sep 17 00:00:00 2001 From: czm Date: Wed, 8 Mar 2023 19:56:13 +0800 Subject: [PATCH 2/2] Revert "OCPBUGS-8411: Use lower case node names only" This reverts commit cc04a436b0086824d52f3b2be15665a2b9f13599. --- 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 1922b55a4e..a67d9a330c 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: strings.ToLower(nodeName), + NodeName: 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 == strings.ToLower(hostname) + return c.NodeName == 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 = strings.ToLower(config.Node.HostnameOverride) + c.NodeName = config.Node.HostnameOverride } if config.Node.NodeIP != "" { c.NodeIP = config.Node.NodeIP