Files
airshipctl/manifests/function/hostgenerator-m3/hosttemplate.yaml
Matt McEuen f9d2d4ef27 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
2020-08-06 09:14:12 -05:00

86 lines
2.3 KiB
YAML

apiVersion: airshipit.org/v1alpha1
kind: Templater
metadata:
name: m3-host-template
values:
# hosts:
# (filled in from the comprehensive site-wide host-catalogue)
# hostsToGenerate:
# (filled in with phase-specific host-generation-catalogue)
# 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
metadata:
annotations:
labels:
name: {{ $hostName }}
spec:
online: false
bootMACAddress: {{ $host.macAddress }}
bootMode: {{ $host.bootMode }}
networkData:
name: {{ $hostName }}-network-data
namespace: default
bmc:
address: {{ $host.bmcAddress }}
credentialsName: {{ $hostName }}-bmc-secret
firmware:
{{ toYaml $hardwareProfile.firmware | indent 4 }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ $hostName }}-bmc-secret
data:
username: {{ $host.bmcUsername | b64enc }}
password: {{ $host.bmcPassword | b64enc }}
type: Opaque
---
apiVersion: v1
kind: Secret
metadata:
name: {{ $hostName }}-network-data
stringData:
networkData: |
links:
{{- range $envAll.commonNetworking.links }}
-
{{ toYaml . | indent 6 }}
{{- if $host.macAddresses }}
ethernet_mac_address: {{ index $host.macAddresses .id }}
{{- end }}
{{- end }}
networks:
{{- range $envAll.commonNetworking.networks }}
-
{{ toYaml . | indent 6 }}
ip_address: {{ index $host.ipAddresses .id }}
{{- end }}
services:
{{ toYaml $envAll.commonNetworking.services | indent 6 }}
type: Opaque
{{ end -}}