Skip to content

Commit ed00c20

Browse files
committed
SUS-681 Additional Fixes
1 parent 775260f commit ed00c20

File tree

28 files changed

+382
-581
lines changed

28 files changed

+382
-581
lines changed

bootstrap/kubeadm/api/v1alpha4/zz_generated.conversion.go

Lines changed: 2 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bootstrap/kubeadm/api/v1beta1/kubeadm_types.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,21 @@ type NodeRegistrationOptions struct {
251251
// IgnorePreflightErrors provides a slice of pre-flight errors to be ignored when the current node is registered.
252252
// +optional
253253
IgnorePreflightErrors []string `json:"ignorePreflightErrors,omitempty"`
254+
255+
// imagePullPolicy specifies the policy for image pulling
256+
// during kubeadm "init" and "join" operations. The value of
257+
// this field must be one of "Always", "IfNotPresent" or
258+
// "Never". Defaults to "IfNotPresent". This can be used only
259+
// with Kubernetes version equal to 1.22 and later.
260+
// +kubebuilder:validation:Enum=Always;IfNotPresent;Never
261+
// +optional
262+
ImagePullPolicy string `json:"imagePullPolicy,omitempty"`
263+
264+
// imagePullSerial specifies if image pulling performed by kubeadm must be done serially or in parallel.
265+
// This option takes effect only on Kubernetes >=1.31.0.
266+
// Default: true (defaulted in kubeadm)
267+
// +optional
268+
ImagePullSerial *bool `json:"imagePullSerial,omitempty"`
254269
}
255270

256271
// MarshalJSON marshals NodeRegistrationOptions in a way that an empty slice in Taints is preserved.

bootstrap/kubeadm/api/v1beta1/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigs.yaml

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigtemplates.yaml

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bootstrap/kubeadm/config/rbac/role.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ rules:
99
- ""
1010
resources:
1111
- configmaps
12-
- events
1312
- secrets
1413
verbs:
1514
- create
@@ -23,7 +22,6 @@ rules:
2322
- bootstrap.cluster.x-k8s.io
2423
resources:
2524
- kubeadmconfigs
26-
- kubeadmconfigs/finalizers
2725
- kubeadmconfigs/status
2826
verbs:
2927
- create
@@ -47,3 +45,10 @@ rules:
4745
- get
4846
- list
4947
- watch
48+
- apiGroups:
49+
- ""
50+
resources:
51+
- events
52+
verbs:
53+
- create
54+
- patch

bootstrap/kubeadm/internal/cloudinit/cloudinit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"fmt"
2323
"text/template"
2424

25-
"github.com/blang/semver"
25+
"github.com/blang/semver/v4"
2626
"github.com/pkg/errors"
2727

2828
bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1beta1"

bootstrap/kubeadm/internal/controllers/kubeadmconfig_controller.go

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ import (
5151
"sigs.k8s.io/cluster-api/controllers/remote"
5252
expv1 "sigs.k8s.io/cluster-api/exp/api/v1beta1"
5353
"sigs.k8s.io/cluster-api/feature"
54-
"sigs.k8s.io/cluster-api/internal/util/taints"
5554
"sigs.k8s.io/cluster-api/util"
5655
"sigs.k8s.io/cluster-api/util/annotations"
5756
"sigs.k8s.io/cluster-api/util/conditions"
@@ -601,8 +600,16 @@ func (r *KubeadmConfigReconciler) joinWorker(ctx context.Context, scope *Scope)
601600
// Do not modify the KubeadmConfig in etcd as this is a temporary taint that will be dropped after the node
602601
// is initialized by ClusterAPI.
603602
joinConfiguration := scope.Config.Spec.JoinConfiguration.DeepCopy()
604-
if !taints.HasTaint(joinConfiguration.NodeRegistration.Taints, clusterv1.NodeUninitializedTaint) {
605-
joinConfiguration.NodeRegistration.Taints = append(joinConfiguration.NodeRegistration.Taints, clusterv1.NodeUninitializedTaint)
603+
604+
// TODO: Vishwanath
605+
// For the k8s v1.31.4 support via kubeadm v1beta4 API version
606+
var NodeUninitializedTaint = corev1.Taint{
607+
Key: "node.cluster.x-k8s.io/uninitialized",
608+
Effect: corev1.TaintEffectNoSchedule,
609+
}
610+
611+
if !HasTaint(joinConfiguration.NodeRegistration.Taints, NodeUninitializedTaint) {
612+
joinConfiguration.NodeRegistration.Taints = append(joinConfiguration.NodeRegistration.Taints, NodeUninitializedTaint)
606613
}
607614

608615
// NOTE: It is not required to provide in input ClusterConfiguration because only clusterConfiguration.APIServer.TimeoutForControlPlane
@@ -1149,3 +1156,14 @@ func (r *KubeadmConfigReconciler) ensureBootstrapSecretOwnersRef(ctx context.Con
11491156
}
11501157
return nil
11511158
}
1159+
1160+
// TODO: Vishwanath
1161+
// HasTaint returns true if the targetTaint is in the list of taints.
1162+
func HasTaint(taints []corev1.Taint, targetTaint corev1.Taint) bool {
1163+
for _, taint := range taints {
1164+
if taint.MatchTaint(&targetTaint) {
1165+
return true
1166+
}
1167+
}
1168+
return false
1169+
}

bootstrap/kubeadm/types/upstreamv1beta1/zz_generated.conversion.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bootstrap/kubeadm/types/upstreamv1beta2/zz_generated.conversion.go

Lines changed: 7 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)