Skip to content

Commit 60eb07d

Browse files
committed
Merge branch 'improvement/add-multi-node-specific-nightly' into tmp/octopus/w/125.0/improvement/add-multi-node-specific-nightly
2 parents 80daa89 + 5d10b9a commit 60eb07d

File tree

41 files changed

+384
-4329
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+384
-4329
lines changed

.github/actions/bastion-tests/action.yaml

+6-1
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,16 @@ inputs:
2222
description: "Path to the bootstrap backup archive"
2323
required: false
2424
default: ""
25+
mountpoint:
26+
description: "The MetalK8s ISO mountpoint on bootstrap node (autodiscovered if not provided)"
27+
required: false
28+
default: ""
2529

2630
runs:
2731
using: "composite"
2832
steps:
2933
- name: "Retrieve MetalK8s mountpoint"
34+
if: ${{ ! inputs.mountpoint }}
3035
id: metalk8s_mountpoint
3136
uses: ./.github/actions/retrieve-mountpoint
3237
- name: Run tests from Bastion
@@ -37,7 +42,7 @@ runs:
3742
COMMAND: |
3843
cd metalk8s
3944
export SSH_CONFIG_FILE=\"/home/centos/ssh_config\"
40-
export ISO_MOUNTPOINT=\"${{ steps.metalk8s_mountpoint.outputs.mountpoint }}\"
45+
export ISO_MOUNTPOINT=\"${{ inputs.mountpoint || steps.metalk8s_mountpoint.outputs.mountpoint }}\"
4146
export BOOTSTRAP_BACKUP_ARCHIVE=\"${{ inputs.BOOTSTRAP_BACKUP_ARCHIVE }}\"
4247
export CONTROL_PLANE_INGRESS_VIP=\"${{ inputs.CONTROL_PLANE_INGRESS_VIP }}\"
4348
export WORKLOAD_PLANE_INGRESS_VIPS=\"${{ inputs.WORKLOAD_PLANE_INGRESS_VIPS }}\"

.github/actions/destroy-cluster/action.yaml

+6-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ inputs:
3737
description: "Name of the deployment (used in artifacts and the VM names prefix)"
3838
required: true
3939

40+
args:
41+
description: Specific arguments to add to the destroy command
42+
required: false
43+
default: ""
44+
4045
runs:
4146
using: "composite"
4247
steps:
@@ -91,6 +96,6 @@ runs:
9196
- name: Destroy cluster with Terraform
9297
working-directory: terraform-snapshot/terraform/
9398
shell: bash
94-
run: terraform destroy -auto-approve
99+
run: terraform destroy -auto-approve ${{ inputs.args }}
95100
env:
96101
TF_VAR_cloud: ${{ inputs.CLOUD }}

.github/actions/mount-iso/action.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,8 @@ runs:
2222
uses: ./.github/actions/run-command-ssh
2323
with:
2424
COMMAND: sudo mount \"${{ inputs.ARCHIVE }}\" \"${{ inputs.MOUNTPOINT }}\"
25+
26+
outputs:
27+
mountpoint:
28+
description: "The mountpoint path"
29+
value: ${{ inputs.MOUNTPOINT }}

.github/actions/prepare-bastion/action.yaml

