Added Image Repositories replacement for KCP

Change-Id: I454f5e9b92290d0c5b24830621a396f07354f90b
This commit is contained in:
Pallav Gupta 2021-06-21 18:00:01 -07:00
parent f74f4af7a9
commit 30691affe8
7 changed files with 42 additions and 2 deletions

View File

@ -161,3 +161,5 @@ spec:
image: quay.io/airshipit/image-builder:latest-ubuntu_focal image: quay.io/airshipit/image-builder:latest-ubuntu_focal
kubernetes: v1.18.6 kubernetes: v1.18.6
image_repositories: k8s.gcr.io

View File

@ -227,6 +227,10 @@ spec:
description: Allows for the specification of the kubernetes version description: Allows for the specification of the kubernetes version
being used. being used.
type: string type: string
image_repositories:
description: Allows for the specification of the image repositories
being used.
type: string
type: object type: object
type: object type: object
served: true served: true

View File

@ -3,6 +3,7 @@ kind: Kustomization
resources: resources:
- ephemeral-env-vars.yaml - ephemeral-env-vars.yaml
- networking.yaml - networking.yaml
- versions.yaml
- generated-secrets.yaml - generated-secrets.yaml
- stringData-encode.yaml - stringData-encode.yaml
- cleanup.yaml - cleanup.yaml

View File

@ -0,0 +1,21 @@
# These rules inject versioned artifacts into the ephemeral function.
apiVersion: airshipit.org/v1alpha1
kind: ReplacementTransformer
metadata:
name: ephemeral-versions-replacements
annotations:
config.kubernetes.io/function: |-
container:
image: localhost/replacement-transformer
replacements:
# Replace the imageRepository in the KubeadmEphemeral
- source:
objref:
kind: VersionsCatalogue
name: versions-airshipctl
fieldref: "{.spec.image_repositories}"
target:
objref:
name: ephemeral-bmc-secret
kind: Secret
fieldrefs: ["stringData.userData%REPLACEMENT_IMAGE_REPOSITORY%"]

View File

@ -81,6 +81,7 @@ stringData:
--- ---
apiServer: apiServer:
certSANs: REPLACEMENT_CERT_SANS certSANs: REPLACEMENT_CERT_SANS
imageRepository: REPLACEMENT_IMAGE_REPOSITORY
apiVersion: kubeadm.k8s.io/v1beta2 apiVersion: kubeadm.k8s.io/v1beta2
controllerManager: {} controllerManager: {}
dns: dns:

View File

@ -13,6 +13,7 @@ spec:
clusterConfiguration: clusterConfiguration:
apiServer: apiServer:
timeoutForControlPlane: 1000s timeoutForControlPlane: 1000s
imageRepository: k8s.gcr.io
files: files:
- path: "/etc/systemd/system/containerd.service.d/http-proxy.conf" - path: "/etc/systemd/system/containerd.service.d/http-proxy.conf"
content: | content: |

View File

@ -30,4 +30,14 @@ replacements:
kind: Metal3MachineTemplate kind: Metal3MachineTemplate
name: cluster-controlplane name: cluster-controlplane
fieldrefs: ["{.spec.template.spec.image}"] fieldrefs: ["{.spec.template.spec.image}"]
# Replace the imageRepository in the KubeadmControlPlane
- source:
objref:
kind: VersionsCatalogue
name: versions-airshipctl
fieldref: "{.spec.image_repositories}"
target:
objref:
kind: KubeadmControlPlane
name: cluster-controlplane
fieldrefs: ["{.spec.kubeadmConfigSpec.clusterConfiguration.imageRepository}"]