Add rudimentary Helm test
Create a simple Helm test to ensure the Region controller is functional enough to allow the MaaS CLI to establish an authenticated session with it. - Also make image cache disabled by default - Fix init container args for HTK Change-Id: I67e688efb91198cd31d3972e09808cea3361570c
This commit is contained in:
20
charts/maas/templates/bin/_maas-test.sh.tpl
Normal file
20
charts/maas/templates/bin/_maas-test.sh.tpl
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
{{/*
|
||||
# Copyright (c) 2017 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. */}}
|
||||
|
||||
set -ex
|
||||
|
||||
maas login local ${MAAS_URL} $MAAS_API_KEY
|
||||
echo $?
|
||||
@@ -37,3 +37,5 @@ data:
|
||||
{{ tuple "bin/_export-api-key.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
||||
register-rack-controller.sh: |
|
||||
{{ tuple "bin/_register-rack-controller.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
||||
maas-test.sh: |
|
||||
{{ tuple "bin/_maas-test.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
||||
|
||||
@@ -45,7 +45,7 @@ spec:
|
||||
hostNetwork: true
|
||||
dnsPolicy: ClusterFirst
|
||||
initContainers:
|
||||
{{ tuple $envAll $dependencies "[]" | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
|
||||
{{ tuple $envAll $dependencies list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
|
||||
containers:
|
||||
- name: maas-rack
|
||||
image: {{ .Values.images.tags.maas_rack }}
|
||||
|
||||
@@ -31,7 +31,7 @@ spec:
|
||||
nodeSelector:
|
||||
{{ .Values.labels.region.node_selector_key }}: {{ .Values.labels.region.node_selector_value }}
|
||||
initContainers:
|
||||
{{ tuple $envAll $dependencies "[]" | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
|
||||
{{ tuple $envAll $dependencies list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
|
||||
containers:
|
||||
- name: maas-bootstrap-admin-user
|
||||
image: {{ .Values.images.tags.bootstrap }}
|
||||
|
||||
@@ -31,7 +31,7 @@ spec:
|
||||
nodeSelector:
|
||||
{{ .Values.labels.region.node_selector_key }}: {{ .Values.labels.region.node_selector_value }}
|
||||
initContainers:
|
||||
{{ tuple $envAll $dependencies "[]" | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
|
||||
{{ tuple $envAll $dependencies list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
|
||||
containers:
|
||||
- name: maas-db-init
|
||||
image: {{ .Values.images.tags.db_init | quote }}
|
||||
|
||||
@@ -31,7 +31,7 @@ spec:
|
||||
nodeSelector:
|
||||
{{ .Values.labels.region.node_selector_key }}: {{ .Values.labels.region.node_selector_value }}
|
||||
initContainers:
|
||||
{{ tuple $envAll $dependencies "[]" | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
|
||||
{{ tuple $envAll $dependencies list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
|
||||
containers:
|
||||
- name: maas-db-sync
|
||||
image: {{ .Values.images.tags.db_sync }}
|
||||
|
||||
@@ -31,7 +31,7 @@ spec:
|
||||
nodeSelector:
|
||||
{{ .Values.labels.region.node_selector_key }}: {{ .Values.labels.region.node_selector_value }}
|
||||
initContainers:
|
||||
{{ tuple $envAll $dependencies "[]" | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
|
||||
{{ tuple $envAll $dependencies list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
|
||||
containers:
|
||||
- name: region-import-resources
|
||||
image: {{ .Values.images.tags.maas_region }}
|
||||
|
||||
52
charts/maas/templates/tests/test-maas-api.yaml
Normal file
52
charts/maas/templates/tests/test-maas-api.yaml
Normal file
@@ -0,0 +1,52 @@
|
||||
{{/*
|
||||
# Copyright (c) 2017 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. */}}
|
||||
{{/*
|
||||
Test that the API is up and can be logged into */}}
|
||||
{{- if .Values.manifests.test_maas_api }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: "{{ .Release.Name }}-api-test"
|
||||
annotations:
|
||||
"helm.sh/hook": "test-success"
|
||||
spec:
|
||||
restartPolicy: Never
|
||||
containers:
|
||||
- name: "{{ .Release.Name }}-api-test"
|
||||
env:
|
||||
- name: 'MAAS_URL'
|
||||
value: {{ tuple "maas_region_ui" "internal" "region_ui" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup" | quote }}
|
||||
- name: 'MAAS_API_KEY'
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: 'maas-api-key'
|
||||
key: 'token'
|
||||
image: {{ .Values.images.tags.maas_region }}
|
||||
imagePullPolicy: {{ .Values.images.pull_policy }}
|
||||
{{ tuple . .Values.pod.resources.test | include "helm-toolkit.snippets.kubernetes_resources" | indent 8 }}
|
||||
command: ["/tmp/maas-test.sh"]
|
||||
volumeMounts:
|
||||
- name: maas-bin
|
||||
mountPath: /tmp/maas-test.sh
|
||||
subPath: maas-test.sh
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: maas-bin
|
||||
configMap:
|
||||
name: maas-bin
|
||||
defaultMode: 0555
|
||||
...
|
||||
{{- end }}
|
||||
Reference in New Issue
Block a user