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
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
being used.
type: string
image_repositories:
description: Allows for the specification of the image repositories
being used.
type: string
type: object
type: object
served: true

View File

@ -3,6 +3,7 @@ kind: Kustomization
resources:
- ephemeral-env-vars.yaml
- networking.yaml
- versions.yaml
- generated-secrets.yaml
- stringData-encode.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:
certSANs: REPLACEMENT_CERT_SANS
imageRepository: REPLACEMENT_IMAGE_REPOSITORY
apiVersion: kubeadm.k8s.io/v1beta2
controllerManager: {}
dns:
@ -132,4 +133,4 @@ stringData:
- mkdir -p /var/lib/docker-engine /mnt/ephemeral/var/lib/docker-engine
- mount --bind /mnt/ephemeral/var/lib/docker-engine /var/lib/docker-engine
- mkdir -p /mnt/ephemeral/var/lib/kubelet/ /var/lib/kubelet/
- mount --bind /mnt/ephemeral/var/lib/kubelet/ /var/lib/kubelet/
- mount --bind /mnt/ephemeral/var/lib/kubelet/ /var/lib/kubelet/

View File

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

View File

@ -30,4 +30,14 @@ replacements:
kind: Metal3MachineTemplate
name: cluster-controlplane
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}"]