From b9d60cc2231d0120acbc6644a6a977bd1f1e9742 Mon Sep 17 00:00:00 2001 From: Sid Shukla Date: Thu, 2 May 2024 11:56:14 +0200 Subject: [PATCH] Cherry-pick bunch of changes from changes made between v1.2.4 and v1.3.0 (#424) * Fix credentials delete logic (#301) - check if no delete attempt occured - check if no secret present in cluster - add integration test case in e2e suite - change Makefile test-e2e target to make able to run selected tests using GINKGO_FOCUS env variable - code grooming * Bump docker/metadata-action from 4 to 5 (#317) Bumps [docker/metadata-action](https://github.com/docker/metadata-action) from 4 to 5. - [Release notes](https://github.com/docker/metadata-action/releases) - [Upgrade guide](https://github.com/docker/metadata-action/blob/master/UPGRADE.md) - [Commits](https://github.com/docker/metadata-action/compare/v4...v5) --- updated-dependencies: - dependency-name: docker/metadata-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump docker/login-action from 2 to 3 (#316) Bumps [docker/login-action](https://github.com/docker/login-action) from 2 to 3. - [Release notes](https://github.com/docker/login-action/releases) - [Commits](https://github.com/docker/login-action/compare/v2...v3) --- updated-dependencies: - dependency-name: docker/login-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump aquasecurity/trivy-action from 0.11.2 to 0.12.0 (#313) Bumps [aquasecurity/trivy-action](https://github.com/aquasecurity/trivy-action) from 0.11.2 to 0.12.0. - [Release notes](https://github.com/aquasecurity/trivy-action/releases) - [Commits](https://github.com/aquasecurity/trivy-action/compare/0.11.2...0.12.0) --- updated-dependencies: - dependency-name: aquasecurity/trivy-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump actions/checkout from 3 to 4 (#314) Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * fix(manager): remove CPU limit and increase memory limit (#319) * E2E for Cilium CNI without Kubeproxy (#310) - add manifest scripts - change makefile * Bump aquasecurity/trivy-action from 0.12.0 to 0.13.0 (#324) Bumps [aquasecurity/trivy-action](https://github.com/aquasecurity/trivy-action) from 0.12.0 to 0.13.0. - [Release notes](https://github.com/aquasecurity/trivy-action/releases) - [Commits](https://github.com/aquasecurity/trivy-action/compare/0.12.0...0.13.0) --- updated-dependencies: - dependency-name: aquasecurity/trivy-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump aquasecurity/trivy-action from 0.13.0 to 0.13.1 (#326) Bumps [aquasecurity/trivy-action](https://github.com/aquasecurity/trivy-action) from 0.13.0 to 0.13.1. - [Release notes](https://github.com/aquasecurity/trivy-action/releases) - [Commits](https://github.com/aquasecurity/trivy-action/compare/0.13.0...0.13.1) --- updated-dependencies: - dependency-name: aquasecurity/trivy-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump aquasecurity/trivy-action from 0.13.1 to 0.14.0 (#327) Bumps [aquasecurity/trivy-action](https://github.com/aquasecurity/trivy-action) from 0.13.1 to 0.14.0. - [Release notes](https://github.com/aquasecurity/trivy-action/releases) - [Commits](https://github.com/aquasecurity/trivy-action/compare/0.13.1...0.14.0) --- updated-dependencies: - dependency-name: aquasecurity/trivy-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * fix CVE-2023-39325 (#329) * update kube-vip to v0.6.3 (#320) * Add codecov.yml to ensure adequate patch coverage (#328) This sets the minimum patch coverage required for changes to repo to 75%. * Add last git commit hash to build flags (#332) This ensures we have the git hash of the changes in our CI logs so we can correlate the code changes being executed. * Cleanup for passing the linter (#336) * Delete unused code from pkg/context * Run gofumpt on the code * Add lint fixes to test package * Skip linting the conversion functions The conversion functions are infinitely recursive and cause linting errors. * Remove unnecessary statement in lint target * Revert file-scope licenses * Bump aquasecurity/trivy-action from 0.14.0 to 0.15.0 (#337) Bumps [aquasecurity/trivy-action](https://github.com/aquasecurity/trivy-action) from 0.14.0 to 0.15.0. - [Release notes](https://github.com/aquasecurity/trivy-action/releases) - [Commits](https://github.com/aquasecurity/trivy-action/compare/0.14.0...0.15.0) --- updated-dependencies: - dependency-name: aquasecurity/trivy-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update controller-gen to v0.14.0 Peg go version in build job to go1.21 Update manifests Run `make manifests` --------- Signed-off-by: dependabot[bot] Co-authored-by: Ilya Alekseyev Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Frederic M <43849398+fad3t@users.noreply.github.com> Co-authored-by: Christophe Jauffret --- .github/codecov.yml | 11 + .github/workflows/build-dev.yaml | 11 +- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/release.yaml | 6 +- .github/workflows/synopsys-schedule.yaml | 2 +- .github/workflows/synopsys.yaml | 2 +- .github/workflows/trivy-scan.yaml | 4 +- .gitignore | 2 + Makefile | 78 +- api/v1alpha4/conditions.go | 2 +- api/v1alpha4/nutanixcluster_conversion.go | 16 +- api/v1alpha4/nutanixmachine_conversion.go | 6 + .../nutanixmachinetemplate_conversion.go | 8 + api/v1alpha4/zz_generated.deepcopy.go | 1 - api/v1beta1/zz_generated.deepcopy.go | 1 - ...ture.cluster.x-k8s.io_nutanixclusters.yaml | 181 +-- ...ture.cluster.x-k8s.io_nutanixmachines.yaml | 377 +++--- ...ster.x-k8s.io_nutanixmachinetemplates.yaml | 251 ++-- config/manager/manager.yaml | 3 +- config/rbac/role.yaml | 1 - controllers/nutanixcluster_controller.go | 14 +- go.mod | 12 +- go.sum | 25 +- hack/ensure-go.sh | 2 +- hack/install-go.sh | 4 +- main.go | 12 +- package/docker/Dockerfile | 2 +- pkg/context/context.go | 25 - templates/base/cluster-with-kcp.yaml | 2 +- templates/cluster-template-ccm.yaml | 2 +- templates/cluster-template-csi.yaml | 2 +- templates/cluster-template.yaml | 2 +- test/e2e/basic_uuid_test.go | 1 - test/e2e/capx_quick_start_test.go | 1 - test/e2e/capx_regression.go | 207 ++++ test/e2e/categories_test.go | 1 - test/e2e/ccm_test.go | 1 - test/e2e/cluster_upgrade_test.go | 1 - test/e2e/clusterctl_upgrade_test.go | 1 - test/e2e/common.go | 2 + test/e2e/csi_test.go | 1 - .../data/cni/cilium/cilium-no-kubeproxy.yaml | 1056 +++++++++++++++++ .../cluster-template/kustomization.yaml | 5 + .../v1alpha4/no-kubeproxy/no-kubeproxy.yaml | 23 + .../kustomization.yaml | 5 + .../cluster-template-ccm/kustomization.yaml | 5 + .../cluster-template-csi/kustomization.yaml | 5 + .../kustomization.yaml | 5 + .../kustomization.yaml | 5 + .../kustomization.yaml | 5 + .../kustomization.yaml | 5 + .../kustomization.yaml | 5 + .../kustomization.yaml | 5 + .../kustomization.yaml | 5 + .../kustomization.yaml | 5 + .../cluster-template/kustomization.yaml | 5 + .../v1beta1/no-kubeproxy/no-kubeproxy.yaml | 23 + test/e2e/e2e_suite_test.go | 64 +- test/e2e/gpu_test.go | 1 - test/e2e/k8s_conformance_test.go | 1 - test/e2e/md_rollout_test.go | 1 - test/e2e/md_scale_test.go | 5 +- test/e2e/mhc_remediations_test.go | 1 - test/e2e/multi_nic_test.go | 1 - test/e2e/nutanix_client.go | 1 - test/e2e/nutanix_client_test.go | 1 - test/e2e/projects_test.go | 11 +- test/e2e/test_helpers.go | 86 +- 68 files changed, 2081 insertions(+), 544 deletions(-) create mode 100644 .github/codecov.yml create mode 100644 test/e2e/capx_regression.go create mode 100644 test/e2e/data/cni/cilium/cilium-no-kubeproxy.yaml create mode 100644 test/e2e/data/infrastructure-nutanix/v1alpha4/no-kubeproxy/cluster-template/kustomization.yaml create mode 100644 test/e2e/data/infrastructure-nutanix/v1alpha4/no-kubeproxy/no-kubeproxy.yaml create mode 100644 test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-additional-categories/kustomization.yaml create mode 100644 test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-ccm/kustomization.yaml create mode 100644 test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-csi/kustomization.yaml create mode 100644 test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-kcp-remediation/kustomization.yaml create mode 100644 test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-kcp-scale-in/kustomization.yaml create mode 100644 test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-md-remediation/kustomization.yaml create mode 100644 test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-no-nmt/kustomization.yaml create mode 100644 test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-no-nutanix-cluster/kustomization.yaml create mode 100644 test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-no-secret/kustomization.yaml create mode 100644 test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-project/kustomization.yaml create mode 100644 test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-upgrades/kustomization.yaml create mode 100644 test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template/kustomization.yaml create mode 100644 test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/no-kubeproxy.yaml diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 0000000000..721df6b11e --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,11 @@ +codecov: + require_ci_to_pass: yes + +coverage: + precision: 2 + round: down + range: 75..100 + status: + patch: + default: + target: 75% diff --git a/.github/workflows/build-dev.yaml b/.github/workflows/build-dev.yaml index a1ddb7c169..f580c963fe 100644 --- a/.github/workflows/build-dev.yaml +++ b/.github/workflows/build-dev.yaml @@ -15,12 +15,12 @@ jobs: - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Go uses: actions/setup-go@v4 with: - go-version: "^1.19" + go-version: "1.21" - name: Test build run: make manifests generate fmt vet build @@ -33,9 +33,14 @@ jobs: - name: Codecov uses: codecov/codecov-action@v3.1.4 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + with: + file: ./coverage.xml # Replace with the path to your coverage report + fail_ci_if_error: true - name: Run Trivy vulnerability scanner - uses: aquasecurity/trivy-action@0.11.2 + uses: aquasecurity/trivy-action@0.15.0 with: scan-type: "fs" ignore-unfixed: true diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 00eb4602b1..2eaadfc026 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -24,7 +24,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index f194208e1d..aaa5414668 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Go uses: actions/setup-go@v4 @@ -26,7 +26,7 @@ jobs: ko: "latest" - name: Login to GHCR - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} @@ -34,7 +34,7 @@ jobs: - name: Docker meta id: meta - uses: docker/metadata-action@v4 + uses: docker/metadata-action@v5 with: images: capi-nutanix sep-tags: "," diff --git a/.github/workflows/synopsys-schedule.yaml b/.github/workflows/synopsys-schedule.yaml index 2c2007f739..8700fcf92d 100644 --- a/.github/workflows/synopsys-schedule.yaml +++ b/.github/workflows/synopsys-schedule.yaml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Go uses: actions/setup-go@v4 diff --git a/.github/workflows/synopsys.yaml b/.github/workflows/synopsys.yaml index d6b84928bf..c87e7c7689 100644 --- a/.github/workflows/synopsys.yaml +++ b/.github/workflows/synopsys.yaml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Go uses: actions/setup-go@v4 diff --git a/.github/workflows/trivy-scan.yaml b/.github/workflows/trivy-scan.yaml index 927f933b72..c79b75a7ef 100644 --- a/.github/workflows/trivy-scan.yaml +++ b/.github/workflows/trivy-scan.yaml @@ -17,7 +17,7 @@ jobs: runs-on: "ubuntu-latest" steps: - name: Checkout Code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Get repository name run: echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV @@ -46,7 +46,7 @@ jobs: ko build -B -t ${{ github.sha }} --platform=$PLATFORMS . - name: Run Trivy vulnerability scanner - uses: aquasecurity/trivy-action@0.11.2 + uses: aquasecurity/trivy-action@0.15.0 with: image-ref: "ko.local/${{ env.REPOSITORY_NAME }}:${{ github.sha }}" format: "sarif" diff --git a/.gitignore b/.gitignore index 049991a74b..181dbfa7fb 100644 --- a/.gitignore +++ b/.gitignore @@ -107,3 +107,5 @@ out # github.com github.com profile.cov +coverage.xml + diff --git a/Makefile b/Makefile index 2c39e581dc..a4e41656cd 100644 --- a/Makefile +++ b/Makefile @@ -54,6 +54,7 @@ export PATH := $(abspath $(TOOLS_BIN_DIR)):$(PATH) CNI_PATH_CALICO ?= "${E2E_DIR}/data/cni/calico/calico.yaml" CNI_PATH_FLANNEL ?= "${E2E_DIR}/data/cni/flannel/flannel.yaml" # From https://github.com/flannel-io/flannel/blob/master/Documentation/kube-flannel.yml CNI_PATH_CILIUM ?= "${E2E_DIR}/data/cni/cilium/cilium.yaml" # helm template cilium cilium/cilium --version 1.13.0 -n kube-system --set hubble.enabled=false | sed 's/${BIN_PATH}/$BIN_PATH/g' +CNI_PATH_CILIUM_NO_KUBEPROXY ?= "${E2E_DIR}/data/cni/cilium/cilium-no-kubeproxy.yaml" # helm template cilium cilium/cilium --version 1.13.0 -n kube-system --set hubble.enabled=false --set kubeProxyReplacement=strict | sed 's/${BIN_PATH}/$BIN_PATH/g' # # Binaries. @@ -79,7 +80,7 @@ SETUP_ENVTEST_BIN := setup-envtest SETUP_ENVTEST := $(abspath $(TOOLS_BIN_DIR)/$(SETUP_ENVTEST_BIN)-$(SETUP_ENVTEST_VER)) SETUP_ENVTEST_PKG := sigs.k8s.io/controller-runtime/tools/setup-envtest -CONTROLLER_GEN_VER := v0.8.0 +CONTROLLER_GEN_VER := v0.14.0 CONTROLLER_GEN_BIN := controller-gen CONTROLLER_GEN := $(abspath $(TOOLS_BIN_DIR)/$(CONTROLLER_GEN_BIN)-$(CONTROLLER_GEN_VER)) CONTROLLER_GEN_PKG := sigs.k8s.io/controller-tools/cmd/controller-gen @@ -117,10 +118,9 @@ CONVERSION_VERIFIER := $(abspath $(TOOLS_BIN_DIR)/$(CONVERSION_VERIFIER_BIN)) TILT_PREPARE_BIN := tilt-prepare TILT_PREPARE := $(abspath $(TOOLS_BIN_DIR)/$(TILT_PREPARE_BIN)) -GOLANGCI_LINT_VER := v1.44.0 +GOLANGCI_LINT_VER := v1.55.2 GOLANGCI_LINT_BIN := golangci-lint GOLANGCI_LINT := $(abspath $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN)) -GOLANGCI_LINT_PKG := github.com/golangci/golangci-lint/cmd/golangci-lint # CRD_OPTIONS define options to add to the CONTROLLER_GEN CRD_OPTIONS ?= "crd:crdVersions=v1" @@ -150,6 +150,7 @@ ifneq ($(LABEL_FILTERS),) endif JUNIT_REPORT_FILE ?= "junit.e2e_suite.1.xml" GINKGO_SKIP ?= "clusterctl-Upgrade" +GINKGO_FOCUS ?= "" GINKGO_NODES ?= 1 E2E_CONF_FILE ?= ${E2E_DIR}/config/nutanix.yaml ARTIFACTS ?= ${REPO_ROOT}/_artifacts @@ -161,6 +162,11 @@ FLAVOR ?= e2e TEST_NAMESPACE=capx-test-ns TEST_CLUSTER_NAME=mycluster +# set ginkgo focus flags, if any +ifneq ($(strip $(GINKGO_FOCUS)),) +_FOCUS_ARGS := $(foreach arg,$(strip $(GINKGO_FOCUS)),--focus="$(arg)") +endif + # to set multiple ginkgo skip flags, if any ifneq ($(strip $(GINKGO_SKIP)),) _SKIP_ARGS := $(foreach arg,$(strip $(GINKGO_SKIP)),--skip="$(arg)") @@ -228,7 +234,8 @@ kind-delete: ## Delete the kind cluster .PHONY: build build: generate fmt ## Build manager binary. - go build -o bin/manager main.go + GIT_COMMIT_HASH=`git rev-parse HEAD` && \ + go build -ldflags "-X main.gitCommitHash=$${GIT_COMMIT_HASH}" -o bin/manager main.go .PHONY: run run: manifests generate fmt vet ## Run a controller from your host. @@ -236,7 +243,8 @@ run: manifests generate fmt vet ## Run a controller from your host. .PHONY: docker-build docker-build: $(KO) ## Build docker image with the manager. - KO_DOCKER_REPO=ko.local $(KO) build -B --platform=${PLATFORMS} -t ${IMG_TAG} -L . + GIT_COMMIT_HASH=`git rev-parse HEAD` && \ + KO_DOCKER_REPO=ko.local GOFLAGS="-ldflags=-X=main.gitCommitHash=$${GIT_COMMIT_HASH}" $(KO) build -B --platform=${PLATFORMS} -t ${IMG_TAG} -L . .PHONY: docker-push docker-push: $(KO) ## Push docker image with the manager. @@ -296,6 +304,24 @@ cluster-e2e-templates-v1beta1: $(KUSTOMIZE) ## Generate cluster templates for v1 $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-kcp-scale-in --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-kcp-scale-in.yaml $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-csi --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-csi.yaml +cluster-e2e-templates-no-kubeproxy: $(KUSTOMIZE) ##Generate cluster templates without kubeproxy + # v1alpha4 + $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1alpha4/no-kubeproxy/cluster-template --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1alpha4/cluster-template.yaml + + # v1beta1 + $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template.yaml + $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-no-secret --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-no-secret.yaml + $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-no-nutanix-cluster --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-no-nutanix-cluster.yaml + $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-additional-categories --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-additional-categories.yaml + $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-no-nmt --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-no-nmt.yaml + $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-project --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-project.yaml + $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-ccm --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-ccm.yaml + $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-upgrades --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-upgrades.yaml + $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-md-remediation --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-md-remediation.yaml + $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-kcp-remediation --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-kcp-remediation.yaml + $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-kcp-scale-in --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-kcp-scale-in.yaml + $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-csi --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-csi.yaml + cluster-templates: $(KUSTOMIZE) ## Generate cluster templates for all flavors $(KUSTOMIZE) build $(TEMPLATES_DIR)/base > $(TEMPLATES_DIR)/cluster-template.yaml $(KUSTOMIZE) build $(TEMPLATES_DIR)/csi > $(TEMPLATES_DIR)/cluster-template-csi.yaml @@ -305,7 +331,8 @@ cluster-templates: $(KUSTOMIZE) ## Generate cluster templates for all flavors .PHONY: docker-build-e2e docker-build-e2e: $(KO) ## Build docker image with the manager with e2e tag. - KO_DOCKER_REPO=ko.local $(KO) build -B --platform=${PLATFORMS_E2E} -t e2e -L . + GIT_COMMIT_HASH=`git rev-parse HEAD` && \ + KO_DOCKER_REPO=ko.local GOFLAGS="-ldflags=-X=main.gitCommitHash=$${GIT_COMMIT_HASH}" $(KO) build -B --platform=${PLATFORMS_E2E} -t e2e -L . docker tag ko.local/cluster-api-provider-nutanix:e2e ${IMG_REPO}:e2e .PHONY: prepare-local-clusterctl @@ -369,6 +396,28 @@ ginkgo-help: .PHONY: test-e2e test-e2e: docker-build-e2e $(GINKGO_BIN) cluster-e2e-templates cluster-templates ## Run the end-to-end tests + mkdir -p $(ARTIFACTS) + NUTANIX_LOG_LEVEL=debug $(GINKGO) -v \ + --trace \ + --progress \ + --tags=e2e \ + --label-filter=$(LABEL_FILTER_ARGS) \ + $(_SKIP_ARGS) \ + $(_FOCUS_ARGS) \ + --nodes=$(GINKGO_NODES) \ + --no-color=$(GINKGO_NOCOLOR) \ + --output-dir="$(ARTIFACTS)" \ + --junit-report=${JUNIT_REPORT_FILE} \ + --timeout="24h" \ + --always-emit-ginkgo-writer \ + $(GINKGO_ARGS) ./test/e2e -- \ + -e2e.artifacts-folder="$(ARTIFACTS)" \ + -e2e.config="$(E2E_CONF_FILE)" \ + -e2e.skip-resource-cleanup=$(SKIP_RESOURCE_CLEANUP) \ + -e2e.use-existing-cluster=$(USE_EXISTING_CLUSTER) + +.PHONY: test-e2e-no-kubeproxy +test-e2e-no-kubeproxy: docker-build-e2e $(GINKGO_BIN) cluster-e2e-templates-no-kubeproxy cluster-templates ## Run the end-to-end tests without kubeproxy mkdir -p $(ARTIFACTS) NUTANIX_LOG_LEVEL=debug $(GINKGO) -v \ --trace \ @@ -402,7 +451,6 @@ list-e2e: docker-build-e2e $(GINKGO_BIN) cluster-e2e-templates cluster-templates test-e2e-calico: CNI=$(CNI_PATH_CALICO) $(MAKE) test-e2e - .PHONY: test-e2e-flannel test-e2e-flannel: CNI=$(CNI_PATH_FLANNEL) $(MAKE) test-e2e @@ -411,8 +459,12 @@ test-e2e-flannel: test-e2e-cilium: CNI=$(CNI_PATH_CILIUM) $(MAKE) test-e2e +.PHONY: test-e2e-cilium-no-kubeproxy +test-e2e-cilium-no-kubeproxy: + CNI=$(CNI_PATH_CILIUM_NO_KUBEPROXY) $(MAKE) test-e2e-no-kubeproxy + .PHONY: test-e2e-all-cni -test-e2e-all-cni: test-e2e test-e2e-calico test-e2e-flannel test-e2e-cilium +test-e2e-all-cni: test-e2e test-e2e-calico test-e2e-flannel test-e2e-cilium test-e2e-cilium-no-kubeproxy ## -------------------------------------- @@ -500,8 +552,8 @@ $(TILT_PREPARE): $(TOOLS_DIR)/go.mod # Build tilt-prepare from tools folder. $(KPROMO): GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(KPROMO_PKG) $(KPROMO_BIN) ${KPROMO_VER} -$(GOLANGCI_LINT): # Build golangci-lint from tools folder - GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(GOLANGCI_LINT_PKG) $(GOLANGCI_LINT_BIN) $(GOLANGCI_LINT_VER) +$(GOLANGCI_LINT): # building golanci-lint from source is not recommended, so we are using the install script + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(TOOLS_BIN_DIR) $(GOLANGCI_LINT_VER) ## -------------------------------------- ## Lint / Verify @@ -509,15 +561,15 @@ $(GOLANGCI_LINT): # Build golangci-lint from tools folder ##@ Lint and Verify +GOLANGCI_LINT_EXTRA_ARGS := --enable gofumpt --build-tags e2e + .PHONY: lint lint: $(GOLANGCI_LINT) ## Lint the codebase $(GOLANGCI_LINT) run -v $(GOLANGCI_LINT_EXTRA_ARGS) - cd $(TEST_DIR); $(GOLANGCI_LINT) run -v $(GOLANGCI_LINT_EXTRA_ARGS) - cd $(TOOLS_DIR); $(GOLANGCI_LINT) run -v $(GOLANGCI_LINT_EXTRA_ARGS) .PHONY: lint-fix lint-fix: $(GOLANGCI_LINT) ## Lint the codebase and run auto-fixers if supported by the linter - GOLANGCI_LINT_EXTRA_ARGS=--fix $(MAKE) lint + GOLANGCI_LINT_EXTRA_ARGS="$(GOLANGCI_LINT_EXTRA_ARGS) --fix" $(MAKE) lint ## -------------------------------------- ## Clean diff --git a/api/v1alpha4/conditions.go b/api/v1alpha4/conditions.go index cc5d358017..9d006b0698 100644 --- a/api/v1alpha4/conditions.go +++ b/api/v1alpha4/conditions.go @@ -30,7 +30,7 @@ const ( ) const ( - //PrismCentralClientCondition indicates the status of the client used to connect to Prism Central + // PrismCentralClientCondition indicates the status of the client used to connect to Prism Central PrismCentralClientCondition capiv1.ConditionType = "PrismClientInit" PrismCentralClientInitializationFailed = "PrismClientInitFailed" diff --git a/api/v1alpha4/nutanixcluster_conversion.go b/api/v1alpha4/nutanixcluster_conversion.go index 78bf508734..9d010c1cb1 100644 --- a/api/v1alpha4/nutanixcluster_conversion.go +++ b/api/v1alpha4/nutanixcluster_conversion.go @@ -31,24 +31,26 @@ func (src *NutanixCluster) ConvertTo(dstRaw conversion.Hub) error { // nolint } // ConvertFrom converts from the Hub version (v1beta1) to this NutanixCluster. -func (dst *NutanixCluster) ConvertFrom(srcRaw conversion.Hub) error { // nolint +func (dst *NutanixCluster) ConvertFrom(srcRaw conversion.Hub) error { //nolint src := srcRaw.(*infrav1beta1.NutanixCluster) return Convert_v1beta1_NutanixCluster_To_v1alpha4_NutanixCluster(src, dst, nil) } // ConvertTo converts this NutanixClusterList to the Hub version (v1beta1). -func (src *NutanixClusterList) ConvertTo(dstRaw conversion.Hub) error { // nolint +func (src *NutanixClusterList) ConvertTo(dstRaw conversion.Hub) error { //nolint dst := dstRaw.(*infrav1beta1.NutanixClusterList) return Convert_v1alpha4_NutanixClusterList_To_v1beta1_NutanixClusterList(src, dst, nil) } // ConvertFrom converts from the Hub version(v1beta1) to this NutanixClusterList. -func (dst *NutanixClusterList) ConvertFrom(srcRaw conversion.Hub) error { // nolint +func (dst *NutanixClusterList) ConvertFrom(srcRaw conversion.Hub) error { //nolint src := srcRaw.(*infrav1beta1.NutanixClusterList) return Convert_v1beta1_NutanixClusterList_To_v1alpha4_NutanixClusterList(src, dst, nil) } // Convert_v1alpha4_NutanixClusterSpec_To_v1beta1_NutanixClusterSpec converts NutanixClusterSpec in NutanixClusterResource from v1alpha4 to v1beta1 version. +// +//nolint:all func Convert_v1alpha4_NutanixClusterSpec_To_v1beta1_NutanixClusterSpec(in *NutanixClusterSpec, out *infrav1beta1.NutanixClusterSpec, s apiconversion.Scope) error { // Wrapping the conversion function to avoid compilation errors due to compileErrorOnMissingConversion() // Ref: https://github.com/kubernetes/kubernetes/issues/98380 @@ -56,6 +58,8 @@ func Convert_v1alpha4_NutanixClusterSpec_To_v1beta1_NutanixClusterSpec(in *Nutan } // Convert_v1alpha4_APIEndpoint_To_v1beta1_APIEndpoint converts APIEndpoint in NutanixClusterResource from v1alpha4 to v1beta1 version. +// +//nolint:all func Convert_v1alpha4_APIEndpoint_To_v1beta1_APIEndpoint(in *capiv1alpha4.APIEndpoint, out *capiv1beta1.APIEndpoint, s apiconversion.Scope) error { // Wrapping the conversion function to avoid compilation errors due to compileErrorOnMissingConversion() // Ref: https://github.com/kubernetes/kubernetes/issues/98380 @@ -63,6 +67,8 @@ func Convert_v1alpha4_APIEndpoint_To_v1beta1_APIEndpoint(in *capiv1alpha4.APIEnd } // Convert_v1beta1_APIEndpoint_To_v1alpha4_APIEndpoint converts APIEndpoint in NutanixClusterResource from v1alpha4 to v1beta1 version. +// +//nolint:all func Convert_v1beta1_APIEndpoint_To_v1alpha4_APIEndpoint(in *capiv1beta1.APIEndpoint, out *capiv1alpha4.APIEndpoint, s apiconversion.Scope) error { // Wrapping the conversion function to avoid compilation errors due to compileErrorOnMissingConversion() // Ref: https://github.com/kubernetes/kubernetes/issues/98380 @@ -70,6 +76,8 @@ func Convert_v1beta1_APIEndpoint_To_v1alpha4_APIEndpoint(in *capiv1beta1.APIEndp } // Convert_v1beta1_NutanixClusterSpec_To_v1alpha4_NutanixClusterSpec converts NutanixClusterSpec in NutanixClusterResource from v1beta1 to v1alpha4 version. +// +//nolint:all func Convert_v1beta1_NutanixClusterSpec_To_v1alpha4_NutanixClusterSpec(in *infrav1beta1.NutanixClusterSpec, out *NutanixClusterSpec, s apiconversion.Scope) error { // Wrapping the conversion function to avoid compilation errors due to compileErrorOnMissingConversion() // Ref: https://github.com/kubernetes/kubernetes/issues/98380 @@ -77,6 +85,8 @@ func Convert_v1beta1_NutanixClusterSpec_To_v1alpha4_NutanixClusterSpec(in *infra } // Convert_v1alpha4_NutanixClusterStatus_To_v1beta1_NutanixClusterStatus converts NutanixClusterStatus in NutanixClusterResource from v1alpha4 to v1beta1 version. +// +//nolint:all func Convert_v1alpha4_NutanixClusterStatus_To_v1beta1_NutanixClusterStatus(in *NutanixClusterStatus, out *infrav1beta1.NutanixClusterStatus, s apiconversion.Scope) error { // Wrapping the conversion function to avoid compilation errors due to compileErrorOnMissingConversion() // Ref: https://github.com/kubernetes/kubernetes/issues/98380 diff --git a/api/v1alpha4/nutanixmachine_conversion.go b/api/v1alpha4/nutanixmachine_conversion.go index 277e84d24e..84ef0a3b2e 100644 --- a/api/v1alpha4/nutanixmachine_conversion.go +++ b/api/v1alpha4/nutanixmachine_conversion.go @@ -47,6 +47,8 @@ func (dst *NutanixMachineList) ConvertFrom(srcRaw conversion.Hub) error { // nol } // Convert_v1alpha4_NutanixMachineSpec_To_v1beta1_NutanixMachineSpec converts NutanixMachineSpec in NutanixMachineResource from v1alpha4 to v1beta1 version. +// +//nolint:all func Convert_v1alpha4_NutanixMachineSpec_To_v1beta1_NutanixMachineSpec(in *NutanixMachineSpec, out *infrav1beta1.NutanixMachineSpec, s apiconversion.Scope) error { // Wrapping the conversion function to avoid compilation errors due to compileErrorOnMissingConversion() // Ref: https://github.com/kubernetes/kubernetes/issues/98380 @@ -54,6 +56,8 @@ func Convert_v1alpha4_NutanixMachineSpec_To_v1beta1_NutanixMachineSpec(in *Nutan } // Convert_v1beta1_NutanixMachineSpec_To_v1alpha4_NutanixMachineSpec converts NutanixMachineSpec in NutanixMachineResource from v1alpha4 to v1beta1 version. +// +//nolint:all func Convert_v1beta1_NutanixMachineSpec_To_v1alpha4_NutanixMachineSpec(in *infrav1beta1.NutanixMachineSpec, out *NutanixMachineSpec, s apiconversion.Scope) error { // Wrapping the conversion function to avoid compilation errors due to compileErrorOnMissingConversion() // Ref: https://github.com/kubernetes/kubernetes/issues/98380 @@ -61,6 +65,8 @@ func Convert_v1beta1_NutanixMachineSpec_To_v1alpha4_NutanixMachineSpec(in *infra } // Convert_v1alpha4_NutanixMachineStatus_To_v1beta1_NutanixMachineStatus converts NutanixMachineStatus in NutanixMachineResource from v1alpha4 to v1beta1 version. +// +//nolint:all func Convert_v1alpha4_NutanixMachineStatus_To_v1beta1_NutanixMachineStatus(in *NutanixMachineStatus, out *infrav1beta1.NutanixMachineStatus, s apiconversion.Scope) error { // Wrapping the conversion function to avoid compilation errors due to compileErrorOnMissingConversion() // Ref: https://github.com/kubernetes/kubernetes/issues/98380 diff --git a/api/v1alpha4/nutanixmachinetemplate_conversion.go b/api/v1alpha4/nutanixmachinetemplate_conversion.go index 2c87f75cc4..4342a60bd2 100644 --- a/api/v1alpha4/nutanixmachinetemplate_conversion.go +++ b/api/v1alpha4/nutanixmachinetemplate_conversion.go @@ -59,6 +59,8 @@ func (dst *NutanixMachineTemplateList) ConvertFrom(srcRaw conversion.Hub) error } // Convert_v1alpha4_ObjectMeta_To_v1beta1_ObjectMeta converts ObjectMeta in NutanixMachineTemplateResource from v1alpha4 to v1beta1 version. +// +//nolint:all func Convert_v1alpha4_ObjectMeta_To_v1beta1_ObjectMeta(in *capiv1alpha4.ObjectMeta, out *capiv1beta1.ObjectMeta, s apiconversion.Scope) error { // Wrapping the conversion function to avoid compilation errors due to compileErrorOnMissingConversion() // Ref: https://github.com/kubernetes/kubernetes/issues/98380 @@ -66,6 +68,8 @@ func Convert_v1alpha4_ObjectMeta_To_v1beta1_ObjectMeta(in *capiv1alpha4.ObjectMe } // Convert_v1beta1_ObjectMeta_To_v1alpha4_ObjectMeta converts ObjectMeta in NutanixMachineTemplateResource from v1beta1 to v1alpha4 version. +// +//nolint:all func Convert_v1beta1_ObjectMeta_To_v1alpha4_ObjectMeta(in *capiv1beta1.ObjectMeta, out *capiv1alpha4.ObjectMeta, s apiconversion.Scope) error { // Wrapping the conversion function to avoid compilation errors due to compileErrorOnMissingConversion() // Ref: https://github.com/kubernetes/kubernetes/issues/98380 @@ -73,6 +77,8 @@ func Convert_v1beta1_ObjectMeta_To_v1alpha4_ObjectMeta(in *capiv1beta1.ObjectMet } // Convert_v1alpha4_NutanixMachineTemplateResource_To_v1beta1_NutanixMachineTemplateResource converts NutanixMachineTemplateResource in NutanixMachineTemplateResource from v1alpha4 to v1beta1 version. +// +//nolint:all func Convert_v1alpha4_NutanixMachineTemplateResource_To_v1beta1_NutanixMachineTemplateResource(in *NutanixMachineTemplateResource, out *infrav1beta1.NutanixMachineTemplateResource, s apiconversion.Scope) error { // Wrapping the conversion function to avoid compilation errors due to compileErrorOnMissingConversion() // Ref: https://github.com/kubernetes/kubernetes/issues/98380 @@ -80,6 +86,8 @@ func Convert_v1alpha4_NutanixMachineTemplateResource_To_v1beta1_NutanixMachineTe } // Convert_v1beta1_NutanixMachineTemplateResource_To_v1alpha4_NutanixMachineTemplateResource converts NutanixMachineTemplateResource in NutanixMachineTemplateResource from v1beta1 to v1alpha4 version. +// +//nolint:all func Convert_v1beta1_NutanixMachineTemplateResource_To_v1alpha4_NutanixMachineTemplateResource(in *infrav1beta1.NutanixMachineTemplateResource, out *NutanixMachineTemplateResource, s apiconversion.Scope) error { // Wrapping the conversion function to avoid compilation errors due to compileErrorOnMissingConversion() // Ref: https://github.com/kubernetes/kubernetes/issues/98380 diff --git a/api/v1alpha4/zz_generated.deepcopy.go b/api/v1alpha4/zz_generated.deepcopy.go index df1ac46cff..f481ad5ed4 100644 --- a/api/v1alpha4/zz_generated.deepcopy.go +++ b/api/v1alpha4/zz_generated.deepcopy.go @@ -1,5 +1,4 @@ //go:build !ignore_autogenerated -// +build !ignore_autogenerated /* Copyright 2022 Nutanix diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index 682b6617c8..db57b529d4 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -1,5 +1,4 @@ //go:build !ignore_autogenerated -// +build !ignore_autogenerated /* Copyright 2022 Nutanix diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_nutanixclusters.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_nutanixclusters.yaml index 0d477c34c2..afa222e075 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_nutanixclusters.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_nutanixclusters.yaml @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.8.0 - creationTimestamp: null + controller-gen.kubebuilder.io/version: v0.14.0 name: nutanixclusters.infrastructure.cluster.x-k8s.io spec: group: infrastructure.cluster.x-k8s.io @@ -34,14 +33,19 @@ spec: description: NutanixCluster is the Schema for the nutanixclusters API properties: apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources type: string kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string metadata: type: object @@ -49,9 +53,9 @@ spec: description: NutanixClusterSpec defines the desired state of NutanixCluster properties: controlPlaneEndpoint: - description: ControlPlaneEndpoint represents the endpoint used to - communicate with the control plane. host can be either DNS name - or ip address + description: |- + ControlPlaneEndpoint represents the endpoint used to communicate with the control plane. + host can be either DNS name or ip address properties: host: description: The hostname on which the API server is serving. @@ -65,18 +69,17 @@ spec: - port type: object prismCentral: - description: prismCentral holds the endpoint address and port to access - the Nutanix Prism Central. When a cluster-wide proxy is installed, - by default, this endpoint will be accessed via the proxy. Should - you wish for communication with this endpoint not to be proxied, - please add the endpoint to the proxy spec.noProxy list. + description: |- + prismCentral holds the endpoint address and port to access the Nutanix Prism Central. + When a cluster-wide proxy is installed, by default, this endpoint will be accessed via the proxy. + Should you wish for communication with this endpoint not to be proxied, please add the endpoint to the + proxy spec.noProxy list. properties: additionalTrustBundle: - description: AdditionalTrustBundle is a PEM encoded x509 cert - for the RootCA that was used to create the certificate for a - Prism Central that uses certificates that were issued by a non-publicly - trusted RootCA. The trust bundle is added to the cert pool used - to authenticate the TLS connection to the Prism Central. + description: |- + AdditionalTrustBundle is a PEM encoded x509 cert for the RootCA that was used to create the certificate + for a Prism Central that uses certificates that were issued by a non-publicly trusted RootCA. The trust + bundle is added to the cert pool used to authenticate the TLS connection to the Prism Central. properties: data: description: Data of the trust bundle if Kind is String. @@ -148,37 +151,37 @@ spec: operational state. properties: lastTransitionTime: - description: Last time the condition transitioned from one status - to another. This should be when the underlying condition changed. - If that is not known, then using the time when the API field - changed is acceptable. + description: |- + Last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when + the API field changed is acceptable. format: date-time type: string message: - description: A human readable message indicating details about - the transition. This field may be empty. + description: |- + A human readable message indicating details about the transition. + This field may be empty. type: string reason: - description: The reason for the condition's last transition - in CamelCase. The specific API may choose whether or not this - field is considered a guaranteed API. This field may not be - empty. + description: |- + The reason for the condition's last transition in CamelCase. + The specific API may choose whether or not this field is considered a guaranteed API. + This field may not be empty. type: string severity: - description: Severity provides an explicit classification of - Reason code, so the users or machines can immediately understand - the current situation and act accordingly. The Severity field - MUST be set only when Status=False. + description: |- + Severity provides an explicit classification of Reason code, so the users or machines can immediately + understand the current situation and act accordingly. + The Severity field MUST be set only when Status=False. type: string status: description: Status of the condition, one of True, False, Unknown. type: string type: - description: Type of condition in CamelCase or in foo.example.com/CamelCase. - Many .condition.type values are consistent across resources - like Available, but because arbitrary conditions can be useful - (see .node.status.conditions), the ability to deconflict is - important. + description: |- + Type of condition in CamelCase or in foo.example.com/CamelCase. + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions + can be useful (see .node.status.conditions), the ability to deconflict is important. type: string required: - status @@ -187,9 +190,9 @@ spec: type: array failureDomains: additionalProperties: - description: FailureDomainSpec is the Schema for Cluster API failure - domains. It allows controllers to understand how many failure - domains a cluster can optionally span across. + description: |- + FailureDomainSpec is the Schema for Cluster API failure domains. + It allows controllers to understand how many failure domains a cluster can optionally span across. properties: attributes: additionalProperties: @@ -233,14 +236,19 @@ spec: description: NutanixCluster is the Schema for the nutanixclusters API properties: apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources type: string kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string metadata: type: object @@ -248,9 +256,9 @@ spec: description: NutanixClusterSpec defines the desired state of NutanixCluster properties: controlPlaneEndpoint: - description: ControlPlaneEndpoint represents the endpoint used to - communicate with the control plane. host can be either DNS name - or ip address + description: |- + ControlPlaneEndpoint represents the endpoint used to communicate with the control plane. + host can be either DNS name or ip address properties: host: description: The hostname on which the API server is serving. @@ -264,18 +272,17 @@ spec: - port type: object prismCentral: - description: prismCentral holds the endpoint address and port to access - the Nutanix Prism Central. When a cluster-wide proxy is installed, - by default, this endpoint will be accessed via the proxy. Should - you wish for communication with this endpoint not to be proxied, - please add the endpoint to the proxy spec.noProxy list. + description: |- + prismCentral holds the endpoint address and port to access the Nutanix Prism Central. + When a cluster-wide proxy is installed, by default, this endpoint will be accessed via the proxy. + Should you wish for communication with this endpoint not to be proxied, please add the endpoint to the + proxy spec.noProxy list. properties: additionalTrustBundle: - description: AdditionalTrustBundle is a PEM encoded x509 cert - for the RootCA that was used to create the certificate for a - Prism Central that uses certificates that were issued by a non-publicly - trusted RootCA. The trust bundle is added to the cert pool used - to authenticate the TLS connection to the Prism Central. + description: |- + AdditionalTrustBundle is a PEM encoded x509 cert for the RootCA that was used to create the certificate + for a Prism Central that uses certificates that were issued by a non-publicly trusted RootCA. The trust + bundle is added to the cert pool used to authenticate the TLS connection to the Prism Central. properties: data: description: Data of the trust bundle if Kind is String. @@ -347,37 +354,37 @@ spec: operational state. properties: lastTransitionTime: - description: Last time the condition transitioned from one status - to another. This should be when the underlying condition changed. - If that is not known, then using the time when the API field - changed is acceptable. + description: |- + Last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when + the API field changed is acceptable. format: date-time type: string message: - description: A human readable message indicating details about - the transition. This field may be empty. + description: |- + A human readable message indicating details about the transition. + This field may be empty. type: string reason: - description: The reason for the condition's last transition - in CamelCase. The specific API may choose whether or not this - field is considered a guaranteed API. This field may not be - empty. + description: |- + The reason for the condition's last transition in CamelCase. + The specific API may choose whether or not this field is considered a guaranteed API. + This field may not be empty. type: string severity: - description: Severity provides an explicit classification of - Reason code, so the users or machines can immediately understand - the current situation and act accordingly. The Severity field - MUST be set only when Status=False. + description: |- + Severity provides an explicit classification of Reason code, so the users or machines can immediately + understand the current situation and act accordingly. + The Severity field MUST be set only when Status=False. type: string status: description: Status of the condition, one of True, False, Unknown. type: string type: - description: Type of condition in CamelCase or in foo.example.com/CamelCase. - Many .condition.type values are consistent across resources - like Available, but because arbitrary conditions can be useful - (see .node.status.conditions), the ability to deconflict is - important. + description: |- + Type of condition in CamelCase or in foo.example.com/CamelCase. + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions + can be useful (see .node.status.conditions), the ability to deconflict is important. type: string required: - lastTransitionTime @@ -387,9 +394,9 @@ spec: type: array failureDomains: additionalProperties: - description: FailureDomainSpec is the Schema for Cluster API failure - domains. It allows controllers to understand how many failure - domains a cluster can optionally span across. + description: |- + FailureDomainSpec is the Schema for Cluster API failure domains. + It allows controllers to understand how many failure domains a cluster can optionally span across. properties: attributes: additionalProperties: @@ -418,9 +425,3 @@ spec: storage: true subresources: status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_nutanixmachines.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_nutanixmachines.yaml index e5af3bc341..2362319d7a 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_nutanixmachines.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_nutanixmachines.yaml @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.8.0 - creationTimestamp: null + controller-gen.kubebuilder.io/version: v0.14.0 name: nutanixmachines.infrastructure.cluster.x-k8s.io spec: group: infrastructure.cluster.x-k8s.io @@ -42,14 +41,19 @@ spec: description: NutanixMachine is the Schema for the nutanixmachines API properties: apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources type: string kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string metadata: type: object @@ -78,47 +82,57 @@ spec: - uefi type: string bootstrapRef: - description: BootstrapRef is a reference to a bootstrap provider-specific - resource that holds configuration details. + description: |- + BootstrapRef is a reference to a bootstrap provider-specific resource + that holds configuration details. properties: apiVersion: description: API version of the referent. type: string fieldPath: - description: 'If referring to a piece of an object instead of - an entire object, this string should contain a valid JSON/Go - field access statement, such as desiredState.manifest.containers[2]. - For example, if the object reference is to a container within - a pod, this would take on a value like: "spec.containers{name}" - (where "name" refers to the name of the container that triggered - the event) or if no container name is specified "spec.containers[2]" - (container with index 2 in this pod). This syntax is chosen - only to have some well-defined way of referencing a part of - an object. TODO: this design is not final and this field is - subject to change in the future.' + description: |- + If referring to a piece of an object instead of an entire object, this string + should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container within a pod, this would take on a value like: + "spec.containers{name}" (where "name" refers to the name of the container that triggered + the event) or if no container name is specified "spec.containers[2]" (container with + index 2 in this pod). This syntax is chosen only to have some well-defined way of + referencing a part of an object. + TODO: this design is not final and this field is subject to change in the future. type: string kind: - description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind of the referent. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string namespace: - description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + description: |- + Namespace of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ type: string resourceVersion: - description: 'Specific resourceVersion to which this reference - is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + description: |- + Specific resourceVersion to which this reference is made, if any. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency type: string uid: - description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' + description: |- + UID of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids type: string type: object + x-kubernetes-map-type: atomic cluster: - description: cluster is to identify the cluster (the Prism Element - under management of the Prism Central), in which the Machine's VM - will be created. The cluster identifier (uuid or name) can be obtained - from the Prism Central console or using the prism_central API. + description: |- + cluster is to identify the cluster (the Prism Element under management + of the Prism Central), in which the Machine's VM will be created. + The cluster identifier (uuid or name) can be obtained from the Prism Central console + or using the prism_central API. properties: name: description: name is the resource name in the PC @@ -136,9 +150,10 @@ spec: - type type: object image: - description: image is to identify the rhcos image uploaded to the - Prism Central (PC) The image identifier (uuid or name) can be obtained - from the Prism Central console or using the prism_central API. + description: |- + image is to identify the rhcos image uploaded to the Prism Central (PC) + The image identifier (uuid or name) can be obtained from the Prism Central console + or using the prism_central API. properties: name: description: name is the resource name in the PC @@ -159,8 +174,9 @@ spec: anyOf: - type: integer - type: string - description: memorySize is the memory size (in Quantity format) of - the VM The minimum memorySize is 2Gi bytes + description: |- + memorySize is the memory size (in Quantity format) of the VM + The minimum memorySize is 2Gi bytes pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true project: @@ -184,10 +200,10 @@ spec: providerID: type: string subnet: - description: subnet is to identify the cluster's network subnet to - use for the Machine's VM The cluster identifier (uuid or name) can - be obtained from the Prism Central console or using the prism_central - API. + description: |- + subnet is to identify the cluster's network subnet to use for the Machine's VM + The cluster identifier (uuid or name) can be obtained from the Prism Central console + or using the prism_central API. items: description: NutanixResourceIdentifier holds the identity of a Nutanix PC resource (cluster, image, subnet, etc.) @@ -213,8 +229,9 @@ spec: anyOf: - type: integer - type: string - description: systemDiskSize is size (in Quantity format) of the system - disk of the VM The minimum systemDiskSize is 20Gi bytes + description: |- + systemDiskSize is size (in Quantity format) of the system disk of the VM + The minimum systemDiskSize is 20Gi bytes pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true vcpuSockets: @@ -242,9 +259,9 @@ spec: description: NutanixMachineStatus defines the observed state of NutanixMachine properties: addresses: - description: Addresses contains the Nutanix VM associated addresses. - Address type is one of Hostname, ExternalIP, InternalIP, ExternalDNS, - InternalDNS + description: |- + Addresses contains the Nutanix VM associated addresses. + Address type is one of Hostname, ExternalIP, InternalIP, ExternalDNS, InternalDNS items: description: MachineAddress contains information for the node's address. @@ -268,37 +285,37 @@ spec: operational state. properties: lastTransitionTime: - description: Last time the condition transitioned from one status - to another. This should be when the underlying condition changed. - If that is not known, then using the time when the API field - changed is acceptable. + description: |- + Last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when + the API field changed is acceptable. format: date-time type: string message: - description: A human readable message indicating details about - the transition. This field may be empty. + description: |- + A human readable message indicating details about the transition. + This field may be empty. type: string reason: - description: The reason for the condition's last transition - in CamelCase. The specific API may choose whether or not this - field is considered a guaranteed API. This field may not be - empty. + description: |- + The reason for the condition's last transition in CamelCase. + The specific API may choose whether or not this field is considered a guaranteed API. + This field may not be empty. type: string severity: - description: Severity provides an explicit classification of - Reason code, so the users or machines can immediately understand - the current situation and act accordingly. The Severity field - MUST be set only when Status=False. + description: |- + Severity provides an explicit classification of Reason code, so the users or machines can immediately + understand the current situation and act accordingly. + The Severity field MUST be set only when Status=False. type: string status: description: Status of the condition, one of True, False, Unknown. type: string type: - description: Type of condition in CamelCase or in foo.example.com/CamelCase. - Many .condition.type values are consistent across resources - like Available, but because arbitrary conditions can be useful - (see .node.status.conditions), the ability to deconflict is - important. + description: |- + Type of condition in CamelCase or in foo.example.com/CamelCase. + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions + can be useful (see .node.status.conditions), the ability to deconflict is important. type: string required: - status @@ -319,35 +336,43 @@ spec: description: API version of the referent. type: string fieldPath: - description: 'If referring to a piece of an object instead of - an entire object, this string should contain a valid JSON/Go - field access statement, such as desiredState.manifest.containers[2]. - For example, if the object reference is to a container within - a pod, this would take on a value like: "spec.containers{name}" - (where "name" refers to the name of the container that triggered - the event) or if no container name is specified "spec.containers[2]" - (container with index 2 in this pod). This syntax is chosen - only to have some well-defined way of referencing a part of - an object. TODO: this design is not final and this field is - subject to change in the future.' + description: |- + If referring to a piece of an object instead of an entire object, this string + should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container within a pod, this would take on a value like: + "spec.containers{name}" (where "name" refers to the name of the container that triggered + the event) or if no container name is specified "spec.containers[2]" (container with + index 2 in this pod). This syntax is chosen only to have some well-defined way of + referencing a part of an object. + TODO: this design is not final and this field is subject to change in the future. type: string kind: - description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind of the referent. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string namespace: - description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + description: |- + Namespace of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ type: string resourceVersion: - description: 'Specific resourceVersion to which this reference - is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + description: |- + Specific resourceVersion to which this reference is made, if any. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency type: string uid: - description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' + description: |- + UID of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids type: string type: object + x-kubernetes-map-type: atomic ready: description: Ready is true when the provider resource is ready. type: boolean @@ -383,14 +408,19 @@ spec: description: NutanixMachine is the Schema for the nutanixmachines API properties: apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources type: string kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string metadata: type: object @@ -419,47 +449,57 @@ spec: - uefi type: string bootstrapRef: - description: BootstrapRef is a reference to a bootstrap provider-specific - resource that holds configuration details. + description: |- + BootstrapRef is a reference to a bootstrap provider-specific resource + that holds configuration details. properties: apiVersion: description: API version of the referent. type: string fieldPath: - description: 'If referring to a piece of an object instead of - an entire object, this string should contain a valid JSON/Go - field access statement, such as desiredState.manifest.containers[2]. - For example, if the object reference is to a container within - a pod, this would take on a value like: "spec.containers{name}" - (where "name" refers to the name of the container that triggered - the event) or if no container name is specified "spec.containers[2]" - (container with index 2 in this pod). This syntax is chosen - only to have some well-defined way of referencing a part of - an object. TODO: this design is not final and this field is - subject to change in the future.' + description: |- + If referring to a piece of an object instead of an entire object, this string + should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container within a pod, this would take on a value like: + "spec.containers{name}" (where "name" refers to the name of the container that triggered + the event) or if no container name is specified "spec.containers[2]" (container with + index 2 in this pod). This syntax is chosen only to have some well-defined way of + referencing a part of an object. + TODO: this design is not final and this field is subject to change in the future. type: string kind: - description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind of the referent. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string namespace: - description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + description: |- + Namespace of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ type: string resourceVersion: - description: 'Specific resourceVersion to which this reference - is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + description: |- + Specific resourceVersion to which this reference is made, if any. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency type: string uid: - description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' + description: |- + UID of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids type: string type: object + x-kubernetes-map-type: atomic cluster: - description: cluster is to identify the cluster (the Prism Element - under management of the Prism Central), in which the Machine's VM - will be created. The cluster identifier (uuid or name) can be obtained - from the Prism Central console or using the prism_central API. + description: |- + cluster is to identify the cluster (the Prism Element under management + of the Prism Central), in which the Machine's VM will be created. + The cluster identifier (uuid or name) can be obtained from the Prism Central console + or using the prism_central API. properties: name: description: name is the resource name in the PC @@ -498,9 +538,10 @@ spec: type: object type: array image: - description: image is to identify the rhcos image uploaded to the - Prism Central (PC) The image identifier (uuid or name) can be obtained - from the Prism Central console or using the prism_central API. + description: |- + image is to identify the rhcos image uploaded to the Prism Central (PC) + The image identifier (uuid or name) can be obtained from the Prism Central console + or using the prism_central API. properties: name: description: name is the resource name in the PC @@ -521,8 +562,9 @@ spec: anyOf: - type: integer - type: string - description: memorySize is the memory size (in Quantity format) of - the VM The minimum memorySize is 2Gi bytes + description: |- + memorySize is the memory size (in Quantity format) of the VM + The minimum memorySize is 2Gi bytes pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true project: @@ -546,10 +588,10 @@ spec: providerID: type: string subnet: - description: subnet is to identify the cluster's network subnet to - use for the Machine's VM The cluster identifier (uuid or name) can - be obtained from the Prism Central console or using the prism_central - API. + description: |- + subnet is to identify the cluster's network subnet to use for the Machine's VM + The cluster identifier (uuid or name) can be obtained from the Prism Central console + or using the prism_central API. items: description: NutanixResourceIdentifier holds the identity of a Nutanix PC resource (cluster, image, subnet, etc.) @@ -575,8 +617,9 @@ spec: anyOf: - type: integer - type: string - description: systemDiskSize is size (in Quantity format) of the system - disk of the VM The minimum systemDiskSize is 20Gi bytes + description: |- + systemDiskSize is size (in Quantity format) of the system disk of the VM + The minimum systemDiskSize is 20Gi bytes pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true vcpuSockets: @@ -604,9 +647,9 @@ spec: description: NutanixMachineStatus defines the observed state of NutanixMachine properties: addresses: - description: Addresses contains the Nutanix VM associated addresses. - Address type is one of Hostname, ExternalIP, InternalIP, ExternalDNS, - InternalDNS + description: |- + Addresses contains the Nutanix VM associated addresses. + Address type is one of Hostname, ExternalIP, InternalIP, ExternalDNS, InternalDNS items: description: MachineAddress contains information for the node's address. @@ -630,37 +673,37 @@ spec: operational state. properties: lastTransitionTime: - description: Last time the condition transitioned from one status - to another. This should be when the underlying condition changed. - If that is not known, then using the time when the API field - changed is acceptable. + description: |- + Last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when + the API field changed is acceptable. format: date-time type: string message: - description: A human readable message indicating details about - the transition. This field may be empty. + description: |- + A human readable message indicating details about the transition. + This field may be empty. type: string reason: - description: The reason for the condition's last transition - in CamelCase. The specific API may choose whether or not this - field is considered a guaranteed API. This field may not be - empty. + description: |- + The reason for the condition's last transition in CamelCase. + The specific API may choose whether or not this field is considered a guaranteed API. + This field may not be empty. type: string severity: - description: Severity provides an explicit classification of - Reason code, so the users or machines can immediately understand - the current situation and act accordingly. The Severity field - MUST be set only when Status=False. + description: |- + Severity provides an explicit classification of Reason code, so the users or machines can immediately + understand the current situation and act accordingly. + The Severity field MUST be set only when Status=False. type: string status: description: Status of the condition, one of True, False, Unknown. type: string type: - description: Type of condition in CamelCase or in foo.example.com/CamelCase. - Many .condition.type values are consistent across resources - like Available, but because arbitrary conditions can be useful - (see .node.status.conditions), the ability to deconflict is - important. + description: |- + Type of condition in CamelCase or in foo.example.com/CamelCase. + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions + can be useful (see .node.status.conditions), the ability to deconflict is important. type: string required: - lastTransitionTime @@ -682,35 +725,43 @@ spec: description: API version of the referent. type: string fieldPath: - description: 'If referring to a piece of an object instead of - an entire object, this string should contain a valid JSON/Go - field access statement, such as desiredState.manifest.containers[2]. - For example, if the object reference is to a container within - a pod, this would take on a value like: "spec.containers{name}" - (where "name" refers to the name of the container that triggered - the event) or if no container name is specified "spec.containers[2]" - (container with index 2 in this pod). This syntax is chosen - only to have some well-defined way of referencing a part of - an object. TODO: this design is not final and this field is - subject to change in the future.' + description: |- + If referring to a piece of an object instead of an entire object, this string + should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container within a pod, this would take on a value like: + "spec.containers{name}" (where "name" refers to the name of the container that triggered + the event) or if no container name is specified "spec.containers[2]" (container with + index 2 in this pod). This syntax is chosen only to have some well-defined way of + referencing a part of an object. + TODO: this design is not final and this field is subject to change in the future. type: string kind: - description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind of the referent. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string namespace: - description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + description: |- + Namespace of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ type: string resourceVersion: - description: 'Specific resourceVersion to which this reference - is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + description: |- + Specific resourceVersion to which this reference is made, if any. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency type: string uid: - description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' + description: |- + UID of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids type: string type: object + x-kubernetes-map-type: atomic ready: description: Ready is true when the provider resource is ready. type: boolean @@ -723,9 +774,3 @@ spec: storage: true subresources: status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_nutanixmachinetemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_nutanixmachinetemplates.yaml index 2768525a6d..72a5d0b6ee 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_nutanixmachinetemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_nutanixmachinetemplates.yaml @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.8.0 - creationTimestamp: null + controller-gen.kubebuilder.io/version: v0.14.0 name: nutanixmachinetemplates.infrastructure.cluster.x-k8s.io spec: group: infrastructure.cluster.x-k8s.io @@ -26,14 +25,19 @@ spec: API properties: apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources type: string kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string metadata: type: object @@ -45,24 +49,27 @@ spec: to create a NutanixMachine from a template properties: metadata: - description: 'Standard object metadata. Ref: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata' + description: |- + Standard object metadata. + Ref: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata properties: annotations: additionalProperties: type: string - description: 'Annotations is an unstructured key value map - stored with a resource that may be set by external tools - to store and retrieve arbitrary metadata. They are not queryable - and should be preserved when modifying objects. More info: - http://kubernetes.io/docs/user-guide/annotations' + description: |- + Annotations is an unstructured key value map stored with a resource that may be + set by external tools to store and retrieve arbitrary metadata. They are not + queryable and should be preserved when modifying objects. + More info: http://kubernetes.io/docs/user-guide/annotations type: object labels: additionalProperties: type: string - description: 'Map of string keys and values that can be used - to organize and categorize (scope and select) objects. May - match selectors of replication controllers and services. - More info: http://kubernetes.io/docs/user-guide/labels' + description: |- + Map of string keys and values that can be used to organize and categorize + (scope and select) objects. May match selectors of replication controllers + and services. + More info: http://kubernetes.io/docs/user-guide/labels type: object type: object spec: @@ -91,48 +98,56 @@ spec: - uefi type: string bootstrapRef: - description: BootstrapRef is a reference to a bootstrap provider-specific - resource that holds configuration details. + description: |- + BootstrapRef is a reference to a bootstrap provider-specific resource + that holds configuration details. properties: apiVersion: description: API version of the referent. type: string fieldPath: - description: 'If referring to a piece of an object instead - of an entire object, this string should contain a valid - JSON/Go field access statement, such as desiredState.manifest.containers[2]. - For example, if the object reference is to a container - within a pod, this would take on a value like: "spec.containers{name}" - (where "name" refers to the name of the container that - triggered the event) or if no container name is specified - "spec.containers[2]" (container with index 2 in this - pod). This syntax is chosen only to have some well-defined - way of referencing a part of an object. TODO: this design - is not final and this field is subject to change in - the future.' + description: |- + If referring to a piece of an object instead of an entire object, this string + should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container within a pod, this would take on a value like: + "spec.containers{name}" (where "name" refers to the name of the container that triggered + the event) or if no container name is specified "spec.containers[2]" (container with + index 2 in this pod). This syntax is chosen only to have some well-defined way of + referencing a part of an object. + TODO: this design is not final and this field is subject to change in the future. type: string kind: - description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind of the referent. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string namespace: - description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + description: |- + Namespace of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ type: string resourceVersion: - description: 'Specific resourceVersion to which this reference - is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + description: |- + Specific resourceVersion to which this reference is made, if any. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency type: string uid: - description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' + description: |- + UID of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids type: string type: object + x-kubernetes-map-type: atomic cluster: - description: cluster is to identify the cluster (the Prism - Element under management of the Prism Central), in which - the Machine's VM will be created. The cluster identifier - (uuid or name) can be obtained from the Prism Central console + description: |- + cluster is to identify the cluster (the Prism Element under management + of the Prism Central), in which the Machine's VM will be created. + The cluster identifier (uuid or name) can be obtained from the Prism Central console or using the prism_central API. properties: name: @@ -152,10 +167,10 @@ spec: - type type: object image: - description: image is to identify the rhcos image uploaded - to the Prism Central (PC) The image identifier (uuid or - name) can be obtained from the Prism Central console or - using the prism_central API. + description: |- + image is to identify the rhcos image uploaded to the Prism Central (PC) + The image identifier (uuid or name) can be obtained from the Prism Central console + or using the prism_central API. properties: name: description: name is the resource name in the PC @@ -177,8 +192,9 @@ spec: anyOf: - type: integer - type: string - description: memorySize is the memory size (in Quantity format) - of the VM The minimum memorySize is 2Gi bytes + description: |- + memorySize is the memory size (in Quantity format) of the VM + The minimum memorySize is 2Gi bytes pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true project: @@ -204,9 +220,9 @@ spec: providerID: type: string subnet: - description: subnet is to identify the cluster's network subnet - to use for the Machine's VM The cluster identifier (uuid - or name) can be obtained from the Prism Central console + description: |- + subnet is to identify the cluster's network subnet to use for the Machine's VM + The cluster identifier (uuid or name) can be obtained from the Prism Central console or using the prism_central API. items: description: NutanixResourceIdentifier holds the identity @@ -235,9 +251,9 @@ spec: anyOf: - type: integer - type: string - description: systemDiskSize is size (in Quantity format) of - the system disk of the VM The minimum systemDiskSize is - 20Gi bytes + description: |- + systemDiskSize is size (in Quantity format) of the system disk of the VM + The minimum systemDiskSize is 20Gi bytes pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true vcpuSockets: @@ -278,14 +294,19 @@ spec: API properties: apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources type: string kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string metadata: type: object @@ -297,24 +318,27 @@ spec: to create a NutanixMachine from a template properties: metadata: - description: 'Standard object metadata. Ref: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata' + description: |- + Standard object metadata. + Ref: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata properties: annotations: additionalProperties: type: string - description: 'Annotations is an unstructured key value map - stored with a resource that may be set by external tools - to store and retrieve arbitrary metadata. They are not queryable - and should be preserved when modifying objects. More info: - http://kubernetes.io/docs/user-guide/annotations' + description: |- + Annotations is an unstructured key value map stored with a resource that may be + set by external tools to store and retrieve arbitrary metadata. They are not + queryable and should be preserved when modifying objects. + More info: http://kubernetes.io/docs/user-guide/annotations type: object labels: additionalProperties: type: string - description: 'Map of string keys and values that can be used - to organize and categorize (scope and select) objects. May - match selectors of replication controllers and services. - More info: http://kubernetes.io/docs/user-guide/labels' + description: |- + Map of string keys and values that can be used to organize and categorize + (scope and select) objects. May match selectors of replication controllers + and services. + More info: http://kubernetes.io/docs/user-guide/labels type: object type: object spec: @@ -343,48 +367,56 @@ spec: - uefi type: string bootstrapRef: - description: BootstrapRef is a reference to a bootstrap provider-specific - resource that holds configuration details. + description: |- + BootstrapRef is a reference to a bootstrap provider-specific resource + that holds configuration details. properties: apiVersion: description: API version of the referent. type: string fieldPath: - description: 'If referring to a piece of an object instead - of an entire object, this string should contain a valid - JSON/Go field access statement, such as desiredState.manifest.containers[2]. - For example, if the object reference is to a container - within a pod, this would take on a value like: "spec.containers{name}" - (where "name" refers to the name of the container that - triggered the event) or if no container name is specified - "spec.containers[2]" (container with index 2 in this - pod). This syntax is chosen only to have some well-defined - way of referencing a part of an object. TODO: this design - is not final and this field is subject to change in - the future.' + description: |- + If referring to a piece of an object instead of an entire object, this string + should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container within a pod, this would take on a value like: + "spec.containers{name}" (where "name" refers to the name of the container that triggered + the event) or if no container name is specified "spec.containers[2]" (container with + index 2 in this pod). This syntax is chosen only to have some well-defined way of + referencing a part of an object. + TODO: this design is not final and this field is subject to change in the future. type: string kind: - description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind of the referent. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names type: string namespace: - description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + description: |- + Namespace of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ type: string resourceVersion: - description: 'Specific resourceVersion to which this reference - is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + description: |- + Specific resourceVersion to which this reference is made, if any. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency type: string uid: - description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' + description: |- + UID of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids type: string type: object + x-kubernetes-map-type: atomic cluster: - description: cluster is to identify the cluster (the Prism - Element under management of the Prism Central), in which - the Machine's VM will be created. The cluster identifier - (uuid or name) can be obtained from the Prism Central console + description: |- + cluster is to identify the cluster (the Prism Element under management + of the Prism Central), in which the Machine's VM will be created. + The cluster identifier (uuid or name) can be obtained from the Prism Central console or using the prism_central API. properties: name: @@ -427,10 +459,10 @@ spec: type: object type: array image: - description: image is to identify the rhcos image uploaded - to the Prism Central (PC) The image identifier (uuid or - name) can be obtained from the Prism Central console or - using the prism_central API. + description: |- + image is to identify the rhcos image uploaded to the Prism Central (PC) + The image identifier (uuid or name) can be obtained from the Prism Central console + or using the prism_central API. properties: name: description: name is the resource name in the PC @@ -452,8 +484,9 @@ spec: anyOf: - type: integer - type: string - description: memorySize is the memory size (in Quantity format) - of the VM The minimum memorySize is 2Gi bytes + description: |- + memorySize is the memory size (in Quantity format) of the VM + The minimum memorySize is 2Gi bytes pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true project: @@ -479,9 +512,9 @@ spec: providerID: type: string subnet: - description: subnet is to identify the cluster's network subnet - to use for the Machine's VM The cluster identifier (uuid - or name) can be obtained from the Prism Central console + description: |- + subnet is to identify the cluster's network subnet to use for the Machine's VM + The cluster identifier (uuid or name) can be obtained from the Prism Central console or using the prism_central API. items: description: NutanixResourceIdentifier holds the identity @@ -510,9 +543,9 @@ spec: anyOf: - type: integer - type: string - description: systemDiskSize is size (in Quantity format) of - the system disk of the VM The minimum systemDiskSize is - 20Gi bytes + description: |- + systemDiskSize is size (in Quantity format) of the system disk of the VM + The minimum systemDiskSize is 20Gi bytes pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true vcpuSockets: @@ -546,9 +579,3 @@ spec: type: object served: true storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index 2efae7420f..7ad285e195 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -116,8 +116,7 @@ spec: periodSeconds: 10 resources: limits: - cpu: 40m - memory: 60Mi + memory: 100Mi requests: cpu: 30m memory: 50Mi diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index 7c06c82fc4..3cf901078a 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -2,7 +2,6 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: - creationTimestamp: null name: manager-role rules: - apiGroups: diff --git a/controllers/nutanixcluster_controller.go b/controllers/nutanixcluster_controller.go index 171dfe83d5..e57be72bf5 100644 --- a/controllers/nutanixcluster_controller.go +++ b/controllers/nutanixcluster_controller.go @@ -321,6 +321,10 @@ func (r *NutanixClusterReconciler) reconcileCredentialRefDelete(ctx context.Cont } err = r.Client.Get(ctx, secretKey, secret) if err != nil { + if errors.IsNotFound(err) { + log.V(1).Info(fmt.Sprintf("Secret %s in namespace %s for cluster %s not found. Ignoring since object must be deleted", secret.Name, secret.Namespace, nutanixCluster.Name)) + return nil + } return err } ctrlutil.RemoveFinalizer(secret, infrav1.NutanixClusterCredentialFinalizer) @@ -328,10 +332,14 @@ func (r *NutanixClusterReconciler) reconcileCredentialRefDelete(ctx context.Cont if err := r.Client.Update(ctx, secret); err != nil { return err } - log.Info(fmt.Sprintf("removing secret %s in namespace %s for cluster %s", secret.Name, secret.Namespace, nutanixCluster.Name)) - if err := r.Client.Delete(ctx, secret); err != nil { - return err + + if secret.DeletionTimestamp.IsZero() { + log.Info(fmt.Sprintf("removing secret %s in namespace %s for cluster %s", secret.Name, secret.Namespace, nutanixCluster.Name)) + if err := r.Client.Delete(ctx, secret); err != nil { + return err + } } + return nil } diff --git a/go.mod b/go.mod index bc8539d68d..82e34f72d5 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/nutanix-cloud-native/cluster-api-provider-nutanix -go 1.19 +go 1.21 require ( github.com/blang/semver v3.5.1+incompatible @@ -110,12 +110,12 @@ require ( github.com/valyala/fastjson v1.6.3 // indirect go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect - golang.org/x/crypto v0.3.0 // indirect - golang.org/x/net v0.7.0 // indirect + golang.org/x/crypto v0.15.0 // indirect + golang.org/x/net v0.18.0 // indirect golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/term v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect + golang.org/x/sys v0.14.0 // indirect + golang.org/x/term v0.14.0 // indirect + golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9 // indirect gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect google.golang.org/appengine v1.6.7 // indirect diff --git a/go.sum b/go.sum index b7cb3d7168..8e097b6663 100644 --- a/go.sum +++ b/go.sum @@ -62,6 +62,7 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7 github.com/99designs/gqlgen v0.15.1 h1:48bRXecwlCNTa/n2bMSp2rQsXNxwZ54QHbiULNf78ec= github.com/99designs/gqlgen v0.15.1/go.mod h1:nbeSjFkqphIqpZsYe1ULVz0yfH8hjpJdJIQoX/e0G2I= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= +github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs= github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-autorest/autorest v0.11.18/go.mod h1:dSiJPy22c3u0OtOKDNttNgqpNFY/GeWa7GH/Pz56QRA= @@ -221,6 +222,7 @@ github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= +github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= @@ -533,6 +535,7 @@ github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zx github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 h1:dcztxKSvZ4Id8iPpHERQBbIJfabdt4wUm5qy3wOL2Zc= +github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6/go.mod h1:E2VnQOmVuvZB6UYnnDB0qG5Nq/1tD9acaOpo6xmt0Kw= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -542,6 +545,7 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= +github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= @@ -737,6 +741,7 @@ go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= +go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= @@ -762,8 +767,9 @@ golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.3.0 h1:a06MkbcxBrEFc0w0QIZWXrH/9cCX6KJyWbBOIwAn+7A= golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= +golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA= +golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -860,8 +866,8 @@ golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= +golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -986,14 +992,14 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= -golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.14.0 h1:LGK9IlZ8T9jvdy6cTdfKUCltatMFOehAQo9SRC46UQ8= +golang.org/x/term v0.14.0/go.mod h1:TySc+nGkYR6qt8km8wUhuFRTVSMIX3XPR58y2lC8vww= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1004,8 +1010,8 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1301,6 +1307,7 @@ gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.0.3 h1:4AuOwCGf4lLR9u3YOe2awrHygurzhO/HeQ6laiA6Sx0= +gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/hack/ensure-go.sh b/hack/ensure-go.sh index c06edf43cd..cbb16b0229 100755 --- a/hack/ensure-go.sh +++ b/hack/ensure-go.sh @@ -31,7 +31,7 @@ EOF local go_version IFS=" " read -ra go_version <<< "$(go version)" local minimum_go_version - minimum_go_version=go1.18.3 + minimum_go_version=go1.21.4 if [[ "${minimum_go_version}" != $(echo -e "${minimum_go_version}\n${go_version[2]}" | sort -s -t. -k 1,1 -k 2,2n -k 3,3n | head -n1) && "${go_version[2]}" != "devel" ]]; then cat < 0 { - return externalIP, nil - } - if len(internalIP) > 0 { - return internalIP, nil - } - - return "", ErrNoMachineIPAddr -} - // GetNutanixMachinesInCluster gets a cluster's NutanixMachine resources. func (clctx *ClusterContext) GetNutanixMachinesInCluster(client ctlclient.Client) ([]*infrav1.NutanixMachine, error) { clusterName := clctx.NutanixCluster.Name diff --git a/templates/base/cluster-with-kcp.yaml b/templates/base/cluster-with-kcp.yaml index 7854cb05cb..052cf488fb 100644 --- a/templates/base/cluster-with-kcp.yaml +++ b/templates/base/cluster-with-kcp.yaml @@ -81,7 +81,7 @@ spec: spec: containers: - name: kube-vip - image: ghcr.io/kube-vip/kube-vip:v0.6.2 + image: ghcr.io/kube-vip/kube-vip:v0.6.3 imagePullPolicy: IfNotPresent args: - manager diff --git a/templates/cluster-template-ccm.yaml b/templates/cluster-template-ccm.yaml index 59ef13fb8e..b3d4e26bd5 100644 --- a/templates/cluster-template-ccm.yaml +++ b/templates/cluster-template-ccm.yaml @@ -411,7 +411,7 @@ spec: spec: containers: - name: kube-vip - image: ghcr.io/kube-vip/kube-vip:v0.6.2 + image: ghcr.io/kube-vip/kube-vip:v0.6.3 imagePullPolicy: IfNotPresent args: - manager diff --git a/templates/cluster-template-csi.yaml b/templates/cluster-template-csi.yaml index 624db6c29d..3cd034a9c0 100644 --- a/templates/cluster-template-csi.yaml +++ b/templates/cluster-template-csi.yaml @@ -1493,7 +1493,7 @@ spec: spec: containers: - name: kube-vip - image: ghcr.io/kube-vip/kube-vip:v0.6.2 + image: ghcr.io/kube-vip/kube-vip:v0.6.3 imagePullPolicy: IfNotPresent args: - manager diff --git a/templates/cluster-template.yaml b/templates/cluster-template.yaml index 0bf37365ac..c4815008b6 100644 --- a/templates/cluster-template.yaml +++ b/templates/cluster-template.yaml @@ -160,7 +160,7 @@ spec: spec: containers: - name: kube-vip - image: ghcr.io/kube-vip/kube-vip:v0.6.2 + image: ghcr.io/kube-vip/kube-vip:v0.6.3 imagePullPolicy: IfNotPresent args: - manager diff --git a/test/e2e/basic_uuid_test.go b/test/e2e/basic_uuid_test.go index 458fd7aa50..d59587a46f 100644 --- a/test/e2e/basic_uuid_test.go +++ b/test/e2e/basic_uuid_test.go @@ -1,5 +1,4 @@ //go:build e2e -// +build e2e /* Copyright 2022 Nutanix diff --git a/test/e2e/capx_quick_start_test.go b/test/e2e/capx_quick_start_test.go index a1bd93d247..7afc352718 100644 --- a/test/e2e/capx_quick_start_test.go +++ b/test/e2e/capx_quick_start_test.go @@ -1,5 +1,4 @@ //go:build e2e -// +build e2e /* Copyright 2020 The Kubernetes Authors. diff --git a/test/e2e/capx_regression.go b/test/e2e/capx_regression.go new file mode 100644 index 0000000000..33c95e9360 --- /dev/null +++ b/test/e2e/capx_regression.go @@ -0,0 +1,207 @@ +//go:build e2e + +/* +Copyright 2022 Nutanix + +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. +*/ + +package e2e + +import ( + "context" + + infrav1 "github.com/nutanix-cloud-native/cluster-api-provider-nutanix/api/v1beta1" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + corev1 "k8s.io/api/core/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" + "sigs.k8s.io/cluster-api/test/framework" + "sigs.k8s.io/cluster-api/test/framework/clusterctl" + "sigs.k8s.io/controller-runtime/pkg/client" +) + +var _ = Describe("Nutanix regression tests", Label("capx-regression-test", "regression", "slow", "network"), func() { + const specName = "capx-regression" + + var ( + namespace *corev1.Namespace + clusterName string + clusterResources *clusterctl.ApplyClusterTemplateAndWaitResult + cancelWatches context.CancelFunc + testHelper testHelperInterface + ) + + BeforeEach(func() { + Expect(e2eConfig).NotTo(BeNil(), "E2EConfig can't be nil") + + testHelper = newTestHelper(e2eConfig) + clusterName = testHelper.generateTestClusterName(specName) + clusterResources = new(clusterctl.ApplyClusterTemplateAndWaitResult) + + Expect(bootstrapClusterProxy).NotTo(BeNil(), "BootstrapClusterProxy can't be nil") + Expect(artifactFolder).NotTo(BeEmpty(), "ArtifactFolder can't be empty") + + namespace, cancelWatches = setupSpecNamespace(ctx, specName, bootstrapClusterProxy, artifactFolder) + + Expect(clusterctlConfigPath).NotTo(BeEmpty(), "ClusterctlConfigPath can't be empty") + }) + + AfterEach(func() { + bcpClient := bootstrapClusterProxy.GetClient() + myCluster := &clusterv1.Cluster{ + ObjectMeta: metav1.ObjectMeta{ + Name: clusterName, + Namespace: namespace.Name, + }, + } + + // Delete the cluster + // Note: We are not using the framework.DeleteClusterAndWait function here because we want to + // succeed even if the cluster is already deleted. + // This is because the cluster may have been deleted by the test itself, and we don't want to + // fail the test in that case. + Byf("Deleting cluster %s/%s", namespace.Name, clusterName) + Expect(bcpClient.Delete(ctx, myCluster)).To(SatisfyAny(Succeed(), MatchError(ContainSubstring("not found")))) + + Byf("Waiting for cluster %s/%s to be deleted", namespace.Name, clusterName) + framework.WaitForClusterDeleted(ctx, framework.WaitForClusterDeletedInput{ + Getter: bcpClient, + Cluster: myCluster, + }, e2eConfig.GetIntervals(specName, "wait-delete-cluster")...) + + Byf("Deleting namespace used for hosting the %q test spec", specName) + framework.DeleteNamespace(ctx, framework.DeleteNamespaceInput{ + Deleter: bcpClient, + Name: myCluster.Namespace, + }) + + cancelWatches() + }) + + It("[Test regression: credentials-delete-race-regression] Create a cluster and delete the credentials secret before delete the cluster", func() { + Expect(namespace).ToNot(BeNil(), "Namespace can't be nil") + Expect(clusterName).ToNot(BeNil(), "ClusterName can't be nil") + + By("Create and deploy secret using e2e credentials", func() { + up := getBaseAuthCredentials(*e2eConfig) + testHelper.createSecret(createSecretParams{ + username: up.username, + password: up.password, + namespace: namespace, + clusterName: clusterName, + }) + }) + + By("Create and deploy Nutanix cluster", func() { + flavor := clusterctl.DefaultFlavor + + deployParams := deployClusterParams{ + clusterName: clusterName, + namespace: namespace, + flavor: flavor, + clusterctlConfigPath: clusterctlConfigPath, + artifactFolder: artifactFolder, + bootstrapClusterProxy: bootstrapClusterProxy, + } + + testHelper.deployClusterAndWait(deployParams, clusterResources) + }) + + By("Checking cluster credential condition is true", func() { + testHelper.verifyConditionOnNutanixCluster(verifyConditionParams{ + clusterName: clusterName, + namespace: namespace, + bootstrapClusterProxy: bootstrapClusterProxy, + expectedCondition: clusterv1.Condition{ + Type: infrav1.CredentialRefSecretOwnerSetCondition, + Status: corev1.ConditionTrue, + }, + }) + }) + + By("Checking cluster prism client init condition is true", func() { + testHelper.verifyConditionOnNutanixCluster(verifyConditionParams{ + clusterName: clusterName, + namespace: namespace, + bootstrapClusterProxy: bootstrapClusterProxy, + expectedCondition: clusterv1.Condition{ + Type: infrav1.PrismCentralClientCondition, + Status: corev1.ConditionTrue, + }, + }) + }) + + By("Dumping cluster resources", func() { + dumpSpecResourcesAndCleanup(ctx, specName, bootstrapClusterProxy, artifactFolder, namespace, cancelWatches, clusterResources.Cluster, e2eConfig.GetIntervals, true) + }) + + By("Deleting the secret", func() { + testHelper.deleteSecret(deleteSecretParams{ + namespace: namespace, + clusterName: clusterName, + }) + }) + + By("Deleting the cluster", func() { + Byf("Deleting cluster %s/%s", namespace.Name, clusterName) + framework.DeleteCluster(ctx, framework.DeleteClusterInput{ + Deleter: bootstrapClusterProxy.GetClient(), + Cluster: &clusterv1.Cluster{ + ObjectMeta: metav1.ObjectMeta{ + Name: clusterName, + Namespace: namespace.Name, + }, + }, + }) + + Byf("Waiting for cluster %s/%s to be deleted", namespace.Name, clusterName) + framework.WaitForClusterDeleted(ctx, framework.WaitForClusterDeletedInput{ + Getter: bootstrapClusterProxy.GetClient(), + Cluster: &clusterv1.Cluster{ + ObjectMeta: metav1.ObjectMeta{ + Name: clusterName, + Namespace: namespace.Name, + }, + }, + }, e2eConfig.GetIntervals(specName, "wait-delete-cluster")...) + }) + + // Check if secret is deleted + By("Checking if secret is deleted", func() { + err := bootstrapClusterProxy.GetClient().Get(ctx, + client.ObjectKey{ + Name: clusterName, + Namespace: namespace.Name, + }, &corev1.Secret{}) + Expect(err).To(HaveOccurred()) + Expect(apierrors.IsNotFound(err)).To(BeTrue()) + }) + + // Check if cluster is deleted + By("Checking if cluster is deleted", func() { + err := bootstrapClusterProxy.GetClient().Get(ctx, + client.ObjectKey{ + Name: clusterName, + Namespace: namespace.Name, + }, &clusterv1.Cluster{}) + Expect(err).To(HaveOccurred()) + Expect(apierrors.IsNotFound(err)).To(BeTrue()) + }) + + By("PASSED!") + }) +}) diff --git a/test/e2e/categories_test.go b/test/e2e/categories_test.go index a7ff7664bd..bb49fcb35b 100644 --- a/test/e2e/categories_test.go +++ b/test/e2e/categories_test.go @@ -1,5 +1,4 @@ //go:build e2e -// +build e2e /* Copyright 2022 Nutanix diff --git a/test/e2e/ccm_test.go b/test/e2e/ccm_test.go index 21f08004dd..60847e3301 100644 --- a/test/e2e/ccm_test.go +++ b/test/e2e/ccm_test.go @@ -1,5 +1,4 @@ //go:build e2e -// +build e2e /* Copyright 2022 Nutanix diff --git a/test/e2e/cluster_upgrade_test.go b/test/e2e/cluster_upgrade_test.go index 3258a0db43..a2f0ef511e 100644 --- a/test/e2e/cluster_upgrade_test.go +++ b/test/e2e/cluster_upgrade_test.go @@ -1,5 +1,4 @@ //go:build e2e -// +build e2e /* Copyright 2022 Nutanix, Inc diff --git a/test/e2e/clusterctl_upgrade_test.go b/test/e2e/clusterctl_upgrade_test.go index 2f64db9420..d02c8db526 100644 --- a/test/e2e/clusterctl_upgrade_test.go +++ b/test/e2e/clusterctl_upgrade_test.go @@ -1,5 +1,4 @@ //go:build e2e -// +build e2e /* Copyright 2020 The Kubernetes Authors. diff --git a/test/e2e/common.go b/test/e2e/common.go index df0aa96698..7aaefd828b 100644 --- a/test/e2e/common.go +++ b/test/e2e/common.go @@ -1,3 +1,5 @@ +//go:build e2e + /* Copyright 2020 The Kubernetes Authors. diff --git a/test/e2e/csi_test.go b/test/e2e/csi_test.go index 1f00e88286..46acfba427 100644 --- a/test/e2e/csi_test.go +++ b/test/e2e/csi_test.go @@ -1,5 +1,4 @@ //go:build e2e -// +build e2e /* Copyright 2022 Nutanix diff --git a/test/e2e/data/cni/cilium/cilium-no-kubeproxy.yaml b/test/e2e/data/cni/cilium/cilium-no-kubeproxy.yaml new file mode 100644 index 0000000000..598b4c6122 --- /dev/null +++ b/test/e2e/data/cni/cilium/cilium-no-kubeproxy.yaml @@ -0,0 +1,1056 @@ +--- +# Source: cilium/templates/cilium-agent/serviceaccount.yaml +apiVersion: v1 +kind: ServiceAccount +metadata: + name: "cilium" + namespace: kube-system +--- +# Source: cilium/templates/cilium-operator/serviceaccount.yaml +apiVersion: v1 +kind: ServiceAccount +metadata: + name: "cilium-operator" + namespace: kube-system +--- +# Source: cilium/templates/cilium-configmap.yaml +apiVersion: v1 +kind: ConfigMap +metadata: + name: cilium-config + namespace: kube-system +data: + + # Identity allocation mode selects how identities are shared between cilium + # nodes by setting how they are stored. The options are "crd" or "kvstore". + # - "crd" stores identities in kubernetes as CRDs (custom resource definition). + # These can be queried with: + # kubectl get ciliumid + # - "kvstore" stores identities in an etcd kvstore, that is + # configured below. Cilium versions before 1.6 supported only the kvstore + # backend. Upgrades from these older cilium versions should continue using + # the kvstore by commenting out the identity-allocation-mode below, or + # setting it to "kvstore". + identity-allocation-mode: crd + identity-heartbeat-timeout: "30m0s" + identity-gc-interval: "15m0s" + cilium-endpoint-gc-interval: "5m0s" + nodes-gc-interval: "5m0s" + skip-cnp-status-startup-clean: "false" + # Disable the usage of CiliumEndpoint CRD + disable-endpoint-crd: "false" + + # If you want to run cilium in debug mode change this value to true + debug: "false" + debug-verbose: "" + # The agent can be put into the following three policy enforcement modes + # default, always and never. + # https://docs.cilium.io/en/latest/security/policy/intro/#policy-enforcement-modes + enable-policy: "default" + + # Enable IPv4 addressing. If enabled, all endpoints are allocated an IPv4 + # address. + enable-ipv4: "true" + + # Enable IPv6 addressing. If enabled, all endpoints are allocated an IPv6 + # address. + enable-ipv6: "false" + # Users who wish to specify their own custom CNI configuration file must set + # custom-cni-conf to "true", otherwise Cilium may overwrite the configuration. + custom-cni-conf: "false" + enable-bpf-clock-probe: "true" + # If you want cilium monitor to aggregate tracing for packets, set this level + # to "low", "medium", or "maximum". The higher the level, the less packets + # that will be seen in monitor output. + monitor-aggregation: medium + + # The monitor aggregation interval governs the typical time between monitor + # notification events for each allowed connection. + # + # Only effective when monitor aggregation is set to "medium" or higher. + monitor-aggregation-interval: "5s" + + # The monitor aggregation flags determine which TCP flags which, upon the + # first observation, cause monitor notifications to be generated. + # + # Only effective when monitor aggregation is set to "medium" or higher. + monitor-aggregation-flags: all + # Specifies the ratio (0.0-1.0] of total system memory to use for dynamic + # sizing of the TCP CT, non-TCP CT, NAT and policy BPF maps. + bpf-map-dynamic-size-ratio: "0.0025" + # bpf-policy-map-max specifies the maximum number of entries in endpoint + # policy map (per endpoint) + bpf-policy-map-max: "16384" + # bpf-lb-map-max specifies the maximum number of entries in bpf lb service, + # backend and affinity maps. + bpf-lb-map-max: "65536" + bpf-lb-external-clusterip: "false" + + # Pre-allocation of map entries allows per-packet latency to be reduced, at + # the expense of up-front memory allocation for the entries in the maps. The + # default value below will minimize memory usage in the default installation; + # users who are sensitive to latency may consider setting this to "true". + # + # This option was introduced in Cilium 1.4. Cilium 1.3 and earlier ignore + # this option and behave as though it is set to "true". + # + # If this value is modified, then during the next Cilium startup the restore + # of existing endpoints and tracking of ongoing connections may be disrupted. + # As a result, reply packets may be dropped and the load-balancing decisions + # for established connections may change. + # + # If this option is set to "false" during an upgrade from 1.3 or earlier to + # 1.4 or later, then it may cause one-time disruptions during the upgrade. + preallocate-bpf-maps: "false" + + # Regular expression matching compatible Istio sidecar istio-proxy + # container image names + sidecar-istio-proxy-image: "cilium/istio_proxy" + + # Name of the cluster. Only relevant when building a mesh of clusters. + cluster-name: default + # Unique ID of the cluster. Must be unique across all conneted clusters and + # in the range of 1 and 255. Only relevant when building a mesh of clusters. + cluster-id: "0" + + # Encapsulation mode for communication between nodes + # Possible values: + # - disabled + # - vxlan (default) + # - geneve + tunnel: "vxlan" + + + # Enables L7 proxy for L7 policy enforcement and visibility + enable-l7-proxy: "true" + + enable-ipv4-masquerade: "true" + enable-ipv6-big-tcp: "false" + enable-ipv6-masquerade: "true" + + enable-xt-socket-fallback: "true" + install-iptables-rules: "true" + install-no-conntrack-iptables-rules: "false" + + auto-direct-node-routes: "false" + enable-local-redirect-policy: "false" + + kube-proxy-replacement: "true" + bpf-lb-sock: "false" + enable-health-check-nodeport: "true" + node-port-bind-protection: "true" + enable-auto-protect-node-port-range: "true" + enable-svc-source-range-check: "true" + enable-l2-neigh-discovery: "true" + arping-refresh-period: "30s" + enable-endpoint-health-checking: "true" + enable-health-checking: "true" + enable-well-known-identities: "false" + enable-remote-node-identity: "true" + synchronize-k8s-nodes: "true" + operator-api-serve-addr: "127.0.0.1:9234" + ipam: "cluster-pool" + cluster-pool-ipv4-cidr: "10.0.0.0/8" + cluster-pool-ipv4-mask-size: "24" + disable-cnp-status-updates: "true" + enable-vtep: "false" + vtep-endpoint: "" + vtep-cidr: "" + vtep-mask: "" + vtep-mac: "" + enable-bgp-control-plane: "false" + procfs: "/host/proc" + bpf-root: "/sys/fs/bpf" + cgroup-root: "/run/cilium/cgroupv2" + enable-k8s-terminating-endpoint: "true" + enable-sctp: "false" + remove-cilium-node-taints: "true" + set-cilium-is-up-condition: "true" + unmanaged-pod-watcher-interval: "15" + tofqdns-dns-reject-response-code: "refused" + tofqdns-enable-dns-compression: "true" + tofqdns-endpoint-max-ip-per-hostname: "50" + tofqdns-idle-connection-grace-period: "0s" + tofqdns-max-deferred-connection-deletes: "10000" + tofqdns-min-ttl: "3600" + tofqdns-proxy-response-max-delay: "100ms" + agent-not-ready-taint-key: "node.cilium.io/agent-not-ready" +--- +# Source: cilium/templates/cilium-agent/clusterrole.yaml +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: cilium + labels: + app.kubernetes.io/part-of: cilium +rules: +- apiGroups: + - networking.k8s.io + resources: + - networkpolicies + verbs: + - get + - list + - watch +- apiGroups: + - discovery.k8s.io + resources: + - endpointslices + verbs: + - get + - list + - watch +- apiGroups: + - "" + resources: + - namespaces + - services + - pods + - endpoints + - nodes + verbs: + - get + - list + - watch +- apiGroups: + - apiextensions.k8s.io + resources: + - customresourcedefinitions + verbs: + - list + - watch + # This is used when validating policies in preflight. This will need to stay + # until we figure out how to avoid "get" inside the preflight, and then + # should be removed ideally. + - get +- apiGroups: + - cilium.io + resources: + - ciliumloadbalancerippools + - ciliumbgppeeringpolicies + - ciliumclusterwideenvoyconfigs + - ciliumclusterwidenetworkpolicies + - ciliumegressgatewaypolicies + - ciliumendpoints + - ciliumendpointslices + - ciliumenvoyconfigs + - ciliumidentities + - ciliumlocalredirectpolicies + - ciliumnetworkpolicies + - ciliumnodes + - ciliumnodeconfigs + verbs: + - list + - watch +- apiGroups: + - cilium.io + resources: + - ciliumidentities + - ciliumendpoints + - ciliumnodes + verbs: + - create +- apiGroups: + - cilium.io + # To synchronize garbage collection of such resources + resources: + - ciliumidentities + verbs: + - update +- apiGroups: + - cilium.io + resources: + - ciliumendpoints + verbs: + - delete + - get +- apiGroups: + - cilium.io + resources: + - ciliumnodes + - ciliumnodes/status + verbs: + - get + - update +- apiGroups: + - cilium.io + resources: + - ciliumnetworkpolicies/status + - ciliumclusterwidenetworkpolicies/status + - ciliumendpoints/status + - ciliumendpoints + verbs: + - patch +--- +# Source: cilium/templates/cilium-operator/clusterrole.yaml +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: cilium-operator + labels: + app.kubernetes.io/part-of: cilium +rules: +- apiGroups: + - "" + resources: + - pods + verbs: + - get + - list + - watch + # to automatically delete [core|kube]dns pods so that are starting to being + # managed by Cilium + - delete +- apiGroups: + - "" + resources: + - nodes + verbs: + - list + - watch +- apiGroups: + - "" + resources: + # To remove node taints + - nodes + # To set NetworkUnavailable false on startup + - nodes/status + verbs: + - patch +- apiGroups: + - discovery.k8s.io + resources: + - endpointslices + verbs: + - get + - list + - watch +- apiGroups: + - "" + resources: + # to perform LB IP allocation for BGP + - services/status + verbs: + - update + - patch +- apiGroups: + - "" + resources: + # to check apiserver connectivity + - namespaces + verbs: + - get + - list + - watch +- apiGroups: + - "" + resources: + # to perform the translation of a CNP that contains `ToGroup` to its endpoints + - services + - endpoints + verbs: + - get + - list + - watch +- apiGroups: + - cilium.io + resources: + - ciliumnetworkpolicies + - ciliumclusterwidenetworkpolicies + verbs: + # Create auto-generated CNPs and CCNPs from Policies that have 'toGroups' + - create + - update + - deletecollection + # To update the status of the CNPs and CCNPs + - patch + - get + - list + - watch +- apiGroups: + - cilium.io + resources: + - ciliumnetworkpolicies/status + - ciliumclusterwidenetworkpolicies/status + verbs: + # Update the auto-generated CNPs and CCNPs status. + - patch + - update +- apiGroups: + - cilium.io + resources: + - ciliumendpoints + - ciliumidentities + verbs: + # To perform garbage collection of such resources + - delete + - list + - watch +- apiGroups: + - cilium.io + resources: + - ciliumidentities + verbs: + # To synchronize garbage collection of such resources + - update +- apiGroups: + - cilium.io + resources: + - ciliumnodes + verbs: + - create + - update + - get + - list + - watch + # To perform CiliumNode garbage collector + - delete +- apiGroups: + - cilium.io + resources: + - ciliumnodes/status + verbs: + - update +- apiGroups: + - cilium.io + resources: + - ciliumendpointslices + - ciliumenvoyconfigs + verbs: + - create + - update + - get + - list + - watch + - delete + - patch +- apiGroups: + - apiextensions.k8s.io + resources: + - customresourcedefinitions + verbs: + - create + - get + - list + - watch +- apiGroups: + - apiextensions.k8s.io + resources: + - customresourcedefinitions + verbs: + - update + resourceNames: + - ciliumloadbalancerippools.cilium.io + - ciliumbgppeeringpolicies.cilium.io + - ciliumclusterwideenvoyconfigs.cilium.io + - ciliumclusterwidenetworkpolicies.cilium.io + - ciliumegressgatewaypolicies.cilium.io + - ciliumendpoints.cilium.io + - ciliumendpointslices.cilium.io + - ciliumenvoyconfigs.cilium.io + - ciliumexternalworkloads.cilium.io + - ciliumidentities.cilium.io + - ciliumlocalredirectpolicies.cilium.io + - ciliumnetworkpolicies.cilium.io + - ciliumnodes.cilium.io + - ciliumnodeconfigs.cilium.io +- apiGroups: + - cilium.io + resources: + - ciliumloadbalancerippools + verbs: + - get + - list + - watch +- apiGroups: + - cilium.io + resources: + - ciliumloadbalancerippools/status + verbs: + - patch +# For cilium-operator running in HA mode. +# +# Cilium operator running in HA mode requires the use of ResourceLock for Leader Election +# between multiple running instances. +# The preferred way of doing this is to use LeasesResourceLock as edits to Leases are less +# common and fewer objects in the cluster watch "all Leases". +- apiGroups: + - coordination.k8s.io + resources: + - leases + verbs: + - create + - get + - update +--- +# Source: cilium/templates/cilium-agent/clusterrolebinding.yaml +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: cilium + labels: + app.kubernetes.io/part-of: cilium +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: cilium +subjects: +- kind: ServiceAccount + name: "cilium" + namespace: kube-system +--- +# Source: cilium/templates/cilium-operator/clusterrolebinding.yaml +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: cilium-operator + labels: + app.kubernetes.io/part-of: cilium +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: cilium-operator +subjects: +- kind: ServiceAccount + name: "cilium-operator" + namespace: kube-system +--- +# Source: cilium/templates/cilium-agent/role.yaml +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: cilium-config-agent + namespace: kube-system + labels: + app.kubernetes.io/part-of: cilium +rules: +- apiGroups: + - "" + resources: + - configmaps + verbs: + - get + - list + - watch +--- +# Source: cilium/templates/cilium-agent/rolebinding.yaml +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: cilium-config-agent + namespace: kube-system + labels: + app.kubernetes.io/part-of: cilium +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: cilium-config-agent +subjects: + - kind: ServiceAccount + name: "cilium" + namespace: kube-system +--- +# Source: cilium/templates/cilium-agent/daemonset.yaml +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: cilium + namespace: kube-system + labels: + k8s-app: cilium + app.kubernetes.io/part-of: cilium + app.kubernetes.io/name: cilium-agent +spec: + selector: + matchLabels: + k8s-app: cilium + updateStrategy: + rollingUpdate: + maxUnavailable: 2 + type: RollingUpdate + template: + metadata: + annotations: + # Set app AppArmor's profile to "unconfined". The value of this annotation + # can be modified as long users know which profiles they have available + # in AppArmor. + container.apparmor.security.beta.kubernetes.io/cilium-agent: "unconfined" + container.apparmor.security.beta.kubernetes.io/clean-cilium-state: "unconfined" + container.apparmor.security.beta.kubernetes.io/mount-cgroup: "unconfined" + container.apparmor.security.beta.kubernetes.io/apply-sysctl-overwrites: "unconfined" + labels: + k8s-app: cilium + app.kubernetes.io/name: cilium-agent + app.kubernetes.io/part-of: cilium + spec: + containers: + - name: cilium-agent + image: "quay.io/cilium/cilium:v1.13.0@sha256:6544a3441b086a2e09005d3e21d1a4afb216fae19c5a60b35793c8a9438f8f68" + imagePullPolicy: IfNotPresent + command: + - cilium-agent + args: + - --config-dir=/tmp/cilium/config-map + startupProbe: + httpGet: + host: "127.0.0.1" + path: /healthz + port: 9879 + scheme: HTTP + httpHeaders: + - name: "brief" + value: "true" + failureThreshold: 105 + periodSeconds: 2 + successThreshold: 1 + livenessProbe: + httpGet: + host: "127.0.0.1" + path: /healthz + port: 9879 + scheme: HTTP + httpHeaders: + - name: "brief" + value: "true" + periodSeconds: 30 + successThreshold: 1 + failureThreshold: 10 + timeoutSeconds: 5 + readinessProbe: + httpGet: + host: "127.0.0.1" + path: /healthz + port: 9879 + scheme: HTTP + httpHeaders: + - name: "brief" + value: "true" + periodSeconds: 30 + successThreshold: 1 + failureThreshold: 3 + timeoutSeconds: 5 + env: + - name: K8S_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + - name: CILIUM_K8S_NAMESPACE + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + - name: CILIUM_CLUSTERMESH_CONFIG + value: /var/lib/cilium/clustermesh/ + - name: CILIUM_CNI_CHAINING_MODE + valueFrom: + configMapKeyRef: + name: cilium-config + key: cni-chaining-mode + optional: true + - name: CILIUM_CUSTOM_CNI_CONF + valueFrom: + configMapKeyRef: + name: cilium-config + key: custom-cni-conf + optional: true + lifecycle: + postStart: + exec: + command: + - "/cni-install.sh" + - "--enable-debug=false" + - "--cni-exclusive=true" + - "--log-file=/var/run/cilium/cilium-cni.log" + preStop: + exec: + command: + - /cni-uninstall.sh + securityContext: + seLinuxOptions: + level: s0 + type: spc_t + capabilities: + add: + - CHOWN + - KILL + - NET_ADMIN + - NET_RAW + - IPC_LOCK + - SYS_MODULE + - SYS_ADMIN + - SYS_RESOURCE + - DAC_OVERRIDE + - FOWNER + - SETGID + - SETUID + drop: + - ALL + terminationMessagePolicy: FallbackToLogsOnError + volumeMounts: + # Unprivileged containers need to mount /proc/sys/net from the host + # to have write access + - mountPath: /host/proc/sys/net + name: host-proc-sys-net + # Unprivileged containers need to mount /proc/sys/kernel from the host + # to have write access + - mountPath: /host/proc/sys/kernel + name: host-proc-sys-kernel + - name: bpf-maps + mountPath: /sys/fs/bpf + # Unprivileged containers can't set mount propagation to bidirectional + # in this case we will mount the bpf fs from an init container that + # is privileged and set the mount propagation from host to container + # in Cilium. + mountPropagation: HostToContainer + - name: cilium-run + mountPath: /var/run/cilium + - name: cni-path + mountPath: /host/opt/cni/bin + - name: etc-cni-netd + mountPath: /host/etc/cni/net.d + - name: clustermesh-secrets + mountPath: /var/lib/cilium/clustermesh + readOnly: true + # Needed to be able to load kernel modules + - name: lib-modules + mountPath: /lib/modules + readOnly: true + - name: xtables-lock + mountPath: /run/xtables.lock + - name: tmp + mountPath: /tmp + initContainers: + - name: config + image: "quay.io/cilium/cilium:v1.13.0@sha256:6544a3441b086a2e09005d3e21d1a4afb216fae19c5a60b35793c8a9438f8f68" + imagePullPolicy: IfNotPresent + command: + - cilium + - build-config + env: + - name: K8S_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + - name: CILIUM_K8S_NAMESPACE + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + volumeMounts: + - name: tmp + mountPath: /tmp + terminationMessagePolicy: FallbackToLogsOnError + # Required to mount cgroup2 filesystem on the underlying Kubernetes node. + # We use nsenter command with host's cgroup and mount namespaces enabled. + - name: mount-cgroup + image: "quay.io/cilium/cilium:v1.13.0@sha256:6544a3441b086a2e09005d3e21d1a4afb216fae19c5a60b35793c8a9438f8f68" + imagePullPolicy: IfNotPresent + env: + - name: CGROUP_ROOT + value: /run/cilium/cgroupv2 + - name: BIN_PATH + value: /opt/cni/bin + command: + - sh + - -ec + # The statically linked Go program binary is invoked to avoid any + # dependency on utilities like sh and mount that can be missing on certain + # distros installed on the underlying host. Copy the binary to the + # same directory where we install cilium cni plugin so that exec permissions + # are available. + - | + cp /usr/bin/cilium-mount /hostbin/cilium-mount; + nsenter --cgroup=/hostproc/1/ns/cgroup --mount=/hostproc/1/ns/mnt "$BIN_PATH/cilium-mount" $CGROUP_ROOT; + rm /hostbin/cilium-mount + volumeMounts: + - name: hostproc + mountPath: /hostproc + - name: cni-path + mountPath: /hostbin + terminationMessagePolicy: FallbackToLogsOnError + securityContext: + seLinuxOptions: + level: s0 + type: spc_t + capabilities: + add: + - SYS_ADMIN + - SYS_CHROOT + - SYS_PTRACE + drop: + - ALL + - name: apply-sysctl-overwrites + image: "quay.io/cilium/cilium:v1.13.0@sha256:6544a3441b086a2e09005d3e21d1a4afb216fae19c5a60b35793c8a9438f8f68" + imagePullPolicy: IfNotPresent + env: + - name: BIN_PATH + value: /opt/cni/bin + command: + - sh + - -ec + # The statically linked Go program binary is invoked to avoid any + # dependency on utilities like sh that can be missing on certain + # distros installed on the underlying host. Copy the binary to the + # same directory where we install cilium cni plugin so that exec permissions + # are available. + - | + cp /usr/bin/cilium-sysctlfix /hostbin/cilium-sysctlfix; + nsenter --mount=/hostproc/1/ns/mnt "$BIN_PATH/cilium-sysctlfix"; + rm /hostbin/cilium-sysctlfix + volumeMounts: + - name: hostproc + mountPath: /hostproc + - name: cni-path + mountPath: /hostbin + terminationMessagePolicy: FallbackToLogsOnError + securityContext: + seLinuxOptions: + level: s0 + type: spc_t + capabilities: + add: + - SYS_ADMIN + - SYS_CHROOT + - SYS_PTRACE + drop: + - ALL + # Mount the bpf fs if it is not mounted. We will perform this task + # from a privileged container because the mount propagation bidirectional + # only works from privileged containers. + - name: mount-bpf-fs + image: "quay.io/cilium/cilium:v1.13.0@sha256:6544a3441b086a2e09005d3e21d1a4afb216fae19c5a60b35793c8a9438f8f68" + imagePullPolicy: IfNotPresent + args: + - 'mount | grep "/sys/fs/bpf type bpf" || mount -t bpf bpf /sys/fs/bpf' + command: + - /bin/bash + - -c + - -- + terminationMessagePolicy: FallbackToLogsOnError + securityContext: + privileged: true + volumeMounts: + - name: bpf-maps + mountPath: /sys/fs/bpf + mountPropagation: Bidirectional + - name: clean-cilium-state + image: "quay.io/cilium/cilium:v1.13.0@sha256:6544a3441b086a2e09005d3e21d1a4afb216fae19c5a60b35793c8a9438f8f68" + imagePullPolicy: IfNotPresent + command: + - /init-container.sh + env: + - name: CILIUM_ALL_STATE + valueFrom: + configMapKeyRef: + name: cilium-config + key: clean-cilium-state + optional: true + - name: CILIUM_BPF_STATE + valueFrom: + configMapKeyRef: + name: cilium-config + key: clean-cilium-bpf-state + optional: true + terminationMessagePolicy: FallbackToLogsOnError + securityContext: + seLinuxOptions: + level: s0 + type: spc_t + capabilities: + add: + - NET_ADMIN + - SYS_MODULE + - SYS_ADMIN + - SYS_RESOURCE + drop: + - ALL + volumeMounts: + - name: bpf-maps + mountPath: /sys/fs/bpf + # Required to mount cgroup filesystem from the host to cilium agent pod + - name: cilium-cgroup + mountPath: /run/cilium/cgroupv2 + mountPropagation: HostToContainer + - name: cilium-run + mountPath: /var/run/cilium + resources: + requests: + cpu: 100m + memory: 100Mi # wait-for-kube-proxy + restartPolicy: Always + priorityClassName: system-node-critical + serviceAccount: "cilium" + serviceAccountName: "cilium" + terminationGracePeriodSeconds: 1 + hostNetwork: true + affinity: + podAntiAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchLabels: + k8s-app: cilium + topologyKey: kubernetes.io/hostname + nodeSelector: + kubernetes.io/os: linux + tolerations: + - operator: Exists + volumes: + # For sharing configuration between the "config" initContainer and the agent + - name: tmp + emptyDir: {} + # To keep state between restarts / upgrades + - name: cilium-run + hostPath: + path: /var/run/cilium + type: DirectoryOrCreate + # To keep state between restarts / upgrades for bpf maps + - name: bpf-maps + hostPath: + path: /sys/fs/bpf + type: DirectoryOrCreate + # To mount cgroup2 filesystem on the host + - name: hostproc + hostPath: + path: /proc + type: Directory + # To keep state between restarts / upgrades for cgroup2 filesystem + - name: cilium-cgroup + hostPath: + path: /run/cilium/cgroupv2 + type: DirectoryOrCreate + # To install cilium cni plugin in the host + - name: cni-path + hostPath: + path: /opt/cni/bin + type: DirectoryOrCreate + # To install cilium cni configuration in the host + - name: etc-cni-netd + hostPath: + path: /etc/cni/net.d + type: DirectoryOrCreate + # To be able to load kernel modules + - name: lib-modules + hostPath: + path: /lib/modules + # To access iptables concurrently with other processes (e.g. kube-proxy) + - name: xtables-lock + hostPath: + path: /run/xtables.lock + type: FileOrCreate + # To read the clustermesh configuration + - name: clustermesh-secrets + secret: + secretName: cilium-clustermesh + # note: the leading zero means this number is in octal representation: do not remove it + defaultMode: 0400 + optional: true + - name: host-proc-sys-net + hostPath: + path: /proc/sys/net + type: Directory + - name: host-proc-sys-kernel + hostPath: + path: /proc/sys/kernel + type: Directory +--- +# Source: cilium/templates/cilium-operator/deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: cilium-operator + namespace: kube-system + labels: + io.cilium/app: operator + name: cilium-operator + app.kubernetes.io/part-of: cilium + app.kubernetes.io/name: cilium-operator +spec: + # See docs on ServerCapabilities.LeasesResourceLock in file pkg/k8s/version/version.go + # for more details. + replicas: 2 + selector: + matchLabels: + io.cilium/app: operator + name: cilium-operator + strategy: + rollingUpdate: + maxSurge: 1 + maxUnavailable: 1 + type: RollingUpdate + template: + metadata: + annotations: + labels: + io.cilium/app: operator + name: cilium-operator + app.kubernetes.io/part-of: cilium + app.kubernetes.io/name: cilium-operator + spec: + containers: + - name: cilium-operator + image: "quay.io/cilium/operator-generic:v1.13.0@sha256:4b58d5b33e53378355f6e8ceb525ccf938b7b6f5384b35373f1f46787467ebf5" + imagePullPolicy: IfNotPresent + command: + - cilium-operator-generic + args: + - --config-dir=/tmp/cilium/config-map + - --debug=$(CILIUM_DEBUG) + env: + - name: K8S_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + - name: CILIUM_K8S_NAMESPACE + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + - name: CILIUM_DEBUG + valueFrom: + configMapKeyRef: + key: debug + name: cilium-config + optional: true + livenessProbe: + httpGet: + host: "127.0.0.1" + path: /healthz + port: 9234 + scheme: HTTP + initialDelaySeconds: 60 + periodSeconds: 10 + timeoutSeconds: 3 + volumeMounts: + - name: cilium-config-path + mountPath: /tmp/cilium/config-map + readOnly: true + terminationMessagePolicy: FallbackToLogsOnError + hostNetwork: true + restartPolicy: Always + priorityClassName: system-cluster-critical + serviceAccount: "cilium-operator" + serviceAccountName: "cilium-operator" + # In HA mode, cilium-operator pods must not be scheduled on the same + # node as they will clash with each other. + affinity: + podAntiAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchLabels: + io.cilium/app: operator + topologyKey: kubernetes.io/hostname + nodeSelector: + kubernetes.io/os: linux + tolerations: + - operator: Exists + volumes: + # To read the configuration from the config map + - name: cilium-config-path + configMap: + name: cilium-config +--- +# Source: cilium/templates/cilium-secrets-namespace.yaml +# Only create the namespace if it's different from Ingress secret namespace or Ingress is not enabled. diff --git a/test/e2e/data/infrastructure-nutanix/v1alpha4/no-kubeproxy/cluster-template/kustomization.yaml b/test/e2e/data/infrastructure-nutanix/v1alpha4/no-kubeproxy/cluster-template/kustomization.yaml new file mode 100644 index 0000000000..924f81da23 --- /dev/null +++ b/test/e2e/data/infrastructure-nutanix/v1alpha4/no-kubeproxy/cluster-template/kustomization.yaml @@ -0,0 +1,5 @@ +bases: + - ../../cluster-template/ + +patchesStrategicMerge: + - ../no-kubeproxy.yaml \ No newline at end of file diff --git a/test/e2e/data/infrastructure-nutanix/v1alpha4/no-kubeproxy/no-kubeproxy.yaml b/test/e2e/data/infrastructure-nutanix/v1alpha4/no-kubeproxy/no-kubeproxy.yaml new file mode 100644 index 0000000000..ba5b499816 --- /dev/null +++ b/test/e2e/data/infrastructure-nutanix/v1alpha4/no-kubeproxy/no-kubeproxy.yaml @@ -0,0 +1,23 @@ +--- +apiVersion: controlplane.cluster.x-k8s.io/v1alpha4 +kind: KubeadmControlPlane +metadata: + name: "${CLUSTER_NAME}-kcp" + namespace: "${NAMESPACE}" +spec: + kubeadmConfigSpec: + initConfiguration: + skipPhases: + - addon/kube-proxy +--- +apiVersion: bootstrap.cluster.x-k8s.io/v1alpha4 +kind: KubeadmConfigTemplate +metadata: + name: "${CLUSTER_NAME}-kcfg-0" + namespace: "${NAMESPACE}" +spec: + template: + spec: + initConfiguration: + skipPhases: + - addon/kube-proxy diff --git a/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-additional-categories/kustomization.yaml b/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-additional-categories/kustomization.yaml new file mode 100644 index 0000000000..ec257a72f6 --- /dev/null +++ b/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-additional-categories/kustomization.yaml @@ -0,0 +1,5 @@ +bases: + - ../../cluster-template-additional-categories/ + +patchesStrategicMerge: + - ../no-kubeproxy.yaml diff --git a/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-ccm/kustomization.yaml b/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-ccm/kustomization.yaml new file mode 100644 index 0000000000..2f3f12d1c1 --- /dev/null +++ b/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-ccm/kustomization.yaml @@ -0,0 +1,5 @@ +bases: + - ../../cluster-template-ccm/ + +patchesStrategicMerge: + - ../no-kubeproxy.yaml diff --git a/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-csi/kustomization.yaml b/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-csi/kustomization.yaml new file mode 100644 index 0000000000..40a17254a2 --- /dev/null +++ b/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-csi/kustomization.yaml @@ -0,0 +1,5 @@ +bases: + - ../../cluster-template-csi/ + +patchesStrategicMerge: + - ../no-kubeproxy.yaml diff --git a/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-kcp-remediation/kustomization.yaml b/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-kcp-remediation/kustomization.yaml new file mode 100644 index 0000000000..9bc9f28b01 --- /dev/null +++ b/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-kcp-remediation/kustomization.yaml @@ -0,0 +1,5 @@ +bases: + - ../../cluster-template-kcp-remediation/ + +patchesStrategicMerge: + - ../no-kubeproxy.yaml diff --git a/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-kcp-scale-in/kustomization.yaml b/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-kcp-scale-in/kustomization.yaml new file mode 100644 index 0000000000..ff1312b3e1 --- /dev/null +++ b/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-kcp-scale-in/kustomization.yaml @@ -0,0 +1,5 @@ +bases: + - ../../cluster-template-kcp-scale-in/ + +patchesStrategicMerge: + - ../no-kubeproxy.yaml diff --git a/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-md-remediation/kustomization.yaml b/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-md-remediation/kustomization.yaml new file mode 100644 index 0000000000..b68d75be2d --- /dev/null +++ b/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-md-remediation/kustomization.yaml @@ -0,0 +1,5 @@ +bases: + - ../../cluster-template-md-remediation/ + +patchesStrategicMerge: + - ../no-kubeproxy.yaml diff --git a/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-no-nmt/kustomization.yaml b/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-no-nmt/kustomization.yaml new file mode 100644 index 0000000000..6c48a7086e --- /dev/null +++ b/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-no-nmt/kustomization.yaml @@ -0,0 +1,5 @@ +bases: + - ../../cluster-template-no-nmt/ + +patchesStrategicMerge: + - ../no-kubeproxy.yaml diff --git a/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-no-nutanix-cluster/kustomization.yaml b/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-no-nutanix-cluster/kustomization.yaml new file mode 100644 index 0000000000..f33fa491d0 --- /dev/null +++ b/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-no-nutanix-cluster/kustomization.yaml @@ -0,0 +1,5 @@ +bases: + - ../../cluster-template-no-nutanix-cluster/ + +patchesStrategicMerge: + - ../no-kubeproxy.yaml diff --git a/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-no-secret/kustomization.yaml b/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-no-secret/kustomization.yaml new file mode 100644 index 0000000000..c90364aff6 --- /dev/null +++ b/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-no-secret/kustomization.yaml @@ -0,0 +1,5 @@ +bases: + - ../../cluster-template-no-secret/ + +patchesStrategicMerge: + - ../no-kubeproxy.yaml diff --git a/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-project/kustomization.yaml b/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-project/kustomization.yaml new file mode 100644 index 0000000000..f828d36702 --- /dev/null +++ b/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-project/kustomization.yaml @@ -0,0 +1,5 @@ +bases: + - ../../cluster-template-project/ + +patchesStrategicMerge: + - ../no-kubeproxy.yaml diff --git a/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-upgrades/kustomization.yaml b/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-upgrades/kustomization.yaml new file mode 100644 index 0000000000..3fe17222f4 --- /dev/null +++ b/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-upgrades/kustomization.yaml @@ -0,0 +1,5 @@ +bases: + - ../../cluster-template-upgrades/ + +patchesStrategicMerge: + - ../no-kubeproxy.yaml diff --git a/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template/kustomization.yaml b/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template/kustomization.yaml new file mode 100644 index 0000000000..924f81da23 --- /dev/null +++ b/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template/kustomization.yaml @@ -0,0 +1,5 @@ +bases: + - ../../cluster-template/ + +patchesStrategicMerge: + - ../no-kubeproxy.yaml \ No newline at end of file diff --git a/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/no-kubeproxy.yaml b/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/no-kubeproxy.yaml new file mode 100644 index 0000000000..9e2e035443 --- /dev/null +++ b/test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/no-kubeproxy.yaml @@ -0,0 +1,23 @@ +--- +apiVersion: controlplane.cluster.x-k8s.io/v1beta1 +kind: KubeadmControlPlane +metadata: + name: "${CLUSTER_NAME}-kcp" + namespace: "${NAMESPACE}" +spec: + kubeadmConfigSpec: + initConfiguration: + skipPhases: + - addon/kube-proxy +--- +apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 +kind: KubeadmConfigTemplate +metadata: + name: "${CLUSTER_NAME}-kcfg-0" + namespace: "${NAMESPACE}" +spec: + template: + spec: + initConfiguration: + skipPhases: + - addon/kube-proxy diff --git a/test/e2e/e2e_suite_test.go b/test/e2e/e2e_suite_test.go index 4ef5db9cfd..42d9eaf466 100644 --- a/test/e2e/e2e_suite_test.go +++ b/test/e2e/e2e_suite_test.go @@ -1,5 +1,4 @@ //go:build e2e -// +build e2e /* Copyright 2020 The Kubernetes Authors. @@ -20,83 +19,26 @@ limitations under the License. package e2e import ( - "flag" "fmt" "os" "path/filepath" "strings" "testing" + infrav1 "github.com/nutanix-cloud-native/cluster-api-provider-nutanix/api/v1beta1" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" storagev1 "k8s.io/api/storage/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - ctrl "sigs.k8s.io/controller-runtime" - clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/cluster-api/test/framework" "sigs.k8s.io/cluster-api/test/framework/bootstrap" "sigs.k8s.io/cluster-api/test/framework/clusterctl" "sigs.k8s.io/cluster-api/test/framework/ginkgoextensions" - - infrav1 "github.com/nutanix-cloud-native/cluster-api-provider-nutanix/api/v1beta1" ) -// Test suite flags. -var ( - // configPath is the path to the e2e config file. - configPath string - - // useExistingCluster instructs the test to use the current cluster instead of creating a new one (default discovery rules apply). - useExistingCluster bool - - // artifactFolder is the folder to store e2e test artifacts. - artifactFolder string - - // clusterctlConfig is the file which tests will use as a clusterctl config. - // If it is not set, a local clusterctl repository (including a clusterctl config) will be created automatically. - clusterctlConfig string - - // alsoLogToFile enables additional logging to the 'ginkgo-log.txt' file in the artifact folder. - // These logs also contain timestamps. - alsoLogToFile bool - - // skipCleanup prevents cleanup of test resources e.g. for debug purposes. - skipCleanup bool - - // flavor is used to add clusterResourceSet for CNI usage in e2e tests - flavor string -) - -// Test suite global vars. -var ( - ctx = ctrl.SetupSignalHandler() - - // e2eConfig to be used for this test, read from configPath. - e2eConfig *clusterctl.E2EConfig - - // clusterctlConfigPath to be used for this test, created by generating a clusterctl local repository - // with the providers specified in the configPath. - clusterctlConfigPath string - - // bootstrapClusterProvider manages provisioning of the the bootstrap cluster to be used for the e2e tests. - // Please note that provisioning will be skipped if e2e.use-existing-cluster is provided. - bootstrapClusterProvider bootstrap.ClusterProvider - - // bootstrapClusterProxy allows to interact with the bootstrap cluster to be used for the e2e tests. - bootstrapClusterProxy framework.ClusterProxy -) - -func init() { - flag.StringVar(&configPath, "e2e.config", "", "path to the e2e config file") - flag.StringVar(&artifactFolder, "e2e.artifacts-folder", "", "folder where e2e test artifact should be stored") - flag.BoolVar(&alsoLogToFile, "e2e.also-log-to-file", true, "if true, ginkgo logs are additionally written to the `ginkgo-log.txt` file in the artifacts folder (including timestamps)") - flag.BoolVar(&skipCleanup, "e2e.skip-resource-cleanup", false, "if true, the resource cleanup after tests will be skipped") - flag.StringVar(&clusterctlConfig, "e2e.clusterctl-config", "", "file which tests will use as a clusterctl config. If it is not set, a local clusterctl repository (including a clusterctl config) will be created automatically.") - flag.BoolVar(&useExistingCluster, "e2e.use-existing-cluster", false, "if true, the test uses the current cluster instead of creating a new one (default discovery rules apply)") -} - func TestE2E(t *testing.T) { // If running in prow, make sure to use the artifacts folder that will be reported in test grid (ignoring the value provided by flag). if prowArtifactFolder, exists := os.LookupEnv("ARTIFACTS"); exists { @@ -120,7 +62,7 @@ var _ = SynchronizedBeforeSuite(func() []byte { // Before all ParallelNodes. Expect(configPath).To(BeAnExistingFile(), "Invalid test suite argument. e2e.config should be an existing file.") - Expect(os.MkdirAll(artifactFolder, 0755)).To(Succeed(), "Invalid test suite argument. Can't create e2e.artifacts-folder %q", artifactFolder) //nolint:gosec + Expect(os.MkdirAll(artifactFolder, 0o755)).To(Succeed(), "Invalid test suite argument. Can't create e2e.artifacts-folder %q", artifactFolder) //nolint:gosec By("Initializing a runtime.Scheme with all the GVK relevant for this test") scheme := initScheme() diff --git a/test/e2e/gpu_test.go b/test/e2e/gpu_test.go index 082eff6270..f3910d1630 100644 --- a/test/e2e/gpu_test.go +++ b/test/e2e/gpu_test.go @@ -1,5 +1,4 @@ //go:build e2e -// +build e2e /* Copyright 2023 Nutanix diff --git a/test/e2e/k8s_conformance_test.go b/test/e2e/k8s_conformance_test.go index 281354a3dd..268e44f522 100644 --- a/test/e2e/k8s_conformance_test.go +++ b/test/e2e/k8s_conformance_test.go @@ -1,5 +1,4 @@ //go:build e2e -// +build e2e /* Copyright 2022 Nutanix, Inc diff --git a/test/e2e/md_rollout_test.go b/test/e2e/md_rollout_test.go index e7094df269..499bfeaedd 100644 --- a/test/e2e/md_rollout_test.go +++ b/test/e2e/md_rollout_test.go @@ -1,5 +1,4 @@ //go:build e2e -// +build e2e /* Copyright 2020 The Kubernetes Authors. diff --git a/test/e2e/md_scale_test.go b/test/e2e/md_scale_test.go index 8bb33d299f..c4428c2f23 100644 --- a/test/e2e/md_scale_test.go +++ b/test/e2e/md_scale_test.go @@ -1,5 +1,4 @@ //go:build e2e -// +build e2e /* Copyright 2021 The Kubernetes Authors. @@ -50,7 +49,7 @@ var _ = Describe("When testing MachineDeployment scale out/in", Label("md-scale- // Label `only-for-validation` is used to run this test only for validation and not as part of the regular test suite. var _ = Describe("When testing MachineDeployment scale up/down from 10 replicas to 20 replicas to 10 again", Label("md-scale-up-down", "slow", "network", "only-for-validation"), func() { // MachineDeploymentScaleSpec implements a test that verifies that MachineDeployment scale operations are successful. - var inputGetter = func() capi_e2e.MachineDeploymentScaleSpecInput { + inputGetter := func() capi_e2e.MachineDeploymentScaleSpecInput { return capi_e2e.MachineDeploymentScaleSpecInput{ E2EConfig: e2eConfig, ClusterctlConfigPath: clusterctlConfigPath, @@ -74,7 +73,7 @@ var _ = Describe("When testing MachineDeployment scale up/down from 10 replicas Expect(input.E2EConfig).ToNot(BeNil(), "Invalid argument. input.E2EConfig can't be nil when calling %s spec", specName) Expect(input.ClusterctlConfigPath).To(BeAnExistingFile(), "Invalid argument. input.ClusterctlConfigPath must be an existing file when calling %s spec", specName) Expect(input.BootstrapClusterProxy).ToNot(BeNil(), "Invalid argument. input.BootstrapClusterProxy can't be nil when calling %s spec", specName) - Expect(os.MkdirAll(input.ArtifactFolder, 0750)).To(Succeed(), "Invalid argument. input.ArtifactFolder can't be created for %s spec", specName) + Expect(os.MkdirAll(input.ArtifactFolder, 0o750)).To(Succeed(), "Invalid argument. input.ArtifactFolder can't be created for %s spec", specName) Expect(input.E2EConfig.Variables).To(HaveKey(KubernetesVersion)) Expect(input.E2EConfig.Variables).To(HaveValidVersion(input.E2EConfig.GetVariable(KubernetesVersion))) diff --git a/test/e2e/mhc_remediations_test.go b/test/e2e/mhc_remediations_test.go index f486023c13..3ceb71e52a 100644 --- a/test/e2e/mhc_remediations_test.go +++ b/test/e2e/mhc_remediations_test.go @@ -1,5 +1,4 @@ //go:build e2e -// +build e2e /* Copyright 2020 The Kubernetes Authors. diff --git a/test/e2e/multi_nic_test.go b/test/e2e/multi_nic_test.go index c95ce12557..4b44ecc5c6 100644 --- a/test/e2e/multi_nic_test.go +++ b/test/e2e/multi_nic_test.go @@ -1,5 +1,4 @@ //go:build e2e -// +build e2e /* Copyright 2022 Nutanix diff --git a/test/e2e/nutanix_client.go b/test/e2e/nutanix_client.go index 855284e692..09b05c6426 100644 --- a/test/e2e/nutanix_client.go +++ b/test/e2e/nutanix_client.go @@ -1,5 +1,4 @@ //go:build e2e -// +build e2e /* Copyright 2022 Nutanix diff --git a/test/e2e/nutanix_client_test.go b/test/e2e/nutanix_client_test.go index 733735ceef..18a2e9ac21 100644 --- a/test/e2e/nutanix_client_test.go +++ b/test/e2e/nutanix_client_test.go @@ -1,5 +1,4 @@ //go:build e2e -// +build e2e /* Copyright 2022 Nutanix diff --git a/test/e2e/projects_test.go b/test/e2e/projects_test.go index 3eead40c10..5a06659710 100644 --- a/test/e2e/projects_test.go +++ b/test/e2e/projects_test.go @@ -1,5 +1,4 @@ //go:build e2e -// +build e2e /* Copyright 2022 Nutanix @@ -32,13 +31,11 @@ import ( infrav1 "github.com/nutanix-cloud-native/cluster-api-provider-nutanix/api/v1beta1" ) -const ( - nutanixProjectNameEnv = "NUTANIX_PROJECT_NAME" - nonExistingProjectName = "nonExistingProjectNameCAPX" -) - var _ = Describe("Nutanix projects", Label("capx-feature-test", "projects", "slow", "network"), func() { - const specName = "cluster-projects" + const ( + specName = "cluster-projects" + nonExistingProjectName = "nonExistingProjectNameCAPX" + ) var ( namespace *corev1.Namespace diff --git a/test/e2e/test_helpers.go b/test/e2e/test_helpers.go index 777054975b..bf7eab13fa 100644 --- a/test/e2e/test_helpers.go +++ b/test/e2e/test_helpers.go @@ -1,5 +1,4 @@ //go:build e2e -// +build e2e /* Copyright 2022 Nutanix @@ -22,12 +21,16 @@ package e2e import ( "context" "encoding/json" + "flag" "fmt" "os" "path/filepath" "strings" "time" + infrav1 "github.com/nutanix-cloud-native/cluster-api-provider-nutanix/api/v1beta1" + "github.com/nutanix-cloud-native/cluster-api-provider-nutanix/controllers" + credentialTypes "github.com/nutanix-cloud-native/prism-go-client/environment/credentials" prismGoClientV3 "github.com/nutanix-cloud-native/prism-go-client/v3" . "github.com/onsi/gomega" @@ -39,12 +42,11 @@ import ( capiv1 "sigs.k8s.io/cluster-api/api/v1beta1" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/cluster-api/test/framework" + "sigs.k8s.io/cluster-api/test/framework/bootstrap" "sigs.k8s.io/cluster-api/test/framework/clusterctl" "sigs.k8s.io/cluster-api/util" + ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" - - infrav1 "github.com/nutanix-cloud-native/cluster-api-provider-nutanix/api/v1beta1" - "github.com/nutanix-cloud-native/cluster-api-provider-nutanix/controllers" ) const ( @@ -66,6 +68,53 @@ const ( subnetVarKey = "NUTANIX_SUBNET_NAME" nameType = "name" + + nutanixProjectNameEnv = "NUTANIX_PROJECT_NAME" +) + +// Test suite global vars. +var ( + ctx = ctrl.SetupSignalHandler() + + // e2eConfig to be used for this test, read from configPath. + e2eConfig *clusterctl.E2EConfig + + // clusterctlConfigPath to be used for this test, created by generating a clusterctl local repository + // with the providers specified in the configPath. + clusterctlConfigPath string + + // bootstrapClusterProvider manages provisioning of the the bootstrap cluster to be used for the e2e tests. + // Please note that provisioning will be skipped if e2e.use-existing-cluster is provided. + bootstrapClusterProvider bootstrap.ClusterProvider + + // bootstrapClusterProxy allows to interact with the bootstrap cluster to be used for the e2e tests. + bootstrapClusterProxy framework.ClusterProxy +) + +// Test suite flags. +var ( + // configPath is the path to the e2e config file. + configPath string + + // useExistingCluster instructs the test to use the current cluster instead of creating a new one (default discovery rules apply). + useExistingCluster bool + + // artifactFolder is the folder to store e2e test artifacts. + artifactFolder string + + // clusterctlConfig is the file which tests will use as a clusterctl config. + // If it is not set, a local clusterctl repository (including a clusterctl config) will be created automatically. + clusterctlConfig string + + // alsoLogToFile enables additional logging to the 'ginkgo-log.txt' file in the artifact folder. + // These logs also contain timestamps. + alsoLogToFile bool + + // skipCleanup prevents cleanup of test resources e.g. for debug purposes. + skipCleanup bool + + // flavor is used to add clusterResourceSet for CNI usage in e2e tests + flavor string ) type testHelperInterface interface { @@ -80,6 +129,7 @@ type testHelperInterface interface { createUUIDProjectNMT(ctx context.Context, clusterName, namespace string) *infrav1.NutanixMachineTemplate deployCluster(params deployClusterParams, clusterResources *clusterctl.ApplyClusterTemplateAndWaitResult) deployClusterAndWait(params deployClusterParams, clusterResources *clusterctl.ApplyClusterTemplateAndWaitResult) + deleteSecret(params deleteSecretParams) findGPU(ctx context.Context, gpuName string) *prismGoClientV3.GPU generateNMTName(clusterName string) string generateNMTProviderID(clusterName string) string @@ -242,6 +292,7 @@ type createGPUNMTParams struct { func (t testHelper) createNameGPUNMT(ctx context.Context, clusterName, namespace string, params createGPUNMTParams) *infrav1.NutanixMachineTemplate { gpuName := t.getVariableFromE2eConfig(params.gpuNameEnvKey) + _ = t.getVariableFromE2eConfig(params.gpuVendorEnvKey) nmt := t.createDefaultNMT(clusterName, namespace) nmt.Spec.Template.Spec.GPUs = []infrav1.NutanixGPU{ @@ -669,3 +720,30 @@ func (t testHelper) verifyGPUNutanixMachines(ctx context.Context, params verifyG ))) } } + +type deleteSecretParams struct { + namespace *corev1.Namespace + clusterName string +} + +func (t testHelper) deleteSecret(params deleteSecretParams) { + secret := &corev1.Secret{ + ObjectMeta: metav1.ObjectMeta{ + Name: params.clusterName, + Namespace: params.namespace.Name, + }, + } + + Eventually(func() error { + return bootstrapClusterProxy.GetClient().Delete(ctx, secret) + }, time.Second*5, defaultInterval).Should(Succeed()) +} + +func init() { + flag.StringVar(&configPath, "e2e.config", "", "path to the e2e config file") + flag.StringVar(&artifactFolder, "e2e.artifacts-folder", "", "folder where e2e test artifact should be stored") + flag.BoolVar(&alsoLogToFile, "e2e.also-log-to-file", true, "if true, ginkgo logs are additionally written to the `ginkgo-log.txt` file in the artifacts folder (including timestamps)") + flag.BoolVar(&skipCleanup, "e2e.skip-resource-cleanup", false, "if true, the resource cleanup after tests will be skipped") + flag.StringVar(&clusterctlConfig, "e2e.clusterctl-config", "", "file which tests will use as a clusterctl config. If it is not set, a local clusterctl repository (including a clusterctl config) will be created automatically.") + flag.BoolVar(&useExistingCluster, "e2e.use-existing-cluster", false, "if true, the test uses the current cluster instead of creating a new one (default discovery rules apply)") +}