1
0
mirror of https://github.com/rancher/rke.git synced 2025-09-03 07:54:14 +00:00

Revert "changes around hostname-override"

This reverts commit f44be421a1.
This commit is contained in:
Kinara Shah
2023-01-23 15:49:09 -08:00
parent 0dc41477c9
commit b5ab4b02ab
5 changed files with 11 additions and 22 deletions

View File

@@ -157,7 +157,6 @@ var (
}
DefaultClusterProportionalAutoscalerLinearParams = v3.LinearAutoscalerParams{CoresPerReplica: 128, NodesPerReplica: 4, Min: 1, PreventSinglePointFailure: true}
DefaultMonitoringAddonReplicas = int32(1)
defaultUseInstanceMetadataHostname = false
)
type ExternalFlags struct {
@@ -264,10 +263,6 @@ func (c *Cluster) setClusterDefaults(ctx context.Context, flags ExternalFlags) e
c.ForceDeployCerts = true
}
if c.CloudProvider.Name == k8s.AWSCloudProvider && c.CloudProvider.UseInstanceMetadataHostname == nil {
c.CloudProvider.UseInstanceMetadataHostname = &defaultUseInstanceMetadataHostname
}
// enable cri-dockerd for k8s >= 1.24
err = c.setCRIDockerd()
if err != nil {

View File

@@ -463,7 +463,6 @@ func (c *Cluster) BuildKubeletProcess(host *hosts.Host, serviceOptions v3.Kubern
"cluster-dns": c.ClusterDNSServer,
"cluster-domain": c.ClusterDomain,
"fail-swap-on": strconv.FormatBool(kubelet.FailSwapOn),
// overrides kubernetes.io/hostname label on node, rke uses it to find node (services/node_util.go)
"hostname-override": host.HostnameOverride,
"kubeconfig": pki.GetConfigPath(pki.KubeNodeCertName),
"pod-infra-container-image": kubelet.InfraContainerImage,
@@ -491,6 +490,9 @@ func (c *Cluster) BuildKubeletProcess(host *hosts.Host, serviceOptions v3.Kubern
if host.IsWindows() { // compatible with Windows
CommandArgs["cloud-config"] = path.Join(host.PrefixPath, cloudConfigFileName)
}
if c.CloudProvider.Name == k8s.AWSCloudProvider {
delete(CommandArgs, "hostname-override")
}
}
if c.IsKubeletGenerateServingCertificateEnabled() {
@@ -688,8 +690,7 @@ func (c *Cluster) BuildKubeProxyProcess(host *hosts.Host, serviceOptions v3.Kube
} else {
CommandArgs["bind-address"] = host.Address
}
if c.CloudProvider.Name == k8s.AWSCloudProvider && c.CloudProvider.UseInstanceMetadataHostname != nil && *c.CloudProvider.UseInstanceMetadataHostname {
// rke-tools will inject hostname-override from ec2 instance metadata to match with the spec.nodeName set by cloud provider https://github.com/rancher/rke-tools/blob/3eab4f07aa97a8aeeaaef55b1b7bbc82e2a3374a/entrypoint.sh#L17
if c.CloudProvider.Name == k8s.AWSCloudProvider {
delete(CommandArgs, "hostname-override")
}
}

View File

@@ -2,7 +2,7 @@
// +build !ignore_autogenerated
/*
Copyright 2023 Rancher Labs, Inc.
Copyright 2022 Rancher Labs, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

View File

@@ -554,8 +554,6 @@ type PortCheck struct {
type CloudProvider struct {
// Name of the Cloud Provider
Name string `yaml:"name" json:"name,omitempty"`
// Only configured for AWS currently, add for other providers as needed
UseInstanceMetadataHostname *bool ` yaml:"useInstanceMetadataHostname,omitempty" json:"useInstanceMetadataHostname,omitempty"`
// AWSCloudProvider
AWSCloudProvider *AWSCloudProvider `yaml:"awsCloudProvider,omitempty" json:"awsCloudProvider,omitempty"`
// AzureCloudProvider

View File

@@ -2,7 +2,7 @@
// +build !ignore_autogenerated
/*
Copyright 2023 Rancher Labs, Inc.
Copyright 2022 Rancher Labs, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -400,11 +400,6 @@ func (in *CanalNetworkProvider) DeepCopy() *CanalNetworkProvider {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CloudProvider) DeepCopyInto(out *CloudProvider) {
*out = *in
if in.UseInstanceMetadataHostname != nil {
in, out := &in.UseInstanceMetadataHostname, &out.UseInstanceMetadataHostname
*out = new(bool)
**out = **in
}
if in.AWSCloudProvider != nil {
in, out := &in.AWSCloudProvider, &out.AWSCloudProvider
*out = new(AWSCloudProvider)