Skip to content

Commit

Permalink
add clusterctl labels to allow clusterctl move command (#223)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
komer3 and komer3 authored Mar 29, 2024
1 parent 585a8dc commit b8dcf4e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions templates/common-init-files/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions templates/flavors/base/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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}

0 comments on commit b8dcf4e

Please sign in to comment.