AIAP multinode deployment

It deploys 3 controlplane and 2 worker nodes using AIAP gate.

+ kubectl --context target-cluster get node
NAME     STATUS   ROLES                  AGE   VERSION
node01   Ready    control-plane,master   48m   v1.21.2
node03   Ready    worker                 43s   v1.21.2
node04   Ready    control-plane,master   16m   v1.21.2
node05   Ready    control-plane,master   26m   v1.21.2
node06   Ready    worker                 54s   v1.21.2

Tested with 32 GB node.
https://zuul.opendev.org/t/openstack/build/da1c2c440d3d4026ab454de73ee518e2/logs

Closes: #652
Closes: #228

Change-Id: Ie2267e15ed75b57e2e27f45b9be19ddcf7b0a0a8
This commit is contained in:
Pallav Gupta 2021-11-05 06:58:52 -07:00 committed by Sirajudeen
parent 4dfe4afa34
commit 13c4e82f7e
18 changed files with 117 additions and 26 deletions

View File

@ -3,7 +3,7 @@ apiVersion: controlplane.cluster.x-k8s.io/v1alpha4
metadata: metadata:
name: cluster-controlplane name: cluster-controlplane
spec: spec:
replicas: 1 replicas: 3
version: v1.21.2 version: v1.21.2
machineTemplate: machineTemplate:
infrastructureRef: infrastructureRef:

View File

@ -18,12 +18,11 @@ export TIMEOUT=${TIMEOUT:-60}
end=$(($(date +%s) + $TIMEOUT)) end=$(($(date +%s) + $TIMEOUT))
while true; do while true; do
export TARGET_IP="$(kubectl --request-timeout 10s \ export TARGET_IP="$(kubectl -n kube-system get po | \
--context $KCTL_CONTEXT \ grep -i apiserver | \
--namespace ingress \ cut -f1 -d ' ' | \
get pods \ xargs kubectl -n kube-system \
-l app.kubernetes.io/component=controller \ get po $1 -o=jsonpath='{.items[0].status.hostIP}')"
-o jsonpath='{.items[*].status.hostIP}')"
if [ ! -z $TARGET_IP ]; then if [ ! -z $TARGET_IP ]; then
break break
else else

View File

@ -6,7 +6,7 @@ metadata:
cluster.x-k8s.io/cluster-name: target-cluster cluster.x-k8s.io/cluster-name: target-cluster
spec: spec:
clusterName: target-cluster clusterName: target-cluster
replicas: 1 replicas: 2
selector: selector:
matchLabels: matchLabels:
cluster.x-k8s.io/cluster-name: target-cluster cluster.x-k8s.io/cluster-name: target-cluster

View File

@ -34,6 +34,7 @@ config:
value: "provisioned" value: "provisioned"
pruneOptions: pruneOptions:
prune: false prune: false
inventoryPolicy: force-adopt
--- ---
apiVersion: airshipit.org/v1alpha1 apiVersion: airshipit.org/v1alpha1
kind: KubernetesApply kind: KubernetesApply

View File

@ -11,3 +11,14 @@ namespace: target-infra
transformers: transformers:
- ../../../../type/gating/ephemeral/controlplane/replacements - ../../../../type/gating/ephemeral/controlplane/replacements
patchesJson6902:
- target:
group: controlplane.cluster.x-k8s.io
version: v1alpha4
kind: KubeadmControlPlane
name: cluster-controlplane
path: patch_json6902_controlplane.yaml
patchesStrategicMerge:
- versions-airshipctl.yaml

View File

@ -0,0 +1,3 @@
- op: replace
path: "/spec/replicas"
value: 1

View File

@ -0,0 +1,12 @@
# Override default controlplane image location
apiVersion: airshipit.org/v1alpha1
kind: VersionsCatalogue
metadata:
name: versions-airshipctl
spec:
files:
k8scontrol:
# Host the image in a locally served location for CI
cluster_controlplane_image:
url: http://10.23.24.137:80/images/control-plane.qcow2
checksum: http://10.23.24.137:80/images/control-plane.qcow2.md5sum

