{{/* Copyright 2017 The Openstack-Helm Authors. Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */}} {{- $envAll := . }} {{- $serviceAccountName := "maas-import-resources" }} {{ tuple $envAll "import_resources" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} --- apiVersion: batch/v1 kind: Job metadata: name: maas-import-resources annotations: {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} spec: template: metadata: labels: {{ tuple $envAll "maas" "import-resources" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} spec: serviceAccountName: {{ $serviceAccountName }} restartPolicy: OnFailure nodeSelector: {{ .Values.labels.region.node_selector_key }}: {{ .Values.labels.region.node_selector_value }} initContainers: {{ tuple $envAll "import_resources" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} containers: - name: region-import-resources image: {{ .Values.images.tags.maas_region }} imagePullPolicy: {{ .Values.images.pull_policy }} env: - name: USE_IMAGE_CACHE value: {{ .Values.conf.cache.enabled | quote }} - name: JOB_TIMEOUT value: {{ .Values.jobs.import_boot_resources.timeout | quote }} - name: ADMIN_USERNAME valueFrom: secretKeyRef: name: {{ .Values.secrets.maas_users.admin }} key: USERNAME - name: RETRY_TIMER value: {{ .Values.jobs.import_boot_resources.retry_timer | quote }} - name: TRY_LIMIT value: {{ .Values.jobs.import_boot_resources.try_limit | quote }} - name: MAAS_ENDPOINT value: {{ tuple "maas_region_ui" "default" "region_ui" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup" }} - name: MAAS_PROXY_ENABLED value: {{ .Values.conf.maas.proxy.proxy_enabled | quote }} - name: MAAS_PEER_PROXY_ENABLED value: {{ .Values.conf.maas.proxy.peer_proxy_enabled | quote }} - name: MAAS_PROXY_SERVER value: {{ .Values.conf.maas.proxy.proxy_server }} - name: MAAS_INTERNAL_PROXY_PORT value: {{ .Values.network.port.service_proxy | quote }} - name: MAAS_HTTP_BOOT value: {{ .Values.conf.maas.http_boot | quote }} - name: MAAS_NTP_SERVERS value: {{ .Values.conf.maas.ntp.ntp_servers | join "," | quote }} - name: MAAS_NTP_EXTERNAL_ONLY value: {{ .Values.conf.maas.ntp.use_external_only | quote }} - name: MAAS_DNS_DNSSEC_REQUIRED value: {{ .Values.conf.maas.dns.require_dnssec | quote }} - name: MAAS_DNS_SERVERS value: {{ .Values.conf.maas.dns.dns_servers | join "," | quote }} - name: MAAS_DEFAULT_OS value: {{ .Values.conf.maas.images.default_os | quote }} - name: MAAS_DEFAULT_DISTRO value: {{ .Values.conf.maas.images.default_image | quote }} - name: MAAS_DEFAULT_KERNEL value: {{ .Values.conf.maas.images.default_kernel | quote }} {{ tuple $envAll $envAll.Values.pod.resources.jobs.import_resources | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} command: - /tmp/import-boot-resources.sh readinessProbe: exec: command: - /tmp/job-readiness.sh initialDelaySeconds: 60 volumeMounts: - name: maas-bin mountPath: /tmp/import-boot-resources.sh subPath: import-boot-resources.sh readOnly: true - name: maas-bin mountPath: /tmp/job-readiness.sh subPath: job-readiness.sh readOnly: true - name: maas-etc mountPath: /etc/bind/named.conf.options subPath: named.conf.options readOnly: true - name: maas-etc mountPath: /etc/maas/regiond.conf subPath: regiond.conf readOnly: true volumes: - name: maas-bin configMap: name: maas-bin defaultMode: 0555 - name: maas-etc configMap: name: maas-etc defaultMode: 0444