Skip to content

Commit 3be05b0

Browse files
committed
clusterapi v1beta2 api changes
1 parent 17b9c2c commit 3be05b0

12 files changed

+95
-91
lines changed

api/v1alpha1/kamajicontrolplane_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
appsv1 "k8s.io/api/apps/v1"
99
corev1 "k8s.io/api/core/v1"
1010
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
11-
capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1"
11+
capiv1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2"
1212
)
1313

1414
// ControlPlaneComponent allows the customization for the given component of the control plane.
@@ -105,7 +105,7 @@ type CoreDNSAddonSpec struct {
105105
type KamajiControlPlaneSpec struct {
106106
KamajiControlPlaneFields `json:",inline"`
107107
// ControlPlaneEndpoint propagates the endpoint the Kubernetes API Server managed by Kamaji is located.
108-
ControlPlaneEndpoint capiv1beta1.APIEndpoint `json:"controlPlaneEndpoint,omitempty"`
108+
ControlPlaneEndpoint capiv1beta2.APIEndpoint `json:"controlPlaneEndpoint,omitempty"`
109109
// Number of desired replicas for the given TenantControlPlane.
110110
// Defaults to 2.
111111
// +kubebuilder:default=2

api/v1alpha1/kamajicontrolplanetemplate_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ package v1alpha1
55

66
import (
77
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
8-
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
8+
clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta1"
99
)
1010

1111
// KamajiControlPlaneTemplateSpec defines the desired state of KamajiControlPlaneTemplate.

config/control-plane-components.yaml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -493,18 +493,19 @@ spec:
493493
type: object
494494
controlPlaneEndpoint:
495495
description: ControlPlaneEndpoint propagates the endpoint the Kubernetes API Server managed by Kamaji is located.
496+
minProperties: 1
496497
properties:
497498
host:
498499
description: host is the hostname on which the API server is serving.
499500
maxLength: 512
501+
minLength: 1
500502
type: string
501503
port:
502504
description: port is the port on which the API server is serving.
503505
format: int32
506+
maximum: 65535
507+
minimum: 1
504508
type: integer
505-
required:
506-
- host
507-
- port
508509
type: object
509510
controllerManager:
510511
description: ControlPlaneComponent allows the customization for the given component of the control plane.
@@ -14093,6 +14094,14 @@ rules:
1409314094
- patch
1409414095
- update
1409514096
- watch
14097+
- apiGroups:
14098+
- apiextensions.k8s.io
14099+
resources:
14100+
- customresourcedefinitions
14101+
verbs:
14102+
- get
14103+
- list
14104+
- watch
1409614105
- apiGroups:
1409714106
- cluster.x-k8s.io
1409814107
resources:

config/crd/bases/controlplane.cluster.x-k8s.io_kamajicontrolplanes.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -493,18 +493,19 @@ spec:
493493
controlPlaneEndpoint:
494494
description: ControlPlaneEndpoint propagates the endpoint the Kubernetes
495495
API Server managed by Kamaji is located.
496+
minProperties: 1
496497
properties:
497498
host:
498499
description: host is the hostname on which the API server is serving.
499500
maxLength: 512
501+
minLength: 1
500502
type: string
501503
port:
502504
description: port is the port on which the API server is serving.
503505
format: int32
506+
maximum: 65535
507+
minimum: 1
504508
type: integer
505-
required:
506-
- host
507-
- port
508509
type: object
509510
controllerManager:
510511
description: ControlPlaneComponent allows the customization for the

config/rbac/role.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ rules:
1515
- patch
1616
- update
1717
- watch
18+
- apiGroups:
19+
- apiextensions.k8s.io
20+
resources:
21+
- customresourcedefinitions
22+
verbs:
23+
- get
24+
- list
25+
- watch
1826
- apiGroups:
1927
- cluster.x-k8s.io
2028
resources:

controllers/kamajicontrolplane_controller.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ import (
1818
"k8s.io/client-go/kubernetes"
1919
"k8s.io/client-go/util/retry"
2020
"k8s.io/component-base/featuregate"
21-
capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1"
21+
capiv1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2"
2222
"sigs.k8s.io/cluster-api/util/annotations"
23+
conditionsapi "sigs.k8s.io/cluster-api/util/conditions"
2324
"sigs.k8s.io/cluster-api/util/predicates"
2425
ctrl "sigs.k8s.io/controller-runtime"
2526
"sigs.k8s.io/controller-runtime/pkg/builder"
@@ -80,18 +81,18 @@ func (r *KamajiControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl.R
8081
}
8182

8283
// Retrieving the Cluster information
83-
cluster := capiv1beta1.Cluster{}
84+
cluster := capiv1beta2.Cluster{}
8485
cluster.SetName(kcp.GetOwnerReferences()[0].Name)
8586
cluster.SetNamespace(kcp.GetNamespace())
8687

8788
if err = r.client.Get(ctx, types.NamespacedName{Name: cluster.Name, Namespace: cluster.Namespace}, &cluster); err != nil {
8889
if errors.IsNotFound(err) {
89-
log.Info("capiv1beta1.Cluster resource may have been deleted, withdrawing reconciliation")
90+
log.Info("capiv1beta2.Cluster resource may have been deleted, withdrawing reconciliation")
9091

9192
return ctrl.Result{}, nil
9293
}
9394

94-
log.Error(err, "unable to get capiv1beta1.Cluster")
95+
log.Error(err, "unable to get capiv1beta2.Cluster")
9596

9697
return ctrl.Result{}, err //nolint:wrapcheck
9798
}
@@ -199,12 +200,12 @@ func (r *KamajiControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl.R
199200
// check that happens latter will never succeed.
200201
if err = r.client.Get(ctx, types.NamespacedName{Name: cluster.Name, Namespace: cluster.Namespace}, &cluster); err != nil {
201202
if errors.IsNotFound(err) {
202-
log.Info("capiv1beta1.Cluster resource may have been deleted, withdrawing reconciliation")
203+
log.Info("capiv1beta2.Cluster resource may have been deleted, withdrawing reconciliation")
203204

204205
return ctrl.Result{}, nil
205206
}
206207

207-
log.Error(err, "unable to get capiv1beta1.Cluster")
208+
log.Error(err, "unable to get capiv1beta2.Cluster")
208209

209210
return ctrl.Result{}, err //nolint:wrapcheck
210211
}
@@ -221,7 +222,7 @@ func (r *KamajiControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl.R
221222
})
222223

223224
if err != nil {
224-
log.Error(err, "cannot patch capiv1beta1.Cluster")
225+
log.Error(err, "cannot patch capiv1beta2.Cluster")
225226

226227
return ctrl.Result{}, err
227228
}
@@ -231,13 +232,13 @@ func (r *KamajiControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl.R
231232
// 1. an assigned Control Plane endpoint
232233
// 2. a ready infrastructure
233234
if len(cluster.Spec.ControlPlaneEndpoint.Host) == 0 {
234-
log.Info("capiv1beta1.Cluster Control Plane endpoint still unprocessed, enqueuing back")
235+
log.Info("capiv1beta2.Cluster Control Plane endpoint still unprocessed, enqueuing back")
235236

236237
return ctrl.Result{RequeueAfter: time.Second}, nil
237238
}
238239

239-
if !cluster.Status.InfrastructureReady {
240-
log.Info("capiv1beta1.Cluster infrastructure is not yet ready, enqueuing back")
240+
if conditionsapi.IsFalse(&cluster, capiv1beta2.InfrastructureReadyCondition) {
241+
log.Info("capiv1beta2.Cluster infrastructure is not yet ready, enqueuing back")
241242

242243
return ctrl.Result{RequeueAfter: time.Second}, nil
243244
}

controllers/kamajicontrolplane_controller_cluster_patch.go

Lines changed: 27 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import (
1212

1313
"github.com/pkg/errors"
1414
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
15-
"k8s.io/apimachinery/pkg/types"
1615
"k8s.io/client-go/util/retry"
17-
capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1"
16+
capiv1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2"
17+
"sigs.k8s.io/cluster-api/controllers/external"
1818
"sigs.k8s.io/cluster-api/util/patch"
1919
"sigs.k8s.io/controller-runtime/pkg/client"
2020

@@ -60,7 +60,7 @@ func (r *KamajiControlPlaneReconciler) patchControlPlaneEndpoint(ctx context.Con
6060
return errors.Wrap(scopedErr, "cannot retrieve *v1alpha1.KamajiControlPlane")
6161
}
6262

63-
controlPlane.Spec.ControlPlaneEndpoint = capiv1beta1.APIEndpoint{
63+
controlPlane.Spec.ControlPlaneEndpoint = capiv1beta2.APIEndpoint{
6464
Host: endpoint,
6565
Port: int32(port), //nolint:gosec
6666
}
@@ -73,10 +73,12 @@ func (r *KamajiControlPlaneReconciler) patchControlPlaneEndpoint(ctx context.Con
7373
return nil
7474
}
7575

76+
//+kubebuilder:rbac:groups=apiextensions.k8s.io,resources=customresourcedefinitions,verbs=get;list;watch
77+
7678
//nolint:cyclop
77-
func (r *KamajiControlPlaneReconciler) patchCluster(ctx context.Context, cluster capiv1beta1.Cluster, controlPlane *v1alpha1.KamajiControlPlane, hostPort string) error {
78-
if cluster.Spec.InfrastructureRef == nil {
79-
return errors.New("capiv1beta1.Cluster has no InfrastructureRef")
79+
func (r *KamajiControlPlaneReconciler) patchCluster(ctx context.Context, cluster capiv1beta2.Cluster, controlPlane *v1alpha1.KamajiControlPlane, hostPort string) error {
80+
if !cluster.Spec.InfrastructureRef.IsDefined() {
81+
return errors.New("capiv1beta2.Cluster has no InfrastructureRef")
8082
}
8183

8284
endpoint, port, err := r.controlPlaneEndpoint(controlPlane, hostPort)
@@ -121,7 +123,7 @@ func (r *KamajiControlPlaneReconciler) patchCluster(ctx context.Context, cluster
121123
//+kubebuilder:rbac:groups=infrastructure.cluster.x-k8s.io,resources=proxmoxclusters;vsphereclusters;tinkerbellclusters,verbs=get;list;watch
122124
//+kubebuilder:rbac:groups=infrastructure.cluster.x-k8s.io,resources=proxmoxclusters;vsphereclusters;tinkerbellclusters,verbs=patch
123125

124-
func (r *KamajiControlPlaneReconciler) checkOrPatchGenericCluster(ctx context.Context, cluster capiv1beta1.Cluster, endpoint string, port int64) error {
126+
func (r *KamajiControlPlaneReconciler) checkOrPatchGenericCluster(ctx context.Context, cluster capiv1beta2.Cluster, endpoint string, port int64) error {
125127
if err := r.checkGenericCluster(ctx, cluster, endpoint, port); err != nil {
126128
if errors.As(err, &UnmanagedControlPlaneAddressError{}) {
127129
return r.patchGenericCluster(ctx, cluster, endpoint, port, false)
@@ -136,18 +138,13 @@ func (r *KamajiControlPlaneReconciler) checkOrPatchGenericCluster(ctx context.Co
136138
//+kubebuilder:rbac:groups=infrastructure.cluster.x-k8s.io,resources=awsclusters;azureclusters;hetznerclusters;kubevirtclusters;nutanixclusters;packetclusters;ionoscloudclusters,verbs=patch;get;list;watch
137139
//+kubebuilder:rbac:groups=infrastructure.cluster.x-k8s.io,resources=kubevirtclusters/status;nutanixclusters/status;packetclusters/status,verbs=patch
138140

139-
func (r *KamajiControlPlaneReconciler) patchGenericCluster(ctx context.Context, cluster capiv1beta1.Cluster, endpoint string, port int64, patchStatus bool) error {
140-
infraCluster := unstructured.Unstructured{}
141-
142-
infraCluster.SetGroupVersionKind(cluster.Spec.InfrastructureRef.GroupVersionKind())
143-
infraCluster.SetName(cluster.Spec.InfrastructureRef.Name)
144-
infraCluster.SetNamespace(cluster.Spec.InfrastructureRef.Namespace)
145-
146-
if err := r.client.Get(ctx, types.NamespacedName{Name: infraCluster.GetName(), Namespace: infraCluster.GetNamespace()}, &infraCluster); err != nil {
147-
return errors.Wrap(err, fmt.Sprintf("cannot retrieve the %s resource", infraCluster.GetKind()))
141+
func (r *KamajiControlPlaneReconciler) patchGenericCluster(ctx context.Context, cluster capiv1beta2.Cluster, endpoint string, port int64, patchStatus bool) error {
142+
infraCluster, err := external.GetObjectFromContractVersionedRef(ctx, r.client, cluster.Spec.InfrastructureRef, cluster.GetNamespace())
143+
if err != nil {
144+
return errors.Wrap(err, fmt.Sprintf("cannot get infrastructure reference %s", cluster.Spec.InfrastructureRef.Name))
148145
}
149146

150-
patchHelper, err := patch.NewHelper(&infraCluster, r.client)
147+
patchHelper, err := patch.NewHelper(infraCluster, r.client)
151148
if err != nil {
152149
return errors.Wrap(err, "unable to create patch helper")
153150
}
@@ -165,7 +162,7 @@ func (r *KamajiControlPlaneReconciler) patchGenericCluster(ctx context.Context,
165162
}
166163
}
167164

168-
if err = patchHelper.Patch(ctx, &infraCluster); err != nil {
165+
if err = patchHelper.Patch(ctx, infraCluster); err != nil {
169166
return errors.Wrap(err, fmt.Sprintf("cannot perform PATCH update for the %s resource", infraCluster.GetKind()))
170167
}
171168

@@ -174,15 +171,10 @@ func (r *KamajiControlPlaneReconciler) patchGenericCluster(ctx context.Context,
174171

175172
//+kubebuilder:rbac:groups=infrastructure.cluster.x-k8s.io,resources=metal3clusters,verbs=get;list;watch
176173

177-
func (r *KamajiControlPlaneReconciler) checkGenericCluster(ctx context.Context, cluster capiv1beta1.Cluster, endpoint string, port int64) error {
178-
gkc := unstructured.Unstructured{}
179-
180-
gkc.SetGroupVersionKind(cluster.Spec.InfrastructureRef.GroupVersionKind())
181-
gkc.SetName(cluster.Spec.InfrastructureRef.Name)
182-
gkc.SetNamespace(cluster.Spec.InfrastructureRef.Namespace)
183-
184-
if err := r.client.Get(ctx, types.NamespacedName{Name: gkc.GetName(), Namespace: gkc.GetNamespace()}, &gkc); err != nil {
185-
return errors.Wrap(err, fmt.Sprintf("cannot retrieve the %s resource", gkc.GetKind()))
174+
func (r *KamajiControlPlaneReconciler) checkGenericCluster(ctx context.Context, cluster capiv1beta2.Cluster, endpoint string, port int64) error {
175+
gkc, err := external.GetObjectFromContractVersionedRef(ctx, r.client, cluster.Spec.InfrastructureRef, cluster.GetNamespace())
176+
if err != nil {
177+
return errors.Wrap(err, fmt.Sprintf("cannot get infrastructure reference %s", cluster.Spec.InfrastructureRef.Name))
186178
}
187179

188180
cpHost, _, err := unstructured.NestedString(gkc.Object, "spec", "controlPlaneEndpoint", "host")
@@ -204,30 +196,25 @@ func (r *KamajiControlPlaneReconciler) checkGenericCluster(ctx context.Context,
204196
}
205197

206198
if cpHost != endpoint {
207-
return fmt.Errorf("the %s cluster has been provisioned with a mismatching host", gkc.GetKind())
199+
return fmt.Errorf("the %s cluster has been provisioned with a mismatching host %s instead of %s", gkc.GetKind(), cpHost, endpoint)
208200
}
209201

210202
if cpPort != port {
211-
return fmt.Errorf("the %s cluster has been provisioned with a mismatching port", gkc.GetKind())
203+
return fmt.Errorf("the %s cluster has been provisioned with a mismatching port %d instead of %d", gkc.GetKind(), cpPort, port)
212204
}
213205

214206
return nil
215207
}
216208

217209
//+kubebuilder:rbac:groups=infrastructure.cluster.x-k8s.io,resources=openstackclusters,verbs=patch;get;list;watch
218210

219-
func (r *KamajiControlPlaneReconciler) patchOpenStackCluster(ctx context.Context, cluster capiv1beta1.Cluster, endpoint string, port int64) error {
220-
osc := unstructured.Unstructured{}
221-
222-
osc.SetGroupVersionKind(cluster.Spec.InfrastructureRef.GroupVersionKind())
223-
osc.SetName(cluster.Spec.InfrastructureRef.Name)
224-
osc.SetNamespace(cluster.Spec.InfrastructureRef.Namespace)
225-
226-
if err := r.client.Get(ctx, types.NamespacedName{Name: osc.GetName(), Namespace: osc.GetNamespace()}, &osc); err != nil {
227-
return errors.Wrap(err, fmt.Sprintf("cannot retrieve the %s resource", osc.GetKind()))
211+
func (r *KamajiControlPlaneReconciler) patchOpenStackCluster(ctx context.Context, cluster capiv1beta2.Cluster, endpoint string, port int64) error {
212+
osc, err := external.GetObjectFromContractVersionedRef(ctx, r.client, cluster.Spec.InfrastructureRef, cluster.GetNamespace())
213+
if err != nil {
214+
return errors.Wrap(err, fmt.Sprintf("cannot get infrastructure reference %s", cluster.Spec.InfrastructureRef.Name))
228215
}
229216

230-
patchHelper, err := patch.NewHelper(&osc, r.client)
217+
patchHelper, err := patch.NewHelper(osc, r.client)
231218
if err != nil {
232219
return errors.Wrap(err, "unable to create patch helper")
233220
}
@@ -240,7 +227,7 @@ func (r *KamajiControlPlaneReconciler) patchOpenStackCluster(ctx context.Context
240227
return errors.Wrap(err, fmt.Sprintf("unable to set unstructured %s spec apiServerPort", osc.GetKind()))
241228
}
242229

243-
if err = patchHelper.Patch(ctx, &osc); err != nil {
230+
if err = patchHelper.Patch(ctx, osc); err != nil {
244231
return errors.Wrap(err, "cannot perform PATCH update for the OpenStackCluster resource")
245232
}
246233

controllers/kamajicontrolplane_controller_resources.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
corev1 "k8s.io/api/core/v1"
1313
"k8s.io/apimachinery/pkg/types"
1414
"k8s.io/client-go/util/retry"
15-
capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1"
15+
capiv1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2"
1616
"sigs.k8s.io/controller-runtime/pkg/client"
1717
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
1818
ctrllog "sigs.k8s.io/controller-runtime/pkg/log"
@@ -24,7 +24,7 @@ var ErrEnqueueBack = errors.New("enqueue back")
2424

2525
//+kubebuilder:rbac:groups="",resources="secrets",verbs=get;list;watch;create;update;patch
2626

27-
func (r *KamajiControlPlaneReconciler) createRequiredResources(ctx context.Context, remoteClient client.Client, cluster capiv1beta1.Cluster, kcp v1alpha1.KamajiControlPlane, tcp *kamajiv1alpha1.TenantControlPlane) error {
27+
func (r *KamajiControlPlaneReconciler) createRequiredResources(ctx context.Context, remoteClient client.Client, cluster capiv1beta2.Cluster, kcp v1alpha1.KamajiControlPlane, tcp *kamajiv1alpha1.TenantControlPlane) error {
2828
log := ctrllog.FromContext(ctx)
2929
// Creating a kubeconfig secret for the workload cluster.
3030
if secretName := tcp.Status.KubeConfig.Admin.SecretName; len(secretName) == 0 {
@@ -64,7 +64,7 @@ func (r *KamajiControlPlaneReconciler) createRequiredResources(ctx context.Conte
6464
// also in regard to the naming conventions according to the Cluster API contracts about Kubeconfig.
6565
//
6666
// more info: https://cluster-api.sigs.k8s.io/developer/architecture/controllers/cluster.html#secrets
67-
func (r *KamajiControlPlaneReconciler) createOrUpdateCertificateAuthority(ctx context.Context, reader client.Client, cluster capiv1beta1.Cluster, kcp v1alpha1.KamajiControlPlane, tcp *kamajiv1alpha1.TenantControlPlane) error {
67+
func (r *KamajiControlPlaneReconciler) createOrUpdateCertificateAuthority(ctx context.Context, reader client.Client, cluster capiv1beta2.Cluster, kcp v1alpha1.KamajiControlPlane, tcp *kamajiv1alpha1.TenantControlPlane) error {
6868
capiCA := &corev1.Secret{}
6969
capiCA.Name = cluster.Name + "-ca"
7070
capiCA.Namespace = cluster.Namespace
@@ -99,7 +99,7 @@ func (r *KamajiControlPlaneReconciler) createOrUpdateCertificateAuthority(ctx co
9999
labels = map[string]string{}
100100
}
101101

102-
labels[capiv1beta1.ClusterNameLabel] = cluster.Name
102+
labels[capiv1beta2.ClusterNameLabel] = cluster.Name
103103
labels["kamaji.clastix.io/component"] = "capi"
104104
labels["kamaji.clastix.io/secret"] = "ca"
105105
labels["kamaji.clastix.io/cluster"] = cluster.Name
@@ -111,7 +111,7 @@ func (r *KamajiControlPlaneReconciler) createOrUpdateCertificateAuthority(ctx co
111111
corev1.TLSCertKey: crt,
112112
corev1.TLSPrivateKeyKey: key,
113113
}
114-
capiCA.Type = capiv1beta1.ClusterSecretType
114+
capiCA.Type = capiv1beta2.ClusterSecretType
115115

116116
return controllerutil.SetControllerReference(&kcp, capiCA, r.client.Scheme())
117117
})
@@ -129,7 +129,7 @@ func (r *KamajiControlPlaneReconciler) createOrUpdateCertificateAuthority(ctx co
129129
// also in regard to the naming conventions according to the Cluster API contracts about kubeconfig.
130130
//
131131
// more info: https://cluster-api.sigs.k8s.io/developer/architecture/controllers/cluster.html#secrets
132-
func (r *KamajiControlPlaneReconciler) createOrUpdateKubeconfig(ctx context.Context, reader client.Client, cluster capiv1beta1.Cluster, kcp v1alpha1.KamajiControlPlane, tcp *kamajiv1alpha1.TenantControlPlane) error {
132+
func (r *KamajiControlPlaneReconciler) createOrUpdateKubeconfig(ctx context.Context, reader client.Client, cluster capiv1beta2.Cluster, kcp v1alpha1.KamajiControlPlane, tcp *kamajiv1alpha1.TenantControlPlane) error {
133133
capiAdminKubeconfig := &corev1.Secret{}
134134
capiAdminKubeconfig.Name = cluster.Name + "-kubeconfig"
135135
capiAdminKubeconfig.Namespace = cluster.Namespace
@@ -149,7 +149,7 @@ func (r *KamajiControlPlaneReconciler) createOrUpdateKubeconfig(ctx context.Cont
149149
labels = map[string]string{}
150150
}
151151

152-
labels[capiv1beta1.ClusterNameLabel] = cluster.Name
152+
labels[capiv1beta2.ClusterNameLabel] = cluster.Name
153153
labels["kamaji.clastix.io/component"] = "capi"
154154
labels["kamaji.clastix.io/secret"] = "kubeconfig"
155155
labels["kamaji.clastix.io/cluster"] = cluster.Name
@@ -170,7 +170,7 @@ func (r *KamajiControlPlaneReconciler) createOrUpdateKubeconfig(ctx context.Cont
170170
capiAdminKubeconfig.Data = map[string][]byte{
171171
"value": value,
172172
}
173-
capiAdminKubeconfig.Type = capiv1beta1.ClusterSecretType
173+
capiAdminKubeconfig.Type = capiv1beta2.ClusterSecretType
174174

175175
return controllerutil.SetControllerReference(&kcp, capiAdminKubeconfig, r.client.Scheme())
176176
})

0 commit comments

Comments
 (0)