From e4ea03ae2a8deb9bffc481bd882f5f52b162a569 Mon Sep 17 00:00:00 2001 From: Luke Bond Date: Tue, 3 Oct 2023 01:52:16 +0100 Subject: [PATCH] chore: add kube scheduler server args & plumb through to config (#54) --- bootstrap/api/v1beta1/kthreesconfig_types.go | 4 ++++ .../bases/bootstrap.cluster.x-k8s.io_kthreesconfigs.yaml | 6 ++++++ .../bootstrap.cluster.x-k8s.io_kthreesconfigtemplates.yaml | 6 ++++++ .../controlplane.cluster.x-k8s.io_kthreescontrolplanes.yaml | 6 ++++++ pkg/k3s/config.go | 3 +++ 5 files changed, 25 insertions(+) diff --git a/bootstrap/api/v1beta1/kthreesconfig_types.go b/bootstrap/api/v1beta1/kthreesconfig_types.go index 1f60e0e2..ff890fa7 100644 --- a/bootstrap/api/v1beta1/kthreesconfig_types.go +++ b/bootstrap/api/v1beta1/kthreesconfig_types.go @@ -60,6 +60,10 @@ type KThreesServerConfig struct { // +optional KubeControllerManagerArgs []string `json:"kubeControllerManagerArgs,omitempty"` + // KubeSchedulerArgs is a customized flag for kube-scheduler process + // +optional + KubeSchedulerArgs []string `json:"kubeSchedulerArgs,omitempty"` + // TLSSan Add additional hostname or IP as a Subject Alternative Name in the TLS cert // +optional TLSSan []string `json:"tlsSan,omitempty"` diff --git a/bootstrap/config/crd/bases/bootstrap.cluster.x-k8s.io_kthreesconfigs.yaml b/bootstrap/config/crd/bases/bootstrap.cluster.x-k8s.io_kthreesconfigs.yaml index 7e770a8a..d460c976 100644 --- a/bootstrap/config/crd/bases/bootstrap.cluster.x-k8s.io_kthreesconfigs.yaml +++ b/bootstrap/config/crd/bases/bootstrap.cluster.x-k8s.io_kthreesconfigs.yaml @@ -181,6 +181,12 @@ spec: items: type: string type: array + kubeSchedulerArgs: + description: KubeSchedulerArgs is a customized flag for kube-scheduler + process + items: + type: string + type: array serviceCidr: description: 'ServiceCidr Network CIDR to use for services IPs (default: "10.43.0.0/16")' diff --git a/bootstrap/config/crd/bases/bootstrap.cluster.x-k8s.io_kthreesconfigtemplates.yaml b/bootstrap/config/crd/bases/bootstrap.cluster.x-k8s.io_kthreesconfigtemplates.yaml index 37dcc7f8..26d64972 100644 --- a/bootstrap/config/crd/bases/bootstrap.cluster.x-k8s.io_kthreesconfigtemplates.yaml +++ b/bootstrap/config/crd/bases/bootstrap.cluster.x-k8s.io_kthreesconfigtemplates.yaml @@ -196,6 +196,12 @@ spec: items: type: string type: array + kubeSchedulerArgs: + description: KubeSchedulerArgs is a customized flag for + kube-scheduler process + items: + type: string + type: array serviceCidr: description: 'ServiceCidr Network CIDR to use for services IPs (default: "10.43.0.0/16")' diff --git a/bootstrap/config/crd/bases/controlplane.cluster.x-k8s.io_kthreescontrolplanes.yaml b/bootstrap/config/crd/bases/controlplane.cluster.x-k8s.io_kthreescontrolplanes.yaml index 88519ed1..296bd5ef 100644 --- a/bootstrap/config/crd/bases/controlplane.cluster.x-k8s.io_kthreescontrolplanes.yaml +++ b/bootstrap/config/crd/bases/controlplane.cluster.x-k8s.io_kthreescontrolplanes.yaml @@ -262,6 +262,12 @@ spec: items: type: string type: array + kubeSchedulerArgs: + description: KubeSchedulerArgs is a customized flag for kube-scheduler + process + items: + type: string + type: array serviceCidr: description: 'ServiceCidr Network CIDR to use for services IPs (default: "10.43.0.0/16")' diff --git a/pkg/k3s/config.go b/pkg/k3s/config.go index ae365d33..e1013ab8 100644 --- a/pkg/k3s/config.go +++ b/pkg/k3s/config.go @@ -13,6 +13,7 @@ type K3sServerConfig struct { DisableCloudController bool `json:"disable-cloud-controller,omitempty"` KubeAPIServerArgs []string `json:"kube-apiserver-arg,omitempty"` KubeControllerManagerArgs []string `json:"kube-controller-manager-arg,omitempty"` + KubeSchedulerArgs []string `json:"kube-scheduler-arg,omitempty"` TLSSan []string `json:"tls-san,omitempty"` BindAddress string `json:"bind-address,omitempty"` HTTPSListenPort string `json:"https-listen-port,omitempty"` @@ -45,6 +46,7 @@ func GenerateInitControlPlaneConfig(controlPlaneEndpoint string, token string, s KubeAPIServerArgs: append(serverConfig.KubeAPIServerArgs, "anonymous-auth=true", getTLSCipherSuiteArg()), TLSSan: append(serverConfig.TLSSan, controlPlaneEndpoint), KubeControllerManagerArgs: append(serverConfig.KubeControllerManagerArgs, "cloud-provider=external"), + KubeSchedulerArgs: serverConfig.KubeSchedulerArgs, BindAddress: serverConfig.BindAddress, HTTPSListenPort: serverConfig.HTTPSListenPort, AdvertiseAddress: serverConfig.AdvertiseAddress, @@ -75,6 +77,7 @@ func GenerateJoinControlPlaneConfig(serverURL string, token string, controlplane KubeAPIServerArgs: append(serverConfig.KubeAPIServerArgs, "anonymous-auth=true", getTLSCipherSuiteArg()), TLSSan: append(serverConfig.TLSSan, controlplaneendpoint), KubeControllerManagerArgs: append(serverConfig.KubeControllerManagerArgs, "cloud-provider=external"), + KubeSchedulerArgs: serverConfig.KubeSchedulerArgs, BindAddress: serverConfig.BindAddress, HTTPSListenPort: serverConfig.HTTPSListenPort, AdvertiseAddress: serverConfig.AdvertiseAddress,