Skip to content

Commit

Permalink
baremetal: Pass through of config variables to ironic
Browse files Browse the repository at this point in the history
  • Loading branch information
derekhiggins committed Jul 16, 2020
1 parent dd63277 commit db3a3c7
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ for name in ironic-api ironic-conductor ironic-inspector dnsmasq httpd mariadb i
podman ps --all | grep -w "$name$" && podman rm $name -f
done

{{- range $n, $v := .PlatformData.BareMetal.IronicExtraConf }}
export {{ $n }}='{{ $v }}'
{{- end }}

# Start the provisioning nic if not already started
PROVISIONING_NIC=ens4
if ! nmcli -t device | grep "$PROVISIONING_NIC:ethernet:connected:provisioning"; then
Expand Down Expand Up @@ -123,6 +127,7 @@ podman run -d --net host --privileged --name ironic-conductor \
--env MARIADB_PASSWORD=$mariadb_password \
--env PROVISIONING_INTERFACE=$PROVISIONING_NIC \
--env OS_CONDUCTOR__HEARTBEAT_TIMEOUT=120 \
--env "OS_*" \
--entrypoint /bin/runironic-conductor \
-v $IRONIC_SHARED_VOLUME:/shared:z ${IRONIC_IMAGE}

Expand All @@ -131,11 +136,13 @@ sleep 10

podman run -d --net host --privileged --name ironic-inspector \
--env PROVISIONING_INTERFACE=$PROVISIONING_NIC \
--env "OS_*" \
-v $IRONIC_SHARED_VOLUME:/shared:z "${IRONIC_INSPECTOR_IMAGE}"

podman run -d --net host --privileged --name ironic-api \
--env MARIADB_PASSWORD=$mariadb_password \
--env PROVISIONING_INTERFACE=$PROVISIONING_NIC \
--env "OS_*" \
--entrypoint /bin/runironic-api \
-v $IRONIC_SHARED_VOLUME:/shared:z ${IRONIC_IMAGE}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ spec:
provisioningDHCPExternal: {{.Baremetal.ProvisioningDHCPExternal}}
provisioningDHCPRange: "{{.Baremetal.ProvisioningDHCPRange}}"
provisioningOSDownloadURL: "{{.ProvisioningOSDownloadURL}}"
ironicExtraConf:
{{- range $n, $v := .Baremetal.IronicExtraConf }}
{{ $n }}: '{{ $v }}'
{{- end }}
16 changes: 16 additions & 0 deletions docs/user/metal/customization_ipi.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,19 @@ certificates signed by a known certificate authority. In environments
where certificates are signed by unknown authorities, this behavior
can be disabled by setting `disableCertificateVerification` to `true`
for each `bmc` entry.

## Customizing ironic for provisioning

Should you need to adjust any of the config options in ironic you can
set ironicExtraConf in the platform section of install-config.yaml. Each
config option should be expressed as a key/value pair with the format

OS_<section>_\_<name>=<value> - where `section` and `name` are the
reprepresent the config option in ironic.conf e.g. to set a IPA ssh key and
set the number of ironic API workers

```yaml
platform:
baremetal:
ironicExtraConf: {"OS_PXE__PXE_APPEND_PARAMS":'nofb nomodeset vga=normal sshkey="ssh-rsa AAAA..."', "OS_API__API_WORKERS":"8"}
```
4 changes: 4 additions & 0 deletions pkg/asset/ignition/bootstrap/baremetal/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ type TemplateData struct {
// ProvisioningDHCPAllowList contains a space-separated list of all of the control plane's boot
// MAC addresses. Requests to bootstrap DHCP from other hosts will be ignored.
ProvisioningDHCPAllowList string

IronicExtraConf map[string]interface{}
}

// GetTemplateData returns platform-specific data for bootstrap templates.
Expand All @@ -48,5 +50,7 @@ func GetTemplateData(config *baremetal.Platform) *TemplateData {
templateData.ProvisioningDHCPAllowList = strings.Join(dhcpAllowList, " ")
}

templateData.IronicExtraConf = config.IronicExtraConf

return &templateData
}
5 changes: 5 additions & 0 deletions pkg/types/baremetal/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,9 @@ type Platform struct {
//
// +optional
ClusterOSImage string `json:"clusterOSImage,omitempty" validate:"omitempty,osimageuri,urlexist"`

// IronicExtraConf is a map of config options to be passed to ironic, each entry should take the
// format OS_<section>_\_<name>=<value> - where `section` and `name` reprepresent the
// config option in ironic.conf
IronicExtraConf map[string]interface{} `json:"ironicExtraConf,omitempty"`
}

0 comments on commit db3a3c7

Please sign in to comment.