Skip to content

Commit

Permalink
Reverse the flag
Browse files Browse the repository at this point in the history
  • Loading branch information
anmazzotti committed Oct 11, 2023
1 parent 4d38b56 commit 926705a
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 29 deletions.
4 changes: 2 additions & 2 deletions bootstrap/api/v1beta1/kthreesconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ type KThreesServerConfig struct {
// +optional
DisableComponents []string `json:"disableComponents,omitempty"`

// UseExternalCloudProvider adds the 'cloud-provider=external' kubelet argument. (default: false)
// DisableExternalCloudProvider suppresses the 'cloud-provider=external' kubelet argument. (default: false)
// +optional
UseExternalCloudProvider bool `json:"useExternalCloudProvider,omitempty"`
DisableExternalCloudProvider bool `json:"disableExternalCloudProvider,omitempty"`
}

type KThreesAgentConfig struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ spec:
items:
type: string
type: array
disableExternalCloudProvider:
description: 'DisableExternalCloudProvider suppresses the ''cloud-provider=external''
kubelet argument. (default: false)'
type: boolean
httpsListenPort:
description: 'HTTPSListenPort HTTPS listen port (default: 6443)'
type: string
Expand Down Expand Up @@ -197,10 +201,6 @@ spec:
items:
type: string
type: array
useExternalCloudProvider:
description: 'UseExternalCloudProvider adds the ''cloud-provider=external''
kubelet argument. (default: false)'
type: boolean
type: object
version:
description: Version specifies the k3s version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ spec:
items:
type: string
type: array
disableExternalCloudProvider:
description: 'DisableExternalCloudProvider suppresses
the ''cloud-provider=external'' kubelet argument. (default:
false)'
type: boolean
httpsListenPort:
description: 'HTTPSListenPort HTTPS listen port (default:
6443)'
Expand Down Expand Up @@ -212,10 +217,6 @@ spec:
items:
type: string
type: array
useExternalCloudProvider:
description: 'UseExternalCloudProvider adds the ''cloud-provider=external''
kubelet argument. (default: false)'
type: boolean
type: object
version:
description: Version specifies the k3s version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,11 @@ spec:
items:
type: string
type: array
disableExternalCloudProvider:
description: 'DisableExternalCloudProvider suppresses the
''cloud-provider=external'' kubelet argument. (default:
false)'
type: boolean
httpsListenPort:
description: 'HTTPSListenPort HTTPS listen port (default:
6443)'
Expand Down Expand Up @@ -278,10 +283,6 @@ spec:
items:
type: string
type: array
useExternalCloudProvider:
description: 'UseExternalCloudProvider adds the ''cloud-provider=external''
kubelet argument. (default: false)'
type: boolean
type: object
version:
description: Version specifies the k3s version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ spec:
items:
type: string
type: array
disableExternalCloudProvider:
description: 'DisableExternalCloudProvider suppresses the ''cloud-provider=external''
kubelet argument. (default: false)'
type: boolean
httpsListenPort:
description: 'HTTPSListenPort HTTPS listen port (default: 6443)'
type: string
Expand Down Expand Up @@ -197,10 +201,6 @@ spec:
items:
type: string
type: array
useExternalCloudProvider:
description: 'UseExternalCloudProvider adds the ''cloud-provider=external''
kubelet argument. (default: false)'
type: boolean
type: object
version:
description: Version specifies the k3s version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ spec:
items:
type: string
type: array
disableExternalCloudProvider:
description: 'DisableExternalCloudProvider suppresses
the ''cloud-provider=external'' kubelet argument. (default:
false)'
type: boolean
httpsListenPort:
description: 'HTTPSListenPort HTTPS listen port (default:
6443)'
Expand Down Expand Up @@ -212,10 +217,6 @@ spec:
items:
type: string
type: array
useExternalCloudProvider:
description: 'UseExternalCloudProvider adds the ''cloud-provider=external''
kubelet argument. (default: false)'
type: boolean
type: object
version:
description: Version specifies the k3s version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,11 @@ spec:
items:
type: string
type: array
disableExternalCloudProvider:
description: 'DisableExternalCloudProvider suppresses the
''cloud-provider=external'' kubelet argument. (default:
false)'
type: boolean
httpsListenPort:
description: 'HTTPSListenPort HTTPS listen port (default:
6443)'
Expand Down Expand Up @@ -278,10 +283,6 @@ spec:
items:
type: string
type: array
useExternalCloudProvider:
description: 'UseExternalCloudProvider adds the ''cloud-provider=external''
kubelet argument. (default: false)'
type: boolean
type: object
version:
description: Version specifies the k3s version
Expand Down
6 changes: 3 additions & 3 deletions pkg/k3s/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type K3sAgentConfig struct {
func GenerateInitControlPlaneConfig(controlPlaneEndpoint string, token string, serverConfig bootstrapv1.KThreesServerConfig, agentConfig bootstrapv1.KThreesAgentConfig) K3sServerConfig {
kubeletExtraArgs := getKubeletExtraArgs(serverConfig)
k3sServerConfig := K3sServerConfig{
DisableCloudController: serverConfig.UseExternalCloudProvider,
DisableCloudController: !serverConfig.DisableExternalCloudProvider,
ClusterInit: true,
KubeAPIServerArgs: append(serverConfig.KubeAPIServerArgs, "anonymous-auth=true", getTLSCipherSuiteArg()),
TLSSan: append(serverConfig.TLSSan, controlPlaneEndpoint),
Expand Down Expand Up @@ -75,7 +75,7 @@ func GenerateInitControlPlaneConfig(controlPlaneEndpoint string, token string, s
func GenerateJoinControlPlaneConfig(serverURL string, token string, controlplaneendpoint string, serverConfig bootstrapv1.KThreesServerConfig, agentConfig bootstrapv1.KThreesAgentConfig) K3sServerConfig {
kubeletExtraArgs := getKubeletExtraArgs(serverConfig)
k3sServerConfig := K3sServerConfig{
DisableCloudController: serverConfig.UseExternalCloudProvider,
DisableCloudController: !serverConfig.DisableExternalCloudProvider,
KubeAPIServerArgs: append(serverConfig.KubeAPIServerArgs, "anonymous-auth=true", getTLSCipherSuiteArg()),
TLSSan: append(serverConfig.TLSSan, controlplaneendpoint),
KubeControllerManagerArgs: append(serverConfig.KubeControllerManagerArgs, kubeletExtraArgs...),
Expand Down Expand Up @@ -158,7 +158,7 @@ func getTLSCipherSuiteArg() string {

func getKubeletExtraArgs(serverConfig bootstrapv1.KThreesServerConfig) []string {
kubeletExtraArgs := []string{}
if serverConfig.UseExternalCloudProvider {
if !serverConfig.DisableExternalCloudProvider {
kubeletExtraArgs = append(kubeletExtraArgs, "cloud-provider=external")
}
return kubeletExtraArgs
Expand Down

0 comments on commit 926705a

Please sign in to comment.