From b8dcf4ef4e7dff2252a2a3931ccd4ac6816d01ec Mon Sep 17 00:00:00 2001 From: Khaja Omer <56000175+komer3@users.noreply.github.com> Date: Fri, 29 Mar 2024 13:07:25 -0500 Subject: [PATCH] add clusterctl labels to allow clusterctl move command (#223) * Adding labels for to CRDs so clusterctl discovery mechnism works * Add labels for resource not picked up by clusterctl by default * add provider label to CRDs --------- Co-authored-by: Khaja Omer --- Tiltfile | 2 ++ config/crd/kustomization.yaml | 1 + templates/common-init-files/secret.yaml | 2 ++ templates/flavors/base/secret.yaml | 2 ++ 4 files changed, 7 insertions(+) diff --git a/Tiltfile b/Tiltfile index 10b3f39ec..c242025e9 100644 --- a/Tiltfile +++ b/Tiltfile @@ -28,6 +28,8 @@ manager_yaml = decode_yaml_stream(kustomize("config/default")) for resource in manager_yaml: if resource["metadata"]["name"] == "capl-manager-credentials": resource["stringData"]["apiToken"] = os.getenv('LINODE_TOKEN') + if resource["kind"] == "CustomResourceDefinition" and resource["spec"]["group"] == "infrastructure.cluster.x-k8s.io": + resource["metadata"]["labels"]["clusterctl.cluster.x-k8s.io"] = "" k8s_yaml(encode_yaml_stream(manager_yaml)) k8s_resource( diff --git a/config/crd/kustomization.yaml b/config/crd/kustomization.yaml index 6ced66145..dd129d480 100644 --- a/config/crd/kustomization.yaml +++ b/config/crd/kustomization.yaml @@ -3,6 +3,7 @@ labels: - pairs: cluster.x-k8s.io/v1beta1: v1alpha1 + cluster.x-k8s.io/provider: "infrastructure-linode" # This kustomization.yaml is not intended to be run by itself, # since it depends on service name and namespace that are out of this kustomize package. diff --git a/templates/common-init-files/secret.yaml b/templates/common-init-files/secret.yaml index e2b3a7827..d0906c7a1 100644 --- a/templates/common-init-files/secret.yaml +++ b/templates/common-init-files/secret.yaml @@ -2,6 +2,8 @@ apiVersion: v1 kind: Secret metadata: name: common-init-files + labels: + clusterctl.cluster.x-k8s.io/move: "true" stringData: containerd-config.toml: | version = 2 diff --git a/templates/flavors/base/secret.yaml b/templates/flavors/base/secret.yaml index cadc5e564..0769643c7 100644 --- a/templates/flavors/base/secret.yaml +++ b/templates/flavors/base/secret.yaml @@ -3,5 +3,7 @@ apiVersion: v1 kind: Secret metadata: name: ${CLUSTER_NAME}-credentials + labels: + clusterctl.cluster.x-k8s.io/move: "true" stringData: apiToken: ${LINODE_TOKEN}