diff --git a/maas/templates/_helpers.tpl b/maas/templates/_helpers.tpl deleted file mode 100644 index d2f33bc897..0000000000 --- a/maas/templates/_helpers.tpl +++ /dev/null @@ -1,3 +0,0 @@ -{{- define "joinListWithColon" -}} -{{ range $k, $v := . }}{{ if $k }},{{ end }}{{ $v }}{{ end }} -{{- end -}} diff --git a/maas/templates/var/_maas-region-controller.postinst.tpl b/maas/templates/bin/_maas-region-controller.postinst.tpl similarity index 77% rename from maas/templates/var/_maas-region-controller.postinst.tpl rename to maas/templates/bin/_maas-region-controller.postinst.tpl index 6c6ac31f12..ae7e846397 100644 --- a/maas/templates/var/_maas-region-controller.postinst.tpl +++ b/maas/templates/bin/_maas-region-controller.postinst.tpl @@ -35,30 +35,6 @@ configure_maas_default_url() { maas-region local_config_set --maas-url "http://${ipaddr}/MAAS" } -get_default_route_ip6() { - while read Src SrcPref Dest DestPref Gateway Metric RefCnt Use Flags Iface - do - [ "$SrcPref" = 00 ] && [ "$Iface" != lo ] && break - done < /proc/net/ipv6_route - if [ -n "$Iface" ]; then - LC_ALL=C /sbin/ip -6 addr list dev "$Iface" scope global permanent | - sed -n '/ inet6 /s/.*inet6 \([0-9a-fA-F:]*\).*/[\1]/p' | head -1 - fi -} - -get_default_route_ip4() { - while read Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT - do - [ "$Mask" = "00000000" ] && break - done < /proc/net/route - if [ -n "$Iface" ]; then - ipaddr=$(LC_ALL=C /sbin/ip -4 addr list dev "$Iface" scope global) - ipaddr=${ipaddr#* inet } - ipaddr=${ipaddr%%/*} - echo $ipaddr - fi -} - extract_default_maas_url() { # Extract DEFAULT_MAAS_URL IP/host setting from config file $1. grep "^DEFAULT_MAAS_URL" "$1" | cut -d"/" -f3 @@ -86,17 +62,8 @@ if [ "$1" = "configure" ] && [ -z "$2" ]; then db_get maas/default-maas-url ipaddr="$RET" if [ -z "$ipaddr" ]; then - #ipaddr=$(get_default_route_ip4) ipaddr="maas-region-ui.{{ .Release.Namespace }}" fi - if [ -z "$ipaddr" ]; then - #ipaddr=$(get_default_route_ip6) - ipaddr="maas-region-ui.{{ .Release.Namespace }}" - fi - # Fallback default is "localhost" - if [ -z "$ipaddr" ]; then - ipaddr=localhost - fi # Set the IP address of the interface with default route configure_maas_default_url "$ipaddr" db_subst maas/installation-note MAAS_URL "$ipaddr" diff --git a/maas/templates/configmap-bin.yaml b/maas/templates/configmap-bin.yaml index 53b2d94dbc..c7c2108d76 100644 --- a/maas/templates/configmap-bin.yaml +++ b/maas/templates/configmap-bin.yaml @@ -5,3 +5,5 @@ metadata: data: start.sh: | {{ tuple "bin/_start.sh.tpl" . | include "template" | indent 4 }} + maas-region-controller.postinst: | +{{ tuple "bin/_maas-region-controller.postinst.tpl" . | include "template" | indent 4 }} diff --git a/maas/templates/configmap-etc.yaml b/maas/templates/configmap-etc.yaml index 2597a28cac..ececffc02c 100644 --- a/maas/templates/configmap-etc.yaml +++ b/maas/templates/configmap-etc.yaml @@ -5,3 +5,5 @@ metadata: data: named.conf.options: |+ {{ tuple "etc/_region-dns-config.tpl" . | include "template" | indent 4 }} + secret: | +{{ tuple "etc/_secret.tpl" . | include "template" | indent 4 }} diff --git a/maas/templates/configmap-var.yaml b/maas/templates/configmap-var.yaml deleted file mode 100644 index 422c0ed503..0000000000 --- a/maas/templates/configmap-var.yaml +++ /dev/null @@ -1,10 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: maas-region-var -data: - maas-region-controller.postinst: | -{{ tuple "var/_maas-region-controller.postinst.tpl" . | include "template" | indent 4 }} - secret: | -{{ tuple "var/_secret.tpl" . | include "template" | indent 4 }} - diff --git a/maas/templates/deploy-region.yaml b/maas/templates/deploy-region.yaml index f044a09c5d..31567170f2 100644 --- a/maas/templates/deploy-region.yaml +++ b/maas/templates/deploy-region.yaml @@ -14,12 +14,7 @@ spec: "name": "init", "image": "{{ .Values.images.maas_region }}", "imagePullPolicy": "Always", - "command": [ - "/bin/bash", "-c" - ], - "args": [ - "chmod +x /tmp/start.sh; /tmp/start.sh" - ], + "command": ["bash", "/tmp/start.sh"], "volumeMounts": [ { "name": "maas-config", @@ -59,6 +54,9 @@ spec: imagePullPolicy: Always ports: - containerPort: {{ .Values.network.port.region_container }} + readinessProbe: + tcpSocket: + port: {{ .Values.network.port.region_container }} securityContext: privileged: true volumeMounts: @@ -91,7 +89,7 @@ spec: emptyDir: {} - name: maas-region-secret configMap: - name: maas-region-var + name: maas-region-etc - name: maas-config emptyDir: {} - name: maas-dns-config @@ -102,4 +100,4 @@ spec: name: maas-region-bin - name: maasregionpostinst configMap: - name: maas-region-var + name: maas-region-bin diff --git a/maas/templates/var/_secret.tpl b/maas/templates/etc/_secret.tpl similarity index 100% rename from maas/templates/var/_secret.tpl rename to maas/templates/etc/_secret.tpl diff --git a/maas/templates/service.yaml b/maas/templates/service.yaml index fce28c7ac8..0a78d6c56d 100644 --- a/maas/templates/service.yaml +++ b/maas/templates/service.yaml @@ -5,7 +5,6 @@ metadata: labels: app: maas-region-ui spec: - type: NodePort ports: - port: {{ .Values.network.port.service_gui }} targetPort: {{ .Values.network.port.service_gui_target }} diff --git a/maas/values.yaml b/maas/values.yaml index 0f46f04f67..8a7862ec89 100644 --- a/maas/values.yaml +++ b/maas/values.yaml @@ -4,7 +4,7 @@ images: maas_region: quay.io/attcomdev/maas-region:2.1.2-1 - maas_rack: quay.io/attcomdev/maas-rack:2.1.2 + maas_rack: quay.io/attcomdev/maas-rack:2.1.2-1 labels: node_selector_key: openstack-control-plane