Skip to content

Commit

Permalink
Test kubeadm controlplane and bootstrap provider
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Adamek <julien.adamek@suse.com>
  • Loading branch information
juadk committed Jun 25, 2024
1 parent dd69ce0 commit f28831d
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This workflow calls the master E2E workflow with custom variables
name: CLI-CAPI-K3s
name: CLI-CAPI-Kubeadm

on:
workflow_dispatch:
Expand All @@ -19,9 +19,10 @@ on:
qase_run_id:
description: Qase run ID where the results will be reported
type: string
schedule:
#schedule:
# From Monday to Saturday at 3am UTC (10pm in us-central1)
- cron: '0 3 * * 1-6'
#- cron: '0 3 * * 1-6'
pull_request:

jobs:
cli:
Expand All @@ -38,7 +39,10 @@ jobs:
qase_api_token: ${{ secrets.QASE_API_TOKEN }}
with:
boot_type: iso
destroy_runner: ${{ github.event_name == 'schedule' && true || inputs.destroy_runner }}
bootstrap_provider: kubeadm
control_plane_provider: kubeadm
#destroy_runner: ${{ github.event_name == 'schedule' && true || inputs.destroy_runner }}
destroy_runner: false
k8s_downstream_version: ${{ matrix.k8s_downstream_version }}
k8s_upstream_version: ${{ matrix.k8s_upstream_version }}
qase_run_id: ${{ inputs.qase_run_id }}
Expand Down
27 changes: 15 additions & 12 deletions .github/workflows/cli-capi-rke2-matrix.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This workflow calls the master E2E workflow with custom variables
name: CLI-RKE2
name: CLI-CAPI-RKE2

on:
workflow_dispatch:
Expand All @@ -9,37 +9,40 @@ on:
default: true
type: boolean
k8s_downstream_version:
description: Rancher cluster downstream version to use
default: '"v1.27.13+k3s1"'
description: Cluster downstream version to use
default: '"1.30.1"'
type: string
k8s_upstream_version:
description: Rancher cluster upstream version to use
default: '"v1.27.13+rke2r1"'
description: Cluster upstream version to use
default: '"v1.30.1+k3s1"'
type: string
qase_run_id:
description: Qase run ID where the results will be reported
type: string
#schedule:
schedule:
# From Monday to Saturday at 3am UTC (10pm in us-central1)
#- cron: '0 3 * * 1-6'
- cron: '0 3 * * 1-6'

jobs:
cli:
strategy:
fail-fast: false
max-parallel: 4
matrix:
k8s_downstream_version: ${{ fromJSON(format('[{0}]', inputs.k8s_downstream_version || '"v1.27.13+rke2r1"')) }}
k8s_upstream_version: ${{ fromJSON(format('[{0}]', inputs.k8s_upstream_version || '"v1.27.13+rke2r1"')) }}
uses: ./.github/workflows/master_e2e.yaml
k8s_downstream_version: ${{ fromJSON(format('[{0}]', inputs.k8s_downstream_version || '"1.30.1"')) }}
k8s_upstream_version: ${{ fromJSON(format('[{0}]', inputs.k8s_upstream_version || '"v1.27.13+k3s1"')) }}
uses: ./.github/workflows/master_capi_e2e.yaml
secrets:
credentials: ${{ secrets.GCP_CREDENTIALS }}
pat_token: ${{ secrets.SELF_HOSTED_RUNNER_PAT_TOKEN }}
qase_api_token: ${{ secrets.QASE_API_TOKEN }}
with:
boot_type: iso
bootstrap_provider: rke2
control_plane_provider: rke2
destroy_runner: ${{ github.event_name == 'schedule' && true || inputs.destroy_runner }}
k8s_downstream_version: ${{ matrix.k8s_downstream_version }}
k8s_upstream_version: ${{ matrix.k8s_upstream_version }}
qase_run_id: ${{ inputs.qase_run_id }}
test_type: cli
zone: us-central1-f
test_type: capi_cli
zone: us-central1-c
10 changes: 10 additions & 0 deletions .github/workflows/master_capi_e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
description: Choose booting type (pxe, iso, raw)
default: pxe
type: string
bootstrap_provider:
description: Bootstrap provider to use
default: rke2
type: string
cluster_name:
description: Name of the provisioned cluster
default: elemental-cluster
Expand All @@ -20,6 +24,10 @@ on:
cluster_number:
description: Number of clusters to deploy in multi-cluster test
type: string
control_plane_provider:
description: Control plane provider to use
default: rke2
type: string
destroy_runner:
description: Destroy the auto-generated self-hosted runner
default: true
Expand Down Expand Up @@ -138,9 +146,11 @@ jobs:
qase_api_token: ${{ secrets.qase_api_token }}
with:
boot_type: ${{ inputs.boot_type }}
bootstrap_provider: ${{ inputs.bootstrap_provider }}
cluster_name: ${{ inputs.cluster_name }}
cluster_namespace: ${{ inputs.cluster_namespace }}
cluster_number: ${{ inputs.cluster_number }}
control_plane_provider: ${{ inputs.control_plane_provider }}
destroy_runner: ${{ inputs.destroy_runner }}
k8s_downstream_version: ${{ inputs.k8s_downstream_version }}
node_number: ${{ inputs.node_number }}
Expand Down
19 changes: 18 additions & 1 deletion .github/workflows/sub_capi_cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,18 @@ on:
boot_type:
required: true
type: string
bootstrap_provider:
required: true
type: string
cluster_name:
required: true
type: string
cluster_namespace:
required: true
type: string
control_plane_provider:
required: true
type: string
destroy_runner:
required: true
type: boolean
Expand Down Expand Up @@ -134,8 +140,10 @@ jobs:
id: install_capi
run: cd tests && make e2e-install-capi
env:
BOOTSTRAP_PROVIDER: ${{ inputs.bootstrap_provider }}
CLUSTER_NAME: ${{ inputs.cluster_name }}
CONTROL_PLANE_ENDPOINT_HOST: "\"192.168.122.50\""
CONTROL_PLANE_PROVIDER: ${{ inputs.control_plane_provider }}
ELEMENTAL_ENABLE_DEBUG: "\"true\""
ELEMENTAL_API_ENDPOINT: "\"management-host\""
ELEMENTAL_API_ENABLE_TLS: "\"true\""
Expand All @@ -144,7 +152,16 @@ jobs:

