Add hardware profile / firmware plumbing
This adds firmware definition into the hostgenerator-m3 function, along with a default hardwareProfile/firmware definition; it also adds a hardwareprofile-example function that can be used as an example for creating and consuming hardwareProfiles. In the future, other things will be added to hardwareProfiles in addition to firmware, for consumption by hostgenerator-m3 and/or by other functions. Closes: #291 Change-Id: I586284f07e5b98353af06ecb7559a64771297e44
This commit is contained in:
parent
7964f0cd77
commit
f9d2d4ef27
13
manifests/function/hardwareprofile-example/README.md
Normal file
13
manifests/function/hardwareprofile-example/README.md
Normal file
@ -0,0 +1,13 @@
|
||||
Function: hardwareprofile-example
|
||||
=================================
|
||||
|
||||
This function defines a hardware profile that can be consumed by the
|
||||
hostgenerator-m3 function, and which has the same values as the default
|
||||
profile defined in that function. It serves as an example for how other
|
||||
hardware profile functions can be created and consumed.
|
||||
|
||||
The `/replacements` kustomization contains a substution rule that injects
|
||||
the profile into the hostgenerator BMH template. Please see the
|
||||
`manifests/type/gating` type and `manifests/type/test-site`
|
||||
kustomization.yamls to see how a hardwareprofile function can be wired in.
|
||||
|
@ -0,0 +1,10 @@
|
||||
apiVersion: airshipit.org/v1alpha1
|
||||
kind: VariableCatalogue
|
||||
metadata:
|
||||
# NOTE: change this when copying this example
|
||||
name: hardwareprofile-example
|
||||
hardwareProfile:
|
||||
firmware:
|
||||
sriovEnabled: false
|
||||
virtualizationDisabled: false
|
||||
simultaneousMultithreadingDisabled: false
|
@ -0,0 +1,4 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- hardwareprofile.yaml
|
@ -0,0 +1,19 @@
|
||||
# These rules inject host-specific information from the `host-catalogue`
|
||||
# into the hostgenerator-m3 function's Template plugin config.
|
||||
apiVersion: airshipit.org/v1alpha1
|
||||
kind: ReplacementTransformer
|
||||
metadata:
|
||||
# NOTE: change this when copying this example
|
||||
name: hardwareprofile-example-replacements
|
||||
replacements:
|
||||
- source:
|
||||
objref:
|
||||
# NOTE: change this to match your hardwareProfile's metadata.name
|
||||
name: hardwareprofile-example
|
||||
fieldref: hardwareProfile
|
||||
target:
|
||||
objref:
|
||||
kind: Templater
|
||||
name: m3-host-template
|
||||
# NOTE: change "example" below when copying this example
|
||||
fieldrefs: [values.hardwareProfiles.example]
|
@ -0,0 +1,4 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- hosts.yaml
|
@ -3,7 +3,7 @@ kind: Templater
|
||||
metadata:
|
||||
name: m3-host-template
|
||||
|
||||
# values:
|
||||
values:
|
||||
# hosts:
|
||||
# (filled in from the comprehensive site-wide host-catalogue)
|
||||
# hostsToGenerate:
|
||||
@ -11,11 +11,23 @@ metadata:
|
||||
# commonNetworking:
|
||||
# (filled in with the type-specific common-networking-catalogue)
|
||||
|
||||
# Additional hardwareProfiles can be defined within their own functions,
|
||||
# and then substituted into the stanza below.
|
||||
# See function/hardwareprofile-example for an example of how to do this.
|
||||
hardwareProfiles:
|
||||
default:
|
||||
# Reference: https://github.com/metal3-io/metal3-docs/blob/master/design/baremetal-operator/bios-config.md
|
||||
firmware:
|
||||
sriovEnabled: false
|
||||
virtualizationDisabled: false
|
||||
simultaneousMultithreadingDisabled: false
|
||||
|
||||
template: |
|
||||
{{- $envAll := . }}
|
||||
{{- range .hostsToGenerate }}
|
||||
{{- $hostName := . }}
|
||||
{{- $host := index $envAll.hosts $hostName }}
|
||||
{{- $hardwareProfile := index $envAll.hardwareProfiles $host.hardwareProfile }}
|
||||
---
|
||||
apiVersion: metal3.io/v1alpha1
|
||||
kind: BareMetalHost
|
||||
@ -33,6 +45,9 @@ template: |
|
||||
bmc:
|
||||
address: {{ $host.bmcAddress }}
|
||||
credentialsName: {{ $hostName }}-bmc-secret
|
||||
firmware:
|
||||
{{ toYaml $hardwareProfile.firmware | indent 4 }}
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
|
@ -1,9 +1,13 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
# TODO: these two should move up to type level in the future
|
||||
- ../../../../../function/hostgenerator-m3
|
||||
- ../../../../../function/hardwareprofile-example
|
||||
- ../../../shared/catalogues/
|
||||
- host-generation.yaml
|
||||
|
||||
transformers:
|
||||
# TODO: these two should move up to type level in the future
|
||||
- ../../../../../function/hostgenerator-m3/replacements
|
||||
- ../../../../../function/hardwareprofile-example/replacements
|
||||
|
@ -1,9 +1,13 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
# TODO: these two should move up to type level in the future
|
||||
- ../../../../../function/hostgenerator-m3
|
||||
- ../../../../../function/hardwareprofile-example
|
||||
- ../../../shared/catalogues/
|
||||
- host-generation.yaml
|
||||
|
||||
transformers:
|
||||
# TODO: these two should move up to type level in the future
|
||||
- ../../../../../function/hostgenerator-m3/replacements
|
||||
- ../../../../../function/hardwareprofile-example/replacements
|
||||
|
@ -18,6 +18,7 @@ hosts:
|
||||
oam: 52:54:00:9b:27:4c
|
||||
pxe: 52:54:00:b6:ed:31
|
||||
bootMode: legacy
|
||||
hardwareProfile: default # defined in the hostgenerator-m3 function
|
||||
node02:
|
||||
macAddress: 52:54:00:b6:ed:02
|
||||
bmcAddress: redfish+http://10.23.25.2:8000/redfish/v1/Systems/air-target-2
|
||||
@ -29,3 +30,4 @@ hosts:
|
||||
macAddresses:
|
||||
oam: 52:54:00:9b:27:02
|
||||
pxe: 52:54:00:b6:ed:02
|
||||
hardwareProfile: example # defined in the hardwareprofile-example function
|
||||
|
Loading…
Reference in New Issue
Block a user