View File

@ -13,3 +13,5 @@ hosts:
- node02 - node02
- node03 - node03
- node04 - node04
- node05
- node06

View File

@ -54,15 +54,45 @@ hosts:
pxe: 52:54:00:b6:ed:23 pxe: 52:54:00:b6:ed:23
hardwareProfile: default # defined in the hardwareprofile-example function hardwareProfile: default # defined in the hardwareprofile-example function
node04: node04:
bootMode: UEFI bootMode: legacy
macAddress: 52:54:00:36:5e:e3 macAddress: 52:54:00:01:71:d8
bmcAddress: redfish+http://10.23.25.2:8000/redfish/v1/Systems/air-target-2 bmcAddress: redfish+http://10.23.25.1:8000/redfish/v1/Systems/air-target-2
bmcUsername: username bmcUsername: username
bmcPassword: password bmcPassword: password
disableCertificateVerification: false
ipAddresses: ipAddresses:
oam-ipv4: 10.23.25.104 oam-ipv4: 10.23.25.104
pxe-ipv4: 10.23.24.104 pxe-ipv4: 10.23.24.104
macAddresses: macAddresses:
oam: 52:54:00:dc:ab:04 oam: 52:54:00:f0:57:e0
pxe: 52:54:00:51:0b:e4 pxe: 52:54:00:01:71:d8
hardwareProfile: default # defined in the hostgenerator-m3 function
node05:
bootMode: legacy
macAddress: 52:54:00:a3:ee:18
bmcAddress: redfish+http://10.23.25.1:8000/redfish/v1/Systems/air-target-3
bmcUsername: username
bmcPassword: password
disableCertificateVerification: false
ipAddresses:
oam-ipv4: 10.23.25.105
pxe-ipv4: 10.23.24.105
macAddresses:
oam: 52:54:00:91:36:49
pxe: 52:54:00:a3:ee:18
hardwareProfile: default # defined in the hostgenerator-m3 function
node06:
bootMode: legacy
macAddress: 52:54:00:b6:ed:19
bmcAddress: redfish+http://10.23.25.1:8000/redfish/v1/Systems/air-worker-2
bmcUsername: username
bmcPassword: password
disableCertificateVerification: false
ipAddresses:
oam-ipv4: 10.23.25.106
pxe-ipv4: 10.23.24.106
macAddresses:
oam: 52:54:00:9b:27:08
pxe: 52:54:00:b6:ed:19
hardwareProfile: default # defined in the hardwareprofile-example function hardwareProfile: default # defined in the hardwareprofile-example function

View File

@ -7,3 +7,5 @@ metadata:
name: host-generation-catalogue name: host-generation-catalogue
hosts: hosts:
m3: m3:
- node04
- node05

View File

@ -7,6 +7,9 @@ resources:
- ../catalogues - ../catalogues
- nodes - nodes
patchesStrategicMerge:
- metal3machinetemplate.yaml
namespace: target-infra namespace: target-infra
commonLabels: commonLabels:

View File

@ -0,0 +1,16 @@
---
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha5
kind: Metal3MachineTemplate
metadata:
annotations:
config.kubernetes.io/path: metal3machinetemplate_cluster-controlplane.yaml
name: cluster-controlplane
spec:
template:
spec:
hostSelector:
matchLabels:
airshipit.org/k8s-role: controlplane-host
image:
url: http://10.23.24.137:80/images/control-plane.qcow2
checksum: http://10.23.24.137:80/images/control-plane.qcow2.md5sum

View File

@ -8,3 +8,4 @@ metadata:
hosts: hosts:
m3: m3:
- node03 - node03
- node06

View File

