Skip to content

Commit

Permalink
Add join token to SANs (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
bschimke95 authored Aug 28, 2024
1 parent f9d6a96 commit b532314
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion bootstrap/controllers/ck8sconfig_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,15 @@ func (r *CK8sConfigReconciler) joinControlplane(ctx context.Context, scope *Scop
return fmt.Errorf("failed to request join token: %w", err)
}

controlPlaneConfig := scope.Config.Spec.ControlPlaneConfig
// Adding the join token name to the extra SANs is required because the token name
// and kubelet name diverge in the CAPI context.
// See https://github.com/canonical/k8s-snap/pull/629 for more details.
controlPlaneConfig.ExtraSANs = append(controlPlaneConfig.ExtraSANs, scope.Config.Name)

configStruct := ck8s.GenerateJoinControlPlaneConfig(ck8s.JoinControlPlaneConfig{
ControlPlaneEndpoint: scope.Cluster.Spec.ControlPlaneEndpoint.Host,
ControlPlaneConfig: scope.Config.Spec.ControlPlaneConfig,
ControlPlaneConfig: controlPlaneConfig,
})
joinConfig, err := kubeyaml.Marshal(configStruct)
if err != nil {
Expand Down

0 comments on commit b532314

Please sign in to comment.