Allow to pass iso url from env for remotedirect-ephemeral phase
This commit introduces an ability to consume AIRSHIPCTL_EPHEMERAL_ISO_URL environment variable. Also it switches from phase patch to catalogue and implements corresponding replacement transformer for remotedirect variables. With this code isoURL catalogue value is only used in an absense of AIRSHIPCTL_EPHEMERAL_ISO_URL. Airshipctl does not control how an iso is served leaving it on discretion of deployment pipeline, also iso contents are fully determined by image-builder image and manifests, thus this change does not violate GitOps principles. Change-Id: Ie6eebe0f0502b2f8e41b081281336299c63f5e4d Signed-off-by: Andrii Ostapenko <andrii.ostapenko@att.com>
This commit is contained in:
parent
e685fb2f1c
commit
0c14bde17e
2
manifests/function/bootstrap/kustomization.yaml
Normal file
2
manifests/function/bootstrap/kustomization.yaml
Normal file
@ -0,0 +1,2 @@
|
||||
generators:
|
||||
- template.yaml
|
@ -0,0 +1,4 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- remotedirect-vars.yaml
|
@ -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%"]
|
28
manifests/function/bootstrap/template.yaml
Normal file
28
manifests/function/bootstrap/template.yaml
Normal 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 }}
|
@ -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
|
||||
|
@ -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
|
||||
|
10
manifests/site/test-site/phases/catalogue.yaml
Normal file
10
manifests/site/test-site/phases/catalogue.yaml
Normal 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
|
@ -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
|
||||
|
@ -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
|
Loading…
Reference in New Issue
Block a user