Integration w/ Drydock bootactions

- Add Values.conf.curtin.override switch for enabling/disable whether
  the default curtin_userdata is overwritten
- Update the customized template for curtin_userdata to be compatible
  with the Drydock boot action system

Change-Id: I90c317725dfdd34a756e90425c9c3fcfcc6911db
This commit is contained in:
Scott Hussey 2017-10-31 16:03:46 -05:00
parent a2e8188b81
commit 4b43a7dbd8
4 changed files with 33 additions and 24 deletions

View File

@ -33,17 +33,7 @@ metadata:
name: maas-etc
data:
curtin_userdata: |+
{{ if .Values.conf.curtin.override -}}
{{ .Values.conf.curtin.override | indent 4 }}
{{- else -}}
{{- if .Values.conf.curtin.prefix -}}
{{ .Values.conf.curtin.prefix | indent 4 }}
{{- end }}
{{ tuple "etc/_curtin_userdata.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
{{- end }}
{{- if .Values.conf.curtin.append -}}
{{ .Values.conf.curtin.append | indent 4 }}
{{- end }}
named.conf.options: |+
{{ if .Values.conf.bind.override -}}
{{ .Values.conf.bind.override | indent 4 }}

View File

@ -24,17 +24,31 @@ early_commands:
driver_00: ["sh", "-c", "echo third party drivers not installed or necessary."]
{{ "{{" }}endif{{ "}}" }}
late_commands:
{{ "{{" }}py: bootdata_url = ''.join([{{ .Values.bootdata_url | quote }},node.hostname,"/promconfig"]){{ "}}" }}
{{ "{{" }}py: promsvc_url = ''.join([{{ .Values.bootdata_url | quote }},node.hostname,"/promservice"]){{ "}}" }}
{{ "{{" }}py: vfsvc_url = ''.join([{{ .Values.bootdata_url | quote }},node.hostname,"/vfservice"]){{ "}}" }}
{{ "{{" }}py: prominit_url = ''.join([{{ .Values.bootdata_url | quote }},node.hostname,"/prominit"]){{ "}}" }}
drydock_01: ["curtin", "in-target","--", "wget", "--no-proxy", "{{ "{{" }}bootdata_url{{ "}}" }}", "-O", "/etc/prom_init.yaml"]
drydock_02: ["curtin", "in-target","--", "wget", "--no-proxy", "{{ "{{" }}prominit_url{{ "}}" }}", "-O", "/var/tmp/prom_init.sh"]
drydock_03: ["curtin", "in-target","--", "chmod", "555", "/var/tmp/prom_init.sh"]
drydock_04: ["curtin", "in-target","--", "wget", "--no-proxy", "{{ "{{" }}promsvc_url{{ "}}" }}", "-O", "/lib/systemd/system/prom_init.service"]
drydock_05: ["curtin", "in-target","--", "systemctl", "enable", "prom_init.service"]
drydock_06: ["curtin", "in-target","--", "wget", "--no-proxy", "{{ "{{" }}vfsvc_url{{ "}}" }}", "-O", "/lib/systemd/system/drydock_vf.service"]
drydock_07: ["curtin", "in-target","--", "systemctl", "enable", "drydock_vf.service"]
{{ "{{" }}py:
def find_ba_key(n):
tag_prefix = "%s_baid" % n.hostname
for t in n.tag_names():
if t.startswith(tag_prefix):
prefix, ba_key = t.split('-')
return ba_key
return False
{{ "}}" }}
{{ "{{" }}py: ba_key = find_ba_key(node){{ "}}" }}
{{ "{{" }}py: ba_units_url = ''.join([{{ .Values.conf.drydock.bootaction_url | quote }},node.hostname,'/units']){{ "}}" }}
{{ "{{" }}py: ba_files_url = ''.join([{{ .Values.conf.drydock.bootaction_url | quote }},node.hostname,'/files']){{ "}}" }}
{{ "{{" }}if ba_key{{ "}}" }}
drydock_00: ["sh", "-c", "echo Installing Drydock Boot Actions."]
drydock_01: ["curtin", "in-target", "--", "wget", "--no-proxy", "--header=X-Bootaction-Key: {{ "{{" }}ba_key{{ "}}" }}", "{{ "{{" }}ba_units_url{{ "}}" }}", "-O", "/tmp/bootaction-units.tar.gz"]
drydock_02: ["curtin", "in-target", "--", "wget", "--no-proxy", "--header=X-Bootaction-Key: {{ "{{" }}ba_key{{ "}}" }}", "{{ "{{" }}ba_files_url{{ "}}" }}", "-O", "/tmp/bootaction-files.tar.gz"]
drydock_03: ["curtin", "in-target", "--", "sh", "-c", "tar --owner=root -xPzvf /tmp/bootaction-units.tar.gz > /tmp/bootaction-unit-names.txt"]
drydock_04: ["curtin", "in-target", "--", "sh", "-c", "tar --owner=root -xPzvf /tmp/bootaction-files.tar.gz > /tmp/bootaction-file-names.txt"]
drydock_05: ["curtin", "in-target", "--", "sh", "-c", "xargs -a /tmp/bootaction-unit-names.txt -n 1 basename > /tmp/bootaction-unit-basenames.txt"]
drydock_06: ["curtin", "in-target", "--", "sh", "-c", "xargs -a /tmp/bootaction-unit-basenames.txt -n 1 systemctl enable"]
drydock_07: ["sh", "-c", "echo Following SystemD units installed and enabled:"]
drydock_08: ["curtin", "in-target", "--", "cat", "/tmp/bootaction-unit-basenames.txt"]
drydock_09: ["sh", "-c", "echo Following files installed on deployed node:"]
drydock_10: ["curtin", "in-target", "--", "cat", "/tmp/bootaction-file-names.txt"]
{{ "{{" }}}endif{{ "}}" }}
maas: [wget, '--no-proxy', {{ "{{" }}node_disable_pxe_url|escape.json{{ "}}" }}, '--post-data', {{ "{{" }}node_disable_pxe_data|escape.json{{ "}}" }}, '-O', '/dev/null']
{{ "{{" }}if third_party_drivers and driver{{ "}}" }}
{{ "{{" }}if driver['key_binary'] and driver['repository'] and driver['package']{{ "}}" }}
@ -50,4 +64,6 @@ late_commands:
{{ "{{" }}endif{{ "}}" }}
driver_06_depmod: ["curtin", "in-target", "--", "depmod"]
driver_07_update_initramfs: ["curtin", "in-target", "--", "update-initramfs", "-u"]
{{ "{{" }}endif{{ "}}" }}
{{ "{{" }}endif{{ "}}" }}
showtrace: true
verbosity: 2

View File

@ -66,10 +66,12 @@ spec:
mountPath: /etc/maas/regiond.conf
subPath: regiond.conf
readOnly: true
{{- if .Values.conf.curtin.override }}
- name: maas-etc
mountPath: /etc/maas/preseeds/curtin_userdata
subPath: curtin_userdata
readOnly: true
{{- end }}
- name: maas-bin
mountPath: /tmp/start.sh
subPath: start.sh

View File

@ -110,8 +110,9 @@ conf:
override:
append:
curtin:
override:
append:
override: true
drydock:
bootaction_url: null
maas:
override:
append: