@@ -33,13 +33,13 @@ import (
33
33
intstrutil "k8s.io/apimachinery/pkg/util/intstr"
34
34
ctrl "sigs.k8s.io/controller-runtime"
35
35
36
- bootstrapv1beta1 "sigs.k8s.io/cluster-api/api/bootstrap/kubeadm/v1beta1 "
37
- controlplanev1beta1 "sigs.k8s.io/cluster-api/api/controlplane/kubeadm/v1beta1 "
36
+ bootstrapv1 "sigs.k8s.io/cluster-api/api/bootstrap/kubeadm/v1beta2 "
37
+ controlplanev1 "sigs.k8s.io/cluster-api/api/controlplane/kubeadm/v1beta2 "
38
38
clusterv1beta1 "sigs.k8s.io/cluster-api/api/core/v1beta1"
39
39
runtimehooksv1 "sigs.k8s.io/cluster-api/api/runtime/hooks/v1alpha1"
40
40
"sigs.k8s.io/cluster-api/exp/runtime/topologymutation"
41
- infrav1beta1 "sigs.k8s.io/cluster-api/test/infrastructure/docker/api/v1beta1 "
42
- infraexpv1beta1 "sigs.k8s.io/cluster-api/test/infrastructure/docker/exp/api/v1beta1 "
41
+ infrav1 "sigs.k8s.io/cluster-api/test/infrastructure/docker/api/v1beta2 "
42
+ infraexpv1 "sigs.k8s.io/cluster-api/test/infrastructure/docker/exp/api/v1beta2 "
43
43
"sigs.k8s.io/cluster-api/test/infrastructure/kind"
44
44
)
45
45
@@ -57,16 +57,16 @@ type ExtensionHandlers struct {
57
57
// NewExtensionHandlers returns a new ExtensionHandlers for the topology mutation hook handlers.
58
58
func NewExtensionHandlers () * ExtensionHandlers {
59
59
scheme := runtime .NewScheme ()
60
- _ = infrav1beta1 .AddToScheme (scheme )
61
- _ = infraexpv1beta1 .AddToScheme (scheme )
62
- _ = bootstrapv1beta1 .AddToScheme (scheme )
63
- _ = controlplanev1beta1 .AddToScheme (scheme )
60
+ _ = infrav1 .AddToScheme (scheme )
61
+ _ = infraexpv1 .AddToScheme (scheme )
62
+ _ = bootstrapv1 .AddToScheme (scheme )
63
+ _ = controlplanev1 .AddToScheme (scheme )
64
64
return & ExtensionHandlers {
65
65
// Add the apiGroups being handled to the decoder
66
66
decoder : serializer .NewCodecFactory (scheme ).UniversalDecoder (
67
- infrav1beta1 .GroupVersion ,
68
- bootstrapv1beta1 .GroupVersion ,
69
- controlplanev1beta1 .GroupVersion ,
67
+ infrav1 .GroupVersion ,
68
+ bootstrapv1 .GroupVersion ,
69
+ controlplanev1 .GroupVersion ,
70
70
),
71
71
}
72
72
}
@@ -87,18 +87,18 @@ func (h *ExtensionHandlers) GeneratePatches(ctx context.Context, req *runtimehoo
87
87
log := ctrl .LoggerFrom (ctx )
88
88
89
89
switch obj := obj .(type ) {
90
- case * infrav1beta1 .DockerClusterTemplate :
90
+ case * infrav1 .DockerClusterTemplate :
91
91
if err := patchDockerClusterTemplate (ctx , obj , variables ); err != nil {
92
92
log .Error (err , "Error patching DockerClusterTemplate" )
93
93
return errors .Wrap (err , "error patching DockerClusterTemplate" )
94
94
}
95
- case * controlplanev1beta1 .KubeadmControlPlaneTemplate :
95
+ case * controlplanev1 .KubeadmControlPlaneTemplate :
96
96
err := patchKubeadmControlPlaneTemplate (ctx , obj , variables )
97
97
if err != nil {
98
98
log .Error (err , "Error patching KubeadmControlPlaneTemplate" )
99
99
return errors .Wrapf (err , "error patching KubeadmControlPlaneTemplate" )
100
100
}
101
- case * bootstrapv1beta1 .KubeadmConfigTemplate :
101
+ case * bootstrapv1 .KubeadmConfigTemplate :
102
102
// NOTE: KubeadmConfigTemplate could be linked to one or more of the existing MachineDeployment class;
103
103
// the patchKubeadmConfigTemplate func shows how to implement patches only for KubeadmConfigTemplates
104
104
// linked to a specific MachineDeployment class; another option is to check the holderRef value and call
@@ -107,7 +107,7 @@ func (h *ExtensionHandlers) GeneratePatches(ctx context.Context, req *runtimehoo
107
107
log .Error (err , "Error patching KubeadmConfigTemplate" )
108
108
return errors .Wrap (err , "error patching KubeadmConfigTemplate" )
109
109
}
110
- case * infrav1beta1 .DockerMachineTemplate :
110
+ case * infrav1 .DockerMachineTemplate :
111
111
// NOTE: DockerMachineTemplate could be linked to the ControlPlane or one or more of the existing MachineDeployment class;
112
112
// the patchDockerMachineTemplate func shows how to implement different patches for DockerMachineTemplate
113
113
// linked to ControlPlane or for DockerMachineTemplate linked to MachineDeployment classes; another option
@@ -116,7 +116,7 @@ func (h *ExtensionHandlers) GeneratePatches(ctx context.Context, req *runtimehoo
116
116
log .Error (err , "Error patching DockerMachineTemplate" )
117
117
return errors .Wrap (err , "error patching DockerMachineTemplate" )
118
118
}
119
- case * infraexpv1beta1 .DockerMachinePoolTemplate :
119
+ case * infraexpv1 .DockerMachinePoolTemplate :
120
120
if err := patchDockerMachinePoolTemplate (ctx , obj , variables ); err != nil {
121
121
log .Error (err , "Error patching DockerMachinePoolTemplate" )
122
122
return errors .Wrap (err , "error patching DockerMachinePoolTemplate" )
@@ -129,7 +129,7 @@ func (h *ExtensionHandlers) GeneratePatches(ctx context.Context, req *runtimehoo
129
129
// patchDockerClusterTemplate patches the DockerClusterTemplate.
130
130
// It sets the LoadBalancer.ImageRepository if the imageRepository variable is provided.
131
131
// NOTE: this patch is not required for any special reason, it is used for testing the patch machinery itself.
132
- func patchDockerClusterTemplate (_ context.Context , dockerClusterTemplate * infrav1beta1 .DockerClusterTemplate , templateVariables map [string ]apiextensionsv1.JSON ) error {
132
+ func patchDockerClusterTemplate (_ context.Context , dockerClusterTemplate * infrav1 .DockerClusterTemplate , templateVariables map [string ]apiextensionsv1.JSON ) error {
133
133
imageRepo , err := topologymutation .GetStringVariable (templateVariables , "imageRepository" )
134
134
if err != nil {
135
135
if topologymutation .IsNotFoundError (err ) {
@@ -146,7 +146,7 @@ func patchDockerClusterTemplate(_ context.Context, dockerClusterTemplate *infrav
146
146
// patchKubeadmControlPlaneTemplate patches the ControlPlaneTemplate.
147
147
// It sets the RolloutStrategy.RollingUpdate.MaxSurge if the kubeadmControlPlaneMaxSurge is provided.
148
148
// NOTE: RolloutStrategy.RollingUpdate.MaxSurge patch is not required for any special reason, it is used for testing the patch machinery itself.
149
- func patchKubeadmControlPlaneTemplate (ctx context.Context , kcpTemplate * controlplanev1beta1 .KubeadmControlPlaneTemplate , templateVariables map [string ]apiextensionsv1.JSON ) error {
149
+ func patchKubeadmControlPlaneTemplate (ctx context.Context , kcpTemplate * controlplanev1 .KubeadmControlPlaneTemplate , templateVariables map [string ]apiextensionsv1.JSON ) error {
150
150
log := ctrl .LoggerFrom (ctx )
151
151
152
152
// 1) Patch RolloutStrategy RollingUpdate MaxSurge with the value from the Cluster Topology variable.
@@ -163,17 +163,17 @@ func patchKubeadmControlPlaneTemplate(ctx context.Context, kcpTemplate *controlp
163
163
kubeadmControlPlaneMaxSurgeIntOrString := intstrutil .Parse (kcpControlPlaneMaxSurge )
164
164
log .Info (fmt .Sprintf ("Setting KubeadmControlPlaneMaxSurge to %q" , kubeadmControlPlaneMaxSurgeIntOrString .String ()))
165
165
if kcpTemplate .Spec .Template .Spec .RolloutStrategy == nil {
166
- kcpTemplate .Spec .Template .Spec .RolloutStrategy = & controlplanev1beta1 .RolloutStrategy {}
166
+ kcpTemplate .Spec .Template .Spec .RolloutStrategy = & controlplanev1 .RolloutStrategy {}
167
167
}
168
168
if kcpTemplate .Spec .Template .Spec .RolloutStrategy .RollingUpdate == nil {
169
- kcpTemplate .Spec .Template .Spec .RolloutStrategy .RollingUpdate = & controlplanev1beta1 .RollingUpdate {}
169
+ kcpTemplate .Spec .Template .Spec .RolloutStrategy .RollingUpdate = & controlplanev1 .RollingUpdate {}
170
170
}
171
171
kcpTemplate .Spec .Template .Spec .RolloutStrategy .RollingUpdate .MaxSurge = & kubeadmControlPlaneMaxSurgeIntOrString
172
172
return nil
173
173
}
174
174
175
175
// patchKubeadmConfigTemplate patches the ControlPlaneTemplate.
176
- func patchKubeadmConfigTemplate (_ context.Context , _ * bootstrapv1beta1 .KubeadmConfigTemplate , _ map [string ]apiextensionsv1.JSON ) error {
176
+ func patchKubeadmConfigTemplate (_ context.Context , _ * bootstrapv1 .KubeadmConfigTemplate , _ map [string ]apiextensionsv1.JSON ) error {
177
177
return nil
178
178
}
179
179
@@ -182,7 +182,7 @@ func patchKubeadmConfigTemplate(_ context.Context, _ *bootstrapv1beta1.KubeadmCo
182
182
// the DockerMachineTemplate belongs to.
183
183
// NOTE: this patch is not required anymore after the introduction of the kind mapper in kind, however we keep it
184
184
// as example of version aware patches.
185
- func patchDockerMachineTemplate (ctx context.Context , dockerMachineTemplate * infrav1beta1 .DockerMachineTemplate , templateVariables map [string ]apiextensionsv1.JSON ) error {
185
+ func patchDockerMachineTemplate (ctx context.Context , dockerMachineTemplate * infrav1 .DockerMachineTemplate , templateVariables map [string ]apiextensionsv1.JSON ) error {
186
186
log := ctrl .LoggerFrom (ctx )
187
187
188
188
// If the DockerMachineTemplate belongs to the ControlPlane, set the images using the ControlPlane version.
@@ -237,7 +237,7 @@ func patchDockerMachineTemplate(ctx context.Context, dockerMachineTemplate *infr
237
237
// It sets the CustomImage to an image for the version in use by the MachinePool.
238
238
// NOTE: this patch is not required anymore after the introduction of the kind mapper in kind, however we keep it
239
239
// as example of version aware patches.
240
- func patchDockerMachinePoolTemplate (ctx context.Context , dockerMachinePoolTemplate * infraexpv1beta1 .DockerMachinePoolTemplate , templateVariables map [string ]apiextensionsv1.JSON ) error {
240
+ func patchDockerMachinePoolTemplate (ctx context.Context , dockerMachinePoolTemplate * infraexpv1 .DockerMachinePoolTemplate , templateVariables map [string ]apiextensionsv1.JSON ) error {
241
241
log := ctrl .LoggerFrom (ctx )
242
242
243
243
// If the DockerMachinePoolTemplate belongs to a MachinePool, set the images the MachinePool version.
0 commit comments