Add catalogue-driven CAPI container versions

This allows for container locations and versions for the CAPI functions
to be (optionally) driven by the `versions-airshipctl` versions
catalogue.  In addition, this moves the clusterctl config from the site
level to become its own function, which can be further refined
(e.g. for public cloud providers) via inheriting functions, composites,
types, etc.

Change-Id: Ic2b02e256419ee8536f5237327cce2754fd0abff
Closes: https://github.com/airshipit/airshipctl/issues/316
This commit is contained in:
Matt McEuen 2020-08-18 11:38:32 -05:00 committed by Kostyantyn Kalynovskyi
parent 4f6b5252c2
commit 70ec47096c
16 changed files with 102 additions and 41 deletions

View File

@ -10,7 +10,7 @@ spec:
spec:
containers:
- name: kube-rbac-proxy
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.4.1
image: ${CONTAINER_CABPK_AUTH_PROXY}
args:
- "--secure-listen-address=0.0.0.0:8443"
- "--upstream=http://127.0.0.1:8080/"

View File

@ -7,5 +7,5 @@ spec:
template:
spec:
containers:
- image: us.gcr.io/k8s-artifacts-prod/cluster-api/kubeadm-bootstrap-controller:v0.3.3
- image: ${CONTAINER_CABPK_MANAGER}
name: manager

View File

@ -10,7 +10,7 @@ spec:
spec:
containers:
- name: kube-rbac-proxy
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.4.1
image: ${CONTAINER_CACPK_AUTH_PROXY}
args:
- "--secure-listen-address=0.0.0.0:8443"
- "--upstream=http://127.0.0.1:8080/"

View File

@ -7,5 +7,5 @@ spec:
template:
spec:
containers:
- image: us.gcr.io/k8s-artifacts-prod/cluster-api/kubeadm-control-plane-controller:v0.3.3
- image: ${CONTAINER_CACPK_MANAGER}
name: manager

View File

@ -10,7 +10,7 @@ spec:
spec:
containers:
- name: kube-rbac-proxy
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.4.1
image: ${CONTAINER_CAPI_AUTH_PROXY}
args:
- "--secure-listen-address=0.0.0.0:8443"
- "--upstream=http://127.0.0.1:8080/"

View File

@ -7,5 +7,5 @@ spec:
template:
spec:
containers:
- image: us.gcr.io/k8s-artifacts-prod/cluster-api/cluster-api-controller:v0.3.3
- image: ${CONTAINER_CAPI_MANAGER}
name: manager

View File

@ -10,7 +10,7 @@ spec:
spec:
containers:
- name: kube-rbac-proxy
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.4.0
image: ${CONTAINER_CAPM3_AUTH_PROXY}
args:
- "--secure-listen-address=0.0.0.0:8443"
- "--upstream=http://127.0.0.1:8080/"

View File

@ -8,5 +8,5 @@ spec:
spec:
containers:
# Change the value of image field below to your controller image URL
- image: quay.io/metal3-io/cluster-api-provider-metal3:v0.3.1
- image: ${CONTAINER_CAPM3_MANAGER}
name: manager

View File

@ -0,0 +1,16 @@
Function: k8scontrol
====================
This function defines a base Clusterctl config that includes a collection
of available CAPI providers (under ``providers``) which are supported by
``airshipctl``. It also provides a selection of those for a default Metal3
deployment (under ``init-options``). The selected init-options may be
patched/overridden at the Type level, etc.
This function relies on CAPI variable substitution to supply versioned
container images to the CAPI components. The Clusterctl objects
supplies defaults, and these can (optionally) be overridden either by
simple Kustomize patching, or by applying the ``replacements``
kustomization as a Kustomize transformer. In the latter case,
an airshipctl versions catalogue must be supplied; please see the
``airshipctl-catalogues`` function for a base/example.

View File

