Skip to content

Commit

Permalink
fix(kubeadm): ensure admin clusterrolebinding with in-cluster client (#…
Browse files Browse the repository at this point in the history
…608)

Signed-off-by: Dario Tranchitella <[email protected]>
  • Loading branch information
prometherion authored Oct 21, 2024
1 parent e4939f6 commit 9ca69e9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/resources/kubeadm_phases.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"fmt"
"os"
"strings"
"time"

corev1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
Expand Down Expand Up @@ -143,7 +144,6 @@ func (r *KubeadmPhase) GetKubeadmFunction(ctx context.Context, tcp *kamajiv1alph
defer func() { _ = os.Remove(tmp) }()

var caSecret corev1.Secret

if err = r.Client.Get(ctx, types.NamespacedName{Name: tcp.Status.Certificates.CA.SecretName, Namespace: tcp.Namespace}, &caSecret); err != nil {
return nil, err
}
Expand All @@ -164,7 +164,9 @@ func (r *KubeadmPhase) GetKubeadmFunction(ctx context.Context, tcp *kamajiv1alph
_ = os.WriteFile(fmt.Sprintf("%s/%s", tmp, i), kubeconfigValue, os.ModePerm)
}

if _, err = kubeconfig.EnsureAdminClusterRoleBinding(tmp, nil); err != nil {
if _, err = kubeconfig.EnsureAdminClusterRoleBinding(tmp, func(_ context.Context, _ clientset.Interface, _ clientset.Interface, duration time.Duration, duration2 time.Duration) (clientset.Interface, error) {
return kubeconfig.EnsureAdminClusterRoleBindingImpl(ctx, c, c, duration, duration2)
}); err != nil {
return nil, err
}

Expand Down

0 comments on commit 9ca69e9

Please sign in to comment.