Add initinfra gating tests

Relates-To: #180

Change-Id: Ie7a8daa532596f2d1d0fb2059ef4630607511711
This commit is contained in:
Vamsi Savaram 2020-04-19 21:32:10 +00:00
parent 68c97923e1
commit e40b5ffec5
7 changed files with 108 additions and 0 deletions

View File

@ -0,0 +1,4 @@
resources:
- ../../../../function/baremetal-operator
commonLabels:
airshipit.org/stage: initinfra

View File

@ -22,6 +22,7 @@
- airshipctl-build-ephemeral-iso
- install-kubectl
- airshipctl-deploy-ephemeral-node
- airshipctl-cluster-initinfra
var_files_default:
- local-dev.yaml
- airship-ipam.yaml

View File

@ -0,0 +1,14 @@
# 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.
# TODO: Remove this as soon as issue #127 is complete
infra_namespace: metal3

View File

@ -0,0 +1,43 @@
# 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.
- name: deploy infra to cluster
command: >-
airshipctl cluster initinfra
# TODO: As soon as issue #127 is complete, this check for pods should
# be removed and initinfra command should check for resource status.
- name: verify initinfra metal3-baremetal-operator is created
command: >-
timeout 20 kubectl \
--kubeconfig {{ airshipctl_config_dir_default | default(ansible_env.HOME) }}/.airship/kubeconfig \
--namespace {{ infra_namespace }} \
get deploy {{ item }}
register: deploy_status
until: item in deploy_status.stdout
with_items:
- metal3-baremetal-operator
retries: 50
delay: 20
- name: verify initinfra metal3-baremetal-operator comes up
command: >-
timeout 20 kubectl \
--kubeconfig {{ airshipctl_config_dir_default | default(ansible_env.HOME) }}/.airship/kubeconfig \
--namespace {{ infra_namespace }} \
wait --for=condition=ready pods --selector name={{ item }}
register: deploy_status
until: item in deploy_status.stdout
with_items:
- metal3-baremetal-operator
retries: 50
delay: 20

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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 -xe
TMP_DIR=${TMP_DIR:-"$(dirname $(mktemp -u))"}
ANSIBLE_HOSTS=${ANSIBLE_HOSTS:-"${TMP_DIR}/ansible_hosts"}
PLAYBOOK_CONFIG=${PLAYBOOK_CONFIG:-"${TMP_DIR}/config.yaml"}
sudo ansible-playbook -i "$ANSIBLE_HOSTS" \
playbooks/airship-airshipctl-test-runner.yaml \
-e @tools/gate/config_cluster_initinfra.yaml \
-e @"$PLAYBOOK_CONFIG"

View File

@ -0,0 +1,15 @@
# 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_roles:
- airshipctl-cluster-initinfra

View File

@ -86,6 +86,7 @@
- airshipctl-build-ephemeral-iso
- install-kubectl
- airshipctl-deploy-ephemeral-node
- airshipctl-cluster-initinfra
serve_dir: /srv/iso
serve_port: 8099
@ -109,6 +110,7 @@
- airshipctl-build-ephemeral-iso
- install-kubectl
- airshipctl-deploy-ephemeral-node
- airshipctl-cluster-initinfra
serve_dir: /srv/iso
serve_port: 8099
voting: false