@ -0,0 +1,45 @@
apiVersion: airshipit.org/v1alpha1
kind: Clusterctl
metadata:
labels:
airshipit.org/deploy-k8s: "false"
name: clusterctl-v1
init-options:
core-provider: "cluster-api:v0.3.3"
bootstrap-providers:
- "kubeadm:v0.3.3"
infrastructure-providers:
- "metal3:v0.3.1"
control-plane-providers:
- "kubeadm:v0.3.3"
providers:
- name: "metal3"
type: "InfrastructureProvider"
variable-substitution: true
versions:
v0.3.1: manifests/function/capm3/v0.3.1
- name: "kubeadm"
type: "BootstrapProvider"
variable-substitution: true
versions:
v0.3.3: manifests/function/cabpk/v0.3.3
- name: "cluster-api"
type: "CoreProvider"
variable-substitution: true
versions:
v0.3.3: manifests/function/capi/v0.3.3
- name: "kubeadm"
type: "ControlPlaneProvider"
variable-substitution: true
versions:
v0.3.3: manifests/function/cacpk/v0.3.3
# These default images can be overridden via the `replacements/` entrypoint
additional-vars:
CONTAINER_CAPM3_MANAGER: quay.io/metal3-io/cluster-api-provider-metal3:v0.3.1
CONTAINER_CACPK_MANAGER: us.gcr.io/k8s-artifacts-prod/cluster-api/kubeadm-control-plane-controller:v0.3.3
CONTAINER_CABPK_MANAGER: us.gcr.io/k8s-artifacts-prod/cluster-api/kubeadm-bootstrap-controller:v0.3.3
CONTAINER_CAPI_MANAGER: us.gcr.io/k8s-artifacts-prod/cluster-api/cluster-api-controller:v0.3.3
CONTAINER_CAPM3_AUTH_PROXY: gcr.io/kubebuilder/kube-rbac-proxy:v0.4.0
CONTAINER_CACPK_AUTH_PROXY: gcr.io/kubebuilder/kube-rbac-proxy:v0.4.1
CONTAINER_CABPK_AUTH_PROXY: gcr.io/kubebuilder/kube-rbac-proxy:v0.4.1
CONTAINER_CAPI_AUTH_PROXY: gcr.io/kubebuilder/kube-rbac-proxy:v0.4.1

View File

@ -0,0 +1,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- versions.yaml

View File

@ -0,0 +1,27 @@
# These rules inject versioned artifacts into the k8scontrol function.
apiVersion: airshipit.org/v1alpha1
kind: ReplacementTransformer
metadata:
name: k8scontrol-versions-replacements
replacements:
# Replace the Kubernetes version in the KubeadmControlPlane
- source:
objref:
name: versions-airshipctl
fieldref: kubernetes
target:
objref:
kind: KubeadmControlPlane
name: cluster-controlplane
fieldrefs: ["spec.version"]
# Replace the controlplane disk image in the Metal3MachineTemplate
- source:
objref:
name: versions-airshipctl
fieldref: files.k8scontrol.cluster_controlplane_image
target:
objref:
kind: Metal3MachineTemplate
name: cluster-controlplane
fieldrefs: ["spec.template.spec.image"]

View File

@ -1,6 +1,6 @@
resources:
- ../../../../composite/infra
- ../../shared/clusterctl
- ../../../../function/clusterctl
- ../../../../function/airshipctl-catalogues
- ../../../../function/baremetal-operator
patchesStrategicMerge:

View File

@ -1,31 +0,0 @@
apiVersion: airshipit.org/v1alpha1
kind: Clusterctl
metadata:
labels:
airshipit.org/deploy-k8s: "false"
name: clusterctl-v1
init-options:
core-provider: "cluster-api:v0.3.3"
bootstrap-providers:
- "kubeadm:v0.3.3"
infrastructure-providers:
- "metal3:v0.3.1"
control-plane-providers:
- "kubeadm:v0.3.3"
providers:
- name: "metal3"
type: "InfrastructureProvider"
versions:
v0.3.1: manifests/function/capm3/v0.3.1
- name: "kubeadm"
type: "BootstrapProvider"
versions:
v0.3.3: manifests/function/cabpk/v0.3.3
- name: "cluster-api"
type: "CoreProvider"
versions:
v0.3.3: manifests/function/capi/v0.3.3
- name: "kubeadm"
type: "ControlPlaneProvider"
versions:
v0.3.3: manifests/function/cacpk/v0.3.3

View File

@ -1,6 +1,6 @@
resources:
- ../../../../composite/infra
- ../../shared/clusterctl
- ../../../../function/clusterctl
- ../../../../function/airshipctl-catalogues
- ../../../../function/baremetal-operator
- ../../../../function/helm-operator