- name: Build the ISO image
id: build_iso
run: cd cluster-api-provider-elemental && AGENT_CONFIG_FILE=iso/config/my-config.yaml make build-iso
run: |
cd cluster-api-provider-elemental
if ${{ contains(inputs.bootstrap_provider, 'kubeadm') }}; then
sed -i 's/tumbleweed:latest/leap:15.5/g' Dockerfile.kubeadm.os
sed -i 's/glibc-gconv-modules-extra//g' Dockerfile.kubeadm.os
sed -i 's@shim \\@shim@g' Dockerfile.kubeadm.os
AGENT_CONFIG_FILE=iso/config/my-config.yaml make build-iso-kubeadm
else
AGENT_CONFIG_FILE=iso/config/my-config.yaml make build-iso
fi
- name: Extract iPXE artifacts from ISO
id: extract_ipxe_artifacts
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/sub_test_choice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
boot_type:
required: true
type: string
bootstrap_provider:
required: true
type: string
cluster_name:
required: true
type: string
Expand All @@ -17,6 +20,9 @@ on:
cluster_namespace:
required: true
type: string
control_plane_provider:
required: true
type: string
destroy_runner:
required: true
type: boolean
Expand Down Expand Up @@ -71,8 +77,10 @@ jobs:
qase_api_token: ${{ secrets.qase_api_token }}
with:
boot_type: ${{ inputs.boot_type }}
bootstrap_provider: ${{ inputs.bootstrap_provider }}
cluster_name: ${{ inputs.cluster_name }}
cluster_namespace: ${{ inputs.cluster_namespace }}
control_plane_provider: ${{ inputs.control_plane_provider }}
destroy_runner: ${{ inputs.destroy_runner }}
k8s_downstream_version: ${{ inputs.k8s_downstream_version }}
node_number: ${{ inputs.node_number }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ e2e test for the CAPI Elemental provider

## Daily CI

[![CLI-CAPI-K3s](https://github.com/rancher-sandbox/elemental-e2e/actions/workflows/cli-capi-k3s-matrix.yaml/badge.svg?branch=main)](https://github.com/rancher-sandbox/elemental-e2e/actions/workflows/cli-capi-k3s-matrix.yaml)
[![CLI-CAPI-RKE2](https://github.com/rancher-sandbox/elemental-e2e/actions/workflows/cli-capi-rke2-matrix.yaml/badge.svg?branch=main)](https://github.com/rancher-sandbox/elemental-e2e/actions/workflows/cli-capi-rke2-matrix.yaml)
1 change: 1 addition & 0 deletions tests/e2e/bootstrap_capi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ 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.
*/

package e2e_test
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/install_capi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ var _ = Describe("E2E - Install CAPI", Label("install-capi"), func() {
out, err := exec.Command("/usr/local/bin/clusterctl",
"--v", "4",
"init",
"--bootstrap", "rke2",
"--control-plane", "rke2",
"--bootstrap", bootstrapProvider,
"--control-plane", controlPlaneProvider,
"--infrastructure", "elemental:v0.0.0").CombinedOutput()
// Show command output, easier to debug
GinkgoWriter.Printf("%s\n", string(out))
Expand Down Expand Up @@ -123,7 +123,7 @@ var _ = Describe("E2E - Install CAPI", Label("install-capi"), func() {
"--control-plane-machine-count=1",
"--worker-machine-count=2",
"--infrastructure", "elemental:v0.0.0",
"--flavor", "rke2",
"--flavor", bootstrapProvider,
"--target-namespace", clusterNS,
clusterName,
"--kubernetes-version="+k8sDownstreamVersion,
Expand Down
4 changes: 4 additions & 0 deletions tests/e2e/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ const (
)

var (
bootstrapProvider string
clusterName string
clusterNS string
clusterType string
clusterYaml string
controlPlaneProvider string
elementalAPIEndpoint string
elementalSupport string
emulateTPM bool
Expand Down Expand Up @@ -323,9 +325,11 @@ type YamlPattern struct {

var _ = BeforeSuite(func() {
bootTypeString := os.Getenv("BOOT_TYPE")
bootstrapProvider = os.Getenv("BOOTSTRAP_PROVIDER")
clusterName = os.Getenv("CLUSTER_NAME")
clusterNS = os.Getenv("CLUSTER_NS")
clusterType = os.Getenv("CLUSTER_TYPE")
controlPlaneProvider = os.Getenv("CONTROLPLANE_PROVIDER")
elementalAPIEndpoint = os.Getenv("ELEMENTAL_API_ENDPOINT")
elementalSupport = os.Getenv("ELEMENTAL_SUPPORT")
eTPM := os.Getenv("EMULATE_TPM")
Expand Down

0 comments on commit f28831d

Please sign in to comment.