From 4810509fa3adaf5de9af65acbe6dd5a701e5c4b8 Mon Sep 17 00:00:00 2001 From: Matt McEuen Date: Wed, 4 Nov 2020 18:38:25 -0600 Subject: [PATCH] Fix Version Catalogue replacement for Clusterctl A previous patchset was intended to accomplish a two-part substitution of container versions into CAPI components, to work around assumptions held by clusterctl: (versions catalogue) --[ReplacementTransformer]--> (Clusterctl YAML) ... then (Clusterctl YAML) --[clusterctl library]--> (CAPI manifests) However, only the second leg (the hard part) worked right; the first part had gaps which are fixed by this change. This also adds the CAPD container definitions to the Clusterctl variables. Change-Id: Ifaca46f6dd3b87c28753cd49b52e62556ead52bd Closes: https://github.com/airshipit/airshipctl/issues/389 --- .../versions-airshipctl.yaml | 5 +- .../clusterctl/replacements/versions.yaml | 107 ++++++++++++++++-- manifests/phases/kustomization.yaml | 3 + 3 files changed, 103 insertions(+), 12 deletions(-) diff --git a/manifests/function/airshipctl-base-catalogues/versions-airshipctl.yaml b/manifests/function/airshipctl-base-catalogues/versions-airshipctl.yaml index f17ec0f47..95a96c341 100644 --- a/manifests/function/airshipctl-base-catalogues/versions-airshipctl.yaml +++ b/manifests/function/airshipctl-base-catalogues/versions-airshipctl.yaml @@ -23,7 +23,7 @@ files: images: capm3: # Images specific to the camp3 function; etc. - manager: quay.io/metal3-io/cluster-api-provider-metal3 + manager: quay.io/metal3-io/cluster-api-provider-metal3:v0.3.2 auth_proxy: gcr.io/kubebuilder/kube-rbac-proxy:v0.4.0 cacpk: manager: us.gcr.io/k8s-artifacts-prod/cluster-api/kubeadm-control-plane-controller:v0.3.7 @@ -31,6 +31,9 @@ images: cabpk: manager: us.gcr.io/k8s-artifacts-prod/cluster-api/kubeadm-bootstrap-controller:v0.3.7 auth_proxy: gcr.io/kubebuilder/kube-rbac-proxy:v0.4.1 + capd: + manager: gcr.io/k8s-staging-cluster-api/capd-manager:v20201019-v0.3.10-86-gc1647481f + auth_proxy: gcr.io/kubebuilder/kube-rbac-proxy:v0.4.0 capi: manager: us.gcr.io/k8s-artifacts-prod/cluster-api/cluster-api-controller:v0.3.7 auth_proxy: gcr.io/kubebuilder/kube-rbac-proxy:v0.4.1 diff --git a/manifests/function/clusterctl/replacements/versions.yaml b/manifests/function/clusterctl/replacements/versions.yaml index f655c0baa..4dd329cff 100644 --- a/manifests/function/clusterctl/replacements/versions.yaml +++ b/manifests/function/clusterctl/replacements/versions.yaml @@ -1,4 +1,4 @@ -# These rules inject versioned artifacts into the k8scontrol function. +# These rules inject versioned artifacts into the clusterctl function. apiVersion: airshipit.org/v1alpha1 kind: ReplacementTransformer metadata: @@ -8,24 +8,109 @@ metadata: container: image: quay.io/airshipit/replacement-transformer:dev replacements: -# Replace the Kubernetes version in the KubeadmControlPlane +# Replace capm3 versions - source: objref: + kind: VariableCatalogue name: versions-airshipctl - fieldref: "{.kubernetes}" + fieldref: "{.images.capm3.manager}" target: objref: - kind: KubeadmControlPlane - name: cluster-controlplane - fieldrefs: ["{.spec.version}"] -# Replace the controlplane disk image in the Metal3MachineTemplate + kind: Clusterctl + name: clusterctl_init + fieldrefs: ["{.additional-vars.CONTAINER_CAPM3_MANAGER}"] - source: objref: + kind: VariableCatalogue name: versions-airshipctl - fieldref: "{.files.k8scontrol.cluster_controlplane_image}" + fieldref: "{.images.capm3.auth_proxy}" target: objref: - kind: Metal3MachineTemplate - name: cluster-controlplane - fieldrefs: ["{.spec.template.spec.image}"] + kind: Clusterctl + name: clusterctl_init + fieldrefs: ["{.additional-vars.CONTAINER_CAPM3_AUTH_PROXY}"] +# Replace cacpk versions +- source: + objref: + kind: VariableCatalogue + name: versions-airshipctl + fieldref: "{.images.cacpk.manager}" + target: + objref: + kind: Clusterctl + name: clusterctl_init + fieldrefs: ["{.additional-vars.CONTAINER_CACPK_MANAGER}"] +- source: + objref: + kind: VariableCatalogue + name: versions-airshipctl + fieldref: "{.images.cacpk.auth_proxy}" + target: + objref: + kind: Clusterctl + name: clusterctl_init + fieldrefs: ["{.additional-vars.CONTAINER_CACPK_AUTH_PROXY}"] +# Replace cabpk versions +- source: + objref: + kind: VariableCatalogue + name: versions-airshipctl + fieldref: "{.images.cabpk.manager}" + target: + objref: + kind: Clusterctl + name: clusterctl_init + fieldrefs: ["{.additional-vars.CONTAINER_CABPK_MANAGER}"] +- source: + objref: + kind: VariableCatalogue + name: versions-airshipctl + fieldref: "{.images.cabpk.auth_proxy}" + target: + objref: + kind: Clusterctl + name: clusterctl_init + fieldrefs: ["{.additional-vars.CONTAINER_CABPK_AUTH_PROXY}"] +# Replace capd versions +- source: + objref: + kind: VariableCatalogue + name: versions-airshipctl + fieldref: "{.images.capd.manager}" + target: + objref: + kind: Clusterctl + name: clusterctl_init + fieldrefs: ["{.additional-vars.CONTAINER_CAPD_MANAGER}"] +- source: + objref: + kind: VariableCatalogue + name: versions-airshipctl + fieldref: "{.images.capd.auth_proxy}" + target: + objref: + kind: Clusterctl + name: clusterctl_init + fieldrefs: ["{.additional-vars.CONTAINER_CAPD_AUTH_PROXY}"] +# Replace capi versions +- source: + objref: + kind: VariableCatalogue + name: versions-airshipctl + fieldref: "{.images.capi.manager}" + target: + objref: + kind: Clusterctl + name: clusterctl_init + fieldrefs: ["{.additional-vars.CONTAINER_CAPI_MANAGER}"] +- source: + objref: + kind: VariableCatalogue + name: versions-airshipctl + fieldref: "{.images.capi.auth_proxy}" + target: + objref: + kind: Clusterctl + name: clusterctl_init + fieldrefs: ["{.additional-vars.CONTAINER_CAPI_AUTH_PROXY}"] diff --git a/manifests/phases/kustomization.yaml b/manifests/phases/kustomization.yaml index bb5cb9adb..146564805 100644 --- a/manifests/phases/kustomization.yaml +++ b/manifests/phases/kustomization.yaml @@ -5,5 +5,8 @@ resources: - cluster-map.yaml - kubeconfig.yaml - ../function/clusterctl + - ../function/airshipctl-base-catalogues patchesStrategicMerge: - clusterctl_init_options.yaml +transformers: + - ../function/clusterctl/replacements