@ -99,6 +99,8 @@ phases:
- name: eject-virtual-media-ephemeral - name: eject-virtual-media-ephemeral
# Power off Ephemeral baremetal host avoid DHCP conflict # Power off Ephemeral baremetal host avoid DHCP conflict
- name: power-off-ephemeral - name: power-off-ephemeral
# Create target k8s cluster resources
- name: controlplane-target
# List all nodes in target cluster # List all nodes in target cluster
# Scripts for this phase placed in manifests/function/phase-helpers/get_node/ # Scripts for this phase placed in manifests/function/phase-helpers/get_node/
# To get ConfigMap for this phase, execute `airshipctl phase render --source config -k ConfigMap` # To get ConfigMap for this phase, execute `airshipctl phase render --source config -k ConfigMap`
@ -124,6 +126,7 @@ validation:
- VariableCatalogue - VariableCatalogue
crdList: crdList:
- airshipctl/manifests/function/airshipctl-schemas - airshipctl/manifests/function/airshipctl-schemas
- airshipctl/manifests/function/baremetal-operator/v0.5.0/upstream/crd
--- ---
apiVersion: airshipit.org/v1alpha1 apiVersion: airshipit.org/v1alpha1
kind: PhasePlan kind: PhasePlan

View File

@ -69,6 +69,7 @@
path: "{{ roleinputvar.path }}" path: "{{ roleinputvar.path }}"
loop: loop:
- { name: 'target', path: 'ephemeral/controlplane' } - { name: 'target', path: 'ephemeral/controlplane' }
- { name: 'target', path: 'target/controlplane' }
- { name: 'ephemeral', path: 'ephemeral/bootstrap' } - { name: 'ephemeral', path: 'ephemeral/bootstrap' }
- { name: 'worker', path: 'target/workers' } - { name: 'worker', path: 'target/workers' }
loop_control: loop_control:
@ -96,12 +97,12 @@
target_vm_cfg: "{{ target_vm_cfg }}" target_vm_cfg: "{{ target_vm_cfg }}"
target_vm_memory_mb: 7168 target_vm_memory_mb: 7168
target_vm_vcpus: 2 target_vm_vcpus: 2
target_vms_count: 1 target_vms_count: 3
worker_disk_size: 30G worker_disk_size: 30G
worker_vm_cfg: "{{ worker_vm_cfg }}" worker_vm_cfg: "{{ worker_vm_cfg }}"
worker_vm_memory_mb: 7168 worker_vm_memory_mb: 7168
worker_vm_vcpus: 2 worker_vm_vcpus: 2
worker_vms_count: 1 worker_vms_count: 2
airship_gate_file_exchanger: airship_gate_file_exchanger:
servername: "localhost" servername: "localhost"
ip: ip:

View File

