diff --git a/Dockerfile.smoketest b/Dockerfile.smoketest new file mode 100644 index 00000000000..5c890afbb73 --- /dev/null +++ b/Dockerfile.smoketest @@ -0,0 +1,44 @@ +ARG REGISTRY +ARG VERSION + +############################################################################### +# final is our slim image with minimal layers and tools +############################################################################### +# FROM ${REGISTRY}/ubi9/python-312:1-10 +FROM ${REGISTRY}/ubi9/python-311:1-62 AS final +ARG PIPX_VERSION=1.5.0 \ + ANSIBLE_VERSION=9.5.1 \ + AZURE_CLI_VERSION=2.60.0 \ + ANSIBLE_AZCOLLECTION_VERSION=2.3.0 + +# Cause Ansible to print task timing information +ENV ANSIBLE_CALLBACKS_ENABLED=profile_tasks +USER root +WORKDIR /smoketest + +COPY smoketest /smoketest + +# Using pipx here because ansible and azure-cli have differing required core Azure modules +# They each need a separate venv to avoid collisions +RUN ${APP_ROOT}/bin/pip install "pipx==${PIPX_VERSION}" && \ + ${APP_ROOT}/bin/pipx install "azure-cli==${AZURE_CLI_VERSION}" && \ + ${APP_ROOT}/bin/pipx install "ansible==${ANSIBLE_VERSION}" --include-deps && \ + ${APP_ROOT}/bin/pipx runpip ansible install -r "/smoketest/ansible-requirements.txt" && \ + ${HOME}/.local/bin/ansible-galaxy collection install "azure.azcollection==${ANSIBLE_AZCOLLECTION_VERSION}" && \ + ${APP_ROOT}/bin/pipx runpip ansible install -r "${HOME}/.ansible/collections/ansible_collections/azure/azcollection/requirements-azure.txt" && \ + ${APP_ROOT}/bin/pipx list + +############################################################################### +# linter takes the final image and injects ansible-lint. Ansible-lint needs +# ansible itself and all ansible modules and python modules installed to correctly lint +############################################################################### +FROM final AS linter +RUN ${APP_ROOT}/bin/pipx inject ansible --include-apps ansible-lint && \ + ${HOME}/.local/bin/ansible-lint -v -c /smoketest/.ansible_lint.yaml --project-dir /smoketest --format sarif | tee /smoketest/sarif.txt + +############################################################################### +# Re-FROM final so that it's the output container +############################################################################### +FROM final +COPY --from=linter /smoketest/sarif.txt /sarif.txt +ENTRYPOINT ["/opt/app-root/src/.local/bin/ansible-playbook"] diff --git a/Makefile b/Makefile index a0953075d9e..16411b585fb 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ ARO_IMAGE_BASE = ${RP_IMAGE_ACR}.azurecr.io/aro E2E_FLAGS ?= -test.v --ginkgo.v --ginkgo.timeout 180m --ginkgo.flake-attempts=2 --ginkgo.junit-report=e2e-report.xml GO_FLAGS ?= -tags=containers_image_openpgp,exclude_graphdriver_btrfs,exclude_graphdriver_devicemapper NO_CACHE ?= true +PODMAN_VOLUME_OVERLAY=$(shell if [[ $$(getenforce) == "Enforcing" ]]; then echo ":O"; else echo ""; fi 2>/dev/null) export GOFLAGS=$(GO_FLAGS) @@ -282,4 +283,27 @@ vendor: install-go-tools: go install ${GOTESTSUM} -.PHONY: admin.kubeconfig aks.kubeconfig aro az ci-portal ci-rp clean client deploy dev-config.yaml discoverycache fix-macos-vendor generate image-aro-multistage image-fluentbit image-proxy init-contrib lint-go runlocal-rp proxy publish-image-aro-multistage publish-image-fluentbit publish-image-proxy secrets secrets-update e2e.test tunnel test-e2e test-go test-python vendor build-all validate-go unit-test-go coverage-go validate-fips install-go-tools +smoketest-image: +# IMAGE_EXISTS = $(shell podman image exists aro-smoketest:$(VERSION)) + docker image exists aro-smoketest:$(VERSION) || docker build . -f Dockerfile.smoketest --build-arg REGISTRY=$(REGISTRY) --build-arg VERSION=$(VERSION) --no-cache=$(NO_CACHE) --tag aro-smoketest:$(VERSION) + +REGION := eastus +CLUSTERPREFIX := smoketest +CLUSTERPATTERN := smoketest-basic* +CLEANUP := True +# Delete the cluster after success unless it's disabled with `make smoketest CLEANUP=False` +ifeq ($(CLEANUP),False) + CLEANUP_ARG = -e CLEANUP=False +else + CLEANUP_ARG = +endif +smoketest: smoketest-image + docker run --rm -t -v $${AZURE_CONFIG_DIR:-~/.azure}:/opt/app-root/src/.azure$(PODMAN_VOLUME_OVERLAY) aro-smoketest:$(VERSION) -i regions/$(REGION) -l $(CLUSTERPATTERN) -e CLUSTERPREFIX=$(CLUSTERPREFIX) $(CLEANUP_ARG) smoketest.yaml + +smoketest-dev: smoketest-image + docker run --rm -it -v $${AZURE_CONFIG_DIR:-~/.azure}:/opt/app-root/src/.azure$(PODMAN_VOLUME_OVERLAY) -v ./smoketest:/smoketest$(PODMAN_VOLUME_OVERLAY) aro-smoketest:$(VERSION) -i regions/$(REGION) -l $(CLUSTERPATTERN) -e CLUSTERPREFIX=$(CLUSTERPREFIX) $(CLEANUP_ARG) smoketest.yaml + +lint-ansible: + cd smoketest; ansible-lint -c .ansible_lint.yaml + +.PHONY: admin.kubeconfig aks.kubeconfig build-all build-portal check-release ci-portal clean deploy dev-config.yaml discoverycache e2e.test e2etools extract-aro-docker fix-macos-vendor generate generate-guardrails generate-kiota generate-operator-apiclient image-aro-multistage image-autorest image-e2e image-fluentbit image-gatekeeper image-proxy init-contrib install-go-tools lint-admin-portal lint-ansible lint-go proxy pyenv runlocal-rp run-portal secrets secrets-update shared-cluster-create shared-cluster-delete shared-cluster-login smoketest-image tunnel unit-test-go unit-test-go-coverpkg unit-test-python validate-fips validate-go validate-go-action vendor diff --git a/smoketest/.ansible_lint.yaml b/smoketest/.ansible_lint.yaml new file mode 100644 index 00000000000..14f287c194c --- /dev/null +++ b/smoketest/.ansible_lint.yaml @@ -0,0 +1,10 @@ +profile: production +exclude_paths: [] +use_default_rules: true +skip_list: + - no-changed-when +enable_list: + - args + - empty-string-compare + - no-same-owner + - name[prefix] diff --git a/smoketest/ansible-requirements.txt b/smoketest/ansible-requirements.txt new file mode 100644 index 00000000000..eca5e2e4ead --- /dev/null +++ b/smoketest/ansible-requirements.txt @@ -0,0 +1 @@ +kubernetes==29.0.0 diff --git a/smoketest/regions/australiacentral/group_vars/all.yaml b/smoketest/regions/australiacentral/group_vars/all.yaml new file mode 100644 index 00000000000..d66978f3310 --- /dev/null +++ b/smoketest/regions/australiacentral/group_vars/all.yaml @@ -0,0 +1 @@ +location: australiacentral diff --git a/smoketest/regions/australiacentral/hosts.yaml b/smoketest/regions/australiacentral/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/australiacentral/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/australiacentral2/group_vars/all.yaml b/smoketest/regions/australiacentral2/group_vars/all.yaml new file mode 100644 index 00000000000..04d2ac42934 --- /dev/null +++ b/smoketest/regions/australiacentral2/group_vars/all.yaml @@ -0,0 +1 @@ +location: australiacentral2 diff --git a/smoketest/regions/australiacentral2/hosts.yaml b/smoketest/regions/australiacentral2/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/australiacentral2/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/australiaeast/group_vars/all.yaml b/smoketest/regions/australiaeast/group_vars/all.yaml new file mode 100644 index 00000000000..ac89177159b --- /dev/null +++ b/smoketest/regions/australiaeast/group_vars/all.yaml @@ -0,0 +1 @@ +location: australiaeast diff --git a/smoketest/regions/australiaeast/hosts.yaml b/smoketest/regions/australiaeast/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/australiaeast/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/australiasoutheast/group_vars/all.yaml b/smoketest/regions/australiasoutheast/group_vars/all.yaml new file mode 100644 index 00000000000..55652853861 --- /dev/null +++ b/smoketest/regions/australiasoutheast/group_vars/all.yaml @@ -0,0 +1 @@ +location: australiasoutheast diff --git a/smoketest/regions/australiasoutheast/hosts.yaml b/smoketest/regions/australiasoutheast/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/australiasoutheast/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/brazilsouth/group_vars/all.yaml b/smoketest/regions/brazilsouth/group_vars/all.yaml new file mode 100644 index 00000000000..d0b2e7771c4 --- /dev/null +++ b/smoketest/regions/brazilsouth/group_vars/all.yaml @@ -0,0 +1 @@ +location: brazilsouth diff --git a/smoketest/regions/brazilsouth/hosts.yaml b/smoketest/regions/brazilsouth/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/brazilsouth/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/brazilsoutheast/group_vars/all.yaml b/smoketest/regions/brazilsoutheast/group_vars/all.yaml new file mode 100644 index 00000000000..3c5e88a65e0 --- /dev/null +++ b/smoketest/regions/brazilsoutheast/group_vars/all.yaml @@ -0,0 +1 @@ +location: brazilsoutheast diff --git a/smoketest/regions/brazilsoutheast/hosts.yaml b/smoketest/regions/brazilsoutheast/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/brazilsoutheast/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/canadacentral/group_vars/all.yaml b/smoketest/regions/canadacentral/group_vars/all.yaml new file mode 100644 index 00000000000..68b66dd6df3 --- /dev/null +++ b/smoketest/regions/canadacentral/group_vars/all.yaml @@ -0,0 +1 @@ +location: canadacentral diff --git a/smoketest/regions/canadacentral/hosts.yaml b/smoketest/regions/canadacentral/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/canadacentral/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/canadaeast/group_vars/all.yaml b/smoketest/regions/canadaeast/group_vars/all.yaml new file mode 100644 index 00000000000..d471282427f --- /dev/null +++ b/smoketest/regions/canadaeast/group_vars/all.yaml @@ -0,0 +1 @@ +location: canadaeast diff --git a/smoketest/regions/canadaeast/hosts.yaml b/smoketest/regions/canadaeast/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/canadaeast/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/centralindia/group_vars/all.yaml b/smoketest/regions/centralindia/group_vars/all.yaml new file mode 100644 index 00000000000..f63ca3b942f --- /dev/null +++ b/smoketest/regions/centralindia/group_vars/all.yaml @@ -0,0 +1 @@ +location: centralindia diff --git a/smoketest/regions/centralindia/hosts.yaml b/smoketest/regions/centralindia/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/centralindia/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/centralus/group_vars/all.yaml b/smoketest/regions/centralus/group_vars/all.yaml new file mode 100644 index 00000000000..6560a5761f7 --- /dev/null +++ b/smoketest/regions/centralus/group_vars/all.yaml @@ -0,0 +1 @@ +location: centralus diff --git a/smoketest/regions/centralus/hosts.yaml b/smoketest/regions/centralus/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/centralus/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/eastasia/group_vars/all.yaml b/smoketest/regions/eastasia/group_vars/all.yaml new file mode 100644 index 00000000000..acdf997dfdc --- /dev/null +++ b/smoketest/regions/eastasia/group_vars/all.yaml @@ -0,0 +1 @@ +location: eastasia diff --git a/smoketest/regions/eastasia/hosts.yaml b/smoketest/regions/eastasia/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/eastasia/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/eastus/group_vars/all.yaml b/smoketest/regions/eastus/group_vars/all.yaml new file mode 100644 index 00000000000..320723c86c1 --- /dev/null +++ b/smoketest/regions/eastus/group_vars/all.yaml @@ -0,0 +1 @@ +location: eastus diff --git a/smoketest/regions/eastus/hosts.yaml b/smoketest/regions/eastus/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/eastus/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/eastus2/group_vars/all.yaml b/smoketest/regions/eastus2/group_vars/all.yaml new file mode 100644 index 00000000000..92294dd82c5 --- /dev/null +++ b/smoketest/regions/eastus2/group_vars/all.yaml @@ -0,0 +1 @@ +location: eastus2 diff --git a/smoketest/regions/eastus2/hosts.yaml b/smoketest/regions/eastus2/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/eastus2/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/francecentral/group_vars/all.yaml b/smoketest/regions/francecentral/group_vars/all.yaml new file mode 100644 index 00000000000..9c212f867c3 --- /dev/null +++ b/smoketest/regions/francecentral/group_vars/all.yaml @@ -0,0 +1 @@ +location: francecentral diff --git a/smoketest/regions/francecentral/hosts.yaml b/smoketest/regions/francecentral/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/francecentral/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/germanywestcentral/group_vars/all.yaml b/smoketest/regions/germanywestcentral/group_vars/all.yaml new file mode 100644 index 00000000000..46ebdaf449e --- /dev/null +++ b/smoketest/regions/germanywestcentral/group_vars/all.yaml @@ -0,0 +1 @@ +location: germanywestcentral diff --git a/smoketest/regions/germanywestcentral/hosts.yaml b/smoketest/regions/germanywestcentral/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/germanywestcentral/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/hosts.yaml b/smoketest/regions/hosts.yaml new file mode 100644 index 00000000000..b13e670d0ad --- /dev/null +++ b/smoketest/regions/hosts.yaml @@ -0,0 +1,72 @@ +--- +simple_clusters: + hosts: + smoketest-basic: + # Basic cluster + name: aro-default + resource_group: "{{ CLUSTERPREFIX }}-basic-{{ location }}" + network_prefix_cidr: 10.0.0.0/22 + master_cidr: 10.0.0.0/23 + worker_cidr: 10.0.2.0/23 + smoketest-private: + # Private cluster + name: aro-default + resource_group: "{{ CLUSTERPREFIX }}-private-{{ location }}" + network_prefix_cidr: 10.0.0.0/22 + master_cidr: 10.0.0.0/23 + worker_cidr: 10.0.2.0/23 + apiserver_visibility: Private + ingress_visibility: Private + smoketest-enc: + # Basic cluster with encryption-at-host enabled + name: aro-414 + resource_group: "{{ CLUSTERPREFIX }}-enc-{{ location }}-414" + version: 4.14.16 + network_prefix_cidr: 10.0.0.0/22 + master_cidr: 10.0.0.0/23 + master_size: Standard_E8s_v5 + master_encryption_at_host: true + worker_cidr: 10.0.2.0/23 + worker_size: Standard_D4s_v5 + worker_encryption_at_host: true + smoketest-udr414: + name: aro-414 + resource_group: "{{ CLUSTERPREFIX }}-udr-{{ location }}-414" + version: "{{ CLUSTERVERSION | default('4.14.16') }}" + network_prefix_cidr: 10.0.0.0/22 + master_cidr: 10.0.0.0/23 + worker_cidr: 10.0.2.0/23 + apiserver_visibility: Private + ingress_visibility: Private + outbound_type: UserDefinedRouting + routes: + - name: Blackhole + address_prefix: 0.0.0.0/0 + next_hop_type: none + smoketest-udr413: + name: aro-413 + resource_group: "{{ CLUSTERPREFIX }}-udr-{{ location }}-413" + version: "4.13.23" + network_prefix_cidr: 10.0.0.0/22 + master_cidr: 10.0.0.0/23 + worker_cidr: 10.0.2.0/23 + apiserver_visibility: Private + ingress_visibility: Private + outbound_type: UserDefinedRouting + routes: + - name: Blackhole + address_prefix: 0.0.0.0/0 + next_hop_type: none +byok_clusters: + hosts: + smoketest-byok: + # Cluster with customer-managed disk encryption key + # https://learn.microsoft.com/en-us/azure/openshift/howto-byok + name: aro-414 + resource_group: "{{ CLUSTERPREFIX }}-byok-{{ location }}-414" + version: 4.14.16 + network_prefix_cidr: 10.0.0.0/22 + master_cidr: 10.0.0.0/23 + master_size: Standard_E8s_v5 + worker_cidr: 10.0.2.0/23 + worker_size: Standard_D4s_v5 diff --git a/smoketest/regions/italynorth/group_vars/all.yaml b/smoketest/regions/italynorth/group_vars/all.yaml new file mode 100644 index 00000000000..7571c3d8e29 --- /dev/null +++ b/smoketest/regions/italynorth/group_vars/all.yaml @@ -0,0 +1 @@ +location: italynorth diff --git a/smoketest/regions/italynorth/hosts.yaml b/smoketest/regions/italynorth/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/italynorth/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/japaneast/group_vars/all.yaml b/smoketest/regions/japaneast/group_vars/all.yaml new file mode 100644 index 00000000000..0584845ed29 --- /dev/null +++ b/smoketest/regions/japaneast/group_vars/all.yaml @@ -0,0 +1 @@ +location: japaneast diff --git a/smoketest/regions/japaneast/hosts.yaml b/smoketest/regions/japaneast/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/japaneast/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/japanwest/group_vars/all.yaml b/smoketest/regions/japanwest/group_vars/all.yaml new file mode 100644 index 00000000000..fcdc3220e97 --- /dev/null +++ b/smoketest/regions/japanwest/group_vars/all.yaml @@ -0,0 +1 @@ +location: japanwest diff --git a/smoketest/regions/japanwest/hosts.yaml b/smoketest/regions/japanwest/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/japanwest/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/koreacentral/group_vars/all.yaml b/smoketest/regions/koreacentral/group_vars/all.yaml new file mode 100644 index 00000000000..df268019d43 --- /dev/null +++ b/smoketest/regions/koreacentral/group_vars/all.yaml @@ -0,0 +1 @@ +location: koreacentral diff --git a/smoketest/regions/koreacentral/hosts.yaml b/smoketest/regions/koreacentral/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/koreacentral/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/northcentralus/group_vars/all.yaml b/smoketest/regions/northcentralus/group_vars/all.yaml new file mode 100644 index 00000000000..0c849f246ba --- /dev/null +++ b/smoketest/regions/northcentralus/group_vars/all.yaml @@ -0,0 +1 @@ +location: northcentralus diff --git a/smoketest/regions/northcentralus/hosts.yaml b/smoketest/regions/northcentralus/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/northcentralus/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/northeurope/group_vars/all.yaml b/smoketest/regions/northeurope/group_vars/all.yaml new file mode 100644 index 00000000000..b1cfe46173b --- /dev/null +++ b/smoketest/regions/northeurope/group_vars/all.yaml @@ -0,0 +1 @@ +location: northeurope diff --git a/smoketest/regions/northeurope/hosts.yaml b/smoketest/regions/northeurope/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/northeurope/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/norwayeast/group_vars/all.yaml b/smoketest/regions/norwayeast/group_vars/all.yaml new file mode 100644 index 00000000000..a4df94997ce --- /dev/null +++ b/smoketest/regions/norwayeast/group_vars/all.yaml @@ -0,0 +1 @@ +location: norwayeast diff --git a/smoketest/regions/norwayeast/hosts.yaml b/smoketest/regions/norwayeast/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/norwayeast/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/norwaywest/group_vars/all.yaml b/smoketest/regions/norwaywest/group_vars/all.yaml new file mode 100644 index 00000000000..9678918d7e7 --- /dev/null +++ b/smoketest/regions/norwaywest/group_vars/all.yaml @@ -0,0 +1 @@ +location: norwaywest diff --git a/smoketest/regions/norwaywest/hosts.yaml b/smoketest/regions/norwaywest/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/norwaywest/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/qatarcentral/group_vars/all.yaml b/smoketest/regions/qatarcentral/group_vars/all.yaml new file mode 100644 index 00000000000..d05ecda3a49 --- /dev/null +++ b/smoketest/regions/qatarcentral/group_vars/all.yaml @@ -0,0 +1 @@ +location: qatarcentral diff --git a/smoketest/regions/qatarcentral/hosts.yaml b/smoketest/regions/qatarcentral/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/qatarcentral/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/southafricanorth/group_vars/all.yaml b/smoketest/regions/southafricanorth/group_vars/all.yaml new file mode 100644 index 00000000000..c1acdf0843f --- /dev/null +++ b/smoketest/regions/southafricanorth/group_vars/all.yaml @@ -0,0 +1 @@ +location: southafricanorth diff --git a/smoketest/regions/southafricanorth/hosts.yaml b/smoketest/regions/southafricanorth/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/southafricanorth/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/southcentralus/group_vars/all.yaml b/smoketest/regions/southcentralus/group_vars/all.yaml new file mode 100644 index 00000000000..3b695e1c013 --- /dev/null +++ b/smoketest/regions/southcentralus/group_vars/all.yaml @@ -0,0 +1 @@ +location: southcentralus diff --git a/smoketest/regions/southcentralus/hosts.yaml b/smoketest/regions/southcentralus/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/southcentralus/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/southeastasia/group_vars/all.yaml b/smoketest/regions/southeastasia/group_vars/all.yaml new file mode 100644 index 00000000000..91d95316be0 --- /dev/null +++ b/smoketest/regions/southeastasia/group_vars/all.yaml @@ -0,0 +1 @@ +location: southeastasia diff --git a/smoketest/regions/southeastasia/hosts.yaml b/smoketest/regions/southeastasia/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/southeastasia/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/southindia/group_vars/all.yaml b/smoketest/regions/southindia/group_vars/all.yaml new file mode 100644 index 00000000000..c91497bb9bc --- /dev/null +++ b/smoketest/regions/southindia/group_vars/all.yaml @@ -0,0 +1 @@ +location: southindia diff --git a/smoketest/regions/southindia/hosts.yaml b/smoketest/regions/southindia/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/southindia/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/swedencentral/group_vars/all.yaml b/smoketest/regions/swedencentral/group_vars/all.yaml new file mode 100644 index 00000000000..544f163a083 --- /dev/null +++ b/smoketest/regions/swedencentral/group_vars/all.yaml @@ -0,0 +1 @@ +location: swedencentral diff --git a/smoketest/regions/swedencentral/hosts.yaml b/smoketest/regions/swedencentral/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/swedencentral/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/switzerlandnorth/group_vars/all.yaml b/smoketest/regions/switzerlandnorth/group_vars/all.yaml new file mode 100644 index 00000000000..e3b75b89a6e --- /dev/null +++ b/smoketest/regions/switzerlandnorth/group_vars/all.yaml @@ -0,0 +1 @@ +location: switzerlandnorth diff --git a/smoketest/regions/switzerlandnorth/hosts.yaml b/smoketest/regions/switzerlandnorth/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/switzerlandnorth/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/switzerlandwest/group_vars/all.yaml b/smoketest/regions/switzerlandwest/group_vars/all.yaml new file mode 100644 index 00000000000..e40eb3355fb --- /dev/null +++ b/smoketest/regions/switzerlandwest/group_vars/all.yaml @@ -0,0 +1 @@ +location: switzerlandwest diff --git a/smoketest/regions/switzerlandwest/hosts.yaml b/smoketest/regions/switzerlandwest/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/switzerlandwest/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/uaenorth/group_vars/all.yaml b/smoketest/regions/uaenorth/group_vars/all.yaml new file mode 100644 index 00000000000..9e3c8c3dfeb --- /dev/null +++ b/smoketest/regions/uaenorth/group_vars/all.yaml @@ -0,0 +1 @@ +location: uaenorth diff --git a/smoketest/regions/uaenorth/hosts.yaml b/smoketest/regions/uaenorth/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/uaenorth/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/uksouth/group_vars/all.yaml b/smoketest/regions/uksouth/group_vars/all.yaml new file mode 100644 index 00000000000..d84a71b2876 --- /dev/null +++ b/smoketest/regions/uksouth/group_vars/all.yaml @@ -0,0 +1 @@ +location: uksouth diff --git a/smoketest/regions/uksouth/hosts.yaml b/smoketest/regions/uksouth/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/uksouth/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/ukwest/group_vars/all.yaml b/smoketest/regions/ukwest/group_vars/all.yaml new file mode 100644 index 00000000000..f27135748d0 --- /dev/null +++ b/smoketest/regions/ukwest/group_vars/all.yaml @@ -0,0 +1 @@ +location: ukwest diff --git a/smoketest/regions/ukwest/hosts.yaml b/smoketest/regions/ukwest/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/ukwest/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/westcentralus/group_vars/all.yaml b/smoketest/regions/westcentralus/group_vars/all.yaml new file mode 100644 index 00000000000..17d85ad61d6 --- /dev/null +++ b/smoketest/regions/westcentralus/group_vars/all.yaml @@ -0,0 +1 @@ +location: westcentralus diff --git a/smoketest/regions/westcentralus/hosts.yaml b/smoketest/regions/westcentralus/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/westcentralus/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/westeurope/group_vars/all.yaml b/smoketest/regions/westeurope/group_vars/all.yaml new file mode 100644 index 00000000000..902dff0bbf7 --- /dev/null +++ b/smoketest/regions/westeurope/group_vars/all.yaml @@ -0,0 +1 @@ +location: westeurope diff --git a/smoketest/regions/westeurope/hosts.yaml b/smoketest/regions/westeurope/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/westeurope/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/westus/group_vars/all.yaml b/smoketest/regions/westus/group_vars/all.yaml new file mode 100644 index 00000000000..3ffb72014c0 --- /dev/null +++ b/smoketest/regions/westus/group_vars/all.yaml @@ -0,0 +1 @@ +location: westus diff --git a/smoketest/regions/westus/hosts.yaml b/smoketest/regions/westus/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/westus/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/westus2/group_vars/all.yaml b/smoketest/regions/westus2/group_vars/all.yaml new file mode 100644 index 00000000000..ee8eae51e74 --- /dev/null +++ b/smoketest/regions/westus2/group_vars/all.yaml @@ -0,0 +1 @@ +location: westus2 diff --git a/smoketest/regions/westus2/hosts.yaml b/smoketest/regions/westus2/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/westus2/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/regions/westus3/group_vars/all.yaml b/smoketest/regions/westus3/group_vars/all.yaml new file mode 100644 index 00000000000..3a38494dc38 --- /dev/null +++ b/smoketest/regions/westus3/group_vars/all.yaml @@ -0,0 +1 @@ +location: westus3 diff --git a/smoketest/regions/westus3/hosts.yaml b/smoketest/regions/westus3/hosts.yaml new file mode 120000 index 00000000000..2782edc3442 --- /dev/null +++ b/smoketest/regions/westus3/hosts.yaml @@ -0,0 +1 @@ +../hosts.yaml \ No newline at end of file diff --git a/smoketest/roles/byok_cluster/tasks/main.yaml b/smoketest/roles/byok_cluster/tasks/main.yaml new file mode 100644 index 00000000000..6a148ef6ea8 --- /dev/null +++ b/smoketest/roles/byok_cluster/tasks/main.yaml @@ -0,0 +1,103 @@ +- name: Create resource group + ansible.builtin.include_tasks: + file: ../tasks/create_resourcegroup.yaml +- name: Create vnet and subnets + ansible.builtin.include_tasks: + file: ../tasks/create_vnet.yaml + +- name: Generate keyvault name + ansible.builtin.set_fact: + keyvault_name: "byok-{{ lookup('password', '/dev/null chars=ascii_letters,digits') | to_uuid | replace('-', '') | truncate(24 - 5, end='') }}" +- name: Debug keyvault_name + ansible.builtin.debug: + var: keyvault_name +- name: Byok keyvault + delegate_to: localhost + register: byok_keyvault_status + azure.azcollection.azure_rm_keyvault: + resource_group: "{{ resource_group }}" + vault_name: "{{ keyvault_name }}" + location: "{{ location }}" + enable_purge_protection: true + vault_tenant: "{{ sub_info.tenant_id }}" + sku: + name: standard + family: "A" + access_policies: + - tenant_id: "{{ sub_info.tenant_id }}" + object_id: "{{ currentuser_info.id }}" + keys: ["encrypt", "decrypt", "wrapkey", "unwrapkey", "sign", "verify", "get", "list", "create", "update", "import", "delete", "backup", + "restore", "recover", "purge"] + tags: + createdby: "{{ currentuser_info.userPrincipalName }}" + createdwith: "ansible smoketest" + purge: "true" +- name: Debug byok_keyvault_status + ansible.builtin.debug: + var: byok_keyvault_status +- name: Get byok keyvault + delegate_to: localhost + register: byok_keyvault_info + azure.azcollection.azure_rm_keyvault_info: + resource_group: "{{ resource_group }}" + name: "{{ keyvault_name }}" +- name: Debug byok_keyvault_info + ansible.builtin.debug: + var: byok_keyvault_info + +- name: Byok key + delegate_to: localhost + register: byok_keyvault_key_status + azure.azcollection.azure_rm_keyvaultkey: + key_name: "{{ name }}-key" + keyvault_uri: "{{ byok_keyvault_info.keyvaults[0].vault_uri }}" +- name: Debug byok_keyvault_key_status + ansible.builtin.debug: + var: byok_keyvault_key_status +- name: Get byok key + delegate_to: localhost + register: byok_keyvault_key_info + azure.azcollection.azure_rm_keyvaultkey_info: + vault_uri: "{{ byok_keyvault_info.keyvaults[0].vault_uri }}" + name: "{{ name }}-key" +- name: Debug byok_keyvault_key_info + ansible.builtin.debug: + var: byok_keyvault_key_info + +- name: Byok disk encryption set + delegate_to: localhost + register: byok_des_status + azure.azcollection.azure_rm_diskencryptionset: + resource_group: "{{ resource_group }}" + name: "{{ name }}-des" + location: "{{ location }}" + source_vault: "{{ keyvault_name }}" + key_url: "{{ byok_keyvault_key_info['keys'][0].kid }}" +- name: Debug byok_des_status + ansible.builtin.debug: + var: byok_des_status + +- name: Byok keyvault + delegate_to: localhost + register: byok_keyvault_status + azure.azcollection.azure_rm_keyvault: + resource_group: "{{ resource_group }}" + vault_name: "{{ keyvault_name }}" + location: "{{ location }}" + enable_purge_protection: true + vault_tenant: "{{ sub_info.tenant_id }}" + sku: + name: standard + family: "A" + access_policies: + - tenant_id: "{{ sub_info.tenant_id }}" + object_id: "{{ currentuser_info.id }}" + keys: ["encrypt", "decrypt", "wrapkey", "unwrapkey", "sign", "verify", "get", "list", "create", "update", "import", "delete", "backup", + "restore", "recover", "purge"] + - tenant_id: "{{ byok_des_status.state.identity.tenant_id }}" + object_id: "{{ byok_des_status.state.identity.principal_id }}" + keys: ["wrapkey", "unwrapkey", "get"] + +- name: Create aro cluster + ansible.builtin.include_tasks: + file: ../tasks/create_aro_cluster.yaml diff --git a/smoketest/roles/cleanup/tasks/main.yaml b/smoketest/roles/cleanup/tasks/main.yaml new file mode 100644 index 00000000000..578a2af0641 --- /dev/null +++ b/smoketest/roles/cleanup/tasks/main.yaml @@ -0,0 +1,7 @@ +--- +- name: Delete aro cluster + ansible.builtin.include_tasks: + file: ../tasks/delete_aro_cluster.yaml +- name: Create resource group + ansible.builtin.include_tasks: + file: ../tasks/delete_resourcegroup.yaml diff --git a/smoketest/roles/pucm/tasks/main.yaml b/smoketest/roles/pucm/tasks/main.yaml new file mode 100644 index 00000000000..5c3d3bea8ac --- /dev/null +++ b/smoketest/roles/pucm/tasks/main.yaml @@ -0,0 +1,14 @@ +--- +- name: Az aro update + ansible.builtin.command: + argv: [az, aro, update, "--name={{ name }}", "--resource-group={{ resource_group }}", -o=yaml] + delegate_to: localhost +- name: Wait for provisioningState to become Succeeded + azure.azcollection.azure_rm_openshiftmanagedcluster_info: + name: "{{ name }}" + resource_group: "{{ resource_group }}" + delegate_to: localhost + register: cluster_status + until: cluster_status.clusters.properties.provisioningState == 'Succeeded' + retries: 6 + delay: 10 diff --git a/smoketest/roles/refresh_credentials/tasks/main.yaml b/smoketest/roles/refresh_credentials/tasks/main.yaml new file mode 100644 index 00000000000..d317ea28dcd --- /dev/null +++ b/smoketest/roles/refresh_credentials/tasks/main.yaml @@ -0,0 +1,14 @@ +--- +- name: Az aro update refresh-credentials + ansible.builtin.command: + argv: [az, aro, update, "--name={{ name }}", "--resource-group={{ resource_group }}", --refresh-credentials, -o=yaml] + delegate_to: localhost +- name: Wait for provisioningState to become Succeeded + azure.azcollection.azure_rm_openshiftmanagedcluster_info: + name: "{{ name }}" + resource_group: "{{ resource_group }}" + delegate_to: localhost + register: cluster_status + until: cluster_status.clusters.properties.provisioningState == 'Succeeded' + retries: 6 + delay: 10 diff --git a/smoketest/roles/simple_cluster/tasks/main.yaml b/smoketest/roles/simple_cluster/tasks/main.yaml new file mode 100644 index 00000000000..d0c91c80994 --- /dev/null +++ b/smoketest/roles/simple_cluster/tasks/main.yaml @@ -0,0 +1,9 @@ +- name: Create resource group + ansible.builtin.include_tasks: + file: ../tasks/create_resourcegroup.yaml +- name: Create vnet and subnets + ansible.builtin.include_tasks: + file: ../tasks/create_vnet.yaml +- name: Create aro cluster + ansible.builtin.include_tasks: + file: ../tasks/create_aro_cluster.yaml diff --git a/smoketest/smoketest.yaml b/smoketest/smoketest.yaml new file mode 100644 index 00000000000..03719e10c9a --- /dev/null +++ b/smoketest/smoketest.yaml @@ -0,0 +1,17 @@ +--- +- name: Deploy simple clusters + hosts: simple_clusters + gather_facts: false + environment: + AZURE_CORE_SURVEY_MESSAGE: "false" + roles: + - simple_cluster + - cleanup +- name: Bring your own keys disk encryption + hosts: byok_clusters + gather_facts: false + environment: + AZURE_CORE_SURVEY_MESSAGE: "false" + roles: + - byok_cluster + - cleanup diff --git a/smoketest/tasks/create_aro_cluster.yaml b/smoketest/tasks/create_aro_cluster.yaml new file mode 100644 index 00000000000..0aa0d0e5c62 --- /dev/null +++ b/smoketest/tasks/create_aro_cluster.yaml @@ -0,0 +1,109 @@ +--- +# TODO: Create clusters with azure_rm_openshiftmanagedcluster if possible +# - name: Create cluster service principal +# azure.azcollection.azure_rm_adserviceprincipal: +# delegate_to: localhost +# app_id: "{{ name | to_uuid }}" +# tenant: "{{ sub_info.tenant_id }}" +# register: csp_info +# - ansible.builtin.debug: var=csp_info +# - name: Create cluster service principal +# ansible.builtin.command: +# delegate_to: localhost +# argv: [ +# "az", "ad", "sp", "create-for-rbac", +# "-n", "{{ name }}-sp", +# "--role", "contributor", +# "--scopes", "{{ rg_info.state.id }}" +# ] +# register: sp_info +# - ansible.builtin.debug: var=sp_info +# - name: Create aro cluster +# azure.azcollection.azure_rm_openshiftmanagedcluster: +# delegate_to: localhost +# name: "{{ name }}" +# resource_group: "{{ resource_group }}" +# location: "{{ location }}" +# service_principal_profile: +# client_id: "{{ csp_info.state.client_id }}" +# client_secret: "{{ csp_info.state.client_secret }}" +# worker_profiles: +# - name: "worker" +# vm_size: "Standard_D4s_v3" +# subnet_id: "{{ worker_subnet_state.state.id }}" +# master_profile: +# vm_size: "Standard_D4s_v3" +# subnet_id: "{{ master_subnet_state.state.id }}" +# - name: Get aro cluster +# ansible.builtin.command: +# delegate_to: localhost +# argv: ["az","aro", "show", "--name={{ name }}", "--resource-group={{ resource_group }}", "-o=yaml"] +# register: aro_create_result +- name: create_aro_cluster | Create aro cluster + ansible.builtin.command: + argv: "{{ argv | reject('equalto', omit) | list }}" + vars: + argv: + - az + - aro + - create + - --name={{ name }} + - --resource-group={{ resource_group }} + - --location={{ location }} + - --master-subnet=master + - --subscription={{ sub_info.subscription_id }} + - --vnet=aro-vnet + - --worker-subnet=worker + - "{% if apiserver_visibility is defined %}--apiserver-visibility={{ apiserver_visibility }}{% else %}{{ omit }}{% endif %}" + - "{% if byok_des_status is defined and byok_des_status.state.provisioning_state == 'Succeeded' + %}--disk-encryption-set={{ byok_des_status.state.id }}{% else %}{{ omit }}{% endif %}" + - "{% if cluster_resource_group is defined %}--cluster-resource-group={{ cluster_resource_group }}{% else %}{{ omit }}{% endif %}" + - "{% if domain is defined %}--domain={{ domain }}{% else %}{{ omit }}{% endif %}" + - "{% if enable_preconfigured_nsg is defined %}--enable-preconfigured-nsg={{ enable_preconfigured_nsg }}{% else %}{{ omit }}{% endif %}" + - "{% if fips_validated_modules is defined %}--fips-validated-modules={{ fips_validated_modules }}{% else %}{{ omit }}{% endif %}" + - "{% if ingress_visibility is defined %}--ingress-visibility={{ ingress_visibility }}{% else %}{{ omit }}{% endif %}" + - "{% if master_encryption_at_host is defined %}--master-encryption-at-host={{ master_encryption_at_host }}{% else %}{{ omit }}{% endif %}" + - "{% if master_vm_size is defined %}--master-vm-size={{ master_vm_size }}{% else %}{{ omit }}{% endif %}" + - "{% if outbound_type is defined %}--outbound-type={{ outbound_type }}{% else %}{{ omit }}{% endif %}" + - "{% if pod_cidr is defined %}--pod-cidr={{ pod_cidr }}{% else %}{{ omit }}{% endif %}" + - "{% if service_cidr is defined %}--service-cidr={{ service_cidr }}{% else %}{{ omit }}{% endif %}" + - "{% if version is defined %}--version={{ version }}{% else %}{{ omit }}{% endif %}" + - "{% if worker_encryption_at_host is defined %}--worker-encryption-at-host={{ worker_encryption_at_host }}{% else %}{{ omit }}{% endif %}" + - "{% if worker_count is defined %}--worker-count={{ worker_count }}{% else %}{{ omit }}{% endif %}" + - "{% if worker_vm_size is defined %}--worker-vm-size={{ worker_vm_size }}{% else %}{{ omit }}{% endif %}" + - --tags=createdby='{{ currentuser_info.userPrincipalName }}' createdwith='ansible smoketest' purge=true + - -o=yaml + delegate_to: localhost + register: aro_create_result +- name: create_aro_cluster | Set fact aro_create_result + ansible.builtin.set_fact: + aro_cluster_state: "{{ aro_create_result.stdout | from_yaml }}" +- name: create_aro_cluster | Debug aro_cluster_state + ansible.builtin.debug: + var: aro_cluster_state +- name: create_aro_cluster | Get cluster kubeconfig + ansible.builtin.command: + argv: [az, aro, get-admin-kubeconfig, "--name={{ name }}", "--resource-group={{ resource_group }}", "-f=/tmp/{{ name }}.kubeconfig"] + delegate_to: localhost + register: aro_credentails_result +- name: create_aro_cluster | Cluster info + # Wait for cluster to become reachable + kubernetes.core.k8s_cluster_info: + kubeconfig: /tmp/{{ name }}.kubeconfig + delegate_to: localhost + register: k8s_cluster_info + retries: 10 + delay: 60 +- name: create_aro_cluster | Get clusterversion + kubernetes.core.k8s_info: + kubeconfig: /tmp/{{ name }}.kubeconfig + api_version: config.openshift.io/v1 + kind: ClusterVersion + name: version + delegate_to: localhost + register: oc_get_clusterversion + retries: 10 # Need retries to wait for real ingress cert to deploy + delay: 60 +- name: create_aro_cluster | Debug clusterversion status conditions + ansible.builtin.debug: + var: oc_get_clusterversion.resources[0].status.conditions diff --git a/smoketest/tasks/create_resourcegroup.yaml b/smoketest/tasks/create_resourcegroup.yaml new file mode 100644 index 00000000000..db2e94d2907 --- /dev/null +++ b/smoketest/tasks/create_resourcegroup.yaml @@ -0,0 +1,41 @@ +--- +- name: create_resourcegroup | Get subscription info + azure.azcollection.azure_rm_subscription_info: + delegate_to: localhost + register: sub_status + run_once: true +- name: create_resourcegroup | Debug sub_status + ansible.builtin.debug: + # msg: Using subscription {{ sub_status.subscriptions[0].display_name }} {{ sub_info.subscriptions[0].subscription_id }} + var: sub_status +- name: create_resourcegroup | Select subscription + ansible.builtin.set_fact: + sub_info: "{{ sub_status.subscriptions[0] }}" +- name: create_resourcegroup | Debug sub_info + ansible.builtin.debug: + var: sub_info +- name: create_resourcegroup | Get current user info + delegate_to: localhost + register: signedinuser_output + ansible.builtin.command: + argv: ["az", "ad", "signed-in-user", "show", "-o=yaml"] +- name: create_resourcegroup | Set fact currentuser_info + ansible.builtin.set_fact: + currentuser_info: "{{ signedinuser_output.stdout | from_yaml }}" +- name: create_resourcegroup | Debug currentuser_info + ansible.builtin.debug: + var: currentuser_info + +- name: create_resourcegroup | Resource group + azure.azcollection.azure_rm_resourcegroup: + name: "{{ resource_group }}" + location: "{{ location }}" + tags: + createdby: "{{ currentuser_info.userPrincipalName }}" + createdwith: "ansible smoketest" + purge: "true" + delegate_to: localhost + register: rg_info +- name: create_resourcegroup | Debug rg_info + ansible.builtin.debug: + var: rg_info diff --git a/smoketest/tasks/create_vnet.yaml b/smoketest/tasks/create_vnet.yaml new file mode 100644 index 00000000000..089eec6c425 --- /dev/null +++ b/smoketest/tasks/create_vnet.yaml @@ -0,0 +1,73 @@ +--- +- name: create_vnet | Vnet + azure.azcollection.azure_rm_virtualnetwork: + name: "{{ vnet_name | default('aro-vnet') }}" + resource_group: "{{ resource_group }}" + address_prefixes_cidr: "{{ network_prefix_cidr }}" + location: "{{ location }}" + tags: + createdby: "{{ currentuser_info.userPrincipalName }}" + createdwith: "ansible smoketest" + purge: "true" + delegate_to: localhost + register: vnet_state +- name: create_vnet | Debug vnet_state + ansible.builtin.debug: + var: vnet_state + +- name: create_vnet | Create route table + when: "routes is defined" + block: + - name: Create route table + azure.azcollection.azure_rm_routetable: + name: "{{ vnet_name | default('aro-vnet') }}-rt" + resource_group: "{{ resource_group }}" + location: "{{ location }}" + tags: + createdby: "{{ currentuser_info.userPrincipalName }}" + createdwith: "ansible smoketest" + purge: "true" + delegate_to: localhost + register: route_table_state + - name: create_vnet | Debug route_table_state + ansible.builtin.debug: + var: route_table_state + - name: Create routes + azure.azcollection.azure_rm_route: + resource_group: "{{ resource_group }}" + name: "{{ item.name }}" + address_prefix: "{{ item.address_prefix }}" + next_hop_type: "{{ item.next_hop_type }}" + route_table_name: "{{ vnet_name | default('aro-vnet') }}-rt" + loop: "{{ routes }}" + delegate_to: localhost + register: route_entry_state + - name: create_vnet | Debug route_entry_state + ansible.builtin.debug: + var: route_entry_state + +- name: create_vnet | Master subnet + azure.azcollection.azure_rm_subnet: + name: master + virtual_network_name: "{{ vnet_name | default('aro-vnet') }}" + address_prefix_cidr: "{{ master_cidr }}" + resource_group: "{{ resource_group }}" + private_link_service_network_policies: "{% if outbound_type == 'UserDefinedRouting' %}Disabled{% else %}{{ omit }}{% endif %}" + route_table: "{% if routes is defined %}{{ vnet_name | default('aro-vnet') }}-rt{% else %}{{ omit }}{% endif %}" + delegate_to: localhost + register: master_subnet_state +- name: create_vnet | Debug master_subnet_state + ansible.builtin.debug: + var: master_subnet_state +- name: create_vnet | Worker subnet + azure.azcollection.azure_rm_subnet: + name: worker + virtual_network_name: "{{ vnet_name | default('aro-vnet') }}" + address_prefix_cidr: "{{ worker_cidr }}" + resource_group: "{{ resource_group }}" + route_table: "{% if routes is defined %}{{ vnet_name | default('aro-vnet') }}-rt{% else %}{{ omit }}{% endif %}" + delegate_to: localhost + register: worker_subnet_state +- name: create_vnet | Debug worker_subnet_state + ansible.builtin.debug: + var: worker_subnet_state diff --git a/smoketest/tasks/delete_aro_cluster.yaml b/smoketest/tasks/delete_aro_cluster.yaml new file mode 100644 index 00000000000..22da681909c --- /dev/null +++ b/smoketest/tasks/delete_aro_cluster.yaml @@ -0,0 +1,9 @@ +--- +- name: delete_aro_cluster | Delete aro cluster + when: CLEANUP is not defined or CLEANUP != "False" + azure.azcollection.azure_rm_openshiftmanagedcluster: + name: "{{ name }}" + resource_group: "{{ resource_group }}" + location: "{{ location }}" + state: absent + delegate_to: localhost diff --git a/smoketest/tasks/delete_resourcegroup.yaml b/smoketest/tasks/delete_resourcegroup.yaml new file mode 100644 index 00000000000..ec360ee6433 --- /dev/null +++ b/smoketest/tasks/delete_resourcegroup.yaml @@ -0,0 +1,9 @@ +--- +- name: delete_resourcegroup | Delete resource group + when: CLEANUP is not defined or CLEANUP != "False" + azure.azcollection.azure_rm_resourcegroup: + name: "{{ resource_group }}" + location: "{{ location }}" + force_delete_nonempty: true + state: absent + delegate_to: localhost