Skip to content

Commit dc7f6ee

Browse files
committed
Allow overriding secretKey for kubeadm kubeconfig
During reconciliation, the bootstrap provider copies the content from the secret provided by Kamaji, named `<cluster>-admin-kubeconfig` into a `cluster-info` configmap of tenant cluster, which then used by kubeadm to join nodes. This change introduces a new annotation, `kamaji.clastix.io/kubeconfig-secret-key`, for the TenantControlPlane resource. This annotation instructs kamaji to read the kubeconfig from a specific key (the default one is super-admin.conf). Example: ``` kamaji.clastix.io/kubeconfig-secret-key: super-admin.svc ``` This will instruct the system to use `super-admin.svc` a kubeconfig with a local service FQDN (introduced by #403). Signed-off-by: Andrei Kvapil <[email protected]>
1 parent 6123d9a commit dc7f6ee

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

internal/utilities/tenant_client.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,13 @@ func GetTenantKubeconfig(ctx context.Context, client client.Client, tenantContro
4444
return nil, err
4545
}
4646

47-
return DecodeKubeconfig(*secretKubeconfig, kubeadmconstants.SuperAdminKubeConfigFileName)
47+
secretKey := kubeadmconstants.SuperAdminKubeConfigFileName
48+
v, ok := tenantControlPlane.GetAnnotations()["kamaji.clastix.io/kubeconfig-secret-key"]
49+
if ok && v != "" {
50+
secretKey = v
51+
}
52+
53+
return DecodeKubeconfig(*secretKubeconfig, secretKey)
4854
}
4955

5056
func GetRESTClientConfig(ctx context.Context, client client.Client, tenantControlPlane *kamajiv1alpha1.TenantControlPlane) (*restclient.Config, error) {

0 commit comments

Comments
 (0)