Merge "Allow to pass iso url from env for remotedirect-ephemeral phase"

This commit is contained in:
Zuul 2021-03-27 08:53:01 +00:00 committed by Gerrit Code Review
commit 3749a8fe50
9 changed files with 79 additions and 15 deletions

View File

@ -0,0 +1,2 @@
generators:
- template.yaml

View File

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

View File

@ -0,0 +1,27 @@
apiVersion: airshipit.org/v1alpha1
kind: ReplacementTransformer
metadata:
name: versions-remotedirect-replacement
annotations:
config.kubernetes.io/function: |-
container:
image: quay.io/airshipit/replacement-transformer:v2
replacements:
- source:
objref:
name: versions-remotedirect
fieldref: spec.remotedirect.isoURL
target:
objref:
kind: BaremetalManager
name: RemoteDirectEphemeral
fieldrefs: ["spec.operationOptions.remoteDirect.isoURL%ISO_URL%"]
- source:
objref:
name: versions-remotedirect
fieldref: spec.remotedirect.node
target:
objref:
kind: BaremetalManager
name: RemoteDirectEphemeral
fieldrefs: ["spec.hostSelector.name%EPHEMERAL_NODE%"]

View File

@ -0,0 +1,28 @@
apiVersion: airshipit.org/v1alpha1
kind: Templater
metadata:
name: iso-patch-template
annotations:
config.kubernetes.io/function: |
container:
image: quay.io/airshipit/templater:latest
envs:
- AIRSHIPCTL_EPHEMERAL_ISO_URL
template: |
{{- $isoURL := env "AIRSHIPCTL_EPHEMERAL_ISO_URL" }}
{{- if not (empty $isoURL) }}
apiVersion: builtin
kind: PatchStrategicMergeTransformer
metadata:
name: smp
patches: |-
---
apiVersion: airshipit.org/v1alpha1
kind: BaremetalManager
metadata:
name: RemoteDirectEphemeral
spec:
operationOptions:
remoteDirect:
isoURL: {{ $isoURL }}
{{- end }}

View File

@ -196,10 +196,10 @@ metadata:
spec:
operation: remote-direct
hostSelector:
name: REPLACE_ME
name: EPHEMERAL_NODE
operationOptions:
remoteDirect:
isoURL: REPLACE_ME
isoURL: ISO_URL
---
apiVersion: airshipit.org/v1alpha1
kind: GenericContainer

View File

@ -9,3 +9,6 @@ patchesStrategicMerge:
- clusterctl_init_options.yaml
transformers:
- ../function/clusterctl/replacements
# NOTE(aostapenko) Consume AIRSHIPCTL_EPHEMERAL_ISO_URL here that will
# have precedence over phase catalogue isoURL value
- ../function/bootstrap

View File

@ -0,0 +1,10 @@
apiVersion: airshipit.org/v1alpha1
kind: VersionsCatalogue
metadata:
name: versions-remotedirect
spec:
remotedirect:
# NOTE(aostapenko) This value will only be used in absense of
# AIRSHIPCTL_EPHEMERAL_ISO_URL environment variable
isoURL: http://localhost:8099/ephemeral.iso
node: node02

View File

@ -1,6 +1,6 @@
resources:
- ../kubeconfig
- ../../../phases
## TODO Consider making a catalogue combined with variable substitution instead
patchesStrategicMerge:
- phase-patch.yaml
- catalogue.yaml
transformers:
- ../../../function/bootstrap/replacements

View File

@ -1,10 +0,0 @@
apiVersion: airshipit.org/v1alpha1
kind: BaremetalManager
metadata:
name: RemoteDirectEphemeral
spec:
hostSelector:
name: node02
operationOptions:
remoteDirect:
isoURL: http://localhost:8099/ephemeral.iso