@@ -93,19 +93,14 @@ This can be used with Cluster API:
93
93
94
94
``` go
95
95
type KubeConfig struct {
96
- // The secret name containing a 'value' key with the kubeconfig file as the value.
97
- // This secret must be in the same Namespace as the Kustomization.
98
- // KubeConfig secrets maintained by Cluster API bootstrap providers can be used here.
99
- // (ex: If your CAPI Cluster's name is `stage`, set this to `stage-kubeconfig`.
100
- // Ensure the Kustomization is in the same Namespace as the Cluster object.
101
- // Ref: https://github.com/kubernetes-sigs/cluster-api/blob/release-0.3/util/secret/consts.go#L24)
102
- // The reconciliation clients are regularly refreshed from the Secret, so
103
- // rotating kubeconfigs for KaaS control-planes from cloud-providers are supported.
104
- // These kubeconfigs follow the same design constraints as Cluster API.
105
- // It is recommended that kubeconfigs be self-contained, and the Secret be
106
- // regularly updated if credentials such as a cloud-access-token expire.
107
- // Cloud-specific `cmd-path` auth helpers will not function without adding
108
- // binaries and credentials to the kustomize-controller Pod.
96
+ // SecretRef holds the name to a secret that contains a 'value' key with
97
+ // the kubeconfig file as the value. It must be in the same namespace as
98
+ // the Kustomization.
99
+ // It is recommended that the kubeconfig is self-contained, and the secret
100
+ // is regularly updated if credentials such as a cloud-access-token expire.
101
+ // Cloud specific `cmd-path` auth helpers will not function without adding
102
+ // binaries and credentials to the Pod that is responsible for reconciling
103
+ // the Kustomization.
109
104
// +required
110
105
SecretRef corev1.LocalObjectReference ` json:"secretRef,omitempty"`
111
106
}
@@ -498,18 +493,19 @@ account. If the kustomization contains cluster level objects like CRDs or object
498
493
namespace, the reconciliation will fail since the account it runs under has no permissions to alter objects
499
494
outside of the `webapp` namespace.
500
495
501
- # # Cluster-API / Remote Clusters
496
+ # # Remote Clusters / Cluster-API
502
497
503
498
If the `kubeConfig` field is set, objects will be applied, health-checked, pruned, and deleted for the default
504
499
cluster specified in that KubeConfig instead of using the in-cluster ServiceAccount.
505
500
506
- This is done by specifying a KubeConfig from a Secret in the same Namespace as the Kustomization.
507
- The KubeConfig bytes are loaded from the `value ` key of the Secret 's data.
508
- This Secret can be regularly updated if cluster-access-tokens have to rotate due to expiration.
501
+ The secret defined in the `kubeConfig.SecretRef` must exist in the same namespace as the Kustomization.
502
+ On every reconciliation, the KubeConfig bytes will be loaded from the `values ` key of the secret 's data, and
503
+ the secret can thus be regularly updated if cluster-access-tokens have to rotate due to expiration.
509
504
510
- This composes well with Cluster API bootstrap providers such as CAPBK(kubeadm) as well as the CAPA(aws) EKS integration.
505
+ This composes well with Cluster API bootstrap providers such as CAPBK (kubeadm) as well as the CAPA (AWS) EKS
506
+ integration.
511
507
512
- To reconcile a kustomization to a CAPI controlled cluster, put the `Kustomization` in the same Namespace as your
508
+ To reconcile a Kustomization to a CAPI controlled cluster, put the `Kustomization` in the same namespace as your
513
509
`Cluster` object, and set the `kubeConfig.secretRef.name` to `<cluster-name>-kubeconfig` :
514
510
515
511
` ` ` yaml
@@ -560,8 +556,9 @@ spec:
560
556
The Cluster and Kustomization can be created at the same time.
561
557
The Kustomization will eventually reconcile once the cluster is available.
562
558
563
- If you wish to target clusters created by other means than CAPI, you can create a ServiceAccount on the remote cluster,
564
- generate a kube config for that account, then create a secret on the cluster where kustomize-controller is running e.g. :
559
+ If you wish to target clusters created by other means than CAPI, you can create a ServiceAccount
560
+ on the remote cluster, generate a KubeConfig for that account, and then create a secret on the
561
+ cluster where kustomize-controller is running e.g. :
565
562
566
563
` ` ` sh
567
564
kubectl create secret generic prod-kubeconfig \
0 commit comments