Skip to content

Commit

Permalink
update config secret name to be more clear
Browse files Browse the repository at this point in the history
it appears that a change in the cluster-api kubeadm bootstrap provider
is causing secrets with the same name as a machine to be created in the
namespace with the machine object. this is causing the kubeconfig secret
created by the capk controller to be overwritten, which cascades into
kubemark not being able to start.

the fix is to add "kubemark-config" as a suffix to secret.
  • Loading branch information
elmiko committed Sep 7, 2024
1 parent 46c9267 commit 3bf758a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions controllers/kubemarkmachine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ import (
)

const (
kubemarkName = "hollow-node"
kubemarkName = "hollow-node"
kubemarkSecretNameSuffix = "kubemark-config"

// MachineControllerName defines the user-agent name used when creating rest clients.
MachineControllerName = "kubemarkmachine-controller"
Expand Down Expand Up @@ -196,7 +197,7 @@ func (r *KubemarkMachineReconciler) Reconcile(ctx context.Context, req ctrl.Requ
}
if err := kubemarkClusterClient.Delete(ctx, &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: kubemarkMachine.Name,
Name: secret.Name(kubemarkMachine.Name, kubemarkSecretNameSuffix),
Namespace: kubemarkClusterNamespace,
},
}); err != nil {
Expand Down Expand Up @@ -311,7 +312,7 @@ func (r *KubemarkMachineReconciler) Reconcile(ctx context.Context, req ctrl.Requ

secret := &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: kubemarkMachine.Name,
Name: secret.Name(kubemarkMachine.Name, kubemarkSecretNameSuffix),
Namespace: kubemarkClusterNamespace,
},
Data: map[string][]byte{
Expand Down

0 comments on commit 3bf758a

Please sign in to comment.