Preparation for workers deployment

Added air-worker VM
Import kubeconfig and check cluster
Initinfra and capi for target cluster

Change-Id: Ib05f805b428a1eab20d62df67ac97670714eebd0
This commit is contained in:
Stanislav Egorov 2020-07-08 21:53:41 -07:00 committed by Stas Egorov
parent 6696ac35fc
commit e20c8ae1fa
11 changed files with 142 additions and 0 deletions

View File

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

View File

@ -0,0 +1,10 @@
---
kind: ConfigMap
apiVersion: v1
metadata:
labels:
name: ironic-vars
data:
PROVISIONING_IP: "10.23.25.102"
DHCP_RANGE: "10.23.25.200,10.23.25.250"
PROVISIONING_INTERFACE: "pxe0"

View File

@ -135,6 +135,10 @@
disk_format: qcow2
target_vms_count: 1
target_vm_nics: "{{ target_vm_nics }}"
worker_vm_memory_mb: 1024
worker_vm_vcpus: 1
worker_disk_size: 10G
worker_vms_count: 1
airship_gate_file_exchanger:
servername: "localhost"
ip:

View File

@ -23,6 +23,8 @@
- ./tools/deployment/25_deploy_ephemeral_node.sh
- ./tools/deployment/26_deploy_metal3_capi_ephemeral_node.sh
- ./tools/deployment/30_deploy_controlplane.sh
- ./tools/deployment/31_deploy_initinfra_target_node.sh
- ./tools/deployment/32_cluster_init_target_node.sh
- name: "Run gate scripts"
include_role:

View File

@ -21,6 +21,8 @@ airship_gate_names:
target_volume_prefix: "vol_target"
ephemeral_volume: "vol_ephemeral"
pool: airship
worker_vm_prefix: "air-worker"
worker_volume_prefix: "vol_worker"
airship_gate_ipam:
nat_network:
@ -79,6 +81,10 @@ airship_gate_flavors:
target_disk_size: 10G
disk_format: qcow2
target_vms_count: 3
worker_vm_memory_mb: 1024
worker_vm_vcpus: 1
worker_disk_size: 10G
worker_vms_count: 1
airship_gate_libvirt_pools:
- path: /var/lib/libvirt/airship

View File

@ -146,3 +146,46 @@
file_exchanger_group: "{{ airship_gate_file_exchanger.group | default(None) }}"
file_exchanger_rbac: "{{ airship_gate_file_exchanger.rbac | default(None) }}"
- name: Create worker volumes
include_role:
name: libvirt-volume
vars:
libvirt_volume:
name: "{{ airship_gate_names.worker_volume_prefix }}-{{ vm_index }}"
size: "{{ chosen_flavor.worker_disk_size }}"
pool: "{{ airship_gate_names.pool }}"
format: "{{ chosen_flavor.disk_format }}"
volume_action: create
loop_control:
loop_var: vm_index
with_sequence: "start=1 end={{ chosen_flavor.worker_vms_count }}"
- name: Create worker domains
include_role:
name: libvirt-domain
vars:
libvirt_domain:
enable_vnc: true
console_log_enabled: true
state: shutdown
name: "{{ airship_gate_names.worker_vm_prefix }}-{{ vm_index }}"
memory_mb: "{{ chosen_flavor.worker_vm_memory_mb }}"
vcpus: "{{ chosen_flavor.worker_vm_vcpus }}"
controllers:
- "sata"
volumes:
- name: "{{ airship_gate_names.worker_volume_prefix }}-{{ vm_index }}"
device: "disk"
target: sda
bus: sata
format: "{{ chosen_flavor.disk_format }}"
pool: "{{ airship_gate_names.pool }}"
interfaces:
- network: "{{ airship_gate_names.nat_network }}"
mac: ""
- network: "{{ airship_gate_names.provision_network }}"
mac: ""
loop_control:
loop_var: vm_index
with_sequence: "start=1 end={{ chosen_flavor.worker_vms_count }}"

View File

@ -38,3 +38,5 @@ airship_gate_names:
target_volume_prefix: "vol_target"
ephemeral_volume: "vol_ephemeral"
pool: airship
worker_vm_prefix: "air-target"
worker_volume_prefix: "vol_worker"

View File

@ -75,6 +75,9 @@ fi
echo "Create kubeconfig"
echo ${KUBECONFIG} | base64 -d > /tmp/targetkubeconfig
echo "Import target kubeconfig"
airshipctl config import /tmp/targetkubeconfig
echo "Check kubectl version"
VERSION=""
N=0

View File

@ -0,0 +1,34 @@
#!/usr/bin/env bash
# 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 -xe
export KUBECONFIG=${KUBECONFIG:-"$HOME/.airship/kubeconfig"}
# TODO need to run another config command after use-context to update kubeconfig
echo "Switch context to target cluster and set manifest"
airshipctl config use-context target-cluster-admin@target-cluster
airshipctl config set-context target-cluster-admin@target-cluster --manifest dummy_manifest
echo "Waiting for all control pods to come up"
kubectl --kubeconfig $KUBECONFIG wait -n kube-system --for=condition=Ready pods --selector tier=control-plane --timeout=600s
kubectl --kubeconfig $KUBECONFIG --namespace metal3 get pods --selector tier=control-plane "--output=jsonpath={.items[*].metadata.name}"
# TODO remove taint
kubectl --kubeconfig $KUBECONFIG taint node node01 node-role.kubernetes.io/master-
echo "Deploy infra to cluster"
airshipctl phase apply initinfra --debug --wait-timeout 600s
kubectl --kubeconfig $KUBECONFIG get pods --all-namespaces

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
# 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 -xe
export KUBECONFIG=${KUBECONFIG:-"$HOME/.airship/kubeconfig"}
# TODO need to run another config command after use-context to update kubeconfig
echo "Switch context to target cluster and set manifest"
airshipctl config use-context target-cluster-admin@target-cluster
airshipctl config set-context target-cluster-admin@target-cluster --manifest dummy_manifest
echo "Deploy CAPI components"
airshipctl cluster init --debug
echo "Waiting for pods to be ready"
kubectl --kubeconfig $KUBECONFIG wait --all-namespaces --for=condition=Ready pods --all --timeout=600s
kubectl --kubeconfig $KUBECONFIG get pods --all-namespaces

View File

@ -94,6 +94,8 @@
- ./tools/deployment/25_deploy_ephemeral_node.sh
- ./tools/deployment/26_deploy_metal3_capi_ephemeral_node.sh
- ./tools/deployment/30_deploy_controlplane.sh
- ./tools/deployment/31_deploy_initinfra_target_node.sh
- ./tools/deployment/32_cluster_init_target_node.sh
serve_dir: /srv/iso
serve_port: 8099
voting: false