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
This commit is contained in:
Matt McEuen 2020-11-04 18:38:25 -06:00
parent 193dc935f1
commit 4810509fa3
3 changed files with 103 additions and 12 deletions

View File

@ -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

View File

@ -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}"]

View File

@ -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