Skip to content

Commit b8cdb61

Browse files
kvapsclaude
authored andcommitted
fix(talosctl): pass --k8s-endpoint flag to rotate-ca kubernetes rotation
The --k8s-endpoint flag was defined but never used in the rotate-ca command. This fix passes the flag value through to the Kubernetes client, allowing users to override the default Kubernetes API endpoint during CA rotation. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Andrei Kvapil <kvapss@gmail.com> Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com> (cherry picked from commit 0bd48bb)
1 parent 27cbe29 commit b8cdb61

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

cmd/talosctl/cmd/talos/rotate-ca.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ func rotateKubernetesCA(ctx context.Context, c *client.Client, encoderOpt encode
150150
TalosClient: c,
151151
ClusterInfo: clusterInfo,
152152

153+
KubernetesEndpoint: rotateCACmdFlags.forceEndpoint,
154+
153155
NewKubernetesCA: newBundle.Certs.K8s,
154156

155157
EncoderOption: encoderOpt,

pkg/rotate/pki/kubernetes/kubernetes.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ type Options struct {
4242
// ClusterInfo provides information about cluster topology.
4343
ClusterInfo cluster.Info
4444

45+
// KubernetesEndpoint overrides the default Kubernetes API endpoint.
46+
KubernetesEndpoint string
47+
4548
// NewKubernetesCA is the new CA for Kubernetes API.
4649
NewKubernetesCA *x509.PEMEncodedCertificateAndKey
4750

@@ -168,6 +171,7 @@ func (r *rotator) fetchClient(ctx context.Context, clientPtr **cluster.Kubernete
168171

169172
*clientPtr = &cluster.KubernetesClient{
170173
ClientProvider: r.talosClientProvider,
174+
ForceEndpoint: r.opts.KubernetesEndpoint,
171175
}
172176

173177
_, err := (*clientPtr).K8sClient(client.WithNode(ctx, firstNode.InternalIP.String()))

0 commit comments

Comments
 (0)