@ -17,7 +17,6 @@
{{ airship_config_manifest_directory }}/{{ airship_config_site_path }}/{{ path }} 2>/dev/null | {{ airship_config_manifest_directory }}/{{ airship_config_site_path }}/{{ path }} 2>/dev/null |
kustomize cfg grep "kind=BareMetalHost" kustomize cfg grep "kind=BareMetalHost"
register: bmh_command register: bmh_command
failed_when: "bmh_command.stdout == ''"
environment: environment:
KUSTOMIZE_ENABLE_ALPHA_COMMANDS: "true" KUSTOMIZE_ENABLE_ALPHA_COMMANDS: "true"
SOPS_IMPORT_PGP: "{{ airship_config_pgp }}" SOPS_IMPORT_PGP: "{{ airship_config_pgp }}"
@ -37,6 +36,7 @@
KUSTOMIZE_ENABLE_ALPHA_COMMANDS: "true" KUSTOMIZE_ENABLE_ALPHA_COMMANDS: "true"
SOPS_IMPORT_PGP: "{{ airship_config_pgp }}" SOPS_IMPORT_PGP: "{{ airship_config_pgp }}"
with_items: "{{ bmh }}" with_items: "{{ bmh }}"
when: bmh|length > 0
- name: get links from network data per BareMetalHost object - name: get links from network data per BareMetalHost object
set_fact: set_fact:
@ -47,6 +47,8 @@
map(attribute='stringData.networkData') | map('from_yaml') | map(attribute='stringData.networkData') | map('from_yaml') |
map(attribute='links') | list map(attribute='links') | list
}} }}
when: bmh|length > 0
- name: define list of VM mac addresses and VM boot mode - name: define list of VM mac addresses and VM boot mode
set_fact: set_fact:
@ -64,6 +66,12 @@
loop_control: loop_control:
index_var: idx index_var: idx
register: vm_cfg_fact register: vm_cfg_fact
when: bmh|length > 0
- set_fact:
"{{ name }}_vm_cfg": "{{ (lookup('vars', name + '_vm_cfg') |list) + (vm_cfg_fact.results | map(attribute='ansible_facts.vm_cfg') | list) }}"
when: "{{ name + '_vm_cfg' }} is defined and bmh|length > 0"
- set_fact: - set_fact:
"{{ name }}_vm_cfg": "{{ vm_cfg_fact.results | map(attribute='ansible_facts.vm_cfg') | list }}" "{{ name }}_vm_cfg": "{{ vm_cfg_fact.results | map(attribute='ansible_facts.vm_cfg') | list }}"
when: "{{ name + '_vm_cfg' }} is not defined and bmh|length > 0"

View File

@ -24,7 +24,6 @@ data:
AIRSHIP_CONFIG_MANIFEST_REPO_AUTH_USERNAME: "" AIRSHIP_CONFIG_MANIFEST_REPO_AUTH_USERNAME: ""
AIRSHIP_CONFIG_MANIFEST_REPO_AUTH_HTTP_PASSWORD: "" AIRSHIP_CONFIG_MANIFEST_REPO_AUTH_HTTP_PASSWORD: ""
AIRSHIP_CONFIG_MANIFEST_REPO_AUTH_SSH_PASSWORD: "" AIRSHIP_CONFIG_MANIFEST_REPO_AUTH_SSH_PASSWORD: ""
SOPS_IMPORT_PGP: ""
--- ---
apiVersion: v1 apiVersion: v1

View File

@ -18,7 +18,7 @@ floorplan:
ephemeral_node: ephemeral_node:
name: air-ephemeral name: air-ephemeral
cpu: 4 cpu: 2
ram: 6144 ram: 6144
nat_mac_address: [ "52:54:00:9b:27:02" ] nat_mac_address: [ "52:54:00:9b:27:02" ]
prov_mac_address: [ "52:54:00:b6:ed:02" ] prov_mac_address: [ "52:54:00:b6:ed:02" ]
@ -26,22 +26,22 @@ ephemeral_node:
- 30G - 30G
target_nodes: target_nodes:
count: 1 count: 3
name: air-target name: air-target
cpu: 2 cpu: 2
ram: 7168 ram: 6144
nat_mac_address: [ "52:54:00:9b:27:4c" ] nat_mac_address: [ "52:54:00:9b:27:4c", "52:54:00:f0:57:e0", "52:54:00:91:36:49" ]
prov_mac_address: [ "52:54:00:b6:ed:31" ] prov_mac_address: [ "52:54:00:b6:ed:31", "52:54:00:01:71:d8", "52:54:00:a3:ee:18" ]
block: block:
- 30G - 30G
worker_nodes: worker_nodes:
count: 1 count: 2
name: air-worker name: air-worker
cpu: 2 cpu: 2
ram: 7168 ram: 6144
nat_mac_address: [ "52:54:00:9b:27:07" ] nat_mac_address: [ "52:54:00:9b:27:07", "52:54:00:9b:27:08" ]
prov_mac_address: [ "52:54:00:b6:ed:23" ] prov_mac_address: [ "52:54:00:b6:ed:23", "52:54:00:b6:ed:19" ]
block: block:
- 30G - 30G