Skip to content

Commit 41c4d39

Browse files
committed
Controller changes
1 parent cd1a25d commit 41c4d39

File tree

10 files changed

+148
-27
lines changed

10 files changed

+148
-27
lines changed

controllers/clustercache/cluster_accessor.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ package clustercache
1818

1919
import (
2020
"context"
21-
"crypto/rsa"
21+
"crypto"
2222
"fmt"
2323
"sync"
2424
"time"
@@ -165,7 +165,7 @@ type clusterAccessorLockedState struct {
165165
// cert to communicate with etcd.
166166
// This private key is stored and cached in the ClusterCache because it's expensive to generate a new
167167
// private key in every single Reconcile.
168-
clientCertificatePrivateKey *rsa.PrivateKey
168+
clientCertificatePrivateKey crypto.Signer
169169

170170
// healthChecking holds the health checking state (e.g. lastProbeSuccessTime, consecutiveFailures)
171171
// of the clusterAccessor.
@@ -286,7 +286,7 @@ func (ca *clusterAccessor) Connect(ctx context.Context) (retErr error) {
286286
// private key generation fails because we check Connected above.
287287
if ca.lockedState.clientCertificatePrivateKey == nil {
288288
log.V(6).Info("Generating client certificate private key")
289-
clientCertificatePrivateKey, err := certs.NewPrivateKey()
289+
clientCertificatePrivateKey, err := certs.NewPrivateKey("")
290290
if err != nil {
291291
return errors.Wrapf(err, "error creating client certificate private key")
292292
}
@@ -435,7 +435,7 @@ func (ca *clusterAccessor) GetRESTConfig(ctx context.Context) (*rest.Config, err
435435
return ca.lockedState.connection.restConfig, nil
436436
}
437437

438-
func (ca *clusterAccessor) GetClientCertificatePrivateKey(ctx context.Context) *rsa.PrivateKey {
438+
func (ca *clusterAccessor) GetClientCertificatePrivateKey(ctx context.Context) crypto.Signer {
439439
ca.rLock(ctx)
440440
defer ca.rUnlock(ctx)
441441

controllers/clustercache/cluster_cache.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ package clustercache
1818

1919
import (
2020
"context"
21-
"crypto/rsa"
21+
"crypto"
2222
"fmt"
2323
"os"
2424
"strings"
@@ -150,7 +150,7 @@ type ClusterCache interface {
150150
//
151151
// Deprecated: This method is deprecated and will be removed in a future release as caching a rsa.PrivateKey
152152
// is outside the scope of the ClusterCache.
153-
GetClientCertificatePrivateKey(ctx context.Context, cluster client.ObjectKey) (*rsa.PrivateKey, error)
153+
GetClientCertificatePrivateKey(ctx context.Context, cluster client.ObjectKey) (crypto.Signer, error)
154154

155155
// Watch watches a workload cluster for events.
156156
// Each unique watch (by input.Name) is only added once after a Connect (otherwise we return early).
@@ -417,7 +417,7 @@ func (cc *clusterCache) GetRESTConfig(ctx context.Context, cluster client.Object
417417
return accessor.GetRESTConfig(ctx)
418418
}
419419

420-
func (cc *clusterCache) GetClientCertificatePrivateKey(ctx context.Context, cluster client.ObjectKey) (*rsa.PrivateKey, error) {
420+
func (cc *clusterCache) GetClientCertificatePrivateKey(ctx context.Context, cluster client.ObjectKey) (crypto.Signer, error) {
421421
accessor := cc.getClusterAccessor(cluster)
422422
if accessor == nil {
423423
return nil, errors.New("error getting client certificate private key: private key was not generated yet")

controlplane/kubeadm/internal/cluster.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
"k8s.io/client-go/rest"
3131
"sigs.k8s.io/controller-runtime/pkg/client"
3232

33+
bootstrapv1 "sigs.k8s.io/cluster-api/api/bootstrap/kubeadm/v1beta2"
3334
clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2"
3435
"sigs.k8s.io/cluster-api/controllers/clustercache"
3536
"sigs.k8s.io/cluster-api/util/cache"
@@ -43,7 +44,7 @@ type ManagementCluster interface {
4344

4445
GetMachinesForCluster(ctx context.Context, cluster *clusterv1.Cluster, filters ...collections.Func) (collections.Machines, error)
4546
GetMachinePoolsForCluster(ctx context.Context, cluster *clusterv1.Cluster) (*clusterv1.MachinePoolList, error)
46-
GetWorkloadCluster(ctx context.Context, clusterKey client.ObjectKey) (WorkloadCluster, error)
47+
GetWorkloadCluster(ctx context.Context, clusterKey client.ObjectKey, keyEncryptionAlgorithm bootstrapv1.EncryptionAlgorithmType) (WorkloadCluster, error)
4748
}
4849

4950
// Management holds operations on the management cluster.
@@ -59,13 +60,14 @@ type Management struct {
5960

6061
// ClientCertEntry is an Entry for the Cache that stores the client cert.
6162
type ClientCertEntry struct {
62-
Cluster client.ObjectKey
63-
ClientCert *tls.Certificate
63+
Cluster client.ObjectKey
64+
ClientCert *tls.Certificate
65+
EncryptionAlgorithm bootstrapv1.EncryptionAlgorithmType
6466
}
6567

6668
// Key returns the cache key of a ClientCertEntry.
6769
func (r ClientCertEntry) Key() string {
68-
return r.Cluster.String()
70+
return fmt.Sprintf("%s/%s", r.Cluster.String(), r.EncryptionAlgorithm)
6971
}
7072

7173
// RemoteClusterConnectionError represents a failure to connect to a remote cluster.
@@ -77,7 +79,7 @@ type RemoteClusterConnectionError struct {
7779
// Error satisfies the error interface.
7880
func (e *RemoteClusterConnectionError) Error() string { return e.Name + ": " + e.Err.Error() }
7981

80-
// Unwrap satisfies the unwrap error inteface.
82+
// Unwrap satisfies the unwrap error interface.
8183
func (e *RemoteClusterConnectionError) Unwrap() error { return e.Err }
8284

8385
// Get implements client.Reader.
@@ -111,7 +113,7 @@ func (m *Management) GetMachinePoolsForCluster(ctx context.Context, cluster *clu
111113

112114
// GetWorkloadCluster builds a cluster object.
113115
// The cluster comes with an etcd client generator to connect to any etcd pod living on a managed machine.
114-
func (m *Management) GetWorkloadCluster(ctx context.Context, clusterKey client.ObjectKey) (WorkloadCluster, error) {
116+
func (m *Management) GetWorkloadCluster(ctx context.Context, clusterKey client.ObjectKey, keyEncryptionAlgorithm bootstrapv1.EncryptionAlgorithmType) (WorkloadCluster, error) {
115117
// TODO(chuckha): Inject this dependency.
116118
// TODO(chuckha): memoize this function. The workload client only exists as long as a reconciliation loop.
117119
restConfig, err := m.ClusterCache.GetRESTConfig(ctx, clusterKey)
@@ -142,15 +144,15 @@ func (m *Management) GetWorkloadCluster(ctx context.Context, clusterKey client.O
142144
// Get client cert from cache if possible, otherwise generate it and add it to the cache.
143145
// TODO: When we implement ClusterConfiguration.EncryptionAlgorithm we should add it to
144146
// the ClientCertEntries and make it part of the key.
145-
if entry, ok := m.ClientCertCache.Has(ClientCertEntry{Cluster: clusterKey}.Key()); ok {
147+
if entry, ok := m.ClientCertCache.Has(ClientCertEntry{Cluster: clusterKey, EncryptionAlgorithm: keyEncryptionAlgorithm}.Key()); ok {
146148
clientCert = *entry.ClientCert
147149
} else {
148150
// The client cert expires after 10 years, but that's okay as the cache has a TTL of 1 day.
149-
clientCert, err = generateClientCert(crtData, keyData)
151+
clientCert, err = generateClientCert(crtData, keyData, keyEncryptionAlgorithm)
150152
if err != nil {
151153
return nil, err
152154
}
153-
m.ClientCertCache.Add(ClientCertEntry{Cluster: clusterKey, ClientCert: &clientCert})
155+
m.ClientCertCache.Add(ClientCertEntry{Cluster: clusterKey, ClientCert: &clientCert, EncryptionAlgorithm: keyEncryptionAlgorithm})
154156
}
155157
} else {
156158
clientCert, err = m.getAPIServerEtcdClientCert(ctx, clusterKey)

controlplane/kubeadm/internal/control_plane.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ func (c *ControlPlane) GetWorkloadCluster(ctx context.Context) (WorkloadCluster,
372372
return c.workloadCluster, nil
373373
}
374374

375-
workloadCluster, err := c.managementCluster.GetWorkloadCluster(ctx, client.ObjectKeyFromObject(c.Cluster))
375+
workloadCluster, err := c.managementCluster.GetWorkloadCluster(ctx, client.ObjectKeyFromObject(c.Cluster), c.GetKeyEncryptionAlgorithm())
376376
if err != nil {
377377
return nil, err
378378
}
@@ -467,3 +467,8 @@ func (c *ControlPlane) StatusToLogKeyAndValues(newMachine, deletedMachine *clust
467467
"etcdMembers", strings.Join(etcdMembers, ", "),
468468
}
469469
}
470+
471+
// GetKeyEncryptionAlgorithm returns the control plane EncryptionAlgorithm.
472+
func (c *ControlPlane) GetKeyEncryptionAlgorithm() bootstrapv1.EncryptionAlgorithmType {
473+
return c.KCP.Spec.KubeadmConfigSpec.ClusterConfiguration.EncryptionAlgorithm
474+
}

controlplane/kubeadm/internal/controllers/controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ func (r *KubeadmControlPlaneReconciler) reconcile(ctx context.Context, controlPl
442442
}
443443

444444
// Generate Cluster Kubeconfig if needed
445-
if result, err := r.reconcileKubeconfig(ctx, controlPlane); !result.IsZero() || err != nil {
445+
if result, err := r.reconcileKubeconfig(ctx, controlPlane); err != nil || !result.IsZero() {
446446
if err != nil {
447447
log.Error(err, "Failed to reconcile Kubeconfig")
448448
}

controlplane/kubeadm/internal/controllers/helpers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ func (r *KubeadmControlPlaneReconciler) reconcileKubeconfig(ctx context.Context,
5252
if endpoint.IsZero() {
5353
return ctrl.Result{}, nil
5454
}
55-
5655
controllerOwnerRef := *metav1.NewControllerRef(controlPlane.KCP, controlplanev1.GroupVersion.WithKind(kubeadmControlPlaneKind))
5756
clusterName := util.ObjectKey(controlPlane.Cluster)
5857
configSecret, err := secret.GetFromNamespacedName(ctx, r.SecretCachingClient, clusterName, secret.Kubeconfig)
@@ -64,6 +63,7 @@ func (r *KubeadmControlPlaneReconciler) reconcileKubeconfig(ctx context.Context,
6463
clusterName,
6564
endpoint.String(),
6665
controllerOwnerRef,
66+
controlPlane.GetKeyEncryptionAlgorithm(),
6767
)
6868
if errors.Is(createErr, kubeconfig.ErrDependentCertificateNotFound) {
6969
return ctrl.Result{RequeueAfter: dependentCertRequeueAfter}, nil
@@ -90,7 +90,7 @@ func (r *KubeadmControlPlaneReconciler) reconcileKubeconfig(ctx context.Context,
9090

9191
if needsRotation {
9292
log.Info("Rotating kubeconfig secret")
93-
if err := kubeconfig.RegenerateSecret(ctx, r.Client, configSecret); err != nil {
93+
if err := kubeconfig.RegenerateSecret(ctx, r.Client, configSecret, controlPlane.GetKeyEncryptionAlgorithm()); err != nil {
9494
return ctrl.Result{}, errors.Wrap(err, "failed to regenerate kubeconfig")
9595
}
9696
}

controlplane/kubeadm/internal/controllers/update.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ func (r *KubeadmControlPlaneReconciler) updateControlPlane(
6969
workloadCluster.UpdateAPIServerInKubeadmConfigMap(controlPlane.KCP.Spec.KubeadmConfigSpec.ClusterConfiguration.APIServer),
7070
workloadCluster.UpdateControllerManagerInKubeadmConfigMap(controlPlane.KCP.Spec.KubeadmConfigSpec.ClusterConfiguration.ControllerManager),
7171
workloadCluster.UpdateSchedulerInKubeadmConfigMap(controlPlane.KCP.Spec.KubeadmConfigSpec.ClusterConfiguration.Scheduler),
72-
workloadCluster.UpdateCertificateValidityPeriodDays(controlPlane.KCP.Spec.KubeadmConfigSpec.ClusterConfiguration.CertificateValidityPeriodDays))
72+
workloadCluster.UpdateCertificateValidityPeriodDays(controlPlane.KCP.Spec.KubeadmConfigSpec.ClusterConfiguration.CertificateValidityPeriodDays),
73+
workloadCluster.UpdateEncryptionAlgorithm(controlPlane.KCP.Spec.KubeadmConfigSpec.ClusterConfiguration.EncryptionAlgorithm))
7374

7475
// Etcd local and external are mutually exclusive and they cannot be switched, once set.
7576
if controlPlane.IsEtcdManaged() {
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
/*
2+
Copyright 2020 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package controllers
18+
19+
import (
20+
"context"
21+
22+
"github.com/blang/semver/v4"
23+
"github.com/pkg/errors"
24+
"k8s.io/klog/v2"
25+
ctrl "sigs.k8s.io/controller-runtime"
26+
27+
bootstrapv1 "sigs.k8s.io/cluster-api/api/bootstrap/kubeadm/v1beta2"
28+
controlplanev1 "sigs.k8s.io/cluster-api/api/controlplane/kubeadm/v1beta2"
29+
"sigs.k8s.io/cluster-api/controlplane/kubeadm/internal"
30+
"sigs.k8s.io/cluster-api/util/collections"
31+
)
32+
33+
func (r *KubeadmControlPlaneReconciler) upgradeControlPlane(
34+
ctx context.Context,
35+
controlPlane *internal.ControlPlane,
36+
machinesRequireUpgrade collections.Machines,
37+
) (ctrl.Result, error) {
38+
log := ctrl.LoggerFrom(ctx)
39+
40+
// TODO: handle reconciliation of etcd members and kubeadm config in case they get out of sync with cluster
41+
42+
workloadCluster, err := controlPlane.GetWorkloadCluster(ctx)
43+
if err != nil {
44+
log.Error(err, "failed to get remote client for workload cluster", "Cluster", klog.KObj(controlPlane.Cluster))
45+
return ctrl.Result{}, err
46+
}
47+
48+
parsedVersion, err := semver.ParseTolerant(controlPlane.KCP.Spec.Version)
49+
if err != nil {
50+
return ctrl.Result{}, errors.Wrapf(err, "failed to parse kubernetes version %q", controlPlane.KCP.Spec.Version)
51+
}
52+
53+
// Ensure kubeadm clusterRoleBinding for v1.29+ as per https://github.com/kubernetes/kubernetes/pull/121305
54+
if err := workloadCluster.AllowClusterAdminPermissions(ctx, parsedVersion); err != nil {
55+
return ctrl.Result{}, errors.Wrap(err, "failed to set cluster-admin ClusterRoleBinding for kubeadm")
56+
}
57+
58+
kubeadmCMMutators := make([]func(*bootstrapv1.ClusterConfiguration), 0)
59+
60+
if controlPlane.KCP.Spec.KubeadmConfigSpec.ClusterConfiguration.IsDefined() {
61+
// Get the imageRepository or the correct value if nothing is set and a migration is necessary.
62+
imageRepository := internal.ImageRepositoryFromClusterConfig(controlPlane.KCP.Spec.KubeadmConfigSpec.ClusterConfiguration)
63+
64+
kubeadmCMMutators = append(kubeadmCMMutators,
65+
workloadCluster.UpdateImageRepositoryInKubeadmConfigMap(imageRepository),
66+
workloadCluster.UpdateFeatureGatesInKubeadmConfigMap(controlPlane.KCP.Spec.KubeadmConfigSpec, parsedVersion),
67+
workloadCluster.UpdateAPIServerInKubeadmConfigMap(controlPlane.KCP.Spec.KubeadmConfigSpec.ClusterConfiguration.APIServer),
68+
workloadCluster.UpdateControllerManagerInKubeadmConfigMap(controlPlane.KCP.Spec.KubeadmConfigSpec.ClusterConfiguration.ControllerManager),
69+
workloadCluster.UpdateSchedulerInKubeadmConfigMap(controlPlane.KCP.Spec.KubeadmConfigSpec.ClusterConfiguration.Scheduler),
70+
workloadCluster.UpdateCertificateValidityPeriodDays(controlPlane.KCP.Spec.KubeadmConfigSpec.ClusterConfiguration.CertificateValidityPeriodDays),
71+
workloadCluster.UpdateEncryptionAlgorithm(controlPlane.KCP.Spec.KubeadmConfigSpec.ClusterConfiguration.EncryptionAlgorithm))
72+
73+
// Etcd local and external are mutually exclusive and they cannot be switched, once set.
74+
if controlPlane.IsEtcdManaged() {
75+
kubeadmCMMutators = append(kubeadmCMMutators,
76+
workloadCluster.UpdateEtcdLocalInKubeadmConfigMap(controlPlane.KCP.Spec.KubeadmConfigSpec.ClusterConfiguration.Etcd.Local))
77+
} else {
78+
kubeadmCMMutators = append(kubeadmCMMutators,
79+
workloadCluster.UpdateEtcdExternalInKubeadmConfigMap(controlPlane.KCP.Spec.KubeadmConfigSpec.ClusterConfiguration.Etcd.External))
80+
}
81+
}
82+
83+
// collectively update Kubeadm config map
84+
if err = workloadCluster.UpdateClusterConfiguration(ctx, parsedVersion, kubeadmCMMutators...); err != nil {
85+
return ctrl.Result{}, err
86+
}
87+
88+
switch controlPlane.KCP.Spec.Rollout.Strategy.Type {
89+
case controlplanev1.RollingUpdateStrategyType:
90+
// RolloutStrategy is currently defaulted and validated to be RollingUpdate
91+
// We can ignore MaxUnavailable because we are enforcing health checks before we get here.
92+
maxNodes := *controlPlane.KCP.Spec.Replicas + int32(controlPlane.KCP.Spec.Rollout.Strategy.RollingUpdate.MaxSurge.IntValue())
93+
if int32(controlPlane.Machines.Len()) < maxNodes {
94+
// scaleUp ensures that we don't continue scaling up while waiting for Machines to have NodeRefs
95+
return r.scaleUpControlPlane(ctx, controlPlane)
96+
}
97+
return r.scaleDownControlPlane(ctx, controlPlane, machinesRequireUpgrade)
98+
default:
99+
log.Info("RolloutStrategy type is not set to RollingUpdate, unable to determine the strategy for rolling out machines")
100+
return ctrl.Result{}, nil
101+
}
102+
}

controlplane/kubeadm/internal/workload_cluster.go

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"context"
2121
"crypto"
2222
"crypto/rand"
23-
"crypto/rsa"
2423
"crypto/tls"
2524
"crypto/x509"
2625
"crypto/x509/pkix"
@@ -88,6 +87,7 @@ type WorkloadCluster interface {
8887
UpdateControllerManagerInKubeadmConfigMap(controllerManager bootstrapv1.ControllerManager) func(*bootstrapv1.ClusterConfiguration)
8988
UpdateSchedulerInKubeadmConfigMap(scheduler bootstrapv1.Scheduler) func(*bootstrapv1.ClusterConfiguration)
9089
UpdateCertificateValidityPeriodDays(certificateValidityPeriodDays int32) func(*bootstrapv1.ClusterConfiguration)
90+
UpdateEncryptionAlgorithm(encryptionAlgorithm bootstrapv1.EncryptionAlgorithmType) func(*bootstrapv1.ClusterConfiguration)
9191
UpdateKubeProxyImageInfo(ctx context.Context, kcp *controlplanev1.KubeadmControlPlane) error
9292
UpdateCoreDNS(ctx context.Context, kcp *controlplanev1.KubeadmControlPlane) error
9393
RemoveEtcdMemberForMachine(ctx context.Context, machine *clusterv1.Machine) error
@@ -195,6 +195,13 @@ func (w *Workload) UpdateCertificateValidityPeriodDays(certificateValidityPeriod
195195
}
196196
}
197197

198+
// UpdateEncryptionAlgorithm updates EncryptionAlgorithmType in kubeadm config map.
199+
func (w *Workload) UpdateEncryptionAlgorithm(encryptionAlgorithm bootstrapv1.EncryptionAlgorithmType) func(*bootstrapv1.ClusterConfiguration) {
200+
return func(c *bootstrapv1.ClusterConfiguration) {
201+
c.EncryptionAlgorithm = encryptionAlgorithm
202+
}
203+
}
204+
198205
// UpdateClusterConfiguration gets the ClusterConfiguration kubeadm-config ConfigMap, converts it to the
199206
// Cluster API representation, and then applies a mutation func; if changes are detected, the
200207
// data are converted back into the Kubeadm API version in use for the target Kubernetes version and the
@@ -347,7 +354,7 @@ func calculateAPIServerPort(config *bootstrapv1.KubeadmConfig) int32 {
347354
return 6443
348355
}
349356

350-
func generateClientCert(caCertEncoded, caKeyEncoded []byte) (tls.Certificate, error) {
357+
func generateClientCert(caCertEncoded, caKeyEncoded []byte, keyEncryptionAlgorithm bootstrapv1.EncryptionAlgorithmType) (tls.Certificate, error) {
351358
caCert, err := certs.DecodeCertPEM(caCertEncoded)
352359
if err != nil {
353360
return tls.Certificate{}, err
@@ -356,18 +363,22 @@ func generateClientCert(caCertEncoded, caKeyEncoded []byte) (tls.Certificate, er
356363
if err != nil {
357364
return tls.Certificate{}, err
358365
}
359-
clientKey, err := certs.NewPrivateKey()
366+
clientKey, err := certs.NewPrivateKey(keyEncryptionAlgorithm)
360367
if err != nil {
361368
return tls.Certificate{}, err
362369
}
363370
x509Cert, err := newClientCert(caCert, clientKey, caKey)
364371
if err != nil {
365372
return tls.Certificate{}, err
366373
}
367-
return tls.X509KeyPair(certs.EncodeCertPEM(x509Cert), certs.EncodePrivateKeyPEM(clientKey))
374+
encodedClientKey, err := certs.EncodePrivateKeyPEM(clientKey)
375+
if err != nil {
376+
return tls.Certificate{}, err
377+
}
378+
return tls.X509KeyPair(certs.EncodeCertPEM(x509Cert), encodedClientKey)
368379
}
369380

370-
func newClientCert(caCert *x509.Certificate, key *rsa.PrivateKey, caKey crypto.Signer) (*x509.Certificate, error) {
381+
func newClientCert(caCert *x509.Certificate, key crypto.Signer, caKey crypto.Signer) (*x509.Certificate, error) {
371382
cfg := certs.Config{
372383
CommonName: "cluster-api.x-k8s.io",
373384
}

internal/controllers/cluster/cluster_controller_phases.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ func (r *Reconciler) reconcileKubeconfig(ctx context.Context, s *scope) (ctrl.Re
360360
_, err := secret.Get(ctx, r.Client, util.ObjectKey(cluster), secret.Kubeconfig)
361361
switch {
362362
case apierrors.IsNotFound(err):
363-
if err := kubeconfig.CreateSecret(ctx, r.Client, cluster); err != nil {
363+
if err := kubeconfig.CreateSecret(ctx, r.Client, cluster, ""); err != nil { // TODO(Karthik): Discuss on how to pass the keyEncryptionAlgorithm
364364
if errors.Is(err, kubeconfig.ErrDependentCertificateNotFound) {
365365
log.Info("Could not find secret for cluster, requeuing", "Secret", secret.ClusterCA)
366366
return ctrl.Result{RequeueAfter: 30 * time.Second}, nil

0 commit comments

Comments
 (0)