+3-5
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,10 @@ runs:
1919
with:
2020
NODE: bastion
2121
COMMAND: |
22-
if [ -d 'metalk8s' ]; then
23-
cd metalk8s && git checkout ${{ inputs.BRANCH }}
24-
else
25-
git clone --branch ${{ inputs.BRANCH }} \
26-
${{ github.server_url }}/${{ github.repository }}
22+
if [ ! -d 'metalk8s' ]; then
23+
git clone ${{ github.server_url }}/${{ github.repository }}
2724
fi
25+
cd metalk8s && git checkout ${{ inputs.BRANCH }}
2826
- name: Install UI tests deps on Bastion
2927
if: inputs.UI_DEPS != 'false'
3028
uses: ./.github/actions/run-command-ssh
+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: "Remove node"
2+
description: "Remove a node from the cluster"
3+
4+
inputs:
5+
node-to-remove:
6+
description: "The name of the node to remove"
7+
required: false
8+
default: "bootstrap"
9+
from-node:
10+
description: "The node to use to do the removal"
11+
required: false
12+
default: "node-1"
13+
14+
runs:
15+
using: "composite"
16+
steps:
17+
- name: "Retrieve etcd container name to use"
18+
id: get-container
19+
uses: ./.github/actions/run-command-ssh
20+
with:
21+
NODE: ${{ inputs.from-node }}
22+
COMMAND: >
23+
sudo crictl ps -q --label io.kubernetes.pod.namespace=kube-system
24+
--label io.kubernetes.container.name=etcd --state Running
25+
CAPTURE_RESULT: "true"
26+
- name: "Retrieve etcd member id to remove"
27+
id: get-id
28+
uses: ./.github/actions/run-command-ssh
29+
with:
30+
NODE: ${{ inputs.from-node }}
31+
COMMAND: >
32+
sudo crictl exec -i \"${{ steps.get-container.outputs.RESULT }}\" sh -c \"
33+
ETCDCTL_API=3 etcdctl --endpoints https://127.0.0.1:2379
34+
--cert /etc/kubernetes/pki/etcd/server.crt
35+
--key /etc/kubernetes/pki/etcd/server.key
36+
--cacert /etc/kubernetes/pki/etcd/ca.crt
37+
member list\" | awk -F ', ' '\$3 ~ \"${{ inputs.node-to-remove }}\" { print \$1 }'
38+
CAPTURE_RESULT: "true"
39+
- name: "Remove the etcd member"
40+
uses: ./.github/actions/run-command-ssh
41+
with:
42+
NODE: ${{ inputs.from-node }}
43+
COMMAND: >
44+
sudo crictl exec -i \"${{ steps.get-container.outputs.RESULT }}\" sh -c \"
45+
ETCDCTL_API=3 etcdctl --endpoints https://127.0.0.1:2379
46+
--cert /etc/kubernetes/pki/etcd/server.crt
47+
--key /etc/kubernetes/pki/etcd/server.key
48+
--cacert /etc/kubernetes/pki/etcd/ca.crt
49+
member remove ${{ steps.get-id.outputs.RESULT }}\"
50+
- name: "Remove the node object"
51+
uses: ./.github/actions/run-command-ssh
52+
with:
53+
NODE: ${{ inputs.from-node }}
54+
COMMAND: >
55+
sudo kubectl --kubeconfig=/etc/kubernetes/admin.conf
56+
delete node ${{ inputs.node-to-remove }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: "Retrieve backup"
2+
description: "Retrieve a MetalK8s bootstrap backup from the bootstrap"
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Find latest backup file
8+
uses: ./.github/actions/run-command-ssh
9+
with:
10+
COMMAND: >
11+
sudo cp \$(sudo find /var/lib/metalk8s/backups -name '*.tar.gz' | sort | tail -n1)
12+
/var/tmp/my-backup.tar.gz
13+
- name: Retrieve the backup file
14+
uses: ./.github/actions/copy-file-ssh
15+
with:
16+
NODE_TO: ""
17+
NODE_FROM: "bootstrap"
18+
SOURCE_FILE: "/var/tmp/my-backup.tar.gz"
19+
DESTINATION_FILE: "./"
20+
- name: Output filename
21+
id: set-outputs
22+
shell: bash
23+
run: echo "filename=my-backup.tar.gz" >> $GITHUB_OUTPUT
24+
25+
outputs:
26+
filename:
27+
description: "The MetalK8s backup file name"
28+
value: ${{ steps.set-outputs.outputs.filename }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: "Run K8s Conformance"
2+
description: "Run the Kubernetes Conformance tests"
3+
4+
inputs:
5+
metalk8s-short-version:
6+
description: "The MetalK8s short version to use in the PR content"
7+
required: true
8+
dest:
9+
description: "Destination directory for results + PR content"
10+
required: false
11+
default: "artifacts/conformance"
12+
13+
runs:
14+
using: "composite"
15+
steps:
16+
- name: Create result directory
17+
shell: bash
18+
run: |
19+
result_dir="${{ inputs.dest }}/sonobuoy-results"
20+
echo "result_dir=$result_dir" >> $GITHUB_ENV
21+
mkdir -p "$result_dir"
22+
- name: Retrieve the Kubernetes version
23+
id: get-k8s-version
24+
uses: ./.github/actions/run-command-ssh
25+
with:
26+
COMMAND: |
27+
sudo rpm -q --queryformat '%{VERSION}' kubelet | cut -d'.' -f1,2
28+
CAPTURE_RESULT: "true"
29+
- name: Get sonobuoy bin
30+
shell: bash
31+
env:
32+
SONOBUOY_VERSION: "0.56.15"
33+
run: |
34+
curl -Lo "sonobuoy.tar.gz" https://github.com/vmware-tanzu/sonobuoy/releases/download/v${SONOBUOY_VERSION}/sonobuoy_${SONOBUOY_VERSION}_linux_amd64.tar.gz
35+
tar xvf sonobuoy.tar.gz
36+
- name: Copy sonobuoy bin to Bootstrap node
37+
uses: ./.github/actions/copy-file-ssh
38+
with:
39+
SOURCE_FILE: "sonobuoy"
40+
- name: Run conformance tests from Bootstrap node
41+
uses: ./.github/actions/run-command-ssh
42+
with:
43+
COMMAND: |
44+
sudo ./sonobuoy run --kubeconfig=/etc/kubernetes/admin.conf --mode=certified-conformance --wait
45+
SSH_OPTIONS: "-o ServerAliveInterval=15"
46+
- name: Retrieve conformance tests result
47+
uses: ./.github/actions/run-command-ssh
48+
with:
49+
COMMAND: |
50+
sudo ./sonobuoy retrieve --kubeconfig=/etc/kubernetes/admin.conf --filename sonobuoy_result.tar.gz
51+
- name: Retrieve conformance tests result from Bootstrap node
52+
uses: ./.github/actions/copy-file-ssh
53+
with:
54+
NODE_TO: ""
55+
NODE_FROM: "bootstrap"
56+
SOURCE_FILE: "sonobuoy_result.tar.gz"
57+
DESTINATION_FILE: "${{ env.result_dir }}/"
58+
- name: Extract conformance tests result
59+
shell: bash
60+
working-directory: ${{ env.result_dir }}
61+
run: tar xvf sonobuoy_result.tar.gz
62+
- name: Check conformance tests result
63+
shell: bash
64+
run: |
65+
failed_tests=$(./sonobuoy results "$result_dir/sonobuoy_result.tar.gz" --mode=detailed --plugin=e2e | jq 'select(.status=="failed")')
66+
[ -n "$failed_tests" ] && echo $failed_tests && exit 1 || exit 0
67+
- name: Prepare conformance PR content
68+
shell: bash
69+
env:
70+
DIRECTORY: "${{ inputs.dest }}/pr-content"
71+
SONOBUOY_RES_DIR: "${{ env.result_dir }}"
72+
K8S_VERSION: "${{ steps.get-k8s-version.outputs.RESULT }}"
73+
METALK8S_VERSION: "${{ inputs.metalk8s-short-version }}"
74+
run: |
75+
.github/scripts/build-conformance-pr-content.sh
76+
tar cvf "${{ inputs.dest }}/pr-content.tar.gz" -C "$DIRECTORY" "v$K8S_VERSION"
77+

.github/actions/spawn-cluster/action.yaml

+17-1
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,20 @@ inputs:
5656
required: false
5757
default: ""
5858

59+
args:
60+
description: Specific arguments to add to the apply command
61+
required: false
62+
default: ""
63+
skip-prepare:
64+
description: Skip the preparation of the worker
65+
required: false
66+
default: "false"
67+
5968
runs:
6069
using: "composite"
6170
steps:
6271
- name: Prepare SSH keypair
72+
if: inputs.skip-prepare == 'false'
6373
shell: bash
6474
run: |
6575
mkdir -p ~/.ssh
@@ -69,6 +79,7 @@ runs:
6979
mkdir -p "artifacts/terraform-context/${{ inputs.NAME }}/"
7080
cp ~/.ssh/terraform* "artifacts/terraform-context/${{ inputs.NAME }}/"
7181
- name: Upload SSH keypair
82+
if: inputs.skip-prepare == 'false'
7283
uses: scality/action-artifacts@v3
7384
with:
7485
method: upload
@@ -77,25 +88,30 @@ runs:
7788
password: ${{inputs.ARTIFACTS_PASSWORD}}
7889
source: artifacts/
7990
- name: Checkout scality/terraform-snapshot
91+
if: inputs.skip-prepare == 'false'
8092
uses: actions/checkout@v3
8193
with:
8294
repository: scality/terraform-snapshot
8395
path: terraform-snapshot
8496
token: ${{ inputs.GIT_ACCESS_TOKEN }}
8597
ref: ${{ inputs.TERRAFORM_SNAPSHOT_TAG }}
8698
- name: Install tools
99+
if: inputs.skip-prepare == 'false'
87100
shell: bash
88101
run: sudo yum install -y unzip tar
89102
- name: Install node
103+
if: inputs.skip-prepare == 'false'
90104
uses: actions/setup-node@v3
91105
with:
92106
node-version: "14"
93107
- name: Install Terraform
108+
if: inputs.skip-prepare == 'false'
94109
uses: hashicorp/setup-terraform@v2
95110
with:
96111
terraform_version: ${{ inputs.TERRAFORM_VERSION }}
97112
terraform_wrapper: false
98113
- name: Initialize Terraform
114+
if: inputs.skip-prepare == 'false'
99115
working-directory: terraform-snapshot/terraform/
100116
shell: bash
101117
run: terraform init
@@ -122,7 +138,7 @@ runs:
122138
"-var-file $TFVARS_DIR/${{ inputs.CLOUD }}.tfvars"
123139
)
124140
for try in $(seq 1 ${MAX_RETRIES}); do
125-
if terraform apply ${TF_OPTS[@]}; then
141+
if terraform apply ${TF_OPTS[@]} ${{ inputs.args }}; then
126142
break
127143
elif [ $try -lt $MAX_RETRIES ]; then
128144
sleep 150

.github/workflows/e2e-tests.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,4 @@ jobs:
7676
nodes-count: ${{ inputs.nodes-count }}
7777
install-solution: ${{ inputs.install-solution }}
7878
generate-snapshots: ${{ inputs.generate-snapshots }}
79+
enable-debug-when-failure: true

0 commit comments

Comments
 (0)