Skip to content

Commit d807014

Browse files
xmudriisteledkron4egmohamed-rafraf
authored
[release/v1.9] Cherry-pick the required fixes for the release/v1.9 branch (#3547)
* feat: add flag to skip TLS verification (#3522) * feat: add flag to skip TLS verification Signed-off-by: Stephan <[email protected]> * Update addons/backups-restic/backups-restic.yaml Co-authored-by: Artiom Diomin <[email protected]> Signed-off-by: Stephan <[email protected]> --------- Signed-off-by: Stephan <[email protected]> Co-authored-by: Artiom Diomin <[email protected]> * fix cloud config defaulting before terraform config apply (#3534) * Make sure no slash at the end of vcenterPrefix (#3537) Signed-off-by: Artiom Diomin <[email protected]> * Fix kubevirt csi addon template (#3529) * fix kubevirt csi addon template * update internal images in template * update internal images in template * fix labels * update addons * update addons sa * fix toleration (#3545) * update Machine controller image (#3546) * update Machine controller image Signed-off-by: Mohamed Rafraf <[email protected]> * update go.mod --------- Signed-off-by: Mohamed Rafraf <[email protected]> * labeling control-plane before (#3544) --------- Signed-off-by: Stephan <[email protected]> Signed-off-by: Artiom Diomin <[email protected]> Signed-off-by: Mohamed Rafraf <[email protected]> Co-authored-by: Stephan <[email protected]> Co-authored-by: Artiom Diomin <[email protected]> Co-authored-by: Mohamed Rafraf <[email protected]> Co-authored-by: Artiom Diomin <[email protected]>
1 parent 9ae498e commit d807014

File tree

11 files changed

+67
-84
lines changed

11 files changed

+67
-84
lines changed

addons/backups-restic/backups-restic.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ spec:
100100
cp -a /etc/kubernetes/pki/front-proxy-ca.key /backup/pki/kubernetes
101101
cp -a /etc/kubernetes/pki/sa.key /backup/pki/kubernetes
102102
cp -a /etc/kubernetes/pki/sa.pub /backup/pki/kubernetes
103-
restic snapshots -q || restic init -q
104-
restic backup --tag=etcd --host=${ETCD_HOSTNAME} /backup
105-
restic forget --prune --keep-last 48
103+
restic snapshots {{- with .Params.commonFlags }} {{.}}{{ end }} -q || restic init {{- with .Params.commonFlags }} {{.}}{{ end }} -q
104+
restic backup {{- with .Params.commonFlags }} {{.}}{{ end }} --tag=etcd --host=${ETCD_HOSTNAME} /backup
105+
restic forget {{- with .Params.commonFlags }} {{.}}{{ end }} --prune --keep-last 48
106106
env:
107107
- name: ETCD_HOSTNAME
108108
valueFrom:

addons/csi-kubevirt/1-kubevirt-csi-driver.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ apiVersion: v1
6161
kind: ConfigMap
6262
metadata:
6363
name: driver-config
64-
namespace: kubevirt-csi-driver
64+
namespace: kube-system
6565
data:
6666
{{ with .Config.CloudProvider.Kubevirt -}}
6767
{{ with .InfraNamespace }}
@@ -96,7 +96,7 @@ spec:
9696
privileged: true
9797
allowPrivilegeEscalation: true
9898
imagePullPolicy: Always
99-
image: '{{ .InternalImages.Get "KubeVirtCSIDriver" }}'
99+
image: '{{ .InternalImages.Get "KubeVirtCSI" }}'
100100
args:
101101
- "--endpoint=unix:/csi/csi.sock"
102102
- "--node-name=$(KUBE_NODE_NAME)"
@@ -159,7 +159,7 @@ spec:
159159
memory: 20Mi
160160
cpu: 5m
161161
- name: csi-liveness-probe
162-
image: '{{ .InternalImages.Get "KubeVirtCSILivenessprobe" }}'
162+
image: '{{ .InternalImages.Get "KubeVirtCSILivenessProbe" }}'
163163
args:
164164
- "--csi-address=/csi/csi.sock"
165165
- "--probe-timeout=3s"

addons/csi-kubevirt/2-kubevirt-csi-controller.yaml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ data:
7979
value: "{{ . }}"
8080
kind: Secret
8181
metadata:
82-
labels:
82+
labels:
8383
app: kubevirt-csi-driver
8484
name: infra-kubeconfig
8585
namespace: kube-system
@@ -104,11 +104,14 @@ spec:
104104
labels:
105105
app: kubevirt-csi-driver
106106
spec:
107-
serviceAccount: kubevirt-csi
107+
serviceAccount: kubevirt-csi-controller-sa
108108
priorityClassName: system-cluster-critical
109109
nodeSelector:
110110
node-role.kubernetes.io/control-plane: ""
111111
tolerations:
112+
- key: "node-role.kubernetes.io/control-plane"
113+
operator: Exists
114+
effect: NoSchedule
112115
- key: CriticalAddonsOnly
113116
operator: Exists
114117
- key: node-role.kubernetes.io/master
@@ -117,7 +120,7 @@ spec:
117120
containers:
118121
- name: csi-driver
119122
imagePullPolicy: Always
120-
image: '{{ .InternalImages.Get "KubeVirtCSIDriver" }}'
123+
image: '{{ .InternalImages.Get "KubeVirtCSI" }}'
121124
args:
122125
- "--endpoint=$(CSI_ENDPOINT)"
123126
- "--infra-cluster-namespace=$(INFRACLUSTER_NAMESPACE)"
@@ -163,7 +166,7 @@ spec:
163166
memory: 50Mi
164167
cpu: 10m
165168
- name: csi-provisioner
166-
image: '{{ .InternalImages.Get "KubeVirtCSIExternalProvisioner" }}'
169+
image: '{{ .InternalImages.Get "KubeVirtCSIProvisioner" }}'
167170
args:
168171
- "--csi-address=$(ADDRESS)"
169172
- "--default-fstype=ext4"
@@ -177,7 +180,7 @@ spec:
177180
- name: socket-dir
178181
mountPath: /var/lib/csi/sockets/pluginproxy/
179182
- name: csi-attacher
180-
image: '{{ .InternalImages.Get "KubeVirtCSIExternalAttacher" }}'
183+
image: '{{ .InternalImages.Get "KubeVirtCSIAttacher" }}'
181184
args:
182185
- "--csi-address=$(ADDRESS)"
183186
- "--v=5"
@@ -194,7 +197,7 @@ spec:
194197
memory: 50Mi
195198
cpu: 10m
196199
- name: csi-liveness-probe
197-
image: '{{ .InternalImages.Get "KubeVirtCSILivenessprobe" }}'
200+
image: '{{ .InternalImages.Get "KubeVirtCSILivenessProbe" }}'
198201
args:
199202
- "--csi-address=/csi/csi.sock"
200203
- "--probe-timeout=3s"

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ require (
3535
google.golang.org/grpc v1.67.0
3636
gopkg.in/yaml.v2 v2.4.0
3737
helm.sh/helm/v3 v3.16.1
38-
k8c.io/machine-controller v1.60.0
38+
k8c.io/machine-controller v1.61.0
3939
k8s.io/api v0.31.1
4040
k8s.io/apiextensions-apiserver v0.31.1
4141
k8s.io/apimachinery v0.31.1

go.sum

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,6 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL
456456
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
457457
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
458458
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
459-
golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo=
460-
golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0=
461459
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
462460
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
463461
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
@@ -565,8 +563,8 @@ helm.sh/helm/v3 v3.16.1 h1:cER6tI/8PgUAsaJaQCVBUg3VI9KN4oVaZJgY60RIc0c=
565563
helm.sh/helm/v3 v3.16.1/go.mod h1:r+xBHHP20qJeEqtvBXMf7W35QDJnzY/eiEBzt+TfHps=
566564
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
567565
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
568-
k8c.io/machine-controller v1.60.0 h1:0ShjXyAnv0hpo59UsV9VFjEfgyG/2XrljBaEUV6JzwM=
569-
k8c.io/machine-controller v1.60.0/go.mod h1:j9SHRLpzFj5wOMlhdPJL+ub08P8rvVvQOFtg7JaLYb4=
566+
k8c.io/machine-controller v1.61.0 h1:d7KVD2CDG2K76ujSt5RPLUP3BCNDcioObdM1N0BUNlc=
567+
k8c.io/machine-controller v1.61.0/go.mod h1:ZGDFyUeEp66RHcNB5Ki/OJyFdZFgo9dkHJ9s6YJWPcg=
570568
k8s.io/api v0.31.1 h1:Xe1hX/fPW3PXYYv8BlozYqw63ytA92snr96zMW9gWTU=
571569
k8s.io/api v0.31.1/go.mod h1:sbN1g6eY6XVLeqNsZGLnI5FwVseTrZX7Fv3O26rhAaI=
572570
k8s.io/apiextensions-apiserver v0.31.1 h1:L+hwULvXx+nvTYX/MKM3kKMZyei+UiSXQWciX/N6E40=

pkg/apis/kubeone/config/config.go

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"os"
2323
"os/exec"
2424
"reflect"
25+
"strings"
2526

2627
"github.com/pkg/errors"
2728
"github.com/sirupsen/logrus"
@@ -231,6 +232,8 @@ func DefaultedV1Beta3KubeOneCluster(versionedCluster *kubeonev1beta3.KubeOneClus
231232

232233
// SetKubeOneClusterDynamicDefaults sets the dynamic defaults for a given KubeOneCluster object
233234
func SetKubeOneClusterDynamicDefaults(cluster *kubeoneapi.KubeOneCluster, credentialsFile []byte) error {
235+
// Set the default cloud config
236+
SetDefaultsCloudConfig(cluster)
234237
// Parse the credentials file
235238
credentials := make(map[string]string)
236239

@@ -289,6 +292,42 @@ func SetKubeOneClusterDynamicDefaults(cluster *kubeoneapi.KubeOneCluster, creden
289292
return nil
290293
}
291294

295+
// SetDefaultsCloudConfig sets default values for the CloudConfig field in the KubeOneCluster object.
296+
// this function assigns a default cloud configuration.
297+
func SetDefaultsCloudConfig(obj *kubeoneapi.KubeOneCluster) {
298+
if obj.CloudProvider.AWS != nil && obj.CloudProvider.External {
299+
if obj.CloudProvider.CloudConfig == "" {
300+
obj.CloudProvider.CloudConfig = defaultAWSCCMCloudConfig(obj.Name, obj.ClusterNetwork.IPFamily)
301+
}
302+
}
303+
}
304+
305+
// defaultAWSCCMCloudConfig generates a default cloud configuration for AWS when using the Cloud Controller Manager (CCM).
306+
// The configuration includes the Kubernetes cluster ID and optionally sets NodeIPFamilies based on the IPFamily setting.
307+
func defaultAWSCCMCloudConfig(name string, ipFamily kubeoneapi.IPFamily) string {
308+
// Initialize the configuration with the global section and cluster ID.
309+
lines := []string{
310+
"[global]",
311+
fmt.Sprintf("KubernetesClusterID=%q", name),
312+
}
313+
314+
// Set NodeIPFamilies based on the IP family configuration.
315+
switch ipFamily {
316+
case kubeoneapi.IPFamilyIPv4:
317+
lines = append(lines, fmt.Sprintf("NodeIPFamilies=%q", "ipv4"))
318+
case kubeoneapi.IPFamilyIPv6:
319+
lines = append(lines, fmt.Sprintf("NodeIPFamilies=%q", "ipv6"))
320+
case kubeoneapi.IPFamilyIPv4IPv6:
321+
lines = append(lines, fmt.Sprintf("NodeIPFamilies=%q", "ipv4"))
322+
lines = append(lines, fmt.Sprintf("NodeIPFamilies=%q", "ipv6"))
323+
case kubeoneapi.IPFamilyIPv6IPv4:
324+
lines = append(lines, fmt.Sprintf("NodeIPFamilies=%q", "ipv6"))
325+
lines = append(lines, fmt.Sprintf("NodeIPFamilies=%q", "ipv4"))
326+
}
327+
328+
return strings.Join(lines, "\n")
329+
}
330+
292331
func setRegistriesAuth(cluster *kubeoneapi.KubeOneCluster, buf string) error {
293332
var registriesAuth struct {
294333
runtime.TypeMeta `json:",inline"`

pkg/apis/kubeone/v1beta2/defaults.go

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package v1beta2
1818

1919
import (
2020
"crypto/tls"
21-
"fmt"
2221
"strings"
2322
"time"
2423

@@ -74,7 +73,6 @@ func SetDefaults_KubeOneCluster(obj *KubeOneCluster) {
7473
SetDefaults_HelmReleases(obj)
7574
SetDefaults_SystemPackages(obj)
7675
SetDefaults_Features(obj)
77-
SetDefaults_CloudConfig(obj)
7876
SetDefaults_TLSCipherSuites(obj)
7977
}
8078

@@ -97,14 +95,6 @@ func SetDefaults_CloudProvider(obj *KubeOneCluster) {
9795
}
9896
}
9997

100-
func SetDefaults_CloudConfig(obj *KubeOneCluster) {
101-
if obj.CloudProvider.AWS != nil && obj.CloudProvider.External {
102-
if obj.CloudProvider.CloudConfig == "" {
103-
obj.CloudProvider.CloudConfig = defaultAWSCCMCloudConfig(obj.Name, obj.ClusterNetwork.IPFamily)
104-
}
105-
}
106-
}
107-
10898
func SetDefaults_Hosts(obj *KubeOneCluster) {
10999
// No hosts, so skip defaulting
110100
if len(obj.ControlPlane.Hosts) == 0 {
@@ -349,28 +339,6 @@ func defaultHostConfig(obj *HostConfig) {
349339
obj.BastionUser = defaults(obj.BastionUser, obj.SSHUsername)
350340
}
351341

352-
func defaultAWSCCMCloudConfig(name string, ipFamily IPFamily) string {
353-
lines := []string{
354-
"[global]",
355-
fmt.Sprintf("KubernetesClusterID=%q", name),
356-
}
357-
358-
switch ipFamily {
359-
case IPFamilyIPv4:
360-
lines = append(lines, fmt.Sprintf("NodeIPFamilies=%q", "ipv4"))
361-
case IPFamilyIPv6:
362-
lines = append(lines, fmt.Sprintf("NodeIPFamilies=%q", "ipv6"))
363-
case IPFamilyIPv4IPv6:
364-
lines = append(lines, fmt.Sprintf("NodeIPFamilies=%q", "ipv4"))
365-
lines = append(lines, fmt.Sprintf("NodeIPFamilies=%q", "ipv6"))
366-
case IPFamilyIPv6IPv4:
367-
lines = append(lines, fmt.Sprintf("NodeIPFamilies=%q", "ipv6"))
368-
lines = append(lines, fmt.Sprintf("NodeIPFamilies=%q", "ipv4"))
369-
}
370-
371-
return strings.Join(lines, "\n")
372-
}
373-
374342
func defaults[T comparable](input, defaultValue T) T {
375343
var zero T
376344

pkg/apis/kubeone/v1beta3/defaults.go

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package v1beta3
1818

1919
import (
2020
"crypto/tls"
21-
"fmt"
2221
"strings"
2322
"time"
2423

@@ -74,7 +73,6 @@ func SetDefaults_KubeOneCluster(obj *KubeOneCluster) {
7473
SetDefaults_Addons(obj)
7574
SetDefaults_SystemPackages(obj)
7675
SetDefaults_Features(obj)
77-
SetDefaults_CloudConfig(obj)
7876
SetDefaults_TLSCipherSuites(obj)
7977
}
8078

@@ -97,14 +95,6 @@ func SetDefaults_CloudProvider(obj *KubeOneCluster) {
9795
}
9896
}
9997

100-
func SetDefaults_CloudConfig(obj *KubeOneCluster) {
101-
if obj.CloudProvider.AWS != nil && obj.CloudProvider.External {
102-
if obj.CloudProvider.CloudConfig == "" {
103-
obj.CloudProvider.CloudConfig = defaultAWSCCMCloudConfig(obj.Name, obj.ClusterNetwork.IPFamily)
104-
}
105-
}
106-
}
107-
10898
func SetDefaults_Hosts(obj *KubeOneCluster) {
10999
// No hosts, so skip defaulting
110100
if len(obj.ControlPlane.Hosts) == 0 {
@@ -347,28 +337,6 @@ func defaultHostConfig(obj *HostConfig) {
347337
obj.BastionUser = defaults(obj.BastionUser, obj.SSHUsername)
348338
}
349339

350-
func defaultAWSCCMCloudConfig(name string, ipFamily IPFamily) string {
351-
lines := []string{
352-
"[global]",
353-
fmt.Sprintf("KubernetesClusterID=%q", name),
354-
}
355-
356-
switch ipFamily {
357-
case IPFamilyIPv4:
358-
lines = append(lines, fmt.Sprintf("NodeIPFamilies=%q", "ipv4"))
359-
case IPFamilyIPv6:
360-
lines = append(lines, fmt.Sprintf("NodeIPFamilies=%q", "ipv6"))
361-
case IPFamilyIPv4IPv6:
362-
lines = append(lines, fmt.Sprintf("NodeIPFamilies=%q", "ipv4"))
363-
lines = append(lines, fmt.Sprintf("NodeIPFamilies=%q", "ipv6"))
364-
case IPFamilyIPv6IPv4:
365-
lines = append(lines, fmt.Sprintf("NodeIPFamilies=%q", "ipv6"))
366-
lines = append(lines, fmt.Sprintf("NodeIPFamilies=%q", "ipv4"))
367-
}
368-
369-
return strings.Join(lines, "\n")
370-
}
371-
372340
func defaults[T comparable](input, defaultValue T) T {
373341
var zero T
374342

pkg/credentials/secret.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ func vsphereSecret(credentials map[string]string) *corev1.Secret {
211211
vscreds := map[string]string{}
212212

213213
vcenterPrefix := strings.ReplaceAll(credentials[VSphereAddressMC], "https://", "")
214+
vcenterPrefix, _ = strings.CutSuffix(vcenterPrefix, "/")
214215
// Save credentials in Secret and configure vSphere cloud controller
215216
// manager to read it, in replace of storing those in /etc/kubernates/cloud-config
216217
// see more: https://vmware.github.io/vsphere-storage-for-kubernetes/documentation/k8s-secret.html

pkg/tasks/tasks.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,11 @@ func WithResources(t Tasks) Tasks {
276276
Description: "ensure caBundle configMap",
277277
Predicate: func(s *state.State) bool { return s.Cluster.CABundle != "" },
278278
},
279+
{
280+
Fn: labelNodes,
281+
Operation: "labeling control-plane nodes",
282+
Description: "labeling control-plane nodes",
283+
},
279284
{
280285
Fn: addons.Ensure,
281286
Operation: "applying addons",
@@ -310,8 +315,9 @@ func WithResources(t Tasks) Tasks {
310315
Operation: "joining static worker nodes to the cluster",
311316
},
312317
{
313-
Fn: labelNodes,
314-
Operation: "labeling nodes",
318+
Fn: labelNodes,
319+
Operation: "labeling nodes",
320+
Description: "labeling nodes",
315321
},
316322
{
317323
Fn: fixFilePermissions,

0 commit comments

Comments
 (0)