Add CAPI initialization steps to gating

This change enables execute 'airshipctl cluster init' command
as a part of zuul pipeline

Co-Authored-By: Kostyantyn Kalynovskyi <kkalynovskyi@mirantis.com>
Change-Id: I9d499ae66f8d847759c2e61e5d4415f2c9f3c860
changes/86/727386/5
Dmitry Ukov 3 years ago
parent 8f75fbdb8c
commit a301de202b
  1. 3
      manifests/site/test-site/ephemeral/initinfra/kustomization.yaml
  2. 10
      manifests/site/test-site/ephemeral/initinfra/patch_bmo_config.yaml
  3. 31
      manifests/site/test-site/shared/clusterctl/clusterctl.yaml
  4. 2
      manifests/site/test-site/shared/clusterctl/kustomization.yaml
  5. 1
      playbooks/airship-airshipctl-test-runner.yaml
  6. 55
      roles/airshipctl-cluster-init-ephemeral/tasks/main.yaml
  7. 29
      tools/gate/29_cluster_init.sh
  8. 15
      tools/gate/config_cluster_init.yaml
  9. 2
      zuul.d/jobs.yaml

@ -1,4 +1,7 @@
resources:
- ../../shared/clusterctl
- ../../../../function/baremetal-operator
patchesStrategicMerge:
- patch_bmo_config.yaml
commonLabels:
airshipit.org/stage: initinfra

@ -0,0 +1,10 @@
---
kind: ConfigMap
apiVersion: v1
metadata:
labels:
name: ironic-vars
data:
PROVISIONING_IP: "10.23.24.101"
DHCP_RANGE: "10.23.24.200,10.23.24.250"
PROVISIONING_INTERFACE: "enp0s4"

@ -0,0 +1,31 @@
apiVersion: airshipit.org/v1alpha1
kind: Clusterctl
metadata:
labels:
airshipit.org/deploy-k8s: "false"
name: clusterctl-v1
init-options:
core-provider: "cluster-api:v0.3.3"
bootstrap-providers:
- "kubeadm:v0.3.3"
infrastructure-providers:
- "metal3:v0.3.1"
control-plane-providers:
- "kubeadm:v0.3.3"
providers:
- name: "metal3"
type: "InfrastructureProvider"
versions:
v0.3.1: manifests/function/capm3/v0.3.1
- name: "kubeadm"
type: "BootstrapProvider"
versions:
v0.3.3: manifests/function/cabpk/v0.3.3
- name: "cluster-api"
type: "CoreProvider"
versions:
v0.3.3: manifests/function/capi/v0.3.3
- name: "kubeadm"
type: "ControlPlaneProvider"
versions:
v0.3.3: manifests/function/cacpk/v0.3.3

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

@ -0,0 +1,55 @@
# 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: initialize CAPI components
command: >-
airshipctl --debug cluster init
- name: verify CAPI deployments are created
command: >-
timeout 20 kubectl \
--kubeconfig {{ airshipctl_config_dir_default | default(ansible_env.HOME) }}/.airship/kubeconfig \
get deploy -n {{ item.namespace }} {{ item.name }}
register: deploy_status
until: item.name in deploy_status.stdout
with_items:
- namespace: capi-kubeadm-bootstrap-system
name: capi-kubeadm-bootstrap-controller-manager
- namespace: capi-kubeadm-control-plane-system
name: capi-kubeadm-control-plane-controller-manager
- namespace: capi-system
name: capi-controller-manager
- namespace: capi-webhook-system
name: capi-controller-manager
- namespace: capi-webhook-system
name: capi-kubeadm-bootstrap-controller-manager
- namespace: capi-webhook-system
name: capi-kubeadm-control-plane-controller-manager
- namespace: capi-webhook-system
name: capm3-controller-manager
- namespace: capm3-system
name: capm3-controller-manager
- namespace: cert-manager
name: cert-manager
- namespace: cert-manager
name: cert-manager-cainjector
- namespace: cert-manager
name: cert-manager-webhook
retries: 50
delay: 20
# TODO: As soon as issue #127 is complete, this check for deployments
# should be removed and initinfra command should check for resource status.
- name: verify all deployments are up
command: >-
kubectl --kubeconfig {{ airshipctl_config_dir_default | default(ansible_env.HOME) }}/.airship/kubeconfig \
wait --for=condition=available deploy --all --timeout=1000s -A

@ -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_init.yaml \
-e @"$PLAYBOOK_CONFIG"

@ -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-init-ephemeral

@ -79,6 +79,7 @@
- install-kubectl
- airshipctl-deploy-ephemeral-node
- airshipctl-phase-apply-initinfra
- airshipctl-cluster-init-ephemeral
serve_dir: /srv/iso
serve_port: 8099
@ -103,6 +104,7 @@
- install-kubectl
- airshipctl-deploy-ephemeral-node
- airshipctl-phase-apply-initinfra
- airshipctl-cluster-init-ephemeral
serve_dir: /srv/iso
serve_port: 8099
voting: false

Loading…
Cancel
Save