diff --git a/.github/ISSUE_TEMPLATE/cleanup_request.md b/.github/ISSUE_TEMPLATE/cleanup_request.md new file mode 100644 index 00000000000..2e8c257bc22 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/cleanup_request.md @@ -0,0 +1,31 @@ +--- +name: 'Cleanup request' +about: Propose a cleanup task for this project. + +--- + +/kind cleanup + +**What needs cleanup:** +[A clear and concise description of what needs to be cleaned up.] + + +**Describe the solution you'd like** +[Description of how you would like the cleanup to be done.] + +Files to change: 2 + +- [ ] File 1 + - Specific lines to cleanup +- [ ] File 2 + - Specific lines to cleanup + +**Anything else you would like to add:** +[Miscellaneous information that will assist in solving the issue.] diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 00000000000..729bb67495a --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,12 @@ +coverage: + status: + project: + default: + target: auto + threshold: 1% + informational: true + patch: + default: + target: auto + threshold: 1% + informational: true diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index f4d4941bad7..58b6cc056dd 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,4 +1,4 @@ - + **What type of PR is this?** @@ -22,8 +22,9 @@ Add one of the following kinds: Fixes # **Special notes for your reviewer**: + -_Please confirm that if this PR changes any image versions, then that's the sole change this PR makes._ +- [ ] cherry-pick candidate **TODOs**: diff --git a/.github/workflows/cover.yaml b/.github/workflows/cover.yaml index ea865dc890b..2fa97bfd67b 100644 --- a/.github/workflows/cover.yaml +++ b/.github/workflows/cover.yaml @@ -2,6 +2,7 @@ name: codecov on: + pull_request: push: branches: - main @@ -10,9 +11,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4.0.1 with: - go-version: '^1.19' + go-version: '1.20' - run: "PATH=/usr/local/go/bin:$PATH make test-cover" - uses: codecov/codecov-action@v3 with: diff --git a/.github/workflows/dependabot-code-gen.yml b/.github/workflows/dependabot-code-gen.yml index 5cb654e0084..e0c314fe1ae 100644 --- a/.github/workflows/dependabot-code-gen.yml +++ b/.github/workflows/dependabot-code-gen.yml @@ -18,9 +18,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Set up Go 1.x - uses: actions/setup-go@v3 + uses: actions/setup-go@v4.0.1 with: - go-version: '1.19' + go-version: '1.20' id: go - name: Check out code into the Go module directory uses: actions/checkout@v3 # tag=v3.2.0 @@ -37,7 +37,7 @@ jobs: run: make modules - name: Update generated code run: make generate - - uses: EndBug/add-and-commit@61a88be553afe4206585b31aa72387c64295d08b # tag=v9.1.1 + - uses: EndBug/add-and-commit@1bad3abcf0d6ec49a5857d124b0bfb52dc7bb081 # tag=v9.1.3 name: Commit changes with: author_name: dependabot[bot] diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 2709959d11c..044744899ef 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -18,9 +18,9 @@ jobs: with: fetch-depth: 0 - name: Install go - uses: actions/setup-go@v3 + uses: actions/setup-go@v4.0.1 with: - go-version: '^1.19' + go-version: '^1.20' - name: generate release artifacts run: | make release diff --git a/.github/workflows/scan.yml b/.github/workflows/scan.yml new file mode 100644 index 00000000000..a98e5e21868 --- /dev/null +++ b/.github/workflows/scan.yml @@ -0,0 +1,22 @@ +name: scan-images + +on: + schedule: + - cron: "0 12 * * 1" + +# Remove all permissions from GITHUB_TOKEN except metadata. +permissions: {} + +jobs: + scan: + name: Trivy + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3.1.0 + - name: Setup go + uses: actions/setup-go@v4.0.1 # tag=v3.4.0 + with: + go-version: 1.20 + - name: Run verify container script + run: make verify-container-images diff --git a/.golangci.yml b/.golangci.yml index d0b16dd3600..81246ee054d 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -74,31 +74,15 @@ linters-settings: - pkg: sigs.k8s.io/controller-runtime alias: ctrl # CAPI - - pkg: sigs.k8s.io/cluster-api/api/v1alpha3 - alias: clusterv1alpha3 - - pkg: sigs.k8s.io/cluster-api/api/v1alpha4 - alias: clusterv1alpha4 - pkg: sigs.k8s.io/cluster-api/api/v1beta1 alias: clusterv1 # CAPI exp - - pkg: sigs.k8s.io/cluster-api/exp/api/v1alpha3 - alias: expv1alpha3 - - pkg: sigs.k8s.io/cluster-api/exp/api/v1alpha4 - alias: expv1alpha4 - pkg: sigs.k8s.io/cluster-api/exp/api/v1beta1 alias: expv1 # CAPZ - - pkg: sigs.k8s.io/cluster-api-provider-azure/api/v1alpha3 - alias: infrav1alpha3 - - pkg: sigs.k8s.io/cluster-api-provider-azure/api/v1alpha4 - alias: infrav1alpha4 - pkg: sigs.k8s.io/cluster-api-provider-azure/api/v1beta1 alias: infrav1 # CAPZ exp - - pkg: sigs.k8s.io/cluster-api-provider-azure/exp/api/v1alpha3 - alias: infrav1alpha3exp - - pkg: sigs.k8s.io/cluster-api-provider-azure/exp/api/v1alpha4 - alias: infrav1alpha4exp - pkg: sigs.k8s.io/cluster-api-provider-azure/exp/api/v1beta1 alias: infrav1exp - pkg: sigs.k8s.io/cluster-api-provider-azure/util/webhook @@ -106,6 +90,12 @@ linters-settings: # Azure - pkg: github.com/Azure/go-autorest/autorest/azure alias: azureautorest + # ASO + - pkg: github.com/Azure/azure-service-operator/v2/api/resources/v1api20200601 + alias: asoresourcesv1 + # Deprecated + - pkg: github.com/Azure/go-autorest/autorest/to + alias: deprecated-use-k8s.io-utils-pointer gocritic: enabled-tags: - "experimental" @@ -127,11 +117,11 @@ linters-settings: arguments: - disableStutteringCheck staticcheck: - go: "1.19" + go: "1.20" stylecheck: - go: "1.19" + go: "1.20" unused: - go: "1.19" + go: "1.20" issues: exclude-rules: @@ -139,8 +129,6 @@ issues: text: "use underscores in Go names|receiver name (.+) should be consistent|methods on the same type should have the same receiver name" - path: 'mock(\w+)/doc.go$' text: "use underscores in package names|don't use an underscore in package name" - - path: api/v1alpha3/azureclusteridentity_types.go - text: "methods on the same type should have the same receiver name" - path: ^test/ linters: - dogsled diff --git a/.markdownlinkcheck.json b/.markdownlinkcheck.json index 3e808e1bd58..353ac60c8a1 100644 --- a/.markdownlinkcheck.json +++ b/.markdownlinkcheck.json @@ -1,7 +1,8 @@ { - "ignorePatterns": [{ - "pattern": "^https://calendar.google.com/calendar" - }], + "ignorePatterns": [ + { "pattern": "^https://calendar.google.com/calendar" }, + { "pattern": "^../reference/" } + ], "httpHeaders": [{ "comment": "Workaround as suggested here: https://github.com/tcort/markdown-link-check/issues/201", "urls": ["https://docs.github.com/"], diff --git a/Dockerfile b/Dockerfile index e9278d1169e..900d35af454 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -# syntax=docker/dockerfile:1.4 +# syntax=docker/dockerfile:1 # Copyright 2019 The Kubernetes Authors. # @@ -18,7 +18,7 @@ ARG ARCH # Build the manager binary -FROM golang:1.19 as builder +FROM golang:1.20 as builder WORKDIR /workspace # Run this with docker build --build_arg $(go env GOPROXY) to override the goproxy diff --git a/Makefile b/Makefile index 04ba9b0c57b..c5fec8d55fe 100644 --- a/Makefile +++ b/Makefile @@ -81,7 +81,7 @@ ENVSUBST_VER := v2.0.0-20210730161058-179042472c46 ENVSUBST_BIN := envsubst ENVSUBST := $(TOOLS_BIN_DIR)/$(ENVSUBST_BIN)-$(ENVSUBST_VER) -GOLANGCI_LINT_VER := v1.51.2 +GOLANGCI_LINT_VER := v1.52.1 GOLANGCI_LINT_BIN := golangci-lint GOLANGCI_LINT := $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER) @@ -101,11 +101,11 @@ KPROMO_VER := v3.5.1 KPROMO_BIN := kpromo KPROMO := $(TOOLS_BIN_DIR)/$(KPROMO_BIN)-$(KPROMO_VER) -GO_APIDIFF_VER := v0.5.0 +GO_APIDIFF_VER := v0.6.0 GO_APIDIFF_BIN := go-apidiff GO_APIDIFF := $(TOOLS_BIN_DIR)/$(GO_APIDIFF_BIN) -GINKGO_VER := v2.8.4 +GINKGO_VER := v2.9.7 GINKGO_BIN := ginkgo GINKGO := $(TOOLS_BIN_DIR)/$(GINKGO_BIN)-$(GINKGO_VER) @@ -113,7 +113,7 @@ KUBECTL_VER := v1.25.6 KUBECTL_BIN := kubectl KUBECTL := $(TOOLS_BIN_DIR)/$(KUBECTL_BIN)-$(KUBECTL_VER) -HELM_VER := v3.8.1 +HELM_VER := v3.11.3 HELM_BIN := helm HELM := $(TOOLS_BIN_DIR)/$(HELM_BIN)-$(HELM_VER) @@ -121,7 +121,7 @@ YQ_VER := v4.14.2 YQ_BIN := yq YQ := $(TOOLS_BIN_DIR)/$(YQ_BIN)-$(YQ_VER) -KIND_VER := v0.17.0 +KIND_VER := v0.19.0 KIND_BIN := kind KIND := $(TOOLS_BIN_DIR)/$(KIND_BIN)-$(KIND_VER) @@ -151,6 +151,9 @@ MANIFEST_ROOT ?= config CRD_ROOT ?= $(MANIFEST_ROOT)/crd/bases WEBHOOK_ROOT ?= $(MANIFEST_ROOT)/webhook RBAC_ROOT ?= $(MANIFEST_ROOT)/rbac +ASO_CRDS_PATH := $(MANIFEST_ROOT)/aso/crds.yaml +ASO_VERSION := v2.0.0 +ASO_CRDS := resourcegroups.resources.azure.com # Allow overriding the imagePullPolicy PULL_POLICY ?= Always @@ -213,9 +216,13 @@ clean-temporary: ## Remove all temporary files and folders. rm -f *.kubeconfig .PHONY: clean-release -clean-release: ## Remove the release folder. +clean-release: clean-release-git ## Remove the release folder. rm -rf $(RELEASE_DIR) +.PHONY: clean-release-git +clean-release-git: ## Restores the git files usually modified during a release + git restore ./*manager_image_patch.yaml ./*manager_pull_policy.yaml + APIDIFF_OLD_COMMIT ?= $(shell git rev-parse origin/main) .PHONY: apidiff @@ -281,7 +288,7 @@ create-management-cluster: $(KUSTOMIZE) $(ENVSUBST) $(KUBECTL) $(KIND) ## Create ./hack/create-custom-cloud-provider-config.sh # Deploy CAPI - curl --retry $(CURL_RETRIES) -sSL https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.3.5/cluster-api-components.yaml | $(ENVSUBST) | $(KUBECTL) apply -f - + curl --retry $(CURL_RETRIES) -sSL https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.4.2/cluster-api-components.yaml | $(ENVSUBST) | $(KUBECTL) apply -f - # Deploy CAPZ $(KIND) load docker-image $(CONTROLLER_IMG)-$(ARCH):$(TAG) --name=$(KIND_CLUSTER_NAME) @@ -364,14 +371,14 @@ delete-workload-cluster: $(KUBECTL) ## Deletes the example workload Kubernetes c .PHONY: docker-pull-prerequisites docker-pull-prerequisites: ## Pull prerequisites for building controller-manager. docker pull docker/dockerfile:1.4 - docker pull docker.io/library/golang:1.19 + docker pull docker.io/library/golang:1.20 docker pull gcr.io/distroless/static:latest .PHONY: docker-build docker-build: docker-pull-prerequisites ## Build the docker image for controller-manager. DOCKER_BUILDKIT=1 docker build --build-arg goproxy=$(GOPROXY) --build-arg ARCH=$(ARCH) --build-arg ldflags="$(LDFLAGS)" . -t $(CONTROLLER_IMG)-$(ARCH):$(TAG) - $(MAKE) set-manifest-image MANIFEST_IMG=$(CONTROLLER_IMG)-$(ARCH) MANIFEST_TAG=$(TAG) TARGET_RESOURCE="./config/default/manager_image_patch.yaml" - $(MAKE) set-manifest-pull-policy TARGET_RESOURCE="./config/default/manager_pull_policy.yaml" + $(MAKE) set-manifest-image MANIFEST_IMG=$(CONTROLLER_IMG)-$(ARCH) MANIFEST_TAG=$(TAG) TARGET_RESOURCE="./config/capz/manager_image_patch.yaml" + $(MAKE) set-manifest-pull-policy TARGET_RESOURCE="./config/capz/manager_pull_policy.yaml" .PHONY: docker-push docker-push: ## Push the docker image @@ -408,12 +415,12 @@ docker-push-manifest: ## Push the fat manifest docker image. .PHONY: set-manifest-image set-manifest-image: ## Update kustomize image patch file for default resource. $(info Updating kustomize image patch file for default resource) - sed -i'' -e 's@image: .*@image: '"${MANIFEST_IMG}:$(MANIFEST_TAG)"'@' ./config/default/manager_image_patch.yaml + sed -i'' -e 's@image: .*@image: '"${MANIFEST_IMG}:$(MANIFEST_TAG)"'@' ./config/capz/manager_image_patch.yaml .PHONY: set-manifest-pull-policy set-manifest-pull-policy: ## Update kustomize pull policy file for default resource. $(info Updating kustomize pull policy file for default resource) - sed -i'' -e 's@imagePullPolicy: .*@imagePullPolicy: '"$(PULL_POLICY)"'@' ./config/default/manager_pull_policy.yaml + sed -i'' -e 's@imagePullPolicy: .*@imagePullPolicy: '"$(PULL_POLICY)"'@' ./config/capz/manager_pull_policy.yaml ## -------------------------------------- ## Generate @@ -428,6 +435,7 @@ generate: ## Generate go related targets, manifests, flavors, e2e-templates and $(MAKE) generate-flavors $(MAKE) generate-e2e-templates $(MAKE) generate-addons + $(MAKE) generate-aso-crds .PHONY: generate-go generate-go: $(CONTROLLER_GEN) $(MOCKGEN) $(CONVERSION_GEN) ## Runs Go related generate targets. @@ -435,26 +443,6 @@ generate-go: $(CONTROLLER_GEN) $(MOCKGEN) $(CONVERSION_GEN) ## Runs Go related g paths=./api/... \ paths=./$(EXP_DIR)/api/... \ object:headerFile=./hack/boilerplate/boilerplate.generatego.txt - $(CONVERSION_GEN) \ - --input-dirs=./api/v1alpha3 \ - --build-tag=ignore_autogenerated_core_v1alpha3 \ - --extra-peer-dirs=sigs.k8s.io/cluster-api/api/v1alpha3 \ - --output-file-base=zz_generated.conversion \ - --go-header-file=./hack/boilerplate/boilerplate.generatego.txt $(OUTPUT_BASE) - $(CONVERSION_GEN) \ - --input-dirs=./api/v1alpha4 \ - --build-tag=ignore_autogenerated_core_v1alpha4 \ - --extra-peer-dirs=sigs.k8s.io/cluster-api/api/v1alpha4 \ - --output-file-base=zz_generated.conversion \ - --go-header-file=./hack/boilerplate/boilerplate.generatego.txt $(OUTPUT_BASE) - $(CONVERSION_GEN) \ - --input-dirs=./$(EXP_DIR)/api/v1alpha3 \ - --output-file-base=zz_generated.conversion \ - --go-header-file=./hack/boilerplate/boilerplate.generatego.txt $(OUTPUT_BASE) - $(CONVERSION_GEN) \ - --input-dirs=./$(EXP_DIR)/api/v1alpha4 \ - --output-file-base=zz_generated.conversion \ - --go-header-file=./hack/boilerplate/boilerplate.generatego.txt $(OUTPUT_BASE) go generate ./... .PHONY: generate-manifests @@ -478,7 +466,7 @@ generate-flavors: $(KUSTOMIZE) generate-addons ./hack/gen-flavors.sh .PHONY: generate-e2e-templates -generate-e2e-templates: $(KUSTOMIZE) ## Generate Azure infrastructure templates for the v1alpha4 CAPI test suite. +generate-e2e-templates: $(KUSTOMIZE) ## Generate Azure infrastructure templates for the v1beta1 CAPI test suite. $(KUSTOMIZE) build $(AZURE_TEMPLATES)/v1beta1/cluster-template --load-restrictor LoadRestrictionsNone > $(AZURE_TEMPLATES)/v1beta1/cluster-template.yaml $(KUSTOMIZE) build $(AZURE_TEMPLATES)/v1beta1/cluster-template-md-remediation --load-restrictor LoadRestrictionsNone > $(AZURE_TEMPLATES)/v1beta1/cluster-template-md-remediation.yaml $(KUSTOMIZE) build $(AZURE_TEMPLATES)/v1beta1/cluster-template-kcp-remediation --load-restrictor LoadRestrictionsNone > $(AZURE_TEMPLATES)/v1beta1/cluster-template-kcp-remediation.yaml @@ -494,8 +482,19 @@ generate-addons: fetch-calico-manifests ## Generate metric-server, calico calico $(KUSTOMIZE) build $(ADDONS_DIR)/calico-ipv6 > $(ADDONS_DIR)/calico-ipv6.yaml $(KUSTOMIZE) build $(ADDONS_DIR)/calico-dual-stack > $(ADDONS_DIR)/calico-dual-stack.yaml +.PHONY: generate-aso-crds +# The yq command filters the list of all ASO CRDs to just the ones specified by ASO_CRDS. +# The sed command changes '$$' to '$$$$' so once the CRDs get run through +# envsubst, '$$$$' changes back to '$$' so ASO will not detect a diff and try to +# update the CRDs for which we don't give it permission. +generate-aso-crds: $(YQ) + curl -fSsL "https://github.com/Azure/azure-service-operator/releases/download/$(ASO_VERSION)/azureserviceoperator_customresourcedefinitions_$(ASO_VERSION).yaml" | \ + $(YQ) e '. | select($(foreach name,$(ASO_CRDS),.metadata.name == "$(name)" or )false)' - | \ + sed 's/\$$\$$/$$$$$$$$/g' \ + > $(ASO_CRDS_PATH) + # When updating this, make sure to also update the Windows image version in templates/addons/windows/calico. -CALICO_VERSION := v3.25.0 +export CALICO_VERSION := v3.25.1 # Where all downloaded Calico manifests are unpacked and stored. CALICO_RELEASES := $(ARTIFACTS)/calico # Path to manifests directory in a Calico release archive. @@ -503,6 +502,10 @@ CALICO_RELEASE_MANIFESTS_DIR := release-$(CALICO_VERSION)/manifests # Path where Calico manifests are stored which should be used for addons generation. CALICO_MANIFESTS_DIR := $(ARTIFACTS)/calico/$(CALICO_RELEASE_MANIFESTS_DIR) +.PHONY: get-calico-version +get-calico-version: ## Print the Calico version used for CNI in the repo. + @echo $(CALICO_VERSION) + .PHONY: fetch-calico-manifests fetch-calico-manifests: $(CALICO_MANIFESTS_DIR) ## Get Calico release manifests and unzip them. cp $(CALICO_MANIFESTS_DIR)/calico-vxlan.yaml $(ADDONS_DIR)/calico @@ -610,7 +613,7 @@ release-binary: $(RELEASE_DIR) ## Compile and build release binaries. -e GOARCH=$(GOARCH) \ -v "$$(pwd):/workspace" \ -w /workspace \ - golang:1.19 \ + golang:1.20 \ go build -a -ldflags '$(LDFLAGS) -extldflags "-static"' \ -o $(RELEASE_DIR)/$(notdir $(RELEASE_BINARY))-$(GOOS)-$(GOARCH) $(RELEASE_BINARY) @@ -656,6 +659,7 @@ go-test: $(SETUP_ENVTEST) ## Run go tests. test-cover: TEST_ARGS+= -coverprofile coverage.out test-cover: test ## Run tests with code coverage and generate reports. go tool cover -func=coverage.out -o coverage.txt + ./hack/codecov-ignore.sh go tool cover -html=coverage.out -o coverage.html .PHONY: test-e2e-run @@ -665,7 +669,8 @@ test-e2e-run: generate-e2e-templates install-tools ## Run e2e tests. -e2e.artifacts-folder="$(ARTIFACTS)" \ -e2e.config="$(E2E_CONF_FILE_ENVSUBST)" \ -e2e.skip-log-collection="$(SKIP_LOG_COLLECTION)" \ - -e2e.skip-resource-cleanup=$(SKIP_CLEANUP) -e2e.use-existing-cluster=$(SKIP_CREATE_MGMT_CLUSTER) $(E2E_ARGS) + -e2e.skip-resource-cleanup=$(SKIP_CLEANUP) -e2e.use-existing-cluster=$(SKIP_CREATE_MGMT_CLUSTER) $(E2E_ARGS) ; \ + $(MAKE) clean-release-git .PHONY: test-e2e test-e2e: ## Run "docker-build" and "docker-push" rules then run e2e tests. @@ -681,8 +686,8 @@ test-e2e-skip-push: ## Run "docker-build" rule then run e2e tests. .PHONY: test-e2e-skip-build-and-push test-e2e-skip-build-and-push: - $(MAKE) set-manifest-image MANIFEST_IMG=$(CONTROLLER_IMG)-$(ARCH) MANIFEST_TAG=$(TAG) TARGET_RESOURCE="./config/default/manager_image_patch.yaml" - $(MAKE) set-manifest-pull-policy TARGET_RESOURCE="./config/default/manager_pull_policy.yaml" PULL_POLICY=IfNotPresent + $(MAKE) set-manifest-image MANIFEST_IMG=$(CONTROLLER_IMG)-$(ARCH) MANIFEST_TAG=$(TAG) TARGET_RESOURCE="./config/capz/manager_image_patch.yaml" + $(MAKE) set-manifest-pull-policy TARGET_RESOURCE="./config/capz/manager_pull_policy.yaml" PULL_POLICY=IfNotPresent MANAGER_IMAGE=$(CONTROLLER_IMG)-$(ARCH):$(TAG) \ $(MAKE) test-e2e-run @@ -703,6 +708,14 @@ ifneq ($(WIN_REPO_URL), ) endif $(MAKE) test-conformance CONFORMANCE_E2E_ARGS="-kubetest.config-file=$(KUBETEST_WINDOWS_CONF_PATH) -kubetest.repo-list-path=$(KUBETEST_REPO_LIST_PATH) $(E2E_ARGS)" +## -------------------------------------- +## Security Scanning +## -------------------------------------- + +.PHONY: verify-container-images +verify-container-images: ## Verify container images + ./hack/verify-container-images.sh + ## -------------------------------------- ## Tilt / Kind ## -------------------------------------- @@ -785,7 +798,7 @@ $(GINKGO): ## Build ginkgo from tools folder. $(KUBECTL): ## Build kubectl from tools folder. mkdir -p $(TOOLS_BIN_DIR) rm -f "$(TOOLS_BIN_DIR)/$(KUBECTL_BIN)*" - curl --retry $(CURL_RETRIES) -fsL https://storage.googleapis.com/kubernetes-release/release/$(KUBECTL_VER)/bin/$(GOOS)/$(GOARCH)/kubectl -o $(KUBECTL) + curl --retry $(CURL_RETRIES) -fsL https://dl.k8s.io/release/$(KUBECTL_VER)/bin/$(GOOS)/$(GOARCH)/kubectl -o $(KUBECTL) ln -sf $(KUBECTL) $(TOOLS_BIN_DIR)/$(KUBECTL_BIN) chmod +x $(KUBECTL) $(TOOLS_BIN_DIR)/$(KUBECTL_BIN) diff --git a/PROJECT b/PROJECT index ec61982168c..24d9517c670 100644 --- a/PROJECT +++ b/PROJECT @@ -2,23 +2,6 @@ version: "3" domain: x-k8s.io repo: sigs.k8s.io/cluster-api-provider-azure resources: -- group: infrastructure - version: v1alpha3 - kind: AzureMachine -- group: infrastructure - version: v1alpha3 - kind: AzureCluster -- group: infrastructure - version: v1alpha3 - kind: AzureMachineTemplate -- group: infrastructure - version: v1alpha4 - kind: AzureMachine -- group: infrastructure - version: v1alpha4 - kind: AzureCluster -- group: infrastructure - version: v1alpha4 kind: AzureMachineTemplate - group: infrastructure version: v1beta1 diff --git a/README.md b/README.md index 6e0cea30951..40a54cba604 100644 --- a/README.md +++ b/README.md @@ -34,13 +34,7 @@ If you need help with CAPZ, please visit the [#cluster-api-azure][slack] channel ### Cluster API Versions -This provider's versions are compatible with the following versions of Cluster API: - -| | Cluster API `v1alpha3` (`v0.3.x`) | Cluster API `v1alpha4` (`v0.4.x`) | Cluster API `v1beta1` (`v1.0.x`) | -|---|---|---|---| -|Azure Provider `v0.4.x` | ✓ | | | -|Azure Provider `v0.5.x` | | ✓ | | -|Azure Provider `v1.0.x` | | | ✓ | +Currently, CAPZ is compatible only with the `v1beta1` version of CAPI (v1.0.x). Support for `v1alpha3` (v0.3.x) and `v1alpha4` (v0.4.x) is deprecated and has been removed. ### Kubernetes Versions diff --git a/Tiltfile b/Tiltfile index 7f5650e699a..3c68c99a3c5 100644 --- a/Tiltfile +++ b/Tiltfile @@ -19,10 +19,10 @@ settings = { "deploy_cert_manager": True, "preload_images_for_kind": True, "kind_cluster_name": "capz", - "capi_version": "v1.3.5", - "cert_manager_version": "v1.11.0", - "kubernetes_version": "v1.24.6", - "aks_kubernetes_version": "v1.24.6", + "capi_version": "v1.4.2", + "cert_manager_version": "v1.11.1", + "kubernetes_version": "v1.25.6", + "aks_kubernetes_version": "v1.25.6", "flatcar_version": "3374.2.1", } @@ -108,16 +108,19 @@ def validate_auth(): tilt_helper_dockerfile_header = """ # Tilt image -FROM golang:1.19 as tilt-helper +FROM golang:1.20 as tilt-helper # Support live reloading with Tilt RUN wget --output-document /restart.sh --quiet https://raw.githubusercontent.com/windmilleng/rerun-process-wrapper/master/restart.sh && \ wget --output-document /start.sh --quiet https://raw.githubusercontent.com/windmilleng/rerun-process-wrapper/master/start.sh && \ - chmod +x /start.sh && chmod +x /restart.sh + chmod +x /start.sh && chmod +x /restart.sh && \ + touch /process.txt && chmod 0777 /process.txt `# pre-create PID file to allow even non-root users to run the image` """ tilt_dockerfile_header = """ FROM gcr.io/distroless/base:debug as tilt -WORKDIR / +WORKDIR /tilt +RUN ["/busybox/chmod", "0777", "."] +COPY --from=tilt-helper /process.txt . COPY --from=tilt-helper /start.sh . COPY --from=tilt-helper /restart.sh . COPY manager . @@ -217,7 +220,7 @@ def capz(): tilt_dockerfile_header, ]) - entrypoint = ["sh", "/start.sh", "/manager"] + entrypoint = ["sh", "/tilt/start.sh", "/tilt/manager"] extra_args = settings.get("extra_args") if extra_args: entrypoint.extend(extra_args) @@ -232,8 +235,8 @@ def capz(): entrypoint = entrypoint, only = "manager", live_update = [ - sync(".tiltbuild/manager", "/manager"), - run("sh /restart.sh"), + sync(".tiltbuild/manager", "/tilt/manager"), + run("sh /tilt/restart.sh"), ], ignore = ["templates"], ) @@ -352,7 +355,7 @@ def deploy_worker_templates(template, substitutions): yaml = shlex.quote(yaml) flavor_name = os.path.basename(flavor) - flavor_cmd = "RANDOM=$(bash -c 'echo $RANDOM'); export CLUSTER_NAME=" + flavor.replace("windows", "win") + "-$RANDOM; make generate-flavors; echo " + yaml + "> ./.tiltbuild/" + flavor + "; cat ./.tiltbuild/" + flavor + " | " + envsubst_cmd + " | " + kubectl_cmd + " apply -f - && echo \"Cluster \'$CLUSTER_NAME\' created, don't forget to delete\"" + flavor_cmd = "RANDOM=$(bash -c 'echo $RANDOM'); export CLUSTER_NAME=" + flavor.replace("windows", "win") + "-$RANDOM; make generate-flavors; echo " + yaml + "> ./.tiltbuild/" + flavor + "; cat ./.tiltbuild/" + flavor + " | " + envsubst_cmd + " | " + kubectl_cmd + " apply -f -; echo \"Cluster \'$CLUSTER_NAME\' created, don't forget to delete\"" # wait for kubeconfig to be available flavor_cmd += "; until " + kubectl_cmd + " get secret ${CLUSTER_NAME}-kubeconfig > /dev/null 2>&1; do sleep 5; done; " + kubectl_cmd + " get secret ${CLUSTER_NAME}-kubeconfig -o jsonpath={.data.value} | base64 --decode > ./${CLUSTER_NAME}.kubeconfig; chmod 600 ./${CLUSTER_NAME}.kubeconfig; until " + kubectl_cmd + " --kubeconfig=./${CLUSTER_NAME}.kubeconfig get nodes > /dev/null 2>&1; do sleep 5; done" @@ -361,27 +364,41 @@ def deploy_worker_templates(template, substitutions): # This is a workaround needed for the calico-node-windows daemonset to be able to run in the calico-system namespace. if "windows" in flavor_name: flavor_cmd += "; until " + kubectl_cmd + " --kubeconfig ./${CLUSTER_NAME}.kubeconfig get configmap kubeadm-config --namespace=kube-system > /dev/null 2>&1; do sleep 5; done" - flavor_cmd += "; " + kubectl_cmd + " --kubeconfig ./${CLUSTER_NAME}.kubeconfig create namespace calico-system --dry-run=client -o yaml | " + kubectl_cmd + " --kubeconfig ./${CLUSTER_NAME}.kubeconfig apply -f - && " + kubectl_cmd + " --kubeconfig ./${CLUSTER_NAME}.kubeconfig get configmap kubeadm-config --namespace=kube-system -o yaml | sed 's/namespace: kube-system/namespace: calico-system/' | " + kubectl_cmd + " --kubeconfig ./${CLUSTER_NAME}.kubeconfig apply -f -" + flavor_cmd += "; " + kubectl_cmd + " --kubeconfig ./${CLUSTER_NAME}.kubeconfig create namespace calico-system --dry-run=client -o yaml | " + kubectl_cmd + " --kubeconfig ./${CLUSTER_NAME}.kubeconfig apply -f -; " + kubectl_cmd + " --kubeconfig ./${CLUSTER_NAME}.kubeconfig get configmap kubeadm-config --namespace=kube-system -o yaml | sed 's/namespace: kube-system/namespace: calico-system/' | " + kubectl_cmd + " --kubeconfig ./${CLUSTER_NAME}.kubeconfig apply -f -" + + flavor_cmd += get_addons(flavor_name) - # install calico - if "ipv6" in flavor_name: - calico_values = "./templates/addons/calico-ipv6/values.yaml" - elif "dual-stack" in flavor_name: - calico_values = "./templates/addons/calico-dual-stack/values.yaml" - else: - calico_values = "./templates/addons/calico/values.yaml" - flavor_cmd += "; " + helm_cmd + " repo add projectcalico https://docs.tigera.io/calico/charts; " + helm_cmd + " --kubeconfig ./${CLUSTER_NAME}.kubeconfig install calico projectcalico/tigera-operator -f " + calico_values + " --namespace tigera-operator --create-namespace" - if "intree-cloud-provider" not in flavor_name and "ipv6" not in flavor_name: # TODO: remove ipv6 once https://github.com/kubernetes-sigs/cloud-provider-azure/issues/3401 is fixed. - flavor_cmd += "; " + helm_cmd + " --kubeconfig ./${CLUSTER_NAME}.kubeconfig install --repo https://raw.githubusercontent.com/kubernetes-sigs/cloud-provider-azure/master/helm/repo cloud-provider-azure --generate-name --set infra.clusterName=${CLUSTER_NAME}" local_resource( name = flavor_name, - cmd = flavor_cmd, + cmd = ["sh", "-ec", flavor_cmd], auto_init = False, trigger_mode = TRIGGER_MODE_MANUAL, labels = ["flavors"], allow_parallel = True, ) +def get_addons(flavor_name): + # do not install calico and out of tree cloud provider for aks workload cluster + if "aks" in flavor_name: + return "" + + # install calico + if "ipv6" in flavor_name: + calico_values = "./templates/addons/calico-ipv6/values.yaml" + elif "dual-stack" in flavor_name: + calico_values = "./templates/addons/calico-dual-stack/values.yaml" + else: + calico_values = "./templates/addons/calico/values.yaml" + + addon_cmd = "; " + helm_cmd + " --kubeconfig ./${CLUSTER_NAME}.kubeconfig install --repo https://docs.tigera.io/calico/charts --version ${CALICO_VERSION} calico tigera-operator -f " + calico_values + " --namespace tigera-operator --create-namespace" + + if "intree-cloud-provider" not in flavor_name: + addon_cmd += "; " + helm_cmd + " --kubeconfig ./${CLUSTER_NAME}.kubeconfig install --repo https://raw.githubusercontent.com/kubernetes-sigs/cloud-provider-azure/master/helm/repo cloud-provider-azure --generate-name --set infra.clusterName=${CLUSTER_NAME}" + if "flatcar" in flavor_name: # append caCetDir location to the cloud-provider-azure helm install command for flatcar flavor + addon_cmd += " --set-string cloudControllerManager.caCertDir=/usr/share/ca-certificates" + + return addon_cmd + def base64_encode(to_encode): encode_blob = local("echo '{}' | tr -d '\n' | base64 | tr -d '\n'".format(to_encode), quiet = True, echo_off = True) return str(encode_blob) diff --git a/api/v1alpha3/azurecluster_conversion.go b/api/v1alpha3/azurecluster_conversion.go deleted file mode 100644 index 8142382027f..00000000000 --- a/api/v1alpha3/azurecluster_conversion.go +++ /dev/null @@ -1,436 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha3 - -import ( - apiconversion "k8s.io/apimachinery/pkg/conversion" - "k8s.io/utils/pointer" - infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" - utilconversion "sigs.k8s.io/cluster-api/util/conversion" - "sigs.k8s.io/controller-runtime/pkg/conversion" -) - -const ( - azureEnvironmentAnnotation = "azurecluster.infrastructure.cluster.x-k8s.io/azureEnvironment" -) - -// ConvertTo converts this AzureCluster to the Hub version (v1beta1). -func (src *AzureCluster) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*infrav1.AzureCluster) - if err := Convert_v1alpha3_AzureCluster_To_v1beta1_AzureCluster(src, dst, nil); err != nil { - return err - } - - if azureEnvironment, ok := src.Annotations[azureEnvironmentAnnotation]; ok { - dst.Spec.AzureEnvironment = azureEnvironment - delete(dst.Annotations, azureEnvironmentAnnotation) - if len(dst.Annotations) == 0 { - dst.Annotations = nil - } - } - - // set default control plane outbound lb for private v1alpha3 clusters. - if src.Spec.NetworkSpec.APIServerLB.Type == Internal { - dst.Spec.NetworkSpec.ControlPlaneOutboundLB = &infrav1.LoadBalancerSpec{ - FrontendIPsCount: pointer.Int32(1), - } - // We also need to set the defaults here because "get" won't set defaults, and hence there is no mismatch when a client - // gets a v1alpha3 cluster. - dst.SetControlPlaneOutboundLBDefaults() - } - - // set default node plane outbound lb for all v1alpha3 clusters. - dst.Spec.NetworkSpec.NodeOutboundLB = &infrav1.LoadBalancerSpec{ - FrontendIPsCount: pointer.Int32(1), - } - // We also need to set the defaults here because "get" won't set defaults, and hence there is no mismatch when a client - // gets a v1alpha3 cluster. - dst.SetNodeOutboundLBDefaults() - - // Manually restore data. - restored := &infrav1.AzureCluster{} - if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { - return err - } - - // override outbound lb if it's present in restored. - dst.Spec.NetworkSpec.ControlPlaneOutboundLB = restored.Spec.NetworkSpec.ControlPlaneOutboundLB - dst.Spec.NetworkSpec.NodeOutboundLB = restored.Spec.NetworkSpec.NodeOutboundLB - - dst.Spec.NetworkSpec.PrivateDNSZoneName = restored.Spec.NetworkSpec.PrivateDNSZoneName - - dst.Spec.NetworkSpec.APIServerLB.FrontendIPsCount = restored.Spec.NetworkSpec.APIServerLB.FrontendIPsCount - dst.Spec.NetworkSpec.APIServerLB.IdleTimeoutInMinutes = restored.Spec.NetworkSpec.APIServerLB.IdleTimeoutInMinutes - - for _, restoredFrontendIP := range restored.Spec.NetworkSpec.APIServerLB.FrontendIPs { - for i, dstFrontendIP := range dst.Spec.NetworkSpec.APIServerLB.FrontendIPs { - if restoredFrontendIP.Name == dstFrontendIP.Name && restoredFrontendIP.PublicIP != nil { - dst.Spec.NetworkSpec.APIServerLB.FrontendIPs[i].PublicIP.IPTags = restoredFrontendIP.PublicIP.IPTags - } - } - } - - dst.Spec.CloudProviderConfigOverrides = restored.Spec.CloudProviderConfigOverrides - dst.Spec.BastionSpec = restored.Spec.BastionSpec - - // Here we manually restore outbound security rules. Since v1alpha3 only supports ingress ("Inbound") rules, all v1alpha4/v1beta1 outbound rules are dropped when an AzureCluster - // is converted to v1alpha3. We loop through all security group rules. For all previously existing outbound rules we restore the full rule. - // Also restores ServiceEndpoints - for _, restoredSubnet := range restored.Spec.NetworkSpec.Subnets { - for i, dstSubnet := range dst.Spec.NetworkSpec.Subnets { - if dstSubnet.Name != restoredSubnet.Name { - continue - } - var restoredOutboundRules []infrav1.SecurityRule - for _, restoredSecurityRule := range restoredSubnet.SecurityGroup.SecurityRules { - if restoredSecurityRule.Direction != infrav1.SecurityRuleDirectionInbound { - // For non-inbound rules which are only supported starting in v1alpha4/v1beta1, we restore the entire rule. - restoredOutboundRules = append(restoredOutboundRules, restoredSecurityRule) - } - } - dst.Spec.NetworkSpec.Subnets[i].SecurityGroup.SecurityRules = append(dst.Spec.NetworkSpec.Subnets[i].SecurityGroup.SecurityRules, restoredOutboundRules...) - dst.Spec.NetworkSpec.Subnets[i].NatGateway = restoredSubnet.NatGateway - dst.Spec.NetworkSpec.Subnets[i].ServiceEndpoints = restoredSubnet.ServiceEndpoints - dst.Spec.NetworkSpec.Subnets[i].PrivateEndpoints = restoredSubnet.PrivateEndpoints - - break - } - } - - dst.Status.LongRunningOperationStates = restored.Status.LongRunningOperationStates - - // Restore list of virtual network peerings - dst.Spec.NetworkSpec.Vnet.Peerings = restored.Spec.NetworkSpec.Vnet.Peerings - - // Restore ExtendedLocation properties - dst.Spec.ExtendedLocation = restored.Spec.ExtendedLocation - - return nil -} - -// ConvertFrom converts from the Hub version (v1beta1) to this version. -func (dst *AzureCluster) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*infrav1.AzureCluster) - if err := Convert_v1beta1_AzureCluster_To_v1alpha3_AzureCluster(src, dst, nil); err != nil { - return err - } - - // Preserve Spec.AzureEnvironment in annotation `azurecluster.infrastructure.cluster.x-k8s.io/azureEnvironment` - if src.Spec.AzureEnvironment != "" { - if dst.Annotations == nil { - dst.Annotations = make(map[string]string) - } - dst.Annotations[azureEnvironmentAnnotation] = src.Spec.AzureEnvironment - } - - // Preserve Hub data on down-conversion. - return utilconversion.MarshalData(src, dst) -} - -// ConvertTo converts this AzureClusterList to the Hub version (v1beta1). -func (src *AzureClusterList) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*infrav1.AzureClusterList) - return Convert_v1alpha3_AzureClusterList_To_v1beta1_AzureClusterList(src, dst, nil) -} - -// ConvertFrom converts from the Hub version (v1beta1) to this version. -func (dst *AzureClusterList) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*infrav1.AzureClusterList) - return Convert_v1beta1_AzureClusterList_To_v1alpha3_AzureClusterList(src, dst, nil) -} - -// Convert_v1alpha3_AzureClusterStatus_To_v1beta1_AzureClusterStatus converts AzureCluster.Status from v1alpha3 to v1beta1. -func Convert_v1alpha3_AzureClusterStatus_To_v1beta1_AzureClusterStatus(in *AzureClusterStatus, out *infrav1.AzureClusterStatus, s apiconversion.Scope) error { - return autoConvert_v1alpha3_AzureClusterStatus_To_v1beta1_AzureClusterStatus(in, out, s) -} - -// Convert_v1alpha3_AzureClusterSpec_To_v1beta1_AzureClusterSpec converts AzureCluster.Spec from v1alpha3 to v1beta1. -func Convert_v1alpha3_AzureClusterSpec_To_v1beta1_AzureClusterSpec(in *AzureClusterSpec, out *infrav1.AzureClusterSpec, s apiconversion.Scope) error { - if err := autoConvert_v1alpha3_AzureClusterSpec_To_v1beta1_AzureClusterSpec(in, out, s); err != nil { - return err - } - - // copy AzureClusterClassSpec fields - out.SubscriptionID = in.SubscriptionID - out.Location = in.Location - out.AdditionalTags = *(*infrav1.Tags)(&in.AdditionalTags) - out.IdentityRef = in.IdentityRef - - return nil -} - -// Convert_v1beta1_AzureClusterSpec_To_v1alpha3_AzureClusterSpec converts from the Hub version (v1beta1) of the AzureClusterSpec to this version. -func Convert_v1beta1_AzureClusterSpec_To_v1alpha3_AzureClusterSpec(in *infrav1.AzureClusterSpec, out *AzureClusterSpec, s apiconversion.Scope) error { - if err := autoConvert_v1beta1_AzureClusterSpec_To_v1alpha3_AzureClusterSpec(in, out, s); err != nil { - return err - } - - // copy AzureClusterClassSpec fields - out.SubscriptionID = in.SubscriptionID - out.Location = in.Location - out.AdditionalTags = Tags(in.AdditionalTags) - out.IdentityRef = in.IdentityRef - - return nil -} - -// Convert_v1beta1_AzureClusterStatus_To_v1alpha3_AzureClusterStatus converts an Azure cluster status from v1beta1 to v1alpha3. -func Convert_v1beta1_AzureClusterStatus_To_v1alpha3_AzureClusterStatus(in *infrav1.AzureClusterStatus, out *AzureClusterStatus, s apiconversion.Scope) error { - return autoConvert_v1beta1_AzureClusterStatus_To_v1alpha3_AzureClusterStatus(in, out, s) -} - -// Convert_v1alpha3_NetworkSpec_To_v1beta1_NetworkSpec converts a network spec from v1alpha3 to v1beta1. -func Convert_v1alpha3_NetworkSpec_To_v1beta1_NetworkSpec(in *NetworkSpec, out *infrav1.NetworkSpec, s apiconversion.Scope) error { - if err := Convert_v1alpha3_VnetSpec_To_v1beta1_VnetSpec(&in.Vnet, &out.Vnet, s); err != nil { - return err - } - - out.Subnets = make(infrav1.Subnets, len(in.Subnets)) - for i := range in.Subnets { - out.Subnets[i] = infrav1.SubnetSpec{} - if err := Convert_v1alpha3_SubnetSpec_To_v1beta1_SubnetSpec(&in.Subnets[i], &out.Subnets[i], s); err != nil { - return err - } - } - - return Convert_v1alpha3_LoadBalancerSpec_To_v1beta1_LoadBalancerSpec(&in.APIServerLB, &out.APIServerLB, s) -} - -// Convert_v1beta1_NetworkSpec_To_v1alpha3_NetworkSpec converts a network spec from v1beta1 to v1alpha3. -func Convert_v1beta1_NetworkSpec_To_v1alpha3_NetworkSpec(in *infrav1.NetworkSpec, out *NetworkSpec, s apiconversion.Scope) error { - if err := Convert_v1beta1_VnetSpec_To_v1alpha3_VnetSpec(&in.Vnet, &out.Vnet, s); err != nil { - return err - } - - out.Subnets = make(Subnets, len(in.Subnets)) - for i := range in.Subnets { - out.Subnets[i] = SubnetSpec{} - if err := Convert_v1beta1_SubnetSpec_To_v1alpha3_SubnetSpec(&in.Subnets[i], &out.Subnets[i], s); err != nil { - return err - } - } - - return Convert_v1beta1_LoadBalancerSpec_To_v1alpha3_LoadBalancerSpec(&in.APIServerLB, &out.APIServerLB, s) -} - -// Convert_v1beta1_VnetSpec_To_v1alpha3_VnetSpec converts a virtual network spec from v1beta1 to v1alpha3. -func Convert_v1beta1_VnetSpec_To_v1alpha3_VnetSpec(in *infrav1.VnetSpec, out *VnetSpec, s apiconversion.Scope) error { - if err := autoConvert_v1beta1_VnetSpec_To_v1alpha3_VnetSpec(in, out, s); err != nil { - return err - } - - // copy VnetClassSpec fields - out.CIDRBlocks = in.CIDRBlocks - out.Tags = Tags(in.Tags) - - return nil -} - -// Convert_v1alpha3_SubnetSpec_To_v1beta1_SubnetSpec converts a subnet spec from v1alpha3 to v1beta1. -func Convert_v1alpha3_SubnetSpec_To_v1beta1_SubnetSpec(in *SubnetSpec, out *infrav1.SubnetSpec, s apiconversion.Scope) error { - if err := autoConvert_v1alpha3_SubnetSpec_To_v1beta1_SubnetSpec(in, out, s); err != nil { - return err - } - - // Convert SubnetClassSpec fields - out.Name = in.Name - out.Role = infrav1.SubnetRole(in.Role) - out.CIDRBlocks = in.CIDRBlocks - - return nil -} - -// Convert_v1beta1_SubnetSpec_To_v1alpha3_SubnetSpec converts a subnet spec from v1beta1 to v1alpha3. -func Convert_v1beta1_SubnetSpec_To_v1alpha3_SubnetSpec(in *infrav1.SubnetSpec, out *SubnetSpec, s apiconversion.Scope) error { - if err := autoConvert_v1beta1_SubnetSpec_To_v1alpha3_SubnetSpec(in, out, s); err != nil { - return err - } - - // Convert SubnetClassSpec fields - out.Name = in.Name - out.Role = SubnetRole(in.Role) - out.CIDRBlocks = in.CIDRBlocks - - return nil -} - -// Convert_v1beta1_SecurityGroup_To_v1alpha3_SecurityGroup converts a security group from v1beta1 to v1alpha3. -func Convert_v1beta1_SecurityGroup_To_v1alpha3_SecurityGroup(in *infrav1.SecurityGroup, out *SecurityGroup, s apiconversion.Scope) error { - out.ID = in.ID - out.Name = in.Name - - out.IngressRules = make(IngressRules, 0) - for _, rule := range in.SecurityRules { - rule := rule - if rule.Direction == infrav1.SecurityRuleDirectionInbound { // only inbound rules are supported in v1alpha3. - ingressRule := IngressRule{} - if err := Convert_v1beta1_SecurityRule_To_v1alpha3_IngressRule(&rule, &ingressRule, s); err != nil { - return err - } - out.IngressRules = append(out.IngressRules, ingressRule) - } - } - - out.Tags = *(*Tags)(&in.Tags) - return nil -} - -// Convert_v1alpha3_SecurityGroup_To_v1beta1_SecurityGroup converts a security group from v1alpha3 to v1beta1. -func Convert_v1alpha3_SecurityGroup_To_v1beta1_SecurityGroup(in *SecurityGroup, out *infrav1.SecurityGroup, s apiconversion.Scope) error { - out.ID = in.ID - out.Name = in.Name - - out.SecurityRules = make(infrav1.SecurityRules, len(in.IngressRules)) - for i := range in.IngressRules { - out.SecurityRules[i] = infrav1.SecurityRule{} - if err := Convert_v1alpha3_IngressRule_To_v1beta1_SecurityRule(&in.IngressRules[i], &out.SecurityRules[i], s); err != nil { - return err - } - } - - out.Tags = *(*infrav1.Tags)(&in.Tags) - return nil -} - -// Convert_v1alpha3_IngressRule_To_v1beta1_SecurityRule converts from a v1alpha3 IngressRule to a v1beta1 SecurityRule. -func Convert_v1alpha3_IngressRule_To_v1beta1_SecurityRule(in *IngressRule, out *infrav1.SecurityRule, _ apiconversion.Scope) error { - out.Name = in.Name - out.Description = in.Description - out.Protocol = infrav1.SecurityGroupProtocol(in.Protocol) - out.Priority = in.Priority - out.SourcePorts = in.SourcePorts - out.DestinationPorts = in.DestinationPorts - out.Source = in.Source - out.Destination = in.Destination - out.Direction = infrav1.SecurityRuleDirectionInbound // all v1alpha3 rules are inbound. - return nil -} - -// Convert_v1beta1_SecurityRule_To_v1alpha3_IngressRule converts from a v1beta1 SecurityRule to a v1alpha3 IngressRule. -func Convert_v1beta1_SecurityRule_To_v1alpha3_IngressRule(in *infrav1.SecurityRule, out *IngressRule, _ apiconversion.Scope) error { - out.Name = in.Name - out.Description = in.Description - out.Protocol = SecurityGroupProtocol(in.Protocol) - out.Priority = in.Priority - out.SourcePorts = in.SourcePorts - out.DestinationPorts = in.DestinationPorts - out.Source = in.Source - out.Destination = in.Destination - return nil -} - -// Convert_v1alpha3_VnetSpec_To_v1beta1_VnetSpec is an autogenerated conversion function. -func Convert_v1alpha3_VnetSpec_To_v1beta1_VnetSpec(in *VnetSpec, out *infrav1.VnetSpec, s apiconversion.Scope) error { - if err := autoConvert_v1alpha3_VnetSpec_To_v1beta1_VnetSpec(in, out, s); err != nil { - return err - } - - // copy VnetClassSpec fields - out.CIDRBlocks = in.CIDRBlocks - out.Tags = *(*infrav1.Tags)(&in.Tags) - - return nil -} - -// Convert_v1beta1_LoadBalancerSpec_To_v1alpha3_LoadBalancerSpec is an autogenerated conversion function. -func Convert_v1beta1_LoadBalancerSpec_To_v1alpha3_LoadBalancerSpec(in *infrav1.LoadBalancerSpec, out *LoadBalancerSpec, s apiconversion.Scope) error { - if err := autoConvert_v1beta1_LoadBalancerSpec_To_v1alpha3_LoadBalancerSpec(in, out, s); err != nil { - return err - } - - // Convert LoadBalancerClassSpec fields - out.SKU = SKU(in.SKU) - if in.FrontendIPs != nil { - in, out := &in.FrontendIPs, &out.FrontendIPs - *out = make([]FrontendIP, len(*in)) - for i := range *in { - if err := Convert_v1beta1_FrontendIP_To_v1alpha3_FrontendIP(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.FrontendIPs = nil - } - out.Type = LBType(in.Type) - - return nil -} - -// Convert_v1alpha3_LoadBalancerSpec_To_v1beta1_LoadBalancerSpec converts an LB spec from v1alpha3 to v1beta1. -func Convert_v1alpha3_LoadBalancerSpec_To_v1beta1_LoadBalancerSpec(in *LoadBalancerSpec, out *infrav1.LoadBalancerSpec, s apiconversion.Scope) error { - if err := autoConvert_v1alpha3_LoadBalancerSpec_To_v1beta1_LoadBalancerSpec(in, out, s); err != nil { - return err - } - - // Convert LoadBalancerClassSpec fields - out.SKU = infrav1.SKU(in.SKU) - if in.FrontendIPs != nil { - in, out := &in.FrontendIPs, &out.FrontendIPs - *out = make([]infrav1.FrontendIP, len(*in)) - for i := range *in { - if err := Convert_v1alpha3_FrontendIP_To_v1beta1_FrontendIP(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.FrontendIPs = nil - } - out.Type = infrav1.LBType(in.Type) - - return nil -} - -// Convert_v1alpha3_Future_To_v1beta1_Future is an autogenerated conversion function. -func Convert_v1alpha3_Future_To_v1beta1_Future(in *Future, out *infrav1.Future, s apiconversion.Scope) error { - out.Data = in.FutureData - return autoConvert_v1alpha3_Future_To_v1beta1_Future(in, out, s) -} - -// Convert_v1beta1_Future_To_v1alpha3_Future is an autogenerated conversion function. -func Convert_v1beta1_Future_To_v1alpha3_Future(in *infrav1.Future, out *Future, s apiconversion.Scope) error { - out.FutureData = in.Data - return autoConvert_v1beta1_Future_To_v1alpha3_Future(in, out, s) -} - -// Convert_v1alpha3_FrontendIP_To_v1beta1_FrontendIP is an autogenerated conversion function. -func Convert_v1alpha3_FrontendIP_To_v1beta1_FrontendIP(in *FrontendIP, out *infrav1.FrontendIP, s apiconversion.Scope) error { - if err := autoConvert_v1alpha3_FrontendIP_To_v1beta1_FrontendIP(in, out, s); err != nil { - return err - } - - // Convert FrontendIPClass fields - out.PrivateIPAddress = in.PrivateIPAddress - - return nil -} - -// Convert_v1beta1_FrontendIP_To_v1alpha3_FrontendIP is an autogenerated conversion function. -func Convert_v1beta1_FrontendIP_To_v1alpha3_FrontendIP(in *infrav1.FrontendIP, out *FrontendIP, s apiconversion.Scope) error { - if err := autoConvert_v1beta1_FrontendIP_To_v1alpha3_FrontendIP(in, out, s); err != nil { - return err - } - - // Convert FrontendIPClass fields - out.PrivateIPAddress = in.PrivateIPAddress - - return nil -} - -// Convert_v1beta1_PublicIPSpec_To_v1alpha3_PublicIPSpec is an autogenerated conversion function. -func Convert_v1beta1_PublicIPSpec_To_v1alpha3_PublicIPSpec(in *infrav1.PublicIPSpec, out *PublicIPSpec, s apiconversion.Scope) error { - return autoConvert_v1beta1_PublicIPSpec_To_v1alpha3_PublicIPSpec(in, out, s) -} diff --git a/api/v1alpha3/azurecluster_types.go b/api/v1alpha3/azurecluster_types.go deleted file mode 100644 index 5694938a7d8..00000000000 --- a/api/v1alpha3/azurecluster_types.go +++ /dev/null @@ -1,120 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -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 v1alpha3 - -import ( - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3" -) - -const ( - // ClusterFinalizer allows ReconcileAzureCluster to clean up Azure resources associated with AzureCluster before - // removing it from the apiserver. - ClusterFinalizer = "azurecluster.infrastructure.cluster.x-k8s.io" - - // ClusterLabelNamespace indicates the namespace of the cluster. - ClusterLabelNamespace = "azurecluster.infrastructure.cluster.x-k8s.io/cluster-namespace" -) - -// AzureClusterSpec defines the desired state of AzureCluster. -type AzureClusterSpec struct { - // NetworkSpec encapsulates all things related to Azure network. - NetworkSpec NetworkSpec `json:"networkSpec,omitempty"` - - // +optional - ResourceGroup string `json:"resourceGroup,omitempty"` - - // +optional - SubscriptionID string `json:"subscriptionID,omitempty"` - - Location string `json:"location"` - - // ControlPlaneEndpoint represents the endpoint used to communicate with the control plane. - // +optional - ControlPlaneEndpoint clusterv1alpha3.APIEndpoint `json:"controlPlaneEndpoint"` - - // AdditionalTags is an optional set of tags to add to Azure resources managed by the Azure provider, in addition to the - // ones added by default. - // +optional - AdditionalTags Tags `json:"additionalTags,omitempty"` - - // IdentityRef is a reference to a AzureIdentity to be used when reconciling this cluster - // +optional - IdentityRef *corev1.ObjectReference `json:"identityRef,omitempty"` -} - -// AzureClusterStatus defines the observed state of AzureCluster. -type AzureClusterStatus struct { - // FailureDomains specifies the list of unique failure domains for the location/region of the cluster. - // A FailureDomain maps to Availability Zone with an Azure Region (if the region support them). An - // Availability Zone is a separate data center within a region and they can be used to ensure - // the cluster is more resilient to failure. - // See: https://learn.microsoft.com/azure/reliability/availability-zones-overview - // This list will be used by Cluster API to try and spread the machines across the failure domains. - FailureDomains clusterv1alpha3.FailureDomains `json:"failureDomains,omitempty"` - - // Ready is true when the provider resource is ready. - // +optional - Ready bool `json:"ready"` - - // Conditions defines current service state of the AzureCluster. - // +optional - Conditions clusterv1alpha3.Conditions `json:"conditions,omitempty"` -} - -// +kubebuilder:object:root=true -// +kubebuilder:printcolumn:name="Cluster",type="string",JSONPath=".metadata.labels.cluster\\.x-k8s\\.io/cluster-name",description="Cluster to which this AzureCluster belongs" -// +kubebuilder:printcolumn:name="Ready",type="boolean",JSONPath=".status.ready" -// +kubebuilder:printcolumn:name="Resource Group",type="string",priority=1,JSONPath=".spec.resourceGroup" -// +kubebuilder:printcolumn:name="SubscriptionID",type="string",priority=1,JSONPath=".spec.subscriptionID" -// +kubebuilder:printcolumn:name="Location",type="string",priority=1,JSONPath=".spec.location" -// +kubebuilder:printcolumn:name="Endpoint",type="string",priority=1,JSONPath=".spec.controlPlaneEndpoint.host",description="Control Plane Endpoint" -// +kubebuilder:resource:path=azureclusters,scope=Namespaced,categories=cluster-api -// +kubebuilder:subresource:status - -// AzureCluster is the Schema for the azureclusters API. -type AzureCluster struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec AzureClusterSpec `json:"spec,omitempty"` - Status AzureClusterStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// AzureClusterList contains a list of AzureClusters. -type AzureClusterList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []AzureCluster `json:"items"` -} - -// GetConditions returns the list of conditions for an AzureCluster API object. -func (c *AzureCluster) GetConditions() clusterv1alpha3.Conditions { - return c.Status.Conditions -} - -// SetConditions will set the given conditions on an AzureCluster object. -func (c *AzureCluster) SetConditions(conditions clusterv1alpha3.Conditions) { - c.Status.Conditions = conditions -} - -func init() { - SchemeBuilder.Register(&AzureCluster{}, &AzureClusterList{}) -} diff --git a/api/v1alpha3/azureclusteridentity_conversion.go b/api/v1alpha3/azureclusteridentity_conversion.go deleted file mode 100644 index 61cd304688c..00000000000 --- a/api/v1alpha3/azureclusteridentity_conversion.go +++ /dev/null @@ -1,112 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha3 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - apiconversion "k8s.io/apimachinery/pkg/conversion" - infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" - utilconversion "sigs.k8s.io/cluster-api/util/conversion" - "sigs.k8s.io/controller-runtime/pkg/conversion" -) - -const ( - // AzureClusterKind is the Kubernetes Kind for AzureCluster. - AzureClusterKind = "AzureCluster" -) - -// ConvertTo converts this AzureCluster to the Hub version (v1beta1). -func (src *AzureClusterIdentity) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*infrav1.AzureClusterIdentity) - if err := Convert_v1alpha3_AzureClusterIdentity_To_v1beta1_AzureClusterIdentity(src, dst, nil); err != nil { - return err - } - - // Manually restore data. - restored := &infrav1.AzureClusterIdentity{} - if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { - return err - } - - if len(dst.Annotations) == 0 { - dst.Annotations = nil - } - - if len(src.Spec.AllowedNamespaces) > 0 { - dst.Spec.AllowedNamespaces = &infrav1.AllowedNamespaces{} - dst.Spec.AllowedNamespaces.NamespaceList = append(dst.Spec.AllowedNamespaces.NamespaceList, src.Spec.AllowedNamespaces...) - } - - if restored.Spec.AllowedNamespaces != nil && restored.Spec.AllowedNamespaces.Selector != nil { - if dst.Spec.AllowedNamespaces == nil { - dst.Spec.AllowedNamespaces = &infrav1.AllowedNamespaces{} - } - dst.Spec.AllowedNamespaces.Selector = restored.Spec.AllowedNamespaces.Selector - } - - // removing ownerReference for AzureCluster as ownerReference is not required from v1alpha4/v1beta1 onwards. - var restoredOwnerReferences []metav1.OwnerReference - for _, ownerRef := range dst.OwnerReferences { - if ownerRef.Kind != AzureClusterKind { - restoredOwnerReferences = append(restoredOwnerReferences, ownerRef) - } - } - dst.OwnerReferences = restoredOwnerReferences - - return nil -} - -// ConvertFrom converts from the Hub version (v1beta1) to this version. -func (dst *AzureClusterIdentity) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*infrav1.AzureClusterIdentity) - if err := Convert_v1beta1_AzureClusterIdentity_To_v1alpha3_AzureClusterIdentity(src, dst, nil); err != nil { - return err - } - - // Preserve Hub data on down-conversion. - if err := utilconversion.MarshalData(src, dst); err != nil { - return err - } - - if src.Spec.AllowedNamespaces != nil { - dst.Spec.AllowedNamespaces = append(dst.Spec.AllowedNamespaces, src.Spec.AllowedNamespaces.NamespaceList...) - } - - return nil -} - -// Convert_v1alpha3_AzureClusterIdentitySpec_To_v1beta1_AzureClusterIdentitySpec converts an Azure cluster identity spec from v1alpha3 to v1beta1. -func Convert_v1alpha3_AzureClusterIdentitySpec_To_v1beta1_AzureClusterIdentitySpec(in *AzureClusterIdentitySpec, out *infrav1.AzureClusterIdentitySpec, s apiconversion.Scope) error { - return autoConvert_v1alpha3_AzureClusterIdentitySpec_To_v1beta1_AzureClusterIdentitySpec(in, out, s) -} - -// Convert_v1beta1_AzureClusterIdentitySpec_To_v1alpha3_AzureClusterIdentitySpec converts an Azure cluster identity spec from v1beta1 to v1alpha3. -func Convert_v1beta1_AzureClusterIdentitySpec_To_v1alpha3_AzureClusterIdentitySpec(in *infrav1.AzureClusterIdentitySpec, out *AzureClusterIdentitySpec, s apiconversion.Scope) error { - return autoConvert_v1beta1_AzureClusterIdentitySpec_To_v1alpha3_AzureClusterIdentitySpec(in, out, s) -} - -// ConvertTo converts this AzureClusterIdentityList to the Hub version (v1beta1). -func (src *AzureClusterIdentityList) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*infrav1.AzureClusterIdentityList) - return Convert_v1alpha3_AzureClusterIdentityList_To_v1beta1_AzureClusterIdentityList(src, dst, nil) -} - -// ConvertFrom converts from the Hub version (v1beta1) to this version. -func (dst *AzureClusterIdentityList) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*infrav1.AzureClusterIdentityList) - return Convert_v1beta1_AzureClusterIdentityList_To_v1alpha3_AzureClusterIdentityList(src, dst, nil) -} diff --git a/api/v1alpha3/azureclusteridentity_types.go b/api/v1alpha3/azureclusteridentity_types.go deleted file mode 100644 index fbeba3b65a0..00000000000 --- a/api/v1alpha3/azureclusteridentity_types.go +++ /dev/null @@ -1,104 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -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 v1alpha3 - -import ( - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3" -) - -// AzureClusterIdentitySpec defines the parameters that are used to create an AzureIdentity. -type AzureClusterIdentitySpec struct { - // UserAssignedMSI or Service Principal - Type IdentityType `json:"type"` - // User assigned MSI resource id. - // +optional - ResourceID string `json:"resourceID,omitempty"` - // Both User Assigned MSI and SP can use this field. - ClientID string `json:"clientID"` - // ClientSecret is a secret reference which should contain either a Service Principal password or certificate secret. - // +optional - ClientSecret corev1.SecretReference `json:"clientSecret,omitempty"` - // Service principal primary tenant id. - TenantID string `json:"tenantID"` - // AllowedNamespaces is an array of namespaces that AzureClusters can - // use this Identity from. - // - // An empty list (default) indicates that AzureClusters can use this - // Identity from any namespace. This field is intentionally not a - // pointer because the nil behavior (no namespaces) is undesirable here. - // +optional - AllowedNamespaces []string `json:"allowedNamespaces"` -} - -// AzureClusterIdentityStatus defines the observed state of AzureClusterIdentity. -type AzureClusterIdentityStatus struct { - // Conditions defines current service state of the AzureClusterIdentity. - // +optional - Conditions clusterv1alpha3.Conditions `json:"conditions,omitempty"` -} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:path=azureclusteridentities,scope=Namespaced,categories=cluster-api -// +kubebuilder:subresource:status - -// AzureClusterIdentity is the Schema for the azureclustersidentities API. -type AzureClusterIdentity struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec AzureClusterIdentitySpec `json:"spec,omitempty"` - Status AzureClusterIdentityStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// AzureClusterIdentityList contains a list of AzureClusterIdentities. -type AzureClusterIdentityList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []AzureClusterIdentity `json:"items"` -} - -// GetConditions returns the list of conditions for an AzureClusterIdentity API object. -func (c *AzureClusterIdentity) GetConditions() clusterv1alpha3.Conditions { - return c.Status.Conditions -} - -// SetConditions will set the given conditions on an AzureClusterIdentity object. -func (c *AzureClusterIdentity) SetConditions(conditions clusterv1alpha3.Conditions) { - c.Status.Conditions = conditions -} - -// ClusterNamespaceAllowed indicates if the cluster namespace is allowed. -func (c *AzureClusterIdentity) ClusterNamespaceAllowed(namespace string) bool { - if len(c.Spec.AllowedNamespaces) == 0 { - return true - } - for _, v := range c.Spec.AllowedNamespaces { - if v == namespace { - return true - } - } - - return false -} - -func init() { - SchemeBuilder.Register(&AzureClusterIdentity{}, &AzureClusterIdentityList{}) -} diff --git a/api/v1alpha3/azuremachine_conversion.go b/api/v1alpha3/azuremachine_conversion.go deleted file mode 100644 index 8920037cb71..00000000000 --- a/api/v1alpha3/azuremachine_conversion.go +++ /dev/null @@ -1,208 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha3 - -import ( - apiconversion "k8s.io/apimachinery/pkg/conversion" - infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" - utilconversion "sigs.k8s.io/cluster-api/util/conversion" - "sigs.k8s.io/controller-runtime/pkg/conversion" -) - -// ConvertTo converts this AzureMachine to the Hub version (v1beta1). -func (src *AzureMachine) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*infrav1.AzureMachine) - if err := Convert_v1alpha3_AzureMachine_To_v1beta1_AzureMachine(src, dst, nil); err != nil { - return err - } - - // Manually restore data from annotations - restored := &infrav1.AzureMachine{} - if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { - return err - } - - // Handle special case for conversion of ManagedDisk to pointer. - if restored.Spec.OSDisk.ManagedDisk == nil && dst.Spec.OSDisk.ManagedDisk != nil { - if *dst.Spec.OSDisk.ManagedDisk == (infrav1.ManagedDiskParameters{}) { - // restore nil value if nothing has changed since conversion - dst.Spec.OSDisk.ManagedDisk = nil - } - } - - if restored.Spec.Image != nil && restored.Spec.Image.SharedGallery != nil { - dst.Spec.Image.SharedGallery.Offer = restored.Spec.Image.SharedGallery.Offer - dst.Spec.Image.SharedGallery.Publisher = restored.Spec.Image.SharedGallery.Publisher - dst.Spec.Image.SharedGallery.SKU = restored.Spec.Image.SharedGallery.SKU - } - - if dst.Spec.Image != nil && restored.Spec.Image.ComputeGallery != nil { - dst.Spec.Image.ComputeGallery = restored.Spec.Image.ComputeGallery - } - - if restored.Spec.AdditionalCapabilities != nil { - dst.Spec.AdditionalCapabilities = restored.Spec.AdditionalCapabilities - } - - if len(restored.Spec.DNSServers) > 0 { - dst.Spec.DNSServers = restored.Spec.DNSServers - } - - if len(restored.Spec.VMExtensions) > 0 { - dst.Spec.VMExtensions = restored.Spec.VMExtensions - } - - if restored.Spec.SpotVMOptions != nil && restored.Spec.SpotVMOptions.EvictionPolicy != nil { - dst.Spec.SpotVMOptions.EvictionPolicy = restored.Spec.SpotVMOptions.EvictionPolicy - } - - if restored.Spec.Diagnostics != nil { - dst.Spec.Diagnostics = restored.Spec.Diagnostics - } - - if restored.Spec.NetworkInterfaces != nil { - dst.Spec.NetworkInterfaces = restored.Spec.NetworkInterfaces - } - - if restored.Spec.SystemAssignedIdentityRole != nil { - dst.Spec.SystemAssignedIdentityRole = restored.Spec.SystemAssignedIdentityRole - } - - //nolint:staticcheck // SubnetName is now deprecated, but the v1beta1 defaulting webhook will migrate it to the networkInterfaces field - dst.Spec.SubnetName = restored.Spec.SubnetName - - dst.Status.LongRunningOperationStates = restored.Status.LongRunningOperationStates - - return nil -} - -// ConvertFrom converts from the Hub version (v1beta1) to this version. -func (dst *AzureMachine) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*infrav1.AzureMachine) - if err := Convert_v1beta1_AzureMachine_To_v1alpha3_AzureMachine(src, dst, nil); err != nil { - return err - } - - // Preserve Hub data on down-conversion. - return utilconversion.MarshalData(src, dst) -} - -// ConvertTo converts this AzureMachineList to the Hub version (v1beta1). -func (src *AzureMachineList) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*infrav1.AzureMachineList) - return Convert_v1alpha3_AzureMachineList_To_v1beta1_AzureMachineList(src, dst, nil) -} - -// ConvertFrom converts from the Hub version (v1beta1) to this version. -func (dst *AzureMachineList) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*infrav1.AzureMachineList) - return Convert_v1beta1_AzureMachineList_To_v1alpha3_AzureMachineList(src, dst, nil) -} - -// Convert_v1alpha3_AzureMachineSpec_To_v1beta1_AzureMachineSpec converts this AzureMachineSpec to the Hub version (v1beta1). -func Convert_v1alpha3_AzureMachineSpec_To_v1beta1_AzureMachineSpec(in *AzureMachineSpec, out *infrav1.AzureMachineSpec, s apiconversion.Scope) error { - return autoConvert_v1alpha3_AzureMachineSpec_To_v1beta1_AzureMachineSpec(in, out, s) -} - -// Convert_v1beta1_AzureMachineSpec_To_v1alpha3_AzureMachineSpec converts from the Hub version (v1beta1) of the AzureMachineSpec to this version. -func Convert_v1beta1_AzureMachineSpec_To_v1alpha3_AzureMachineSpec(in *infrav1.AzureMachineSpec, out *AzureMachineSpec, s apiconversion.Scope) error { - return autoConvert_v1beta1_AzureMachineSpec_To_v1alpha3_AzureMachineSpec(in, out, s) -} - -// Convert_v1alpha3_AzureMachineStatus_To_v1beta1_AzureMachineStatus converts this AzureMachineStatus to the Hub version (v1beta1). -func Convert_v1alpha3_AzureMachineStatus_To_v1beta1_AzureMachineStatus(in *AzureMachineStatus, out *infrav1.AzureMachineStatus, s apiconversion.Scope) error { - return autoConvert_v1alpha3_AzureMachineStatus_To_v1beta1_AzureMachineStatus(in, out, s) -} - -// Convert_v1beta1_AzureMachineStatus_To_v1alpha3_AzureMachineStatus converts from the Hub version (v1beta1) of the AzureMachineStatus to this version. -func Convert_v1beta1_AzureMachineStatus_To_v1alpha3_AzureMachineStatus(in *infrav1.AzureMachineStatus, out *AzureMachineStatus, s apiconversion.Scope) error { - return autoConvert_v1beta1_AzureMachineStatus_To_v1alpha3_AzureMachineStatus(in, out, s) -} - -// Convert_v1alpha3_OSDisk_To_v1beta1_OSDisk converts this OSDisk to the Hub version (v1beta1). -func Convert_v1alpha3_OSDisk_To_v1beta1_OSDisk(in *OSDisk, out *infrav1.OSDisk, s apiconversion.Scope) error { - out.OSType = in.OSType - if in.DiskSizeGB != 0 { - out.DiskSizeGB = &in.DiskSizeGB - } - out.DiffDiskSettings = (*infrav1.DiffDiskSettings)(in.DiffDiskSettings) - out.CachingType = in.CachingType - out.ManagedDisk = &infrav1.ManagedDiskParameters{} - - return Convert_v1alpha3_ManagedDisk_To_v1beta1_ManagedDiskParameters(&in.ManagedDisk, out.ManagedDisk, s) -} - -// Convert_v1beta1_OSDisk_To_v1alpha3_OSDisk converts from the Hub version (v1beta1) of the AzureMachineStatus to this version. -func Convert_v1beta1_OSDisk_To_v1alpha3_OSDisk(in *infrav1.OSDisk, out *OSDisk, s apiconversion.Scope) error { - out.OSType = in.OSType - if in.DiskSizeGB != nil { - out.DiskSizeGB = *in.DiskSizeGB - } - out.DiffDiskSettings = (*DiffDiskSettings)(in.DiffDiskSettings) - out.CachingType = in.CachingType - - if in.ManagedDisk != nil { - out.ManagedDisk = ManagedDisk{} - if err := Convert_v1beta1_ManagedDiskParameters_To_v1alpha3_ManagedDisk(in.ManagedDisk, &out.ManagedDisk, s); err != nil { - return err - } - } - - return nil -} - -// Convert_v1alpha3_ManagedDisk_To_v1beta1_ManagedDiskParameters converts this ManagedDisk to the Hub version (v1beta1). -func Convert_v1alpha3_ManagedDisk_To_v1beta1_ManagedDiskParameters(in *ManagedDisk, out *infrav1.ManagedDiskParameters, s apiconversion.Scope) error { - out.StorageAccountType = in.StorageAccountType - out.DiskEncryptionSet = (*infrav1.DiskEncryptionSetParameters)(in.DiskEncryptionSet) - return nil -} - -// Convert_v1beta1_ManagedDiskParameters_To_v1alpha3_ManagedDisk converts from the Hub version (v1beta1) of the ManagedDiskParameters to this version. -func Convert_v1beta1_ManagedDiskParameters_To_v1alpha3_ManagedDisk(in *infrav1.ManagedDiskParameters, out *ManagedDisk, s apiconversion.Scope) error { - out.StorageAccountType = in.StorageAccountType - out.DiskEncryptionSet = (*DiskEncryptionSetParameters)(in.DiskEncryptionSet) - return nil -} - -// Convert_v1beta1_AzureMarketplaceImage_To_v1alpha3_AzureMarketplaceImage converts an Azure Marketplace image from v1beta1 to v1alpha3. -func Convert_v1beta1_AzureMarketplaceImage_To_v1alpha3_AzureMarketplaceImage(in *infrav1.AzureMarketplaceImage, out *AzureMarketplaceImage, s apiconversion.Scope) error { - out.Offer = in.ImagePlan.Offer - out.Publisher = in.ImagePlan.Publisher - out.SKU = in.ImagePlan.SKU - - return autoConvert_v1beta1_AzureMarketplaceImage_To_v1alpha3_AzureMarketplaceImage(in, out, s) -} - -// Convert_v1alpha3_AzureMarketplaceImage_To_v1beta1_AzureMarketplaceImage converts an Azure Marketplace image from v1alpha3 to v1beta1. -func Convert_v1alpha3_AzureMarketplaceImage_To_v1beta1_AzureMarketplaceImage(in *AzureMarketplaceImage, out *infrav1.AzureMarketplaceImage, s apiconversion.Scope) error { - out.ImagePlan.Offer = in.Offer - out.ImagePlan.Publisher = in.Publisher - out.ImagePlan.SKU = in.SKU - - return autoConvert_v1alpha3_AzureMarketplaceImage_To_v1beta1_AzureMarketplaceImage(in, out, s) -} - -// Convert_v1beta1_Image_To_v1alpha3_Image converts an image from v1beta1 to v1alpha3. -func Convert_v1beta1_Image_To_v1alpha3_Image(in *infrav1.Image, out *Image, s apiconversion.Scope) error { - return autoConvert_v1beta1_Image_To_v1alpha3_Image(in, out, s) -} - -// Convert_v1beta1_SpotVMOptions_To_v1alpha3_SpotVMOptions converts SpotVMOptions from v1beta1 to v1alpha3. -func Convert_v1beta1_SpotVMOptions_To_v1alpha3_SpotVMOptions(in *infrav1.SpotVMOptions, out *SpotVMOptions, s apiconversion.Scope) error { - return autoConvert_v1beta1_SpotVMOptions_To_v1alpha3_SpotVMOptions(in, out, s) -} diff --git a/api/v1alpha3/azuremachine_types.go b/api/v1alpha3/azuremachine_types.go deleted file mode 100644 index 0cd1a3f6302..00000000000 --- a/api/v1alpha3/azuremachine_types.go +++ /dev/null @@ -1,222 +0,0 @@ -/* -Copyright 2019 The Kubernetes Authors. - -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 v1alpha3 - -import ( - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/resource" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3" - "sigs.k8s.io/cluster-api/errors" -) - -const ( - // MachineFinalizer allows ReconcileAzureMachine to clean up Azure resources associated with AzureMachine before - // removing it from the apiserver. - MachineFinalizer = "azuremachine.infrastructure.cluster.x-k8s.io" -) - -// AzureMachineSpec defines the desired state of AzureMachine. -type AzureMachineSpec struct { - // ProviderID is the unique identifier as specified by the cloud provider. - // +optional - ProviderID *string `json:"providerID,omitempty"` - - VMSize string `json:"vmSize"` - - // FailureDomain is the failure domain unique identifier this Machine should be attached to, - // as defined in Cluster API. This relates to an Azure Availability Zone - FailureDomain *string `json:"failureDomain,omitempty"` - - // Deprecated: use FailureDomain instead - AvailabilityZone AvailabilityZone `json:"availabilityZone,omitempty"` - - // Image is used to provide details of an image to use during VM creation. - // If image details are omitted the image will default the Azure Marketplace "capi" offer, - // which is based on Ubuntu. - // +kubebuilder:validation:nullable - // +optional - Image *Image `json:"image,omitempty"` - - // Identity is the type of identity used for the virtual machine. - // The type 'SystemAssigned' is an implicitly created identity. - // The generated identity will be assigned a Subscription contributor role. - // The type 'UserAssigned' is a standalone Azure resource provided by the user - // and assigned to the VM - // +kubebuilder:default=None - // +optional - Identity VMIdentity `json:"identity,omitempty"` - - // UserAssignedIdentities is a list of standalone Azure identities provided by the user - // The lifecycle of a user-assigned identity is managed separately from the lifecycle of - // the AzureMachine. - // See https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/how-to-manage-ua-identity-cli - // +optional - UserAssignedIdentities []UserAssignedIdentity `json:"userAssignedIdentities,omitempty"` - - // RoleAssignmentName is the name of the role assignment to create for a system assigned identity. It can be any valid GUID. - // If not specified, a random GUID will be generated. - // +optional - RoleAssignmentName string `json:"roleAssignmentName,omitempty"` - - // OSDisk specifies the parameters for the operating system disk of the machine - OSDisk OSDisk `json:"osDisk"` - - // DataDisk specifies the parameters that are used to add one or more data disks to the machine - DataDisks []DataDisk `json:"dataDisks,omitempty"` - - // Deprecated: to support old clients, will be removed in v1alpha4/v1beta1 - Location string `json:"location"` - - SSHPublicKey string `json:"sshPublicKey"` - - // AdditionalTags is an optional set of tags to add to an instance, in addition to the ones added by default by the - // Azure provider. If both the AzureCluster and the AzureMachine specify the same tag name with different values, the - // AzureMachine's value takes precedence. - // +optional - AdditionalTags Tags `json:"additionalTags,omitempty"` - - // AllocatePublicIP allows the ability to create dynamic public ips for machines where this value is true. - // +optional - AllocatePublicIP bool `json:"allocatePublicIP,omitempty"` - - // EnableIPForwarding enables IP Forwarding in Azure which is required for some CNI's to send traffic from a pods on one machine - // to another. This is required for IpV6 with Calico in combination with User Defined Routes (set by the Azure Cloud Controller - // manager). Default is false for disabled. - // +optional - EnableIPForwarding bool `json:"enableIPForwarding,omitempty"` - - // AcceleratedNetworking enables or disables Azure accelerated networking. If omitted, it will be set based on - // whether the requested VMSize supports accelerated networking. - // If AcceleratedNetworking is set to true with a VMSize that does not support it, Azure will return an error. - // +kubebuilder:validation:nullable - // +optional - AcceleratedNetworking *bool `json:"acceleratedNetworking,omitempty"` - - // SpotVMOptions allows the ability to specify the Machine should use a Spot VM. - // +optional - SpotVMOptions *SpotVMOptions `json:"spotVMOptions,omitempty"` - - // SecurityProfile specifies the Security profile settings for a virtual machine. - // +optional - SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"` -} - -// SpotVMOptions defines the options relevant to running the Machine on Spot VMs. -type SpotVMOptions struct { - // MaxPrice defines the maximum price the user is willing to pay for Spot VM instances - // +optional - MaxPrice *resource.Quantity `json:"maxPrice,omitempty"` -} - -// AzureMachineStatus defines the observed state of AzureMachine. -type AzureMachineStatus struct { - // Ready is true when the provider resource is ready. - // +optional - Ready bool `json:"ready"` - - // Addresses contains the Azure instance associated addresses. - Addresses []corev1.NodeAddress `json:"addresses,omitempty"` - - // VMState is the provisioning state of the Azure virtual machine. - // +optional - VMState *VMState `json:"vmState,omitempty"` - - // ErrorReason will be set in the event that there is a terminal problem - // reconciling the Machine and will contain a succinct value suitable - // for machine interpretation. - // - // This field should not be set for transitive errors that a controller - // faces that are expected to be fixed automatically over - // time (like service outages), but instead indicate that something is - // fundamentally wrong with the Machine's spec or the configuration of - // the controller, and that manual intervention is required. Examples - // of terminal errors would be invalid combinations of settings in the - // spec, values that are unsupported by the controller, or the - // responsible controller itself being critically misconfigured. - // - // Any transient errors that occur during the reconciliation of Machines - // can be added as events to the Machine object and/or logged in the - // controller's output. - // +optional - FailureReason *errors.MachineStatusError `json:"failureReason,omitempty"` - - // ErrorMessage will be set in the event that there is a terminal problem - // reconciling the Machine and will contain a more verbose string suitable - // for logging and human consumption. - // - // This field should not be set for transitive errors that a controller - // faces that are expected to be fixed automatically over - // time (like service outages), but instead indicate that something is - // fundamentally wrong with the Machine's spec or the configuration of - // the controller, and that manual intervention is required. Examples - // of terminal errors would be invalid combinations of settings in the - // spec, values that are unsupported by the controller, or the - // responsible controller itself being critically misconfigured. - // - // Any transient errors that occur during the reconciliation of Machines - // can be added as events to the Machine object and/or logged in the - // controller's output. - // +optional - FailureMessage *string `json:"failureMessage,omitempty"` - - // Conditions defines current service state of the AzureMachine. - // +optional - Conditions clusterv1alpha3.Conditions `json:"conditions,omitempty"` -} - -// +kubebuilder:object:root=true -// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.ready",description="AzureMachine ready status" -// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.vmState",description="Azure VM provisioning state" -// +kubebuilder:printcolumn:name="Cluster",type="string",priority=1,JSONPath=".metadata.labels.cluster\\.x-k8s\\.io/cluster-name",description="Cluster to which this AzureMachine belongs" -// +kubebuilder:printcolumn:name="Machine",type="string",priority=1,JSONPath=".metadata.ownerReferences[?(@.kind==\"Machine\")].name",description="Machine object to which this AzureMachine belongs" -// +kubebuilder:printcolumn:name="VM ID",type="string",priority=1,JSONPath=".spec.providerID",description="Azure VM ID" -// +kubebuilder:printcolumn:name="VM Size",type="string",priority=1,JSONPath=".spec.vmSize",description="Azure VM Size" -// +kubebuilder:resource:path=azuremachines,scope=Namespaced,categories=cluster-api -// +kubebuilder:subresource:status - -// AzureMachine is the Schema for the azuremachines API. -type AzureMachine struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec AzureMachineSpec `json:"spec,omitempty"` - Status AzureMachineStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// AzureMachineList contains a list of AzureMachines. -type AzureMachineList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []AzureMachine `json:"items"` -} - -// GetConditions returns the list of conditions for an AzureMachine API object. -func (m *AzureMachine) GetConditions() clusterv1alpha3.Conditions { - return m.Status.Conditions -} - -// SetConditions will set the given conditions on an AzureMachine object. -func (m *AzureMachine) SetConditions(conditions clusterv1alpha3.Conditions) { - m.Status.Conditions = conditions -} - -func init() { - SchemeBuilder.Register(&AzureMachine{}, &AzureMachineList{}) -} diff --git a/api/v1alpha3/azuremachinetemplate_conversion.go b/api/v1alpha3/azuremachinetemplate_conversion.go deleted file mode 100644 index a182eb2e2c7..00000000000 --- a/api/v1alpha3/azuremachinetemplate_conversion.go +++ /dev/null @@ -1,123 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha3 - -import ( - apimachineryconversion "k8s.io/apimachinery/pkg/conversion" - infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" - utilconversion "sigs.k8s.io/cluster-api/util/conversion" - "sigs.k8s.io/controller-runtime/pkg/conversion" -) - -// ConvertTo converts this AzureMachineTemplate to the Hub version (v1beta1). -func (src *AzureMachineTemplate) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*infrav1.AzureMachineTemplate) - if err := Convert_v1alpha3_AzureMachineTemplate_To_v1beta1_AzureMachineTemplate(src, dst, nil); err != nil { - return err - } - - // Manually restore data from annotations - restored := &infrav1.AzureMachineTemplate{} - if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { - return err - } - - // Handle special case for conversion of ManagedDisk to pointer. - if restored.Spec.Template.Spec.OSDisk.ManagedDisk == nil && dst.Spec.Template.Spec.OSDisk.ManagedDisk != nil { - if *dst.Spec.Template.Spec.OSDisk.ManagedDisk == (infrav1.ManagedDiskParameters{}) { - // restore nil value if nothing has changed since conversion - dst.Spec.Template.Spec.OSDisk.ManagedDisk = nil - } - } - - if restored.Spec.Template.Spec.Image != nil && restored.Spec.Template.Spec.Image.SharedGallery != nil { - dst.Spec.Template.Spec.Image.SharedGallery.Offer = restored.Spec.Template.Spec.Image.SharedGallery.Offer - dst.Spec.Template.Spec.Image.SharedGallery.Publisher = restored.Spec.Template.Spec.Image.SharedGallery.Publisher - dst.Spec.Template.Spec.Image.SharedGallery.SKU = restored.Spec.Template.Spec.Image.SharedGallery.SKU - } - - if dst.Spec.Template.Spec.Image != nil && restored.Spec.Template.Spec.Image.ComputeGallery != nil { - dst.Spec.Template.Spec.Image.ComputeGallery = restored.Spec.Template.Spec.Image.ComputeGallery - } - - if restored.Spec.Template.Spec.AdditionalCapabilities != nil { - dst.Spec.Template.Spec.AdditionalCapabilities = restored.Spec.Template.Spec.AdditionalCapabilities - } - - if restored.Spec.Template.Spec.Diagnostics != nil { - dst.Spec.Template.Spec.Diagnostics = restored.Spec.Template.Spec.Diagnostics - } - - //nolint:staticcheck // SubnetName is now deprecated, but the v1beta1 defaulting webhook will migrate it to the networkInterfaces field - dst.Spec.Template.Spec.SubnetName = restored.Spec.Template.Spec.SubnetName - dst.Spec.Template.ObjectMeta = restored.Spec.Template.ObjectMeta - - if len(restored.Spec.Template.Spec.DNSServers) > 0 { - dst.Spec.Template.Spec.DNSServers = restored.Spec.Template.Spec.DNSServers - } - - if len(restored.Spec.Template.Spec.VMExtensions) > 0 { - dst.Spec.Template.Spec.VMExtensions = restored.Spec.Template.Spec.VMExtensions - } - - if restored.Spec.Template.Spec.SpotVMOptions != nil && restored.Spec.Template.Spec.SpotVMOptions.EvictionPolicy != nil { - dst.Spec.Template.Spec.SpotVMOptions.EvictionPolicy = restored.Spec.Template.Spec.SpotVMOptions.EvictionPolicy - } - - if restored.Spec.Template.Spec.NetworkInterfaces != nil { - dst.Spec.Template.Spec.NetworkInterfaces = restored.Spec.Template.Spec.NetworkInterfaces - } - - if restored.Spec.Template.Spec.SystemAssignedIdentityRole != nil { - dst.Spec.Template.Spec.SystemAssignedIdentityRole = restored.Spec.Template.Spec.SystemAssignedIdentityRole - } - - return nil -} - -// ConvertFrom converts from the Hub version (v1beta1) to this version. -func (dst *AzureMachineTemplate) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*infrav1.AzureMachineTemplate) - if err := Convert_v1beta1_AzureMachineTemplate_To_v1alpha3_AzureMachineTemplate(src, dst, nil); err != nil { - return err - } - - // Preserve Hub data on down-conversion. - return utilconversion.MarshalData(src, dst) -} - -// ConvertTo converts this AzureMachineTemplateList to the Hub version (v1beta1). -func (src *AzureMachineTemplateList) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*infrav1.AzureMachineTemplateList) - return Convert_v1alpha3_AzureMachineTemplateList_To_v1beta1_AzureMachineTemplateList(src, dst, nil) -} - -// ConvertFrom converts from the Hub version (v1beta1) to this version. -func (dst *AzureMachineTemplateList) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*infrav1.AzureMachineTemplateList) - return Convert_v1beta1_AzureMachineTemplateList_To_v1alpha3_AzureMachineTemplateList(src, dst, nil) -} - -// Convert_v1beta1_AzureSharedGalleryImage_To_v1alpha3_AzureSharedGalleryImage converts an Azure shared gallery image from v1beta1 to v1alpha3. -func Convert_v1beta1_AzureSharedGalleryImage_To_v1alpha3_AzureSharedGalleryImage(in *infrav1.AzureSharedGalleryImage, out *AzureSharedGalleryImage, s apimachineryconversion.Scope) error { - return autoConvert_v1beta1_AzureSharedGalleryImage_To_v1alpha3_AzureSharedGalleryImage(in, out, s) -} - -// Convert_v1beta1_AzureMachineTemplateResource_To_v1alpha3_AzureMachineTemplateResource converts an Azure machine template resource from v1beta1 to v1alpha3. -func Convert_v1beta1_AzureMachineTemplateResource_To_v1alpha3_AzureMachineTemplateResource(in *infrav1.AzureMachineTemplateResource, out *AzureMachineTemplateResource, s apimachineryconversion.Scope) error { - return autoConvert_v1beta1_AzureMachineTemplateResource_To_v1alpha3_AzureMachineTemplateResource(in, out, s) -} diff --git a/api/v1alpha3/azuremachinetemplate_types.go b/api/v1alpha3/azuremachinetemplate_types.go deleted file mode 100644 index 675be93dbfa..00000000000 --- a/api/v1alpha3/azuremachinetemplate_types.go +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright 2019 The Kubernetes Authors. - -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 v1alpha3 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// AzureMachineTemplateSpec defines the desired state of AzureMachineTemplate. -type AzureMachineTemplateSpec struct { - Template AzureMachineTemplateResource `json:"template"` -} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:path=azuremachinetemplates,scope=Namespaced,categories=cluster-api - -// AzureMachineTemplate is the Schema for the azuremachinetemplates API. -type AzureMachineTemplate struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec AzureMachineTemplateSpec `json:"spec,omitempty"` -} - -// +kubebuilder:object:root=true - -// AzureMachineTemplateList contains a list of AzureMachineTemplate. -type AzureMachineTemplateList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []AzureMachineTemplate `json:"items"` -} - -func init() { - SchemeBuilder.Register(&AzureMachineTemplate{}, &AzureMachineTemplateList{}) -} - -// AzureMachineTemplateResource describes the data needed to create an AzureMachine from a template. -type AzureMachineTemplateResource struct { - // Spec is the specification of the desired behavior of the machine. - Spec AzureMachineSpec `json:"spec"` -} diff --git a/api/v1alpha3/azuremanagedcluster_conversion.go b/api/v1alpha3/azuremanagedcluster_conversion.go deleted file mode 100644 index eaecbf00ec6..00000000000 --- a/api/v1alpha3/azuremanagedcluster_conversion.go +++ /dev/null @@ -1,63 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha3 - -import ( - infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" - utilconversion "sigs.k8s.io/cluster-api/util/conversion" - "sigs.k8s.io/controller-runtime/pkg/conversion" -) - -// ConvertTo converts this AzureManagedCluster to the Hub version (v1beta1). -func (src *AzureManagedCluster) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*infrav1.AzureManagedCluster) - if err := Convert_v1alpha3_AzureManagedCluster_To_v1beta1_AzureManagedCluster(src, dst, nil); err != nil { - return err - } - - // Manually restore data. - restored := &infrav1.AzureManagedCluster{} - if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { - return err - } - - return nil -} - -// ConvertFrom converts from the Hub version (v1beta1) to this version. -func (dst *AzureManagedCluster) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*infrav1.AzureManagedCluster) - - if err := Convert_v1beta1_AzureManagedCluster_To_v1alpha3_AzureManagedCluster(src, dst, nil); err != nil { - return err - } - - // Preserve Hub data on down-conversion. - return utilconversion.MarshalData(src, dst) -} - -// ConvertTo converts this AzureManagedClusterList to the Hub version (v1beta1). -func (src *AzureManagedClusterList) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*infrav1.AzureManagedClusterList) - return Convert_v1alpha3_AzureManagedClusterList_To_v1beta1_AzureManagedClusterList(src, dst, nil) -} - -// ConvertFrom converts from the Hub version (v1beta1) to this version. -func (dst *AzureManagedClusterList) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*infrav1.AzureManagedClusterList) - return Convert_v1beta1_AzureManagedClusterList_To_v1alpha3_AzureManagedClusterList(src, dst, nil) -} diff --git a/api/v1alpha3/azuremanagedcluster_types.go b/api/v1alpha3/azuremanagedcluster_types.go deleted file mode 100644 index 88b3e8b1112..00000000000 --- a/api/v1alpha3/azuremanagedcluster_types.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -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 v1alpha3 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3" -) - -// AzureManagedClusterSpec defines the desired state of AzureManagedCluster. -type AzureManagedClusterSpec struct { - // ControlPlaneEndpoint represents the endpoint used to communicate with the control plane. - // +optional - ControlPlaneEndpoint clusterv1alpha3.APIEndpoint `json:"controlPlaneEndpoint"` -} - -// AzureManagedClusterStatus defines the observed state of AzureManagedCluster. -type AzureManagedClusterStatus struct { - // Ready is true when the provider resource is ready. - // +optional - Ready bool `json:"ready,omitempty"` -} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:path=azuremanagedclusters,scope=Namespaced,categories=cluster-api,shortName=amc -// +kubebuilder:subresource:status - -// AzureManagedCluster is the Schema for the azuremanagedclusters API. -type AzureManagedCluster struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec AzureManagedClusterSpec `json:"spec,omitempty"` - Status AzureManagedClusterStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// AzureManagedClusterList contains a list of AzureManagedClusters. -type AzureManagedClusterList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []AzureManagedCluster `json:"items"` -} - -func init() { - SchemeBuilder.Register(&AzureManagedCluster{}, &AzureManagedClusterList{}) -} diff --git a/api/v1alpha3/azuremanagedcontrolplane_conversion.go b/api/v1alpha3/azuremanagedcontrolplane_conversion.go deleted file mode 100644 index 8365f660751..00000000000 --- a/api/v1alpha3/azuremanagedcontrolplane_conversion.go +++ /dev/null @@ -1,103 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha3 - -import ( - apiconversion "k8s.io/apimachinery/pkg/conversion" - infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" - utilconversion "sigs.k8s.io/cluster-api/util/conversion" - "sigs.k8s.io/controller-runtime/pkg/conversion" -) - -// ConvertTo converts this AzureManagedControlPlane to the Hub version (v1beta1). -func (src *AzureManagedControlPlane) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*infrav1.AzureManagedControlPlane) - if err := Convert_v1alpha3_AzureManagedControlPlane_To_v1beta1_AzureManagedControlPlane(src, dst, nil); err != nil { - return err - } - - // Manually restore data. - restored := &infrav1.AzureManagedControlPlane{} - if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { - return err - } - - dst.Spec.IdentityRef = restored.Spec.IdentityRef - dst.Spec.SKU = restored.Spec.SKU - dst.Spec.LoadBalancerProfile = restored.Spec.LoadBalancerProfile - dst.Spec.APIServerAccessProfile = restored.Spec.APIServerAccessProfile - dst.Spec.AddonProfiles = restored.Spec.AddonProfiles - dst.Spec.VirtualNetwork.ResourceGroup = restored.Spec.VirtualNetwork.ResourceGroup - dst.Spec.VirtualNetwork.Subnet.ServiceEndpoints = restored.Spec.VirtualNetwork.Subnet.ServiceEndpoints - dst.Spec.VirtualNetwork.Subnet.PrivateEndpoints = restored.Spec.VirtualNetwork.Subnet.PrivateEndpoints - dst.Spec.AutoScalerProfile = restored.Spec.AutoScalerProfile - dst.Spec.OutboundType = restored.Spec.OutboundType - - dst.Status.LongRunningOperationStates = restored.Status.LongRunningOperationStates - dst.Status.Conditions = restored.Status.Conditions - - return nil -} - -// ConvertFrom converts from the Hub version (v1beta1) to this version. -func (dst *AzureManagedControlPlane) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*infrav1.AzureManagedControlPlane) - - if err := Convert_v1beta1_AzureManagedControlPlane_To_v1alpha3_AzureManagedControlPlane(src, dst, nil); err != nil { - return err - } - - // Preserve Hub data on down-conversion. - return utilconversion.MarshalData(src, dst) -} - -// Convert_v1beta1_AzureManagedControlPlaneSpec_To_v1alpha3_AzureManagedControlPlaneSpec is an autogenerated conversion function. -func Convert_v1beta1_AzureManagedControlPlaneSpec_To_v1alpha3_AzureManagedControlPlaneSpec(in *infrav1.AzureManagedControlPlaneSpec, out *AzureManagedControlPlaneSpec, s apiconversion.Scope) error { - return autoConvert_v1beta1_AzureManagedControlPlaneSpec_To_v1alpha3_AzureManagedControlPlaneSpec(in, out, s) -} - -// Convert_v1beta1_AzureManagedControlPlaneStatus_To_v1alpha3_AzureManagedControlPlaneStatus is an autogenerated conversion function. -func Convert_v1beta1_AzureManagedControlPlaneStatus_To_v1alpha3_AzureManagedControlPlaneStatus(in *infrav1.AzureManagedControlPlaneStatus, out *AzureManagedControlPlaneStatus, s apiconversion.Scope) error { - return autoConvert_v1beta1_AzureManagedControlPlaneStatus_To_v1alpha3_AzureManagedControlPlaneStatus(in, out, s) -} - -// ConvertTo converts this AzureManagedControlPlane to the Hub version (v1beta1). -func (src *AzureManagedControlPlaneList) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*infrav1.AzureManagedControlPlaneList) - return Convert_v1alpha3_AzureManagedControlPlaneList_To_v1beta1_AzureManagedControlPlaneList(src, dst, nil) -} - -// ConvertFrom converts from the Hub version (v1beta1) to this version. -func (dst *AzureManagedControlPlaneList) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*infrav1.AzureManagedControlPlaneList) - return Convert_v1beta1_AzureManagedControlPlaneList_To_v1alpha3_AzureManagedControlPlaneList(src, dst, nil) -} - -// Convert_v1beta1_ManagedControlPlaneVirtualNetwork_To_v1alpha3_ManagedControlPlaneVirtualNetwork converts v1beta1 ManagedControlPlaneVirtualNetwork to v1alpha3 ManagedControlPlaneVirtualNetwork. -func Convert_v1beta1_ManagedControlPlaneVirtualNetwork_To_v1alpha3_ManagedControlPlaneVirtualNetwork(in *infrav1.ManagedControlPlaneVirtualNetwork, out *ManagedControlPlaneVirtualNetwork, s apiconversion.Scope) error { - out.Name = in.Name - out.Subnet.Name = in.Subnet.Name - out.Subnet.CIDRBlock = in.Subnet.CIDRBlock - out.CIDRBlock = in.CIDRBlock - - return nil -} - -// Convert_v1beta1_ManagedControlPlaneSubnet_To_v1alpha3_ManagedControlPlaneSubnet is a conversion function. -func Convert_v1beta1_ManagedControlPlaneSubnet_To_v1alpha3_ManagedControlPlaneSubnet(in *infrav1.ManagedControlPlaneSubnet, out *ManagedControlPlaneSubnet, s apiconversion.Scope) error { - return autoConvert_v1beta1_ManagedControlPlaneSubnet_To_v1alpha3_ManagedControlPlaneSubnet(in, out, s) -} diff --git a/api/v1alpha3/azuremanagedcontrolplane_types.go b/api/v1alpha3/azuremanagedcontrolplane_types.go deleted file mode 100644 index 2cfe68ec7b9..00000000000 --- a/api/v1alpha3/azuremanagedcontrolplane_types.go +++ /dev/null @@ -1,145 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -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 v1alpha3 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3" -) - -// AzureManagedControlPlaneSpec defines the desired state of AzureManagedControlPlane. -type AzureManagedControlPlaneSpec struct { - // Version defines the desired Kubernetes version. - // +kubebuilder:validation:MinLength:=2 - Version string `json:"version"` - - // ResourceGroupName is the name of the Azure resource group for this AKS Cluster. - ResourceGroupName string `json:"resourceGroupName"` - - // NodeResourceGroupName is the name of the resource group - // containing cluster IaaS resources. Will be populated to default - // in webhook. - NodeResourceGroupName string `json:"nodeResourceGroupName"` - - // VirtualNetwork describes the vnet for the AKS cluster. Will be created if it does not exist. - VirtualNetwork ManagedControlPlaneVirtualNetwork `json:"virtualNetwork,omitempty"` - - // SubscriotionID is the GUID of the Azure subscription to hold this cluster. - SubscriptionID string `json:"subscriptionID,omitempty"` - - // Location is a string matching one of the canonical Azure region names. Examples: "westus2", "eastus". - Location string `json:"location"` - - // ControlPlaneEndpoint represents the endpoint used to communicate with the control plane. - // +optional - ControlPlaneEndpoint clusterv1alpha3.APIEndpoint `json:"controlPlaneEndpoint"` - - // AdditionalTags is an optional set of tags to add to Azure resources managed by the Azure provider, in addition to the - // ones added by default. - // +optional - AdditionalTags Tags `json:"additionalTags,omitempty"` - - // NetworkPlugin used for building Kubernetes network. - // +kubebuilder:validation:Enum=azure;kubenet - // +optional - NetworkPlugin *string `json:"networkPlugin,omitempty"` - - // NetworkPolicy used for building Kubernetes network. - // +kubebuilder:validation:Enum=azure;calico - // +optional - NetworkPolicy *string `json:"networkPolicy,omitempty"` - - // SSHPublicKey is a string literal containing an ssh public key base64 encoded. - SSHPublicKey string `json:"sshPublicKey"` - - // DNSServiceIP is an IP address assigned to the Kubernetes DNS service. - // It must be within the Kubernetes service address range specified in serviceCidr. - // +optional - DNSServiceIP *string `json:"dnsServiceIP,omitempty"` - - // LoadBalancerSKU is the SKU of the loadBalancer to be provisioned. - // +kubebuilder:validation:Enum=Basic;Standard - // +optional - LoadBalancerSKU *string `json:"loadBalancerSKU,omitempty"` - - // AadProfile is Azure Active Directory configuration to integrate with AKS for aad authentication. - // +optional - AADProfile *AADProfile `json:"aadProfile,omitempty"` -} - -// AADProfile - AAD integration managed by AKS. -type AADProfile struct { - // Managed - Whether to enable managed AAD. - // +kubebuilder:validation:Required - Managed bool `json:"managed"` - - // AdminGroupObjectIDs - AAD group object IDs that will have admin role of the cluster. - // +kubebuilder:validation:Required - AdminGroupObjectIDs []string `json:"adminGroupObjectIDs"` -} - -// ManagedControlPlaneVirtualNetwork describes a virtual network required to provision AKS clusters. -type ManagedControlPlaneVirtualNetwork struct { - Name string `json:"name"` - CIDRBlock string `json:"cidrBlock"` - Subnet ManagedControlPlaneSubnet `json:"subnet,omitempty"` -} - -// ManagedControlPlaneSubnet describes a subnet for an AKS cluster. -type ManagedControlPlaneSubnet struct { - Name string `json:"name"` - CIDRBlock string `json:"cidrBlock"` -} - -// AzureManagedControlPlaneStatus defines the observed state of AzureManagedControlPlane. -type AzureManagedControlPlaneStatus struct { - // Ready is true when the provider resource is ready. - // +optional - Ready bool `json:"ready,omitempty"` - - // Initialized is true when the the control plane is available for initial contact. - // This may occur before the control plane is fully ready. - // In the AzureManagedControlPlane implementation, these are identical. - // +optional - Initialized bool `json:"initialized,omitempty"` -} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:path=azuremanagedcontrolplanes,scope=Namespaced,categories=cluster-api,shortName=amcp -// +kubebuilder:subresource:status - -// AzureManagedControlPlane is the Schema for the azuremanagedcontrolplanes API. -type AzureManagedControlPlane struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec AzureManagedControlPlaneSpec `json:"spec,omitempty"` - Status AzureManagedControlPlaneStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// AzureManagedControlPlaneList contains a list of AzureManagedControlPlanes. -type AzureManagedControlPlaneList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []AzureManagedControlPlane `json:"items"` -} - -func init() { - SchemeBuilder.Register(&AzureManagedControlPlane{}, &AzureManagedControlPlaneList{}) -} diff --git a/api/v1alpha3/azuremanagedmachinepool_conversion.go b/api/v1alpha3/azuremanagedmachinepool_conversion.go deleted file mode 100644 index 0719e5a8c8d..00000000000 --- a/api/v1alpha3/azuremanagedmachinepool_conversion.go +++ /dev/null @@ -1,96 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha3 - -import ( - apiconversion "k8s.io/apimachinery/pkg/conversion" - infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" - utilconversion "sigs.k8s.io/cluster-api/util/conversion" - "sigs.k8s.io/controller-runtime/pkg/conversion" -) - -// ConvertTo converts this AzureManagedMachinePool to the Hub version (v1beta1). -func (src *AzureManagedMachinePool) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*infrav1.AzureManagedMachinePool) - if err := Convert_v1alpha3_AzureManagedMachinePool_To_v1beta1_AzureManagedMachinePool(src, dst, nil); err != nil { - return err - } - - // Manually restore data. - restored := &infrav1.AzureManagedMachinePool{} - if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { - return err - } - - dst.Spec.Name = restored.Spec.Name - dst.Spec.Scaling = restored.Spec.Scaling - dst.Spec.Taints = restored.Spec.Taints - dst.Spec.AvailabilityZones = restored.Spec.AvailabilityZones - dst.Spec.MaxPods = restored.Spec.MaxPods - dst.Spec.OsDiskType = restored.Spec.OsDiskType - dst.Spec.OSType = restored.Spec.OSType - dst.Spec.NodeLabels = restored.Spec.NodeLabels - dst.Spec.EnableUltraSSD = restored.Spec.EnableUltraSSD - dst.Spec.EnableNodePublicIP = restored.Spec.EnableNodePublicIP - dst.Spec.NodePublicIPPrefixID = restored.Spec.NodePublicIPPrefixID - dst.Spec.ScaleSetPriority = restored.Spec.ScaleSetPriority - dst.Spec.AdditionalTags = restored.Spec.AdditionalTags - dst.Spec.KubeletDiskType = restored.Spec.KubeletDiskType - dst.Spec.LinuxOSConfig = restored.Spec.LinuxOSConfig - - if restored.Spec.KubeletConfig != nil { - dst.Spec.KubeletConfig = restored.Spec.KubeletConfig - } - - dst.Status.LongRunningOperationStates = restored.Status.LongRunningOperationStates - dst.Status.Conditions = restored.Status.Conditions - - return nil -} - -// ConvertFrom converts from the Hub version (v1beta1) to this version. -func (dst *AzureManagedMachinePool) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*infrav1.AzureManagedMachinePool) - if err := Convert_v1beta1_AzureManagedMachinePool_To_v1alpha3_AzureManagedMachinePool(src, dst, nil); err != nil { - return err - } - - // Preserve Hub data on down-conversion. - return utilconversion.MarshalData(src, dst) -} - -// Convert_v1beta1_AzureManagedMachinePoolSpec_To_v1alpha3_AzureManagedMachinePoolSpec is an autogenerated conversion function. -func Convert_v1beta1_AzureManagedMachinePoolSpec_To_v1alpha3_AzureManagedMachinePoolSpec(in *infrav1.AzureManagedMachinePoolSpec, out *AzureManagedMachinePoolSpec, s apiconversion.Scope) error { - return autoConvert_v1beta1_AzureManagedMachinePoolSpec_To_v1alpha3_AzureManagedMachinePoolSpec(in, out, s) -} - -// Convert_v1beta1_AzureManagedMachinePoolStatus_To_v1alpha3_AzureManagedMachinePoolStatus is an autogenerated conversion function. -func Convert_v1beta1_AzureManagedMachinePoolStatus_To_v1alpha3_AzureManagedMachinePoolStatus(in *infrav1.AzureManagedMachinePoolStatus, out *AzureManagedMachinePoolStatus, s apiconversion.Scope) error { - return autoConvert_v1beta1_AzureManagedMachinePoolStatus_To_v1alpha3_AzureManagedMachinePoolStatus(in, out, s) -} - -// ConvertTo converts this AzureManagedMachinePoolList to the Hub version (v1beta1). -func (src *AzureManagedMachinePoolList) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*infrav1.AzureManagedMachinePoolList) - return Convert_v1alpha3_AzureManagedMachinePoolList_To_v1beta1_AzureManagedMachinePoolList(src, dst, nil) -} - -// ConvertFrom converts from the Hub version (v1beta1) to this version. -func (dst *AzureManagedMachinePoolList) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*infrav1.AzureManagedMachinePoolList) - return Convert_v1beta1_AzureManagedMachinePoolList_To_v1alpha3_AzureManagedMachinePoolList(src, dst, nil) -} diff --git a/api/v1alpha3/azuremanagedmachinepool_types.go b/api/v1alpha3/azuremanagedmachinepool_types.go deleted file mode 100644 index cfdd986a31f..00000000000 --- a/api/v1alpha3/azuremanagedmachinepool_types.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -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 v1alpha3 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - capierrors "sigs.k8s.io/cluster-api/errors" -) - -// AzureManagedMachinePoolSpec defines the desired state of AzureManagedMachinePool. -type AzureManagedMachinePoolSpec struct { - // Mode - represents mode of an agent pool. Possible values include: System, User. - // +kubebuilder:validation:Enum=System;User - Mode string `json:"mode"` - - // SKU is the size of the VMs in the node pool. - SKU string `json:"sku"` - - // OSDiskSizeGB is the disk size for every machine in this agent pool. - // If you specify 0, it will apply the default osDisk size according to the vmSize specified. - OSDiskSizeGB *int32 `json:"osDiskSizeGB,omitempty"` - - // ProviderIDList is the unique identifier as specified by the cloud provider. - // +optional - ProviderIDList []string `json:"providerIDList,omitempty"` -} - -// AzureManagedMachinePoolStatus defines the observed state of AzureManagedMachinePool. -type AzureManagedMachinePoolStatus struct { - // Ready is true when the provider resource is ready. - // +optional - Ready bool `json:"ready"` - - // Replicas is the most recently observed number of replicas. - // +optional - Replicas int32 `json:"replicas"` - - // Any transient errors that occur during the reconciliation of Machines - // can be added as events to the Machine object and/or logged in the - // controller's output. - // +optional - ErrorReason *capierrors.MachineStatusError `json:"errorReason,omitempty"` - - // Any transient errors that occur during the reconciliation of Machines - // can be added as events to the Machine object and/or logged in the - // controller's output. - // +optional - ErrorMessage *string `json:"errorMessage,omitempty"` -} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:path=azuremanagedmachinepools,scope=Namespaced,categories=cluster-api,shortName=ammp -// +kubebuilder:subresource:status - -// AzureManagedMachinePool is the Schema for the azuremanagedmachinepools API. -type AzureManagedMachinePool struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec AzureManagedMachinePoolSpec `json:"spec,omitempty"` - Status AzureManagedMachinePoolStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// AzureManagedMachinePoolList contains a list of AzureManagedMachinePools. -type AzureManagedMachinePoolList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []AzureManagedMachinePool `json:"items"` -} - -func init() { - SchemeBuilder.Register(&AzureManagedMachinePool{}, &AzureManagedMachinePoolList{}) -} diff --git a/api/v1alpha3/conditions_consts.go b/api/v1alpha3/conditions_consts.go deleted file mode 100644 index f03d8a5e8a7..00000000000 --- a/api/v1alpha3/conditions_consts.go +++ /dev/null @@ -1,53 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -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 v1alpha3 - -import clusterv1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3" - -// AzureCluster Conditions and Reasons. -const ( - // NetworkInfrastructureReadyCondition reports of current status of cluster infrastructure. - NetworkInfrastructureReadyCondition = "NetworkInfrastructureReady" - // LoadBalancerProvisioningReason API Server endpoint for the loadbalancer. - LoadBalancerProvisioningReason = "LoadBalancerProvisioning" - // LoadBalancerProvisioningFailedReason used for failure during provisioning of loadbalancer. - LoadBalancerProvisioningFailedReason = "LoadBalancerProvisioningFailed" - // NamespaceNotAllowedByIdentity used to indicate cluster in a namespace not allowed by identity. - NamespaceNotAllowedByIdentity = "NamespaceNotAllowedByIdentity" -) - -// AzureMachine Conditions and Reasons. -const ( - // VMRunningCondition reports on current status of the Azure VM. - VMRunningCondition clusterv1alpha3.ConditionType = "VMRunning" - // VMNCreatingReason used when the vm creation is in progress. - VMNCreatingReason = "VMCreating" - // VMNUpdatingReason used when the vm updating is in progress. - VMNUpdatingReason = "VMUpdating" - // VMNotFoundReason used when the vm couldn't be retrieved. - VMNotFoundReason = "VMNotFound" - // VMDeletingReason used when the vm is in a deleting state. - VMDDeletingReason = "VMDeleting" - // VMStoppedReason vm is in a stopped state. - VMStoppedReason = "VMStopped" - // VMProvisionFailedReason used for failures during vm provisioning. - VMProvisionFailedReason = "VMProvisionFailed" - // WaitingForClusterInfrastructureReason used when machine is waiting for cluster infrastructure to be ready before proceeding. - WaitingForClusterInfrastructureReason = "WaitingForClusterInfrastructure" - // WaitingForBootstrapDataReason used when machine is waiting for bootstrap data to be ready before proceeding. - WaitingForBootstrapDataReason = "WaitingForBootstrapData" -) diff --git a/api/v1alpha3/conversion_test.go b/api/v1alpha3/conversion_test.go deleted file mode 100644 index 063086a5f26..00000000000 --- a/api/v1alpha3/conversion_test.go +++ /dev/null @@ -1,113 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha3 - -import ( - "testing" - - fuzz "github.com/google/gofuzz" - . "github.com/onsi/gomega" - "k8s.io/apimachinery/pkg/api/apitesting/fuzzer" - "k8s.io/apimachinery/pkg/runtime" - runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer" - "k8s.io/utils/pointer" - infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" - utilconversion "sigs.k8s.io/cluster-api/util/conversion" -) - -func TestFuzzyConversion(t *testing.T) { - g := NewWithT(t) - scheme := runtime.NewScheme() - g.Expect(AddToScheme(scheme)).To(Succeed()) - g.Expect(infrav1.AddToScheme(scheme)).To(Succeed()) - - t.Run("for AzureCluster", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ - Scheme: scheme, - Hub: &infrav1.AzureCluster{}, - Spoke: &AzureCluster{}, - FuzzerFuncs: []fuzzer.FuzzerFuncs{overrideDeprecatedAndRemovedFieldsFuncs, overrideOutboundLBFunc}, - })) - - t.Run("for AzureMachine", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ - Scheme: scheme, - Hub: &infrav1.AzureMachine{}, - Spoke: &AzureMachine{}, - FuzzerFuncs: []fuzzer.FuzzerFuncs{overrideDeprecatedAndRemovedFieldsFuncs}, - })) - - t.Run("for AzureMachineTemplate", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ - Scheme: scheme, - Hub: &infrav1.AzureMachineTemplate{}, - Spoke: &AzureMachineTemplate{}, - FuzzerFuncs: []fuzzer.FuzzerFuncs{overrideDeprecatedAndRemovedFieldsFuncs}, - })) - - t.Run("for AzureClusterIdentity", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ - Scheme: scheme, - Hub: &infrav1.AzureClusterIdentity{}, - Spoke: &AzureClusterIdentity{}, - FuzzerFuncs: []fuzzer.FuzzerFuncs{overrideDeprecatedAndRemovedFieldsFuncs}, - })) - - t.Run("for AzureManagedCluster", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ - Scheme: scheme, - Hub: &infrav1.AzureManagedCluster{}, - Spoke: &AzureManagedCluster{}, - })) - - t.Run("for AzureManagedControlPlane", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ - Scheme: scheme, - Hub: &infrav1.AzureManagedControlPlane{}, - Spoke: &AzureManagedControlPlane{}, - })) - - t.Run("for AzureManagedMachinePool", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ - Scheme: scheme, - Hub: &infrav1.AzureManagedMachinePool{}, - Spoke: &AzureManagedMachinePool{}, - })) -} - -func overrideDeprecatedAndRemovedFieldsFuncs(codecs runtimeserializer.CodecFactory) []interface{} { - return []interface{}{ - func(azureMachineSpec *AzureMachineSpec, c fuzz.Continue) { - azureMachineSpec.Location = "" - }, - func(subnetSpec *SubnetSpec, c fuzz.Continue) { - subnetSpec.InternalLBIPAddress = "" - }, - func(vnetSpec *VnetSpec, c fuzz.Continue) { - vnetSpec.CidrBlock = "" - }, - func(azureClusterIdentity *AzureClusterIdentity, c fuzz.Continue) { - azureClusterIdentity.Spec.AllowedNamespaces = nil - }, - } -} - -func overrideOutboundLBFunc(codecs runtimeserializer.CodecFactory) []interface{} { - return []interface{}{ - func(networkSpec *infrav1.NetworkSpec, c fuzz.Continue) { - networkSpec.ControlPlaneOutboundLB = &infrav1.LoadBalancerSpec{ - FrontendIPsCount: pointer.Int32(1), - } - networkSpec.NodeOutboundLB = &infrav1.LoadBalancerSpec{ - FrontendIPsCount: pointer.Int32(1), - } - }, - } -} diff --git a/api/v1alpha3/groupversion_info.go b/api/v1alpha3/groupversion_info.go deleted file mode 100644 index f1bfe5aa121..00000000000 --- a/api/v1alpha3/groupversion_info.go +++ /dev/null @@ -1,39 +0,0 @@ -/* -Copyright 2019 The Kubernetes Authors. - -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 v1alpha3 contains API Schema definitions for the infrastructure v1alpha3 API group -// +kubebuilder:object:generate=true -// +groupName=infrastructure.cluster.x-k8s.io -package v1alpha3 - -import ( - "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/scheme" -) - -var ( - // GroupVersion is group version used to register these objects. - GroupVersion = schema.GroupVersion{Group: "infrastructure.cluster.x-k8s.io", Version: "v1alpha3"} - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme. - SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} - - // AddToScheme adds the types in this group-version to the given scheme. - AddToScheme = SchemeBuilder.AddToScheme - - // localSchemeBuilder is used for type conversions. - localSchemeBuilder = SchemeBuilder.SchemeBuilder -) diff --git a/api/v1alpha3/tags.go b/api/v1alpha3/tags.go deleted file mode 100644 index 3f730bcfdb9..00000000000 --- a/api/v1alpha3/tags.go +++ /dev/null @@ -1,197 +0,0 @@ -/* -Copyright 2019 The Kubernetes Authors. - -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 v1alpha3 - -import ( - "fmt" - "reflect" -) - -// Tags defines a map of tags. -type Tags map[string]string - -// Equals returns true if the tags are equal. -func (t Tags) Equals(other Tags) bool { - return reflect.DeepEqual(t, other) -} - -// HasMatchingSpecVersionHash returns true if the resource has been tagged with a matching resource spec hash value. -func (t Tags) HasMatchingSpecVersionHash(hash string) bool { - value, ok := t[SpecVersionHashTagKey()] - return ok && value == hash -} - -// HasOwned returns true if the tags contains a tag that marks the resource as owned by the cluster from the perspective of this management tooling. -func (t Tags) HasOwned(cluster string) bool { - value, ok := t[ClusterTagKey(cluster)] - return ok && ResourceLifecycle(value) == ResourceLifecycleOwned -} - -// HasAzureCloudProviderOwned returns true if the tags contains a tag that marks the resource as owned by the cluster from the perspective of the in-tree cloud provider. -func (t Tags) HasAzureCloudProviderOwned(cluster string) bool { - value, ok := t[ClusterAzureCloudProviderTagKey(cluster)] - return ok && ResourceLifecycle(value) == ResourceLifecycleOwned -} - -// GetRole returns the Cluster API role for the tagged resource. -func (t Tags) GetRole() string { - return t[NameAzureClusterAPIRole] -} - -// Difference returns the difference between this map of tags and the other map of tags. -// Items are considered equals if key and value are equals. -func (t Tags) Difference(other Tags) Tags { - res := make(Tags, len(t)) - - for key, value := range t { - if otherValue, ok := other[key]; ok && value == otherValue { - continue - } - res[key] = value - } - - return res -} - -// Merge merges in tags from other. If a tag already exists, it is replaced by the tag in other. -func (t Tags) Merge(other Tags) { - for k, v := range other { - t[k] = v - } -} - -// AddSpecVersionHashTag adds a spec version hash to the Azure resource tags to determine if state has changed quickly. -func (t Tags) AddSpecVersionHashTag(hash string) Tags { - t[SpecVersionHashTagKey()] = hash - return t -} - -// ResourceLifecycle configures the lifecycle of a resource. -type ResourceLifecycle string - -const ( - // ResourceLifecycleOwned is the value we use when tagging resources to indicate - // that the resource is considered owned and managed by the cluster, - // and in particular that the lifecycle is tied to the lifecycle of the cluster. - ResourceLifecycleOwned = ResourceLifecycle("owned") - - // ResourceLifecycleShared is the value we use when tagging resources to indicate - // that the resource is shared between multiple clusters, and should not be destroyed - // if the cluster is destroyed. - ResourceLifecycleShared = ResourceLifecycle("shared") - - // NameKubernetesAzureCloudProviderPrefix is the tag name used by the cloud provider to logically - // separate independent cluster resources. We use it to identify which resources we expect - // to be permissive about state changes. - // logically independent clusters running in the same AZ. - // The tag key = NameKubernetesAzureCloudProviderPrefix + clusterID - // The tag value is an ownership value. - NameKubernetesAzureCloudProviderPrefix = "kubernetes.io_cluster_" - - // NameAzureProviderPrefix is the tag prefix we use to differentiate - // cluster-api-provider-azure owned components from other tooling that - // uses NameKubernetesClusterPrefix. - NameAzureProviderPrefix = "sigs.k8s.io_cluster-api-provider-azure_" - - // NameAzureProviderOwned is the tag name we use to differentiate - // cluster-api-provider-azure owned components from other tooling that - // uses NameKubernetesClusterPrefix. - NameAzureProviderOwned = NameAzureProviderPrefix + "cluster_" - - // NameAzureClusterAPIRole is the tag name we use to mark roles for resources - // dedicated to this cluster api provider implementation. - NameAzureClusterAPIRole = NameAzureProviderPrefix + "role" - - // APIServerRole describes the value for the apiserver role. - APIServerRole = "apiserver" - - // NodeOutboundRole describes the value for the node outbound LB role. - NodeOutboundRole = "nodeOutbound" - - // ControlPlaneOutboundRole describes the value for the control plane outbound LB role. - ControlPlaneOutboundRole = "controlPlaneOutbound" - - // BastionRole describes the value for the bastion role. - BastionRole = "bastion" - - // CommonRole describes the value for the common role. - CommonRole = "common" - - // VMTagsLastAppliedAnnotation is the key for the machine object annotation - // which tracks the AdditionalTags in the Machine Provider Config. - // See https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ - // for annotation formatting rules. - VMTagsLastAppliedAnnotation = "sigs.k8s.io/cluster-api-provider-azure-last-applied-tags-vm" -) - -// SpecVersionHashTagKey is the key for the spec version hash used to enable quick spec difference comparison. -func SpecVersionHashTagKey() string { - return fmt.Sprintf("%s%s", NameAzureProviderPrefix, "spec-version-hash") -} - -// ClusterTagKey generates the key for resources associated with a cluster. -func ClusterTagKey(name string) string { - return fmt.Sprintf("%s%s", NameAzureProviderOwned, name) -} - -// ClusterAzureCloudProviderTagKey generates the key for resources associated a cluster's Azure cloud provider. -func ClusterAzureCloudProviderTagKey(name string) string { - return fmt.Sprintf("%s%s", NameKubernetesAzureCloudProviderPrefix, name) -} - -// BuildParams is used to build tags around an azure resource. -type BuildParams struct { - // Lifecycle determines the resource lifecycle. - Lifecycle ResourceLifecycle - - // ClusterName is the cluster associated with the resource. - ClusterName string - - // ResourceID is the unique identifier of the resource to be tagged. - ResourceID string - - // Name is the name of the resource, it's applied as the tag "Name" on Azure. - // +optional - Name *string - - // Role is the role associated to the resource. - // +optional - Role *string - - // Any additional tags to be added to the resource. - // +optional - Additional Tags -} - -// Build builds tags including the cluster tag and returns them in map form. -func Build(params BuildParams) Tags { - tags := make(Tags) - for k, v := range params.Additional { - tags[k] = v - } - - tags[ClusterTagKey(params.ClusterName)] = string(params.Lifecycle) - if params.Role != nil { - tags[NameAzureClusterAPIRole] = *params.Role - } - - if params.Name != nil { - tags["Name"] = *params.Name - } - - return tags -} diff --git a/api/v1alpha3/tags_test.go b/api/v1alpha3/tags_test.go deleted file mode 100644 index ad126b46575..00000000000 --- a/api/v1alpha3/tags_test.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2019 The Kubernetes Authors. - -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 v1alpha3 - -import ( - "testing" - - . "github.com/onsi/gomega" -) - -func TestTags_Merge(t *testing.T) { - g := NewWithT(t) - - tests := []struct { - name string - other Tags - expected Tags - }{ - { - name: "nil other", - other: nil, - expected: Tags{ - "a": "b", - "c": "d", - }, - }, - { - name: "empty other", - other: Tags{}, - expected: Tags{ - "a": "b", - "c": "d", - }, - }, - { - name: "disjoint", - other: Tags{ - "1": "2", - "3": "4", - }, - expected: Tags{ - "a": "b", - "c": "d", - "1": "2", - "3": "4", - }, - }, - { - name: "overlapping, other wins", - other: Tags{ - "1": "2", - "3": "4", - "a": "hello", - }, - expected: Tags{ - "a": "hello", - "c": "d", - "1": "2", - "3": "4", - }, - }, - } - for _, tc := range tests { - tc := tc - t.Run(tc.name, func(t *testing.T) { - t.Parallel() - tags := Tags{ - "a": "b", - "c": "d", - } - - tags.Merge(tc.other) - g.Expect(tags).To(Equal(tc.expected)) - }) - } -} diff --git a/api/v1alpha3/types.go b/api/v1alpha3/types.go deleted file mode 100644 index 5549f02a4ea..00000000000 --- a/api/v1alpha3/types.go +++ /dev/null @@ -1,491 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -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 v1alpha3 - -import ( - corev1 "k8s.io/api/core/v1" -) - -const ( - // ControlPlane machine label. - ControlPlane string = "control-plane" - // Node machine label. - Node string = "node" -) - -// Future contains the data needed for an Azure long-running operation to continue across reconcile loops. -type Future struct { - // Type describes the type of future, update, create, delete, etc. - Type string `json:"type"` - - // ResourceGroup is the Azure resource group for the resource. - // +optional - ResourceGroup string `json:"resourceGroup,omitempty"` - - // Name is the name of the Azure resource. - // +optional - Name string `json:"name,omitempty"` - - // FutureData is the base64 url encoded json Azure AutoRest Future. - FutureData string `json:"futureData,omitempty"` -} - -// NetworkSpec specifies what the Azure networking resources should look like. -type NetworkSpec struct { - // Vnet is the configuration for the Azure virtual network. - // +optional - Vnet VnetSpec `json:"vnet,omitempty"` - - // Subnets is the configuration for the control-plane subnet and the node subnet. - // +optional - Subnets Subnets `json:"subnets,omitempty"` - - // APIServerLB is the configuration for the control-plane load balancer. - // +optional - APIServerLB LoadBalancerSpec `json:"apiServerLB,omitempty"` -} - -// VnetSpec configures an Azure virtual network. -type VnetSpec struct { - // ResourceGroup is the name of the resource group of the existing virtual network - // or the resource group where a managed virtual network should be created. - ResourceGroup string `json:"resourceGroup,omitempty"` - - // ID is the identifier of the virtual network this provider should use to create resources. - ID string `json:"id,omitempty"` - - // Name defines a name for the virtual network resource. - Name string `json:"name"` - - // CidrBlock is the CIDR block to be used when the provider creates a managed virtual network. - // Deprecated: Use CIDRBlocks instead - // +optional - CidrBlock string `json:"cidrBlock,omitempty"` - - // CIDRBlocks defines the virtual network's address space, specified as one or more address prefixes in CIDR notation. - // +optional - CIDRBlocks []string `json:"cidrBlocks,omitempty"` - - // Tags is a collection of tags describing the resource. - // +optional - Tags Tags `json:"tags,omitempty"` -} - -// IsManaged returns true if the vnet is managed. -func (v *VnetSpec) IsManaged(clusterName string) bool { - return v.ID == "" || v.Tags.HasOwned(clusterName) -} - -// Subnets is a slice of Subnet. -type Subnets []SubnetSpec - -// SecurityGroupRole defines the unique role of a security group. -type SecurityGroupRole string - -const ( - // SecurityGroupNode defines a Kubernetes workload node role. - SecurityGroupNode = SecurityGroupRole(Node) - - // SecurityGroupControlPlane defines a Kubernetes control plane node role. - SecurityGroupControlPlane = SecurityGroupRole(ControlPlane) -) - -// SecurityGroup defines an Azure security group. -type SecurityGroup struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - IngressRules IngressRules `json:"ingressRule,omitempty"` - Tags Tags `json:"tags,omitempty"` -} - -// RouteTable defines an Azure route table. -type RouteTable struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` -} - -// SecurityGroupProtocol defines the protocol type for a security group rule. -type SecurityGroupProtocol string - -const ( - // SecurityGroupProtocolAll is a wildcard for all IP protocols. - SecurityGroupProtocolAll = SecurityGroupProtocol("*") - - // SecurityGroupProtocolTCP represents the TCP protocol in ingress rules. - SecurityGroupProtocolTCP = SecurityGroupProtocol("Tcp") - - // SecurityGroupProtocolUDP represents the UDP protocol in ingress rules. - SecurityGroupProtocolUDP = SecurityGroupProtocol("Udp") -) - -// IngressRule defines an Azure ingress rule for security groups. -type IngressRule struct { - Name string `json:"name"` - Description string `json:"description"` - Protocol SecurityGroupProtocol `json:"protocol"` - - // Priority - A number between 100 and 4096. Each rule should have a unique value for priority. Rules are processed in priority order, with lower numbers processed before higher numbers. Once traffic matches a rule, processing stops. - Priority int32 `json:"priority,omitempty"` - - // SourcePorts - The source port or range. Integer or range between 0 and 65535. Asterix '*' can also be used to match all ports. - SourcePorts *string `json:"sourcePorts,omitempty"` - - // DestinationPorts - The destination port or range. Integer or range between 0 and 65535. Asterix '*' can also be used to match all ports. - DestinationPorts *string `json:"destinationPorts,omitempty"` - - // Source - The CIDR or source IP range. Asterix '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from. - Source *string `json:"source,omitempty"` - - // Destination - The destination address prefix. CIDR or destination IP range. Asterix '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. - Destination *string `json:"destination,omitempty"` -} - -// IngressRules is a slice of Azure ingress rules for security groups. -type IngressRules []IngressRule - -// LoadBalancerSpec defines an Azure load balancer. -type LoadBalancerSpec struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - SKU SKU `json:"sku,omitempty"` - FrontendIPs []FrontendIP `json:"frontendIPs,omitempty"` - Type LBType `json:"type,omitempty"` -} - -// SKU defines an Azure load balancer SKU. -type SKU string - -const ( - // SKUStandard is the value for the Azure load balancer Standard SKU. - SKUStandard = SKU("Standard") -) - -// LBType defines an Azure load balancer Type. -type LBType string - -const ( - // Internal is the value for the Azure load balancer internal type. - Internal = LBType("Internal") - // Public is the value for the Azure load balancer public type. - Public = LBType("Public") -) - -// FrontendIP defines a load balancer frontend IP configuration. -type FrontendIP struct { - // +kubebuilder:validation:MinLength=1 - Name string `json:"name"` - // +optional - PrivateIPAddress string `json:"privateIP,omitempty"` - // +optional - PublicIP *PublicIPSpec `json:"publicIP,omitempty"` -} - -// PublicIPSpec defines the inputs to create an Azure public IP address. -type PublicIPSpec struct { - Name string `json:"name"` - // +optional - DNSName string `json:"dnsName,omitempty"` -} - -// VMState describes the state of an Azure virtual machine. -type VMState string - -const ( - // VMStateCreating ... - VMStateCreating VMState = "Creating" - // VMStateDeleting ... - VMStateDeleting VMState = "Deleting" - // VMStateFailed ... - VMStateFailed VMState = "Failed" - // VMStateMigrating ... - VMStateMigrating VMState = "Migrating" - // VMStateSucceeded ... - VMStateSucceeded VMState = "Succeeded" - // VMStateUpdating ... - VMStateUpdating VMState = "Updating" - // VMStateDeleted represents a deleted VM - // NOTE: This state is specific to capz, and does not have corresponding mapping in Azure API (https://docs.microsoft.com/en-us/azure/virtual-machines/states-lifecycle#provisioning-states) - VMStateDeleted VMState = "Deleted" -) - -// VM describes an Azure virtual machine. -type VM struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - AvailabilityZone string `json:"availabilityZone,omitempty"` - // Hardware profile - VMSize string `json:"vmSize,omitempty"` - // Storage profile - Image Image `json:"image,omitempty"` - OSDisk OSDisk `json:"osDisk,omitempty"` - StartupScript string `json:"startupScript,omitempty"` - // State - The provisioning state, which only appears in the response. - State VMState `json:"vmState,omitempty"` - Identity VMIdentity `json:"identity,omitempty"` - Tags Tags `json:"tags,omitempty"` - - // Addresses contains the addresses associated with the Azure VM. - Addresses []corev1.NodeAddress `json:"addresses,omitempty"` -} - -// Image defines information about the image to use for VM creation. -// There are three ways to specify an image: by ID, Marketplace Image or SharedImageGallery -// One of ID, SharedImage or Marketplace should be set. -type Image struct { - // ID specifies an image to use by ID - // +optional - ID *string `json:"id,omitempty"` - - // SharedGallery specifies an image to use from an Azure Shared Image Gallery - // +optional - SharedGallery *AzureSharedGalleryImage `json:"sharedGallery,omitempty"` - - // Marketplace specifies an image to use from the Azure Marketplace - // +optional - Marketplace *AzureMarketplaceImage `json:"marketplace,omitempty"` -} - -// AzureMarketplaceImage defines an image in the Azure Marketplace to use for VM creation. -type AzureMarketplaceImage struct { - // Publisher is the name of the organization that created the image - // +kubebuilder:validation:MinLength=1 - Publisher string `json:"publisher"` - // Offer specifies the name of a group of related images created by the publisher. - // For example, UbuntuServer, WindowsServer - // +kubebuilder:validation:MinLength=1 - Offer string `json:"offer"` - // SKU specifies an instance of an offer, such as a major release of a distribution. - // For example, 18.04-LTS, 2019-Datacenter - // +kubebuilder:validation:MinLength=1 - SKU string `json:"sku"` - // Version specifies the version of an image sku. The allowed formats - // are Major.Minor.Build or 'latest'. Major, Minor, and Build are decimal numbers. - // Specify 'latest' to use the latest version of an image available at deploy time. - // Even if you use 'latest', the VM image will not automatically update after deploy - // time even if a new version becomes available. - // +kubebuilder:validation:MinLength=1 - Version string `json:"version"` - // ThirdPartyImage indicates the image is published by a third party publisher and a Plan - // will be generated for it. - // +kubebuilder:default=false - // +optional - ThirdPartyImage bool `json:"thirdPartyImage"` -} - -// AzureSharedGalleryImage defines an image in a Shared Image Gallery to use for VM creation. -type AzureSharedGalleryImage struct { - // SubscriptionID is the identifier of the subscription that contains the shared image gallery - // +kubebuilder:validation:MinLength=1 - SubscriptionID string `json:"subscriptionID"` - // ResourceGroup specifies the resource group containing the shared image gallery - // +kubebuilder:validation:MinLength=1 - ResourceGroup string `json:"resourceGroup"` - // Gallery specifies the name of the shared image gallery that contains the image - // +kubebuilder:validation:MinLength=1 - Gallery string `json:"gallery"` - // Name is the name of the image - // +kubebuilder:validation:MinLength=1 - Name string `json:"name"` - // Version specifies the version of the marketplace image. The allowed formats - // are Major.Minor.Build or 'latest'. Major, Minor, and Build are decimal numbers. - // Specify 'latest' to use the latest version of an image available at deploy time. - // Even if you use 'latest', the VM image will not automatically update after deploy - // time even if a new version becomes available. - // +kubebuilder:validation:MinLength=1 - Version string `json:"version"` -} - -// AvailabilityZone specifies an Azure Availability Zone. -// -// Deprecated: Use FailureDomain instead. -type AvailabilityZone struct { - ID *string `json:"id,omitempty"` - Enabled *bool `json:"enabled,omitempty"` -} - -// VMIdentity defines the identity of the virtual machine, if configured. -// +kubebuilder:validation:Enum=None;SystemAssigned;UserAssigned -type VMIdentity string - -const ( - // VMIdentityNone ... - VMIdentityNone VMIdentity = "None" - // VMIdentitySystemAssigned ... - VMIdentitySystemAssigned VMIdentity = "SystemAssigned" - // VMIdentityUserAssigned ... - VMIdentityUserAssigned VMIdentity = "UserAssigned" -) - -// UserAssignedIdentity defines the user-assigned identities provided -// by the user to be assigned to Azure resources. -type UserAssignedIdentity struct { - // ProviderID is the identification ID of the user-assigned Identity, the format of an identity is: - // 'azure:///subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}' - ProviderID string `json:"providerID"` -} - -const ( - // AzureIdentityBindingSelector is the label used to match with the AzureIdentityBinding - // For the controller to match an identity binding, it needs a [label] with the key `aadpodidbinding` - // whose value is that of the `selector:` field in the `AzureIdentityBinding`. - AzureIdentityBindingSelector = "capz-controller-aadpodidentity-selector" -) - -// IdentityType represents different types of identities. -// +kubebuilder:validation:Enum=ServicePrincipal;UserAssignedMSI -type IdentityType string - -const ( - // UserAssignedMSI represents a user-assigned identity. - UserAssignedMSI IdentityType = "UserAssignedMSI" - - // ServicePrincipal represents a service principal. - ServicePrincipal IdentityType = "ServicePrincipal" -) - -// OSDisk defines the operating system disk for a VM. -// -// WARNING: this requires any updates to ManagedDisk to be manually converted. This is due to the odd issue with -// conversion-gen where the warning message generated uses a relative directory import rather than the fully -// qualified import when generating outside of the GOPATH. -// +k8s:conversion-gen=false -type OSDisk struct { - OSType string `json:"osType"` - DiskSizeGB int32 `json:"diskSizeGB"` - ManagedDisk ManagedDisk `json:"managedDisk"` - DiffDiskSettings *DiffDiskSettings `json:"diffDiskSettings,omitempty"` - // +optional - CachingType string `json:"cachingType,omitempty"` -} - -// DataDisk specifies the parameters that are used to add one or more data disks to the machine. -type DataDisk struct { - // NameSuffix is the suffix to be appended to the machine name to generate the disk name. - // Each disk name will be in format _. - NameSuffix string `json:"nameSuffix"` - // DiskSizeGB is the size in GB to assign to the data disk. - DiskSizeGB int32 `json:"diskSizeGB"` - // +optional - ManagedDisk *ManagedDisk `json:"managedDisk,omitempty"` - // Lun Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. - // The value must be between 0 and 63. - Lun *int32 `json:"lun,omitempty"` - // +optional - CachingType string `json:"cachingType,omitempty"` -} - -// ManagedDisk defines the managed disk options for a VM. -type ManagedDisk struct { - StorageAccountType string `json:"storageAccountType"` - DiskEncryptionSet *DiskEncryptionSetParameters `json:"diskEncryptionSet,omitempty"` -} - -// DiskEncryptionSetParameters defines disk encryption options. -type DiskEncryptionSetParameters struct { - // ID defines resourceID for diskEncryptionSet resource. It must be in the same subscription - ID string `json:"id,omitempty"` -} - -// DiffDiskSettings describe ephemeral disk settings for the os disk. -type DiffDiskSettings struct { - // Option enables ephemeral OS when set to "Local" - // See https://docs.microsoft.com/en-us/azure/virtual-machines/ephemeral-os-disks for full details - // +kubebuilder:validation:Enum=Local - Option string `json:"option"` -} - -// SubnetRole defines the unique role of a subnet. -type SubnetRole string - -const ( - // SubnetNode defines a Kubernetes workload node role. - SubnetNode = SubnetRole(Node) - - // SubnetControlPlane defines a Kubernetes control plane node role. - SubnetControlPlane = SubnetRole(ControlPlane) -) - -// SubnetSpec configures an Azure subnet. -type SubnetSpec struct { - // Role defines the subnet role (eg. Node, ControlPlane) - Role SubnetRole `json:"role,omitempty"` - - // ID defines a unique identifier to reference this resource. - // +optional - ID string `json:"id,omitempty"` - - // Name defines a name for the subnet resource. - Name string `json:"name"` - - // CidrBlock is the CIDR block to be used when the provider creates a managed Vnet. - // Deprecated: Use CIDRBlocks instead - // +optional - CidrBlock string `json:"cidrBlock,omitempty"` - - // CIDRBlocks defines the subnet's address space, specified as one or more address prefixes in CIDR notation. - // +optional - CIDRBlocks []string `json:"cidrBlocks,omitempty"` - - // InternalLBIPAddress is the IP address that will be used as the internal LB private IP. - // For the control plane subnet only. - // +optional - // Deprecated: Use LoadBalancer private IP instead - InternalLBIPAddress string `json:"internalLBIPAddress,omitempty"` - - // SecurityGroup defines the NSG (network security group) that should be attached to this subnet. - // +optional - SecurityGroup SecurityGroup `json:"securityGroup,omitempty"` - - // RouteTable defines the route table that should be attached to this subnet. - // +optional - RouteTable RouteTable `json:"routeTable,omitempty"` -} - -// GetControlPlaneSubnet returns the cluster control plane subnet. -func (n *NetworkSpec) GetControlPlaneSubnet() *SubnetSpec { - for _, sn := range n.Subnets { - if sn.Role == SubnetControlPlane { - return &sn - } - } - return nil -} - -// GetNodeSubnet returns the cluster node subnet. -func (n *NetworkSpec) GetNodeSubnet() *SubnetSpec { - for _, sn := range n.Subnets { - if sn.Role == SubnetNode { - return &sn - } - } - return nil -} - -// SecurityProfile specifies the Security profile settings for a -// virtual machine or virtual machine scale set. -type SecurityProfile struct { - // This field indicates whether Host Encryption should be enabled - // or disabled for a virtual machine or virtual machine scale - // set. Default is disabled. - EncryptionAtHost *bool `json:"encryptionAtHost,omitempty"` -} - -// AddressRecord specifies a DNS record mapping a hostname to an IPV4 or IPv6 address. -type AddressRecord struct { - Hostname string - IP string -} diff --git a/api/v1alpha3/zz_generated.conversion.go b/api/v1alpha3/zz_generated.conversion.go deleted file mode 100644 index 85993b3076b..00000000000 --- a/api/v1alpha3/zz_generated.conversion.go +++ /dev/null @@ -1,2198 +0,0 @@ -//go:build !ignore_autogenerated_core_v1alpha3 -// +build !ignore_autogenerated_core_v1alpha3 - -/* -Copyright The Kubernetes Authors. - -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. -*/ - -// Code generated by conversion-gen-v0.23.1. DO NOT EDIT. - -package v1alpha3 - -import ( - unsafe "unsafe" - - v1 "k8s.io/api/core/v1" - resource "k8s.io/apimachinery/pkg/api/resource" - conversion "k8s.io/apimachinery/pkg/conversion" - runtime "k8s.io/apimachinery/pkg/runtime" - v1beta1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" - apiv1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3" - apiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" - errors "sigs.k8s.io/cluster-api/errors" -) - -func init() { - localSchemeBuilder.Register(RegisterConversions) -} - -// RegisterConversions adds conversion functions to the given scheme. -// Public to allow building arbitrary schemes. -func RegisterConversions(s *runtime.Scheme) error { - if err := s.AddGeneratedConversionFunc((*AADProfile)(nil), (*v1beta1.AADProfile)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AADProfile_To_v1beta1_AADProfile(a.(*AADProfile), b.(*v1beta1.AADProfile), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AADProfile)(nil), (*AADProfile)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AADProfile_To_v1alpha3_AADProfile(a.(*v1beta1.AADProfile), b.(*AADProfile), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AddressRecord)(nil), (*v1beta1.AddressRecord)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AddressRecord_To_v1beta1_AddressRecord(a.(*AddressRecord), b.(*v1beta1.AddressRecord), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AddressRecord)(nil), (*AddressRecord)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AddressRecord_To_v1alpha3_AddressRecord(a.(*v1beta1.AddressRecord), b.(*AddressRecord), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureCluster)(nil), (*v1beta1.AzureCluster)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureCluster_To_v1beta1_AzureCluster(a.(*AzureCluster), b.(*v1beta1.AzureCluster), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureCluster)(nil), (*AzureCluster)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureCluster_To_v1alpha3_AzureCluster(a.(*v1beta1.AzureCluster), b.(*AzureCluster), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureClusterIdentity)(nil), (*v1beta1.AzureClusterIdentity)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureClusterIdentity_To_v1beta1_AzureClusterIdentity(a.(*AzureClusterIdentity), b.(*v1beta1.AzureClusterIdentity), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureClusterIdentity)(nil), (*AzureClusterIdentity)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureClusterIdentity_To_v1alpha3_AzureClusterIdentity(a.(*v1beta1.AzureClusterIdentity), b.(*AzureClusterIdentity), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureClusterIdentityList)(nil), (*v1beta1.AzureClusterIdentityList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureClusterIdentityList_To_v1beta1_AzureClusterIdentityList(a.(*AzureClusterIdentityList), b.(*v1beta1.AzureClusterIdentityList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureClusterIdentityList)(nil), (*AzureClusterIdentityList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureClusterIdentityList_To_v1alpha3_AzureClusterIdentityList(a.(*v1beta1.AzureClusterIdentityList), b.(*AzureClusterIdentityList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureClusterIdentityStatus)(nil), (*v1beta1.AzureClusterIdentityStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureClusterIdentityStatus_To_v1beta1_AzureClusterIdentityStatus(a.(*AzureClusterIdentityStatus), b.(*v1beta1.AzureClusterIdentityStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureClusterIdentityStatus)(nil), (*AzureClusterIdentityStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureClusterIdentityStatus_To_v1alpha3_AzureClusterIdentityStatus(a.(*v1beta1.AzureClusterIdentityStatus), b.(*AzureClusterIdentityStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureClusterList)(nil), (*v1beta1.AzureClusterList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureClusterList_To_v1beta1_AzureClusterList(a.(*AzureClusterList), b.(*v1beta1.AzureClusterList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureClusterList)(nil), (*AzureClusterList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureClusterList_To_v1alpha3_AzureClusterList(a.(*v1beta1.AzureClusterList), b.(*AzureClusterList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureMachine)(nil), (*v1beta1.AzureMachine)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureMachine_To_v1beta1_AzureMachine(a.(*AzureMachine), b.(*v1beta1.AzureMachine), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureMachine)(nil), (*AzureMachine)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMachine_To_v1alpha3_AzureMachine(a.(*v1beta1.AzureMachine), b.(*AzureMachine), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureMachineList)(nil), (*v1beta1.AzureMachineList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureMachineList_To_v1beta1_AzureMachineList(a.(*AzureMachineList), b.(*v1beta1.AzureMachineList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureMachineList)(nil), (*AzureMachineList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMachineList_To_v1alpha3_AzureMachineList(a.(*v1beta1.AzureMachineList), b.(*AzureMachineList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureMachineTemplate)(nil), (*v1beta1.AzureMachineTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureMachineTemplate_To_v1beta1_AzureMachineTemplate(a.(*AzureMachineTemplate), b.(*v1beta1.AzureMachineTemplate), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureMachineTemplate)(nil), (*AzureMachineTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMachineTemplate_To_v1alpha3_AzureMachineTemplate(a.(*v1beta1.AzureMachineTemplate), b.(*AzureMachineTemplate), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureMachineTemplateList)(nil), (*v1beta1.AzureMachineTemplateList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureMachineTemplateList_To_v1beta1_AzureMachineTemplateList(a.(*AzureMachineTemplateList), b.(*v1beta1.AzureMachineTemplateList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureMachineTemplateList)(nil), (*AzureMachineTemplateList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMachineTemplateList_To_v1alpha3_AzureMachineTemplateList(a.(*v1beta1.AzureMachineTemplateList), b.(*AzureMachineTemplateList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureMachineTemplateResource)(nil), (*v1beta1.AzureMachineTemplateResource)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureMachineTemplateResource_To_v1beta1_AzureMachineTemplateResource(a.(*AzureMachineTemplateResource), b.(*v1beta1.AzureMachineTemplateResource), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureMachineTemplateSpec)(nil), (*v1beta1.AzureMachineTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureMachineTemplateSpec_To_v1beta1_AzureMachineTemplateSpec(a.(*AzureMachineTemplateSpec), b.(*v1beta1.AzureMachineTemplateSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureMachineTemplateSpec)(nil), (*AzureMachineTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMachineTemplateSpec_To_v1alpha3_AzureMachineTemplateSpec(a.(*v1beta1.AzureMachineTemplateSpec), b.(*AzureMachineTemplateSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureManagedCluster)(nil), (*v1beta1.AzureManagedCluster)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureManagedCluster_To_v1beta1_AzureManagedCluster(a.(*AzureManagedCluster), b.(*v1beta1.AzureManagedCluster), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureManagedCluster)(nil), (*AzureManagedCluster)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureManagedCluster_To_v1alpha3_AzureManagedCluster(a.(*v1beta1.AzureManagedCluster), b.(*AzureManagedCluster), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureManagedClusterList)(nil), (*v1beta1.AzureManagedClusterList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureManagedClusterList_To_v1beta1_AzureManagedClusterList(a.(*AzureManagedClusterList), b.(*v1beta1.AzureManagedClusterList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureManagedClusterList)(nil), (*AzureManagedClusterList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureManagedClusterList_To_v1alpha3_AzureManagedClusterList(a.(*v1beta1.AzureManagedClusterList), b.(*AzureManagedClusterList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureManagedClusterSpec)(nil), (*v1beta1.AzureManagedClusterSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureManagedClusterSpec_To_v1beta1_AzureManagedClusterSpec(a.(*AzureManagedClusterSpec), b.(*v1beta1.AzureManagedClusterSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureManagedClusterSpec)(nil), (*AzureManagedClusterSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureManagedClusterSpec_To_v1alpha3_AzureManagedClusterSpec(a.(*v1beta1.AzureManagedClusterSpec), b.(*AzureManagedClusterSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureManagedClusterStatus)(nil), (*v1beta1.AzureManagedClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureManagedClusterStatus_To_v1beta1_AzureManagedClusterStatus(a.(*AzureManagedClusterStatus), b.(*v1beta1.AzureManagedClusterStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureManagedClusterStatus)(nil), (*AzureManagedClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureManagedClusterStatus_To_v1alpha3_AzureManagedClusterStatus(a.(*v1beta1.AzureManagedClusterStatus), b.(*AzureManagedClusterStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureManagedControlPlane)(nil), (*v1beta1.AzureManagedControlPlane)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureManagedControlPlane_To_v1beta1_AzureManagedControlPlane(a.(*AzureManagedControlPlane), b.(*v1beta1.AzureManagedControlPlane), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureManagedControlPlane)(nil), (*AzureManagedControlPlane)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureManagedControlPlane_To_v1alpha3_AzureManagedControlPlane(a.(*v1beta1.AzureManagedControlPlane), b.(*AzureManagedControlPlane), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureManagedControlPlaneList)(nil), (*v1beta1.AzureManagedControlPlaneList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureManagedControlPlaneList_To_v1beta1_AzureManagedControlPlaneList(a.(*AzureManagedControlPlaneList), b.(*v1beta1.AzureManagedControlPlaneList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureManagedControlPlaneList)(nil), (*AzureManagedControlPlaneList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureManagedControlPlaneList_To_v1alpha3_AzureManagedControlPlaneList(a.(*v1beta1.AzureManagedControlPlaneList), b.(*AzureManagedControlPlaneList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureManagedControlPlaneSpec)(nil), (*v1beta1.AzureManagedControlPlaneSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureManagedControlPlaneSpec_To_v1beta1_AzureManagedControlPlaneSpec(a.(*AzureManagedControlPlaneSpec), b.(*v1beta1.AzureManagedControlPlaneSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureManagedControlPlaneStatus)(nil), (*v1beta1.AzureManagedControlPlaneStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureManagedControlPlaneStatus_To_v1beta1_AzureManagedControlPlaneStatus(a.(*AzureManagedControlPlaneStatus), b.(*v1beta1.AzureManagedControlPlaneStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureManagedMachinePool)(nil), (*v1beta1.AzureManagedMachinePool)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureManagedMachinePool_To_v1beta1_AzureManagedMachinePool(a.(*AzureManagedMachinePool), b.(*v1beta1.AzureManagedMachinePool), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureManagedMachinePool)(nil), (*AzureManagedMachinePool)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureManagedMachinePool_To_v1alpha3_AzureManagedMachinePool(a.(*v1beta1.AzureManagedMachinePool), b.(*AzureManagedMachinePool), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureManagedMachinePoolList)(nil), (*v1beta1.AzureManagedMachinePoolList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureManagedMachinePoolList_To_v1beta1_AzureManagedMachinePoolList(a.(*AzureManagedMachinePoolList), b.(*v1beta1.AzureManagedMachinePoolList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureManagedMachinePoolList)(nil), (*AzureManagedMachinePoolList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureManagedMachinePoolList_To_v1alpha3_AzureManagedMachinePoolList(a.(*v1beta1.AzureManagedMachinePoolList), b.(*AzureManagedMachinePoolList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureManagedMachinePoolSpec)(nil), (*v1beta1.AzureManagedMachinePoolSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureManagedMachinePoolSpec_To_v1beta1_AzureManagedMachinePoolSpec(a.(*AzureManagedMachinePoolSpec), b.(*v1beta1.AzureManagedMachinePoolSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureManagedMachinePoolStatus)(nil), (*v1beta1.AzureManagedMachinePoolStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureManagedMachinePoolStatus_To_v1beta1_AzureManagedMachinePoolStatus(a.(*AzureManagedMachinePoolStatus), b.(*v1beta1.AzureManagedMachinePoolStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureSharedGalleryImage)(nil), (*v1beta1.AzureSharedGalleryImage)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureSharedGalleryImage_To_v1beta1_AzureSharedGalleryImage(a.(*AzureSharedGalleryImage), b.(*v1beta1.AzureSharedGalleryImage), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*BuildParams)(nil), (*v1beta1.BuildParams)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_BuildParams_To_v1beta1_BuildParams(a.(*BuildParams), b.(*v1beta1.BuildParams), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.BuildParams)(nil), (*BuildParams)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_BuildParams_To_v1alpha3_BuildParams(a.(*v1beta1.BuildParams), b.(*BuildParams), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*DataDisk)(nil), (*v1beta1.DataDisk)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_DataDisk_To_v1beta1_DataDisk(a.(*DataDisk), b.(*v1beta1.DataDisk), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.DataDisk)(nil), (*DataDisk)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_DataDisk_To_v1alpha3_DataDisk(a.(*v1beta1.DataDisk), b.(*DataDisk), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*DiffDiskSettings)(nil), (*v1beta1.DiffDiskSettings)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_DiffDiskSettings_To_v1beta1_DiffDiskSettings(a.(*DiffDiskSettings), b.(*v1beta1.DiffDiskSettings), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.DiffDiskSettings)(nil), (*DiffDiskSettings)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_DiffDiskSettings_To_v1alpha3_DiffDiskSettings(a.(*v1beta1.DiffDiskSettings), b.(*DiffDiskSettings), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*DiskEncryptionSetParameters)(nil), (*v1beta1.DiskEncryptionSetParameters)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_DiskEncryptionSetParameters_To_v1beta1_DiskEncryptionSetParameters(a.(*DiskEncryptionSetParameters), b.(*v1beta1.DiskEncryptionSetParameters), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.DiskEncryptionSetParameters)(nil), (*DiskEncryptionSetParameters)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_DiskEncryptionSetParameters_To_v1alpha3_DiskEncryptionSetParameters(a.(*v1beta1.DiskEncryptionSetParameters), b.(*DiskEncryptionSetParameters), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*Image)(nil), (*v1beta1.Image)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_Image_To_v1beta1_Image(a.(*Image), b.(*v1beta1.Image), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*ManagedControlPlaneSubnet)(nil), (*v1beta1.ManagedControlPlaneSubnet)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_ManagedControlPlaneSubnet_To_v1beta1_ManagedControlPlaneSubnet(a.(*ManagedControlPlaneSubnet), b.(*v1beta1.ManagedControlPlaneSubnet), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*ManagedControlPlaneVirtualNetwork)(nil), (*v1beta1.ManagedControlPlaneVirtualNetwork)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_ManagedControlPlaneVirtualNetwork_To_v1beta1_ManagedControlPlaneVirtualNetwork(a.(*ManagedControlPlaneVirtualNetwork), b.(*v1beta1.ManagedControlPlaneVirtualNetwork), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*PublicIPSpec)(nil), (*v1beta1.PublicIPSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_PublicIPSpec_To_v1beta1_PublicIPSpec(a.(*PublicIPSpec), b.(*v1beta1.PublicIPSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*RouteTable)(nil), (*v1beta1.RouteTable)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_RouteTable_To_v1beta1_RouteTable(a.(*RouteTable), b.(*v1beta1.RouteTable), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.RouteTable)(nil), (*RouteTable)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_RouteTable_To_v1alpha3_RouteTable(a.(*v1beta1.RouteTable), b.(*RouteTable), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*SecurityProfile)(nil), (*v1beta1.SecurityProfile)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_SecurityProfile_To_v1beta1_SecurityProfile(a.(*SecurityProfile), b.(*v1beta1.SecurityProfile), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.SecurityProfile)(nil), (*SecurityProfile)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_SecurityProfile_To_v1alpha3_SecurityProfile(a.(*v1beta1.SecurityProfile), b.(*SecurityProfile), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*SpotVMOptions)(nil), (*v1beta1.SpotVMOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_SpotVMOptions_To_v1beta1_SpotVMOptions(a.(*SpotVMOptions), b.(*v1beta1.SpotVMOptions), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*UserAssignedIdentity)(nil), (*v1beta1.UserAssignedIdentity)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_UserAssignedIdentity_To_v1beta1_UserAssignedIdentity(a.(*UserAssignedIdentity), b.(*v1beta1.UserAssignedIdentity), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.UserAssignedIdentity)(nil), (*UserAssignedIdentity)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_UserAssignedIdentity_To_v1alpha3_UserAssignedIdentity(a.(*v1beta1.UserAssignedIdentity), b.(*UserAssignedIdentity), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*AzureClusterIdentitySpec)(nil), (*v1beta1.AzureClusterIdentitySpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureClusterIdentitySpec_To_v1beta1_AzureClusterIdentitySpec(a.(*AzureClusterIdentitySpec), b.(*v1beta1.AzureClusterIdentitySpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*AzureClusterSpec)(nil), (*v1beta1.AzureClusterSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureClusterSpec_To_v1beta1_AzureClusterSpec(a.(*AzureClusterSpec), b.(*v1beta1.AzureClusterSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*AzureClusterStatus)(nil), (*v1beta1.AzureClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureClusterStatus_To_v1beta1_AzureClusterStatus(a.(*AzureClusterStatus), b.(*v1beta1.AzureClusterStatus), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*AzureMachineSpec)(nil), (*v1beta1.AzureMachineSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureMachineSpec_To_v1beta1_AzureMachineSpec(a.(*AzureMachineSpec), b.(*v1beta1.AzureMachineSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*AzureMachineStatus)(nil), (*v1beta1.AzureMachineStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureMachineStatus_To_v1beta1_AzureMachineStatus(a.(*AzureMachineStatus), b.(*v1beta1.AzureMachineStatus), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*AzureMarketplaceImage)(nil), (*v1beta1.AzureMarketplaceImage)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureMarketplaceImage_To_v1beta1_AzureMarketplaceImage(a.(*AzureMarketplaceImage), b.(*v1beta1.AzureMarketplaceImage), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*FrontendIP)(nil), (*v1beta1.FrontendIP)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_FrontendIP_To_v1beta1_FrontendIP(a.(*FrontendIP), b.(*v1beta1.FrontendIP), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*Future)(nil), (*v1beta1.Future)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_Future_To_v1beta1_Future(a.(*Future), b.(*v1beta1.Future), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*IngressRule)(nil), (*v1beta1.SecurityRule)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_IngressRule_To_v1beta1_SecurityRule(a.(*IngressRule), b.(*v1beta1.SecurityRule), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*LoadBalancerSpec)(nil), (*v1beta1.LoadBalancerSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_LoadBalancerSpec_To_v1beta1_LoadBalancerSpec(a.(*LoadBalancerSpec), b.(*v1beta1.LoadBalancerSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*ManagedDisk)(nil), (*v1beta1.ManagedDiskParameters)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_ManagedDisk_To_v1beta1_ManagedDiskParameters(a.(*ManagedDisk), b.(*v1beta1.ManagedDiskParameters), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*NetworkSpec)(nil), (*v1beta1.NetworkSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_NetworkSpec_To_v1beta1_NetworkSpec(a.(*NetworkSpec), b.(*v1beta1.NetworkSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*OSDisk)(nil), (*v1beta1.OSDisk)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_OSDisk_To_v1beta1_OSDisk(a.(*OSDisk), b.(*v1beta1.OSDisk), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*SecurityGroup)(nil), (*v1beta1.SecurityGroup)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_SecurityGroup_To_v1beta1_SecurityGroup(a.(*SecurityGroup), b.(*v1beta1.SecurityGroup), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*SubnetSpec)(nil), (*v1beta1.SubnetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_SubnetSpec_To_v1beta1_SubnetSpec(a.(*SubnetSpec), b.(*v1beta1.SubnetSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*VnetSpec)(nil), (*v1beta1.VnetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_VnetSpec_To_v1beta1_VnetSpec(a.(*VnetSpec), b.(*v1beta1.VnetSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.AzureClusterIdentitySpec)(nil), (*AzureClusterIdentitySpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureClusterIdentitySpec_To_v1alpha3_AzureClusterIdentitySpec(a.(*v1beta1.AzureClusterIdentitySpec), b.(*AzureClusterIdentitySpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.AzureClusterSpec)(nil), (*AzureClusterSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureClusterSpec_To_v1alpha3_AzureClusterSpec(a.(*v1beta1.AzureClusterSpec), b.(*AzureClusterSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.AzureClusterStatus)(nil), (*AzureClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureClusterStatus_To_v1alpha3_AzureClusterStatus(a.(*v1beta1.AzureClusterStatus), b.(*AzureClusterStatus), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.AzureMachineSpec)(nil), (*AzureMachineSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMachineSpec_To_v1alpha3_AzureMachineSpec(a.(*v1beta1.AzureMachineSpec), b.(*AzureMachineSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.AzureMachineStatus)(nil), (*AzureMachineStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMachineStatus_To_v1alpha3_AzureMachineStatus(a.(*v1beta1.AzureMachineStatus), b.(*AzureMachineStatus), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.AzureMachineTemplateResource)(nil), (*AzureMachineTemplateResource)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMachineTemplateResource_To_v1alpha3_AzureMachineTemplateResource(a.(*v1beta1.AzureMachineTemplateResource), b.(*AzureMachineTemplateResource), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.AzureManagedControlPlaneSpec)(nil), (*AzureManagedControlPlaneSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureManagedControlPlaneSpec_To_v1alpha3_AzureManagedControlPlaneSpec(a.(*v1beta1.AzureManagedControlPlaneSpec), b.(*AzureManagedControlPlaneSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.AzureManagedControlPlaneStatus)(nil), (*AzureManagedControlPlaneStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureManagedControlPlaneStatus_To_v1alpha3_AzureManagedControlPlaneStatus(a.(*v1beta1.AzureManagedControlPlaneStatus), b.(*AzureManagedControlPlaneStatus), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.AzureManagedMachinePoolSpec)(nil), (*AzureManagedMachinePoolSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureManagedMachinePoolSpec_To_v1alpha3_AzureManagedMachinePoolSpec(a.(*v1beta1.AzureManagedMachinePoolSpec), b.(*AzureManagedMachinePoolSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.AzureManagedMachinePoolStatus)(nil), (*AzureManagedMachinePoolStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureManagedMachinePoolStatus_To_v1alpha3_AzureManagedMachinePoolStatus(a.(*v1beta1.AzureManagedMachinePoolStatus), b.(*AzureManagedMachinePoolStatus), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.AzureMarketplaceImage)(nil), (*AzureMarketplaceImage)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMarketplaceImage_To_v1alpha3_AzureMarketplaceImage(a.(*v1beta1.AzureMarketplaceImage), b.(*AzureMarketplaceImage), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.AzureSharedGalleryImage)(nil), (*AzureSharedGalleryImage)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureSharedGalleryImage_To_v1alpha3_AzureSharedGalleryImage(a.(*v1beta1.AzureSharedGalleryImage), b.(*AzureSharedGalleryImage), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.FrontendIP)(nil), (*FrontendIP)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_FrontendIP_To_v1alpha3_FrontendIP(a.(*v1beta1.FrontendIP), b.(*FrontendIP), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.Future)(nil), (*Future)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_Future_To_v1alpha3_Future(a.(*v1beta1.Future), b.(*Future), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.Image)(nil), (*Image)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_Image_To_v1alpha3_Image(a.(*v1beta1.Image), b.(*Image), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.LoadBalancerSpec)(nil), (*LoadBalancerSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_LoadBalancerSpec_To_v1alpha3_LoadBalancerSpec(a.(*v1beta1.LoadBalancerSpec), b.(*LoadBalancerSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.ManagedControlPlaneSubnet)(nil), (*ManagedControlPlaneSubnet)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_ManagedControlPlaneSubnet_To_v1alpha3_ManagedControlPlaneSubnet(a.(*v1beta1.ManagedControlPlaneSubnet), b.(*ManagedControlPlaneSubnet), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.ManagedControlPlaneVirtualNetwork)(nil), (*ManagedControlPlaneVirtualNetwork)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_ManagedControlPlaneVirtualNetwork_To_v1alpha3_ManagedControlPlaneVirtualNetwork(a.(*v1beta1.ManagedControlPlaneVirtualNetwork), b.(*ManagedControlPlaneVirtualNetwork), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.ManagedDiskParameters)(nil), (*ManagedDisk)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_ManagedDiskParameters_To_v1alpha3_ManagedDisk(a.(*v1beta1.ManagedDiskParameters), b.(*ManagedDisk), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.NetworkSpec)(nil), (*NetworkSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_NetworkSpec_To_v1alpha3_NetworkSpec(a.(*v1beta1.NetworkSpec), b.(*NetworkSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.OSDisk)(nil), (*OSDisk)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_OSDisk_To_v1alpha3_OSDisk(a.(*v1beta1.OSDisk), b.(*OSDisk), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.PublicIPSpec)(nil), (*PublicIPSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_PublicIPSpec_To_v1alpha3_PublicIPSpec(a.(*v1beta1.PublicIPSpec), b.(*PublicIPSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.SecurityGroup)(nil), (*SecurityGroup)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_SecurityGroup_To_v1alpha3_SecurityGroup(a.(*v1beta1.SecurityGroup), b.(*SecurityGroup), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.SecurityRule)(nil), (*IngressRule)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_SecurityRule_To_v1alpha3_IngressRule(a.(*v1beta1.SecurityRule), b.(*IngressRule), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.SpotVMOptions)(nil), (*SpotVMOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_SpotVMOptions_To_v1alpha3_SpotVMOptions(a.(*v1beta1.SpotVMOptions), b.(*SpotVMOptions), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.SubnetSpec)(nil), (*SubnetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_SubnetSpec_To_v1alpha3_SubnetSpec(a.(*v1beta1.SubnetSpec), b.(*SubnetSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.VnetSpec)(nil), (*VnetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_VnetSpec_To_v1alpha3_VnetSpec(a.(*v1beta1.VnetSpec), b.(*VnetSpec), scope) - }); err != nil { - return err - } - return nil -} - -func autoConvert_v1alpha3_AADProfile_To_v1beta1_AADProfile(in *AADProfile, out *v1beta1.AADProfile, s conversion.Scope) error { - out.Managed = in.Managed - out.AdminGroupObjectIDs = *(*[]string)(unsafe.Pointer(&in.AdminGroupObjectIDs)) - return nil -} - -// Convert_v1alpha3_AADProfile_To_v1beta1_AADProfile is an autogenerated conversion function. -func Convert_v1alpha3_AADProfile_To_v1beta1_AADProfile(in *AADProfile, out *v1beta1.AADProfile, s conversion.Scope) error { - return autoConvert_v1alpha3_AADProfile_To_v1beta1_AADProfile(in, out, s) -} - -func autoConvert_v1beta1_AADProfile_To_v1alpha3_AADProfile(in *v1beta1.AADProfile, out *AADProfile, s conversion.Scope) error { - out.Managed = in.Managed - out.AdminGroupObjectIDs = *(*[]string)(unsafe.Pointer(&in.AdminGroupObjectIDs)) - return nil -} - -// Convert_v1beta1_AADProfile_To_v1alpha3_AADProfile is an autogenerated conversion function. -func Convert_v1beta1_AADProfile_To_v1alpha3_AADProfile(in *v1beta1.AADProfile, out *AADProfile, s conversion.Scope) error { - return autoConvert_v1beta1_AADProfile_To_v1alpha3_AADProfile(in, out, s) -} - -func autoConvert_v1alpha3_AddressRecord_To_v1beta1_AddressRecord(in *AddressRecord, out *v1beta1.AddressRecord, s conversion.Scope) error { - out.Hostname = in.Hostname - out.IP = in.IP - return nil -} - -// Convert_v1alpha3_AddressRecord_To_v1beta1_AddressRecord is an autogenerated conversion function. -func Convert_v1alpha3_AddressRecord_To_v1beta1_AddressRecord(in *AddressRecord, out *v1beta1.AddressRecord, s conversion.Scope) error { - return autoConvert_v1alpha3_AddressRecord_To_v1beta1_AddressRecord(in, out, s) -} - -func autoConvert_v1beta1_AddressRecord_To_v1alpha3_AddressRecord(in *v1beta1.AddressRecord, out *AddressRecord, s conversion.Scope) error { - out.Hostname = in.Hostname - out.IP = in.IP - return nil -} - -// Convert_v1beta1_AddressRecord_To_v1alpha3_AddressRecord is an autogenerated conversion function. -func Convert_v1beta1_AddressRecord_To_v1alpha3_AddressRecord(in *v1beta1.AddressRecord, out *AddressRecord, s conversion.Scope) error { - return autoConvert_v1beta1_AddressRecord_To_v1alpha3_AddressRecord(in, out, s) -} - -func autoConvert_v1alpha3_AzureCluster_To_v1beta1_AzureCluster(in *AzureCluster, out *v1beta1.AzureCluster, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha3_AzureClusterSpec_To_v1beta1_AzureClusterSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1alpha3_AzureClusterStatus_To_v1beta1_AzureClusterStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha3_AzureCluster_To_v1beta1_AzureCluster is an autogenerated conversion function. -func Convert_v1alpha3_AzureCluster_To_v1beta1_AzureCluster(in *AzureCluster, out *v1beta1.AzureCluster, s conversion.Scope) error { - return autoConvert_v1alpha3_AzureCluster_To_v1beta1_AzureCluster(in, out, s) -} - -func autoConvert_v1beta1_AzureCluster_To_v1alpha3_AzureCluster(in *v1beta1.AzureCluster, out *AzureCluster, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1beta1_AzureClusterSpec_To_v1alpha3_AzureClusterSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1beta1_AzureClusterStatus_To_v1alpha3_AzureClusterStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta1_AzureCluster_To_v1alpha3_AzureCluster is an autogenerated conversion function. -func Convert_v1beta1_AzureCluster_To_v1alpha3_AzureCluster(in *v1beta1.AzureCluster, out *AzureCluster, s conversion.Scope) error { - return autoConvert_v1beta1_AzureCluster_To_v1alpha3_AzureCluster(in, out, s) -} - -func autoConvert_v1alpha3_AzureClusterIdentity_To_v1beta1_AzureClusterIdentity(in *AzureClusterIdentity, out *v1beta1.AzureClusterIdentity, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha3_AzureClusterIdentitySpec_To_v1beta1_AzureClusterIdentitySpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1alpha3_AzureClusterIdentityStatus_To_v1beta1_AzureClusterIdentityStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha3_AzureClusterIdentity_To_v1beta1_AzureClusterIdentity is an autogenerated conversion function. -func Convert_v1alpha3_AzureClusterIdentity_To_v1beta1_AzureClusterIdentity(in *AzureClusterIdentity, out *v1beta1.AzureClusterIdentity, s conversion.Scope) error { - return autoConvert_v1alpha3_AzureClusterIdentity_To_v1beta1_AzureClusterIdentity(in, out, s) -} - -func autoConvert_v1beta1_AzureClusterIdentity_To_v1alpha3_AzureClusterIdentity(in *v1beta1.AzureClusterIdentity, out *AzureClusterIdentity, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1beta1_AzureClusterIdentitySpec_To_v1alpha3_AzureClusterIdentitySpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1beta1_AzureClusterIdentityStatus_To_v1alpha3_AzureClusterIdentityStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta1_AzureClusterIdentity_To_v1alpha3_AzureClusterIdentity is an autogenerated conversion function. -func Convert_v1beta1_AzureClusterIdentity_To_v1alpha3_AzureClusterIdentity(in *v1beta1.AzureClusterIdentity, out *AzureClusterIdentity, s conversion.Scope) error { - return autoConvert_v1beta1_AzureClusterIdentity_To_v1alpha3_AzureClusterIdentity(in, out, s) -} - -func autoConvert_v1alpha3_AzureClusterIdentityList_To_v1beta1_AzureClusterIdentityList(in *AzureClusterIdentityList, out *v1beta1.AzureClusterIdentityList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]v1beta1.AzureClusterIdentity, len(*in)) - for i := range *in { - if err := Convert_v1alpha3_AzureClusterIdentity_To_v1beta1_AzureClusterIdentity(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1alpha3_AzureClusterIdentityList_To_v1beta1_AzureClusterIdentityList is an autogenerated conversion function. -func Convert_v1alpha3_AzureClusterIdentityList_To_v1beta1_AzureClusterIdentityList(in *AzureClusterIdentityList, out *v1beta1.AzureClusterIdentityList, s conversion.Scope) error { - return autoConvert_v1alpha3_AzureClusterIdentityList_To_v1beta1_AzureClusterIdentityList(in, out, s) -} - -func autoConvert_v1beta1_AzureClusterIdentityList_To_v1alpha3_AzureClusterIdentityList(in *v1beta1.AzureClusterIdentityList, out *AzureClusterIdentityList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]AzureClusterIdentity, len(*in)) - for i := range *in { - if err := Convert_v1beta1_AzureClusterIdentity_To_v1alpha3_AzureClusterIdentity(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1beta1_AzureClusterIdentityList_To_v1alpha3_AzureClusterIdentityList is an autogenerated conversion function. -func Convert_v1beta1_AzureClusterIdentityList_To_v1alpha3_AzureClusterIdentityList(in *v1beta1.AzureClusterIdentityList, out *AzureClusterIdentityList, s conversion.Scope) error { - return autoConvert_v1beta1_AzureClusterIdentityList_To_v1alpha3_AzureClusterIdentityList(in, out, s) -} - -func autoConvert_v1alpha3_AzureClusterIdentitySpec_To_v1beta1_AzureClusterIdentitySpec(in *AzureClusterIdentitySpec, out *v1beta1.AzureClusterIdentitySpec, s conversion.Scope) error { - out.Type = v1beta1.IdentityType(in.Type) - out.ResourceID = in.ResourceID - out.ClientID = in.ClientID - out.ClientSecret = in.ClientSecret - out.TenantID = in.TenantID - // WARNING: in.AllowedNamespaces requires manual conversion: inconvertible types ([]string vs *sigs.k8s.io/cluster-api-provider-azure/api/v1beta1.AllowedNamespaces) - return nil -} - -func autoConvert_v1beta1_AzureClusterIdentitySpec_To_v1alpha3_AzureClusterIdentitySpec(in *v1beta1.AzureClusterIdentitySpec, out *AzureClusterIdentitySpec, s conversion.Scope) error { - out.Type = IdentityType(in.Type) - out.ResourceID = in.ResourceID - out.ClientID = in.ClientID - out.ClientSecret = in.ClientSecret - out.TenantID = in.TenantID - // WARNING: in.AllowedNamespaces requires manual conversion: inconvertible types (*sigs.k8s.io/cluster-api-provider-azure/api/v1beta1.AllowedNamespaces vs []string) - return nil -} - -func autoConvert_v1alpha3_AzureClusterIdentityStatus_To_v1beta1_AzureClusterIdentityStatus(in *AzureClusterIdentityStatus, out *v1beta1.AzureClusterIdentityStatus, s conversion.Scope) error { - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(apiv1beta1.Conditions, len(*in)) - for i := range *in { - if err := apiv1alpha3.Convert_v1alpha3_Condition_To_v1beta1_Condition(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Conditions = nil - } - return nil -} - -// Convert_v1alpha3_AzureClusterIdentityStatus_To_v1beta1_AzureClusterIdentityStatus is an autogenerated conversion function. -func Convert_v1alpha3_AzureClusterIdentityStatus_To_v1beta1_AzureClusterIdentityStatus(in *AzureClusterIdentityStatus, out *v1beta1.AzureClusterIdentityStatus, s conversion.Scope) error { - return autoConvert_v1alpha3_AzureClusterIdentityStatus_To_v1beta1_AzureClusterIdentityStatus(in, out, s) -} - -func autoConvert_v1beta1_AzureClusterIdentityStatus_To_v1alpha3_AzureClusterIdentityStatus(in *v1beta1.AzureClusterIdentityStatus, out *AzureClusterIdentityStatus, s conversion.Scope) error { - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(apiv1alpha3.Conditions, len(*in)) - for i := range *in { - if err := apiv1alpha3.Convert_v1beta1_Condition_To_v1alpha3_Condition(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Conditions = nil - } - return nil -} - -// Convert_v1beta1_AzureClusterIdentityStatus_To_v1alpha3_AzureClusterIdentityStatus is an autogenerated conversion function. -func Convert_v1beta1_AzureClusterIdentityStatus_To_v1alpha3_AzureClusterIdentityStatus(in *v1beta1.AzureClusterIdentityStatus, out *AzureClusterIdentityStatus, s conversion.Scope) error { - return autoConvert_v1beta1_AzureClusterIdentityStatus_To_v1alpha3_AzureClusterIdentityStatus(in, out, s) -} - -func autoConvert_v1alpha3_AzureClusterList_To_v1beta1_AzureClusterList(in *AzureClusterList, out *v1beta1.AzureClusterList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]v1beta1.AzureCluster, len(*in)) - for i := range *in { - if err := Convert_v1alpha3_AzureCluster_To_v1beta1_AzureCluster(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1alpha3_AzureClusterList_To_v1beta1_AzureClusterList is an autogenerated conversion function. -func Convert_v1alpha3_AzureClusterList_To_v1beta1_AzureClusterList(in *AzureClusterList, out *v1beta1.AzureClusterList, s conversion.Scope) error { - return autoConvert_v1alpha3_AzureClusterList_To_v1beta1_AzureClusterList(in, out, s) -} - -func autoConvert_v1beta1_AzureClusterList_To_v1alpha3_AzureClusterList(in *v1beta1.AzureClusterList, out *AzureClusterList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]AzureCluster, len(*in)) - for i := range *in { - if err := Convert_v1beta1_AzureCluster_To_v1alpha3_AzureCluster(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1beta1_AzureClusterList_To_v1alpha3_AzureClusterList is an autogenerated conversion function. -func Convert_v1beta1_AzureClusterList_To_v1alpha3_AzureClusterList(in *v1beta1.AzureClusterList, out *AzureClusterList, s conversion.Scope) error { - return autoConvert_v1beta1_AzureClusterList_To_v1alpha3_AzureClusterList(in, out, s) -} - -func autoConvert_v1alpha3_AzureClusterSpec_To_v1beta1_AzureClusterSpec(in *AzureClusterSpec, out *v1beta1.AzureClusterSpec, s conversion.Scope) error { - if err := Convert_v1alpha3_NetworkSpec_To_v1beta1_NetworkSpec(&in.NetworkSpec, &out.NetworkSpec, s); err != nil { - return err - } - out.ResourceGroup = in.ResourceGroup - // WARNING: in.SubscriptionID requires manual conversion: does not exist in peer-type - // WARNING: in.Location requires manual conversion: does not exist in peer-type - if err := apiv1alpha3.Convert_v1alpha3_APIEndpoint_To_v1beta1_APIEndpoint(&in.ControlPlaneEndpoint, &out.ControlPlaneEndpoint, s); err != nil { - return err - } - // WARNING: in.AdditionalTags requires manual conversion: does not exist in peer-type - // WARNING: in.IdentityRef requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1beta1_AzureClusterSpec_To_v1alpha3_AzureClusterSpec(in *v1beta1.AzureClusterSpec, out *AzureClusterSpec, s conversion.Scope) error { - // WARNING: in.AzureClusterClassSpec requires manual conversion: does not exist in peer-type - if err := Convert_v1beta1_NetworkSpec_To_v1alpha3_NetworkSpec(&in.NetworkSpec, &out.NetworkSpec, s); err != nil { - return err - } - out.ResourceGroup = in.ResourceGroup - // WARNING: in.BastionSpec requires manual conversion: does not exist in peer-type - if err := apiv1alpha3.Convert_v1beta1_APIEndpoint_To_v1alpha3_APIEndpoint(&in.ControlPlaneEndpoint, &out.ControlPlaneEndpoint, s); err != nil { - return err - } - return nil -} - -func autoConvert_v1alpha3_AzureClusterStatus_To_v1beta1_AzureClusterStatus(in *AzureClusterStatus, out *v1beta1.AzureClusterStatus, s conversion.Scope) error { - if in.FailureDomains != nil { - in, out := &in.FailureDomains, &out.FailureDomains - *out = make(apiv1beta1.FailureDomains, len(*in)) - for key, val := range *in { - newVal := new(apiv1beta1.FailureDomainSpec) - if err := apiv1alpha3.Convert_v1alpha3_FailureDomainSpec_To_v1beta1_FailureDomainSpec(&val, newVal, s); err != nil { - return err - } - (*out)[key] = *newVal - } - } else { - out.FailureDomains = nil - } - out.Ready = in.Ready - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(apiv1beta1.Conditions, len(*in)) - for i := range *in { - if err := apiv1alpha3.Convert_v1alpha3_Condition_To_v1beta1_Condition(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Conditions = nil - } - return nil -} - -func autoConvert_v1beta1_AzureClusterStatus_To_v1alpha3_AzureClusterStatus(in *v1beta1.AzureClusterStatus, out *AzureClusterStatus, s conversion.Scope) error { - if in.FailureDomains != nil { - in, out := &in.FailureDomains, &out.FailureDomains - *out = make(apiv1alpha3.FailureDomains, len(*in)) - for key, val := range *in { - newVal := new(apiv1alpha3.FailureDomainSpec) - if err := apiv1alpha3.Convert_v1beta1_FailureDomainSpec_To_v1alpha3_FailureDomainSpec(&val, newVal, s); err != nil { - return err - } - (*out)[key] = *newVal - } - } else { - out.FailureDomains = nil - } - out.Ready = in.Ready - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(apiv1alpha3.Conditions, len(*in)) - for i := range *in { - if err := apiv1alpha3.Convert_v1beta1_Condition_To_v1alpha3_Condition(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Conditions = nil - } - // WARNING: in.LongRunningOperationStates requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha3_AzureMachine_To_v1beta1_AzureMachine(in *AzureMachine, out *v1beta1.AzureMachine, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha3_AzureMachineSpec_To_v1beta1_AzureMachineSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1alpha3_AzureMachineStatus_To_v1beta1_AzureMachineStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha3_AzureMachine_To_v1beta1_AzureMachine is an autogenerated conversion function. -func Convert_v1alpha3_AzureMachine_To_v1beta1_AzureMachine(in *AzureMachine, out *v1beta1.AzureMachine, s conversion.Scope) error { - return autoConvert_v1alpha3_AzureMachine_To_v1beta1_AzureMachine(in, out, s) -} - -func autoConvert_v1beta1_AzureMachine_To_v1alpha3_AzureMachine(in *v1beta1.AzureMachine, out *AzureMachine, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1beta1_AzureMachineSpec_To_v1alpha3_AzureMachineSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1beta1_AzureMachineStatus_To_v1alpha3_AzureMachineStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta1_AzureMachine_To_v1alpha3_AzureMachine is an autogenerated conversion function. -func Convert_v1beta1_AzureMachine_To_v1alpha3_AzureMachine(in *v1beta1.AzureMachine, out *AzureMachine, s conversion.Scope) error { - return autoConvert_v1beta1_AzureMachine_To_v1alpha3_AzureMachine(in, out, s) -} - -func autoConvert_v1alpha3_AzureMachineList_To_v1beta1_AzureMachineList(in *AzureMachineList, out *v1beta1.AzureMachineList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]v1beta1.AzureMachine, len(*in)) - for i := range *in { - if err := Convert_v1alpha3_AzureMachine_To_v1beta1_AzureMachine(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1alpha3_AzureMachineList_To_v1beta1_AzureMachineList is an autogenerated conversion function. -func Convert_v1alpha3_AzureMachineList_To_v1beta1_AzureMachineList(in *AzureMachineList, out *v1beta1.AzureMachineList, s conversion.Scope) error { - return autoConvert_v1alpha3_AzureMachineList_To_v1beta1_AzureMachineList(in, out, s) -} - -func autoConvert_v1beta1_AzureMachineList_To_v1alpha3_AzureMachineList(in *v1beta1.AzureMachineList, out *AzureMachineList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]AzureMachine, len(*in)) - for i := range *in { - if err := Convert_v1beta1_AzureMachine_To_v1alpha3_AzureMachine(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1beta1_AzureMachineList_To_v1alpha3_AzureMachineList is an autogenerated conversion function. -func Convert_v1beta1_AzureMachineList_To_v1alpha3_AzureMachineList(in *v1beta1.AzureMachineList, out *AzureMachineList, s conversion.Scope) error { - return autoConvert_v1beta1_AzureMachineList_To_v1alpha3_AzureMachineList(in, out, s) -} - -func autoConvert_v1alpha3_AzureMachineSpec_To_v1beta1_AzureMachineSpec(in *AzureMachineSpec, out *v1beta1.AzureMachineSpec, s conversion.Scope) error { - out.ProviderID = (*string)(unsafe.Pointer(in.ProviderID)) - out.VMSize = in.VMSize - out.FailureDomain = (*string)(unsafe.Pointer(in.FailureDomain)) - // WARNING: in.AvailabilityZone requires manual conversion: does not exist in peer-type - if in.Image != nil { - in, out := &in.Image, &out.Image - *out = new(v1beta1.Image) - if err := Convert_v1alpha3_Image_To_v1beta1_Image(*in, *out, s); err != nil { - return err - } - } else { - out.Image = nil - } - out.Identity = v1beta1.VMIdentity(in.Identity) - out.UserAssignedIdentities = *(*[]v1beta1.UserAssignedIdentity)(unsafe.Pointer(&in.UserAssignedIdentities)) - out.RoleAssignmentName = in.RoleAssignmentName - if err := Convert_v1alpha3_OSDisk_To_v1beta1_OSDisk(&in.OSDisk, &out.OSDisk, s); err != nil { - return err - } - if in.DataDisks != nil { - in, out := &in.DataDisks, &out.DataDisks - *out = make([]v1beta1.DataDisk, len(*in)) - for i := range *in { - if err := Convert_v1alpha3_DataDisk_To_v1beta1_DataDisk(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.DataDisks = nil - } - // WARNING: in.Location requires manual conversion: does not exist in peer-type - out.SSHPublicKey = in.SSHPublicKey - out.AdditionalTags = *(*v1beta1.Tags)(unsafe.Pointer(&in.AdditionalTags)) - out.AllocatePublicIP = in.AllocatePublicIP - out.EnableIPForwarding = in.EnableIPForwarding - out.AcceleratedNetworking = (*bool)(unsafe.Pointer(in.AcceleratedNetworking)) - if in.SpotVMOptions != nil { - in, out := &in.SpotVMOptions, &out.SpotVMOptions - *out = new(v1beta1.SpotVMOptions) - if err := Convert_v1alpha3_SpotVMOptions_To_v1beta1_SpotVMOptions(*in, *out, s); err != nil { - return err - } - } else { - out.SpotVMOptions = nil - } - out.SecurityProfile = (*v1beta1.SecurityProfile)(unsafe.Pointer(in.SecurityProfile)) - return nil -} - -func autoConvert_v1beta1_AzureMachineSpec_To_v1alpha3_AzureMachineSpec(in *v1beta1.AzureMachineSpec, out *AzureMachineSpec, s conversion.Scope) error { - out.ProviderID = (*string)(unsafe.Pointer(in.ProviderID)) - out.VMSize = in.VMSize - out.FailureDomain = (*string)(unsafe.Pointer(in.FailureDomain)) - if in.Image != nil { - in, out := &in.Image, &out.Image - *out = new(Image) - if err := Convert_v1beta1_Image_To_v1alpha3_Image(*in, *out, s); err != nil { - return err - } - } else { - out.Image = nil - } - out.Identity = VMIdentity(in.Identity) - out.UserAssignedIdentities = *(*[]UserAssignedIdentity)(unsafe.Pointer(&in.UserAssignedIdentities)) - // WARNING: in.SystemAssignedIdentityRole requires manual conversion: does not exist in peer-type - out.RoleAssignmentName = in.RoleAssignmentName - if err := Convert_v1beta1_OSDisk_To_v1alpha3_OSDisk(&in.OSDisk, &out.OSDisk, s); err != nil { - return err - } - if in.DataDisks != nil { - in, out := &in.DataDisks, &out.DataDisks - *out = make([]DataDisk, len(*in)) - for i := range *in { - if err := Convert_v1beta1_DataDisk_To_v1alpha3_DataDisk(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.DataDisks = nil - } - out.SSHPublicKey = in.SSHPublicKey - out.AdditionalTags = *(*Tags)(unsafe.Pointer(&in.AdditionalTags)) - // WARNING: in.AdditionalCapabilities requires manual conversion: does not exist in peer-type - out.AllocatePublicIP = in.AllocatePublicIP - out.EnableIPForwarding = in.EnableIPForwarding - out.AcceleratedNetworking = (*bool)(unsafe.Pointer(in.AcceleratedNetworking)) - // WARNING: in.Diagnostics requires manual conversion: does not exist in peer-type - if in.SpotVMOptions != nil { - in, out := &in.SpotVMOptions, &out.SpotVMOptions - *out = new(SpotVMOptions) - if err := Convert_v1beta1_SpotVMOptions_To_v1alpha3_SpotVMOptions(*in, *out, s); err != nil { - return err - } - } else { - out.SpotVMOptions = nil - } - out.SecurityProfile = (*SecurityProfile)(unsafe.Pointer(in.SecurityProfile)) - // WARNING: in.SubnetName requires manual conversion: does not exist in peer-type - // WARNING: in.DNSServers requires manual conversion: does not exist in peer-type - // WARNING: in.VMExtensions requires manual conversion: does not exist in peer-type - // WARNING: in.NetworkInterfaces requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha3_AzureMachineStatus_To_v1beta1_AzureMachineStatus(in *AzureMachineStatus, out *v1beta1.AzureMachineStatus, s conversion.Scope) error { - out.Ready = in.Ready - out.Addresses = *(*[]v1.NodeAddress)(unsafe.Pointer(&in.Addresses)) - out.VMState = (*v1beta1.ProvisioningState)(unsafe.Pointer(in.VMState)) - out.FailureReason = (*errors.MachineStatusError)(unsafe.Pointer(in.FailureReason)) - out.FailureMessage = (*string)(unsafe.Pointer(in.FailureMessage)) - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(apiv1beta1.Conditions, len(*in)) - for i := range *in { - if err := apiv1alpha3.Convert_v1alpha3_Condition_To_v1beta1_Condition(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Conditions = nil - } - return nil -} - -func autoConvert_v1beta1_AzureMachineStatus_To_v1alpha3_AzureMachineStatus(in *v1beta1.AzureMachineStatus, out *AzureMachineStatus, s conversion.Scope) error { - out.Ready = in.Ready - out.Addresses = *(*[]v1.NodeAddress)(unsafe.Pointer(&in.Addresses)) - out.VMState = (*VMState)(unsafe.Pointer(in.VMState)) - out.FailureReason = (*errors.MachineStatusError)(unsafe.Pointer(in.FailureReason)) - out.FailureMessage = (*string)(unsafe.Pointer(in.FailureMessage)) - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(apiv1alpha3.Conditions, len(*in)) - for i := range *in { - if err := apiv1alpha3.Convert_v1beta1_Condition_To_v1alpha3_Condition(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Conditions = nil - } - // WARNING: in.LongRunningOperationStates requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha3_AzureMachineTemplate_To_v1beta1_AzureMachineTemplate(in *AzureMachineTemplate, out *v1beta1.AzureMachineTemplate, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha3_AzureMachineTemplateSpec_To_v1beta1_AzureMachineTemplateSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha3_AzureMachineTemplate_To_v1beta1_AzureMachineTemplate is an autogenerated conversion function. -func Convert_v1alpha3_AzureMachineTemplate_To_v1beta1_AzureMachineTemplate(in *AzureMachineTemplate, out *v1beta1.AzureMachineTemplate, s conversion.Scope) error { - return autoConvert_v1alpha3_AzureMachineTemplate_To_v1beta1_AzureMachineTemplate(in, out, s) -} - -func autoConvert_v1beta1_AzureMachineTemplate_To_v1alpha3_AzureMachineTemplate(in *v1beta1.AzureMachineTemplate, out *AzureMachineTemplate, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1beta1_AzureMachineTemplateSpec_To_v1alpha3_AzureMachineTemplateSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta1_AzureMachineTemplate_To_v1alpha3_AzureMachineTemplate is an autogenerated conversion function. -func Convert_v1beta1_AzureMachineTemplate_To_v1alpha3_AzureMachineTemplate(in *v1beta1.AzureMachineTemplate, out *AzureMachineTemplate, s conversion.Scope) error { - return autoConvert_v1beta1_AzureMachineTemplate_To_v1alpha3_AzureMachineTemplate(in, out, s) -} - -func autoConvert_v1alpha3_AzureMachineTemplateList_To_v1beta1_AzureMachineTemplateList(in *AzureMachineTemplateList, out *v1beta1.AzureMachineTemplateList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]v1beta1.AzureMachineTemplate, len(*in)) - for i := range *in { - if err := Convert_v1alpha3_AzureMachineTemplate_To_v1beta1_AzureMachineTemplate(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1alpha3_AzureMachineTemplateList_To_v1beta1_AzureMachineTemplateList is an autogenerated conversion function. -func Convert_v1alpha3_AzureMachineTemplateList_To_v1beta1_AzureMachineTemplateList(in *AzureMachineTemplateList, out *v1beta1.AzureMachineTemplateList, s conversion.Scope) error { - return autoConvert_v1alpha3_AzureMachineTemplateList_To_v1beta1_AzureMachineTemplateList(in, out, s) -} - -func autoConvert_v1beta1_AzureMachineTemplateList_To_v1alpha3_AzureMachineTemplateList(in *v1beta1.AzureMachineTemplateList, out *AzureMachineTemplateList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]AzureMachineTemplate, len(*in)) - for i := range *in { - if err := Convert_v1beta1_AzureMachineTemplate_To_v1alpha3_AzureMachineTemplate(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1beta1_AzureMachineTemplateList_To_v1alpha3_AzureMachineTemplateList is an autogenerated conversion function. -func Convert_v1beta1_AzureMachineTemplateList_To_v1alpha3_AzureMachineTemplateList(in *v1beta1.AzureMachineTemplateList, out *AzureMachineTemplateList, s conversion.Scope) error { - return autoConvert_v1beta1_AzureMachineTemplateList_To_v1alpha3_AzureMachineTemplateList(in, out, s) -} - -func autoConvert_v1alpha3_AzureMachineTemplateResource_To_v1beta1_AzureMachineTemplateResource(in *AzureMachineTemplateResource, out *v1beta1.AzureMachineTemplateResource, s conversion.Scope) error { - if err := Convert_v1alpha3_AzureMachineSpec_To_v1beta1_AzureMachineSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha3_AzureMachineTemplateResource_To_v1beta1_AzureMachineTemplateResource is an autogenerated conversion function. -func Convert_v1alpha3_AzureMachineTemplateResource_To_v1beta1_AzureMachineTemplateResource(in *AzureMachineTemplateResource, out *v1beta1.AzureMachineTemplateResource, s conversion.Scope) error { - return autoConvert_v1alpha3_AzureMachineTemplateResource_To_v1beta1_AzureMachineTemplateResource(in, out, s) -} - -func autoConvert_v1beta1_AzureMachineTemplateResource_To_v1alpha3_AzureMachineTemplateResource(in *v1beta1.AzureMachineTemplateResource, out *AzureMachineTemplateResource, s conversion.Scope) error { - // WARNING: in.ObjectMeta requires manual conversion: does not exist in peer-type - if err := Convert_v1beta1_AzureMachineSpec_To_v1alpha3_AzureMachineSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - return nil -} - -func autoConvert_v1alpha3_AzureMachineTemplateSpec_To_v1beta1_AzureMachineTemplateSpec(in *AzureMachineTemplateSpec, out *v1beta1.AzureMachineTemplateSpec, s conversion.Scope) error { - if err := Convert_v1alpha3_AzureMachineTemplateResource_To_v1beta1_AzureMachineTemplateResource(&in.Template, &out.Template, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha3_AzureMachineTemplateSpec_To_v1beta1_AzureMachineTemplateSpec is an autogenerated conversion function. -func Convert_v1alpha3_AzureMachineTemplateSpec_To_v1beta1_AzureMachineTemplateSpec(in *AzureMachineTemplateSpec, out *v1beta1.AzureMachineTemplateSpec, s conversion.Scope) error { - return autoConvert_v1alpha3_AzureMachineTemplateSpec_To_v1beta1_AzureMachineTemplateSpec(in, out, s) -} - -func autoConvert_v1beta1_AzureMachineTemplateSpec_To_v1alpha3_AzureMachineTemplateSpec(in *v1beta1.AzureMachineTemplateSpec, out *AzureMachineTemplateSpec, s conversion.Scope) error { - if err := Convert_v1beta1_AzureMachineTemplateResource_To_v1alpha3_AzureMachineTemplateResource(&in.Template, &out.Template, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta1_AzureMachineTemplateSpec_To_v1alpha3_AzureMachineTemplateSpec is an autogenerated conversion function. -func Convert_v1beta1_AzureMachineTemplateSpec_To_v1alpha3_AzureMachineTemplateSpec(in *v1beta1.AzureMachineTemplateSpec, out *AzureMachineTemplateSpec, s conversion.Scope) error { - return autoConvert_v1beta1_AzureMachineTemplateSpec_To_v1alpha3_AzureMachineTemplateSpec(in, out, s) -} - -func autoConvert_v1alpha3_AzureManagedCluster_To_v1beta1_AzureManagedCluster(in *AzureManagedCluster, out *v1beta1.AzureManagedCluster, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha3_AzureManagedClusterSpec_To_v1beta1_AzureManagedClusterSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1alpha3_AzureManagedClusterStatus_To_v1beta1_AzureManagedClusterStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha3_AzureManagedCluster_To_v1beta1_AzureManagedCluster is an autogenerated conversion function. -func Convert_v1alpha3_AzureManagedCluster_To_v1beta1_AzureManagedCluster(in *AzureManagedCluster, out *v1beta1.AzureManagedCluster, s conversion.Scope) error { - return autoConvert_v1alpha3_AzureManagedCluster_To_v1beta1_AzureManagedCluster(in, out, s) -} - -func autoConvert_v1beta1_AzureManagedCluster_To_v1alpha3_AzureManagedCluster(in *v1beta1.AzureManagedCluster, out *AzureManagedCluster, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1beta1_AzureManagedClusterSpec_To_v1alpha3_AzureManagedClusterSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1beta1_AzureManagedClusterStatus_To_v1alpha3_AzureManagedClusterStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta1_AzureManagedCluster_To_v1alpha3_AzureManagedCluster is an autogenerated conversion function. -func Convert_v1beta1_AzureManagedCluster_To_v1alpha3_AzureManagedCluster(in *v1beta1.AzureManagedCluster, out *AzureManagedCluster, s conversion.Scope) error { - return autoConvert_v1beta1_AzureManagedCluster_To_v1alpha3_AzureManagedCluster(in, out, s) -} - -func autoConvert_v1alpha3_AzureManagedClusterList_To_v1beta1_AzureManagedClusterList(in *AzureManagedClusterList, out *v1beta1.AzureManagedClusterList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]v1beta1.AzureManagedCluster, len(*in)) - for i := range *in { - if err := Convert_v1alpha3_AzureManagedCluster_To_v1beta1_AzureManagedCluster(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1alpha3_AzureManagedClusterList_To_v1beta1_AzureManagedClusterList is an autogenerated conversion function. -func Convert_v1alpha3_AzureManagedClusterList_To_v1beta1_AzureManagedClusterList(in *AzureManagedClusterList, out *v1beta1.AzureManagedClusterList, s conversion.Scope) error { - return autoConvert_v1alpha3_AzureManagedClusterList_To_v1beta1_AzureManagedClusterList(in, out, s) -} - -func autoConvert_v1beta1_AzureManagedClusterList_To_v1alpha3_AzureManagedClusterList(in *v1beta1.AzureManagedClusterList, out *AzureManagedClusterList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]AzureManagedCluster, len(*in)) - for i := range *in { - if err := Convert_v1beta1_AzureManagedCluster_To_v1alpha3_AzureManagedCluster(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1beta1_AzureManagedClusterList_To_v1alpha3_AzureManagedClusterList is an autogenerated conversion function. -func Convert_v1beta1_AzureManagedClusterList_To_v1alpha3_AzureManagedClusterList(in *v1beta1.AzureManagedClusterList, out *AzureManagedClusterList, s conversion.Scope) error { - return autoConvert_v1beta1_AzureManagedClusterList_To_v1alpha3_AzureManagedClusterList(in, out, s) -} - -func autoConvert_v1alpha3_AzureManagedClusterSpec_To_v1beta1_AzureManagedClusterSpec(in *AzureManagedClusterSpec, out *v1beta1.AzureManagedClusterSpec, s conversion.Scope) error { - if err := apiv1alpha3.Convert_v1alpha3_APIEndpoint_To_v1beta1_APIEndpoint(&in.ControlPlaneEndpoint, &out.ControlPlaneEndpoint, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha3_AzureManagedClusterSpec_To_v1beta1_AzureManagedClusterSpec is an autogenerated conversion function. -func Convert_v1alpha3_AzureManagedClusterSpec_To_v1beta1_AzureManagedClusterSpec(in *AzureManagedClusterSpec, out *v1beta1.AzureManagedClusterSpec, s conversion.Scope) error { - return autoConvert_v1alpha3_AzureManagedClusterSpec_To_v1beta1_AzureManagedClusterSpec(in, out, s) -} - -func autoConvert_v1beta1_AzureManagedClusterSpec_To_v1alpha3_AzureManagedClusterSpec(in *v1beta1.AzureManagedClusterSpec, out *AzureManagedClusterSpec, s conversion.Scope) error { - if err := apiv1alpha3.Convert_v1beta1_APIEndpoint_To_v1alpha3_APIEndpoint(&in.ControlPlaneEndpoint, &out.ControlPlaneEndpoint, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta1_AzureManagedClusterSpec_To_v1alpha3_AzureManagedClusterSpec is an autogenerated conversion function. -func Convert_v1beta1_AzureManagedClusterSpec_To_v1alpha3_AzureManagedClusterSpec(in *v1beta1.AzureManagedClusterSpec, out *AzureManagedClusterSpec, s conversion.Scope) error { - return autoConvert_v1beta1_AzureManagedClusterSpec_To_v1alpha3_AzureManagedClusterSpec(in, out, s) -} - -func autoConvert_v1alpha3_AzureManagedClusterStatus_To_v1beta1_AzureManagedClusterStatus(in *AzureManagedClusterStatus, out *v1beta1.AzureManagedClusterStatus, s conversion.Scope) error { - out.Ready = in.Ready - return nil -} - -// Convert_v1alpha3_AzureManagedClusterStatus_To_v1beta1_AzureManagedClusterStatus is an autogenerated conversion function. -func Convert_v1alpha3_AzureManagedClusterStatus_To_v1beta1_AzureManagedClusterStatus(in *AzureManagedClusterStatus, out *v1beta1.AzureManagedClusterStatus, s conversion.Scope) error { - return autoConvert_v1alpha3_AzureManagedClusterStatus_To_v1beta1_AzureManagedClusterStatus(in, out, s) -} - -func autoConvert_v1beta1_AzureManagedClusterStatus_To_v1alpha3_AzureManagedClusterStatus(in *v1beta1.AzureManagedClusterStatus, out *AzureManagedClusterStatus, s conversion.Scope) error { - out.Ready = in.Ready - return nil -} - -// Convert_v1beta1_AzureManagedClusterStatus_To_v1alpha3_AzureManagedClusterStatus is an autogenerated conversion function. -func Convert_v1beta1_AzureManagedClusterStatus_To_v1alpha3_AzureManagedClusterStatus(in *v1beta1.AzureManagedClusterStatus, out *AzureManagedClusterStatus, s conversion.Scope) error { - return autoConvert_v1beta1_AzureManagedClusterStatus_To_v1alpha3_AzureManagedClusterStatus(in, out, s) -} - -func autoConvert_v1alpha3_AzureManagedControlPlane_To_v1beta1_AzureManagedControlPlane(in *AzureManagedControlPlane, out *v1beta1.AzureManagedControlPlane, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha3_AzureManagedControlPlaneSpec_To_v1beta1_AzureManagedControlPlaneSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1alpha3_AzureManagedControlPlaneStatus_To_v1beta1_AzureManagedControlPlaneStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha3_AzureManagedControlPlane_To_v1beta1_AzureManagedControlPlane is an autogenerated conversion function. -func Convert_v1alpha3_AzureManagedControlPlane_To_v1beta1_AzureManagedControlPlane(in *AzureManagedControlPlane, out *v1beta1.AzureManagedControlPlane, s conversion.Scope) error { - return autoConvert_v1alpha3_AzureManagedControlPlane_To_v1beta1_AzureManagedControlPlane(in, out, s) -} - -func autoConvert_v1beta1_AzureManagedControlPlane_To_v1alpha3_AzureManagedControlPlane(in *v1beta1.AzureManagedControlPlane, out *AzureManagedControlPlane, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1beta1_AzureManagedControlPlaneSpec_To_v1alpha3_AzureManagedControlPlaneSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1beta1_AzureManagedControlPlaneStatus_To_v1alpha3_AzureManagedControlPlaneStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta1_AzureManagedControlPlane_To_v1alpha3_AzureManagedControlPlane is an autogenerated conversion function. -func Convert_v1beta1_AzureManagedControlPlane_To_v1alpha3_AzureManagedControlPlane(in *v1beta1.AzureManagedControlPlane, out *AzureManagedControlPlane, s conversion.Scope) error { - return autoConvert_v1beta1_AzureManagedControlPlane_To_v1alpha3_AzureManagedControlPlane(in, out, s) -} - -func autoConvert_v1alpha3_AzureManagedControlPlaneList_To_v1beta1_AzureManagedControlPlaneList(in *AzureManagedControlPlaneList, out *v1beta1.AzureManagedControlPlaneList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]v1beta1.AzureManagedControlPlane, len(*in)) - for i := range *in { - if err := Convert_v1alpha3_AzureManagedControlPlane_To_v1beta1_AzureManagedControlPlane(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1alpha3_AzureManagedControlPlaneList_To_v1beta1_AzureManagedControlPlaneList is an autogenerated conversion function. -func Convert_v1alpha3_AzureManagedControlPlaneList_To_v1beta1_AzureManagedControlPlaneList(in *AzureManagedControlPlaneList, out *v1beta1.AzureManagedControlPlaneList, s conversion.Scope) error { - return autoConvert_v1alpha3_AzureManagedControlPlaneList_To_v1beta1_AzureManagedControlPlaneList(in, out, s) -} - -func autoConvert_v1beta1_AzureManagedControlPlaneList_To_v1alpha3_AzureManagedControlPlaneList(in *v1beta1.AzureManagedControlPlaneList, out *AzureManagedControlPlaneList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]AzureManagedControlPlane, len(*in)) - for i := range *in { - if err := Convert_v1beta1_AzureManagedControlPlane_To_v1alpha3_AzureManagedControlPlane(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1beta1_AzureManagedControlPlaneList_To_v1alpha3_AzureManagedControlPlaneList is an autogenerated conversion function. -func Convert_v1beta1_AzureManagedControlPlaneList_To_v1alpha3_AzureManagedControlPlaneList(in *v1beta1.AzureManagedControlPlaneList, out *AzureManagedControlPlaneList, s conversion.Scope) error { - return autoConvert_v1beta1_AzureManagedControlPlaneList_To_v1alpha3_AzureManagedControlPlaneList(in, out, s) -} - -func autoConvert_v1alpha3_AzureManagedControlPlaneSpec_To_v1beta1_AzureManagedControlPlaneSpec(in *AzureManagedControlPlaneSpec, out *v1beta1.AzureManagedControlPlaneSpec, s conversion.Scope) error { - out.Version = in.Version - out.ResourceGroupName = in.ResourceGroupName - out.NodeResourceGroupName = in.NodeResourceGroupName - if err := Convert_v1alpha3_ManagedControlPlaneVirtualNetwork_To_v1beta1_ManagedControlPlaneVirtualNetwork(&in.VirtualNetwork, &out.VirtualNetwork, s); err != nil { - return err - } - out.SubscriptionID = in.SubscriptionID - out.Location = in.Location - if err := apiv1alpha3.Convert_v1alpha3_APIEndpoint_To_v1beta1_APIEndpoint(&in.ControlPlaneEndpoint, &out.ControlPlaneEndpoint, s); err != nil { - return err - } - out.AdditionalTags = *(*v1beta1.Tags)(unsafe.Pointer(&in.AdditionalTags)) - out.NetworkPlugin = (*string)(unsafe.Pointer(in.NetworkPlugin)) - out.NetworkPolicy = (*string)(unsafe.Pointer(in.NetworkPolicy)) - out.SSHPublicKey = in.SSHPublicKey - out.DNSServiceIP = (*string)(unsafe.Pointer(in.DNSServiceIP)) - out.LoadBalancerSKU = (*string)(unsafe.Pointer(in.LoadBalancerSKU)) - out.AADProfile = (*v1beta1.AADProfile)(unsafe.Pointer(in.AADProfile)) - return nil -} - -// Convert_v1alpha3_AzureManagedControlPlaneSpec_To_v1beta1_AzureManagedControlPlaneSpec is an autogenerated conversion function. -func Convert_v1alpha3_AzureManagedControlPlaneSpec_To_v1beta1_AzureManagedControlPlaneSpec(in *AzureManagedControlPlaneSpec, out *v1beta1.AzureManagedControlPlaneSpec, s conversion.Scope) error { - return autoConvert_v1alpha3_AzureManagedControlPlaneSpec_To_v1beta1_AzureManagedControlPlaneSpec(in, out, s) -} - -func autoConvert_v1beta1_AzureManagedControlPlaneSpec_To_v1alpha3_AzureManagedControlPlaneSpec(in *v1beta1.AzureManagedControlPlaneSpec, out *AzureManagedControlPlaneSpec, s conversion.Scope) error { - out.Version = in.Version - out.ResourceGroupName = in.ResourceGroupName - out.NodeResourceGroupName = in.NodeResourceGroupName - if err := Convert_v1beta1_ManagedControlPlaneVirtualNetwork_To_v1alpha3_ManagedControlPlaneVirtualNetwork(&in.VirtualNetwork, &out.VirtualNetwork, s); err != nil { - return err - } - out.SubscriptionID = in.SubscriptionID - out.Location = in.Location - if err := apiv1alpha3.Convert_v1beta1_APIEndpoint_To_v1alpha3_APIEndpoint(&in.ControlPlaneEndpoint, &out.ControlPlaneEndpoint, s); err != nil { - return err - } - out.AdditionalTags = *(*Tags)(unsafe.Pointer(&in.AdditionalTags)) - out.NetworkPlugin = (*string)(unsafe.Pointer(in.NetworkPlugin)) - out.NetworkPolicy = (*string)(unsafe.Pointer(in.NetworkPolicy)) - // WARNING: in.OutboundType requires manual conversion: does not exist in peer-type - out.SSHPublicKey = in.SSHPublicKey - out.DNSServiceIP = (*string)(unsafe.Pointer(in.DNSServiceIP)) - out.LoadBalancerSKU = (*string)(unsafe.Pointer(in.LoadBalancerSKU)) - // WARNING: in.IdentityRef requires manual conversion: does not exist in peer-type - out.AADProfile = (*AADProfile)(unsafe.Pointer(in.AADProfile)) - // WARNING: in.AddonProfiles requires manual conversion: does not exist in peer-type - // WARNING: in.SKU requires manual conversion: does not exist in peer-type - // WARNING: in.LoadBalancerProfile requires manual conversion: does not exist in peer-type - // WARNING: in.APIServerAccessProfile requires manual conversion: does not exist in peer-type - // WARNING: in.AutoScalerProfile requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha3_AzureManagedControlPlaneStatus_To_v1beta1_AzureManagedControlPlaneStatus(in *AzureManagedControlPlaneStatus, out *v1beta1.AzureManagedControlPlaneStatus, s conversion.Scope) error { - out.Ready = in.Ready - out.Initialized = in.Initialized - return nil -} - -// Convert_v1alpha3_AzureManagedControlPlaneStatus_To_v1beta1_AzureManagedControlPlaneStatus is an autogenerated conversion function. -func Convert_v1alpha3_AzureManagedControlPlaneStatus_To_v1beta1_AzureManagedControlPlaneStatus(in *AzureManagedControlPlaneStatus, out *v1beta1.AzureManagedControlPlaneStatus, s conversion.Scope) error { - return autoConvert_v1alpha3_AzureManagedControlPlaneStatus_To_v1beta1_AzureManagedControlPlaneStatus(in, out, s) -} - -func autoConvert_v1beta1_AzureManagedControlPlaneStatus_To_v1alpha3_AzureManagedControlPlaneStatus(in *v1beta1.AzureManagedControlPlaneStatus, out *AzureManagedControlPlaneStatus, s conversion.Scope) error { - out.Ready = in.Ready - out.Initialized = in.Initialized - // WARNING: in.Conditions requires manual conversion: does not exist in peer-type - // WARNING: in.LongRunningOperationStates requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha3_AzureManagedMachinePool_To_v1beta1_AzureManagedMachinePool(in *AzureManagedMachinePool, out *v1beta1.AzureManagedMachinePool, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha3_AzureManagedMachinePoolSpec_To_v1beta1_AzureManagedMachinePoolSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1alpha3_AzureManagedMachinePoolStatus_To_v1beta1_AzureManagedMachinePoolStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha3_AzureManagedMachinePool_To_v1beta1_AzureManagedMachinePool is an autogenerated conversion function. -func Convert_v1alpha3_AzureManagedMachinePool_To_v1beta1_AzureManagedMachinePool(in *AzureManagedMachinePool, out *v1beta1.AzureManagedMachinePool, s conversion.Scope) error { - return autoConvert_v1alpha3_AzureManagedMachinePool_To_v1beta1_AzureManagedMachinePool(in, out, s) -} - -func autoConvert_v1beta1_AzureManagedMachinePool_To_v1alpha3_AzureManagedMachinePool(in *v1beta1.AzureManagedMachinePool, out *AzureManagedMachinePool, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1beta1_AzureManagedMachinePoolSpec_To_v1alpha3_AzureManagedMachinePoolSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1beta1_AzureManagedMachinePoolStatus_To_v1alpha3_AzureManagedMachinePoolStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta1_AzureManagedMachinePool_To_v1alpha3_AzureManagedMachinePool is an autogenerated conversion function. -func Convert_v1beta1_AzureManagedMachinePool_To_v1alpha3_AzureManagedMachinePool(in *v1beta1.AzureManagedMachinePool, out *AzureManagedMachinePool, s conversion.Scope) error { - return autoConvert_v1beta1_AzureManagedMachinePool_To_v1alpha3_AzureManagedMachinePool(in, out, s) -} - -func autoConvert_v1alpha3_AzureManagedMachinePoolList_To_v1beta1_AzureManagedMachinePoolList(in *AzureManagedMachinePoolList, out *v1beta1.AzureManagedMachinePoolList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]v1beta1.AzureManagedMachinePool, len(*in)) - for i := range *in { - if err := Convert_v1alpha3_AzureManagedMachinePool_To_v1beta1_AzureManagedMachinePool(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1alpha3_AzureManagedMachinePoolList_To_v1beta1_AzureManagedMachinePoolList is an autogenerated conversion function. -func Convert_v1alpha3_AzureManagedMachinePoolList_To_v1beta1_AzureManagedMachinePoolList(in *AzureManagedMachinePoolList, out *v1beta1.AzureManagedMachinePoolList, s conversion.Scope) error { - return autoConvert_v1alpha3_AzureManagedMachinePoolList_To_v1beta1_AzureManagedMachinePoolList(in, out, s) -} - -func autoConvert_v1beta1_AzureManagedMachinePoolList_To_v1alpha3_AzureManagedMachinePoolList(in *v1beta1.AzureManagedMachinePoolList, out *AzureManagedMachinePoolList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]AzureManagedMachinePool, len(*in)) - for i := range *in { - if err := Convert_v1beta1_AzureManagedMachinePool_To_v1alpha3_AzureManagedMachinePool(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1beta1_AzureManagedMachinePoolList_To_v1alpha3_AzureManagedMachinePoolList is an autogenerated conversion function. -func Convert_v1beta1_AzureManagedMachinePoolList_To_v1alpha3_AzureManagedMachinePoolList(in *v1beta1.AzureManagedMachinePoolList, out *AzureManagedMachinePoolList, s conversion.Scope) error { - return autoConvert_v1beta1_AzureManagedMachinePoolList_To_v1alpha3_AzureManagedMachinePoolList(in, out, s) -} - -func autoConvert_v1alpha3_AzureManagedMachinePoolSpec_To_v1beta1_AzureManagedMachinePoolSpec(in *AzureManagedMachinePoolSpec, out *v1beta1.AzureManagedMachinePoolSpec, s conversion.Scope) error { - out.Mode = in.Mode - out.SKU = in.SKU - out.OSDiskSizeGB = (*int32)(unsafe.Pointer(in.OSDiskSizeGB)) - out.ProviderIDList = *(*[]string)(unsafe.Pointer(&in.ProviderIDList)) - return nil -} - -// Convert_v1alpha3_AzureManagedMachinePoolSpec_To_v1beta1_AzureManagedMachinePoolSpec is an autogenerated conversion function. -func Convert_v1alpha3_AzureManagedMachinePoolSpec_To_v1beta1_AzureManagedMachinePoolSpec(in *AzureManagedMachinePoolSpec, out *v1beta1.AzureManagedMachinePoolSpec, s conversion.Scope) error { - return autoConvert_v1alpha3_AzureManagedMachinePoolSpec_To_v1beta1_AzureManagedMachinePoolSpec(in, out, s) -} - -func autoConvert_v1beta1_AzureManagedMachinePoolSpec_To_v1alpha3_AzureManagedMachinePoolSpec(in *v1beta1.AzureManagedMachinePoolSpec, out *AzureManagedMachinePoolSpec, s conversion.Scope) error { - // WARNING: in.AdditionalTags requires manual conversion: does not exist in peer-type - // WARNING: in.Name requires manual conversion: does not exist in peer-type - out.Mode = in.Mode - out.SKU = in.SKU - out.OSDiskSizeGB = (*int32)(unsafe.Pointer(in.OSDiskSizeGB)) - // WARNING: in.AvailabilityZones requires manual conversion: does not exist in peer-type - // WARNING: in.NodeLabels requires manual conversion: does not exist in peer-type - // WARNING: in.Taints requires manual conversion: does not exist in peer-type - out.ProviderIDList = *(*[]string)(unsafe.Pointer(&in.ProviderIDList)) - // WARNING: in.Scaling requires manual conversion: does not exist in peer-type - // WARNING: in.MaxPods requires manual conversion: does not exist in peer-type - // WARNING: in.OsDiskType requires manual conversion: does not exist in peer-type - // WARNING: in.EnableUltraSSD requires manual conversion: does not exist in peer-type - // WARNING: in.OSType requires manual conversion: does not exist in peer-type - // WARNING: in.EnableNodePublicIP requires manual conversion: does not exist in peer-type - // WARNING: in.NodePublicIPPrefixID requires manual conversion: does not exist in peer-type - // WARNING: in.ScaleSetPriority requires manual conversion: does not exist in peer-type - // WARNING: in.KubeletConfig requires manual conversion: does not exist in peer-type - // WARNING: in.KubeletDiskType requires manual conversion: does not exist in peer-type - // WARNING: in.LinuxOSConfig requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha3_AzureManagedMachinePoolStatus_To_v1beta1_AzureManagedMachinePoolStatus(in *AzureManagedMachinePoolStatus, out *v1beta1.AzureManagedMachinePoolStatus, s conversion.Scope) error { - out.Ready = in.Ready - out.Replicas = in.Replicas - out.ErrorReason = (*errors.MachineStatusError)(unsafe.Pointer(in.ErrorReason)) - out.ErrorMessage = (*string)(unsafe.Pointer(in.ErrorMessage)) - return nil -} - -// Convert_v1alpha3_AzureManagedMachinePoolStatus_To_v1beta1_AzureManagedMachinePoolStatus is an autogenerated conversion function. -func Convert_v1alpha3_AzureManagedMachinePoolStatus_To_v1beta1_AzureManagedMachinePoolStatus(in *AzureManagedMachinePoolStatus, out *v1beta1.AzureManagedMachinePoolStatus, s conversion.Scope) error { - return autoConvert_v1alpha3_AzureManagedMachinePoolStatus_To_v1beta1_AzureManagedMachinePoolStatus(in, out, s) -} - -func autoConvert_v1beta1_AzureManagedMachinePoolStatus_To_v1alpha3_AzureManagedMachinePoolStatus(in *v1beta1.AzureManagedMachinePoolStatus, out *AzureManagedMachinePoolStatus, s conversion.Scope) error { - out.Ready = in.Ready - out.Replicas = in.Replicas - out.ErrorReason = (*errors.MachineStatusError)(unsafe.Pointer(in.ErrorReason)) - out.ErrorMessage = (*string)(unsafe.Pointer(in.ErrorMessage)) - // WARNING: in.Conditions requires manual conversion: does not exist in peer-type - // WARNING: in.LongRunningOperationStates requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha3_AzureMarketplaceImage_To_v1beta1_AzureMarketplaceImage(in *AzureMarketplaceImage, out *v1beta1.AzureMarketplaceImage, s conversion.Scope) error { - // WARNING: in.Publisher requires manual conversion: does not exist in peer-type - // WARNING: in.Offer requires manual conversion: does not exist in peer-type - // WARNING: in.SKU requires manual conversion: does not exist in peer-type - out.Version = in.Version - out.ThirdPartyImage = in.ThirdPartyImage - return nil -} - -func autoConvert_v1beta1_AzureMarketplaceImage_To_v1alpha3_AzureMarketplaceImage(in *v1beta1.AzureMarketplaceImage, out *AzureMarketplaceImage, s conversion.Scope) error { - // WARNING: in.ImagePlan requires manual conversion: does not exist in peer-type - out.Version = in.Version - out.ThirdPartyImage = in.ThirdPartyImage - return nil -} - -func autoConvert_v1alpha3_AzureSharedGalleryImage_To_v1beta1_AzureSharedGalleryImage(in *AzureSharedGalleryImage, out *v1beta1.AzureSharedGalleryImage, s conversion.Scope) error { - out.SubscriptionID = in.SubscriptionID - out.ResourceGroup = in.ResourceGroup - out.Gallery = in.Gallery - out.Name = in.Name - out.Version = in.Version - return nil -} - -// Convert_v1alpha3_AzureSharedGalleryImage_To_v1beta1_AzureSharedGalleryImage is an autogenerated conversion function. -func Convert_v1alpha3_AzureSharedGalleryImage_To_v1beta1_AzureSharedGalleryImage(in *AzureSharedGalleryImage, out *v1beta1.AzureSharedGalleryImage, s conversion.Scope) error { - return autoConvert_v1alpha3_AzureSharedGalleryImage_To_v1beta1_AzureSharedGalleryImage(in, out, s) -} - -func autoConvert_v1beta1_AzureSharedGalleryImage_To_v1alpha3_AzureSharedGalleryImage(in *v1beta1.AzureSharedGalleryImage, out *AzureSharedGalleryImage, s conversion.Scope) error { - out.SubscriptionID = in.SubscriptionID - out.ResourceGroup = in.ResourceGroup - out.Gallery = in.Gallery - out.Name = in.Name - out.Version = in.Version - // WARNING: in.Publisher requires manual conversion: does not exist in peer-type - // WARNING: in.Offer requires manual conversion: does not exist in peer-type - // WARNING: in.SKU requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha3_BuildParams_To_v1beta1_BuildParams(in *BuildParams, out *v1beta1.BuildParams, s conversion.Scope) error { - out.Lifecycle = v1beta1.ResourceLifecycle(in.Lifecycle) - out.ClusterName = in.ClusterName - out.ResourceID = in.ResourceID - out.Name = (*string)(unsafe.Pointer(in.Name)) - out.Role = (*string)(unsafe.Pointer(in.Role)) - out.Additional = *(*v1beta1.Tags)(unsafe.Pointer(&in.Additional)) - return nil -} - -// Convert_v1alpha3_BuildParams_To_v1beta1_BuildParams is an autogenerated conversion function. -func Convert_v1alpha3_BuildParams_To_v1beta1_BuildParams(in *BuildParams, out *v1beta1.BuildParams, s conversion.Scope) error { - return autoConvert_v1alpha3_BuildParams_To_v1beta1_BuildParams(in, out, s) -} - -func autoConvert_v1beta1_BuildParams_To_v1alpha3_BuildParams(in *v1beta1.BuildParams, out *BuildParams, s conversion.Scope) error { - out.Lifecycle = ResourceLifecycle(in.Lifecycle) - out.ClusterName = in.ClusterName - out.ResourceID = in.ResourceID - out.Name = (*string)(unsafe.Pointer(in.Name)) - out.Role = (*string)(unsafe.Pointer(in.Role)) - out.Additional = *(*Tags)(unsafe.Pointer(&in.Additional)) - return nil -} - -// Convert_v1beta1_BuildParams_To_v1alpha3_BuildParams is an autogenerated conversion function. -func Convert_v1beta1_BuildParams_To_v1alpha3_BuildParams(in *v1beta1.BuildParams, out *BuildParams, s conversion.Scope) error { - return autoConvert_v1beta1_BuildParams_To_v1alpha3_BuildParams(in, out, s) -} - -func autoConvert_v1alpha3_DataDisk_To_v1beta1_DataDisk(in *DataDisk, out *v1beta1.DataDisk, s conversion.Scope) error { - out.NameSuffix = in.NameSuffix - out.DiskSizeGB = in.DiskSizeGB - if in.ManagedDisk != nil { - in, out := &in.ManagedDisk, &out.ManagedDisk - *out = new(v1beta1.ManagedDiskParameters) - if err := Convert_v1alpha3_ManagedDisk_To_v1beta1_ManagedDiskParameters(*in, *out, s); err != nil { - return err - } - } else { - out.ManagedDisk = nil - } - out.Lun = (*int32)(unsafe.Pointer(in.Lun)) - out.CachingType = in.CachingType - return nil -} - -// Convert_v1alpha3_DataDisk_To_v1beta1_DataDisk is an autogenerated conversion function. -func Convert_v1alpha3_DataDisk_To_v1beta1_DataDisk(in *DataDisk, out *v1beta1.DataDisk, s conversion.Scope) error { - return autoConvert_v1alpha3_DataDisk_To_v1beta1_DataDisk(in, out, s) -} - -func autoConvert_v1beta1_DataDisk_To_v1alpha3_DataDisk(in *v1beta1.DataDisk, out *DataDisk, s conversion.Scope) error { - out.NameSuffix = in.NameSuffix - out.DiskSizeGB = in.DiskSizeGB - if in.ManagedDisk != nil { - in, out := &in.ManagedDisk, &out.ManagedDisk - *out = new(ManagedDisk) - if err := Convert_v1beta1_ManagedDiskParameters_To_v1alpha3_ManagedDisk(*in, *out, s); err != nil { - return err - } - } else { - out.ManagedDisk = nil - } - out.Lun = (*int32)(unsafe.Pointer(in.Lun)) - out.CachingType = in.CachingType - return nil -} - -// Convert_v1beta1_DataDisk_To_v1alpha3_DataDisk is an autogenerated conversion function. -func Convert_v1beta1_DataDisk_To_v1alpha3_DataDisk(in *v1beta1.DataDisk, out *DataDisk, s conversion.Scope) error { - return autoConvert_v1beta1_DataDisk_To_v1alpha3_DataDisk(in, out, s) -} - -func autoConvert_v1alpha3_DiffDiskSettings_To_v1beta1_DiffDiskSettings(in *DiffDiskSettings, out *v1beta1.DiffDiskSettings, s conversion.Scope) error { - out.Option = in.Option - return nil -} - -// Convert_v1alpha3_DiffDiskSettings_To_v1beta1_DiffDiskSettings is an autogenerated conversion function. -func Convert_v1alpha3_DiffDiskSettings_To_v1beta1_DiffDiskSettings(in *DiffDiskSettings, out *v1beta1.DiffDiskSettings, s conversion.Scope) error { - return autoConvert_v1alpha3_DiffDiskSettings_To_v1beta1_DiffDiskSettings(in, out, s) -} - -func autoConvert_v1beta1_DiffDiskSettings_To_v1alpha3_DiffDiskSettings(in *v1beta1.DiffDiskSettings, out *DiffDiskSettings, s conversion.Scope) error { - out.Option = in.Option - return nil -} - -// Convert_v1beta1_DiffDiskSettings_To_v1alpha3_DiffDiskSettings is an autogenerated conversion function. -func Convert_v1beta1_DiffDiskSettings_To_v1alpha3_DiffDiskSettings(in *v1beta1.DiffDiskSettings, out *DiffDiskSettings, s conversion.Scope) error { - return autoConvert_v1beta1_DiffDiskSettings_To_v1alpha3_DiffDiskSettings(in, out, s) -} - -func autoConvert_v1alpha3_DiskEncryptionSetParameters_To_v1beta1_DiskEncryptionSetParameters(in *DiskEncryptionSetParameters, out *v1beta1.DiskEncryptionSetParameters, s conversion.Scope) error { - out.ID = in.ID - return nil -} - -// Convert_v1alpha3_DiskEncryptionSetParameters_To_v1beta1_DiskEncryptionSetParameters is an autogenerated conversion function. -func Convert_v1alpha3_DiskEncryptionSetParameters_To_v1beta1_DiskEncryptionSetParameters(in *DiskEncryptionSetParameters, out *v1beta1.DiskEncryptionSetParameters, s conversion.Scope) error { - return autoConvert_v1alpha3_DiskEncryptionSetParameters_To_v1beta1_DiskEncryptionSetParameters(in, out, s) -} - -func autoConvert_v1beta1_DiskEncryptionSetParameters_To_v1alpha3_DiskEncryptionSetParameters(in *v1beta1.DiskEncryptionSetParameters, out *DiskEncryptionSetParameters, s conversion.Scope) error { - out.ID = in.ID - return nil -} - -// Convert_v1beta1_DiskEncryptionSetParameters_To_v1alpha3_DiskEncryptionSetParameters is an autogenerated conversion function. -func Convert_v1beta1_DiskEncryptionSetParameters_To_v1alpha3_DiskEncryptionSetParameters(in *v1beta1.DiskEncryptionSetParameters, out *DiskEncryptionSetParameters, s conversion.Scope) error { - return autoConvert_v1beta1_DiskEncryptionSetParameters_To_v1alpha3_DiskEncryptionSetParameters(in, out, s) -} - -func autoConvert_v1alpha3_FrontendIP_To_v1beta1_FrontendIP(in *FrontendIP, out *v1beta1.FrontendIP, s conversion.Scope) error { - out.Name = in.Name - // WARNING: in.PrivateIPAddress requires manual conversion: does not exist in peer-type - if in.PublicIP != nil { - in, out := &in.PublicIP, &out.PublicIP - *out = new(v1beta1.PublicIPSpec) - if err := Convert_v1alpha3_PublicIPSpec_To_v1beta1_PublicIPSpec(*in, *out, s); err != nil { - return err - } - } else { - out.PublicIP = nil - } - return nil -} - -func autoConvert_v1beta1_FrontendIP_To_v1alpha3_FrontendIP(in *v1beta1.FrontendIP, out *FrontendIP, s conversion.Scope) error { - out.Name = in.Name - if in.PublicIP != nil { - in, out := &in.PublicIP, &out.PublicIP - *out = new(PublicIPSpec) - if err := Convert_v1beta1_PublicIPSpec_To_v1alpha3_PublicIPSpec(*in, *out, s); err != nil { - return err - } - } else { - out.PublicIP = nil - } - // WARNING: in.FrontendIPClass requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha3_Future_To_v1beta1_Future(in *Future, out *v1beta1.Future, s conversion.Scope) error { - out.Type = in.Type - out.ResourceGroup = in.ResourceGroup - out.Name = in.Name - // WARNING: in.FutureData requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1beta1_Future_To_v1alpha3_Future(in *v1beta1.Future, out *Future, s conversion.Scope) error { - out.Type = in.Type - out.ResourceGroup = in.ResourceGroup - // WARNING: in.ServiceName requires manual conversion: does not exist in peer-type - out.Name = in.Name - // WARNING: in.Data requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha3_Image_To_v1beta1_Image(in *Image, out *v1beta1.Image, s conversion.Scope) error { - out.ID = (*string)(unsafe.Pointer(in.ID)) - if in.SharedGallery != nil { - in, out := &in.SharedGallery, &out.SharedGallery - *out = new(v1beta1.AzureSharedGalleryImage) - if err := Convert_v1alpha3_AzureSharedGalleryImage_To_v1beta1_AzureSharedGalleryImage(*in, *out, s); err != nil { - return err - } - } else { - out.SharedGallery = nil - } - if in.Marketplace != nil { - in, out := &in.Marketplace, &out.Marketplace - *out = new(v1beta1.AzureMarketplaceImage) - if err := Convert_v1alpha3_AzureMarketplaceImage_To_v1beta1_AzureMarketplaceImage(*in, *out, s); err != nil { - return err - } - } else { - out.Marketplace = nil - } - return nil -} - -// Convert_v1alpha3_Image_To_v1beta1_Image is an autogenerated conversion function. -func Convert_v1alpha3_Image_To_v1beta1_Image(in *Image, out *v1beta1.Image, s conversion.Scope) error { - return autoConvert_v1alpha3_Image_To_v1beta1_Image(in, out, s) -} - -func autoConvert_v1beta1_Image_To_v1alpha3_Image(in *v1beta1.Image, out *Image, s conversion.Scope) error { - out.ID = (*string)(unsafe.Pointer(in.ID)) - if in.SharedGallery != nil { - in, out := &in.SharedGallery, &out.SharedGallery - *out = new(AzureSharedGalleryImage) - if err := Convert_v1beta1_AzureSharedGalleryImage_To_v1alpha3_AzureSharedGalleryImage(*in, *out, s); err != nil { - return err - } - } else { - out.SharedGallery = nil - } - if in.Marketplace != nil { - in, out := &in.Marketplace, &out.Marketplace - *out = new(AzureMarketplaceImage) - if err := Convert_v1beta1_AzureMarketplaceImage_To_v1alpha3_AzureMarketplaceImage(*in, *out, s); err != nil { - return err - } - } else { - out.Marketplace = nil - } - // WARNING: in.ComputeGallery requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha3_LoadBalancerSpec_To_v1beta1_LoadBalancerSpec(in *LoadBalancerSpec, out *v1beta1.LoadBalancerSpec, s conversion.Scope) error { - out.ID = in.ID - out.Name = in.Name - // WARNING: in.SKU requires manual conversion: does not exist in peer-type - if in.FrontendIPs != nil { - in, out := &in.FrontendIPs, &out.FrontendIPs - *out = make([]v1beta1.FrontendIP, len(*in)) - for i := range *in { - if err := Convert_v1alpha3_FrontendIP_To_v1beta1_FrontendIP(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.FrontendIPs = nil - } - // WARNING: in.Type requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1beta1_LoadBalancerSpec_To_v1alpha3_LoadBalancerSpec(in *v1beta1.LoadBalancerSpec, out *LoadBalancerSpec, s conversion.Scope) error { - out.ID = in.ID - out.Name = in.Name - if in.FrontendIPs != nil { - in, out := &in.FrontendIPs, &out.FrontendIPs - *out = make([]FrontendIP, len(*in)) - for i := range *in { - if err := Convert_v1beta1_FrontendIP_To_v1alpha3_FrontendIP(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.FrontendIPs = nil - } - // WARNING: in.FrontendIPsCount requires manual conversion: does not exist in peer-type - // WARNING: in.BackendPool requires manual conversion: does not exist in peer-type - // WARNING: in.LoadBalancerClassSpec requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha3_ManagedControlPlaneSubnet_To_v1beta1_ManagedControlPlaneSubnet(in *ManagedControlPlaneSubnet, out *v1beta1.ManagedControlPlaneSubnet, s conversion.Scope) error { - out.Name = in.Name - out.CIDRBlock = in.CIDRBlock - return nil -} - -// Convert_v1alpha3_ManagedControlPlaneSubnet_To_v1beta1_ManagedControlPlaneSubnet is an autogenerated conversion function. -func Convert_v1alpha3_ManagedControlPlaneSubnet_To_v1beta1_ManagedControlPlaneSubnet(in *ManagedControlPlaneSubnet, out *v1beta1.ManagedControlPlaneSubnet, s conversion.Scope) error { - return autoConvert_v1alpha3_ManagedControlPlaneSubnet_To_v1beta1_ManagedControlPlaneSubnet(in, out, s) -} - -func autoConvert_v1beta1_ManagedControlPlaneSubnet_To_v1alpha3_ManagedControlPlaneSubnet(in *v1beta1.ManagedControlPlaneSubnet, out *ManagedControlPlaneSubnet, s conversion.Scope) error { - out.Name = in.Name - out.CIDRBlock = in.CIDRBlock - // WARNING: in.ServiceEndpoints requires manual conversion: does not exist in peer-type - // WARNING: in.PrivateEndpoints requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha3_ManagedControlPlaneVirtualNetwork_To_v1beta1_ManagedControlPlaneVirtualNetwork(in *ManagedControlPlaneVirtualNetwork, out *v1beta1.ManagedControlPlaneVirtualNetwork, s conversion.Scope) error { - out.Name = in.Name - out.CIDRBlock = in.CIDRBlock - if err := Convert_v1alpha3_ManagedControlPlaneSubnet_To_v1beta1_ManagedControlPlaneSubnet(&in.Subnet, &out.Subnet, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha3_ManagedControlPlaneVirtualNetwork_To_v1beta1_ManagedControlPlaneVirtualNetwork is an autogenerated conversion function. -func Convert_v1alpha3_ManagedControlPlaneVirtualNetwork_To_v1beta1_ManagedControlPlaneVirtualNetwork(in *ManagedControlPlaneVirtualNetwork, out *v1beta1.ManagedControlPlaneVirtualNetwork, s conversion.Scope) error { - return autoConvert_v1alpha3_ManagedControlPlaneVirtualNetwork_To_v1beta1_ManagedControlPlaneVirtualNetwork(in, out, s) -} - -func autoConvert_v1beta1_ManagedControlPlaneVirtualNetwork_To_v1alpha3_ManagedControlPlaneVirtualNetwork(in *v1beta1.ManagedControlPlaneVirtualNetwork, out *ManagedControlPlaneVirtualNetwork, s conversion.Scope) error { - out.Name = in.Name - out.CIDRBlock = in.CIDRBlock - if err := Convert_v1beta1_ManagedControlPlaneSubnet_To_v1alpha3_ManagedControlPlaneSubnet(&in.Subnet, &out.Subnet, s); err != nil { - return err - } - // WARNING: in.ResourceGroup requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha3_NetworkSpec_To_v1beta1_NetworkSpec(in *NetworkSpec, out *v1beta1.NetworkSpec, s conversion.Scope) error { - if err := Convert_v1alpha3_VnetSpec_To_v1beta1_VnetSpec(&in.Vnet, &out.Vnet, s); err != nil { - return err - } - if in.Subnets != nil { - in, out := &in.Subnets, &out.Subnets - *out = make(v1beta1.Subnets, len(*in)) - for i := range *in { - if err := Convert_v1alpha3_SubnetSpec_To_v1beta1_SubnetSpec(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Subnets = nil - } - if err := Convert_v1alpha3_LoadBalancerSpec_To_v1beta1_LoadBalancerSpec(&in.APIServerLB, &out.APIServerLB, s); err != nil { - return err - } - return nil -} - -func autoConvert_v1beta1_NetworkSpec_To_v1alpha3_NetworkSpec(in *v1beta1.NetworkSpec, out *NetworkSpec, s conversion.Scope) error { - if err := Convert_v1beta1_VnetSpec_To_v1alpha3_VnetSpec(&in.Vnet, &out.Vnet, s); err != nil { - return err - } - if in.Subnets != nil { - in, out := &in.Subnets, &out.Subnets - *out = make(Subnets, len(*in)) - for i := range *in { - if err := Convert_v1beta1_SubnetSpec_To_v1alpha3_SubnetSpec(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Subnets = nil - } - if err := Convert_v1beta1_LoadBalancerSpec_To_v1alpha3_LoadBalancerSpec(&in.APIServerLB, &out.APIServerLB, s); err != nil { - return err - } - // WARNING: in.NodeOutboundLB requires manual conversion: does not exist in peer-type - // WARNING: in.ControlPlaneOutboundLB requires manual conversion: does not exist in peer-type - // WARNING: in.NetworkClassSpec requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha3_PublicIPSpec_To_v1beta1_PublicIPSpec(in *PublicIPSpec, out *v1beta1.PublicIPSpec, s conversion.Scope) error { - out.Name = in.Name - out.DNSName = in.DNSName - return nil -} - -// Convert_v1alpha3_PublicIPSpec_To_v1beta1_PublicIPSpec is an autogenerated conversion function. -func Convert_v1alpha3_PublicIPSpec_To_v1beta1_PublicIPSpec(in *PublicIPSpec, out *v1beta1.PublicIPSpec, s conversion.Scope) error { - return autoConvert_v1alpha3_PublicIPSpec_To_v1beta1_PublicIPSpec(in, out, s) -} - -func autoConvert_v1beta1_PublicIPSpec_To_v1alpha3_PublicIPSpec(in *v1beta1.PublicIPSpec, out *PublicIPSpec, s conversion.Scope) error { - out.Name = in.Name - out.DNSName = in.DNSName - // WARNING: in.IPTags requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha3_RouteTable_To_v1beta1_RouteTable(in *RouteTable, out *v1beta1.RouteTable, s conversion.Scope) error { - out.ID = in.ID - out.Name = in.Name - return nil -} - -// Convert_v1alpha3_RouteTable_To_v1beta1_RouteTable is an autogenerated conversion function. -func Convert_v1alpha3_RouteTable_To_v1beta1_RouteTable(in *RouteTable, out *v1beta1.RouteTable, s conversion.Scope) error { - return autoConvert_v1alpha3_RouteTable_To_v1beta1_RouteTable(in, out, s) -} - -func autoConvert_v1beta1_RouteTable_To_v1alpha3_RouteTable(in *v1beta1.RouteTable, out *RouteTable, s conversion.Scope) error { - out.ID = in.ID - out.Name = in.Name - return nil -} - -// Convert_v1beta1_RouteTable_To_v1alpha3_RouteTable is an autogenerated conversion function. -func Convert_v1beta1_RouteTable_To_v1alpha3_RouteTable(in *v1beta1.RouteTable, out *RouteTable, s conversion.Scope) error { - return autoConvert_v1beta1_RouteTable_To_v1alpha3_RouteTable(in, out, s) -} - -func autoConvert_v1alpha3_SecurityGroup_To_v1beta1_SecurityGroup(in *SecurityGroup, out *v1beta1.SecurityGroup, s conversion.Scope) error { - out.ID = in.ID - out.Name = in.Name - // WARNING: in.IngressRules requires manual conversion: does not exist in peer-type - // WARNING: in.Tags requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1beta1_SecurityGroup_To_v1alpha3_SecurityGroup(in *v1beta1.SecurityGroup, out *SecurityGroup, s conversion.Scope) error { - out.ID = in.ID - out.Name = in.Name - // WARNING: in.SecurityGroupClass requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha3_SecurityProfile_To_v1beta1_SecurityProfile(in *SecurityProfile, out *v1beta1.SecurityProfile, s conversion.Scope) error { - out.EncryptionAtHost = (*bool)(unsafe.Pointer(in.EncryptionAtHost)) - return nil -} - -// Convert_v1alpha3_SecurityProfile_To_v1beta1_SecurityProfile is an autogenerated conversion function. -func Convert_v1alpha3_SecurityProfile_To_v1beta1_SecurityProfile(in *SecurityProfile, out *v1beta1.SecurityProfile, s conversion.Scope) error { - return autoConvert_v1alpha3_SecurityProfile_To_v1beta1_SecurityProfile(in, out, s) -} - -func autoConvert_v1beta1_SecurityProfile_To_v1alpha3_SecurityProfile(in *v1beta1.SecurityProfile, out *SecurityProfile, s conversion.Scope) error { - out.EncryptionAtHost = (*bool)(unsafe.Pointer(in.EncryptionAtHost)) - return nil -} - -// Convert_v1beta1_SecurityProfile_To_v1alpha3_SecurityProfile is an autogenerated conversion function. -func Convert_v1beta1_SecurityProfile_To_v1alpha3_SecurityProfile(in *v1beta1.SecurityProfile, out *SecurityProfile, s conversion.Scope) error { - return autoConvert_v1beta1_SecurityProfile_To_v1alpha3_SecurityProfile(in, out, s) -} - -func autoConvert_v1alpha3_SpotVMOptions_To_v1beta1_SpotVMOptions(in *SpotVMOptions, out *v1beta1.SpotVMOptions, s conversion.Scope) error { - out.MaxPrice = (*resource.Quantity)(unsafe.Pointer(in.MaxPrice)) - return nil -} - -// Convert_v1alpha3_SpotVMOptions_To_v1beta1_SpotVMOptions is an autogenerated conversion function. -func Convert_v1alpha3_SpotVMOptions_To_v1beta1_SpotVMOptions(in *SpotVMOptions, out *v1beta1.SpotVMOptions, s conversion.Scope) error { - return autoConvert_v1alpha3_SpotVMOptions_To_v1beta1_SpotVMOptions(in, out, s) -} - -func autoConvert_v1beta1_SpotVMOptions_To_v1alpha3_SpotVMOptions(in *v1beta1.SpotVMOptions, out *SpotVMOptions, s conversion.Scope) error { - out.MaxPrice = (*resource.Quantity)(unsafe.Pointer(in.MaxPrice)) - // WARNING: in.EvictionPolicy requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha3_SubnetSpec_To_v1beta1_SubnetSpec(in *SubnetSpec, out *v1beta1.SubnetSpec, s conversion.Scope) error { - // WARNING: in.Role requires manual conversion: does not exist in peer-type - out.ID = in.ID - // WARNING: in.Name requires manual conversion: does not exist in peer-type - // WARNING: in.CidrBlock requires manual conversion: does not exist in peer-type - // WARNING: in.CIDRBlocks requires manual conversion: does not exist in peer-type - // WARNING: in.InternalLBIPAddress requires manual conversion: does not exist in peer-type - if err := Convert_v1alpha3_SecurityGroup_To_v1beta1_SecurityGroup(&in.SecurityGroup, &out.SecurityGroup, s); err != nil { - return err - } - if err := Convert_v1alpha3_RouteTable_To_v1beta1_RouteTable(&in.RouteTable, &out.RouteTable, s); err != nil { - return err - } - return nil -} - -func autoConvert_v1beta1_SubnetSpec_To_v1alpha3_SubnetSpec(in *v1beta1.SubnetSpec, out *SubnetSpec, s conversion.Scope) error { - out.ID = in.ID - if err := Convert_v1beta1_SecurityGroup_To_v1alpha3_SecurityGroup(&in.SecurityGroup, &out.SecurityGroup, s); err != nil { - return err - } - if err := Convert_v1beta1_RouteTable_To_v1alpha3_RouteTable(&in.RouteTable, &out.RouteTable, s); err != nil { - return err - } - // WARNING: in.NatGateway requires manual conversion: does not exist in peer-type - // WARNING: in.SubnetClassSpec requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha3_UserAssignedIdentity_To_v1beta1_UserAssignedIdentity(in *UserAssignedIdentity, out *v1beta1.UserAssignedIdentity, s conversion.Scope) error { - out.ProviderID = in.ProviderID - return nil -} - -// Convert_v1alpha3_UserAssignedIdentity_To_v1beta1_UserAssignedIdentity is an autogenerated conversion function. -func Convert_v1alpha3_UserAssignedIdentity_To_v1beta1_UserAssignedIdentity(in *UserAssignedIdentity, out *v1beta1.UserAssignedIdentity, s conversion.Scope) error { - return autoConvert_v1alpha3_UserAssignedIdentity_To_v1beta1_UserAssignedIdentity(in, out, s) -} - -func autoConvert_v1beta1_UserAssignedIdentity_To_v1alpha3_UserAssignedIdentity(in *v1beta1.UserAssignedIdentity, out *UserAssignedIdentity, s conversion.Scope) error { - out.ProviderID = in.ProviderID - return nil -} - -// Convert_v1beta1_UserAssignedIdentity_To_v1alpha3_UserAssignedIdentity is an autogenerated conversion function. -func Convert_v1beta1_UserAssignedIdentity_To_v1alpha3_UserAssignedIdentity(in *v1beta1.UserAssignedIdentity, out *UserAssignedIdentity, s conversion.Scope) error { - return autoConvert_v1beta1_UserAssignedIdentity_To_v1alpha3_UserAssignedIdentity(in, out, s) -} - -func autoConvert_v1alpha3_VnetSpec_To_v1beta1_VnetSpec(in *VnetSpec, out *v1beta1.VnetSpec, s conversion.Scope) error { - out.ResourceGroup = in.ResourceGroup - out.ID = in.ID - out.Name = in.Name - // WARNING: in.CidrBlock requires manual conversion: does not exist in peer-type - // WARNING: in.CIDRBlocks requires manual conversion: does not exist in peer-type - // WARNING: in.Tags requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1beta1_VnetSpec_To_v1alpha3_VnetSpec(in *v1beta1.VnetSpec, out *VnetSpec, s conversion.Scope) error { - out.ResourceGroup = in.ResourceGroup - out.ID = in.ID - out.Name = in.Name - // WARNING: in.Peerings requires manual conversion: does not exist in peer-type - // WARNING: in.VnetClassSpec requires manual conversion: does not exist in peer-type - return nil -} diff --git a/api/v1alpha3/zz_generated.deepcopy.go b/api/v1alpha3/zz_generated.deepcopy.go deleted file mode 100644 index ea5533c632f..00000000000 --- a/api/v1alpha3/zz_generated.deepcopy.go +++ /dev/null @@ -1,1477 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright The Kubernetes Authors. - -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. -*/ - -// Code generated by controller-gen. DO NOT EDIT. - -package v1alpha3 - -import ( - "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/runtime" - apiv1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3" - "sigs.k8s.io/cluster-api/errors" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AADProfile) DeepCopyInto(out *AADProfile) { - *out = *in - if in.AdminGroupObjectIDs != nil { - in, out := &in.AdminGroupObjectIDs, &out.AdminGroupObjectIDs - *out = make([]string, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AADProfile. -func (in *AADProfile) DeepCopy() *AADProfile { - if in == nil { - return nil - } - out := new(AADProfile) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AddressRecord) DeepCopyInto(out *AddressRecord) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddressRecord. -func (in *AddressRecord) DeepCopy() *AddressRecord { - if in == nil { - return nil - } - out := new(AddressRecord) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AvailabilityZone) DeepCopyInto(out *AvailabilityZone) { - *out = *in - if in.ID != nil { - in, out := &in.ID, &out.ID - *out = new(string) - **out = **in - } - if in.Enabled != nil { - in, out := &in.Enabled, &out.Enabled - *out = new(bool) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AvailabilityZone. -func (in *AvailabilityZone) DeepCopy() *AvailabilityZone { - if in == nil { - return nil - } - out := new(AvailabilityZone) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureCluster) DeepCopyInto(out *AzureCluster) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureCluster. -func (in *AzureCluster) DeepCopy() *AzureCluster { - if in == nil { - return nil - } - out := new(AzureCluster) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AzureCluster) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureClusterIdentity) DeepCopyInto(out *AzureClusterIdentity) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureClusterIdentity. -func (in *AzureClusterIdentity) DeepCopy() *AzureClusterIdentity { - if in == nil { - return nil - } - out := new(AzureClusterIdentity) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AzureClusterIdentity) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureClusterIdentityList) DeepCopyInto(out *AzureClusterIdentityList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]AzureClusterIdentity, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureClusterIdentityList. -func (in *AzureClusterIdentityList) DeepCopy() *AzureClusterIdentityList { - if in == nil { - return nil - } - out := new(AzureClusterIdentityList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AzureClusterIdentityList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureClusterIdentitySpec) DeepCopyInto(out *AzureClusterIdentitySpec) { - *out = *in - out.ClientSecret = in.ClientSecret - if in.AllowedNamespaces != nil { - in, out := &in.AllowedNamespaces, &out.AllowedNamespaces - *out = make([]string, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureClusterIdentitySpec. -func (in *AzureClusterIdentitySpec) DeepCopy() *AzureClusterIdentitySpec { - if in == nil { - return nil - } - out := new(AzureClusterIdentitySpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureClusterIdentityStatus) DeepCopyInto(out *AzureClusterIdentityStatus) { - *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(apiv1alpha3.Conditions, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureClusterIdentityStatus. -func (in *AzureClusterIdentityStatus) DeepCopy() *AzureClusterIdentityStatus { - if in == nil { - return nil - } - out := new(AzureClusterIdentityStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureClusterList) DeepCopyInto(out *AzureClusterList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]AzureCluster, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureClusterList. -func (in *AzureClusterList) DeepCopy() *AzureClusterList { - if in == nil { - return nil - } - out := new(AzureClusterList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AzureClusterList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureClusterSpec) DeepCopyInto(out *AzureClusterSpec) { - *out = *in - in.NetworkSpec.DeepCopyInto(&out.NetworkSpec) - out.ControlPlaneEndpoint = in.ControlPlaneEndpoint - if in.AdditionalTags != nil { - in, out := &in.AdditionalTags, &out.AdditionalTags - *out = make(Tags, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.IdentityRef != nil { - in, out := &in.IdentityRef, &out.IdentityRef - *out = new(v1.ObjectReference) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureClusterSpec. -func (in *AzureClusterSpec) DeepCopy() *AzureClusterSpec { - if in == nil { - return nil - } - out := new(AzureClusterSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureClusterStatus) DeepCopyInto(out *AzureClusterStatus) { - *out = *in - if in.FailureDomains != nil { - in, out := &in.FailureDomains, &out.FailureDomains - *out = make(apiv1alpha3.FailureDomains, len(*in)) - for key, val := range *in { - (*out)[key] = *val.DeepCopy() - } - } - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(apiv1alpha3.Conditions, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureClusterStatus. -func (in *AzureClusterStatus) DeepCopy() *AzureClusterStatus { - if in == nil { - return nil - } - out := new(AzureClusterStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachine) DeepCopyInto(out *AzureMachine) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachine. -func (in *AzureMachine) DeepCopy() *AzureMachine { - if in == nil { - return nil - } - out := new(AzureMachine) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AzureMachine) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachineList) DeepCopyInto(out *AzureMachineList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]AzureMachine, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachineList. -func (in *AzureMachineList) DeepCopy() *AzureMachineList { - if in == nil { - return nil - } - out := new(AzureMachineList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AzureMachineList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachineSpec) DeepCopyInto(out *AzureMachineSpec) { - *out = *in - if in.ProviderID != nil { - in, out := &in.ProviderID, &out.ProviderID - *out = new(string) - **out = **in - } - if in.FailureDomain != nil { - in, out := &in.FailureDomain, &out.FailureDomain - *out = new(string) - **out = **in - } - in.AvailabilityZone.DeepCopyInto(&out.AvailabilityZone) - if in.Image != nil { - in, out := &in.Image, &out.Image - *out = new(Image) - (*in).DeepCopyInto(*out) - } - if in.UserAssignedIdentities != nil { - in, out := &in.UserAssignedIdentities, &out.UserAssignedIdentities - *out = make([]UserAssignedIdentity, len(*in)) - copy(*out, *in) - } - in.OSDisk.DeepCopyInto(&out.OSDisk) - if in.DataDisks != nil { - in, out := &in.DataDisks, &out.DataDisks - *out = make([]DataDisk, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.AdditionalTags != nil { - in, out := &in.AdditionalTags, &out.AdditionalTags - *out = make(Tags, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.AcceleratedNetworking != nil { - in, out := &in.AcceleratedNetworking, &out.AcceleratedNetworking - *out = new(bool) - **out = **in - } - if in.SpotVMOptions != nil { - in, out := &in.SpotVMOptions, &out.SpotVMOptions - *out = new(SpotVMOptions) - (*in).DeepCopyInto(*out) - } - if in.SecurityProfile != nil { - in, out := &in.SecurityProfile, &out.SecurityProfile - *out = new(SecurityProfile) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachineSpec. -func (in *AzureMachineSpec) DeepCopy() *AzureMachineSpec { - if in == nil { - return nil - } - out := new(AzureMachineSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachineStatus) DeepCopyInto(out *AzureMachineStatus) { - *out = *in - if in.Addresses != nil { - in, out := &in.Addresses, &out.Addresses - *out = make([]v1.NodeAddress, len(*in)) - copy(*out, *in) - } - if in.VMState != nil { - in, out := &in.VMState, &out.VMState - *out = new(VMState) - **out = **in - } - if in.FailureReason != nil { - in, out := &in.FailureReason, &out.FailureReason - *out = new(errors.MachineStatusError) - **out = **in - } - if in.FailureMessage != nil { - in, out := &in.FailureMessage, &out.FailureMessage - *out = new(string) - **out = **in - } - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(apiv1alpha3.Conditions, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachineStatus. -func (in *AzureMachineStatus) DeepCopy() *AzureMachineStatus { - if in == nil { - return nil - } - out := new(AzureMachineStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachineTemplate) DeepCopyInto(out *AzureMachineTemplate) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachineTemplate. -func (in *AzureMachineTemplate) DeepCopy() *AzureMachineTemplate { - if in == nil { - return nil - } - out := new(AzureMachineTemplate) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AzureMachineTemplate) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachineTemplateList) DeepCopyInto(out *AzureMachineTemplateList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]AzureMachineTemplate, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachineTemplateList. -func (in *AzureMachineTemplateList) DeepCopy() *AzureMachineTemplateList { - if in == nil { - return nil - } - out := new(AzureMachineTemplateList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AzureMachineTemplateList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachineTemplateResource) DeepCopyInto(out *AzureMachineTemplateResource) { - *out = *in - in.Spec.DeepCopyInto(&out.Spec) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachineTemplateResource. -func (in *AzureMachineTemplateResource) DeepCopy() *AzureMachineTemplateResource { - if in == nil { - return nil - } - out := new(AzureMachineTemplateResource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachineTemplateSpec) DeepCopyInto(out *AzureMachineTemplateSpec) { - *out = *in - in.Template.DeepCopyInto(&out.Template) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachineTemplateSpec. -func (in *AzureMachineTemplateSpec) DeepCopy() *AzureMachineTemplateSpec { - if in == nil { - return nil - } - out := new(AzureMachineTemplateSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureManagedCluster) DeepCopyInto(out *AzureManagedCluster) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec - out.Status = in.Status -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureManagedCluster. -func (in *AzureManagedCluster) DeepCopy() *AzureManagedCluster { - if in == nil { - return nil - } - out := new(AzureManagedCluster) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AzureManagedCluster) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureManagedClusterList) DeepCopyInto(out *AzureManagedClusterList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]AzureManagedCluster, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureManagedClusterList. -func (in *AzureManagedClusterList) DeepCopy() *AzureManagedClusterList { - if in == nil { - return nil - } - out := new(AzureManagedClusterList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AzureManagedClusterList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureManagedClusterSpec) DeepCopyInto(out *AzureManagedClusterSpec) { - *out = *in - out.ControlPlaneEndpoint = in.ControlPlaneEndpoint -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureManagedClusterSpec. -func (in *AzureManagedClusterSpec) DeepCopy() *AzureManagedClusterSpec { - if in == nil { - return nil - } - out := new(AzureManagedClusterSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureManagedClusterStatus) DeepCopyInto(out *AzureManagedClusterStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureManagedClusterStatus. -func (in *AzureManagedClusterStatus) DeepCopy() *AzureManagedClusterStatus { - if in == nil { - return nil - } - out := new(AzureManagedClusterStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureManagedControlPlane) DeepCopyInto(out *AzureManagedControlPlane) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - out.Status = in.Status -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureManagedControlPlane. -func (in *AzureManagedControlPlane) DeepCopy() *AzureManagedControlPlane { - if in == nil { - return nil - } - out := new(AzureManagedControlPlane) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AzureManagedControlPlane) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureManagedControlPlaneList) DeepCopyInto(out *AzureManagedControlPlaneList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]AzureManagedControlPlane, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureManagedControlPlaneList. -func (in *AzureManagedControlPlaneList) DeepCopy() *AzureManagedControlPlaneList { - if in == nil { - return nil - } - out := new(AzureManagedControlPlaneList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AzureManagedControlPlaneList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureManagedControlPlaneSpec) DeepCopyInto(out *AzureManagedControlPlaneSpec) { - *out = *in - out.VirtualNetwork = in.VirtualNetwork - out.ControlPlaneEndpoint = in.ControlPlaneEndpoint - if in.AdditionalTags != nil { - in, out := &in.AdditionalTags, &out.AdditionalTags - *out = make(Tags, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.NetworkPlugin != nil { - in, out := &in.NetworkPlugin, &out.NetworkPlugin - *out = new(string) - **out = **in - } - if in.NetworkPolicy != nil { - in, out := &in.NetworkPolicy, &out.NetworkPolicy - *out = new(string) - **out = **in - } - if in.DNSServiceIP != nil { - in, out := &in.DNSServiceIP, &out.DNSServiceIP - *out = new(string) - **out = **in - } - if in.LoadBalancerSKU != nil { - in, out := &in.LoadBalancerSKU, &out.LoadBalancerSKU - *out = new(string) - **out = **in - } - if in.AADProfile != nil { - in, out := &in.AADProfile, &out.AADProfile - *out = new(AADProfile) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureManagedControlPlaneSpec. -func (in *AzureManagedControlPlaneSpec) DeepCopy() *AzureManagedControlPlaneSpec { - if in == nil { - return nil - } - out := new(AzureManagedControlPlaneSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureManagedControlPlaneStatus) DeepCopyInto(out *AzureManagedControlPlaneStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureManagedControlPlaneStatus. -func (in *AzureManagedControlPlaneStatus) DeepCopy() *AzureManagedControlPlaneStatus { - if in == nil { - return nil - } - out := new(AzureManagedControlPlaneStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureManagedMachinePool) DeepCopyInto(out *AzureManagedMachinePool) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureManagedMachinePool. -func (in *AzureManagedMachinePool) DeepCopy() *AzureManagedMachinePool { - if in == nil { - return nil - } - out := new(AzureManagedMachinePool) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AzureManagedMachinePool) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureManagedMachinePoolList) DeepCopyInto(out *AzureManagedMachinePoolList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]AzureManagedMachinePool, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureManagedMachinePoolList. -func (in *AzureManagedMachinePoolList) DeepCopy() *AzureManagedMachinePoolList { - if in == nil { - return nil - } - out := new(AzureManagedMachinePoolList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AzureManagedMachinePoolList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureManagedMachinePoolSpec) DeepCopyInto(out *AzureManagedMachinePoolSpec) { - *out = *in - if in.OSDiskSizeGB != nil { - in, out := &in.OSDiskSizeGB, &out.OSDiskSizeGB - *out = new(int32) - **out = **in - } - if in.ProviderIDList != nil { - in, out := &in.ProviderIDList, &out.ProviderIDList - *out = make([]string, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureManagedMachinePoolSpec. -func (in *AzureManagedMachinePoolSpec) DeepCopy() *AzureManagedMachinePoolSpec { - if in == nil { - return nil - } - out := new(AzureManagedMachinePoolSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureManagedMachinePoolStatus) DeepCopyInto(out *AzureManagedMachinePoolStatus) { - *out = *in - if in.ErrorReason != nil { - in, out := &in.ErrorReason, &out.ErrorReason - *out = new(errors.MachineStatusError) - **out = **in - } - if in.ErrorMessage != nil { - in, out := &in.ErrorMessage, &out.ErrorMessage - *out = new(string) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureManagedMachinePoolStatus. -func (in *AzureManagedMachinePoolStatus) DeepCopy() *AzureManagedMachinePoolStatus { - if in == nil { - return nil - } - out := new(AzureManagedMachinePoolStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMarketplaceImage) DeepCopyInto(out *AzureMarketplaceImage) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMarketplaceImage. -func (in *AzureMarketplaceImage) DeepCopy() *AzureMarketplaceImage { - if in == nil { - return nil - } - out := new(AzureMarketplaceImage) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureSharedGalleryImage) DeepCopyInto(out *AzureSharedGalleryImage) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureSharedGalleryImage. -func (in *AzureSharedGalleryImage) DeepCopy() *AzureSharedGalleryImage { - if in == nil { - return nil - } - out := new(AzureSharedGalleryImage) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BuildParams) DeepCopyInto(out *BuildParams) { - *out = *in - if in.Name != nil { - in, out := &in.Name, &out.Name - *out = new(string) - **out = **in - } - if in.Role != nil { - in, out := &in.Role, &out.Role - *out = new(string) - **out = **in - } - if in.Additional != nil { - in, out := &in.Additional, &out.Additional - *out = make(Tags, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BuildParams. -func (in *BuildParams) DeepCopy() *BuildParams { - if in == nil { - return nil - } - out := new(BuildParams) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DataDisk) DeepCopyInto(out *DataDisk) { - *out = *in - if in.ManagedDisk != nil { - in, out := &in.ManagedDisk, &out.ManagedDisk - *out = new(ManagedDisk) - (*in).DeepCopyInto(*out) - } - if in.Lun != nil { - in, out := &in.Lun, &out.Lun - *out = new(int32) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataDisk. -func (in *DataDisk) DeepCopy() *DataDisk { - if in == nil { - return nil - } - out := new(DataDisk) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DiffDiskSettings) DeepCopyInto(out *DiffDiskSettings) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiffDiskSettings. -func (in *DiffDiskSettings) DeepCopy() *DiffDiskSettings { - if in == nil { - return nil - } - out := new(DiffDiskSettings) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DiskEncryptionSetParameters) DeepCopyInto(out *DiskEncryptionSetParameters) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiskEncryptionSetParameters. -func (in *DiskEncryptionSetParameters) DeepCopy() *DiskEncryptionSetParameters { - if in == nil { - return nil - } - out := new(DiskEncryptionSetParameters) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FrontendIP) DeepCopyInto(out *FrontendIP) { - *out = *in - if in.PublicIP != nil { - in, out := &in.PublicIP, &out.PublicIP - *out = new(PublicIPSpec) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FrontendIP. -func (in *FrontendIP) DeepCopy() *FrontendIP { - if in == nil { - return nil - } - out := new(FrontendIP) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Future) DeepCopyInto(out *Future) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Future. -func (in *Future) DeepCopy() *Future { - if in == nil { - return nil - } - out := new(Future) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Image) DeepCopyInto(out *Image) { - *out = *in - if in.ID != nil { - in, out := &in.ID, &out.ID - *out = new(string) - **out = **in - } - if in.SharedGallery != nil { - in, out := &in.SharedGallery, &out.SharedGallery - *out = new(AzureSharedGalleryImage) - **out = **in - } - if in.Marketplace != nil { - in, out := &in.Marketplace, &out.Marketplace - *out = new(AzureMarketplaceImage) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Image. -func (in *Image) DeepCopy() *Image { - if in == nil { - return nil - } - out := new(Image) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IngressRule) DeepCopyInto(out *IngressRule) { - *out = *in - if in.SourcePorts != nil { - in, out := &in.SourcePorts, &out.SourcePorts - *out = new(string) - **out = **in - } - if in.DestinationPorts != nil { - in, out := &in.DestinationPorts, &out.DestinationPorts - *out = new(string) - **out = **in - } - if in.Source != nil { - in, out := &in.Source, &out.Source - *out = new(string) - **out = **in - } - if in.Destination != nil { - in, out := &in.Destination, &out.Destination - *out = new(string) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressRule. -func (in *IngressRule) DeepCopy() *IngressRule { - if in == nil { - return nil - } - out := new(IngressRule) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in IngressRules) DeepCopyInto(out *IngressRules) { - { - in := &in - *out = make(IngressRules, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressRules. -func (in IngressRules) DeepCopy() IngressRules { - if in == nil { - return nil - } - out := new(IngressRules) - in.DeepCopyInto(out) - return *out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LoadBalancerSpec) DeepCopyInto(out *LoadBalancerSpec) { - *out = *in - if in.FrontendIPs != nil { - in, out := &in.FrontendIPs, &out.FrontendIPs - *out = make([]FrontendIP, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoadBalancerSpec. -func (in *LoadBalancerSpec) DeepCopy() *LoadBalancerSpec { - if in == nil { - return nil - } - out := new(LoadBalancerSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ManagedControlPlaneSubnet) DeepCopyInto(out *ManagedControlPlaneSubnet) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedControlPlaneSubnet. -func (in *ManagedControlPlaneSubnet) DeepCopy() *ManagedControlPlaneSubnet { - if in == nil { - return nil - } - out := new(ManagedControlPlaneSubnet) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ManagedControlPlaneVirtualNetwork) DeepCopyInto(out *ManagedControlPlaneVirtualNetwork) { - *out = *in - out.Subnet = in.Subnet -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedControlPlaneVirtualNetwork. -func (in *ManagedControlPlaneVirtualNetwork) DeepCopy() *ManagedControlPlaneVirtualNetwork { - if in == nil { - return nil - } - out := new(ManagedControlPlaneVirtualNetwork) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ManagedDisk) DeepCopyInto(out *ManagedDisk) { - *out = *in - if in.DiskEncryptionSet != nil { - in, out := &in.DiskEncryptionSet, &out.DiskEncryptionSet - *out = new(DiskEncryptionSetParameters) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedDisk. -func (in *ManagedDisk) DeepCopy() *ManagedDisk { - if in == nil { - return nil - } - out := new(ManagedDisk) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NetworkSpec) DeepCopyInto(out *NetworkSpec) { - *out = *in - in.Vnet.DeepCopyInto(&out.Vnet) - if in.Subnets != nil { - in, out := &in.Subnets, &out.Subnets - *out = make(Subnets, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - in.APIServerLB.DeepCopyInto(&out.APIServerLB) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkSpec. -func (in *NetworkSpec) DeepCopy() *NetworkSpec { - if in == nil { - return nil - } - out := new(NetworkSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OSDisk) DeepCopyInto(out *OSDisk) { - *out = *in - in.ManagedDisk.DeepCopyInto(&out.ManagedDisk) - if in.DiffDiskSettings != nil { - in, out := &in.DiffDiskSettings, &out.DiffDiskSettings - *out = new(DiffDiskSettings) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OSDisk. -func (in *OSDisk) DeepCopy() *OSDisk { - if in == nil { - return nil - } - out := new(OSDisk) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PublicIPSpec) DeepCopyInto(out *PublicIPSpec) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PublicIPSpec. -func (in *PublicIPSpec) DeepCopy() *PublicIPSpec { - if in == nil { - return nil - } - out := new(PublicIPSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RouteTable) DeepCopyInto(out *RouteTable) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteTable. -func (in *RouteTable) DeepCopy() *RouteTable { - if in == nil { - return nil - } - out := new(RouteTable) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SecurityGroup) DeepCopyInto(out *SecurityGroup) { - *out = *in - if in.IngressRules != nil { - in, out := &in.IngressRules, &out.IngressRules - *out = make(IngressRules, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Tags != nil { - in, out := &in.Tags, &out.Tags - *out = make(Tags, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecurityGroup. -func (in *SecurityGroup) DeepCopy() *SecurityGroup { - if in == nil { - return nil - } - out := new(SecurityGroup) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SecurityProfile) DeepCopyInto(out *SecurityProfile) { - *out = *in - if in.EncryptionAtHost != nil { - in, out := &in.EncryptionAtHost, &out.EncryptionAtHost - *out = new(bool) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecurityProfile. -func (in *SecurityProfile) DeepCopy() *SecurityProfile { - if in == nil { - return nil - } - out := new(SecurityProfile) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SpotVMOptions) DeepCopyInto(out *SpotVMOptions) { - *out = *in - if in.MaxPrice != nil { - in, out := &in.MaxPrice, &out.MaxPrice - x := (*in).DeepCopy() - *out = &x - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpotVMOptions. -func (in *SpotVMOptions) DeepCopy() *SpotVMOptions { - if in == nil { - return nil - } - out := new(SpotVMOptions) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SubnetSpec) DeepCopyInto(out *SubnetSpec) { - *out = *in - if in.CIDRBlocks != nil { - in, out := &in.CIDRBlocks, &out.CIDRBlocks - *out = make([]string, len(*in)) - copy(*out, *in) - } - in.SecurityGroup.DeepCopyInto(&out.SecurityGroup) - out.RouteTable = in.RouteTable -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubnetSpec. -func (in *SubnetSpec) DeepCopy() *SubnetSpec { - if in == nil { - return nil - } - out := new(SubnetSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in Subnets) DeepCopyInto(out *Subnets) { - { - in := &in - *out = make(Subnets, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Subnets. -func (in Subnets) DeepCopy() Subnets { - if in == nil { - return nil - } - out := new(Subnets) - in.DeepCopyInto(out) - return *out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in Tags) DeepCopyInto(out *Tags) { - { - in := &in - *out = make(Tags, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Tags. -func (in Tags) DeepCopy() Tags { - if in == nil { - return nil - } - out := new(Tags) - in.DeepCopyInto(out) - return *out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *UserAssignedIdentity) DeepCopyInto(out *UserAssignedIdentity) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserAssignedIdentity. -func (in *UserAssignedIdentity) DeepCopy() *UserAssignedIdentity { - if in == nil { - return nil - } - out := new(UserAssignedIdentity) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VM) DeepCopyInto(out *VM) { - *out = *in - in.Image.DeepCopyInto(&out.Image) - in.OSDisk.DeepCopyInto(&out.OSDisk) - if in.Tags != nil { - in, out := &in.Tags, &out.Tags - *out = make(Tags, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.Addresses != nil { - in, out := &in.Addresses, &out.Addresses - *out = make([]v1.NodeAddress, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VM. -func (in *VM) DeepCopy() *VM { - if in == nil { - return nil - } - out := new(VM) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VnetSpec) DeepCopyInto(out *VnetSpec) { - *out = *in - if in.CIDRBlocks != nil { - in, out := &in.CIDRBlocks, &out.CIDRBlocks - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.Tags != nil { - in, out := &in.Tags, &out.Tags - *out = make(Tags, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VnetSpec. -func (in *VnetSpec) DeepCopy() *VnetSpec { - if in == nil { - return nil - } - out := new(VnetSpec) - in.DeepCopyInto(out) - return out -} diff --git a/api/v1alpha4/azurecluster_conversion.go b/api/v1alpha4/azurecluster_conversion.go deleted file mode 100644 index d769e9b655a..00000000000 --- a/api/v1alpha4/azurecluster_conversion.go +++ /dev/null @@ -1,384 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha4 - -import ( - "unsafe" - - apiconversion "k8s.io/apimachinery/pkg/conversion" - infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" - utilconversion "sigs.k8s.io/cluster-api/util/conversion" - "sigs.k8s.io/controller-runtime/pkg/conversion" -) - -// ConvertTo converts this AzureCluster to the Hub version (v1beta1). -func (src *AzureCluster) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*infrav1.AzureCluster) - if err := Convert_v1alpha4_AzureCluster_To_v1beta1_AzureCluster(src, dst, nil); err != nil { - return err - } - - // Manually restore data. - restored := &infrav1.AzureCluster{} - if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { - return err - } - - // Restore list of virtual network peerings - dst.Spec.NetworkSpec.Vnet.Peerings = restored.Spec.NetworkSpec.Vnet.Peerings - - // Restore ExtendedLocation properties - dst.Spec.ExtendedLocation = restored.Spec.ExtendedLocation - - // Restore API Server LB IP tags. - for _, restoredFrontendIP := range restored.Spec.NetworkSpec.APIServerLB.FrontendIPs { - for i, dstFrontendIP := range dst.Spec.NetworkSpec.APIServerLB.FrontendIPs { - if restoredFrontendIP.Name == dstFrontendIP.Name && restoredFrontendIP.PublicIP != nil { - dst.Spec.NetworkSpec.APIServerLB.FrontendIPs[i].PublicIP.IPTags = restoredFrontendIP.PublicIP.IPTags - } - } - } - - // Restore outbound LB IP tags. - if restored.Spec.NetworkSpec.ControlPlaneOutboundLB != nil { - for _, restoredFrontendIP := range restored.Spec.NetworkSpec.ControlPlaneOutboundLB.FrontendIPs { - for i, dstFrontendIP := range dst.Spec.NetworkSpec.ControlPlaneOutboundLB.FrontendIPs { - if restoredFrontendIP.Name == dstFrontendIP.Name && restoredFrontendIP.PublicIP != nil { - dst.Spec.NetworkSpec.ControlPlaneOutboundLB.FrontendIPs[i].PublicIP.IPTags = restoredFrontendIP.PublicIP.IPTags - } - } - } - } - if restored.Spec.NetworkSpec.NodeOutboundLB != nil { - for _, restoredFrontendIP := range restored.Spec.NetworkSpec.NodeOutboundLB.FrontendIPs { - for i, dstFrontendIP := range dst.Spec.NetworkSpec.NodeOutboundLB.FrontendIPs { - if restoredFrontendIP.Name == dstFrontendIP.Name && restoredFrontendIP.PublicIP != nil { - dst.Spec.NetworkSpec.NodeOutboundLB.FrontendIPs[i].PublicIP.IPTags = restoredFrontendIP.PublicIP.IPTags - } - } - } - } - - // Restore NAT Gateway IP tags, ServiceEndpoints and PrivateEndpoints. - for _, restoredSubnet := range restored.Spec.NetworkSpec.Subnets { - for i, dstSubnet := range dst.Spec.NetworkSpec.Subnets { - if dstSubnet.Name == restoredSubnet.Name { - dst.Spec.NetworkSpec.Subnets[i].NatGateway.NatGatewayIP.IPTags = restoredSubnet.NatGateway.NatGatewayIP.IPTags - dst.Spec.NetworkSpec.Subnets[i].ServiceEndpoints = restoredSubnet.ServiceEndpoints - dst.Spec.NetworkSpec.Subnets[i].PrivateEndpoints = restoredSubnet.PrivateEndpoints - } - } - } - - // Restore Azure Bastion IP tags, ServiceEndpoints, PrivateEndpoints, SKU, and EnableTunneling. - if restored.Spec.BastionSpec.AzureBastion != nil && dst.Spec.BastionSpec.AzureBastion != nil { - if restored.Spec.BastionSpec.AzureBastion.PublicIP.Name == dst.Spec.BastionSpec.AzureBastion.PublicIP.Name { - dst.Spec.BastionSpec.AzureBastion.PublicIP.IPTags = restored.Spec.BastionSpec.AzureBastion.PublicIP.IPTags - } - if restored.Spec.BastionSpec.AzureBastion.Subnet.NatGateway.NatGatewayIP.Name == dst.Spec.BastionSpec.AzureBastion.Subnet.NatGateway.NatGatewayIP.Name { - dst.Spec.BastionSpec.AzureBastion.Subnet.NatGateway.NatGatewayIP.IPTags = restored.Spec.BastionSpec.AzureBastion.Subnet.NatGateway.NatGatewayIP.IPTags - } - dst.Spec.BastionSpec.AzureBastion.Subnet.ServiceEndpoints = restored.Spec.BastionSpec.AzureBastion.Subnet.ServiceEndpoints - dst.Spec.BastionSpec.AzureBastion.Subnet.PrivateEndpoints = restored.Spec.BastionSpec.AzureBastion.Subnet.PrivateEndpoints - dst.Spec.BastionSpec.AzureBastion.Sku = restored.Spec.BastionSpec.AzureBastion.Sku - dst.Spec.BastionSpec.AzureBastion.EnableTunneling = restored.Spec.BastionSpec.AzureBastion.EnableTunneling - } - - // Restore load balancers' backend pool name - if restored.Spec.NetworkSpec.APIServerLB.BackendPool.Name != "" { - dst.Spec.NetworkSpec.APIServerLB.BackendPool.Name = restored.Spec.NetworkSpec.APIServerLB.BackendPool.Name - } - - if restored.Spec.NetworkSpec.NodeOutboundLB != nil && restored.Spec.NetworkSpec.NodeOutboundLB.BackendPool.Name != "" { - dst.Spec.NetworkSpec.NodeOutboundLB.BackendPool.Name = restored.Spec.NetworkSpec.NodeOutboundLB.BackendPool.Name - } - - if restored.Spec.NetworkSpec.ControlPlaneOutboundLB != nil && restored.Spec.NetworkSpec.ControlPlaneOutboundLB.BackendPool.Name != "" { - dst.Spec.NetworkSpec.ControlPlaneOutboundLB.BackendPool.Name = restored.Spec.NetworkSpec.ControlPlaneOutboundLB.BackendPool.Name - } - - return nil -} - -// ConvertFrom converts from the Hub version (v1beta1) to this version. -func (dst *AzureCluster) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*infrav1.AzureCluster) - if err := Convert_v1beta1_AzureCluster_To_v1alpha4_AzureCluster(src, dst, nil); err != nil { - return err - } - - // Preserve Hub data on down-conversion. - return utilconversion.MarshalData(src, dst) -} - -// ConvertTo converts this AzureClusterList to the Hub version (v1beta1). -func (src *AzureClusterList) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*infrav1.AzureClusterList) - return Convert_v1alpha4_AzureClusterList_To_v1beta1_AzureClusterList(src, dst, nil) -} - -// ConvertFrom converts from the Hub version (v1beta1) to this version. -func (dst *AzureClusterList) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*infrav1.AzureClusterList) - return Convert_v1beta1_AzureClusterList_To_v1alpha4_AzureClusterList(src, dst, nil) -} - -// Convert_v1beta1_VnetSpec_To_v1alpha4_VnetSpec converts from the Hub version (v1beta1) of the VnetSpec to this version. -func Convert_v1beta1_VnetSpec_To_v1alpha4_VnetSpec(in *infrav1.VnetSpec, out *VnetSpec, s apiconversion.Scope) error { - if err := autoConvert_v1beta1_VnetSpec_To_v1alpha4_VnetSpec(in, out, s); err != nil { - return err - } - - // Convert VnetClassSpec fields - out.CIDRBlocks = in.CIDRBlocks - out.Tags = *(*Tags)(&in.Tags) - - return nil -} - -// Convert_v1alpha4_VnetSpec_To_v1beta1_VnetSpec is an autogenerated conversion function. -func Convert_v1alpha4_VnetSpec_To_v1beta1_VnetSpec(in *VnetSpec, out *infrav1.VnetSpec, s apiconversion.Scope) error { - if err := autoConvert_v1alpha4_VnetSpec_To_v1beta1_VnetSpec(in, out, s); err != nil { - return err - } - - // Convert VnetClassSpec fields - out.CIDRBlocks = in.CIDRBlocks - out.Tags = *(*infrav1.Tags)(&in.Tags) - - return nil -} - -// Convert_v1alpha4_AzureClusterSpec_To_v1beta1_AzureClusterSpec is an autogenerated conversion function. -func Convert_v1alpha4_AzureClusterSpec_To_v1beta1_AzureClusterSpec(in *AzureClusterSpec, out *infrav1.AzureClusterSpec, s apiconversion.Scope) error { - if err := autoConvert_v1alpha4_AzureClusterSpec_To_v1beta1_AzureClusterSpec(in, out, s); err != nil { - return err - } - - // Convert AzureClusterClassSpec fields - out.SubscriptionID = in.SubscriptionID - out.Location = in.Location - out.AdditionalTags = *(*infrav1.Tags)(&in.AdditionalTags) - out.IdentityRef = in.IdentityRef - out.AzureEnvironment = in.AzureEnvironment - out.CloudProviderConfigOverrides = (*infrav1.CloudProviderConfigOverrides)(unsafe.Pointer(in.CloudProviderConfigOverrides)) - - return nil -} - -// Convert_v1beta1_AzureClusterSpec_To_v1alpha4_AzureClusterSpec is an autogenerated conversion function. -func Convert_v1beta1_AzureClusterSpec_To_v1alpha4_AzureClusterSpec(in *infrav1.AzureClusterSpec, out *AzureClusterSpec, s apiconversion.Scope) error { - if err := autoConvert_v1beta1_AzureClusterSpec_To_v1alpha4_AzureClusterSpec(in, out, s); err != nil { - return err - } - - // Convert AzureClusterClassSpec fields - out.SubscriptionID = in.SubscriptionID - out.Location = in.Location - out.AdditionalTags = Tags(in.AdditionalTags) - out.IdentityRef = in.IdentityRef - out.AzureEnvironment = in.AzureEnvironment - out.CloudProviderConfigOverrides = (*CloudProviderConfigOverrides)(unsafe.Pointer(in.CloudProviderConfigOverrides)) - - return nil -} - -// Convert_v1alpha4_FrontendIP_To_v1beta1_FrontendIP is an autogenerated conversion function. -func Convert_v1alpha4_FrontendIP_To_v1beta1_FrontendIP(in *FrontendIP, out *infrav1.FrontendIP, s apiconversion.Scope) error { - if err := autoConvert_v1alpha4_FrontendIP_To_v1beta1_FrontendIP(in, out, s); err != nil { - return err - } - - // Convert FrontendIPClass fields - out.PrivateIPAddress = in.PrivateIPAddress - - return nil -} - -// Convert_v1beta1_FrontendIP_To_v1alpha4_FrontendIP is an autogenerated conversion function. -func Convert_v1beta1_FrontendIP_To_v1alpha4_FrontendIP(in *infrav1.FrontendIP, out *FrontendIP, s apiconversion.Scope) error { - if err := autoConvert_v1beta1_FrontendIP_To_v1alpha4_FrontendIP(in, out, s); err != nil { - return err - } - - // Convert FrontendIPClass fields - out.PrivateIPAddress = in.PrivateIPAddress - - return nil -} - -// Convert_v1alpha4_LoadBalancerSpec_To_v1beta1_LoadBalancerSpec is an autogenerated conversion function. -func Convert_v1alpha4_LoadBalancerSpec_To_v1beta1_LoadBalancerSpec(in *LoadBalancerSpec, out *infrav1.LoadBalancerSpec, s apiconversion.Scope) error { - if err := autoConvert_v1alpha4_LoadBalancerSpec_To_v1beta1_LoadBalancerSpec(in, out, s); err != nil { - return err - } - - // Convert LoadBalancerClassSpec fields - out.SKU = infrav1.SKU(in.SKU) - if in.FrontendIPs != nil { - in, out := &in.FrontendIPs, &out.FrontendIPs - *out = make([]infrav1.FrontendIP, len(*in)) - for i := range *in { - if err := Convert_v1alpha4_FrontendIP_To_v1beta1_FrontendIP(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.FrontendIPs = nil - } - out.Type = infrav1.LBType(in.Type) - out.FrontendIPsCount = in.FrontendIPsCount - out.IdleTimeoutInMinutes = in.IdleTimeoutInMinutes - - return nil -} - -// Convert_v1beta1_LoadBalancerSpec_To_v1alpha4_LoadBalancerSpec is an autogenerated conversion function. -func Convert_v1beta1_LoadBalancerSpec_To_v1alpha4_LoadBalancerSpec(in *infrav1.LoadBalancerSpec, out *LoadBalancerSpec, s apiconversion.Scope) error { - if err := autoConvert_v1beta1_LoadBalancerSpec_To_v1alpha4_LoadBalancerSpec(in, out, s); err != nil { - return err - } - - // Convert LoadBalancerClassSpec fields - out.SKU = SKU(in.SKU) - if in.FrontendIPs != nil { - in, out := &in.FrontendIPs, &out.FrontendIPs - *out = make([]FrontendIP, len(*in)) - for i := range *in { - if err := Convert_v1beta1_FrontendIP_To_v1alpha4_FrontendIP(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.FrontendIPs = nil - } - out.Type = LBType(in.Type) - out.FrontendIPsCount = in.FrontendIPsCount - out.IdleTimeoutInMinutes = in.IdleTimeoutInMinutes - - return nil -} - -// Convert_v1alpha4_NetworkSpec_To_v1beta1_NetworkSpec is an autogenerated conversion function. -func Convert_v1alpha4_NetworkSpec_To_v1beta1_NetworkSpec(in *NetworkSpec, out *infrav1.NetworkSpec, s apiconversion.Scope) error { - if err := autoConvert_v1alpha4_NetworkSpec_To_v1beta1_NetworkSpec(in, out, s); err != nil { - return err - } - - // Convert NetworkClassSpec fields - out.PrivateDNSZoneName = in.PrivateDNSZoneName - - return nil -} - -// Convert_v1beta1_NetworkSpec_To_v1alpha4_NetworkSpec is an autogenerated conversion function. -func Convert_v1beta1_NetworkSpec_To_v1alpha4_NetworkSpec(in *infrav1.NetworkSpec, out *NetworkSpec, s apiconversion.Scope) error { - if err := autoConvert_v1beta1_NetworkSpec_To_v1alpha4_NetworkSpec(in, out, s); err != nil { - return err - } - - // Convert NetworkClassSpec fields - out.PrivateDNSZoneName = in.PrivateDNSZoneName - - return nil -} - -// Convert_v1alpha4_SubnetSpec_To_v1beta1_SubnetSpec is an autogenerated conversion function. -func Convert_v1alpha4_SubnetSpec_To_v1beta1_SubnetSpec(in *SubnetSpec, out *infrav1.SubnetSpec, s apiconversion.Scope) error { - if err := autoConvert_v1alpha4_SubnetSpec_To_v1beta1_SubnetSpec(in, out, s); err != nil { - return err - } - - // Convert SubnetClassSpec fields - out.Role = infrav1.SubnetRole(in.Role) - out.Name = in.Name - out.CIDRBlocks = in.CIDRBlocks - - return nil -} - -// Convert_v1beta1_SubnetSpec_To_v1alpha4_SubnetSpec is an autogenerated conversion function. -func Convert_v1beta1_SubnetSpec_To_v1alpha4_SubnetSpec(in *infrav1.SubnetSpec, out *SubnetSpec, s apiconversion.Scope) error { - if err := autoConvert_v1beta1_SubnetSpec_To_v1alpha4_SubnetSpec(in, out, s); err != nil { - return err - } - - // Convert SubnetClassSpec fields - out.Role = SubnetRole(in.Role) - out.Name = in.Name - out.CIDRBlocks = in.CIDRBlocks - - return nil -} - -// Convert_v1alpha4_SecurityGroup_To_v1beta1_SecurityGroup is an autogenerated conversion function. -func Convert_v1alpha4_SecurityGroup_To_v1beta1_SecurityGroup(in *SecurityGroup, out *infrav1.SecurityGroup, s apiconversion.Scope) error { - if err := autoConvert_v1alpha4_SecurityGroup_To_v1beta1_SecurityGroup(in, out, s); err != nil { - return err - } - - // Convert SecurityGroupClass fields - out.SecurityRules = *(*infrav1.SecurityRules)(unsafe.Pointer(&in.SecurityRules)) - out.Tags = *(*infrav1.Tags)(&in.Tags) - - return nil -} - -// Convert_v1beta1_SecurityGroup_To_v1alpha4_SecurityGroup is an autogenerated conversion function. -func Convert_v1beta1_SecurityGroup_To_v1alpha4_SecurityGroup(in *infrav1.SecurityGroup, out *SecurityGroup, s apiconversion.Scope) error { - if err := autoConvert_v1beta1_SecurityGroup_To_v1alpha4_SecurityGroup(in, out, s); err != nil { - return err - } - - // Convert SecurityGroupClass fields - out.SecurityRules = *(*SecurityRules)(unsafe.Pointer(&in.SecurityRules)) - out.Tags = *(*Tags)(&in.Tags) - - return nil -} - -// Convert_v1alpha4_NatGateway_To_v1beta1_NatGateway converts a NAT gateway from v1alpha4 to v1beta1. -func Convert_v1alpha4_NatGateway_To_v1beta1_NatGateway(in *NatGateway, out *infrav1.NatGateway, s apiconversion.Scope) error { - if err := autoConvert_v1alpha4_NatGateway_To_v1beta1_NatGateway(in, out, s); err != nil { - return err - } - - // Convert Name field - out.Name = in.Name - return nil -} - -// Convert_v1beta1_NatGateway_To_v1alpha4_NatGateway converts a NatGateway from v1beta1 to v1alpha4. -func Convert_v1beta1_NatGateway_To_v1alpha4_NatGateway(in *infrav1.NatGateway, out *NatGateway, s apiconversion.Scope) error { - if err := autoConvert_v1beta1_NatGateway_To_v1alpha4_NatGateway(in, out, s); err != nil { - return err - } - - // Convert Name field - out.Name = in.Name - return nil -} - -// Convert_v1beta1_PublicIPSpec_To_v1alpha4_PublicIPSpec is an autogenerated conversion function. -func Convert_v1beta1_PublicIPSpec_To_v1alpha4_PublicIPSpec(in *infrav1.PublicIPSpec, out *PublicIPSpec, s apiconversion.Scope) error { - return autoConvert_v1beta1_PublicIPSpec_To_v1alpha4_PublicIPSpec(in, out, s) -} - -// Convert_v1beta1_AzureBastion_To_v1alpha4_AzureBastion is an autogenerated conversion function. -func Convert_v1beta1_AzureBastion_To_v1alpha4_AzureBastion(in *infrav1.AzureBastion, out *AzureBastion, s apiconversion.Scope) error { - return autoConvert_v1beta1_AzureBastion_To_v1alpha4_AzureBastion(in, out, s) -} diff --git a/api/v1alpha4/azurecluster_types.go b/api/v1alpha4/azurecluster_types.go deleted file mode 100644 index 609c88a64f0..00000000000 --- a/api/v1alpha4/azurecluster_types.go +++ /dev/null @@ -1,158 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha4 - -import ( - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" -) - -const ( - // ClusterFinalizer allows ReconcileAzureCluster to clean up Azure resources associated with AzureCluster before - // removing it from the apiserver. - ClusterFinalizer = "azurecluster.infrastructure.cluster.x-k8s.io" - - // ClusterLabelNamespace indicates the namespace of the cluster. - ClusterLabelNamespace = "azurecluster.infrastructure.cluster.x-k8s.io/cluster-namespace" -) - -// AzureClusterSpec defines the desired state of AzureCluster. -type AzureClusterSpec struct { - // NetworkSpec encapsulates all things related to Azure network. - NetworkSpec NetworkSpec `json:"networkSpec,omitempty"` - - // +optional - ResourceGroup string `json:"resourceGroup,omitempty"` - - // +optional - SubscriptionID string `json:"subscriptionID,omitempty"` - - Location string `json:"location"` - - // ControlPlaneEndpoint represents the endpoint used to communicate with the control plane. - // +optional - ControlPlaneEndpoint clusterv1alpha4.APIEndpoint `json:"controlPlaneEndpoint"` - - // AdditionalTags is an optional set of tags to add to Azure resources managed by the Azure provider, in addition to the - // ones added by default. - // +optional - AdditionalTags Tags `json:"additionalTags,omitempty"` - - // IdentityRef is a reference to an AzureIdentity to be used when reconciling this cluster - // +optional - IdentityRef *corev1.ObjectReference `json:"identityRef,omitempty"` - - // AzureEnvironment is the name of the AzureCloud to be used. - // The default value that would be used by most users is "AzurePublicCloud", other values are: - // - ChinaCloud: "AzureChinaCloud" - // - GermanCloud: "AzureGermanCloud" - // - PublicCloud: "AzurePublicCloud" - // - USGovernmentCloud: "AzureUSGovernmentCloud" - // +optional - AzureEnvironment string `json:"azureEnvironment,omitempty"` - - // BastionSpec encapsulates all things related to the Bastions in the cluster. - // +optional - BastionSpec BastionSpec `json:"bastionSpec,omitempty"` - - // CloudProviderConfigOverrides is an optional set of configuration values that can be overridden in azure cloud provider config. - // This is only a subset of options that are available in azure cloud provider config. - // Some values for the cloud provider config are inferred from other parts of cluster api provider azure spec, and may not be available for overrides. - // See: https://kubernetes-sigs.github.io/cloud-provider-azure/install/configs - // Note: All cloud provider config values can be customized by creating the secret beforehand. CloudProviderConfigOverrides is only used when the secret is managed by the Azure Provider. - // +optional - CloudProviderConfigOverrides *CloudProviderConfigOverrides `json:"cloudProviderConfigOverrides,omitempty"` -} - -// AzureClusterStatus defines the observed state of AzureCluster. -type AzureClusterStatus struct { - // FailureDomains specifies the list of unique failure domains for the location/region of the cluster. - // A FailureDomain maps to Availability Zone with an Azure Region (if the region support them). An - // Availability Zone is a separate data center within a region and they can be used to ensure - // the cluster is more resilient to failure. - // See: https://learn.microsoft.com/azure/reliability/availability-zones-overview - // This list will be used by Cluster API to try and spread the machines across the failure domains. - FailureDomains clusterv1alpha4.FailureDomains `json:"failureDomains,omitempty"` - - // Ready is true when the provider resource is ready. - // +optional - Ready bool `json:"ready"` - - // Conditions defines current service state of the AzureCluster. - // +optional - Conditions clusterv1alpha4.Conditions `json:"conditions,omitempty"` - - // LongRunningOperationStates saves the states for Azure long-running operations so they can be continued on the - // next reconciliation loop. - // +optional - LongRunningOperationStates Futures `json:"longRunningOperationStates,omitempty"` -} - -// +kubebuilder:object:root=true -// +kubebuilder:printcolumn:name="Cluster",type="string",JSONPath=".metadata.labels.cluster\\.x-k8s\\.io/cluster-name",description="Cluster to which this AzureCluster belongs" -// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" -// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].reason" -// +kubebuilder:printcolumn:name="Message",type="string",priority=1,JSONPath=".status.conditions[?(@.type=='Ready')].message" -// +kubebuilder:printcolumn:name="Resource Group",type="string",priority=1,JSONPath=".spec.resourceGroup" -// +kubebuilder:printcolumn:name="SubscriptionID",type="string",priority=1,JSONPath=".spec.subscriptionID" -// +kubebuilder:printcolumn:name="Location",type="string",priority=1,JSONPath=".spec.location" -// +kubebuilder:printcolumn:name="Endpoint",type="string",priority=1,JSONPath=".spec.controlPlaneEndpoint.host",description="Control Plane Endpoint" -// +kubebuilder:resource:path=azureclusters,scope=Namespaced,categories=cluster-api -// +kubebuilder:subresource:status - -// AzureCluster is the Schema for the azureclusters API. -type AzureCluster struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec AzureClusterSpec `json:"spec,omitempty"` - Status AzureClusterStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// AzureClusterList contains a list of AzureClusters. -type AzureClusterList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []AzureCluster `json:"items"` -} - -// GetConditions returns the list of conditions for an AzureCluster API object. -func (c *AzureCluster) GetConditions() clusterv1alpha4.Conditions { - return c.Status.Conditions -} - -// SetConditions will set the given conditions on an AzureCluster object. -func (c *AzureCluster) SetConditions(conditions clusterv1alpha4.Conditions) { - c.Status.Conditions = conditions -} - -// GetFutures returns the list of long running operation states for an AzureCluster API object. -func (c *AzureCluster) GetFutures() Futures { - return c.Status.LongRunningOperationStates -} - -// SetFutures will set the given long running operation states on an AzureCluster object. -func (c *AzureCluster) SetFutures(futures Futures) { - c.Status.LongRunningOperationStates = futures -} - -func init() { - SchemeBuilder.Register(&AzureCluster{}, &AzureClusterList{}) -} diff --git a/api/v1alpha4/azureclusteridentity_conversion.go b/api/v1alpha4/azureclusteridentity_conversion.go deleted file mode 100644 index a7390a7abc2..00000000000 --- a/api/v1alpha4/azureclusteridentity_conversion.go +++ /dev/null @@ -1,46 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha4 - -import ( - infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" - "sigs.k8s.io/controller-runtime/pkg/conversion" -) - -// ConvertTo converts this AzureCluster to the Hub version (v1beta1). -func (src *AzureClusterIdentity) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*infrav1.AzureClusterIdentity) - return Convert_v1alpha4_AzureClusterIdentity_To_v1beta1_AzureClusterIdentity(src, dst, nil) -} - -// ConvertFrom converts from the Hub version (v1beta1) to this version. -func (dst *AzureClusterIdentity) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*infrav1.AzureClusterIdentity) - return Convert_v1beta1_AzureClusterIdentity_To_v1alpha4_AzureClusterIdentity(src, dst, nil) -} - -// ConvertTo converts this AzureCluster to the Hub version (v1beta1). -func (src *AzureClusterIdentityList) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*infrav1.AzureClusterIdentityList) - return Convert_v1alpha4_AzureClusterIdentityList_To_v1beta1_AzureClusterIdentityList(src, dst, nil) -} - -// ConvertFrom converts from the Hub version (v1beta1) to this version. -func (dst *AzureClusterIdentityList) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*infrav1.AzureClusterIdentityList) - return Convert_v1beta1_AzureClusterIdentityList_To_v1alpha4_AzureClusterIdentityList(src, dst, nil) -} diff --git a/api/v1alpha4/azureclusteridentity_types.go b/api/v1alpha4/azureclusteridentity_types.go deleted file mode 100644 index 4c376aa842c..00000000000 --- a/api/v1alpha4/azureclusteridentity_types.go +++ /dev/null @@ -1,110 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha4 - -import ( - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" -) - -// AllowedNamespaces defines the namespaces the clusters are allowed to use the identity from -// NamespaceList takes precedence over the Selector. -type AllowedNamespaces struct { - // A nil or empty list indicates that AzureCluster cannot use the identity from any namespace. - // - // +optional - // +nullable - NamespaceList []string `json:"list"` - // Selector is a selector of namespaces that AzureCluster can - // use this Identity from. This is a standard Kubernetes LabelSelector, - // a label query over a set of resources. The result of matchLabels and - // matchExpressions are ANDed. - // - // A nil or empty selector indicates that AzureCluster cannot use this - // AzureClusterIdentity from any namespace. - // +optional - Selector *metav1.LabelSelector `json:"selector"` -} - -// AzureClusterIdentitySpec defines the parameters that are used to create an AzureIdentity. -type AzureClusterIdentitySpec struct { - // UserAssignedMSI or Service Principal - Type IdentityType `json:"type"` - // User assigned MSI resource id. - // +optional - ResourceID string `json:"resourceID,omitempty"` - // Both User Assigned MSI and SP can use this field. - ClientID string `json:"clientID"` - // ClientSecret is a secret reference which should contain either a Service Principal password or certificate secret. - // +optional - ClientSecret corev1.SecretReference `json:"clientSecret,omitempty"` - // Service principal primary tenant id. - TenantID string `json:"tenantID"` - // AllowedNamespaces is used to identify the namespaces the clusters are allowed to use the identity from. - // Namespaces can be selected either using an array of namespaces or with label selector. - // An empty allowedNamespaces object indicates that AzureClusters can use this identity from any namespace. - // If this object is nil, no namespaces will be allowed (default behaviour, if this field is not provided) - // A namespace should be either in the NamespaceList or match with Selector to use the identity. - // - // +optional - // +nullable - AllowedNamespaces *AllowedNamespaces `json:"allowedNamespaces"` -} - -// AzureClusterIdentityStatus defines the observed state of AzureClusterIdentity. -type AzureClusterIdentityStatus struct { - // Conditions defines current service state of the AzureClusterIdentity. - // +optional - Conditions clusterv1alpha4.Conditions `json:"conditions,omitempty"` -} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:path=azureclusteridentities,scope=Namespaced,categories=cluster-api -// +kubebuilder:subresource:status - -// AzureClusterIdentity is the Schema for the azureclustersidentities API. -type AzureClusterIdentity struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec AzureClusterIdentitySpec `json:"spec,omitempty"` - Status AzureClusterIdentityStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// AzureClusterIdentityList contains a list of AzureClusterIdentity. -type AzureClusterIdentityList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []AzureClusterIdentity `json:"items"` -} - -// GetConditions returns the list of conditions for an AzureClusterIdentity API object. -func (c *AzureClusterIdentity) GetConditions() clusterv1alpha4.Conditions { - return c.Status.Conditions -} - -// SetConditions will set the given conditions on an AzureClusterIdentity object. -func (c *AzureClusterIdentity) SetConditions(conditions clusterv1alpha4.Conditions) { - c.Status.Conditions = conditions -} - -func init() { - SchemeBuilder.Register(&AzureClusterIdentity{}, &AzureClusterIdentityList{}) -} diff --git a/api/v1alpha4/azuremachine_conversion.go b/api/v1alpha4/azuremachine_conversion.go deleted file mode 100644 index d292b3e1c3f..00000000000 --- a/api/v1alpha4/azuremachine_conversion.go +++ /dev/null @@ -1,128 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha4 - -import ( - apiconversion "k8s.io/apimachinery/pkg/conversion" - infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" - utilconversion "sigs.k8s.io/cluster-api/util/conversion" - "sigs.k8s.io/controller-runtime/pkg/conversion" -) - -// ConvertTo converts this AzureMachine to the Hub version (v1beta1). -func (src *AzureMachine) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*infrav1.AzureMachine) - if err := Convert_v1alpha4_AzureMachine_To_v1beta1_AzureMachine(src, dst, nil); err != nil { - return err - } - - // Manually restore data from annotations - restored := &infrav1.AzureMachine{} - if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { - return err - } - - if restored.Spec.Image != nil && restored.Spec.Image.ComputeGallery != nil { - dst.Spec.Image.ComputeGallery = restored.Spec.Image.ComputeGallery - } - - if restored.Spec.AdditionalCapabilities != nil { - dst.Spec.AdditionalCapabilities = restored.Spec.AdditionalCapabilities - } - - if len(restored.Spec.DNSServers) > 0 { - dst.Spec.DNSServers = restored.Spec.DNSServers - } - - if len(restored.Spec.VMExtensions) > 0 { - dst.Spec.VMExtensions = restored.Spec.VMExtensions - } - - if restored.Spec.SpotVMOptions != nil && restored.Spec.SpotVMOptions.EvictionPolicy != nil { - dst.Spec.SpotVMOptions.EvictionPolicy = restored.Spec.SpotVMOptions.EvictionPolicy - } - - if restored.Spec.Diagnostics != nil { - dst.Spec.Diagnostics = restored.Spec.Diagnostics - } - - if restored.Spec.NetworkInterfaces != nil { - dst.Spec.NetworkInterfaces = restored.Spec.NetworkInterfaces - } - - if restored.Spec.SystemAssignedIdentityRole != nil { - dst.Spec.SystemAssignedIdentityRole = restored.Spec.SystemAssignedIdentityRole - } - - return nil -} - -// ConvertFrom converts from the Hub version (v1beta1) to this version. -func (dst *AzureMachine) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*infrav1.AzureMachine) - if err := Convert_v1beta1_AzureMachine_To_v1alpha4_AzureMachine(src, dst, nil); err != nil { - return err - } - - // Preserve Hub data on down-conversion. - return utilconversion.MarshalData(src, dst) -} - -// ConvertTo converts this AzureMachineList to the Hub version (v1beta1). -func (src *AzureMachineList) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*infrav1.AzureMachineList) - return Convert_v1alpha4_AzureMachineList_To_v1beta1_AzureMachineList(src, dst, nil) -} - -// ConvertFrom converts from the Hub version (v1beta1) to this version. -func (dst *AzureMachineList) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*infrav1.AzureMachineList) - return Convert_v1beta1_AzureMachineList_To_v1alpha4_AzureMachineList(src, dst, nil) -} - -// Convert_v1beta1_AzureMarketplaceImage_To_v1alpha4_AzureMarketplaceImage converts an Azure Marketplace image from v1beta1 to v1alpha4. -func Convert_v1beta1_AzureMarketplaceImage_To_v1alpha4_AzureMarketplaceImage(in *infrav1.AzureMarketplaceImage, out *AzureMarketplaceImage, s apiconversion.Scope) error { - out.Offer = in.ImagePlan.Offer - out.Publisher = in.ImagePlan.Publisher - out.SKU = in.ImagePlan.SKU - - return autoConvert_v1beta1_AzureMarketplaceImage_To_v1alpha4_AzureMarketplaceImage(in, out, s) -} - -// Convert_v1alpha4_AzureMarketplaceImage_To_v1beta1_AzureMarketplaceImage converts an Azure Marketplace image from v1alpha4 to v1beta1. -func Convert_v1alpha4_AzureMarketplaceImage_To_v1beta1_AzureMarketplaceImage(in *AzureMarketplaceImage, out *infrav1.AzureMarketplaceImage, s apiconversion.Scope) error { - out.ImagePlan.Offer = in.Offer - out.ImagePlan.Publisher = in.Publisher - out.ImagePlan.SKU = in.SKU - - return autoConvert_v1alpha4_AzureMarketplaceImage_To_v1beta1_AzureMarketplaceImage(in, out, s) -} - -// Convert_v1beta1_Image_To_v1alpha4_Image converts an image from v1beta1 to v1alpha4. -func Convert_v1beta1_Image_To_v1alpha4_Image(in *infrav1.Image, out *Image, s apiconversion.Scope) error { - return autoConvert_v1beta1_Image_To_v1alpha4_Image(in, out, s) -} - -// Convert_v1beta1_AzureMachineSpec_To_v1alpha4_AzureMachineSpec is an autogenerated conversion function. -func Convert_v1beta1_AzureMachineSpec_To_v1alpha4_AzureMachineSpec(in *infrav1.AzureMachineSpec, out *AzureMachineSpec, s apiconversion.Scope) error { - return autoConvert_v1beta1_AzureMachineSpec_To_v1alpha4_AzureMachineSpec(in, out, s) -} - -// Convert_v1beta1_SpotVMOptions_To_v1alpha4_SpotVMOptions converts SpotVMOptions from v1beta1 to v1alpha4. -func Convert_v1beta1_SpotVMOptions_To_v1alpha4_SpotVMOptions(in *infrav1.SpotVMOptions, out *SpotVMOptions, s apiconversion.Scope) error { - return autoConvert_v1beta1_SpotVMOptions_To_v1alpha4_SpotVMOptions(in, out, s) -} diff --git a/api/v1alpha4/azuremachine_types.go b/api/v1alpha4/azuremachine_types.go deleted file mode 100644 index 18ea9a08ae2..00000000000 --- a/api/v1alpha4/azuremachine_types.go +++ /dev/null @@ -1,235 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha4 - -import ( - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/resource" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" - "sigs.k8s.io/cluster-api/errors" -) - -const ( - // MachineFinalizer allows ReconcileAzureMachine to clean up Azure resources associated with AzureMachine before - // removing it from the apiserver. - MachineFinalizer = "azuremachine.infrastructure.cluster.x-k8s.io" -) - -// AzureMachineSpec defines the desired state of AzureMachine. -type AzureMachineSpec struct { - // ProviderID is the unique identifier as specified by the cloud provider. - // +optional - ProviderID *string `json:"providerID,omitempty"` - - VMSize string `json:"vmSize"` - - // FailureDomain is the failure domain unique identifier this Machine should be attached to, - // as defined in Cluster API. This relates to an Azure Availability Zone - FailureDomain *string `json:"failureDomain,omitempty"` - - // Image is used to provide details of an image to use during VM creation. - // If image details are omitted the image will default the Azure Marketplace "capi" offer, - // which is based on Ubuntu. - // +kubebuilder:validation:nullable - // +optional - Image *Image `json:"image,omitempty"` - - // Identity is the type of identity used for the virtual machine. - // The type 'SystemAssigned' is an implicitly created identity. - // The generated identity will be assigned a Subscription contributor role. - // The type 'UserAssigned' is a standalone Azure resource provided by the user - // and assigned to the VM - // +kubebuilder:default=None - // +optional - Identity VMIdentity `json:"identity,omitempty"` - - // UserAssignedIdentities is a list of standalone Azure identities provided by the user - // The lifecycle of a user-assigned identity is managed separately from the lifecycle of - // the AzureMachine. - // See https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/how-to-manage-ua-identity-cli - // +optional - UserAssignedIdentities []UserAssignedIdentity `json:"userAssignedIdentities,omitempty"` - - // RoleAssignmentName is the name of the role assignment to create for a system assigned identity. It can be any valid GUID. - // If not specified, a random GUID will be generated. - // +optional - RoleAssignmentName string `json:"roleAssignmentName,omitempty"` - - // OSDisk specifies the parameters for the operating system disk of the machine - OSDisk OSDisk `json:"osDisk"` - - // DataDisk specifies the parameters that are used to add one or more data disks to the machine - DataDisks []DataDisk `json:"dataDisks,omitempty"` - - SSHPublicKey string `json:"sshPublicKey"` - - // AdditionalTags is an optional set of tags to add to an instance, in addition to the ones added by default by the - // Azure provider. If both the AzureCluster and the AzureMachine specify the same tag name with different values, the - // AzureMachine's value takes precedence. - // +optional - AdditionalTags Tags `json:"additionalTags,omitempty"` - - // AllocatePublicIP allows the ability to create dynamic public ips for machines where this value is true. - // +optional - AllocatePublicIP bool `json:"allocatePublicIP,omitempty"` - - // EnableIPForwarding enables IP Forwarding in Azure which is required for some CNI's to send traffic from a pods on one machine - // to another. This is required for IpV6 with Calico in combination with User Defined Routes (set by the Azure Cloud Controller - // manager). Default is false for disabled. - // +optional - EnableIPForwarding bool `json:"enableIPForwarding,omitempty"` - - // AcceleratedNetworking enables or disables Azure accelerated networking. If omitted, it will be set based on - // whether the requested VMSize supports accelerated networking. - // If AcceleratedNetworking is set to true with a VMSize that does not support it, Azure will return an error. - // +kubebuilder:validation:nullable - // +optional - AcceleratedNetworking *bool `json:"acceleratedNetworking,omitempty"` - - // SpotVMOptions allows the ability to specify the Machine should use a Spot VM - // +optional - SpotVMOptions *SpotVMOptions `json:"spotVMOptions,omitempty"` - - // SecurityProfile specifies the Security profile settings for a virtual machine. - // +optional - SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"` - - // SubnetName selects the Subnet where the VM will be placed - // +optional - SubnetName string `json:"subnetName,omitempty"` -} - -// SpotVMOptions defines the options relevant to running the Machine on Spot VMs. -type SpotVMOptions struct { - // MaxPrice defines the maximum price the user is willing to pay for Spot VM instances - // +optional - MaxPrice *resource.Quantity `json:"maxPrice,omitempty"` -} - -// AzureMachineStatus defines the observed state of AzureMachine. -type AzureMachineStatus struct { - // Ready is true when the provider resource is ready. - // +optional - Ready bool `json:"ready"` - - // Addresses contains the Azure instance associated addresses. - Addresses []corev1.NodeAddress `json:"addresses,omitempty"` - - // VMState is the provisioning state of the Azure virtual machine. - // +optional - VMState *ProvisioningState `json:"vmState,omitempty"` - - // ErrorReason will be set in the event that there is a terminal problem - // reconciling the Machine and will contain a succinct value suitable - // for machine interpretation. - // - // This field should not be set for transitive errors that a controller - // faces that are expected to be fixed automatically over - // time (like service outages), but instead indicate that something is - // fundamentally wrong with the Machine's spec or the configuration of - // the controller, and that manual intervention is required. Examples - // of terminal errors would be invalid combinations of settings in the - // spec, values that are unsupported by the controller, or the - // responsible controller itself being critically misconfigured. - // - // Any transient errors that occur during the reconciliation of Machines - // can be added as events to the Machine object and/or logged in the - // controller's output. - // +optional - FailureReason *errors.MachineStatusError `json:"failureReason,omitempty"` - - // ErrorMessage will be set in the event that there is a terminal problem - // reconciling the Machine and will contain a more verbose string suitable - // for logging and human consumption. - // - // This field should not be set for transitive errors that a controller - // faces that are expected to be fixed automatically over - // time (like service outages), but instead indicate that something is - // fundamentally wrong with the Machine's spec or the configuration of - // the controller, and that manual intervention is required. Examples - // of terminal errors would be invalid combinations of settings in the - // spec, values that are unsupported by the controller, or the - // responsible controller itself being critically misconfigured. - // - // Any transient errors that occur during the reconciliation of Machines - // can be added as events to the Machine object and/or logged in the - // controller's output. - // +optional - FailureMessage *string `json:"failureMessage,omitempty"` - - // Conditions defines current service state of the AzureMachine. - // +optional - Conditions clusterv1alpha4.Conditions `json:"conditions,omitempty"` - - // LongRunningOperationStates saves the states for Azure long-running operations so they can be continued on the - // next reconciliation loop. - // +optional - LongRunningOperationStates Futures `json:"longRunningOperationStates,omitempty"` -} - -// +kubebuilder:object:root=true -// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.ready",description="AzureMachine ready status" -// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.vmState",description="Azure VM provisioning state" -// +kubebuilder:printcolumn:name="Cluster",type="string",priority=1,JSONPath=".metadata.labels.cluster\\.x-k8s\\.io/cluster-name",description="Cluster to which this AzureMachine belongs" -// +kubebuilder:printcolumn:name="Machine",type="string",priority=1,JSONPath=".metadata.ownerReferences[?(@.kind==\"Machine\")].name",description="Machine object to which this AzureMachine belongs" -// +kubebuilder:printcolumn:name="VM ID",type="string",priority=1,JSONPath=".spec.providerID",description="Azure VM ID" -// +kubebuilder:printcolumn:name="VM Size",type="string",priority=1,JSONPath=".spec.vmSize",description="Azure VM Size" -// +kubebuilder:resource:path=azuremachines,scope=Namespaced,categories=cluster-api -// +kubebuilder:subresource:status - -// AzureMachine is the Schema for the azuremachines API. -type AzureMachine struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec AzureMachineSpec `json:"spec,omitempty"` - Status AzureMachineStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// AzureMachineList contains a list of AzureMachine. -type AzureMachineList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []AzureMachine `json:"items"` -} - -// GetConditions returns the list of conditions for an AzureMachine API object. -func (m *AzureMachine) GetConditions() clusterv1alpha4.Conditions { - return m.Status.Conditions -} - -// SetConditions will set the given conditions on an AzureMachine object. -func (m *AzureMachine) SetConditions(conditions clusterv1alpha4.Conditions) { - m.Status.Conditions = conditions -} - -// GetFutures returns the list of long running operation states for an AzureMachine API object. -func (m *AzureMachine) GetFutures() Futures { - return m.Status.LongRunningOperationStates -} - -// SetFutures will set the given long running operation states on an AzureMachine object. -func (m *AzureMachine) SetFutures(futures Futures) { - m.Status.LongRunningOperationStates = futures -} - -func init() { - SchemeBuilder.Register(&AzureMachine{}, &AzureMachineList{}) -} diff --git a/api/v1alpha4/azuremachinetemplate_conversion.go b/api/v1alpha4/azuremachinetemplate_conversion.go deleted file mode 100644 index 204f359074e..00000000000 --- a/api/v1alpha4/azuremachinetemplate_conversion.go +++ /dev/null @@ -1,102 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha4 - -import ( - apimachineryconversion "k8s.io/apimachinery/pkg/conversion" - infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" - utilconversion "sigs.k8s.io/cluster-api/util/conversion" - "sigs.k8s.io/controller-runtime/pkg/conversion" -) - -// ConvertTo converts this AzureMachineTemplate to the Hub version (v1beta1). -func (src *AzureMachineTemplate) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*infrav1.AzureMachineTemplate) - if err := Convert_v1alpha4_AzureMachineTemplate_To_v1beta1_AzureMachineTemplate(src, dst, nil); err != nil { - return err - } - - // Restore missing fields from annotations - restored := &infrav1.AzureMachineTemplate{} - if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { - return err - } - - if dst.Spec.Template.Spec.Image != nil && restored.Spec.Template.Spec.Image.ComputeGallery != nil { - dst.Spec.Template.Spec.Image.ComputeGallery = restored.Spec.Template.Spec.Image.ComputeGallery - } - - if restored.Spec.Template.Spec.AdditionalCapabilities != nil { - dst.Spec.Template.Spec.AdditionalCapabilities = restored.Spec.Template.Spec.AdditionalCapabilities - } - - if restored.Spec.Template.Spec.Diagnostics != nil { - dst.Spec.Template.Spec.Diagnostics = restored.Spec.Template.Spec.Diagnostics - } - - dst.Spec.Template.ObjectMeta = restored.Spec.Template.ObjectMeta - - if len(restored.Spec.Template.Spec.DNSServers) > 0 { - dst.Spec.Template.Spec.DNSServers = restored.Spec.Template.Spec.DNSServers - } - - if len(restored.Spec.Template.Spec.VMExtensions) > 0 { - dst.Spec.Template.Spec.VMExtensions = restored.Spec.Template.Spec.VMExtensions - } - - if restored.Spec.Template.Spec.SpotVMOptions != nil && restored.Spec.Template.Spec.SpotVMOptions.EvictionPolicy != nil { - dst.Spec.Template.Spec.SpotVMOptions.EvictionPolicy = restored.Spec.Template.Spec.SpotVMOptions.EvictionPolicy - } - - if restored.Spec.Template.Spec.NetworkInterfaces != nil { - dst.Spec.Template.Spec.NetworkInterfaces = restored.Spec.Template.Spec.NetworkInterfaces - } - - if restored.Spec.Template.Spec.SystemAssignedIdentityRole != nil { - dst.Spec.Template.Spec.SystemAssignedIdentityRole = restored.Spec.Template.Spec.SystemAssignedIdentityRole - } - - return nil -} - -// ConvertFrom converts from the Hub version (v1beta1) to this version. -func (dst *AzureMachineTemplate) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*infrav1.AzureMachineTemplate) - if err := Convert_v1beta1_AzureMachineTemplate_To_v1alpha4_AzureMachineTemplate(src, dst, nil); err != nil { - return err - } - - // Preserve Hub data on down-conversion. - return utilconversion.MarshalData(src, dst) -} - -// ConvertTo converts this AzureMachineTemplateList to the Hub version (v1beta1). -func (src *AzureMachineTemplateList) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*infrav1.AzureMachineTemplateList) - return Convert_v1alpha4_AzureMachineTemplateList_To_v1beta1_AzureMachineTemplateList(src, dst, nil) -} - -// ConvertFrom converts from the Hub version (v1beta1) to this version. -func (dst *AzureMachineTemplateList) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*infrav1.AzureMachineTemplateList) - return Convert_v1beta1_AzureMachineTemplateList_To_v1alpha4_AzureMachineTemplateList(src, dst, nil) -} - -// Convert_v1beta1_AzureMachineTemplateResource_To_v1alpha4_AzureMachineTemplateResource converts an Azure Machine Template Resource from v1beta1 to v1alpha4. -func Convert_v1beta1_AzureMachineTemplateResource_To_v1alpha4_AzureMachineTemplateResource(in *infrav1.AzureMachineTemplateResource, out *AzureMachineTemplateResource, s apimachineryconversion.Scope) error { - return autoConvert_v1beta1_AzureMachineTemplateResource_To_v1alpha4_AzureMachineTemplateResource(in, out, s) -} diff --git a/api/v1alpha4/azuremachinetemplate_types.go b/api/v1alpha4/azuremachinetemplate_types.go deleted file mode 100644 index a9224a4dd8b..00000000000 --- a/api/v1alpha4/azuremachinetemplate_types.go +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha4 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// AzureMachineTemplateSpec defines the desired state of AzureMachineTemplate. -type AzureMachineTemplateSpec struct { - Template AzureMachineTemplateResource `json:"template"` -} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:path=azuremachinetemplates,scope=Namespaced,categories=cluster-api - -// AzureMachineTemplate is the Schema for the azuremachinetemplates API. -type AzureMachineTemplate struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec AzureMachineTemplateSpec `json:"spec,omitempty"` -} - -// +kubebuilder:object:root=true - -// AzureMachineTemplateList contains a list of AzureMachineTemplates. -type AzureMachineTemplateList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []AzureMachineTemplate `json:"items"` -} - -func init() { - SchemeBuilder.Register(&AzureMachineTemplate{}, &AzureMachineTemplateList{}) -} - -// AzureMachineTemplateResource describes the data needed to create an AzureMachine from a template. -type AzureMachineTemplateResource struct { - // Spec is the specification of the desired behavior of the machine. - Spec AzureMachineSpec `json:"spec"` -} diff --git a/api/v1alpha4/azuremanagedcluster_conversion.go b/api/v1alpha4/azuremanagedcluster_conversion.go deleted file mode 100644 index dac118b2112..00000000000 --- a/api/v1alpha4/azuremanagedcluster_conversion.go +++ /dev/null @@ -1,46 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha4 - -import ( - infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" - "sigs.k8s.io/controller-runtime/pkg/conversion" -) - -// ConvertTo converts this AzureManagedCluster to the Hub version (v1beta1). -func (src *AzureManagedCluster) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*infrav1.AzureManagedCluster) - return Convert_v1alpha4_AzureManagedCluster_To_v1beta1_AzureManagedCluster(src, dst, nil) -} - -// ConvertFrom converts from the Hub version (v1beta1) to this version. -func (dst *AzureManagedCluster) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*infrav1.AzureManagedCluster) - return Convert_v1beta1_AzureManagedCluster_To_v1alpha4_AzureManagedCluster(src, dst, nil) -} - -// ConvertTo converts this AzureManagedClusterList to the Hub version (v1beta1). -func (src *AzureManagedClusterList) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*infrav1.AzureManagedClusterList) - return Convert_v1alpha4_AzureManagedClusterList_To_v1beta1_AzureManagedClusterList(src, dst, nil) -} - -// ConvertFrom converts from the Hub version (v1beta1) to this version. -func (dst *AzureManagedClusterList) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*infrav1.AzureManagedClusterList) - return Convert_v1beta1_AzureManagedClusterList_To_v1alpha4_AzureManagedClusterList(src, dst, nil) -} diff --git a/api/v1alpha4/azuremanagedcluster_types.go b/api/v1alpha4/azuremanagedcluster_types.go deleted file mode 100644 index f41076140c3..00000000000 --- a/api/v1alpha4/azuremanagedcluster_types.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha4 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" -) - -// AzureManagedClusterSpec defines the desired state of AzureManagedCluster. -type AzureManagedClusterSpec struct { - // ControlPlaneEndpoint represents the endpoint used to communicate with the control plane. - // +optional - ControlPlaneEndpoint clusterv1alpha4.APIEndpoint `json:"controlPlaneEndpoint"` -} - -// AzureManagedClusterStatus defines the observed state of AzureManagedCluster. -type AzureManagedClusterStatus struct { - // Ready is true when the provider resource is ready. - // +optional - Ready bool `json:"ready,omitempty"` -} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:path=azuremanagedclusters,scope=Namespaced,categories=cluster-api,shortName=amc -// +kubebuilder:subresource:status - -// AzureManagedCluster is the Schema for the azuremanagedclusters API. -type AzureManagedCluster struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec AzureManagedClusterSpec `json:"spec,omitempty"` - Status AzureManagedClusterStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// AzureManagedClusterList contains a list of AzureManagedClusters. -type AzureManagedClusterList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []AzureManagedCluster `json:"items"` -} - -func init() { - SchemeBuilder.Register(&AzureManagedCluster{}, &AzureManagedClusterList{}) -} diff --git a/api/v1alpha4/azuremanagedcontrolplane_conversion.go b/api/v1alpha4/azuremanagedcontrolplane_conversion.go deleted file mode 100644 index 8f40560976e..00000000000 --- a/api/v1alpha4/azuremanagedcontrolplane_conversion.go +++ /dev/null @@ -1,95 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha4 - -import ( - apiconversion "k8s.io/apimachinery/pkg/conversion" - infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" - utilconversion "sigs.k8s.io/cluster-api/util/conversion" - "sigs.k8s.io/controller-runtime/pkg/conversion" -) - -// ConvertTo converts this AzureManagedControlPlane to the Hub version (v1beta1). -func (src *AzureManagedControlPlane) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*infrav1.AzureManagedControlPlane) - if err := Convert_v1alpha4_AzureManagedControlPlane_To_v1beta1_AzureManagedControlPlane(src, dst, nil); err != nil { - return err - } - - // Manually restore data. - restored := &infrav1.AzureManagedControlPlane{} - if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { - return err - } - - dst.Spec.AddonProfiles = restored.Spec.AddonProfiles - dst.Status.Conditions = restored.Status.Conditions - dst.Spec.VirtualNetwork.ResourceGroup = restored.Spec.VirtualNetwork.ResourceGroup - dst.Spec.VirtualNetwork.Subnet.ServiceEndpoints = restored.Spec.VirtualNetwork.Subnet.ServiceEndpoints - dst.Spec.VirtualNetwork.Subnet.PrivateEndpoints = restored.Spec.VirtualNetwork.Subnet.PrivateEndpoints - dst.Spec.AutoScalerProfile = restored.Spec.AutoScalerProfile - dst.Spec.OutboundType = restored.Spec.OutboundType - - return nil -} - -// ConvertFrom converts from the Hub version (v1beta1) to this version. -func (dst *AzureManagedControlPlane) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*infrav1.AzureManagedControlPlane) - if err := Convert_v1beta1_AzureManagedControlPlane_To_v1alpha4_AzureManagedControlPlane(src, dst, nil); err != nil { - return err - } - - // Preserve Hub data on down-conversion. - return utilconversion.MarshalData(src, dst) -} - -// Convert_v1beta1_AzureManagedControlPlaneSpec_To_v1alpha4_AzureManagedControlPlaneSpec is an autogenerated conversion function. -func Convert_v1beta1_AzureManagedControlPlaneSpec_To_v1alpha4_AzureManagedControlPlaneSpec(in *infrav1.AzureManagedControlPlaneSpec, out *AzureManagedControlPlaneSpec, s apiconversion.Scope) error { - return autoConvert_v1beta1_AzureManagedControlPlaneSpec_To_v1alpha4_AzureManagedControlPlaneSpec(in, out, s) -} - -// Convert_v1beta1_AzureManagedControlPlaneStatus_To_v1alpha4_AzureManagedControlPlaneStatus is an autogenerated conversion function. -func Convert_v1beta1_AzureManagedControlPlaneStatus_To_v1alpha4_AzureManagedControlPlaneStatus(in *infrav1.AzureManagedControlPlaneStatus, out *AzureManagedControlPlaneStatus, s apiconversion.Scope) error { - return autoConvert_v1beta1_AzureManagedControlPlaneStatus_To_v1alpha4_AzureManagedControlPlaneStatus(in, out, s) -} - -// ConvertTo converts this AzureManagedControlPlaneList to the Hub version (v1beta1). -func (src *AzureManagedControlPlaneList) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*infrav1.AzureManagedControlPlaneList) - return Convert_v1alpha4_AzureManagedControlPlaneList_To_v1beta1_AzureManagedControlPlaneList(src, dst, nil) -} - -// ConvertFrom converts from the Hub version (v1beta1) to this version. -func (dst *AzureManagedControlPlaneList) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*infrav1.AzureManagedControlPlaneList) - return Convert_v1beta1_AzureManagedControlPlaneList_To_v1alpha4_AzureManagedControlPlaneList(src, dst, nil) -} - -// Convert_v1beta1_ManagedControlPlaneVirtualNetwork_To_v1alpha4_ManagedControlPlaneVirtualNetwork converts v1beta1 ManagedControlPlaneVirtualNetwork to v1alpha4 ManagedControlPlaneVirtualNetwork. -func Convert_v1beta1_ManagedControlPlaneVirtualNetwork_To_v1alpha4_ManagedControlPlaneVirtualNetwork(in *infrav1.ManagedControlPlaneVirtualNetwork, out *ManagedControlPlaneVirtualNetwork, s apiconversion.Scope) error { - out.Name = in.Name - out.Subnet.Name = in.Subnet.Name - out.Subnet.CIDRBlock = in.Subnet.CIDRBlock - out.CIDRBlock = in.CIDRBlock - return nil -} - -// Convert_v1beta1_ManagedControlPlaneSubnet_To_v1alpha4_ManagedControlPlaneSubnet converts v1beta1 ManagedControlPlaneSubnet to v1alpha4 ManagedControlPlaneSubnet. -func Convert_v1beta1_ManagedControlPlaneSubnet_To_v1alpha4_ManagedControlPlaneSubnet(in *infrav1.ManagedControlPlaneSubnet, out *ManagedControlPlaneSubnet, s apiconversion.Scope) error { - return autoConvert_v1beta1_ManagedControlPlaneSubnet_To_v1alpha4_ManagedControlPlaneSubnet(in, out, s) -} diff --git a/api/v1alpha4/azuremanagedcontrolplane_types.go b/api/v1alpha4/azuremanagedcontrolplane_types.go deleted file mode 100644 index 4c0933ed2f0..00000000000 --- a/api/v1alpha4/azuremanagedcontrolplane_types.go +++ /dev/null @@ -1,238 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha4 - -import ( - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" -) - -const ( - // PrivateDNSZoneModeSystem represents mode System for azuremanagedcontrolplane. - PrivateDNSZoneModeSystem string = "System" - - // PrivateDNSZoneModeNone represents mode None for azuremanagedcontrolplane. - PrivateDNSZoneModeNone string = "None" -) - -// AzureManagedControlPlaneSpec defines the desired state of AzureManagedControlPlane. -type AzureManagedControlPlaneSpec struct { - // Version defines the desired Kubernetes version. - // +kubebuilder:validation:MinLength:=2 - Version string `json:"version"` - - // ResourceGroupName is the name of the Azure resource group for this AKS Cluster. - ResourceGroupName string `json:"resourceGroupName"` - - // NodeResourceGroupName is the name of the resource group - // containing cluster IaaS resources. Will be populated to default - // in webhook. - // +optional - NodeResourceGroupName string `json:"nodeResourceGroupName,omitempty"` - - // VirtualNetwork describes the vnet for the AKS cluster. Will be created if it does not exist. - VirtualNetwork ManagedControlPlaneVirtualNetwork `json:"virtualNetwork,omitempty"` - - // SubscriptionID is the GUID of the Azure subscription to hold this cluster. - SubscriptionID string `json:"subscriptionID,omitempty"` - - // Location is a string matching one of the canonical Azure region names. Examples: "westus2", "eastus". - Location string `json:"location"` - - // ControlPlaneEndpoint represents the endpoint used to communicate with the control plane. - // +optional - ControlPlaneEndpoint clusterv1alpha4.APIEndpoint `json:"controlPlaneEndpoint"` - - // AdditionalTags is an optional set of tags to add to Azure resources managed by the Azure provider, in addition to the - // ones added by default. - // +optional - AdditionalTags Tags `json:"additionalTags,omitempty"` - - // NetworkPlugin used for building Kubernetes network. - // +kubebuilder:validation:Enum=azure;kubenet - // +optional - NetworkPlugin *string `json:"networkPlugin,omitempty"` - - // NetworkPolicy used for building Kubernetes network. - // +kubebuilder:validation:Enum=azure;calico - // +optional - NetworkPolicy *string `json:"networkPolicy,omitempty"` - - // SSHPublicKey is a string literal containing an ssh public key base64 encoded. - SSHPublicKey string `json:"sshPublicKey"` - - // DNSServiceIP is an IP address assigned to the Kubernetes DNS service. - // It must be within the Kubernetes service address range specified in serviceCidr. - // +optional - DNSServiceIP *string `json:"dnsServiceIP,omitempty"` - - // LoadBalancerSKU is the SKU of the loadBalancer to be provisioned. - // +kubebuilder:validation:Enum=Basic;Standard - // +optional - LoadBalancerSKU *string `json:"loadBalancerSKU,omitempty"` - - // IdentityRef is a reference to a AzureClusterIdentity to be used when reconciling this cluster - // +optional - IdentityRef *corev1.ObjectReference `json:"identityRef,omitempty"` - - // AadProfile is Azure Active Directory configuration to integrate with AKS for aad authentication. - // +optional - AADProfile *AADProfile `json:"aadProfile,omitempty"` - - // SKU is the AKSSku of the AKS to be provisioned. - // +optional - SKU *AKSSku `json:"sku,omitempty"` - - // LoadBalancerProfile is the profile of the cluster load balancer. - // +optional - LoadBalancerProfile *LoadBalancerProfile `json:"loadBalancerProfile,omitempty"` - - // APIServerAccessProfile is the access profile for AKS API server. - // +optional - APIServerAccessProfile *APIServerAccessProfile `json:"apiServerAccessProfile,omitempty"` -} - -// AADProfile - AAD integration managed by AKS. -type AADProfile struct { - // Managed - Whether to enable managed AAD. - // +kubebuilder:validation:Required - Managed bool `json:"managed"` - - // AdminGroupObjectIDs - AAD group object IDs that will have admin role of the cluster. - // +kubebuilder:validation:Required - AdminGroupObjectIDs []string `json:"adminGroupObjectIDs"` -} - -// AKSSku - AKS SKU. -type AKSSku struct { - // Tier - Tier of a managed cluster SKU. - // +kubebuilder:validation:Enum=Free;Paid - Tier string `json:"tier"` -} - -// LoadBalancerProfile - Profile of the cluster load balancer. -type LoadBalancerProfile struct { - // Load balancer profile must specify at most one of ManagedOutboundIPs, OutboundIPPrefixes and OutboundIPs. - // By default the AKS cluster automatically creates a public IP in the AKS-managed infrastructure resource group and assigns it to the load balancer outbound pool. - // Alternatively, you can assign your own custom public IP or public IP prefix at cluster creation time. - // See https://docs.microsoft.com/en-us/azure/aks/load-balancer-standard#provide-your-own-outbound-public-ips-or-prefixes - - // ManagedOutboundIPs - Desired managed outbound IPs for the cluster load balancer. - // +optional - ManagedOutboundIPs *int32 `json:"managedOutboundIPs,omitempty"` - - // OutboundIPPrefixes - Desired outbound IP Prefix resources for the cluster load balancer. - // +optional - OutboundIPPrefixes []string `json:"outboundIPPrefixes,omitempty"` - - // OutboundIPs - Desired outbound IP resources for the cluster load balancer. - // +optional - OutboundIPs []string `json:"outboundIPs,omitempty"` - - // AllocatedOutboundPorts - Desired number of allocated SNAT ports per VM. Allowed values must be in the range of 0 to 64000 (inclusive). The default value is 0 which results in Azure dynamically allocating ports. - // +optional - AllocatedOutboundPorts *int32 `json:"allocatedOutboundPorts,omitempty"` - - // IdleTimeoutInMinutes - Desired outbound flow idle timeout in minutes. Allowed values must be in the range of 4 to 120 (inclusive). The default value is 30 minutes. - // +optional - IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` -} - -// APIServerAccessProfile - access profile for AKS API server. -type APIServerAccessProfile struct { - // AuthorizedIPRanges - Authorized IP Ranges to kubernetes API server. - // +optional - AuthorizedIPRanges []string `json:"authorizedIPRanges,omitempty"` - // EnablePrivateCluster - Whether to create the cluster as a private cluster or not. - // +optional - EnablePrivateCluster *bool `json:"enablePrivateCluster,omitempty"` - // PrivateDNSZone - Private dns zone mode for private cluster. - // +kubebuilder:validation:Enum=System;None - // +optional - PrivateDNSZone *string `json:"privateDNSZone,omitempty"` - // EnablePrivateClusterPublicFQDN - Whether to create additional public FQDN for private cluster or not. - // +optional - EnablePrivateClusterPublicFQDN *bool `json:"enablePrivateClusterPublicFQDN,omitempty"` -} - -// ManagedControlPlaneVirtualNetwork describes a virtual network required to provision AKS clusters. -type ManagedControlPlaneVirtualNetwork struct { - Name string `json:"name"` - CIDRBlock string `json:"cidrBlock"` - Subnet ManagedControlPlaneSubnet `json:"subnet,omitempty"` -} - -// ManagedControlPlaneSubnet describes a subnet for an AKS cluster. -type ManagedControlPlaneSubnet struct { - Name string `json:"name"` - CIDRBlock string `json:"cidrBlock"` -} - -// AzureManagedControlPlaneStatus defines the observed state of AzureManagedControlPlane. -type AzureManagedControlPlaneStatus struct { - // Ready is true when the provider resource is ready. - // +optional - Ready bool `json:"ready,omitempty"` - - // Initialized is true when the the control plane is available for initial contact. - // This may occur before the control plane is fully ready. - // In the AzureManagedControlPlane implementation, these are identical. - // +optional - Initialized bool `json:"initialized,omitempty"` - - // LongRunningOperationStates saves the states for Azure long-running operations so they can be continued on the - // next reconciliation loop. - // +optional - LongRunningOperationStates Futures `json:"longRunningOperationStates,omitempty"` -} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:path=azuremanagedcontrolplanes,scope=Namespaced,categories=cluster-api,shortName=amcp -// +kubebuilder:subresource:status - -// AzureManagedControlPlane is the Schema for the azuremanagedcontrolplanes API. -type AzureManagedControlPlane struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec AzureManagedControlPlaneSpec `json:"spec,omitempty"` - Status AzureManagedControlPlaneStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// AzureManagedControlPlaneList contains a list of AzureManagedControlPlane. -type AzureManagedControlPlaneList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []AzureManagedControlPlane `json:"items"` -} - -// GetFutures returns the list of long running operation states for an AzureManagedControlPlane API object. -func (m *AzureManagedControlPlane) GetFutures() Futures { - return m.Status.LongRunningOperationStates -} - -// SetFutures will set the given long running operation states on an AzureManagedControlPlane object. -func (m *AzureManagedControlPlane) SetFutures(futures Futures) { - m.Status.LongRunningOperationStates = futures -} - -func init() { - SchemeBuilder.Register(&AzureManagedControlPlane{}, &AzureManagedControlPlaneList{}) -} diff --git a/api/v1alpha4/azuremanagedmachinepool_conversion.go b/api/v1alpha4/azuremanagedmachinepool_conversion.go deleted file mode 100644 index ecd45c152c5..00000000000 --- a/api/v1alpha4/azuremanagedmachinepool_conversion.go +++ /dev/null @@ -1,96 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha4 - -import ( - apiconversion "k8s.io/apimachinery/pkg/conversion" - infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" - utilconversion "sigs.k8s.io/cluster-api/util/conversion" - "sigs.k8s.io/controller-runtime/pkg/conversion" -) - -// ConvertTo converts this AzureManagedMachinePool to the Hub version (v1beta1). -func (src *AzureManagedMachinePool) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*infrav1.AzureManagedMachinePool) - if err := Convert_v1alpha4_AzureManagedMachinePool_To_v1beta1_AzureManagedMachinePool(src, dst, nil); err != nil { - return err - } - - // Manually restore data. - restored := &infrav1.AzureManagedMachinePool{} - if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { - return err - } - - dst.Spec.Scaling = restored.Spec.Scaling - dst.Spec.Name = restored.Spec.Name - dst.Spec.Taints = restored.Spec.Taints - dst.Spec.AvailabilityZones = restored.Spec.AvailabilityZones - dst.Spec.MaxPods = restored.Spec.MaxPods - dst.Spec.OsDiskType = restored.Spec.OsDiskType - dst.Spec.OSType = restored.Spec.OSType - dst.Spec.NodeLabels = restored.Spec.NodeLabels - dst.Spec.EnableUltraSSD = restored.Spec.EnableUltraSSD - dst.Spec.EnableNodePublicIP = restored.Spec.EnableNodePublicIP - dst.Spec.NodePublicIPPrefixID = restored.Spec.NodePublicIPPrefixID - dst.Spec.ScaleSetPriority = restored.Spec.ScaleSetPriority - dst.Spec.AdditionalTags = restored.Spec.AdditionalTags - dst.Spec.KubeletDiskType = restored.Spec.KubeletDiskType - dst.Spec.LinuxOSConfig = restored.Spec.LinuxOSConfig - - if restored.Spec.KubeletConfig != nil { - dst.Spec.KubeletConfig = restored.Spec.KubeletConfig - } - - dst.Status.LongRunningOperationStates = restored.Status.LongRunningOperationStates - dst.Status.Conditions = restored.Status.Conditions - - return nil -} - -// ConvertFrom converts from the Hub version (v1beta1) to this version. -func (dst *AzureManagedMachinePool) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*infrav1.AzureManagedMachinePool) - if err := Convert_v1beta1_AzureManagedMachinePool_To_v1alpha4_AzureManagedMachinePool(src, dst, nil); err != nil { - return err - } - - // Preserve Hub data on down-conversion. - return utilconversion.MarshalData(src, dst) -} - -// Convert_v1beta1_AzureManagedMachinePoolSpec_To_v1alpha4_AzureManagedMachinePoolSpec is an autogenerated conversion function. -func Convert_v1beta1_AzureManagedMachinePoolSpec_To_v1alpha4_AzureManagedMachinePoolSpec(in *infrav1.AzureManagedMachinePoolSpec, out *AzureManagedMachinePoolSpec, s apiconversion.Scope) error { - return autoConvert_v1beta1_AzureManagedMachinePoolSpec_To_v1alpha4_AzureManagedMachinePoolSpec(in, out, s) -} - -// Convert_v1beta1_AzureManagedMachinePoolStatus_To_v1alpha4_AzureManagedMachinePoolStatus is an autogenerated conversion function. -func Convert_v1beta1_AzureManagedMachinePoolStatus_To_v1alpha4_AzureManagedMachinePoolStatus(in *infrav1.AzureManagedMachinePoolStatus, out *AzureManagedMachinePoolStatus, s apiconversion.Scope) error { - return autoConvert_v1beta1_AzureManagedMachinePoolStatus_To_v1alpha4_AzureManagedMachinePoolStatus(in, out, s) -} - -// ConvertTo converts this AzureManagedMachinePoolList to the Hub version (v1beta1). -func (src *AzureManagedMachinePoolList) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*infrav1.AzureManagedMachinePoolList) - return Convert_v1alpha4_AzureManagedMachinePoolList_To_v1beta1_AzureManagedMachinePoolList(src, dst, nil) -} - -// ConvertFrom converts from the Hub version (v1beta1) to this version. -func (dst *AzureManagedMachinePoolList) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*infrav1.AzureManagedMachinePoolList) - return Convert_v1beta1_AzureManagedMachinePoolList_To_v1alpha4_AzureManagedMachinePoolList(src, dst, nil) -} diff --git a/api/v1alpha4/azuremanagedmachinepool_types.go b/api/v1alpha4/azuremanagedmachinepool_types.go deleted file mode 100644 index 646c8a3b859..00000000000 --- a/api/v1alpha4/azuremanagedmachinepool_types.go +++ /dev/null @@ -1,108 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha4 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - capierrors "sigs.k8s.io/cluster-api/errors" -) - -const ( - // LabelAgentPoolMode represents mode of an agent pool. Possible values include: System, User. - LabelAgentPoolMode = "azuremanagedmachinepool.infrastructure.cluster.x-k8s.io/agentpoolmode" - - // NodePoolModeSystem represents mode system for azuremachinepool. - NodePoolModeSystem NodePoolMode = "System" - - // NodePoolModeUser represents mode user for azuremachinepool. - NodePoolModeUser NodePoolMode = "User" -) - -// NodePoolMode enumerates the values for agent pool mode. -type NodePoolMode string - -// AzureManagedMachinePoolSpec defines the desired state of AzureManagedMachinePool. -type AzureManagedMachinePoolSpec struct { - - // Name - name of the agent pool. If not specified, CAPZ uses the name of the CR as the agent pool name. - // +optional - Name *string `json:"name,omitempty"` - - // Mode - represents mode of an agent pool. Possible values include: System, User. - // +kubebuilder:validation:Enum=System;User - Mode string `json:"mode"` - - // SKU is the size of the VMs in the node pool. - SKU string `json:"sku"` - - // OSDiskSizeGB is the disk size for every machine in this agent pool. - // If you specify 0, it will apply the default osDisk size according to the vmSize specified. - OSDiskSizeGB *int32 `json:"osDiskSizeGB,omitempty"` - - // ProviderIDList is the unique identifier as specified by the cloud provider. - // +optional - ProviderIDList []string `json:"providerIDList,omitempty"` -} - -// AzureManagedMachinePoolStatus defines the observed state of AzureManagedMachinePool. -type AzureManagedMachinePoolStatus struct { - // Ready is true when the provider resource is ready. - // +optional - Ready bool `json:"ready"` - - // Replicas is the most recently observed number of replicas. - // +optional - Replicas int32 `json:"replicas"` - - // Any transient errors that occur during the reconciliation of Machines - // can be added as events to the Machine object and/or logged in the - // controller's output. - // +optional - ErrorReason *capierrors.MachineStatusError `json:"errorReason,omitempty"` - - // Any transient errors that occur during the reconciliation of Machines - // can be added as events to the Machine object and/or logged in the - // controller's output. - // +optional - ErrorMessage *string `json:"errorMessage,omitempty"` -} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:path=azuremanagedmachinepools,scope=Namespaced,categories=cluster-api,shortName=ammp -// +kubebuilder:subresource:status - -// AzureManagedMachinePool is the Schema for the azuremanagedmachinepools API. -type AzureManagedMachinePool struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec AzureManagedMachinePoolSpec `json:"spec,omitempty"` - Status AzureManagedMachinePoolStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// AzureManagedMachinePoolList contains a list of AzureManagedMachinePools. -type AzureManagedMachinePoolList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []AzureManagedMachinePool `json:"items"` -} - -func init() { - SchemeBuilder.Register(&AzureManagedMachinePool{}, &AzureManagedMachinePoolList{}) -} diff --git a/api/v1alpha4/conditions_consts.go b/api/v1alpha4/conditions_consts.go deleted file mode 100644 index 49ec91384ad..00000000000 --- a/api/v1alpha4/conditions_consts.go +++ /dev/null @@ -1,120 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha4 - -import clusterv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" - -// AzureCluster Conditions and Reasons. -const ( - // NetworkInfrastructureReadyCondition reports of current status of cluster infrastructure. - NetworkInfrastructureReadyCondition clusterv1alpha4.ConditionType = "NetworkInfrastructureReady" - // NamespaceNotAllowedByIdentity used to indicate cluster in a namespace not allowed by identity. - NamespaceNotAllowedByIdentity = "NamespaceNotAllowedByIdentity" -) - -// AzureMachine Conditions and Reasons. -const ( - // VMRunningCondition reports on current status of the Azure VM. - VMRunningCondition clusterv1alpha4.ConditionType = "VMRunning" - // VMCreatingReason used when the vm creation is in progress. - VMCreatingReason = "VMCreating" - // VMUpdatingReason used when the vm updating is in progress. - VMUpdatingReason = "VMUpdating" - // VMDeletingReason used when the vm is in a deleting state. - VMDeletingReason = "VMDeleting" - // VMProvisionFailedReason used for failures during vm provisioning. - VMProvisionFailedReason = "VMProvisionFailed" - // WaitingForClusterInfrastructureReason used when machine is waiting for cluster infrastructure to be ready before proceeding. - WaitingForClusterInfrastructureReason = "WaitingForClusterInfrastructure" - // WaitingForBootstrapDataReason used when machine is waiting for bootstrap data to be ready before proceeding. - WaitingForBootstrapDataReason = "WaitingForBootstrapData" - // BootstrapSucceededCondition reports the result of the execution of the bootstrap data on the machine. - BootstrapSucceededCondition = "BoostrapSucceeded" - // BootstrapInProgressReason is used to indicate the bootstrap data has not finished executing. - BootstrapInProgressReason = "BootstrapInProgress" - // BootstrapFailedReason is used to indicate the bootstrap process ran into an error. - BootstrapFailedReason = "BootstrapFailed" -) - -// AzureMachinePool Conditions and Reasons. -const ( - // ScaleSetRunningCondition reports on current status of the Azure Scale Set. - ScaleSetRunningCondition clusterv1alpha4.ConditionType = "ScaleSetRunning" - // ScaleSetCreatingReason used when the scale set creation is in progress. - ScaleSetCreatingReason = "ScaleSetCreating" - // ScaleSetUpdatingReason used when the scale set updating is in progress. - ScaleSetUpdatingReason = "ScaleSetUpdating" - // ScaleSetDeletingReason used when the scale set is in a deleting state. - ScaleSetDeletingReason = "ScaleSetDeleting" - // ScaleSetProvisionFailedReason used for failures during scale set provisioning. - ScaleSetProvisionFailedReason = "ScaleSetProvisionFailed" - - // ScaleSetDesiredReplicasCondition reports on the scaling state of the machine pool. - ScaleSetDesiredReplicasCondition clusterv1alpha4.ConditionType = "ScaleSetDesiredReplicas" - // ScaleSetScaleUpReason describes the machine pool scaling up. - ScaleSetScaleUpReason = "ScaleSetScalingUp" - // ScaleSetScaleDownReason describes the machine pool scaling down. - ScaleSetScaleDownReason = "ScaleSetScalingDown" - - // ScaleSetModelUpdatedCondition reports on the model state of the pool. - ScaleSetModelUpdatedCondition clusterv1alpha4.ConditionType = "ScaleSetModelUpdated" - // ScaleSetModelOutOfDateReason describes the machine pool model being out of date. - ScaleSetModelOutOfDateReason = "ScaleSetModelOutOfDate" -) - -// Azure Services Conditions and Reasons. -const ( - // ResourceGroupReadyCondition means the resource group exists and is ready to be used. - ResourceGroupReadyCondition clusterv1alpha4.ConditionType = "ResourceGroupReady" - // VNetReadyCondition means the virtual network exists and is ready to be used. - VNetReadyCondition clusterv1alpha4.ConditionType = "VNetReady" - // SecurityGroupsReadyCondition means the security groups exist and are ready to be used. - SecurityGroupsReadyCondition clusterv1alpha4.ConditionType = "SecurityGroupsReady" - // RouteTablesReadyCondition means the route tables exist and are ready to be used. - RouteTablesReadyCondition clusterv1alpha4.ConditionType = "RouteTablesReady" - // PublicIPsReadyCondition means the public IPs exist and are ready to be used. - PublicIPsReadyCondition clusterv1alpha4.ConditionType = "PublicIPsReady" - // NATGatewaysReadyCondition means the NAT gateways exist and are ready to be used. - NATGatewaysReadyCondition clusterv1alpha4.ConditionType = "NATGatewaysReady" - // SubnetsReadyCondition means the subnets exist and are ready to be used. - SubnetsReadyCondition clusterv1alpha4.ConditionType = "SubnetsReady" - // LoadBalancersReadyCondition means the load balancers exist and are ready to be used. - LoadBalancersReadyCondition clusterv1alpha4.ConditionType = "LoadBalancersReady" - // PrivateDNSReadyCondition means the private DNS exists and is ready to be used. - PrivateDNSReadyCondition clusterv1alpha4.ConditionType = "PrivateDNSReady" - // BastionHostReadyCondition means the bastion host exists and is ready to be used. - BastionHostReadyCondition clusterv1alpha4.ConditionType = "BastionHostReady" - // InboundNATRulesReadyCondition means the inbound NAT rules exist and are ready to be used. - InboundNATRulesReadyCondition clusterv1alpha4.ConditionType = "InboundNATRulesReady" - // AvailabilitySetReadyCondition means the availability set exists and is ready to be used. - AvailabilitySetReadyCondition clusterv1alpha4.ConditionType = "AvailabilitySetReady" - // RoleAssignmentReadyCondition means the role assignment exists and is ready to be used. - RoleAssignmentReadyCondition clusterv1alpha4.ConditionType = "RoleAssignmentReady" - - // CreatingReason means the resource is being created. - CreatingReason = "Creating" - // FailedReason means the resource failed to be created. - FailedReason = "Failed" - // DeletingReason means the resource is being deleted. - DeletingReason = "Deleting" - // DeletedReason means the resource was deleted. - DeletedReason = "Deleted" - // DeletionFailedReason means the resource failed to be deleted. - DeletionFailedReason = "DeletionFailed" - // UpdatingReason means the resource is being updated. - UpdatingReason = "Updating" -) diff --git a/api/v1alpha4/conversion_test.go b/api/v1alpha4/conversion_test.go deleted file mode 100644 index 66fcf12811c..00000000000 --- a/api/v1alpha4/conversion_test.go +++ /dev/null @@ -1,75 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha4 - -import ( - "testing" - - . "github.com/onsi/gomega" - "k8s.io/apimachinery/pkg/runtime" - infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" - utilconversion "sigs.k8s.io/cluster-api/util/conversion" -) - -func TestFuzzyConversion(t *testing.T) { - g := NewWithT(t) - scheme := runtime.NewScheme() - g.Expect(AddToScheme(scheme)).To(Succeed()) - g.Expect(infrav1.AddToScheme(scheme)).To(Succeed()) - - t.Run("for AzureCluster", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ - Scheme: scheme, - Hub: &infrav1.AzureCluster{}, - Spoke: &AzureCluster{}, - })) - - t.Run("for AzureMachine", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ - Scheme: scheme, - Hub: &infrav1.AzureMachine{}, - Spoke: &AzureMachine{}, - })) - - t.Run("for AzureMachineTemplate", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ - Scheme: scheme, - Hub: &infrav1.AzureMachineTemplate{}, - Spoke: &AzureMachineTemplate{}, - })) - - t.Run("for AzureClusterIdentity", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ - Scheme: scheme, - Hub: &infrav1.AzureClusterIdentity{}, - Spoke: &AzureClusterIdentity{}, - })) - - t.Run("for AzureManagedCluster", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ - Scheme: scheme, - Hub: &infrav1.AzureManagedCluster{}, - Spoke: &AzureManagedCluster{}, - })) - - t.Run("for AzureManagedControlPlane", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ - Scheme: scheme, - Hub: &infrav1.AzureManagedControlPlane{}, - Spoke: &AzureManagedControlPlane{}, - })) - - t.Run("for AzureManagedMachinePool", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ - Scheme: scheme, - Hub: &infrav1.AzureManagedMachinePool{}, - Spoke: &AzureManagedMachinePool{}, - })) -} diff --git a/api/v1alpha4/groupversion_info.go b/api/v1alpha4/groupversion_info.go deleted file mode 100644 index 728422c86d2..00000000000 --- a/api/v1alpha4/groupversion_info.go +++ /dev/null @@ -1,39 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha4 contains API Schema definitions for the infrastructure v1alpha4 API group -// +kubebuilder:object:generate=true -// +groupName=infrastructure.cluster.x-k8s.io -package v1alpha4 - -import ( - "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/scheme" -) - -var ( - // GroupVersion is group version used to register these objects. - GroupVersion = schema.GroupVersion{Group: "infrastructure.cluster.x-k8s.io", Version: "v1alpha4"} - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme. - SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} - - // AddToScheme adds the types in this group-version to the given scheme. - AddToScheme = SchemeBuilder.AddToScheme - - // localSchemeBuilder is used for type conversions. - localSchemeBuilder = SchemeBuilder.SchemeBuilder -) diff --git a/api/v1alpha4/tags.go b/api/v1alpha4/tags.go deleted file mode 100644 index a7adad92047..00000000000 --- a/api/v1alpha4/tags.go +++ /dev/null @@ -1,197 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha4 - -import ( - "fmt" - "reflect" -) - -// Tags defines a map of tags. -type Tags map[string]string - -// Equals returns true if the tags are equal. -func (t Tags) Equals(other Tags) bool { - return reflect.DeepEqual(t, other) -} - -// HasMatchingSpecVersionHash returns true if the resource has been tagged with a matching resource spec hash value. -func (t Tags) HasMatchingSpecVersionHash(hash string) bool { - value, ok := t[SpecVersionHashTagKey()] - return ok && value == hash -} - -// HasOwned returns true if the tags contains a tag that marks the resource as owned by the cluster from the perspective of this management tooling. -func (t Tags) HasOwned(cluster string) bool { - value, ok := t[ClusterTagKey(cluster)] - return ok && ResourceLifecycle(value) == ResourceLifecycleOwned -} - -// HasAzureCloudProviderOwned returns true if the tags contains a tag that marks the resource as owned by the cluster from the perspective of the in-tree cloud provider. -func (t Tags) HasAzureCloudProviderOwned(cluster string) bool { - value, ok := t[ClusterAzureCloudProviderTagKey(cluster)] - return ok && ResourceLifecycle(value) == ResourceLifecycleOwned -} - -// GetRole returns the Cluster API role for the tagged resource. -func (t Tags) GetRole() string { - return t[NameAzureClusterAPIRole] -} - -// Difference returns the difference between this map of tags and the other map of tags. -// Items are considered equals if key and value are equals. -func (t Tags) Difference(other Tags) Tags { - res := make(Tags, len(t)) - - for key, value := range t { - if otherValue, ok := other[key]; ok && value == otherValue { - continue - } - res[key] = value - } - - return res -} - -// Merge merges in tags from other. If a tag already exists, it is replaced by the tag in other. -func (t Tags) Merge(other Tags) { - for k, v := range other { - t[k] = v - } -} - -// AddSpecVersionHashTag adds a spec version hash to the Azure resource tags to determine quickly if state has changed. -func (t Tags) AddSpecVersionHashTag(hash string) Tags { - t[SpecVersionHashTagKey()] = hash - return t -} - -// ResourceLifecycle configures the lifecycle of a resource. -type ResourceLifecycle string - -const ( - // ResourceLifecycleOwned is the value we use when tagging resources to indicate - // that the resource is considered owned and managed by the cluster, - // and in particular that the lifecycle is tied to the lifecycle of the cluster. - ResourceLifecycleOwned = ResourceLifecycle("owned") - - // ResourceLifecycleShared is the value we use when tagging resources to indicate - // that the resource is shared between multiple clusters, and should not be destroyed - // if the cluster is destroyed. - ResourceLifecycleShared = ResourceLifecycle("shared") - - // NameKubernetesAzureCloudProviderPrefix is the tag name used by the cloud provider to logically - // separate independent cluster resources. We use it to identify which resources we expect - // to be permissive about state changes. - // logically independent clusters running in the same AZ. - // The tag key = NameKubernetesAzureCloudProviderPrefix + clusterID. - // The tag value is an ownership value. - NameKubernetesAzureCloudProviderPrefix = "kubernetes.io_cluster_" - - // NameAzureProviderPrefix is the tag prefix we use to differentiate - // cluster-api-provider-azure owned components from other tooling that - // uses NameKubernetesClusterPrefix. - NameAzureProviderPrefix = "sigs.k8s.io_cluster-api-provider-azure_" - - // NameAzureProviderOwned is the tag name we use to differentiate - // cluster-api-provider-azure owned components from other tooling that - // uses NameKubernetesClusterPrefix. - NameAzureProviderOwned = NameAzureProviderPrefix + "cluster_" - - // NameAzureClusterAPIRole is the tag name we use to mark roles for resources - // dedicated to this cluster api provider implementation. - NameAzureClusterAPIRole = NameAzureProviderPrefix + "role" - - // APIServerRole describes the value for the apiserver role. - APIServerRole = "apiserver" - - // NodeOutboundRole describes the value for the node outbound LB role. - NodeOutboundRole = "nodeOutbound" - - // ControlPlaneOutboundRole describes the value for the control plane outbound LB role. - ControlPlaneOutboundRole = "controlPlaneOutbound" - - // BastionRole describes the value for the bastion role. - BastionRole = "bastion" - - // CommonRole describes the value for the common role. - CommonRole = "common" - - // VMTagsLastAppliedAnnotation is the key for the machine object annotation - // which tracks the AdditionalTags in the Machine Provider Config. - // See https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ - // for annotation formatting rules. - VMTagsLastAppliedAnnotation = "sigs.k8s.io/cluster-api-provider-azure-last-applied-tags-vm" -) - -// SpecVersionHashTagKey is the key for the spec version hash used to enable quick spec difference comparison. -func SpecVersionHashTagKey() string { - return fmt.Sprintf("%s%s", NameAzureProviderPrefix, "spec-version-hash") -} - -// ClusterTagKey generates the key for resources associated with a cluster. -func ClusterTagKey(name string) string { - return fmt.Sprintf("%s%s", NameAzureProviderOwned, name) -} - -// ClusterAzureCloudProviderTagKey generates the key for resources associated a cluster's Azure cloud provider. -func ClusterAzureCloudProviderTagKey(name string) string { - return fmt.Sprintf("%s%s", NameKubernetesAzureCloudProviderPrefix, name) -} - -// BuildParams is used to build tags around an azure resource. -type BuildParams struct { - // Lifecycle determines the resource lifecycle. - Lifecycle ResourceLifecycle - - // ClusterName is the cluster associated with the resource. - ClusterName string - - // ResourceID is the unique identifier of the resource to be tagged. - ResourceID string - - // Name is the name of the resource, it's applied as the tag "Name" on Azure. - // +optional - Name *string - - // Role is the role associated to the resource. - // +optional - Role *string - - // Any additional tags to be added to the resource. - // +optional - Additional Tags -} - -// Build builds tags including the cluster tag and returns them in map form. -func Build(params BuildParams) Tags { - tags := make(Tags) - for k, v := range params.Additional { - tags[k] = v - } - - tags[ClusterTagKey(params.ClusterName)] = string(params.Lifecycle) - if params.Role != nil { - tags[NameAzureClusterAPIRole] = *params.Role - } - - if params.Name != nil { - tags["Name"] = *params.Name - } - - return tags -} diff --git a/api/v1alpha4/tags_test.go b/api/v1alpha4/tags_test.go deleted file mode 100644 index 3c8cac5f03f..00000000000 --- a/api/v1alpha4/tags_test.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha4 - -import ( - "testing" - - . "github.com/onsi/gomega" -) - -func TestTags_Merge(t *testing.T) { - g := NewWithT(t) - - tests := []struct { - name string - other Tags - expected Tags - }{ - { - name: "nil other", - other: nil, - expected: Tags{ - "a": "b", - "c": "d", - }, - }, - { - name: "empty other", - other: Tags{}, - expected: Tags{ - "a": "b", - "c": "d", - }, - }, - { - name: "disjoint", - other: Tags{ - "1": "2", - "3": "4", - }, - expected: Tags{ - "a": "b", - "c": "d", - "1": "2", - "3": "4", - }, - }, - { - name: "overlapping, other wins", - other: Tags{ - "1": "2", - "3": "4", - "a": "hello", - }, - expected: Tags{ - "a": "hello", - "c": "d", - "1": "2", - "3": "4", - }, - }, - } - for _, tc := range tests { - tc := tc - t.Run(tc.name, func(t *testing.T) { - t.Parallel() - tags := Tags{ - "a": "b", - "c": "d", - } - - tags.Merge(tc.other) - g.Expect(tags).To(Equal(tc.expected)) - }) - } -} diff --git a/api/v1alpha4/types.go b/api/v1alpha4/types.go deleted file mode 100644 index 663d231f7c0..00000000000 --- a/api/v1alpha4/types.go +++ /dev/null @@ -1,657 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha4 - -import ( - "github.com/pkg/errors" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/resource" -) - -const ( - // ControlPlane machine label. - ControlPlane string = "control-plane" - // Node machine label. - Node string = "node" -) - -// Futures is a slice of Future. -type Futures []Future - -const ( - // PatchFuture is a future that was derived from a PATCH request. - PatchFuture string = "PATCH" - // PutFuture is a future that was derived from a PUT request. - PutFuture string = "PUT" - // DeleteFuture is a future that was derived from a DELETE request. - DeleteFuture string = "DELETE" -) - -// Future contains the data needed for an Azure long-running operation to continue across reconcile loops. -type Future struct { - // Type describes the type of future, such as update, create, delete, etc. - Type string `json:"type"` - - // ResourceGroup is the Azure resource group for the resource. - // +optional - ResourceGroup string `json:"resourceGroup,omitempty"` - - // ServiceName is the name of the Azure service. - // Together with the name of the resource, this forms the unique identifier for the future. - ServiceName string `json:"serviceName"` - - // Name is the name of the Azure resource. - // Together with the service name, this forms the unique identifier for the future. - Name string `json:"name"` - - // Data is the base64 url encoded json Azure AutoRest Future. - Data string `json:"data,omitempty"` -} - -// NetworkSpec specifies what the Azure networking resources should look like. -type NetworkSpec struct { - // Vnet is the configuration for the Azure virtual network. - // +optional - Vnet VnetSpec `json:"vnet,omitempty"` - - // Subnets is the configuration for the control-plane subnet and the node subnet. - // +optional - Subnets Subnets `json:"subnets,omitempty"` - - // APIServerLB is the configuration for the control-plane load balancer. - // +optional - APIServerLB LoadBalancerSpec `json:"apiServerLB,omitempty"` - - // NodeOutboundLB is the configuration for the node outbound load balancer. - // +optional - NodeOutboundLB *LoadBalancerSpec `json:"nodeOutboundLB,omitempty"` - - // ControlPlaneOutboundLB is the configuration for the control-plane outbound load balancer. - // This is different from APIServerLB, and is used only in private clusters (optionally) for enabling outbound traffic. - // +optional - ControlPlaneOutboundLB *LoadBalancerSpec `json:"controlPlaneOutboundLB,omitempty"` - - // PrivateDNSZoneName defines the zone name for the Azure Private DNS. - // +optional - PrivateDNSZoneName string `json:"privateDNSZoneName,omitempty"` -} - -// VnetSpec configures an Azure virtual network. -type VnetSpec struct { - // ResourceGroup is the name of the resource group of the existing virtual network - // or the resource group where a managed virtual network should be created. - ResourceGroup string `json:"resourceGroup,omitempty"` - - // ID is the identifier of the virtual network this provider should use to create resources. - ID string `json:"id,omitempty"` - - // Name defines a name for the virtual network resource. - Name string `json:"name"` - - // CIDRBlocks defines the virtual network's address space, specified as one or more address prefixes in CIDR notation. - // +optional - CIDRBlocks []string `json:"cidrBlocks,omitempty"` - - // Tags is a collection of tags describing the resource. - // +optional - Tags Tags `json:"tags,omitempty"` -} - -// IsManaged returns true if the vnet is managed. -func (v *VnetSpec) IsManaged(clusterName string) bool { - return v.ID == "" || v.Tags.HasOwned(clusterName) -} - -// Subnets is a slice of Subnet. -type Subnets []SubnetSpec - -// SecurityGroup defines an Azure security group. -type SecurityGroup struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - SecurityRules SecurityRules `json:"securityRules,omitempty"` - Tags Tags `json:"tags,omitempty"` -} - -// RouteTable defines an Azure route table. -type RouteTable struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` -} - -// NatGateway defines an Azure Nat Gateway. -// NAT gateway resources are part of Vnet NAT and provide outbound Internet connectivity for subnets of a virtual network. -type NatGateway struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - NatGatewayIP PublicIPSpec `json:"ip,omitempty"` -} - -// SecurityGroupProtocol defines the protocol type for a security group rule. -type SecurityGroupProtocol string - -const ( - // SecurityGroupProtocolAll is a wildcard for all IP protocols. - SecurityGroupProtocolAll = SecurityGroupProtocol("*") - // SecurityGroupProtocolTCP represents the TCP protocol. - SecurityGroupProtocolTCP = SecurityGroupProtocol("Tcp") - // SecurityGroupProtocolUDP represents the UDP protocol. - SecurityGroupProtocolUDP = SecurityGroupProtocol("Udp") - // SecurityGroupProtocolICMP represents the ICMP protocol. - SecurityGroupProtocolICMP = SecurityGroupProtocol("Icmp") -) - -// SecurityRuleDirection defines the direction type for a security group rule. -type SecurityRuleDirection string - -const ( - // SecurityRuleDirectionInbound defines an ingress security rule. - SecurityRuleDirectionInbound = SecurityRuleDirection("Inbound") - - // SecurityRuleDirectionOutbound defines an egress security rule. - SecurityRuleDirectionOutbound = SecurityRuleDirection("Outbound") -) - -// SecurityRule defines an Azure security rule for security groups. -type SecurityRule struct { - // Name is a unique name within the network security group. - Name string `json:"name"` - // A description for this rule. Restricted to 140 chars. - Description string `json:"description"` - // Protocol specifies the protocol type. "Tcp", "Udp", "Icmp", or "*". - // +kubebuilder:validation:Enum=Tcp;Udp;Icmp;* - Protocol SecurityGroupProtocol `json:"protocol"` - // Direction indicates whether the rule applies to inbound, or outbound traffic. "Inbound" or "Outbound". - // +kubebuilder:validation:Enum=Inbound;Outbound - Direction SecurityRuleDirection `json:"direction"` - // Priority is a number between 100 and 4096. Each rule should have a unique value for priority. Rules are processed in priority order, with lower numbers processed before higher numbers. Once traffic matches a rule, processing stops. - Priority int32 `json:"priority,omitempty"` - // SourcePorts specifies source port or range. Integer or range between 0 and 65535. Asterix '*' can also be used to match all ports. - SourcePorts *string `json:"sourcePorts,omitempty"` - // DestinationPorts specifies the destination port or range. Integer or range between 0 and 65535. Asterix '*' can also be used to match all ports. - DestinationPorts *string `json:"destinationPorts,omitempty"` - // Source specifies the CIDR or source IP range. Asterix '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from. - Source *string `json:"source,omitempty"` - // Destination is the destination address prefix. CIDR or destination IP range. Asterix '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. - Destination *string `json:"destination,omitempty"` -} - -// SecurityRules is a slice of Azure security rules for security groups. -type SecurityRules []SecurityRule - -// LoadBalancerSpec defines an Azure load balancer. -type LoadBalancerSpec struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - SKU SKU `json:"sku,omitempty"` - FrontendIPs []FrontendIP `json:"frontendIPs,omitempty"` - Type LBType `json:"type,omitempty"` - // FrontendIPsCount specifies the number of frontend IP addresses for the load balancer. - FrontendIPsCount *int32 `json:"frontendIPsCount,omitempty"` - // IdleTimeoutInMinutes specifies the timeout for the TCP idle connection. - IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` -} - -// SKU defines an Azure load balancer SKU. -type SKU string - -const ( - // SKUStandard is the value for the Azure load balancer Standard SKU. - SKUStandard = SKU("Standard") -) - -// LBType defines an Azure load balancer Type. -type LBType string - -const ( - // Internal is the value for the Azure load balancer internal type. - Internal = LBType("Internal") - // Public is the value for the Azure load balancer public type. - Public = LBType("Public") -) - -// FrontendIP defines a load balancer frontend IP configuration. -type FrontendIP struct { - // +kubebuilder:validation:MinLength=1 - Name string `json:"name"` - // +optional - PrivateIPAddress string `json:"privateIP,omitempty"` - // +optional - PublicIP *PublicIPSpec `json:"publicIP,omitempty"` -} - -// PublicIPSpec defines the inputs to create an Azure public IP address. -type PublicIPSpec struct { - Name string `json:"name"` - // +optional - DNSName string `json:"dnsName,omitempty"` -} - -// VMState describes the state of an Azure virtual machine. -// Deprecated: use ProvisioningState. -type VMState string - -// ProvisioningState describes the provisioning state of an Azure resource. -type ProvisioningState string - -const ( - // Creating ... - Creating ProvisioningState = "Creating" - // Deleting ... - Deleting ProvisioningState = "Deleting" - // Failed ... - Failed ProvisioningState = "Failed" - // Migrating ... - Migrating ProvisioningState = "Migrating" - // Succeeded ... - Succeeded ProvisioningState = "Succeeded" - // Updating ... - Updating ProvisioningState = "Updating" - // Canceled represents an action which was initiated but terminated by the user before completion. - Canceled ProvisioningState = "Canceled" - // Deleted represents a deleted VM - // NOTE: This state is specific to capz, and does not have corresponding mapping in Azure API (https://docs.microsoft.com/en-us/azure/virtual-machines/states-billing#provisioning-states) - Deleted ProvisioningState = "Deleted" -) - -// VM describes an Azure virtual machine. -type VM struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - AvailabilityZone string `json:"availabilityZone,omitempty"` - // Hardware profile - VMSize string `json:"vmSize,omitempty"` - // Storage profile - Image Image `json:"image,omitempty"` - OSDisk OSDisk `json:"osDisk,omitempty"` - StartupScript string `json:"startupScript,omitempty"` - // State - The provisioning state, which only appears in the response. - State ProvisioningState `json:"vmState,omitempty"` - Identity VMIdentity `json:"identity,omitempty"` - Tags Tags `json:"tags,omitempty"` - - // Addresses contains the addresses associated with the Azure VM. - Addresses []corev1.NodeAddress `json:"addresses,omitempty"` -} - -// Image defines information about the image to use for VM creation. -// There are three ways to specify an image: by ID, Marketplace Image or SharedImageGallery -// One of ID, SharedImage or Marketplace should be set. -type Image struct { - // ID specifies an image to use by ID - // +optional - ID *string `json:"id,omitempty"` - - // SharedGallery specifies an image to use from an Azure Shared Image Gallery - // +optional - SharedGallery *AzureSharedGalleryImage `json:"sharedGallery,omitempty"` - - // Marketplace specifies an image to use from the Azure Marketplace - // +optional - Marketplace *AzureMarketplaceImage `json:"marketplace,omitempty"` -} - -// AzureMarketplaceImage defines an image in the Azure Marketplace to use for VM creation. -type AzureMarketplaceImage struct { - // Publisher is the name of the organization that created the image - // +kubebuilder:validation:MinLength=1 - Publisher string `json:"publisher"` - // Offer specifies the name of a group of related images created by the publisher. - // For example, UbuntuServer, WindowsServer - // +kubebuilder:validation:MinLength=1 - Offer string `json:"offer"` - // SKU specifies an instance of an offer, such as a major release of a distribution. - // For example, 18.04-LTS, 2019-Datacenter - // +kubebuilder:validation:MinLength=1 - SKU string `json:"sku"` - // Version specifies the version of an image sku. The allowed formats - // are Major.Minor.Build or 'latest'. Major, Minor, and Build are decimal numbers. - // Specify 'latest' to use the latest version of an image available at deploy time. - // Even if you use 'latest', the VM image will not automatically update after deploy - // time even if a new version becomes available. - // +kubebuilder:validation:MinLength=1 - Version string `json:"version"` - // ThirdPartyImage indicates the image is published by a third party publisher and a Plan - // will be generated for it. - // +kubebuilder:default=false - // +optional - ThirdPartyImage bool `json:"thirdPartyImage"` -} - -// AzureSharedGalleryImage defines an image in a Shared Image Gallery to use for VM creation. -type AzureSharedGalleryImage struct { - // SubscriptionID is the identifier of the subscription that contains the shared image gallery - // +kubebuilder:validation:MinLength=1 - SubscriptionID string `json:"subscriptionID"` - // ResourceGroup specifies the resource group containing the shared image gallery - // +kubebuilder:validation:MinLength=1 - ResourceGroup string `json:"resourceGroup"` - // Gallery specifies the name of the shared image gallery that contains the image - // +kubebuilder:validation:MinLength=1 - Gallery string `json:"gallery"` - // Name is the name of the image - // +kubebuilder:validation:MinLength=1 - Name string `json:"name"` - // Version specifies the version of the marketplace image. The allowed formats - // are Major.Minor.Build or 'latest'. Major, Minor, and Build are decimal numbers. - // Specify 'latest' to use the latest version of an image available at deploy time. - // Even if you use 'latest', the VM image will not automatically update after deploy - // time even if a new version becomes available. - // +kubebuilder:validation:MinLength=1 - Version string `json:"version"` - // Publisher is the name of the organization that created the image. - // This value will be used to add a `Plan` in the API request when creating the VM/VMSS resource. - // This is needed when the source image from which this SIG image was built requires the `Plan` to be used. - // +optional - Publisher *string `json:"publisher,omitempty"` - // Offer specifies the name of a group of related images created by the publisher. - // For example, UbuntuServer, WindowsServer - // This value will be used to add a `Plan` in the API request when creating the VM/VMSS resource. - // This is needed when the source image from which this SIG image was built requires the `Plan` to be used. - // +optional - Offer *string `json:"offer,omitempty"` - // SKU specifies an instance of an offer, such as a major release of a distribution. - // For example, 18.04-LTS, 2019-Datacenter - // This value will be used to add a `Plan` in the API request when creating the VM/VMSS resource. - // This is needed when the source image from which this SIG image was built requires the `Plan` to be used. - // +optional - SKU *string `json:"sku,omitempty"` -} - -// VMIdentity defines the identity of the virtual machine, if configured. -// +kubebuilder:validation:Enum=None;SystemAssigned;UserAssigned -type VMIdentity string - -const ( - // VMIdentityNone ... - VMIdentityNone VMIdentity = "None" - // VMIdentitySystemAssigned ... - VMIdentitySystemAssigned VMIdentity = "SystemAssigned" - // VMIdentityUserAssigned ... - VMIdentityUserAssigned VMIdentity = "UserAssigned" -) - -// UserAssignedIdentity defines the user-assigned identities provided -// by the user to be assigned to Azure resources. -type UserAssignedIdentity struct { - // ProviderID is the identification ID of the user-assigned Identity, the format of an identity is: - // 'azure:///subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}' - ProviderID string `json:"providerID"` -} - -const ( - // AzureIdentityBindingSelector is the label used to match with the AzureIdentityBinding - // For the controller to match an identity binding, it needs a [label] with the key `aadpodidbinding` - // whose value is that of the `selector:` field in the `AzureIdentityBinding`. - AzureIdentityBindingSelector = "capz-controller-aadpodidentity-selector" -) - -// IdentityType represents different types of identities. -// +kubebuilder:validation:Enum=ServicePrincipal;UserAssignedMSI -type IdentityType string - -const ( - // UserAssignedMSI represents a user-assigned identity. - UserAssignedMSI IdentityType = "UserAssignedMSI" - - // ServicePrincipal represents a service principal. - ServicePrincipal IdentityType = "ServicePrincipal" - - // ManualServicePrincipal represents a manual service principal. - ManualServicePrincipal IdentityType = "ManualServicePrincipal" -) - -// OSDisk defines the operating system disk for a VM. -// -// WARNING: this requires any updates to ManagedDisk to be manually converted. This is due to the odd issue with -// conversion-gen where the warning message generated uses a relative directory import rather than the fully -// qualified import when generating outside of the GOPATH. -type OSDisk struct { - OSType string `json:"osType"` - // DiskSizeGB is the size in GB to assign to the OS disk. - // Will have a default of 30GB if not provided - // +optional - DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` - // ManagedDisk specifies the Managed Disk parameters for the OS disk. - // +optional - ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` - DiffDiskSettings *DiffDiskSettings `json:"diffDiskSettings,omitempty"` - // CachingType specifies the caching requirements. - // +optional - // +kubebuilder:validation:Enum=None;ReadOnly;ReadWrite - CachingType string `json:"cachingType,omitempty"` -} - -// DataDisk specifies the parameters that are used to add one or more data disks to the machine. -type DataDisk struct { - // NameSuffix is the suffix to be appended to the machine name to generate the disk name. - // Each disk name will be in format _. - NameSuffix string `json:"nameSuffix"` - // DiskSizeGB is the size in GB to assign to the data disk. - DiskSizeGB int32 `json:"diskSizeGB"` - // ManagedDisk specifies the Managed Disk parameters for the data disk. - // +optional - ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` - // Lun Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. - // The value must be between 0 and 63. - Lun *int32 `json:"lun,omitempty"` - // CachingType specifies the caching requirements. - // +optional - // +kubebuilder:validation:Enum=None;ReadOnly;ReadWrite - CachingType string `json:"cachingType,omitempty"` -} - -// ManagedDiskParameters defines the parameters of a managed disk. -type ManagedDiskParameters struct { - // +optional - StorageAccountType string `json:"storageAccountType,omitempty"` - // +optional - DiskEncryptionSet *DiskEncryptionSetParameters `json:"diskEncryptionSet,omitempty"` -} - -// DiskEncryptionSetParameters defines disk encryption options. -type DiskEncryptionSetParameters struct { - // ID defines resourceID for diskEncryptionSet resource. It must be in the same subscription - ID string `json:"id,omitempty"` -} - -// DiffDiskSettings describe ephemeral disk settings for the os disk. -type DiffDiskSettings struct { - // Option enables ephemeral OS when set to "Local" - // See https://docs.microsoft.com/en-us/azure/virtual-machines/ephemeral-os-disks for full details - // +kubebuilder:validation:Enum=Local - Option string `json:"option"` -} - -// SubnetRole defines the unique role of a subnet. -type SubnetRole string - -const ( - // SubnetNode defines a Kubernetes workload node role. - SubnetNode = SubnetRole(Node) - - // SubnetControlPlane defines a Kubernetes control plane node role. - SubnetControlPlane = SubnetRole(ControlPlane) -) - -// SubnetSpec configures an Azure subnet. -type SubnetSpec struct { - // Role defines the subnet role (eg. Node, ControlPlane) - Role SubnetRole `json:"role,omitempty"` - - // ID defines a unique identifier to reference this resource. - // +optional - ID string `json:"id,omitempty"` - - // Name defines a name for the subnet resource. - Name string `json:"name"` - - // CIDRBlocks defines the subnet's address space, specified as one or more address prefixes in CIDR notation. - // +optional - CIDRBlocks []string `json:"cidrBlocks,omitempty"` - - // SecurityGroup defines the NSG (network security group) that should be attached to this subnet. - // +optional - SecurityGroup SecurityGroup `json:"securityGroup,omitempty"` - - // RouteTable defines the route table that should be attached to this subnet. - // +optional - RouteTable RouteTable `json:"routeTable,omitempty"` - - // NatGateway associated with this subnet. - // +optional - NatGateway NatGateway `json:"natGateway,omitempty"` -} - -// GetControlPlaneSubnet returns the cluster control plane subnet. -func (n *NetworkSpec) GetControlPlaneSubnet() (SubnetSpec, error) { - for _, sn := range n.Subnets { - if sn.Role == SubnetControlPlane { - return sn, nil - } - } - return SubnetSpec{}, errors.Errorf("no subnet found with role %s", SubnetControlPlane) -} - -// UpdateControlPlaneSubnet updates the cluster control plane subnet. -func (n *NetworkSpec) UpdateControlPlaneSubnet(subnet SubnetSpec) { - for i, sn := range n.Subnets { - if sn.Role == SubnetControlPlane { - n.Subnets[i] = subnet - } - } -} - -// UpdateNodeSubnet updates the cluster node subnet. -func (n *NetworkSpec) UpdateNodeSubnet(subnet SubnetSpec) { - for i, sn := range n.Subnets { - if sn.Role == SubnetNode { - n.Subnets[i] = subnet - } - } -} - -// IsNatGatewayEnabled returns whether or not a Nat Gateway is enabled on the subnet. -func (s SubnetSpec) IsNatGatewayEnabled() bool { - return s.NatGateway.Name != "" -} - -// SecurityProfile specifies the Security profile settings for a -// virtual machine or virtual machine scale set. -type SecurityProfile struct { - // This field indicates whether Host Encryption should be enabled - // or disabled for a virtual machine or virtual machine scale - // set. Default is disabled. - EncryptionAtHost *bool `json:"encryptionAtHost,omitempty"` -} - -// AddressRecord specifies a DNS record mapping a hostname to an IPV4 or IPv6 address. -type AddressRecord struct { - Hostname string - IP string -} - -// CloudProviderConfigOverrides represents the fields that can be overridden in azure cloud provider config. -type CloudProviderConfigOverrides struct { - RateLimits []RateLimitSpec `json:"rateLimits,omitempty"` - BackOffs BackOffConfig `json:"backOffs,omitempty"` -} - -// BackOffConfig indicates the back-off config options. -type BackOffConfig struct { - CloudProviderBackoff bool `json:"cloudProviderBackoff,omitempty"` - CloudProviderBackoffRetries int `json:"cloudProviderBackoffRetries,omitempty"` - CloudProviderBackoffExponent *resource.Quantity `json:"cloudProviderBackoffExponent,omitempty"` - CloudProviderBackoffDuration int `json:"cloudProviderBackoffDuration,omitempty"` - CloudProviderBackoffJitter *resource.Quantity `json:"cloudProviderBackoffJitter,omitempty"` -} - -// RateLimitSpec represents the rate limit configuration for a particular kind of resource. -// Eg. loadBalancerRateLimit is used to configure rate limits for load balancers. -// This eventually gets converted to CloudProviderRateLimitConfig that cloud-provider-azure expects. -// See: https://github.com/kubernetes-sigs/cloud-provider-azure/blob/d585c2031925b39c925624302f22f8856e29e352/pkg/provider/azure_ratelimit.go#L25 -// We cannot use CloudProviderRateLimitConfig directly because floating point values are not supported in controller-tools. -// See: https://github.com/kubernetes-sigs/controller-tools/issues/245 -type RateLimitSpec struct { - // Name is the name of the rate limit spec. - // +kubebuilder:validation:Enum=defaultRateLimit;routeRateLimit;subnetsRateLimit;interfaceRateLimit;routeTableRateLimit;loadBalancerRateLimit;publicIPAddressRateLimit;securityGroupRateLimit;virtualMachineRateLimit;storageAccountRateLimit;diskRateLimit;snapshotRateLimit;virtualMachineScaleSetRateLimit;virtualMachineSizesRateLimit;availabilitySetRateLimit - Name string `json:"name,omitempty"` - Config RateLimitConfig `json:"config,omitempty"` -} - -// RateLimitConfig indicates the rate limit config options. -type RateLimitConfig struct { - CloudProviderRateLimit bool `json:"cloudProviderRateLimit,omitempty"` - CloudProviderRateLimitQPS *resource.Quantity `json:"cloudProviderRateLimitQPS,omitempty"` - CloudProviderRateLimitBucket int `json:"cloudProviderRateLimitBucket,omitempty"` - CloudProviderRateLimitQPSWrite *resource.Quantity `json:"cloudProviderRateLimitQPSWrite,omitempty"` - CloudProviderRateLimitBucketWrite int `json:"cloudProviderRateLimitBucketWrite,omitempty"` -} - -const ( - // DefaultRateLimit ... - DefaultRateLimit = "defaultRateLimit" - // RouteRateLimit ... - RouteRateLimit = "routeRateLimit" - // SubnetsRateLimit ... - SubnetsRateLimit = "subnetsRateLimit" - // InterfaceRateLimit ... - InterfaceRateLimit = "interfaceRateLimit" - // RouteTableRateLimit ... - RouteTableRateLimit = "routeTableRateLimit" - // LoadBalancerRateLimit ... - LoadBalancerRateLimit = "loadBalancerRateLimit" - // PublicIPAddressRateLimit ... - PublicIPAddressRateLimit = "publicIPAddressRateLimit" - // SecurityGroupRateLimit ... - SecurityGroupRateLimit = "securityGroupRateLimit" - // VirtualMachineRateLimit ... - VirtualMachineRateLimit = "virtualMachineRateLimit" - // StorageAccountRateLimit ... - StorageAccountRateLimit = "storageAccountRateLimit" - // DiskRateLimit ... - DiskRateLimit = "diskRateLimit" - // SnapshotRateLimit ... - SnapshotRateLimit = "snapshotRateLimit" - // VirtualMachineScaleSetRateLimit ... - VirtualMachineScaleSetRateLimit = "virtualMachineScaleSetRateLimit" - // VirtualMachineSizesRateLimit ... - VirtualMachineSizesRateLimit = "virtualMachineSizesRateLimit" - // AvailabilitySetRateLimit ... - AvailabilitySetRateLimit = "availabilitySetRateLimit" -) - -// BastionSpec specifies how the Bastion feature should be set up for the cluster. -type BastionSpec struct { - // +optional - AzureBastion *AzureBastion `json:"azureBastion,omitempty"` -} - -// AzureBastion specifies how the Azure Bastion cloud component should be configured. -type AzureBastion struct { - // +optional - Name string `json:"name,omitempty"` - // +optional - Subnet SubnetSpec `json:"subnet,omitempty"` - // +optional - PublicIP PublicIPSpec `json:"publicIP,omitempty"` -} - -// IsTerminalProvisioningState returns true if the ProvisioningState is a terminal state for an Azure resource. -func IsTerminalProvisioningState(state ProvisioningState) bool { - return state == Failed || state == Succeeded -} diff --git a/api/v1alpha4/zz_generated.conversion.go b/api/v1alpha4/zz_generated.conversion.go deleted file mode 100644 index a42ae25ebe9..00000000000 --- a/api/v1alpha4/zz_generated.conversion.go +++ /dev/null @@ -1,2737 +0,0 @@ -//go:build !ignore_autogenerated_core_v1alpha4 -// +build !ignore_autogenerated_core_v1alpha4 - -/* -Copyright The Kubernetes Authors. - -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. -*/ - -// Code generated by conversion-gen-v0.23.1. DO NOT EDIT. - -package v1alpha4 - -import ( - unsafe "unsafe" - - corev1 "k8s.io/api/core/v1" - resource "k8s.io/apimachinery/pkg/api/resource" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - conversion "k8s.io/apimachinery/pkg/conversion" - runtime "k8s.io/apimachinery/pkg/runtime" - v1beta1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" - apiv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" - apiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" - errors "sigs.k8s.io/cluster-api/errors" -) - -func init() { - localSchemeBuilder.Register(RegisterConversions) -} - -// RegisterConversions adds conversion functions to the given scheme. -// Public to allow building arbitrary schemes. -func RegisterConversions(s *runtime.Scheme) error { - if err := s.AddGeneratedConversionFunc((*AADProfile)(nil), (*v1beta1.AADProfile)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AADProfile_To_v1beta1_AADProfile(a.(*AADProfile), b.(*v1beta1.AADProfile), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AADProfile)(nil), (*AADProfile)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AADProfile_To_v1alpha4_AADProfile(a.(*v1beta1.AADProfile), b.(*AADProfile), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AKSSku)(nil), (*v1beta1.AKSSku)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AKSSku_To_v1beta1_AKSSku(a.(*AKSSku), b.(*v1beta1.AKSSku), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AKSSku)(nil), (*AKSSku)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AKSSku_To_v1alpha4_AKSSku(a.(*v1beta1.AKSSku), b.(*AKSSku), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*APIServerAccessProfile)(nil), (*v1beta1.APIServerAccessProfile)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_APIServerAccessProfile_To_v1beta1_APIServerAccessProfile(a.(*APIServerAccessProfile), b.(*v1beta1.APIServerAccessProfile), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.APIServerAccessProfile)(nil), (*APIServerAccessProfile)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_APIServerAccessProfile_To_v1alpha4_APIServerAccessProfile(a.(*v1beta1.APIServerAccessProfile), b.(*APIServerAccessProfile), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AddressRecord)(nil), (*v1beta1.AddressRecord)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AddressRecord_To_v1beta1_AddressRecord(a.(*AddressRecord), b.(*v1beta1.AddressRecord), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AddressRecord)(nil), (*AddressRecord)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AddressRecord_To_v1alpha4_AddressRecord(a.(*v1beta1.AddressRecord), b.(*AddressRecord), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AllowedNamespaces)(nil), (*v1beta1.AllowedNamespaces)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AllowedNamespaces_To_v1beta1_AllowedNamespaces(a.(*AllowedNamespaces), b.(*v1beta1.AllowedNamespaces), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AllowedNamespaces)(nil), (*AllowedNamespaces)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AllowedNamespaces_To_v1alpha4_AllowedNamespaces(a.(*v1beta1.AllowedNamespaces), b.(*AllowedNamespaces), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureBastion)(nil), (*v1beta1.AzureBastion)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureBastion_To_v1beta1_AzureBastion(a.(*AzureBastion), b.(*v1beta1.AzureBastion), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureCluster)(nil), (*v1beta1.AzureCluster)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureCluster_To_v1beta1_AzureCluster(a.(*AzureCluster), b.(*v1beta1.AzureCluster), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureCluster)(nil), (*AzureCluster)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureCluster_To_v1alpha4_AzureCluster(a.(*v1beta1.AzureCluster), b.(*AzureCluster), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureClusterIdentity)(nil), (*v1beta1.AzureClusterIdentity)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureClusterIdentity_To_v1beta1_AzureClusterIdentity(a.(*AzureClusterIdentity), b.(*v1beta1.AzureClusterIdentity), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureClusterIdentity)(nil), (*AzureClusterIdentity)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureClusterIdentity_To_v1alpha4_AzureClusterIdentity(a.(*v1beta1.AzureClusterIdentity), b.(*AzureClusterIdentity), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureClusterIdentityList)(nil), (*v1beta1.AzureClusterIdentityList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureClusterIdentityList_To_v1beta1_AzureClusterIdentityList(a.(*AzureClusterIdentityList), b.(*v1beta1.AzureClusterIdentityList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureClusterIdentityList)(nil), (*AzureClusterIdentityList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureClusterIdentityList_To_v1alpha4_AzureClusterIdentityList(a.(*v1beta1.AzureClusterIdentityList), b.(*AzureClusterIdentityList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureClusterIdentitySpec)(nil), (*v1beta1.AzureClusterIdentitySpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureClusterIdentitySpec_To_v1beta1_AzureClusterIdentitySpec(a.(*AzureClusterIdentitySpec), b.(*v1beta1.AzureClusterIdentitySpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureClusterIdentitySpec)(nil), (*AzureClusterIdentitySpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureClusterIdentitySpec_To_v1alpha4_AzureClusterIdentitySpec(a.(*v1beta1.AzureClusterIdentitySpec), b.(*AzureClusterIdentitySpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureClusterIdentityStatus)(nil), (*v1beta1.AzureClusterIdentityStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureClusterIdentityStatus_To_v1beta1_AzureClusterIdentityStatus(a.(*AzureClusterIdentityStatus), b.(*v1beta1.AzureClusterIdentityStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureClusterIdentityStatus)(nil), (*AzureClusterIdentityStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureClusterIdentityStatus_To_v1alpha4_AzureClusterIdentityStatus(a.(*v1beta1.AzureClusterIdentityStatus), b.(*AzureClusterIdentityStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureClusterList)(nil), (*v1beta1.AzureClusterList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureClusterList_To_v1beta1_AzureClusterList(a.(*AzureClusterList), b.(*v1beta1.AzureClusterList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureClusterList)(nil), (*AzureClusterList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureClusterList_To_v1alpha4_AzureClusterList(a.(*v1beta1.AzureClusterList), b.(*AzureClusterList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureClusterStatus)(nil), (*v1beta1.AzureClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureClusterStatus_To_v1beta1_AzureClusterStatus(a.(*AzureClusterStatus), b.(*v1beta1.AzureClusterStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureClusterStatus)(nil), (*AzureClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureClusterStatus_To_v1alpha4_AzureClusterStatus(a.(*v1beta1.AzureClusterStatus), b.(*AzureClusterStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureMachine)(nil), (*v1beta1.AzureMachine)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureMachine_To_v1beta1_AzureMachine(a.(*AzureMachine), b.(*v1beta1.AzureMachine), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureMachine)(nil), (*AzureMachine)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMachine_To_v1alpha4_AzureMachine(a.(*v1beta1.AzureMachine), b.(*AzureMachine), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureMachineList)(nil), (*v1beta1.AzureMachineList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureMachineList_To_v1beta1_AzureMachineList(a.(*AzureMachineList), b.(*v1beta1.AzureMachineList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureMachineList)(nil), (*AzureMachineList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMachineList_To_v1alpha4_AzureMachineList(a.(*v1beta1.AzureMachineList), b.(*AzureMachineList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureMachineSpec)(nil), (*v1beta1.AzureMachineSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureMachineSpec_To_v1beta1_AzureMachineSpec(a.(*AzureMachineSpec), b.(*v1beta1.AzureMachineSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureMachineStatus)(nil), (*v1beta1.AzureMachineStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureMachineStatus_To_v1beta1_AzureMachineStatus(a.(*AzureMachineStatus), b.(*v1beta1.AzureMachineStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureMachineStatus)(nil), (*AzureMachineStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMachineStatus_To_v1alpha4_AzureMachineStatus(a.(*v1beta1.AzureMachineStatus), b.(*AzureMachineStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureMachineTemplate)(nil), (*v1beta1.AzureMachineTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureMachineTemplate_To_v1beta1_AzureMachineTemplate(a.(*AzureMachineTemplate), b.(*v1beta1.AzureMachineTemplate), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureMachineTemplate)(nil), (*AzureMachineTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMachineTemplate_To_v1alpha4_AzureMachineTemplate(a.(*v1beta1.AzureMachineTemplate), b.(*AzureMachineTemplate), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureMachineTemplateList)(nil), (*v1beta1.AzureMachineTemplateList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureMachineTemplateList_To_v1beta1_AzureMachineTemplateList(a.(*AzureMachineTemplateList), b.(*v1beta1.AzureMachineTemplateList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureMachineTemplateList)(nil), (*AzureMachineTemplateList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMachineTemplateList_To_v1alpha4_AzureMachineTemplateList(a.(*v1beta1.AzureMachineTemplateList), b.(*AzureMachineTemplateList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureMachineTemplateResource)(nil), (*v1beta1.AzureMachineTemplateResource)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureMachineTemplateResource_To_v1beta1_AzureMachineTemplateResource(a.(*AzureMachineTemplateResource), b.(*v1beta1.AzureMachineTemplateResource), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureMachineTemplateSpec)(nil), (*v1beta1.AzureMachineTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureMachineTemplateSpec_To_v1beta1_AzureMachineTemplateSpec(a.(*AzureMachineTemplateSpec), b.(*v1beta1.AzureMachineTemplateSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureMachineTemplateSpec)(nil), (*AzureMachineTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMachineTemplateSpec_To_v1alpha4_AzureMachineTemplateSpec(a.(*v1beta1.AzureMachineTemplateSpec), b.(*AzureMachineTemplateSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureManagedCluster)(nil), (*v1beta1.AzureManagedCluster)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureManagedCluster_To_v1beta1_AzureManagedCluster(a.(*AzureManagedCluster), b.(*v1beta1.AzureManagedCluster), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureManagedCluster)(nil), (*AzureManagedCluster)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureManagedCluster_To_v1alpha4_AzureManagedCluster(a.(*v1beta1.AzureManagedCluster), b.(*AzureManagedCluster), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureManagedClusterList)(nil), (*v1beta1.AzureManagedClusterList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureManagedClusterList_To_v1beta1_AzureManagedClusterList(a.(*AzureManagedClusterList), b.(*v1beta1.AzureManagedClusterList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureManagedClusterList)(nil), (*AzureManagedClusterList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureManagedClusterList_To_v1alpha4_AzureManagedClusterList(a.(*v1beta1.AzureManagedClusterList), b.(*AzureManagedClusterList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureManagedClusterSpec)(nil), (*v1beta1.AzureManagedClusterSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureManagedClusterSpec_To_v1beta1_AzureManagedClusterSpec(a.(*AzureManagedClusterSpec), b.(*v1beta1.AzureManagedClusterSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureManagedClusterSpec)(nil), (*AzureManagedClusterSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureManagedClusterSpec_To_v1alpha4_AzureManagedClusterSpec(a.(*v1beta1.AzureManagedClusterSpec), b.(*AzureManagedClusterSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureManagedClusterStatus)(nil), (*v1beta1.AzureManagedClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureManagedClusterStatus_To_v1beta1_AzureManagedClusterStatus(a.(*AzureManagedClusterStatus), b.(*v1beta1.AzureManagedClusterStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureManagedClusterStatus)(nil), (*AzureManagedClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureManagedClusterStatus_To_v1alpha4_AzureManagedClusterStatus(a.(*v1beta1.AzureManagedClusterStatus), b.(*AzureManagedClusterStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureManagedControlPlane)(nil), (*v1beta1.AzureManagedControlPlane)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureManagedControlPlane_To_v1beta1_AzureManagedControlPlane(a.(*AzureManagedControlPlane), b.(*v1beta1.AzureManagedControlPlane), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureManagedControlPlane)(nil), (*AzureManagedControlPlane)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureManagedControlPlane_To_v1alpha4_AzureManagedControlPlane(a.(*v1beta1.AzureManagedControlPlane), b.(*AzureManagedControlPlane), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureManagedControlPlaneList)(nil), (*v1beta1.AzureManagedControlPlaneList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureManagedControlPlaneList_To_v1beta1_AzureManagedControlPlaneList(a.(*AzureManagedControlPlaneList), b.(*v1beta1.AzureManagedControlPlaneList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureManagedControlPlaneList)(nil), (*AzureManagedControlPlaneList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureManagedControlPlaneList_To_v1alpha4_AzureManagedControlPlaneList(a.(*v1beta1.AzureManagedControlPlaneList), b.(*AzureManagedControlPlaneList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureManagedControlPlaneSpec)(nil), (*v1beta1.AzureManagedControlPlaneSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureManagedControlPlaneSpec_To_v1beta1_AzureManagedControlPlaneSpec(a.(*AzureManagedControlPlaneSpec), b.(*v1beta1.AzureManagedControlPlaneSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureManagedControlPlaneStatus)(nil), (*v1beta1.AzureManagedControlPlaneStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureManagedControlPlaneStatus_To_v1beta1_AzureManagedControlPlaneStatus(a.(*AzureManagedControlPlaneStatus), b.(*v1beta1.AzureManagedControlPlaneStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureManagedMachinePool)(nil), (*v1beta1.AzureManagedMachinePool)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureManagedMachinePool_To_v1beta1_AzureManagedMachinePool(a.(*AzureManagedMachinePool), b.(*v1beta1.AzureManagedMachinePool), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureManagedMachinePool)(nil), (*AzureManagedMachinePool)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureManagedMachinePool_To_v1alpha4_AzureManagedMachinePool(a.(*v1beta1.AzureManagedMachinePool), b.(*AzureManagedMachinePool), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureManagedMachinePoolList)(nil), (*v1beta1.AzureManagedMachinePoolList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureManagedMachinePoolList_To_v1beta1_AzureManagedMachinePoolList(a.(*AzureManagedMachinePoolList), b.(*v1beta1.AzureManagedMachinePoolList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureManagedMachinePoolList)(nil), (*AzureManagedMachinePoolList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureManagedMachinePoolList_To_v1alpha4_AzureManagedMachinePoolList(a.(*v1beta1.AzureManagedMachinePoolList), b.(*AzureManagedMachinePoolList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureManagedMachinePoolSpec)(nil), (*v1beta1.AzureManagedMachinePoolSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureManagedMachinePoolSpec_To_v1beta1_AzureManagedMachinePoolSpec(a.(*AzureManagedMachinePoolSpec), b.(*v1beta1.AzureManagedMachinePoolSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureManagedMachinePoolStatus)(nil), (*v1beta1.AzureManagedMachinePoolStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureManagedMachinePoolStatus_To_v1beta1_AzureManagedMachinePoolStatus(a.(*AzureManagedMachinePoolStatus), b.(*v1beta1.AzureManagedMachinePoolStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureSharedGalleryImage)(nil), (*v1beta1.AzureSharedGalleryImage)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureSharedGalleryImage_To_v1beta1_AzureSharedGalleryImage(a.(*AzureSharedGalleryImage), b.(*v1beta1.AzureSharedGalleryImage), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureSharedGalleryImage)(nil), (*AzureSharedGalleryImage)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureSharedGalleryImage_To_v1alpha4_AzureSharedGalleryImage(a.(*v1beta1.AzureSharedGalleryImage), b.(*AzureSharedGalleryImage), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*BackOffConfig)(nil), (*v1beta1.BackOffConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_BackOffConfig_To_v1beta1_BackOffConfig(a.(*BackOffConfig), b.(*v1beta1.BackOffConfig), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.BackOffConfig)(nil), (*BackOffConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_BackOffConfig_To_v1alpha4_BackOffConfig(a.(*v1beta1.BackOffConfig), b.(*BackOffConfig), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*BastionSpec)(nil), (*v1beta1.BastionSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_BastionSpec_To_v1beta1_BastionSpec(a.(*BastionSpec), b.(*v1beta1.BastionSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.BastionSpec)(nil), (*BastionSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_BastionSpec_To_v1alpha4_BastionSpec(a.(*v1beta1.BastionSpec), b.(*BastionSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*BuildParams)(nil), (*v1beta1.BuildParams)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_BuildParams_To_v1beta1_BuildParams(a.(*BuildParams), b.(*v1beta1.BuildParams), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.BuildParams)(nil), (*BuildParams)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_BuildParams_To_v1alpha4_BuildParams(a.(*v1beta1.BuildParams), b.(*BuildParams), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*CloudProviderConfigOverrides)(nil), (*v1beta1.CloudProviderConfigOverrides)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_CloudProviderConfigOverrides_To_v1beta1_CloudProviderConfigOverrides(a.(*CloudProviderConfigOverrides), b.(*v1beta1.CloudProviderConfigOverrides), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.CloudProviderConfigOverrides)(nil), (*CloudProviderConfigOverrides)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_CloudProviderConfigOverrides_To_v1alpha4_CloudProviderConfigOverrides(a.(*v1beta1.CloudProviderConfigOverrides), b.(*CloudProviderConfigOverrides), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*DataDisk)(nil), (*v1beta1.DataDisk)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_DataDisk_To_v1beta1_DataDisk(a.(*DataDisk), b.(*v1beta1.DataDisk), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.DataDisk)(nil), (*DataDisk)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_DataDisk_To_v1alpha4_DataDisk(a.(*v1beta1.DataDisk), b.(*DataDisk), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*DiffDiskSettings)(nil), (*v1beta1.DiffDiskSettings)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_DiffDiskSettings_To_v1beta1_DiffDiskSettings(a.(*DiffDiskSettings), b.(*v1beta1.DiffDiskSettings), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.DiffDiskSettings)(nil), (*DiffDiskSettings)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_DiffDiskSettings_To_v1alpha4_DiffDiskSettings(a.(*v1beta1.DiffDiskSettings), b.(*DiffDiskSettings), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*DiskEncryptionSetParameters)(nil), (*v1beta1.DiskEncryptionSetParameters)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_DiskEncryptionSetParameters_To_v1beta1_DiskEncryptionSetParameters(a.(*DiskEncryptionSetParameters), b.(*v1beta1.DiskEncryptionSetParameters), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.DiskEncryptionSetParameters)(nil), (*DiskEncryptionSetParameters)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_DiskEncryptionSetParameters_To_v1alpha4_DiskEncryptionSetParameters(a.(*v1beta1.DiskEncryptionSetParameters), b.(*DiskEncryptionSetParameters), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*Future)(nil), (*v1beta1.Future)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_Future_To_v1beta1_Future(a.(*Future), b.(*v1beta1.Future), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.Future)(nil), (*Future)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_Future_To_v1alpha4_Future(a.(*v1beta1.Future), b.(*Future), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*Image)(nil), (*v1beta1.Image)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_Image_To_v1beta1_Image(a.(*Image), b.(*v1beta1.Image), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*LoadBalancerProfile)(nil), (*v1beta1.LoadBalancerProfile)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_LoadBalancerProfile_To_v1beta1_LoadBalancerProfile(a.(*LoadBalancerProfile), b.(*v1beta1.LoadBalancerProfile), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.LoadBalancerProfile)(nil), (*LoadBalancerProfile)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_LoadBalancerProfile_To_v1alpha4_LoadBalancerProfile(a.(*v1beta1.LoadBalancerProfile), b.(*LoadBalancerProfile), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*ManagedControlPlaneSubnet)(nil), (*v1beta1.ManagedControlPlaneSubnet)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_ManagedControlPlaneSubnet_To_v1beta1_ManagedControlPlaneSubnet(a.(*ManagedControlPlaneSubnet), b.(*v1beta1.ManagedControlPlaneSubnet), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*ManagedControlPlaneVirtualNetwork)(nil), (*v1beta1.ManagedControlPlaneVirtualNetwork)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_ManagedControlPlaneVirtualNetwork_To_v1beta1_ManagedControlPlaneVirtualNetwork(a.(*ManagedControlPlaneVirtualNetwork), b.(*v1beta1.ManagedControlPlaneVirtualNetwork), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*ManagedDiskParameters)(nil), (*v1beta1.ManagedDiskParameters)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_ManagedDiskParameters_To_v1beta1_ManagedDiskParameters(a.(*ManagedDiskParameters), b.(*v1beta1.ManagedDiskParameters), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.ManagedDiskParameters)(nil), (*ManagedDiskParameters)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_ManagedDiskParameters_To_v1alpha4_ManagedDiskParameters(a.(*v1beta1.ManagedDiskParameters), b.(*ManagedDiskParameters), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*OSDisk)(nil), (*v1beta1.OSDisk)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_OSDisk_To_v1beta1_OSDisk(a.(*OSDisk), b.(*v1beta1.OSDisk), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.OSDisk)(nil), (*OSDisk)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_OSDisk_To_v1alpha4_OSDisk(a.(*v1beta1.OSDisk), b.(*OSDisk), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*PublicIPSpec)(nil), (*v1beta1.PublicIPSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_PublicIPSpec_To_v1beta1_PublicIPSpec(a.(*PublicIPSpec), b.(*v1beta1.PublicIPSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*RateLimitConfig)(nil), (*v1beta1.RateLimitConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_RateLimitConfig_To_v1beta1_RateLimitConfig(a.(*RateLimitConfig), b.(*v1beta1.RateLimitConfig), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.RateLimitConfig)(nil), (*RateLimitConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_RateLimitConfig_To_v1alpha4_RateLimitConfig(a.(*v1beta1.RateLimitConfig), b.(*RateLimitConfig), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*RateLimitSpec)(nil), (*v1beta1.RateLimitSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_RateLimitSpec_To_v1beta1_RateLimitSpec(a.(*RateLimitSpec), b.(*v1beta1.RateLimitSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.RateLimitSpec)(nil), (*RateLimitSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_RateLimitSpec_To_v1alpha4_RateLimitSpec(a.(*v1beta1.RateLimitSpec), b.(*RateLimitSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*RouteTable)(nil), (*v1beta1.RouteTable)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_RouteTable_To_v1beta1_RouteTable(a.(*RouteTable), b.(*v1beta1.RouteTable), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.RouteTable)(nil), (*RouteTable)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_RouteTable_To_v1alpha4_RouteTable(a.(*v1beta1.RouteTable), b.(*RouteTable), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*SecurityProfile)(nil), (*v1beta1.SecurityProfile)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_SecurityProfile_To_v1beta1_SecurityProfile(a.(*SecurityProfile), b.(*v1beta1.SecurityProfile), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.SecurityProfile)(nil), (*SecurityProfile)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_SecurityProfile_To_v1alpha4_SecurityProfile(a.(*v1beta1.SecurityProfile), b.(*SecurityProfile), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*SecurityRule)(nil), (*v1beta1.SecurityRule)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_SecurityRule_To_v1beta1_SecurityRule(a.(*SecurityRule), b.(*v1beta1.SecurityRule), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.SecurityRule)(nil), (*SecurityRule)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_SecurityRule_To_v1alpha4_SecurityRule(a.(*v1beta1.SecurityRule), b.(*SecurityRule), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*SpotVMOptions)(nil), (*v1beta1.SpotVMOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_SpotVMOptions_To_v1beta1_SpotVMOptions(a.(*SpotVMOptions), b.(*v1beta1.SpotVMOptions), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*UserAssignedIdentity)(nil), (*v1beta1.UserAssignedIdentity)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_UserAssignedIdentity_To_v1beta1_UserAssignedIdentity(a.(*UserAssignedIdentity), b.(*v1beta1.UserAssignedIdentity), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.UserAssignedIdentity)(nil), (*UserAssignedIdentity)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_UserAssignedIdentity_To_v1alpha4_UserAssignedIdentity(a.(*v1beta1.UserAssignedIdentity), b.(*UserAssignedIdentity), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*AzureClusterSpec)(nil), (*v1beta1.AzureClusterSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureClusterSpec_To_v1beta1_AzureClusterSpec(a.(*AzureClusterSpec), b.(*v1beta1.AzureClusterSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*AzureMarketplaceImage)(nil), (*v1beta1.AzureMarketplaceImage)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureMarketplaceImage_To_v1beta1_AzureMarketplaceImage(a.(*AzureMarketplaceImage), b.(*v1beta1.AzureMarketplaceImage), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*FrontendIP)(nil), (*v1beta1.FrontendIP)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_FrontendIP_To_v1beta1_FrontendIP(a.(*FrontendIP), b.(*v1beta1.FrontendIP), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*LoadBalancerSpec)(nil), (*v1beta1.LoadBalancerSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_LoadBalancerSpec_To_v1beta1_LoadBalancerSpec(a.(*LoadBalancerSpec), b.(*v1beta1.LoadBalancerSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*NatGateway)(nil), (*v1beta1.NatGateway)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_NatGateway_To_v1beta1_NatGateway(a.(*NatGateway), b.(*v1beta1.NatGateway), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*NetworkSpec)(nil), (*v1beta1.NetworkSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_NetworkSpec_To_v1beta1_NetworkSpec(a.(*NetworkSpec), b.(*v1beta1.NetworkSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*SecurityGroup)(nil), (*v1beta1.SecurityGroup)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_SecurityGroup_To_v1beta1_SecurityGroup(a.(*SecurityGroup), b.(*v1beta1.SecurityGroup), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*SubnetSpec)(nil), (*v1beta1.SubnetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_SubnetSpec_To_v1beta1_SubnetSpec(a.(*SubnetSpec), b.(*v1beta1.SubnetSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*VnetSpec)(nil), (*v1beta1.VnetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_VnetSpec_To_v1beta1_VnetSpec(a.(*VnetSpec), b.(*v1beta1.VnetSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.AzureBastion)(nil), (*AzureBastion)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureBastion_To_v1alpha4_AzureBastion(a.(*v1beta1.AzureBastion), b.(*AzureBastion), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.AzureClusterSpec)(nil), (*AzureClusterSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureClusterSpec_To_v1alpha4_AzureClusterSpec(a.(*v1beta1.AzureClusterSpec), b.(*AzureClusterSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.AzureMachineSpec)(nil), (*AzureMachineSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMachineSpec_To_v1alpha4_AzureMachineSpec(a.(*v1beta1.AzureMachineSpec), b.(*AzureMachineSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.AzureMachineTemplateResource)(nil), (*AzureMachineTemplateResource)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMachineTemplateResource_To_v1alpha4_AzureMachineTemplateResource(a.(*v1beta1.AzureMachineTemplateResource), b.(*AzureMachineTemplateResource), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.AzureManagedControlPlaneSpec)(nil), (*AzureManagedControlPlaneSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureManagedControlPlaneSpec_To_v1alpha4_AzureManagedControlPlaneSpec(a.(*v1beta1.AzureManagedControlPlaneSpec), b.(*AzureManagedControlPlaneSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.AzureManagedControlPlaneStatus)(nil), (*AzureManagedControlPlaneStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureManagedControlPlaneStatus_To_v1alpha4_AzureManagedControlPlaneStatus(a.(*v1beta1.AzureManagedControlPlaneStatus), b.(*AzureManagedControlPlaneStatus), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.AzureManagedMachinePoolSpec)(nil), (*AzureManagedMachinePoolSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureManagedMachinePoolSpec_To_v1alpha4_AzureManagedMachinePoolSpec(a.(*v1beta1.AzureManagedMachinePoolSpec), b.(*AzureManagedMachinePoolSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.AzureManagedMachinePoolStatus)(nil), (*AzureManagedMachinePoolStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureManagedMachinePoolStatus_To_v1alpha4_AzureManagedMachinePoolStatus(a.(*v1beta1.AzureManagedMachinePoolStatus), b.(*AzureManagedMachinePoolStatus), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.AzureMarketplaceImage)(nil), (*AzureMarketplaceImage)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMarketplaceImage_To_v1alpha4_AzureMarketplaceImage(a.(*v1beta1.AzureMarketplaceImage), b.(*AzureMarketplaceImage), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.FrontendIP)(nil), (*FrontendIP)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_FrontendIP_To_v1alpha4_FrontendIP(a.(*v1beta1.FrontendIP), b.(*FrontendIP), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.Image)(nil), (*Image)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_Image_To_v1alpha4_Image(a.(*v1beta1.Image), b.(*Image), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.LoadBalancerSpec)(nil), (*LoadBalancerSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_LoadBalancerSpec_To_v1alpha4_LoadBalancerSpec(a.(*v1beta1.LoadBalancerSpec), b.(*LoadBalancerSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.ManagedControlPlaneSubnet)(nil), (*ManagedControlPlaneSubnet)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_ManagedControlPlaneSubnet_To_v1alpha4_ManagedControlPlaneSubnet(a.(*v1beta1.ManagedControlPlaneSubnet), b.(*ManagedControlPlaneSubnet), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.ManagedControlPlaneVirtualNetwork)(nil), (*ManagedControlPlaneVirtualNetwork)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_ManagedControlPlaneVirtualNetwork_To_v1alpha4_ManagedControlPlaneVirtualNetwork(a.(*v1beta1.ManagedControlPlaneVirtualNetwork), b.(*ManagedControlPlaneVirtualNetwork), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.NatGateway)(nil), (*NatGateway)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_NatGateway_To_v1alpha4_NatGateway(a.(*v1beta1.NatGateway), b.(*NatGateway), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.NetworkSpec)(nil), (*NetworkSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_NetworkSpec_To_v1alpha4_NetworkSpec(a.(*v1beta1.NetworkSpec), b.(*NetworkSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.PublicIPSpec)(nil), (*PublicIPSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_PublicIPSpec_To_v1alpha4_PublicIPSpec(a.(*v1beta1.PublicIPSpec), b.(*PublicIPSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.SecurityGroup)(nil), (*SecurityGroup)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_SecurityGroup_To_v1alpha4_SecurityGroup(a.(*v1beta1.SecurityGroup), b.(*SecurityGroup), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.SpotVMOptions)(nil), (*SpotVMOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_SpotVMOptions_To_v1alpha4_SpotVMOptions(a.(*v1beta1.SpotVMOptions), b.(*SpotVMOptions), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.SubnetSpec)(nil), (*SubnetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_SubnetSpec_To_v1alpha4_SubnetSpec(a.(*v1beta1.SubnetSpec), b.(*SubnetSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.VnetSpec)(nil), (*VnetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_VnetSpec_To_v1alpha4_VnetSpec(a.(*v1beta1.VnetSpec), b.(*VnetSpec), scope) - }); err != nil { - return err - } - return nil -} - -func autoConvert_v1alpha4_AADProfile_To_v1beta1_AADProfile(in *AADProfile, out *v1beta1.AADProfile, s conversion.Scope) error { - out.Managed = in.Managed - out.AdminGroupObjectIDs = *(*[]string)(unsafe.Pointer(&in.AdminGroupObjectIDs)) - return nil -} - -// Convert_v1alpha4_AADProfile_To_v1beta1_AADProfile is an autogenerated conversion function. -func Convert_v1alpha4_AADProfile_To_v1beta1_AADProfile(in *AADProfile, out *v1beta1.AADProfile, s conversion.Scope) error { - return autoConvert_v1alpha4_AADProfile_To_v1beta1_AADProfile(in, out, s) -} - -func autoConvert_v1beta1_AADProfile_To_v1alpha4_AADProfile(in *v1beta1.AADProfile, out *AADProfile, s conversion.Scope) error { - out.Managed = in.Managed - out.AdminGroupObjectIDs = *(*[]string)(unsafe.Pointer(&in.AdminGroupObjectIDs)) - return nil -} - -// Convert_v1beta1_AADProfile_To_v1alpha4_AADProfile is an autogenerated conversion function. -func Convert_v1beta1_AADProfile_To_v1alpha4_AADProfile(in *v1beta1.AADProfile, out *AADProfile, s conversion.Scope) error { - return autoConvert_v1beta1_AADProfile_To_v1alpha4_AADProfile(in, out, s) -} - -func autoConvert_v1alpha4_AKSSku_To_v1beta1_AKSSku(in *AKSSku, out *v1beta1.AKSSku, s conversion.Scope) error { - out.Tier = v1beta1.AzureManagedControlPlaneSkuTier(in.Tier) - return nil -} - -// Convert_v1alpha4_AKSSku_To_v1beta1_AKSSku is an autogenerated conversion function. -func Convert_v1alpha4_AKSSku_To_v1beta1_AKSSku(in *AKSSku, out *v1beta1.AKSSku, s conversion.Scope) error { - return autoConvert_v1alpha4_AKSSku_To_v1beta1_AKSSku(in, out, s) -} - -func autoConvert_v1beta1_AKSSku_To_v1alpha4_AKSSku(in *v1beta1.AKSSku, out *AKSSku, s conversion.Scope) error { - out.Tier = string(in.Tier) - return nil -} - -// Convert_v1beta1_AKSSku_To_v1alpha4_AKSSku is an autogenerated conversion function. -func Convert_v1beta1_AKSSku_To_v1alpha4_AKSSku(in *v1beta1.AKSSku, out *AKSSku, s conversion.Scope) error { - return autoConvert_v1beta1_AKSSku_To_v1alpha4_AKSSku(in, out, s) -} - -func autoConvert_v1alpha4_APIServerAccessProfile_To_v1beta1_APIServerAccessProfile(in *APIServerAccessProfile, out *v1beta1.APIServerAccessProfile, s conversion.Scope) error { - out.AuthorizedIPRanges = *(*[]string)(unsafe.Pointer(&in.AuthorizedIPRanges)) - out.EnablePrivateCluster = (*bool)(unsafe.Pointer(in.EnablePrivateCluster)) - out.PrivateDNSZone = (*string)(unsafe.Pointer(in.PrivateDNSZone)) - out.EnablePrivateClusterPublicFQDN = (*bool)(unsafe.Pointer(in.EnablePrivateClusterPublicFQDN)) - return nil -} - -// Convert_v1alpha4_APIServerAccessProfile_To_v1beta1_APIServerAccessProfile is an autogenerated conversion function. -func Convert_v1alpha4_APIServerAccessProfile_To_v1beta1_APIServerAccessProfile(in *APIServerAccessProfile, out *v1beta1.APIServerAccessProfile, s conversion.Scope) error { - return autoConvert_v1alpha4_APIServerAccessProfile_To_v1beta1_APIServerAccessProfile(in, out, s) -} - -func autoConvert_v1beta1_APIServerAccessProfile_To_v1alpha4_APIServerAccessProfile(in *v1beta1.APIServerAccessProfile, out *APIServerAccessProfile, s conversion.Scope) error { - out.AuthorizedIPRanges = *(*[]string)(unsafe.Pointer(&in.AuthorizedIPRanges)) - out.EnablePrivateCluster = (*bool)(unsafe.Pointer(in.EnablePrivateCluster)) - out.PrivateDNSZone = (*string)(unsafe.Pointer(in.PrivateDNSZone)) - out.EnablePrivateClusterPublicFQDN = (*bool)(unsafe.Pointer(in.EnablePrivateClusterPublicFQDN)) - return nil -} - -// Convert_v1beta1_APIServerAccessProfile_To_v1alpha4_APIServerAccessProfile is an autogenerated conversion function. -func Convert_v1beta1_APIServerAccessProfile_To_v1alpha4_APIServerAccessProfile(in *v1beta1.APIServerAccessProfile, out *APIServerAccessProfile, s conversion.Scope) error { - return autoConvert_v1beta1_APIServerAccessProfile_To_v1alpha4_APIServerAccessProfile(in, out, s) -} - -func autoConvert_v1alpha4_AddressRecord_To_v1beta1_AddressRecord(in *AddressRecord, out *v1beta1.AddressRecord, s conversion.Scope) error { - out.Hostname = in.Hostname - out.IP = in.IP - return nil -} - -// Convert_v1alpha4_AddressRecord_To_v1beta1_AddressRecord is an autogenerated conversion function. -func Convert_v1alpha4_AddressRecord_To_v1beta1_AddressRecord(in *AddressRecord, out *v1beta1.AddressRecord, s conversion.Scope) error { - return autoConvert_v1alpha4_AddressRecord_To_v1beta1_AddressRecord(in, out, s) -} - -func autoConvert_v1beta1_AddressRecord_To_v1alpha4_AddressRecord(in *v1beta1.AddressRecord, out *AddressRecord, s conversion.Scope) error { - out.Hostname = in.Hostname - out.IP = in.IP - return nil -} - -// Convert_v1beta1_AddressRecord_To_v1alpha4_AddressRecord is an autogenerated conversion function. -func Convert_v1beta1_AddressRecord_To_v1alpha4_AddressRecord(in *v1beta1.AddressRecord, out *AddressRecord, s conversion.Scope) error { - return autoConvert_v1beta1_AddressRecord_To_v1alpha4_AddressRecord(in, out, s) -} - -func autoConvert_v1alpha4_AllowedNamespaces_To_v1beta1_AllowedNamespaces(in *AllowedNamespaces, out *v1beta1.AllowedNamespaces, s conversion.Scope) error { - out.NamespaceList = *(*[]string)(unsafe.Pointer(&in.NamespaceList)) - out.Selector = (*v1.LabelSelector)(unsafe.Pointer(in.Selector)) - return nil -} - -// Convert_v1alpha4_AllowedNamespaces_To_v1beta1_AllowedNamespaces is an autogenerated conversion function. -func Convert_v1alpha4_AllowedNamespaces_To_v1beta1_AllowedNamespaces(in *AllowedNamespaces, out *v1beta1.AllowedNamespaces, s conversion.Scope) error { - return autoConvert_v1alpha4_AllowedNamespaces_To_v1beta1_AllowedNamespaces(in, out, s) -} - -func autoConvert_v1beta1_AllowedNamespaces_To_v1alpha4_AllowedNamespaces(in *v1beta1.AllowedNamespaces, out *AllowedNamespaces, s conversion.Scope) error { - out.NamespaceList = *(*[]string)(unsafe.Pointer(&in.NamespaceList)) - out.Selector = (*v1.LabelSelector)(unsafe.Pointer(in.Selector)) - return nil -} - -// Convert_v1beta1_AllowedNamespaces_To_v1alpha4_AllowedNamespaces is an autogenerated conversion function. -func Convert_v1beta1_AllowedNamespaces_To_v1alpha4_AllowedNamespaces(in *v1beta1.AllowedNamespaces, out *AllowedNamespaces, s conversion.Scope) error { - return autoConvert_v1beta1_AllowedNamespaces_To_v1alpha4_AllowedNamespaces(in, out, s) -} - -func autoConvert_v1alpha4_AzureBastion_To_v1beta1_AzureBastion(in *AzureBastion, out *v1beta1.AzureBastion, s conversion.Scope) error { - out.Name = in.Name - if err := Convert_v1alpha4_SubnetSpec_To_v1beta1_SubnetSpec(&in.Subnet, &out.Subnet, s); err != nil { - return err - } - if err := Convert_v1alpha4_PublicIPSpec_To_v1beta1_PublicIPSpec(&in.PublicIP, &out.PublicIP, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha4_AzureBastion_To_v1beta1_AzureBastion is an autogenerated conversion function. -func Convert_v1alpha4_AzureBastion_To_v1beta1_AzureBastion(in *AzureBastion, out *v1beta1.AzureBastion, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureBastion_To_v1beta1_AzureBastion(in, out, s) -} - -func autoConvert_v1beta1_AzureBastion_To_v1alpha4_AzureBastion(in *v1beta1.AzureBastion, out *AzureBastion, s conversion.Scope) error { - out.Name = in.Name - if err := Convert_v1beta1_SubnetSpec_To_v1alpha4_SubnetSpec(&in.Subnet, &out.Subnet, s); err != nil { - return err - } - if err := Convert_v1beta1_PublicIPSpec_To_v1alpha4_PublicIPSpec(&in.PublicIP, &out.PublicIP, s); err != nil { - return err - } - // WARNING: in.Sku requires manual conversion: does not exist in peer-type - // WARNING: in.EnableTunneling requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha4_AzureCluster_To_v1beta1_AzureCluster(in *AzureCluster, out *v1beta1.AzureCluster, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha4_AzureClusterSpec_To_v1beta1_AzureClusterSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1alpha4_AzureClusterStatus_To_v1beta1_AzureClusterStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha4_AzureCluster_To_v1beta1_AzureCluster is an autogenerated conversion function. -func Convert_v1alpha4_AzureCluster_To_v1beta1_AzureCluster(in *AzureCluster, out *v1beta1.AzureCluster, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureCluster_To_v1beta1_AzureCluster(in, out, s) -} - -func autoConvert_v1beta1_AzureCluster_To_v1alpha4_AzureCluster(in *v1beta1.AzureCluster, out *AzureCluster, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1beta1_AzureClusterSpec_To_v1alpha4_AzureClusterSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1beta1_AzureClusterStatus_To_v1alpha4_AzureClusterStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta1_AzureCluster_To_v1alpha4_AzureCluster is an autogenerated conversion function. -func Convert_v1beta1_AzureCluster_To_v1alpha4_AzureCluster(in *v1beta1.AzureCluster, out *AzureCluster, s conversion.Scope) error { - return autoConvert_v1beta1_AzureCluster_To_v1alpha4_AzureCluster(in, out, s) -} - -func autoConvert_v1alpha4_AzureClusterIdentity_To_v1beta1_AzureClusterIdentity(in *AzureClusterIdentity, out *v1beta1.AzureClusterIdentity, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha4_AzureClusterIdentitySpec_To_v1beta1_AzureClusterIdentitySpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1alpha4_AzureClusterIdentityStatus_To_v1beta1_AzureClusterIdentityStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha4_AzureClusterIdentity_To_v1beta1_AzureClusterIdentity is an autogenerated conversion function. -func Convert_v1alpha4_AzureClusterIdentity_To_v1beta1_AzureClusterIdentity(in *AzureClusterIdentity, out *v1beta1.AzureClusterIdentity, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureClusterIdentity_To_v1beta1_AzureClusterIdentity(in, out, s) -} - -func autoConvert_v1beta1_AzureClusterIdentity_To_v1alpha4_AzureClusterIdentity(in *v1beta1.AzureClusterIdentity, out *AzureClusterIdentity, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1beta1_AzureClusterIdentitySpec_To_v1alpha4_AzureClusterIdentitySpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1beta1_AzureClusterIdentityStatus_To_v1alpha4_AzureClusterIdentityStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta1_AzureClusterIdentity_To_v1alpha4_AzureClusterIdentity is an autogenerated conversion function. -func Convert_v1beta1_AzureClusterIdentity_To_v1alpha4_AzureClusterIdentity(in *v1beta1.AzureClusterIdentity, out *AzureClusterIdentity, s conversion.Scope) error { - return autoConvert_v1beta1_AzureClusterIdentity_To_v1alpha4_AzureClusterIdentity(in, out, s) -} - -func autoConvert_v1alpha4_AzureClusterIdentityList_To_v1beta1_AzureClusterIdentityList(in *AzureClusterIdentityList, out *v1beta1.AzureClusterIdentityList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]v1beta1.AzureClusterIdentity, len(*in)) - for i := range *in { - if err := Convert_v1alpha4_AzureClusterIdentity_To_v1beta1_AzureClusterIdentity(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1alpha4_AzureClusterIdentityList_To_v1beta1_AzureClusterIdentityList is an autogenerated conversion function. -func Convert_v1alpha4_AzureClusterIdentityList_To_v1beta1_AzureClusterIdentityList(in *AzureClusterIdentityList, out *v1beta1.AzureClusterIdentityList, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureClusterIdentityList_To_v1beta1_AzureClusterIdentityList(in, out, s) -} - -func autoConvert_v1beta1_AzureClusterIdentityList_To_v1alpha4_AzureClusterIdentityList(in *v1beta1.AzureClusterIdentityList, out *AzureClusterIdentityList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]AzureClusterIdentity, len(*in)) - for i := range *in { - if err := Convert_v1beta1_AzureClusterIdentity_To_v1alpha4_AzureClusterIdentity(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1beta1_AzureClusterIdentityList_To_v1alpha4_AzureClusterIdentityList is an autogenerated conversion function. -func Convert_v1beta1_AzureClusterIdentityList_To_v1alpha4_AzureClusterIdentityList(in *v1beta1.AzureClusterIdentityList, out *AzureClusterIdentityList, s conversion.Scope) error { - return autoConvert_v1beta1_AzureClusterIdentityList_To_v1alpha4_AzureClusterIdentityList(in, out, s) -} - -func autoConvert_v1alpha4_AzureClusterIdentitySpec_To_v1beta1_AzureClusterIdentitySpec(in *AzureClusterIdentitySpec, out *v1beta1.AzureClusterIdentitySpec, s conversion.Scope) error { - out.Type = v1beta1.IdentityType(in.Type) - out.ResourceID = in.ResourceID - out.ClientID = in.ClientID - out.ClientSecret = in.ClientSecret - out.TenantID = in.TenantID - out.AllowedNamespaces = (*v1beta1.AllowedNamespaces)(unsafe.Pointer(in.AllowedNamespaces)) - return nil -} - -// Convert_v1alpha4_AzureClusterIdentitySpec_To_v1beta1_AzureClusterIdentitySpec is an autogenerated conversion function. -func Convert_v1alpha4_AzureClusterIdentitySpec_To_v1beta1_AzureClusterIdentitySpec(in *AzureClusterIdentitySpec, out *v1beta1.AzureClusterIdentitySpec, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureClusterIdentitySpec_To_v1beta1_AzureClusterIdentitySpec(in, out, s) -} - -func autoConvert_v1beta1_AzureClusterIdentitySpec_To_v1alpha4_AzureClusterIdentitySpec(in *v1beta1.AzureClusterIdentitySpec, out *AzureClusterIdentitySpec, s conversion.Scope) error { - out.Type = IdentityType(in.Type) - out.ResourceID = in.ResourceID - out.ClientID = in.ClientID - out.ClientSecret = in.ClientSecret - out.TenantID = in.TenantID - out.AllowedNamespaces = (*AllowedNamespaces)(unsafe.Pointer(in.AllowedNamespaces)) - return nil -} - -// Convert_v1beta1_AzureClusterIdentitySpec_To_v1alpha4_AzureClusterIdentitySpec is an autogenerated conversion function. -func Convert_v1beta1_AzureClusterIdentitySpec_To_v1alpha4_AzureClusterIdentitySpec(in *v1beta1.AzureClusterIdentitySpec, out *AzureClusterIdentitySpec, s conversion.Scope) error { - return autoConvert_v1beta1_AzureClusterIdentitySpec_To_v1alpha4_AzureClusterIdentitySpec(in, out, s) -} - -func autoConvert_v1alpha4_AzureClusterIdentityStatus_To_v1beta1_AzureClusterIdentityStatus(in *AzureClusterIdentityStatus, out *v1beta1.AzureClusterIdentityStatus, s conversion.Scope) error { - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(apiv1beta1.Conditions, len(*in)) - for i := range *in { - if err := apiv1alpha4.Convert_v1alpha4_Condition_To_v1beta1_Condition(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Conditions = nil - } - return nil -} - -// Convert_v1alpha4_AzureClusterIdentityStatus_To_v1beta1_AzureClusterIdentityStatus is an autogenerated conversion function. -func Convert_v1alpha4_AzureClusterIdentityStatus_To_v1beta1_AzureClusterIdentityStatus(in *AzureClusterIdentityStatus, out *v1beta1.AzureClusterIdentityStatus, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureClusterIdentityStatus_To_v1beta1_AzureClusterIdentityStatus(in, out, s) -} - -func autoConvert_v1beta1_AzureClusterIdentityStatus_To_v1alpha4_AzureClusterIdentityStatus(in *v1beta1.AzureClusterIdentityStatus, out *AzureClusterIdentityStatus, s conversion.Scope) error { - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(apiv1alpha4.Conditions, len(*in)) - for i := range *in { - if err := apiv1alpha4.Convert_v1beta1_Condition_To_v1alpha4_Condition(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Conditions = nil - } - return nil -} - -// Convert_v1beta1_AzureClusterIdentityStatus_To_v1alpha4_AzureClusterIdentityStatus is an autogenerated conversion function. -func Convert_v1beta1_AzureClusterIdentityStatus_To_v1alpha4_AzureClusterIdentityStatus(in *v1beta1.AzureClusterIdentityStatus, out *AzureClusterIdentityStatus, s conversion.Scope) error { - return autoConvert_v1beta1_AzureClusterIdentityStatus_To_v1alpha4_AzureClusterIdentityStatus(in, out, s) -} - -func autoConvert_v1alpha4_AzureClusterList_To_v1beta1_AzureClusterList(in *AzureClusterList, out *v1beta1.AzureClusterList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]v1beta1.AzureCluster, len(*in)) - for i := range *in { - if err := Convert_v1alpha4_AzureCluster_To_v1beta1_AzureCluster(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1alpha4_AzureClusterList_To_v1beta1_AzureClusterList is an autogenerated conversion function. -func Convert_v1alpha4_AzureClusterList_To_v1beta1_AzureClusterList(in *AzureClusterList, out *v1beta1.AzureClusterList, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureClusterList_To_v1beta1_AzureClusterList(in, out, s) -} - -func autoConvert_v1beta1_AzureClusterList_To_v1alpha4_AzureClusterList(in *v1beta1.AzureClusterList, out *AzureClusterList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]AzureCluster, len(*in)) - for i := range *in { - if err := Convert_v1beta1_AzureCluster_To_v1alpha4_AzureCluster(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1beta1_AzureClusterList_To_v1alpha4_AzureClusterList is an autogenerated conversion function. -func Convert_v1beta1_AzureClusterList_To_v1alpha4_AzureClusterList(in *v1beta1.AzureClusterList, out *AzureClusterList, s conversion.Scope) error { - return autoConvert_v1beta1_AzureClusterList_To_v1alpha4_AzureClusterList(in, out, s) -} - -func autoConvert_v1alpha4_AzureClusterSpec_To_v1beta1_AzureClusterSpec(in *AzureClusterSpec, out *v1beta1.AzureClusterSpec, s conversion.Scope) error { - if err := Convert_v1alpha4_NetworkSpec_To_v1beta1_NetworkSpec(&in.NetworkSpec, &out.NetworkSpec, s); err != nil { - return err - } - out.ResourceGroup = in.ResourceGroup - // WARNING: in.SubscriptionID requires manual conversion: does not exist in peer-type - // WARNING: in.Location requires manual conversion: does not exist in peer-type - if err := apiv1alpha4.Convert_v1alpha4_APIEndpoint_To_v1beta1_APIEndpoint(&in.ControlPlaneEndpoint, &out.ControlPlaneEndpoint, s); err != nil { - return err - } - // WARNING: in.AdditionalTags requires manual conversion: does not exist in peer-type - // WARNING: in.IdentityRef requires manual conversion: does not exist in peer-type - // WARNING: in.AzureEnvironment requires manual conversion: does not exist in peer-type - if err := Convert_v1alpha4_BastionSpec_To_v1beta1_BastionSpec(&in.BastionSpec, &out.BastionSpec, s); err != nil { - return err - } - // WARNING: in.CloudProviderConfigOverrides requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1beta1_AzureClusterSpec_To_v1alpha4_AzureClusterSpec(in *v1beta1.AzureClusterSpec, out *AzureClusterSpec, s conversion.Scope) error { - // WARNING: in.AzureClusterClassSpec requires manual conversion: does not exist in peer-type - if err := Convert_v1beta1_NetworkSpec_To_v1alpha4_NetworkSpec(&in.NetworkSpec, &out.NetworkSpec, s); err != nil { - return err - } - out.ResourceGroup = in.ResourceGroup - if err := Convert_v1beta1_BastionSpec_To_v1alpha4_BastionSpec(&in.BastionSpec, &out.BastionSpec, s); err != nil { - return err - } - if err := apiv1alpha4.Convert_v1beta1_APIEndpoint_To_v1alpha4_APIEndpoint(&in.ControlPlaneEndpoint, &out.ControlPlaneEndpoint, s); err != nil { - return err - } - return nil -} - -func autoConvert_v1alpha4_AzureClusterStatus_To_v1beta1_AzureClusterStatus(in *AzureClusterStatus, out *v1beta1.AzureClusterStatus, s conversion.Scope) error { - if in.FailureDomains != nil { - in, out := &in.FailureDomains, &out.FailureDomains - *out = make(apiv1beta1.FailureDomains, len(*in)) - for key, val := range *in { - newVal := new(apiv1beta1.FailureDomainSpec) - if err := apiv1alpha4.Convert_v1alpha4_FailureDomainSpec_To_v1beta1_FailureDomainSpec(&val, newVal, s); err != nil { - return err - } - (*out)[key] = *newVal - } - } else { - out.FailureDomains = nil - } - out.Ready = in.Ready - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(apiv1beta1.Conditions, len(*in)) - for i := range *in { - if err := apiv1alpha4.Convert_v1alpha4_Condition_To_v1beta1_Condition(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Conditions = nil - } - out.LongRunningOperationStates = *(*v1beta1.Futures)(unsafe.Pointer(&in.LongRunningOperationStates)) - return nil -} - -// Convert_v1alpha4_AzureClusterStatus_To_v1beta1_AzureClusterStatus is an autogenerated conversion function. -func Convert_v1alpha4_AzureClusterStatus_To_v1beta1_AzureClusterStatus(in *AzureClusterStatus, out *v1beta1.AzureClusterStatus, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureClusterStatus_To_v1beta1_AzureClusterStatus(in, out, s) -} - -func autoConvert_v1beta1_AzureClusterStatus_To_v1alpha4_AzureClusterStatus(in *v1beta1.AzureClusterStatus, out *AzureClusterStatus, s conversion.Scope) error { - if in.FailureDomains != nil { - in, out := &in.FailureDomains, &out.FailureDomains - *out = make(apiv1alpha4.FailureDomains, len(*in)) - for key, val := range *in { - newVal := new(apiv1alpha4.FailureDomainSpec) - if err := apiv1alpha4.Convert_v1beta1_FailureDomainSpec_To_v1alpha4_FailureDomainSpec(&val, newVal, s); err != nil { - return err - } - (*out)[key] = *newVal - } - } else { - out.FailureDomains = nil - } - out.Ready = in.Ready - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(apiv1alpha4.Conditions, len(*in)) - for i := range *in { - if err := apiv1alpha4.Convert_v1beta1_Condition_To_v1alpha4_Condition(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Conditions = nil - } - out.LongRunningOperationStates = *(*Futures)(unsafe.Pointer(&in.LongRunningOperationStates)) - return nil -} - -// Convert_v1beta1_AzureClusterStatus_To_v1alpha4_AzureClusterStatus is an autogenerated conversion function. -func Convert_v1beta1_AzureClusterStatus_To_v1alpha4_AzureClusterStatus(in *v1beta1.AzureClusterStatus, out *AzureClusterStatus, s conversion.Scope) error { - return autoConvert_v1beta1_AzureClusterStatus_To_v1alpha4_AzureClusterStatus(in, out, s) -} - -func autoConvert_v1alpha4_AzureMachine_To_v1beta1_AzureMachine(in *AzureMachine, out *v1beta1.AzureMachine, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha4_AzureMachineSpec_To_v1beta1_AzureMachineSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1alpha4_AzureMachineStatus_To_v1beta1_AzureMachineStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha4_AzureMachine_To_v1beta1_AzureMachine is an autogenerated conversion function. -func Convert_v1alpha4_AzureMachine_To_v1beta1_AzureMachine(in *AzureMachine, out *v1beta1.AzureMachine, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureMachine_To_v1beta1_AzureMachine(in, out, s) -} - -func autoConvert_v1beta1_AzureMachine_To_v1alpha4_AzureMachine(in *v1beta1.AzureMachine, out *AzureMachine, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1beta1_AzureMachineSpec_To_v1alpha4_AzureMachineSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1beta1_AzureMachineStatus_To_v1alpha4_AzureMachineStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta1_AzureMachine_To_v1alpha4_AzureMachine is an autogenerated conversion function. -func Convert_v1beta1_AzureMachine_To_v1alpha4_AzureMachine(in *v1beta1.AzureMachine, out *AzureMachine, s conversion.Scope) error { - return autoConvert_v1beta1_AzureMachine_To_v1alpha4_AzureMachine(in, out, s) -} - -func autoConvert_v1alpha4_AzureMachineList_To_v1beta1_AzureMachineList(in *AzureMachineList, out *v1beta1.AzureMachineList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]v1beta1.AzureMachine, len(*in)) - for i := range *in { - if err := Convert_v1alpha4_AzureMachine_To_v1beta1_AzureMachine(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1alpha4_AzureMachineList_To_v1beta1_AzureMachineList is an autogenerated conversion function. -func Convert_v1alpha4_AzureMachineList_To_v1beta1_AzureMachineList(in *AzureMachineList, out *v1beta1.AzureMachineList, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureMachineList_To_v1beta1_AzureMachineList(in, out, s) -} - -func autoConvert_v1beta1_AzureMachineList_To_v1alpha4_AzureMachineList(in *v1beta1.AzureMachineList, out *AzureMachineList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]AzureMachine, len(*in)) - for i := range *in { - if err := Convert_v1beta1_AzureMachine_To_v1alpha4_AzureMachine(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1beta1_AzureMachineList_To_v1alpha4_AzureMachineList is an autogenerated conversion function. -func Convert_v1beta1_AzureMachineList_To_v1alpha4_AzureMachineList(in *v1beta1.AzureMachineList, out *AzureMachineList, s conversion.Scope) error { - return autoConvert_v1beta1_AzureMachineList_To_v1alpha4_AzureMachineList(in, out, s) -} - -func autoConvert_v1alpha4_AzureMachineSpec_To_v1beta1_AzureMachineSpec(in *AzureMachineSpec, out *v1beta1.AzureMachineSpec, s conversion.Scope) error { - out.ProviderID = (*string)(unsafe.Pointer(in.ProviderID)) - out.VMSize = in.VMSize - out.FailureDomain = (*string)(unsafe.Pointer(in.FailureDomain)) - if in.Image != nil { - in, out := &in.Image, &out.Image - *out = new(v1beta1.Image) - if err := Convert_v1alpha4_Image_To_v1beta1_Image(*in, *out, s); err != nil { - return err - } - } else { - out.Image = nil - } - out.Identity = v1beta1.VMIdentity(in.Identity) - out.UserAssignedIdentities = *(*[]v1beta1.UserAssignedIdentity)(unsafe.Pointer(&in.UserAssignedIdentities)) - out.RoleAssignmentName = in.RoleAssignmentName - if err := Convert_v1alpha4_OSDisk_To_v1beta1_OSDisk(&in.OSDisk, &out.OSDisk, s); err != nil { - return err - } - out.DataDisks = *(*[]v1beta1.DataDisk)(unsafe.Pointer(&in.DataDisks)) - out.SSHPublicKey = in.SSHPublicKey - out.AdditionalTags = *(*v1beta1.Tags)(unsafe.Pointer(&in.AdditionalTags)) - out.AllocatePublicIP = in.AllocatePublicIP - out.EnableIPForwarding = in.EnableIPForwarding - out.AcceleratedNetworking = (*bool)(unsafe.Pointer(in.AcceleratedNetworking)) - if in.SpotVMOptions != nil { - in, out := &in.SpotVMOptions, &out.SpotVMOptions - *out = new(v1beta1.SpotVMOptions) - if err := Convert_v1alpha4_SpotVMOptions_To_v1beta1_SpotVMOptions(*in, *out, s); err != nil { - return err - } - } else { - out.SpotVMOptions = nil - } - out.SecurityProfile = (*v1beta1.SecurityProfile)(unsafe.Pointer(in.SecurityProfile)) - out.SubnetName = in.SubnetName - return nil -} - -// Convert_v1alpha4_AzureMachineSpec_To_v1beta1_AzureMachineSpec is an autogenerated conversion function. -func Convert_v1alpha4_AzureMachineSpec_To_v1beta1_AzureMachineSpec(in *AzureMachineSpec, out *v1beta1.AzureMachineSpec, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureMachineSpec_To_v1beta1_AzureMachineSpec(in, out, s) -} - -func autoConvert_v1beta1_AzureMachineSpec_To_v1alpha4_AzureMachineSpec(in *v1beta1.AzureMachineSpec, out *AzureMachineSpec, s conversion.Scope) error { - out.ProviderID = (*string)(unsafe.Pointer(in.ProviderID)) - out.VMSize = in.VMSize - out.FailureDomain = (*string)(unsafe.Pointer(in.FailureDomain)) - if in.Image != nil { - in, out := &in.Image, &out.Image - *out = new(Image) - if err := Convert_v1beta1_Image_To_v1alpha4_Image(*in, *out, s); err != nil { - return err - } - } else { - out.Image = nil - } - out.Identity = VMIdentity(in.Identity) - out.UserAssignedIdentities = *(*[]UserAssignedIdentity)(unsafe.Pointer(&in.UserAssignedIdentities)) - // WARNING: in.SystemAssignedIdentityRole requires manual conversion: does not exist in peer-type - out.RoleAssignmentName = in.RoleAssignmentName - if err := Convert_v1beta1_OSDisk_To_v1alpha4_OSDisk(&in.OSDisk, &out.OSDisk, s); err != nil { - return err - } - out.DataDisks = *(*[]DataDisk)(unsafe.Pointer(&in.DataDisks)) - out.SSHPublicKey = in.SSHPublicKey - out.AdditionalTags = *(*Tags)(unsafe.Pointer(&in.AdditionalTags)) - // WARNING: in.AdditionalCapabilities requires manual conversion: does not exist in peer-type - out.AllocatePublicIP = in.AllocatePublicIP - out.EnableIPForwarding = in.EnableIPForwarding - out.AcceleratedNetworking = (*bool)(unsafe.Pointer(in.AcceleratedNetworking)) - // WARNING: in.Diagnostics requires manual conversion: does not exist in peer-type - if in.SpotVMOptions != nil { - in, out := &in.SpotVMOptions, &out.SpotVMOptions - *out = new(SpotVMOptions) - if err := Convert_v1beta1_SpotVMOptions_To_v1alpha4_SpotVMOptions(*in, *out, s); err != nil { - return err - } - } else { - out.SpotVMOptions = nil - } - out.SecurityProfile = (*SecurityProfile)(unsafe.Pointer(in.SecurityProfile)) - out.SubnetName = in.SubnetName - // WARNING: in.DNSServers requires manual conversion: does not exist in peer-type - // WARNING: in.VMExtensions requires manual conversion: does not exist in peer-type - // WARNING: in.NetworkInterfaces requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha4_AzureMachineStatus_To_v1beta1_AzureMachineStatus(in *AzureMachineStatus, out *v1beta1.AzureMachineStatus, s conversion.Scope) error { - out.Ready = in.Ready - out.Addresses = *(*[]corev1.NodeAddress)(unsafe.Pointer(&in.Addresses)) - out.VMState = (*v1beta1.ProvisioningState)(unsafe.Pointer(in.VMState)) - out.FailureReason = (*errors.MachineStatusError)(unsafe.Pointer(in.FailureReason)) - out.FailureMessage = (*string)(unsafe.Pointer(in.FailureMessage)) - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(apiv1beta1.Conditions, len(*in)) - for i := range *in { - if err := apiv1alpha4.Convert_v1alpha4_Condition_To_v1beta1_Condition(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Conditions = nil - } - out.LongRunningOperationStates = *(*v1beta1.Futures)(unsafe.Pointer(&in.LongRunningOperationStates)) - return nil -} - -// Convert_v1alpha4_AzureMachineStatus_To_v1beta1_AzureMachineStatus is an autogenerated conversion function. -func Convert_v1alpha4_AzureMachineStatus_To_v1beta1_AzureMachineStatus(in *AzureMachineStatus, out *v1beta1.AzureMachineStatus, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureMachineStatus_To_v1beta1_AzureMachineStatus(in, out, s) -} - -func autoConvert_v1beta1_AzureMachineStatus_To_v1alpha4_AzureMachineStatus(in *v1beta1.AzureMachineStatus, out *AzureMachineStatus, s conversion.Scope) error { - out.Ready = in.Ready - out.Addresses = *(*[]corev1.NodeAddress)(unsafe.Pointer(&in.Addresses)) - out.VMState = (*ProvisioningState)(unsafe.Pointer(in.VMState)) - out.FailureReason = (*errors.MachineStatusError)(unsafe.Pointer(in.FailureReason)) - out.FailureMessage = (*string)(unsafe.Pointer(in.FailureMessage)) - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(apiv1alpha4.Conditions, len(*in)) - for i := range *in { - if err := apiv1alpha4.Convert_v1beta1_Condition_To_v1alpha4_Condition(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Conditions = nil - } - out.LongRunningOperationStates = *(*Futures)(unsafe.Pointer(&in.LongRunningOperationStates)) - return nil -} - -// Convert_v1beta1_AzureMachineStatus_To_v1alpha4_AzureMachineStatus is an autogenerated conversion function. -func Convert_v1beta1_AzureMachineStatus_To_v1alpha4_AzureMachineStatus(in *v1beta1.AzureMachineStatus, out *AzureMachineStatus, s conversion.Scope) error { - return autoConvert_v1beta1_AzureMachineStatus_To_v1alpha4_AzureMachineStatus(in, out, s) -} - -func autoConvert_v1alpha4_AzureMachineTemplate_To_v1beta1_AzureMachineTemplate(in *AzureMachineTemplate, out *v1beta1.AzureMachineTemplate, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha4_AzureMachineTemplateSpec_To_v1beta1_AzureMachineTemplateSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha4_AzureMachineTemplate_To_v1beta1_AzureMachineTemplate is an autogenerated conversion function. -func Convert_v1alpha4_AzureMachineTemplate_To_v1beta1_AzureMachineTemplate(in *AzureMachineTemplate, out *v1beta1.AzureMachineTemplate, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureMachineTemplate_To_v1beta1_AzureMachineTemplate(in, out, s) -} - -func autoConvert_v1beta1_AzureMachineTemplate_To_v1alpha4_AzureMachineTemplate(in *v1beta1.AzureMachineTemplate, out *AzureMachineTemplate, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1beta1_AzureMachineTemplateSpec_To_v1alpha4_AzureMachineTemplateSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta1_AzureMachineTemplate_To_v1alpha4_AzureMachineTemplate is an autogenerated conversion function. -func Convert_v1beta1_AzureMachineTemplate_To_v1alpha4_AzureMachineTemplate(in *v1beta1.AzureMachineTemplate, out *AzureMachineTemplate, s conversion.Scope) error { - return autoConvert_v1beta1_AzureMachineTemplate_To_v1alpha4_AzureMachineTemplate(in, out, s) -} - -func autoConvert_v1alpha4_AzureMachineTemplateList_To_v1beta1_AzureMachineTemplateList(in *AzureMachineTemplateList, out *v1beta1.AzureMachineTemplateList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]v1beta1.AzureMachineTemplate, len(*in)) - for i := range *in { - if err := Convert_v1alpha4_AzureMachineTemplate_To_v1beta1_AzureMachineTemplate(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1alpha4_AzureMachineTemplateList_To_v1beta1_AzureMachineTemplateList is an autogenerated conversion function. -func Convert_v1alpha4_AzureMachineTemplateList_To_v1beta1_AzureMachineTemplateList(in *AzureMachineTemplateList, out *v1beta1.AzureMachineTemplateList, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureMachineTemplateList_To_v1beta1_AzureMachineTemplateList(in, out, s) -} - -func autoConvert_v1beta1_AzureMachineTemplateList_To_v1alpha4_AzureMachineTemplateList(in *v1beta1.AzureMachineTemplateList, out *AzureMachineTemplateList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]AzureMachineTemplate, len(*in)) - for i := range *in { - if err := Convert_v1beta1_AzureMachineTemplate_To_v1alpha4_AzureMachineTemplate(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1beta1_AzureMachineTemplateList_To_v1alpha4_AzureMachineTemplateList is an autogenerated conversion function. -func Convert_v1beta1_AzureMachineTemplateList_To_v1alpha4_AzureMachineTemplateList(in *v1beta1.AzureMachineTemplateList, out *AzureMachineTemplateList, s conversion.Scope) error { - return autoConvert_v1beta1_AzureMachineTemplateList_To_v1alpha4_AzureMachineTemplateList(in, out, s) -} - -func autoConvert_v1alpha4_AzureMachineTemplateResource_To_v1beta1_AzureMachineTemplateResource(in *AzureMachineTemplateResource, out *v1beta1.AzureMachineTemplateResource, s conversion.Scope) error { - if err := Convert_v1alpha4_AzureMachineSpec_To_v1beta1_AzureMachineSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha4_AzureMachineTemplateResource_To_v1beta1_AzureMachineTemplateResource is an autogenerated conversion function. -func Convert_v1alpha4_AzureMachineTemplateResource_To_v1beta1_AzureMachineTemplateResource(in *AzureMachineTemplateResource, out *v1beta1.AzureMachineTemplateResource, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureMachineTemplateResource_To_v1beta1_AzureMachineTemplateResource(in, out, s) -} - -func autoConvert_v1beta1_AzureMachineTemplateResource_To_v1alpha4_AzureMachineTemplateResource(in *v1beta1.AzureMachineTemplateResource, out *AzureMachineTemplateResource, s conversion.Scope) error { - // WARNING: in.ObjectMeta requires manual conversion: does not exist in peer-type - if err := Convert_v1beta1_AzureMachineSpec_To_v1alpha4_AzureMachineSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - return nil -} - -func autoConvert_v1alpha4_AzureMachineTemplateSpec_To_v1beta1_AzureMachineTemplateSpec(in *AzureMachineTemplateSpec, out *v1beta1.AzureMachineTemplateSpec, s conversion.Scope) error { - if err := Convert_v1alpha4_AzureMachineTemplateResource_To_v1beta1_AzureMachineTemplateResource(&in.Template, &out.Template, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha4_AzureMachineTemplateSpec_To_v1beta1_AzureMachineTemplateSpec is an autogenerated conversion function. -func Convert_v1alpha4_AzureMachineTemplateSpec_To_v1beta1_AzureMachineTemplateSpec(in *AzureMachineTemplateSpec, out *v1beta1.AzureMachineTemplateSpec, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureMachineTemplateSpec_To_v1beta1_AzureMachineTemplateSpec(in, out, s) -} - -func autoConvert_v1beta1_AzureMachineTemplateSpec_To_v1alpha4_AzureMachineTemplateSpec(in *v1beta1.AzureMachineTemplateSpec, out *AzureMachineTemplateSpec, s conversion.Scope) error { - if err := Convert_v1beta1_AzureMachineTemplateResource_To_v1alpha4_AzureMachineTemplateResource(&in.Template, &out.Template, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta1_AzureMachineTemplateSpec_To_v1alpha4_AzureMachineTemplateSpec is an autogenerated conversion function. -func Convert_v1beta1_AzureMachineTemplateSpec_To_v1alpha4_AzureMachineTemplateSpec(in *v1beta1.AzureMachineTemplateSpec, out *AzureMachineTemplateSpec, s conversion.Scope) error { - return autoConvert_v1beta1_AzureMachineTemplateSpec_To_v1alpha4_AzureMachineTemplateSpec(in, out, s) -} - -func autoConvert_v1alpha4_AzureManagedCluster_To_v1beta1_AzureManagedCluster(in *AzureManagedCluster, out *v1beta1.AzureManagedCluster, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha4_AzureManagedClusterSpec_To_v1beta1_AzureManagedClusterSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1alpha4_AzureManagedClusterStatus_To_v1beta1_AzureManagedClusterStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha4_AzureManagedCluster_To_v1beta1_AzureManagedCluster is an autogenerated conversion function. -func Convert_v1alpha4_AzureManagedCluster_To_v1beta1_AzureManagedCluster(in *AzureManagedCluster, out *v1beta1.AzureManagedCluster, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureManagedCluster_To_v1beta1_AzureManagedCluster(in, out, s) -} - -func autoConvert_v1beta1_AzureManagedCluster_To_v1alpha4_AzureManagedCluster(in *v1beta1.AzureManagedCluster, out *AzureManagedCluster, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1beta1_AzureManagedClusterSpec_To_v1alpha4_AzureManagedClusterSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1beta1_AzureManagedClusterStatus_To_v1alpha4_AzureManagedClusterStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta1_AzureManagedCluster_To_v1alpha4_AzureManagedCluster is an autogenerated conversion function. -func Convert_v1beta1_AzureManagedCluster_To_v1alpha4_AzureManagedCluster(in *v1beta1.AzureManagedCluster, out *AzureManagedCluster, s conversion.Scope) error { - return autoConvert_v1beta1_AzureManagedCluster_To_v1alpha4_AzureManagedCluster(in, out, s) -} - -func autoConvert_v1alpha4_AzureManagedClusterList_To_v1beta1_AzureManagedClusterList(in *AzureManagedClusterList, out *v1beta1.AzureManagedClusterList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]v1beta1.AzureManagedCluster, len(*in)) - for i := range *in { - if err := Convert_v1alpha4_AzureManagedCluster_To_v1beta1_AzureManagedCluster(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1alpha4_AzureManagedClusterList_To_v1beta1_AzureManagedClusterList is an autogenerated conversion function. -func Convert_v1alpha4_AzureManagedClusterList_To_v1beta1_AzureManagedClusterList(in *AzureManagedClusterList, out *v1beta1.AzureManagedClusterList, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureManagedClusterList_To_v1beta1_AzureManagedClusterList(in, out, s) -} - -func autoConvert_v1beta1_AzureManagedClusterList_To_v1alpha4_AzureManagedClusterList(in *v1beta1.AzureManagedClusterList, out *AzureManagedClusterList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]AzureManagedCluster, len(*in)) - for i := range *in { - if err := Convert_v1beta1_AzureManagedCluster_To_v1alpha4_AzureManagedCluster(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1beta1_AzureManagedClusterList_To_v1alpha4_AzureManagedClusterList is an autogenerated conversion function. -func Convert_v1beta1_AzureManagedClusterList_To_v1alpha4_AzureManagedClusterList(in *v1beta1.AzureManagedClusterList, out *AzureManagedClusterList, s conversion.Scope) error { - return autoConvert_v1beta1_AzureManagedClusterList_To_v1alpha4_AzureManagedClusterList(in, out, s) -} - -func autoConvert_v1alpha4_AzureManagedClusterSpec_To_v1beta1_AzureManagedClusterSpec(in *AzureManagedClusterSpec, out *v1beta1.AzureManagedClusterSpec, s conversion.Scope) error { - if err := apiv1alpha4.Convert_v1alpha4_APIEndpoint_To_v1beta1_APIEndpoint(&in.ControlPlaneEndpoint, &out.ControlPlaneEndpoint, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha4_AzureManagedClusterSpec_To_v1beta1_AzureManagedClusterSpec is an autogenerated conversion function. -func Convert_v1alpha4_AzureManagedClusterSpec_To_v1beta1_AzureManagedClusterSpec(in *AzureManagedClusterSpec, out *v1beta1.AzureManagedClusterSpec, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureManagedClusterSpec_To_v1beta1_AzureManagedClusterSpec(in, out, s) -} - -func autoConvert_v1beta1_AzureManagedClusterSpec_To_v1alpha4_AzureManagedClusterSpec(in *v1beta1.AzureManagedClusterSpec, out *AzureManagedClusterSpec, s conversion.Scope) error { - if err := apiv1alpha4.Convert_v1beta1_APIEndpoint_To_v1alpha4_APIEndpoint(&in.ControlPlaneEndpoint, &out.ControlPlaneEndpoint, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta1_AzureManagedClusterSpec_To_v1alpha4_AzureManagedClusterSpec is an autogenerated conversion function. -func Convert_v1beta1_AzureManagedClusterSpec_To_v1alpha4_AzureManagedClusterSpec(in *v1beta1.AzureManagedClusterSpec, out *AzureManagedClusterSpec, s conversion.Scope) error { - return autoConvert_v1beta1_AzureManagedClusterSpec_To_v1alpha4_AzureManagedClusterSpec(in, out, s) -} - -func autoConvert_v1alpha4_AzureManagedClusterStatus_To_v1beta1_AzureManagedClusterStatus(in *AzureManagedClusterStatus, out *v1beta1.AzureManagedClusterStatus, s conversion.Scope) error { - out.Ready = in.Ready - return nil -} - -// Convert_v1alpha4_AzureManagedClusterStatus_To_v1beta1_AzureManagedClusterStatus is an autogenerated conversion function. -func Convert_v1alpha4_AzureManagedClusterStatus_To_v1beta1_AzureManagedClusterStatus(in *AzureManagedClusterStatus, out *v1beta1.AzureManagedClusterStatus, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureManagedClusterStatus_To_v1beta1_AzureManagedClusterStatus(in, out, s) -} - -func autoConvert_v1beta1_AzureManagedClusterStatus_To_v1alpha4_AzureManagedClusterStatus(in *v1beta1.AzureManagedClusterStatus, out *AzureManagedClusterStatus, s conversion.Scope) error { - out.Ready = in.Ready - return nil -} - -// Convert_v1beta1_AzureManagedClusterStatus_To_v1alpha4_AzureManagedClusterStatus is an autogenerated conversion function. -func Convert_v1beta1_AzureManagedClusterStatus_To_v1alpha4_AzureManagedClusterStatus(in *v1beta1.AzureManagedClusterStatus, out *AzureManagedClusterStatus, s conversion.Scope) error { - return autoConvert_v1beta1_AzureManagedClusterStatus_To_v1alpha4_AzureManagedClusterStatus(in, out, s) -} - -func autoConvert_v1alpha4_AzureManagedControlPlane_To_v1beta1_AzureManagedControlPlane(in *AzureManagedControlPlane, out *v1beta1.AzureManagedControlPlane, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha4_AzureManagedControlPlaneSpec_To_v1beta1_AzureManagedControlPlaneSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1alpha4_AzureManagedControlPlaneStatus_To_v1beta1_AzureManagedControlPlaneStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha4_AzureManagedControlPlane_To_v1beta1_AzureManagedControlPlane is an autogenerated conversion function. -func Convert_v1alpha4_AzureManagedControlPlane_To_v1beta1_AzureManagedControlPlane(in *AzureManagedControlPlane, out *v1beta1.AzureManagedControlPlane, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureManagedControlPlane_To_v1beta1_AzureManagedControlPlane(in, out, s) -} - -func autoConvert_v1beta1_AzureManagedControlPlane_To_v1alpha4_AzureManagedControlPlane(in *v1beta1.AzureManagedControlPlane, out *AzureManagedControlPlane, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1beta1_AzureManagedControlPlaneSpec_To_v1alpha4_AzureManagedControlPlaneSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1beta1_AzureManagedControlPlaneStatus_To_v1alpha4_AzureManagedControlPlaneStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta1_AzureManagedControlPlane_To_v1alpha4_AzureManagedControlPlane is an autogenerated conversion function. -func Convert_v1beta1_AzureManagedControlPlane_To_v1alpha4_AzureManagedControlPlane(in *v1beta1.AzureManagedControlPlane, out *AzureManagedControlPlane, s conversion.Scope) error { - return autoConvert_v1beta1_AzureManagedControlPlane_To_v1alpha4_AzureManagedControlPlane(in, out, s) -} - -func autoConvert_v1alpha4_AzureManagedControlPlaneList_To_v1beta1_AzureManagedControlPlaneList(in *AzureManagedControlPlaneList, out *v1beta1.AzureManagedControlPlaneList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]v1beta1.AzureManagedControlPlane, len(*in)) - for i := range *in { - if err := Convert_v1alpha4_AzureManagedControlPlane_To_v1beta1_AzureManagedControlPlane(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1alpha4_AzureManagedControlPlaneList_To_v1beta1_AzureManagedControlPlaneList is an autogenerated conversion function. -func Convert_v1alpha4_AzureManagedControlPlaneList_To_v1beta1_AzureManagedControlPlaneList(in *AzureManagedControlPlaneList, out *v1beta1.AzureManagedControlPlaneList, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureManagedControlPlaneList_To_v1beta1_AzureManagedControlPlaneList(in, out, s) -} - -func autoConvert_v1beta1_AzureManagedControlPlaneList_To_v1alpha4_AzureManagedControlPlaneList(in *v1beta1.AzureManagedControlPlaneList, out *AzureManagedControlPlaneList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]AzureManagedControlPlane, len(*in)) - for i := range *in { - if err := Convert_v1beta1_AzureManagedControlPlane_To_v1alpha4_AzureManagedControlPlane(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1beta1_AzureManagedControlPlaneList_To_v1alpha4_AzureManagedControlPlaneList is an autogenerated conversion function. -func Convert_v1beta1_AzureManagedControlPlaneList_To_v1alpha4_AzureManagedControlPlaneList(in *v1beta1.AzureManagedControlPlaneList, out *AzureManagedControlPlaneList, s conversion.Scope) error { - return autoConvert_v1beta1_AzureManagedControlPlaneList_To_v1alpha4_AzureManagedControlPlaneList(in, out, s) -} - -func autoConvert_v1alpha4_AzureManagedControlPlaneSpec_To_v1beta1_AzureManagedControlPlaneSpec(in *AzureManagedControlPlaneSpec, out *v1beta1.AzureManagedControlPlaneSpec, s conversion.Scope) error { - out.Version = in.Version - out.ResourceGroupName = in.ResourceGroupName - out.NodeResourceGroupName = in.NodeResourceGroupName - if err := Convert_v1alpha4_ManagedControlPlaneVirtualNetwork_To_v1beta1_ManagedControlPlaneVirtualNetwork(&in.VirtualNetwork, &out.VirtualNetwork, s); err != nil { - return err - } - out.SubscriptionID = in.SubscriptionID - out.Location = in.Location - if err := apiv1alpha4.Convert_v1alpha4_APIEndpoint_To_v1beta1_APIEndpoint(&in.ControlPlaneEndpoint, &out.ControlPlaneEndpoint, s); err != nil { - return err - } - out.AdditionalTags = *(*v1beta1.Tags)(unsafe.Pointer(&in.AdditionalTags)) - out.NetworkPlugin = (*string)(unsafe.Pointer(in.NetworkPlugin)) - out.NetworkPolicy = (*string)(unsafe.Pointer(in.NetworkPolicy)) - out.SSHPublicKey = in.SSHPublicKey - out.DNSServiceIP = (*string)(unsafe.Pointer(in.DNSServiceIP)) - out.LoadBalancerSKU = (*string)(unsafe.Pointer(in.LoadBalancerSKU)) - out.IdentityRef = (*corev1.ObjectReference)(unsafe.Pointer(in.IdentityRef)) - out.AADProfile = (*v1beta1.AADProfile)(unsafe.Pointer(in.AADProfile)) - out.SKU = (*v1beta1.AKSSku)(unsafe.Pointer(in.SKU)) - out.LoadBalancerProfile = (*v1beta1.LoadBalancerProfile)(unsafe.Pointer(in.LoadBalancerProfile)) - out.APIServerAccessProfile = (*v1beta1.APIServerAccessProfile)(unsafe.Pointer(in.APIServerAccessProfile)) - return nil -} - -// Convert_v1alpha4_AzureManagedControlPlaneSpec_To_v1beta1_AzureManagedControlPlaneSpec is an autogenerated conversion function. -func Convert_v1alpha4_AzureManagedControlPlaneSpec_To_v1beta1_AzureManagedControlPlaneSpec(in *AzureManagedControlPlaneSpec, out *v1beta1.AzureManagedControlPlaneSpec, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureManagedControlPlaneSpec_To_v1beta1_AzureManagedControlPlaneSpec(in, out, s) -} - -func autoConvert_v1beta1_AzureManagedControlPlaneSpec_To_v1alpha4_AzureManagedControlPlaneSpec(in *v1beta1.AzureManagedControlPlaneSpec, out *AzureManagedControlPlaneSpec, s conversion.Scope) error { - out.Version = in.Version - out.ResourceGroupName = in.ResourceGroupName - out.NodeResourceGroupName = in.NodeResourceGroupName - if err := Convert_v1beta1_ManagedControlPlaneVirtualNetwork_To_v1alpha4_ManagedControlPlaneVirtualNetwork(&in.VirtualNetwork, &out.VirtualNetwork, s); err != nil { - return err - } - out.SubscriptionID = in.SubscriptionID - out.Location = in.Location - if err := apiv1alpha4.Convert_v1beta1_APIEndpoint_To_v1alpha4_APIEndpoint(&in.ControlPlaneEndpoint, &out.ControlPlaneEndpoint, s); err != nil { - return err - } - out.AdditionalTags = *(*Tags)(unsafe.Pointer(&in.AdditionalTags)) - out.NetworkPlugin = (*string)(unsafe.Pointer(in.NetworkPlugin)) - out.NetworkPolicy = (*string)(unsafe.Pointer(in.NetworkPolicy)) - // WARNING: in.OutboundType requires manual conversion: does not exist in peer-type - out.SSHPublicKey = in.SSHPublicKey - out.DNSServiceIP = (*string)(unsafe.Pointer(in.DNSServiceIP)) - out.LoadBalancerSKU = (*string)(unsafe.Pointer(in.LoadBalancerSKU)) - out.IdentityRef = (*corev1.ObjectReference)(unsafe.Pointer(in.IdentityRef)) - out.AADProfile = (*AADProfile)(unsafe.Pointer(in.AADProfile)) - // WARNING: in.AddonProfiles requires manual conversion: does not exist in peer-type - out.SKU = (*AKSSku)(unsafe.Pointer(in.SKU)) - out.LoadBalancerProfile = (*LoadBalancerProfile)(unsafe.Pointer(in.LoadBalancerProfile)) - out.APIServerAccessProfile = (*APIServerAccessProfile)(unsafe.Pointer(in.APIServerAccessProfile)) - // WARNING: in.AutoScalerProfile requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha4_AzureManagedControlPlaneStatus_To_v1beta1_AzureManagedControlPlaneStatus(in *AzureManagedControlPlaneStatus, out *v1beta1.AzureManagedControlPlaneStatus, s conversion.Scope) error { - out.Ready = in.Ready - out.Initialized = in.Initialized - out.LongRunningOperationStates = *(*v1beta1.Futures)(unsafe.Pointer(&in.LongRunningOperationStates)) - return nil -} - -// Convert_v1alpha4_AzureManagedControlPlaneStatus_To_v1beta1_AzureManagedControlPlaneStatus is an autogenerated conversion function. -func Convert_v1alpha4_AzureManagedControlPlaneStatus_To_v1beta1_AzureManagedControlPlaneStatus(in *AzureManagedControlPlaneStatus, out *v1beta1.AzureManagedControlPlaneStatus, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureManagedControlPlaneStatus_To_v1beta1_AzureManagedControlPlaneStatus(in, out, s) -} - -func autoConvert_v1beta1_AzureManagedControlPlaneStatus_To_v1alpha4_AzureManagedControlPlaneStatus(in *v1beta1.AzureManagedControlPlaneStatus, out *AzureManagedControlPlaneStatus, s conversion.Scope) error { - out.Ready = in.Ready - out.Initialized = in.Initialized - // WARNING: in.Conditions requires manual conversion: does not exist in peer-type - out.LongRunningOperationStates = *(*Futures)(unsafe.Pointer(&in.LongRunningOperationStates)) - return nil -} - -func autoConvert_v1alpha4_AzureManagedMachinePool_To_v1beta1_AzureManagedMachinePool(in *AzureManagedMachinePool, out *v1beta1.AzureManagedMachinePool, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha4_AzureManagedMachinePoolSpec_To_v1beta1_AzureManagedMachinePoolSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1alpha4_AzureManagedMachinePoolStatus_To_v1beta1_AzureManagedMachinePoolStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha4_AzureManagedMachinePool_To_v1beta1_AzureManagedMachinePool is an autogenerated conversion function. -func Convert_v1alpha4_AzureManagedMachinePool_To_v1beta1_AzureManagedMachinePool(in *AzureManagedMachinePool, out *v1beta1.AzureManagedMachinePool, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureManagedMachinePool_To_v1beta1_AzureManagedMachinePool(in, out, s) -} - -func autoConvert_v1beta1_AzureManagedMachinePool_To_v1alpha4_AzureManagedMachinePool(in *v1beta1.AzureManagedMachinePool, out *AzureManagedMachinePool, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1beta1_AzureManagedMachinePoolSpec_To_v1alpha4_AzureManagedMachinePoolSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1beta1_AzureManagedMachinePoolStatus_To_v1alpha4_AzureManagedMachinePoolStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta1_AzureManagedMachinePool_To_v1alpha4_AzureManagedMachinePool is an autogenerated conversion function. -func Convert_v1beta1_AzureManagedMachinePool_To_v1alpha4_AzureManagedMachinePool(in *v1beta1.AzureManagedMachinePool, out *AzureManagedMachinePool, s conversion.Scope) error { - return autoConvert_v1beta1_AzureManagedMachinePool_To_v1alpha4_AzureManagedMachinePool(in, out, s) -} - -func autoConvert_v1alpha4_AzureManagedMachinePoolList_To_v1beta1_AzureManagedMachinePoolList(in *AzureManagedMachinePoolList, out *v1beta1.AzureManagedMachinePoolList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]v1beta1.AzureManagedMachinePool, len(*in)) - for i := range *in { - if err := Convert_v1alpha4_AzureManagedMachinePool_To_v1beta1_AzureManagedMachinePool(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1alpha4_AzureManagedMachinePoolList_To_v1beta1_AzureManagedMachinePoolList is an autogenerated conversion function. -func Convert_v1alpha4_AzureManagedMachinePoolList_To_v1beta1_AzureManagedMachinePoolList(in *AzureManagedMachinePoolList, out *v1beta1.AzureManagedMachinePoolList, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureManagedMachinePoolList_To_v1beta1_AzureManagedMachinePoolList(in, out, s) -} - -func autoConvert_v1beta1_AzureManagedMachinePoolList_To_v1alpha4_AzureManagedMachinePoolList(in *v1beta1.AzureManagedMachinePoolList, out *AzureManagedMachinePoolList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]AzureManagedMachinePool, len(*in)) - for i := range *in { - if err := Convert_v1beta1_AzureManagedMachinePool_To_v1alpha4_AzureManagedMachinePool(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1beta1_AzureManagedMachinePoolList_To_v1alpha4_AzureManagedMachinePoolList is an autogenerated conversion function. -func Convert_v1beta1_AzureManagedMachinePoolList_To_v1alpha4_AzureManagedMachinePoolList(in *v1beta1.AzureManagedMachinePoolList, out *AzureManagedMachinePoolList, s conversion.Scope) error { - return autoConvert_v1beta1_AzureManagedMachinePoolList_To_v1alpha4_AzureManagedMachinePoolList(in, out, s) -} - -func autoConvert_v1alpha4_AzureManagedMachinePoolSpec_To_v1beta1_AzureManagedMachinePoolSpec(in *AzureManagedMachinePoolSpec, out *v1beta1.AzureManagedMachinePoolSpec, s conversion.Scope) error { - out.Name = (*string)(unsafe.Pointer(in.Name)) - out.Mode = in.Mode - out.SKU = in.SKU - out.OSDiskSizeGB = (*int32)(unsafe.Pointer(in.OSDiskSizeGB)) - out.ProviderIDList = *(*[]string)(unsafe.Pointer(&in.ProviderIDList)) - return nil -} - -// Convert_v1alpha4_AzureManagedMachinePoolSpec_To_v1beta1_AzureManagedMachinePoolSpec is an autogenerated conversion function. -func Convert_v1alpha4_AzureManagedMachinePoolSpec_To_v1beta1_AzureManagedMachinePoolSpec(in *AzureManagedMachinePoolSpec, out *v1beta1.AzureManagedMachinePoolSpec, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureManagedMachinePoolSpec_To_v1beta1_AzureManagedMachinePoolSpec(in, out, s) -} - -func autoConvert_v1beta1_AzureManagedMachinePoolSpec_To_v1alpha4_AzureManagedMachinePoolSpec(in *v1beta1.AzureManagedMachinePoolSpec, out *AzureManagedMachinePoolSpec, s conversion.Scope) error { - // WARNING: in.AdditionalTags requires manual conversion: does not exist in peer-type - out.Name = (*string)(unsafe.Pointer(in.Name)) - out.Mode = in.Mode - out.SKU = in.SKU - out.OSDiskSizeGB = (*int32)(unsafe.Pointer(in.OSDiskSizeGB)) - // WARNING: in.AvailabilityZones requires manual conversion: does not exist in peer-type - // WARNING: in.NodeLabels requires manual conversion: does not exist in peer-type - // WARNING: in.Taints requires manual conversion: does not exist in peer-type - out.ProviderIDList = *(*[]string)(unsafe.Pointer(&in.ProviderIDList)) - // WARNING: in.Scaling requires manual conversion: does not exist in peer-type - // WARNING: in.MaxPods requires manual conversion: does not exist in peer-type - // WARNING: in.OsDiskType requires manual conversion: does not exist in peer-type - // WARNING: in.EnableUltraSSD requires manual conversion: does not exist in peer-type - // WARNING: in.OSType requires manual conversion: does not exist in peer-type - // WARNING: in.EnableNodePublicIP requires manual conversion: does not exist in peer-type - // WARNING: in.NodePublicIPPrefixID requires manual conversion: does not exist in peer-type - // WARNING: in.ScaleSetPriority requires manual conversion: does not exist in peer-type - // WARNING: in.KubeletConfig requires manual conversion: does not exist in peer-type - // WARNING: in.KubeletDiskType requires manual conversion: does not exist in peer-type - // WARNING: in.LinuxOSConfig requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha4_AzureManagedMachinePoolStatus_To_v1beta1_AzureManagedMachinePoolStatus(in *AzureManagedMachinePoolStatus, out *v1beta1.AzureManagedMachinePoolStatus, s conversion.Scope) error { - out.Ready = in.Ready - out.Replicas = in.Replicas - out.ErrorReason = (*errors.MachineStatusError)(unsafe.Pointer(in.ErrorReason)) - out.ErrorMessage = (*string)(unsafe.Pointer(in.ErrorMessage)) - return nil -} - -// Convert_v1alpha4_AzureManagedMachinePoolStatus_To_v1beta1_AzureManagedMachinePoolStatus is an autogenerated conversion function. -func Convert_v1alpha4_AzureManagedMachinePoolStatus_To_v1beta1_AzureManagedMachinePoolStatus(in *AzureManagedMachinePoolStatus, out *v1beta1.AzureManagedMachinePoolStatus, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureManagedMachinePoolStatus_To_v1beta1_AzureManagedMachinePoolStatus(in, out, s) -} - -func autoConvert_v1beta1_AzureManagedMachinePoolStatus_To_v1alpha4_AzureManagedMachinePoolStatus(in *v1beta1.AzureManagedMachinePoolStatus, out *AzureManagedMachinePoolStatus, s conversion.Scope) error { - out.Ready = in.Ready - out.Replicas = in.Replicas - out.ErrorReason = (*errors.MachineStatusError)(unsafe.Pointer(in.ErrorReason)) - out.ErrorMessage = (*string)(unsafe.Pointer(in.ErrorMessage)) - // WARNING: in.Conditions requires manual conversion: does not exist in peer-type - // WARNING: in.LongRunningOperationStates requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha4_AzureMarketplaceImage_To_v1beta1_AzureMarketplaceImage(in *AzureMarketplaceImage, out *v1beta1.AzureMarketplaceImage, s conversion.Scope) error { - // WARNING: in.Publisher requires manual conversion: does not exist in peer-type - // WARNING: in.Offer requires manual conversion: does not exist in peer-type - // WARNING: in.SKU requires manual conversion: does not exist in peer-type - out.Version = in.Version - out.ThirdPartyImage = in.ThirdPartyImage - return nil -} - -func autoConvert_v1beta1_AzureMarketplaceImage_To_v1alpha4_AzureMarketplaceImage(in *v1beta1.AzureMarketplaceImage, out *AzureMarketplaceImage, s conversion.Scope) error { - // WARNING: in.ImagePlan requires manual conversion: does not exist in peer-type - out.Version = in.Version - out.ThirdPartyImage = in.ThirdPartyImage - return nil -} - -func autoConvert_v1alpha4_AzureSharedGalleryImage_To_v1beta1_AzureSharedGalleryImage(in *AzureSharedGalleryImage, out *v1beta1.AzureSharedGalleryImage, s conversion.Scope) error { - out.SubscriptionID = in.SubscriptionID - out.ResourceGroup = in.ResourceGroup - out.Gallery = in.Gallery - out.Name = in.Name - out.Version = in.Version - out.Publisher = (*string)(unsafe.Pointer(in.Publisher)) - out.Offer = (*string)(unsafe.Pointer(in.Offer)) - out.SKU = (*string)(unsafe.Pointer(in.SKU)) - return nil -} - -// Convert_v1alpha4_AzureSharedGalleryImage_To_v1beta1_AzureSharedGalleryImage is an autogenerated conversion function. -func Convert_v1alpha4_AzureSharedGalleryImage_To_v1beta1_AzureSharedGalleryImage(in *AzureSharedGalleryImage, out *v1beta1.AzureSharedGalleryImage, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureSharedGalleryImage_To_v1beta1_AzureSharedGalleryImage(in, out, s) -} - -func autoConvert_v1beta1_AzureSharedGalleryImage_To_v1alpha4_AzureSharedGalleryImage(in *v1beta1.AzureSharedGalleryImage, out *AzureSharedGalleryImage, s conversion.Scope) error { - out.SubscriptionID = in.SubscriptionID - out.ResourceGroup = in.ResourceGroup - out.Gallery = in.Gallery - out.Name = in.Name - out.Version = in.Version - out.Publisher = (*string)(unsafe.Pointer(in.Publisher)) - out.Offer = (*string)(unsafe.Pointer(in.Offer)) - out.SKU = (*string)(unsafe.Pointer(in.SKU)) - return nil -} - -// Convert_v1beta1_AzureSharedGalleryImage_To_v1alpha4_AzureSharedGalleryImage is an autogenerated conversion function. -func Convert_v1beta1_AzureSharedGalleryImage_To_v1alpha4_AzureSharedGalleryImage(in *v1beta1.AzureSharedGalleryImage, out *AzureSharedGalleryImage, s conversion.Scope) error { - return autoConvert_v1beta1_AzureSharedGalleryImage_To_v1alpha4_AzureSharedGalleryImage(in, out, s) -} - -func autoConvert_v1alpha4_BackOffConfig_To_v1beta1_BackOffConfig(in *BackOffConfig, out *v1beta1.BackOffConfig, s conversion.Scope) error { - out.CloudProviderBackoff = in.CloudProviderBackoff - out.CloudProviderBackoffRetries = in.CloudProviderBackoffRetries - out.CloudProviderBackoffExponent = (*resource.Quantity)(unsafe.Pointer(in.CloudProviderBackoffExponent)) - out.CloudProviderBackoffDuration = in.CloudProviderBackoffDuration - out.CloudProviderBackoffJitter = (*resource.Quantity)(unsafe.Pointer(in.CloudProviderBackoffJitter)) - return nil -} - -// Convert_v1alpha4_BackOffConfig_To_v1beta1_BackOffConfig is an autogenerated conversion function. -func Convert_v1alpha4_BackOffConfig_To_v1beta1_BackOffConfig(in *BackOffConfig, out *v1beta1.BackOffConfig, s conversion.Scope) error { - return autoConvert_v1alpha4_BackOffConfig_To_v1beta1_BackOffConfig(in, out, s) -} - -func autoConvert_v1beta1_BackOffConfig_To_v1alpha4_BackOffConfig(in *v1beta1.BackOffConfig, out *BackOffConfig, s conversion.Scope) error { - out.CloudProviderBackoff = in.CloudProviderBackoff - out.CloudProviderBackoffRetries = in.CloudProviderBackoffRetries - out.CloudProviderBackoffExponent = (*resource.Quantity)(unsafe.Pointer(in.CloudProviderBackoffExponent)) - out.CloudProviderBackoffDuration = in.CloudProviderBackoffDuration - out.CloudProviderBackoffJitter = (*resource.Quantity)(unsafe.Pointer(in.CloudProviderBackoffJitter)) - return nil -} - -// Convert_v1beta1_BackOffConfig_To_v1alpha4_BackOffConfig is an autogenerated conversion function. -func Convert_v1beta1_BackOffConfig_To_v1alpha4_BackOffConfig(in *v1beta1.BackOffConfig, out *BackOffConfig, s conversion.Scope) error { - return autoConvert_v1beta1_BackOffConfig_To_v1alpha4_BackOffConfig(in, out, s) -} - -func autoConvert_v1alpha4_BastionSpec_To_v1beta1_BastionSpec(in *BastionSpec, out *v1beta1.BastionSpec, s conversion.Scope) error { - if in.AzureBastion != nil { - in, out := &in.AzureBastion, &out.AzureBastion - *out = new(v1beta1.AzureBastion) - if err := Convert_v1alpha4_AzureBastion_To_v1beta1_AzureBastion(*in, *out, s); err != nil { - return err - } - } else { - out.AzureBastion = nil - } - return nil -} - -// Convert_v1alpha4_BastionSpec_To_v1beta1_BastionSpec is an autogenerated conversion function. -func Convert_v1alpha4_BastionSpec_To_v1beta1_BastionSpec(in *BastionSpec, out *v1beta1.BastionSpec, s conversion.Scope) error { - return autoConvert_v1alpha4_BastionSpec_To_v1beta1_BastionSpec(in, out, s) -} - -func autoConvert_v1beta1_BastionSpec_To_v1alpha4_BastionSpec(in *v1beta1.BastionSpec, out *BastionSpec, s conversion.Scope) error { - if in.AzureBastion != nil { - in, out := &in.AzureBastion, &out.AzureBastion - *out = new(AzureBastion) - if err := Convert_v1beta1_AzureBastion_To_v1alpha4_AzureBastion(*in, *out, s); err != nil { - return err - } - } else { - out.AzureBastion = nil - } - return nil -} - -// Convert_v1beta1_BastionSpec_To_v1alpha4_BastionSpec is an autogenerated conversion function. -func Convert_v1beta1_BastionSpec_To_v1alpha4_BastionSpec(in *v1beta1.BastionSpec, out *BastionSpec, s conversion.Scope) error { - return autoConvert_v1beta1_BastionSpec_To_v1alpha4_BastionSpec(in, out, s) -} - -func autoConvert_v1alpha4_BuildParams_To_v1beta1_BuildParams(in *BuildParams, out *v1beta1.BuildParams, s conversion.Scope) error { - out.Lifecycle = v1beta1.ResourceLifecycle(in.Lifecycle) - out.ClusterName = in.ClusterName - out.ResourceID = in.ResourceID - out.Name = (*string)(unsafe.Pointer(in.Name)) - out.Role = (*string)(unsafe.Pointer(in.Role)) - out.Additional = *(*v1beta1.Tags)(unsafe.Pointer(&in.Additional)) - return nil -} - -// Convert_v1alpha4_BuildParams_To_v1beta1_BuildParams is an autogenerated conversion function. -func Convert_v1alpha4_BuildParams_To_v1beta1_BuildParams(in *BuildParams, out *v1beta1.BuildParams, s conversion.Scope) error { - return autoConvert_v1alpha4_BuildParams_To_v1beta1_BuildParams(in, out, s) -} - -func autoConvert_v1beta1_BuildParams_To_v1alpha4_BuildParams(in *v1beta1.BuildParams, out *BuildParams, s conversion.Scope) error { - out.Lifecycle = ResourceLifecycle(in.Lifecycle) - out.ClusterName = in.ClusterName - out.ResourceID = in.ResourceID - out.Name = (*string)(unsafe.Pointer(in.Name)) - out.Role = (*string)(unsafe.Pointer(in.Role)) - out.Additional = *(*Tags)(unsafe.Pointer(&in.Additional)) - return nil -} - -// Convert_v1beta1_BuildParams_To_v1alpha4_BuildParams is an autogenerated conversion function. -func Convert_v1beta1_BuildParams_To_v1alpha4_BuildParams(in *v1beta1.BuildParams, out *BuildParams, s conversion.Scope) error { - return autoConvert_v1beta1_BuildParams_To_v1alpha4_BuildParams(in, out, s) -} - -func autoConvert_v1alpha4_CloudProviderConfigOverrides_To_v1beta1_CloudProviderConfigOverrides(in *CloudProviderConfigOverrides, out *v1beta1.CloudProviderConfigOverrides, s conversion.Scope) error { - out.RateLimits = *(*[]v1beta1.RateLimitSpec)(unsafe.Pointer(&in.RateLimits)) - if err := Convert_v1alpha4_BackOffConfig_To_v1beta1_BackOffConfig(&in.BackOffs, &out.BackOffs, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha4_CloudProviderConfigOverrides_To_v1beta1_CloudProviderConfigOverrides is an autogenerated conversion function. -func Convert_v1alpha4_CloudProviderConfigOverrides_To_v1beta1_CloudProviderConfigOverrides(in *CloudProviderConfigOverrides, out *v1beta1.CloudProviderConfigOverrides, s conversion.Scope) error { - return autoConvert_v1alpha4_CloudProviderConfigOverrides_To_v1beta1_CloudProviderConfigOverrides(in, out, s) -} - -func autoConvert_v1beta1_CloudProviderConfigOverrides_To_v1alpha4_CloudProviderConfigOverrides(in *v1beta1.CloudProviderConfigOverrides, out *CloudProviderConfigOverrides, s conversion.Scope) error { - out.RateLimits = *(*[]RateLimitSpec)(unsafe.Pointer(&in.RateLimits)) - if err := Convert_v1beta1_BackOffConfig_To_v1alpha4_BackOffConfig(&in.BackOffs, &out.BackOffs, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta1_CloudProviderConfigOverrides_To_v1alpha4_CloudProviderConfigOverrides is an autogenerated conversion function. -func Convert_v1beta1_CloudProviderConfigOverrides_To_v1alpha4_CloudProviderConfigOverrides(in *v1beta1.CloudProviderConfigOverrides, out *CloudProviderConfigOverrides, s conversion.Scope) error { - return autoConvert_v1beta1_CloudProviderConfigOverrides_To_v1alpha4_CloudProviderConfigOverrides(in, out, s) -} - -func autoConvert_v1alpha4_DataDisk_To_v1beta1_DataDisk(in *DataDisk, out *v1beta1.DataDisk, s conversion.Scope) error { - out.NameSuffix = in.NameSuffix - out.DiskSizeGB = in.DiskSizeGB - out.ManagedDisk = (*v1beta1.ManagedDiskParameters)(unsafe.Pointer(in.ManagedDisk)) - out.Lun = (*int32)(unsafe.Pointer(in.Lun)) - out.CachingType = in.CachingType - return nil -} - -// Convert_v1alpha4_DataDisk_To_v1beta1_DataDisk is an autogenerated conversion function. -func Convert_v1alpha4_DataDisk_To_v1beta1_DataDisk(in *DataDisk, out *v1beta1.DataDisk, s conversion.Scope) error { - return autoConvert_v1alpha4_DataDisk_To_v1beta1_DataDisk(in, out, s) -} - -func autoConvert_v1beta1_DataDisk_To_v1alpha4_DataDisk(in *v1beta1.DataDisk, out *DataDisk, s conversion.Scope) error { - out.NameSuffix = in.NameSuffix - out.DiskSizeGB = in.DiskSizeGB - out.ManagedDisk = (*ManagedDiskParameters)(unsafe.Pointer(in.ManagedDisk)) - out.Lun = (*int32)(unsafe.Pointer(in.Lun)) - out.CachingType = in.CachingType - return nil -} - -// Convert_v1beta1_DataDisk_To_v1alpha4_DataDisk is an autogenerated conversion function. -func Convert_v1beta1_DataDisk_To_v1alpha4_DataDisk(in *v1beta1.DataDisk, out *DataDisk, s conversion.Scope) error { - return autoConvert_v1beta1_DataDisk_To_v1alpha4_DataDisk(in, out, s) -} - -func autoConvert_v1alpha4_DiffDiskSettings_To_v1beta1_DiffDiskSettings(in *DiffDiskSettings, out *v1beta1.DiffDiskSettings, s conversion.Scope) error { - out.Option = in.Option - return nil -} - -// Convert_v1alpha4_DiffDiskSettings_To_v1beta1_DiffDiskSettings is an autogenerated conversion function. -func Convert_v1alpha4_DiffDiskSettings_To_v1beta1_DiffDiskSettings(in *DiffDiskSettings, out *v1beta1.DiffDiskSettings, s conversion.Scope) error { - return autoConvert_v1alpha4_DiffDiskSettings_To_v1beta1_DiffDiskSettings(in, out, s) -} - -func autoConvert_v1beta1_DiffDiskSettings_To_v1alpha4_DiffDiskSettings(in *v1beta1.DiffDiskSettings, out *DiffDiskSettings, s conversion.Scope) error { - out.Option = in.Option - return nil -} - -// Convert_v1beta1_DiffDiskSettings_To_v1alpha4_DiffDiskSettings is an autogenerated conversion function. -func Convert_v1beta1_DiffDiskSettings_To_v1alpha4_DiffDiskSettings(in *v1beta1.DiffDiskSettings, out *DiffDiskSettings, s conversion.Scope) error { - return autoConvert_v1beta1_DiffDiskSettings_To_v1alpha4_DiffDiskSettings(in, out, s) -} - -func autoConvert_v1alpha4_DiskEncryptionSetParameters_To_v1beta1_DiskEncryptionSetParameters(in *DiskEncryptionSetParameters, out *v1beta1.DiskEncryptionSetParameters, s conversion.Scope) error { - out.ID = in.ID - return nil -} - -// Convert_v1alpha4_DiskEncryptionSetParameters_To_v1beta1_DiskEncryptionSetParameters is an autogenerated conversion function. -func Convert_v1alpha4_DiskEncryptionSetParameters_To_v1beta1_DiskEncryptionSetParameters(in *DiskEncryptionSetParameters, out *v1beta1.DiskEncryptionSetParameters, s conversion.Scope) error { - return autoConvert_v1alpha4_DiskEncryptionSetParameters_To_v1beta1_DiskEncryptionSetParameters(in, out, s) -} - -func autoConvert_v1beta1_DiskEncryptionSetParameters_To_v1alpha4_DiskEncryptionSetParameters(in *v1beta1.DiskEncryptionSetParameters, out *DiskEncryptionSetParameters, s conversion.Scope) error { - out.ID = in.ID - return nil -} - -// Convert_v1beta1_DiskEncryptionSetParameters_To_v1alpha4_DiskEncryptionSetParameters is an autogenerated conversion function. -func Convert_v1beta1_DiskEncryptionSetParameters_To_v1alpha4_DiskEncryptionSetParameters(in *v1beta1.DiskEncryptionSetParameters, out *DiskEncryptionSetParameters, s conversion.Scope) error { - return autoConvert_v1beta1_DiskEncryptionSetParameters_To_v1alpha4_DiskEncryptionSetParameters(in, out, s) -} - -func autoConvert_v1alpha4_FrontendIP_To_v1beta1_FrontendIP(in *FrontendIP, out *v1beta1.FrontendIP, s conversion.Scope) error { - out.Name = in.Name - // WARNING: in.PrivateIPAddress requires manual conversion: does not exist in peer-type - if in.PublicIP != nil { - in, out := &in.PublicIP, &out.PublicIP - *out = new(v1beta1.PublicIPSpec) - if err := Convert_v1alpha4_PublicIPSpec_To_v1beta1_PublicIPSpec(*in, *out, s); err != nil { - return err - } - } else { - out.PublicIP = nil - } - return nil -} - -func autoConvert_v1beta1_FrontendIP_To_v1alpha4_FrontendIP(in *v1beta1.FrontendIP, out *FrontendIP, s conversion.Scope) error { - out.Name = in.Name - if in.PublicIP != nil { - in, out := &in.PublicIP, &out.PublicIP - *out = new(PublicIPSpec) - if err := Convert_v1beta1_PublicIPSpec_To_v1alpha4_PublicIPSpec(*in, *out, s); err != nil { - return err - } - } else { - out.PublicIP = nil - } - // WARNING: in.FrontendIPClass requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha4_Future_To_v1beta1_Future(in *Future, out *v1beta1.Future, s conversion.Scope) error { - out.Type = in.Type - out.ResourceGroup = in.ResourceGroup - out.ServiceName = in.ServiceName - out.Name = in.Name - out.Data = in.Data - return nil -} - -// Convert_v1alpha4_Future_To_v1beta1_Future is an autogenerated conversion function. -func Convert_v1alpha4_Future_To_v1beta1_Future(in *Future, out *v1beta1.Future, s conversion.Scope) error { - return autoConvert_v1alpha4_Future_To_v1beta1_Future(in, out, s) -} - -func autoConvert_v1beta1_Future_To_v1alpha4_Future(in *v1beta1.Future, out *Future, s conversion.Scope) error { - out.Type = in.Type - out.ResourceGroup = in.ResourceGroup - out.ServiceName = in.ServiceName - out.Name = in.Name - out.Data = in.Data - return nil -} - -// Convert_v1beta1_Future_To_v1alpha4_Future is an autogenerated conversion function. -func Convert_v1beta1_Future_To_v1alpha4_Future(in *v1beta1.Future, out *Future, s conversion.Scope) error { - return autoConvert_v1beta1_Future_To_v1alpha4_Future(in, out, s) -} - -func autoConvert_v1alpha4_Image_To_v1beta1_Image(in *Image, out *v1beta1.Image, s conversion.Scope) error { - out.ID = (*string)(unsafe.Pointer(in.ID)) - out.SharedGallery = (*v1beta1.AzureSharedGalleryImage)(unsafe.Pointer(in.SharedGallery)) - if in.Marketplace != nil { - in, out := &in.Marketplace, &out.Marketplace - *out = new(v1beta1.AzureMarketplaceImage) - if err := Convert_v1alpha4_AzureMarketplaceImage_To_v1beta1_AzureMarketplaceImage(*in, *out, s); err != nil { - return err - } - } else { - out.Marketplace = nil - } - return nil -} - -// Convert_v1alpha4_Image_To_v1beta1_Image is an autogenerated conversion function. -func Convert_v1alpha4_Image_To_v1beta1_Image(in *Image, out *v1beta1.Image, s conversion.Scope) error { - return autoConvert_v1alpha4_Image_To_v1beta1_Image(in, out, s) -} - -func autoConvert_v1beta1_Image_To_v1alpha4_Image(in *v1beta1.Image, out *Image, s conversion.Scope) error { - out.ID = (*string)(unsafe.Pointer(in.ID)) - out.SharedGallery = (*AzureSharedGalleryImage)(unsafe.Pointer(in.SharedGallery)) - if in.Marketplace != nil { - in, out := &in.Marketplace, &out.Marketplace - *out = new(AzureMarketplaceImage) - if err := Convert_v1beta1_AzureMarketplaceImage_To_v1alpha4_AzureMarketplaceImage(*in, *out, s); err != nil { - return err - } - } else { - out.Marketplace = nil - } - // WARNING: in.ComputeGallery requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha4_LoadBalancerProfile_To_v1beta1_LoadBalancerProfile(in *LoadBalancerProfile, out *v1beta1.LoadBalancerProfile, s conversion.Scope) error { - out.ManagedOutboundIPs = (*int32)(unsafe.Pointer(in.ManagedOutboundIPs)) - out.OutboundIPPrefixes = *(*[]string)(unsafe.Pointer(&in.OutboundIPPrefixes)) - out.OutboundIPs = *(*[]string)(unsafe.Pointer(&in.OutboundIPs)) - out.AllocatedOutboundPorts = (*int32)(unsafe.Pointer(in.AllocatedOutboundPorts)) - out.IdleTimeoutInMinutes = (*int32)(unsafe.Pointer(in.IdleTimeoutInMinutes)) - return nil -} - -// Convert_v1alpha4_LoadBalancerProfile_To_v1beta1_LoadBalancerProfile is an autogenerated conversion function. -func Convert_v1alpha4_LoadBalancerProfile_To_v1beta1_LoadBalancerProfile(in *LoadBalancerProfile, out *v1beta1.LoadBalancerProfile, s conversion.Scope) error { - return autoConvert_v1alpha4_LoadBalancerProfile_To_v1beta1_LoadBalancerProfile(in, out, s) -} - -func autoConvert_v1beta1_LoadBalancerProfile_To_v1alpha4_LoadBalancerProfile(in *v1beta1.LoadBalancerProfile, out *LoadBalancerProfile, s conversion.Scope) error { - out.ManagedOutboundIPs = (*int32)(unsafe.Pointer(in.ManagedOutboundIPs)) - out.OutboundIPPrefixes = *(*[]string)(unsafe.Pointer(&in.OutboundIPPrefixes)) - out.OutboundIPs = *(*[]string)(unsafe.Pointer(&in.OutboundIPs)) - out.AllocatedOutboundPorts = (*int32)(unsafe.Pointer(in.AllocatedOutboundPorts)) - out.IdleTimeoutInMinutes = (*int32)(unsafe.Pointer(in.IdleTimeoutInMinutes)) - return nil -} - -// Convert_v1beta1_LoadBalancerProfile_To_v1alpha4_LoadBalancerProfile is an autogenerated conversion function. -func Convert_v1beta1_LoadBalancerProfile_To_v1alpha4_LoadBalancerProfile(in *v1beta1.LoadBalancerProfile, out *LoadBalancerProfile, s conversion.Scope) error { - return autoConvert_v1beta1_LoadBalancerProfile_To_v1alpha4_LoadBalancerProfile(in, out, s) -} - -func autoConvert_v1alpha4_LoadBalancerSpec_To_v1beta1_LoadBalancerSpec(in *LoadBalancerSpec, out *v1beta1.LoadBalancerSpec, s conversion.Scope) error { - out.ID = in.ID - out.Name = in.Name - // WARNING: in.SKU requires manual conversion: does not exist in peer-type - if in.FrontendIPs != nil { - in, out := &in.FrontendIPs, &out.FrontendIPs - *out = make([]v1beta1.FrontendIP, len(*in)) - for i := range *in { - if err := Convert_v1alpha4_FrontendIP_To_v1beta1_FrontendIP(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.FrontendIPs = nil - } - // WARNING: in.Type requires manual conversion: does not exist in peer-type - out.FrontendIPsCount = (*int32)(unsafe.Pointer(in.FrontendIPsCount)) - // WARNING: in.IdleTimeoutInMinutes requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1beta1_LoadBalancerSpec_To_v1alpha4_LoadBalancerSpec(in *v1beta1.LoadBalancerSpec, out *LoadBalancerSpec, s conversion.Scope) error { - out.ID = in.ID - out.Name = in.Name - if in.FrontendIPs != nil { - in, out := &in.FrontendIPs, &out.FrontendIPs - *out = make([]FrontendIP, len(*in)) - for i := range *in { - if err := Convert_v1beta1_FrontendIP_To_v1alpha4_FrontendIP(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.FrontendIPs = nil - } - out.FrontendIPsCount = (*int32)(unsafe.Pointer(in.FrontendIPsCount)) - // WARNING: in.BackendPool requires manual conversion: does not exist in peer-type - // WARNING: in.LoadBalancerClassSpec requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha4_ManagedControlPlaneSubnet_To_v1beta1_ManagedControlPlaneSubnet(in *ManagedControlPlaneSubnet, out *v1beta1.ManagedControlPlaneSubnet, s conversion.Scope) error { - out.Name = in.Name - out.CIDRBlock = in.CIDRBlock - return nil -} - -// Convert_v1alpha4_ManagedControlPlaneSubnet_To_v1beta1_ManagedControlPlaneSubnet is an autogenerated conversion function. -func Convert_v1alpha4_ManagedControlPlaneSubnet_To_v1beta1_ManagedControlPlaneSubnet(in *ManagedControlPlaneSubnet, out *v1beta1.ManagedControlPlaneSubnet, s conversion.Scope) error { - return autoConvert_v1alpha4_ManagedControlPlaneSubnet_To_v1beta1_ManagedControlPlaneSubnet(in, out, s) -} - -func autoConvert_v1beta1_ManagedControlPlaneSubnet_To_v1alpha4_ManagedControlPlaneSubnet(in *v1beta1.ManagedControlPlaneSubnet, out *ManagedControlPlaneSubnet, s conversion.Scope) error { - out.Name = in.Name - out.CIDRBlock = in.CIDRBlock - // WARNING: in.ServiceEndpoints requires manual conversion: does not exist in peer-type - // WARNING: in.PrivateEndpoints requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha4_ManagedControlPlaneVirtualNetwork_To_v1beta1_ManagedControlPlaneVirtualNetwork(in *ManagedControlPlaneVirtualNetwork, out *v1beta1.ManagedControlPlaneVirtualNetwork, s conversion.Scope) error { - out.Name = in.Name - out.CIDRBlock = in.CIDRBlock - if err := Convert_v1alpha4_ManagedControlPlaneSubnet_To_v1beta1_ManagedControlPlaneSubnet(&in.Subnet, &out.Subnet, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha4_ManagedControlPlaneVirtualNetwork_To_v1beta1_ManagedControlPlaneVirtualNetwork is an autogenerated conversion function. -func Convert_v1alpha4_ManagedControlPlaneVirtualNetwork_To_v1beta1_ManagedControlPlaneVirtualNetwork(in *ManagedControlPlaneVirtualNetwork, out *v1beta1.ManagedControlPlaneVirtualNetwork, s conversion.Scope) error { - return autoConvert_v1alpha4_ManagedControlPlaneVirtualNetwork_To_v1beta1_ManagedControlPlaneVirtualNetwork(in, out, s) -} - -func autoConvert_v1beta1_ManagedControlPlaneVirtualNetwork_To_v1alpha4_ManagedControlPlaneVirtualNetwork(in *v1beta1.ManagedControlPlaneVirtualNetwork, out *ManagedControlPlaneVirtualNetwork, s conversion.Scope) error { - out.Name = in.Name - out.CIDRBlock = in.CIDRBlock - if err := Convert_v1beta1_ManagedControlPlaneSubnet_To_v1alpha4_ManagedControlPlaneSubnet(&in.Subnet, &out.Subnet, s); err != nil { - return err - } - // WARNING: in.ResourceGroup requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha4_ManagedDiskParameters_To_v1beta1_ManagedDiskParameters(in *ManagedDiskParameters, out *v1beta1.ManagedDiskParameters, s conversion.Scope) error { - out.StorageAccountType = in.StorageAccountType - out.DiskEncryptionSet = (*v1beta1.DiskEncryptionSetParameters)(unsafe.Pointer(in.DiskEncryptionSet)) - return nil -} - -// Convert_v1alpha4_ManagedDiskParameters_To_v1beta1_ManagedDiskParameters is an autogenerated conversion function. -func Convert_v1alpha4_ManagedDiskParameters_To_v1beta1_ManagedDiskParameters(in *ManagedDiskParameters, out *v1beta1.ManagedDiskParameters, s conversion.Scope) error { - return autoConvert_v1alpha4_ManagedDiskParameters_To_v1beta1_ManagedDiskParameters(in, out, s) -} - -func autoConvert_v1beta1_ManagedDiskParameters_To_v1alpha4_ManagedDiskParameters(in *v1beta1.ManagedDiskParameters, out *ManagedDiskParameters, s conversion.Scope) error { - out.StorageAccountType = in.StorageAccountType - out.DiskEncryptionSet = (*DiskEncryptionSetParameters)(unsafe.Pointer(in.DiskEncryptionSet)) - return nil -} - -// Convert_v1beta1_ManagedDiskParameters_To_v1alpha4_ManagedDiskParameters is an autogenerated conversion function. -func Convert_v1beta1_ManagedDiskParameters_To_v1alpha4_ManagedDiskParameters(in *v1beta1.ManagedDiskParameters, out *ManagedDiskParameters, s conversion.Scope) error { - return autoConvert_v1beta1_ManagedDiskParameters_To_v1alpha4_ManagedDiskParameters(in, out, s) -} - -func autoConvert_v1alpha4_NatGateway_To_v1beta1_NatGateway(in *NatGateway, out *v1beta1.NatGateway, s conversion.Scope) error { - out.ID = in.ID - // WARNING: in.Name requires manual conversion: does not exist in peer-type - if err := Convert_v1alpha4_PublicIPSpec_To_v1beta1_PublicIPSpec(&in.NatGatewayIP, &out.NatGatewayIP, s); err != nil { - return err - } - return nil -} - -func autoConvert_v1beta1_NatGateway_To_v1alpha4_NatGateway(in *v1beta1.NatGateway, out *NatGateway, s conversion.Scope) error { - out.ID = in.ID - if err := Convert_v1beta1_PublicIPSpec_To_v1alpha4_PublicIPSpec(&in.NatGatewayIP, &out.NatGatewayIP, s); err != nil { - return err - } - // WARNING: in.NatGatewayClassSpec requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha4_NetworkSpec_To_v1beta1_NetworkSpec(in *NetworkSpec, out *v1beta1.NetworkSpec, s conversion.Scope) error { - if err := Convert_v1alpha4_VnetSpec_To_v1beta1_VnetSpec(&in.Vnet, &out.Vnet, s); err != nil { - return err - } - if in.Subnets != nil { - in, out := &in.Subnets, &out.Subnets - *out = make(v1beta1.Subnets, len(*in)) - for i := range *in { - if err := Convert_v1alpha4_SubnetSpec_To_v1beta1_SubnetSpec(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Subnets = nil - } - if err := Convert_v1alpha4_LoadBalancerSpec_To_v1beta1_LoadBalancerSpec(&in.APIServerLB, &out.APIServerLB, s); err != nil { - return err - } - if in.NodeOutboundLB != nil { - in, out := &in.NodeOutboundLB, &out.NodeOutboundLB - *out = new(v1beta1.LoadBalancerSpec) - if err := Convert_v1alpha4_LoadBalancerSpec_To_v1beta1_LoadBalancerSpec(*in, *out, s); err != nil { - return err - } - } else { - out.NodeOutboundLB = nil - } - if in.ControlPlaneOutboundLB != nil { - in, out := &in.ControlPlaneOutboundLB, &out.ControlPlaneOutboundLB - *out = new(v1beta1.LoadBalancerSpec) - if err := Convert_v1alpha4_LoadBalancerSpec_To_v1beta1_LoadBalancerSpec(*in, *out, s); err != nil { - return err - } - } else { - out.ControlPlaneOutboundLB = nil - } - // WARNING: in.PrivateDNSZoneName requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1beta1_NetworkSpec_To_v1alpha4_NetworkSpec(in *v1beta1.NetworkSpec, out *NetworkSpec, s conversion.Scope) error { - if err := Convert_v1beta1_VnetSpec_To_v1alpha4_VnetSpec(&in.Vnet, &out.Vnet, s); err != nil { - return err - } - if in.Subnets != nil { - in, out := &in.Subnets, &out.Subnets - *out = make(Subnets, len(*in)) - for i := range *in { - if err := Convert_v1beta1_SubnetSpec_To_v1alpha4_SubnetSpec(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Subnets = nil - } - if err := Convert_v1beta1_LoadBalancerSpec_To_v1alpha4_LoadBalancerSpec(&in.APIServerLB, &out.APIServerLB, s); err != nil { - return err - } - if in.NodeOutboundLB != nil { - in, out := &in.NodeOutboundLB, &out.NodeOutboundLB - *out = new(LoadBalancerSpec) - if err := Convert_v1beta1_LoadBalancerSpec_To_v1alpha4_LoadBalancerSpec(*in, *out, s); err != nil { - return err - } - } else { - out.NodeOutboundLB = nil - } - if in.ControlPlaneOutboundLB != nil { - in, out := &in.ControlPlaneOutboundLB, &out.ControlPlaneOutboundLB - *out = new(LoadBalancerSpec) - if err := Convert_v1beta1_LoadBalancerSpec_To_v1alpha4_LoadBalancerSpec(*in, *out, s); err != nil { - return err - } - } else { - out.ControlPlaneOutboundLB = nil - } - // WARNING: in.NetworkClassSpec requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha4_OSDisk_To_v1beta1_OSDisk(in *OSDisk, out *v1beta1.OSDisk, s conversion.Scope) error { - out.OSType = in.OSType - out.DiskSizeGB = (*int32)(unsafe.Pointer(in.DiskSizeGB)) - out.ManagedDisk = (*v1beta1.ManagedDiskParameters)(unsafe.Pointer(in.ManagedDisk)) - out.DiffDiskSettings = (*v1beta1.DiffDiskSettings)(unsafe.Pointer(in.DiffDiskSettings)) - out.CachingType = in.CachingType - return nil -} - -// Convert_v1alpha4_OSDisk_To_v1beta1_OSDisk is an autogenerated conversion function. -func Convert_v1alpha4_OSDisk_To_v1beta1_OSDisk(in *OSDisk, out *v1beta1.OSDisk, s conversion.Scope) error { - return autoConvert_v1alpha4_OSDisk_To_v1beta1_OSDisk(in, out, s) -} - -func autoConvert_v1beta1_OSDisk_To_v1alpha4_OSDisk(in *v1beta1.OSDisk, out *OSDisk, s conversion.Scope) error { - out.OSType = in.OSType - out.DiskSizeGB = (*int32)(unsafe.Pointer(in.DiskSizeGB)) - out.ManagedDisk = (*ManagedDiskParameters)(unsafe.Pointer(in.ManagedDisk)) - out.DiffDiskSettings = (*DiffDiskSettings)(unsafe.Pointer(in.DiffDiskSettings)) - out.CachingType = in.CachingType - return nil -} - -// Convert_v1beta1_OSDisk_To_v1alpha4_OSDisk is an autogenerated conversion function. -func Convert_v1beta1_OSDisk_To_v1alpha4_OSDisk(in *v1beta1.OSDisk, out *OSDisk, s conversion.Scope) error { - return autoConvert_v1beta1_OSDisk_To_v1alpha4_OSDisk(in, out, s) -} - -func autoConvert_v1alpha4_PublicIPSpec_To_v1beta1_PublicIPSpec(in *PublicIPSpec, out *v1beta1.PublicIPSpec, s conversion.Scope) error { - out.Name = in.Name - out.DNSName = in.DNSName - return nil -} - -// Convert_v1alpha4_PublicIPSpec_To_v1beta1_PublicIPSpec is an autogenerated conversion function. -func Convert_v1alpha4_PublicIPSpec_To_v1beta1_PublicIPSpec(in *PublicIPSpec, out *v1beta1.PublicIPSpec, s conversion.Scope) error { - return autoConvert_v1alpha4_PublicIPSpec_To_v1beta1_PublicIPSpec(in, out, s) -} - -func autoConvert_v1beta1_PublicIPSpec_To_v1alpha4_PublicIPSpec(in *v1beta1.PublicIPSpec, out *PublicIPSpec, s conversion.Scope) error { - out.Name = in.Name - out.DNSName = in.DNSName - // WARNING: in.IPTags requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha4_RateLimitConfig_To_v1beta1_RateLimitConfig(in *RateLimitConfig, out *v1beta1.RateLimitConfig, s conversion.Scope) error { - out.CloudProviderRateLimit = in.CloudProviderRateLimit - out.CloudProviderRateLimitQPS = (*resource.Quantity)(unsafe.Pointer(in.CloudProviderRateLimitQPS)) - out.CloudProviderRateLimitBucket = in.CloudProviderRateLimitBucket - out.CloudProviderRateLimitQPSWrite = (*resource.Quantity)(unsafe.Pointer(in.CloudProviderRateLimitQPSWrite)) - out.CloudProviderRateLimitBucketWrite = in.CloudProviderRateLimitBucketWrite - return nil -} - -// Convert_v1alpha4_RateLimitConfig_To_v1beta1_RateLimitConfig is an autogenerated conversion function. -func Convert_v1alpha4_RateLimitConfig_To_v1beta1_RateLimitConfig(in *RateLimitConfig, out *v1beta1.RateLimitConfig, s conversion.Scope) error { - return autoConvert_v1alpha4_RateLimitConfig_To_v1beta1_RateLimitConfig(in, out, s) -} - -func autoConvert_v1beta1_RateLimitConfig_To_v1alpha4_RateLimitConfig(in *v1beta1.RateLimitConfig, out *RateLimitConfig, s conversion.Scope) error { - out.CloudProviderRateLimit = in.CloudProviderRateLimit - out.CloudProviderRateLimitQPS = (*resource.Quantity)(unsafe.Pointer(in.CloudProviderRateLimitQPS)) - out.CloudProviderRateLimitBucket = in.CloudProviderRateLimitBucket - out.CloudProviderRateLimitQPSWrite = (*resource.Quantity)(unsafe.Pointer(in.CloudProviderRateLimitQPSWrite)) - out.CloudProviderRateLimitBucketWrite = in.CloudProviderRateLimitBucketWrite - return nil -} - -// Convert_v1beta1_RateLimitConfig_To_v1alpha4_RateLimitConfig is an autogenerated conversion function. -func Convert_v1beta1_RateLimitConfig_To_v1alpha4_RateLimitConfig(in *v1beta1.RateLimitConfig, out *RateLimitConfig, s conversion.Scope) error { - return autoConvert_v1beta1_RateLimitConfig_To_v1alpha4_RateLimitConfig(in, out, s) -} - -func autoConvert_v1alpha4_RateLimitSpec_To_v1beta1_RateLimitSpec(in *RateLimitSpec, out *v1beta1.RateLimitSpec, s conversion.Scope) error { - out.Name = in.Name - if err := Convert_v1alpha4_RateLimitConfig_To_v1beta1_RateLimitConfig(&in.Config, &out.Config, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha4_RateLimitSpec_To_v1beta1_RateLimitSpec is an autogenerated conversion function. -func Convert_v1alpha4_RateLimitSpec_To_v1beta1_RateLimitSpec(in *RateLimitSpec, out *v1beta1.RateLimitSpec, s conversion.Scope) error { - return autoConvert_v1alpha4_RateLimitSpec_To_v1beta1_RateLimitSpec(in, out, s) -} - -func autoConvert_v1beta1_RateLimitSpec_To_v1alpha4_RateLimitSpec(in *v1beta1.RateLimitSpec, out *RateLimitSpec, s conversion.Scope) error { - out.Name = in.Name - if err := Convert_v1beta1_RateLimitConfig_To_v1alpha4_RateLimitConfig(&in.Config, &out.Config, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta1_RateLimitSpec_To_v1alpha4_RateLimitSpec is an autogenerated conversion function. -func Convert_v1beta1_RateLimitSpec_To_v1alpha4_RateLimitSpec(in *v1beta1.RateLimitSpec, out *RateLimitSpec, s conversion.Scope) error { - return autoConvert_v1beta1_RateLimitSpec_To_v1alpha4_RateLimitSpec(in, out, s) -} - -func autoConvert_v1alpha4_RouteTable_To_v1beta1_RouteTable(in *RouteTable, out *v1beta1.RouteTable, s conversion.Scope) error { - out.ID = in.ID - out.Name = in.Name - return nil -} - -// Convert_v1alpha4_RouteTable_To_v1beta1_RouteTable is an autogenerated conversion function. -func Convert_v1alpha4_RouteTable_To_v1beta1_RouteTable(in *RouteTable, out *v1beta1.RouteTable, s conversion.Scope) error { - return autoConvert_v1alpha4_RouteTable_To_v1beta1_RouteTable(in, out, s) -} - -func autoConvert_v1beta1_RouteTable_To_v1alpha4_RouteTable(in *v1beta1.RouteTable, out *RouteTable, s conversion.Scope) error { - out.ID = in.ID - out.Name = in.Name - return nil -} - -// Convert_v1beta1_RouteTable_To_v1alpha4_RouteTable is an autogenerated conversion function. -func Convert_v1beta1_RouteTable_To_v1alpha4_RouteTable(in *v1beta1.RouteTable, out *RouteTable, s conversion.Scope) error { - return autoConvert_v1beta1_RouteTable_To_v1alpha4_RouteTable(in, out, s) -} - -func autoConvert_v1alpha4_SecurityGroup_To_v1beta1_SecurityGroup(in *SecurityGroup, out *v1beta1.SecurityGroup, s conversion.Scope) error { - out.ID = in.ID - out.Name = in.Name - // WARNING: in.SecurityRules requires manual conversion: does not exist in peer-type - // WARNING: in.Tags requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1beta1_SecurityGroup_To_v1alpha4_SecurityGroup(in *v1beta1.SecurityGroup, out *SecurityGroup, s conversion.Scope) error { - out.ID = in.ID - out.Name = in.Name - // WARNING: in.SecurityGroupClass requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha4_SecurityProfile_To_v1beta1_SecurityProfile(in *SecurityProfile, out *v1beta1.SecurityProfile, s conversion.Scope) error { - out.EncryptionAtHost = (*bool)(unsafe.Pointer(in.EncryptionAtHost)) - return nil -} - -// Convert_v1alpha4_SecurityProfile_To_v1beta1_SecurityProfile is an autogenerated conversion function. -func Convert_v1alpha4_SecurityProfile_To_v1beta1_SecurityProfile(in *SecurityProfile, out *v1beta1.SecurityProfile, s conversion.Scope) error { - return autoConvert_v1alpha4_SecurityProfile_To_v1beta1_SecurityProfile(in, out, s) -} - -func autoConvert_v1beta1_SecurityProfile_To_v1alpha4_SecurityProfile(in *v1beta1.SecurityProfile, out *SecurityProfile, s conversion.Scope) error { - out.EncryptionAtHost = (*bool)(unsafe.Pointer(in.EncryptionAtHost)) - return nil -} - -// Convert_v1beta1_SecurityProfile_To_v1alpha4_SecurityProfile is an autogenerated conversion function. -func Convert_v1beta1_SecurityProfile_To_v1alpha4_SecurityProfile(in *v1beta1.SecurityProfile, out *SecurityProfile, s conversion.Scope) error { - return autoConvert_v1beta1_SecurityProfile_To_v1alpha4_SecurityProfile(in, out, s) -} - -func autoConvert_v1alpha4_SecurityRule_To_v1beta1_SecurityRule(in *SecurityRule, out *v1beta1.SecurityRule, s conversion.Scope) error { - out.Name = in.Name - out.Description = in.Description - out.Protocol = v1beta1.SecurityGroupProtocol(in.Protocol) - out.Direction = v1beta1.SecurityRuleDirection(in.Direction) - out.Priority = in.Priority - out.SourcePorts = (*string)(unsafe.Pointer(in.SourcePorts)) - out.DestinationPorts = (*string)(unsafe.Pointer(in.DestinationPorts)) - out.Source = (*string)(unsafe.Pointer(in.Source)) - out.Destination = (*string)(unsafe.Pointer(in.Destination)) - return nil -} - -// Convert_v1alpha4_SecurityRule_To_v1beta1_SecurityRule is an autogenerated conversion function. -func Convert_v1alpha4_SecurityRule_To_v1beta1_SecurityRule(in *SecurityRule, out *v1beta1.SecurityRule, s conversion.Scope) error { - return autoConvert_v1alpha4_SecurityRule_To_v1beta1_SecurityRule(in, out, s) -} - -func autoConvert_v1beta1_SecurityRule_To_v1alpha4_SecurityRule(in *v1beta1.SecurityRule, out *SecurityRule, s conversion.Scope) error { - out.Name = in.Name - out.Description = in.Description - out.Protocol = SecurityGroupProtocol(in.Protocol) - out.Direction = SecurityRuleDirection(in.Direction) - out.Priority = in.Priority - out.SourcePorts = (*string)(unsafe.Pointer(in.SourcePorts)) - out.DestinationPorts = (*string)(unsafe.Pointer(in.DestinationPorts)) - out.Source = (*string)(unsafe.Pointer(in.Source)) - out.Destination = (*string)(unsafe.Pointer(in.Destination)) - return nil -} - -// Convert_v1beta1_SecurityRule_To_v1alpha4_SecurityRule is an autogenerated conversion function. -func Convert_v1beta1_SecurityRule_To_v1alpha4_SecurityRule(in *v1beta1.SecurityRule, out *SecurityRule, s conversion.Scope) error { - return autoConvert_v1beta1_SecurityRule_To_v1alpha4_SecurityRule(in, out, s) -} - -func autoConvert_v1alpha4_SpotVMOptions_To_v1beta1_SpotVMOptions(in *SpotVMOptions, out *v1beta1.SpotVMOptions, s conversion.Scope) error { - out.MaxPrice = (*resource.Quantity)(unsafe.Pointer(in.MaxPrice)) - return nil -} - -// Convert_v1alpha4_SpotVMOptions_To_v1beta1_SpotVMOptions is an autogenerated conversion function. -func Convert_v1alpha4_SpotVMOptions_To_v1beta1_SpotVMOptions(in *SpotVMOptions, out *v1beta1.SpotVMOptions, s conversion.Scope) error { - return autoConvert_v1alpha4_SpotVMOptions_To_v1beta1_SpotVMOptions(in, out, s) -} - -func autoConvert_v1beta1_SpotVMOptions_To_v1alpha4_SpotVMOptions(in *v1beta1.SpotVMOptions, out *SpotVMOptions, s conversion.Scope) error { - out.MaxPrice = (*resource.Quantity)(unsafe.Pointer(in.MaxPrice)) - // WARNING: in.EvictionPolicy requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha4_SubnetSpec_To_v1beta1_SubnetSpec(in *SubnetSpec, out *v1beta1.SubnetSpec, s conversion.Scope) error { - // WARNING: in.Role requires manual conversion: does not exist in peer-type - out.ID = in.ID - // WARNING: in.Name requires manual conversion: does not exist in peer-type - // WARNING: in.CIDRBlocks requires manual conversion: does not exist in peer-type - if err := Convert_v1alpha4_SecurityGroup_To_v1beta1_SecurityGroup(&in.SecurityGroup, &out.SecurityGroup, s); err != nil { - return err - } - if err := Convert_v1alpha4_RouteTable_To_v1beta1_RouteTable(&in.RouteTable, &out.RouteTable, s); err != nil { - return err - } - if err := Convert_v1alpha4_NatGateway_To_v1beta1_NatGateway(&in.NatGateway, &out.NatGateway, s); err != nil { - return err - } - return nil -} - -func autoConvert_v1beta1_SubnetSpec_To_v1alpha4_SubnetSpec(in *v1beta1.SubnetSpec, out *SubnetSpec, s conversion.Scope) error { - out.ID = in.ID - if err := Convert_v1beta1_SecurityGroup_To_v1alpha4_SecurityGroup(&in.SecurityGroup, &out.SecurityGroup, s); err != nil { - return err - } - if err := Convert_v1beta1_RouteTable_To_v1alpha4_RouteTable(&in.RouteTable, &out.RouteTable, s); err != nil { - return err - } - if err := Convert_v1beta1_NatGateway_To_v1alpha4_NatGateway(&in.NatGateway, &out.NatGateway, s); err != nil { - return err - } - // WARNING: in.SubnetClassSpec requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha4_UserAssignedIdentity_To_v1beta1_UserAssignedIdentity(in *UserAssignedIdentity, out *v1beta1.UserAssignedIdentity, s conversion.Scope) error { - out.ProviderID = in.ProviderID - return nil -} - -// Convert_v1alpha4_UserAssignedIdentity_To_v1beta1_UserAssignedIdentity is an autogenerated conversion function. -func Convert_v1alpha4_UserAssignedIdentity_To_v1beta1_UserAssignedIdentity(in *UserAssignedIdentity, out *v1beta1.UserAssignedIdentity, s conversion.Scope) error { - return autoConvert_v1alpha4_UserAssignedIdentity_To_v1beta1_UserAssignedIdentity(in, out, s) -} - -func autoConvert_v1beta1_UserAssignedIdentity_To_v1alpha4_UserAssignedIdentity(in *v1beta1.UserAssignedIdentity, out *UserAssignedIdentity, s conversion.Scope) error { - out.ProviderID = in.ProviderID - return nil -} - -// Convert_v1beta1_UserAssignedIdentity_To_v1alpha4_UserAssignedIdentity is an autogenerated conversion function. -func Convert_v1beta1_UserAssignedIdentity_To_v1alpha4_UserAssignedIdentity(in *v1beta1.UserAssignedIdentity, out *UserAssignedIdentity, s conversion.Scope) error { - return autoConvert_v1beta1_UserAssignedIdentity_To_v1alpha4_UserAssignedIdentity(in, out, s) -} - -func autoConvert_v1alpha4_VnetSpec_To_v1beta1_VnetSpec(in *VnetSpec, out *v1beta1.VnetSpec, s conversion.Scope) error { - out.ResourceGroup = in.ResourceGroup - out.ID = in.ID - out.Name = in.Name - // WARNING: in.CIDRBlocks requires manual conversion: does not exist in peer-type - // WARNING: in.Tags requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1beta1_VnetSpec_To_v1alpha4_VnetSpec(in *v1beta1.VnetSpec, out *VnetSpec, s conversion.Scope) error { - out.ResourceGroup = in.ResourceGroup - out.ID = in.ID - out.Name = in.Name - // WARNING: in.Peerings requires manual conversion: does not exist in peer-type - // WARNING: in.VnetClassSpec requires manual conversion: does not exist in peer-type - return nil -} diff --git a/api/v1alpha4/zz_generated.deepcopy.go b/api/v1alpha4/zz_generated.deepcopy.go deleted file mode 100644 index b1c23279006..00000000000 --- a/api/v1alpha4/zz_generated.deepcopy.go +++ /dev/null @@ -1,1819 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright The Kubernetes Authors. - -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. -*/ - -// Code generated by controller-gen. DO NOT EDIT. - -package v1alpha4 - -import ( - "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - apiv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" - "sigs.k8s.io/cluster-api/errors" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AADProfile) DeepCopyInto(out *AADProfile) { - *out = *in - if in.AdminGroupObjectIDs != nil { - in, out := &in.AdminGroupObjectIDs, &out.AdminGroupObjectIDs - *out = make([]string, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AADProfile. -func (in *AADProfile) DeepCopy() *AADProfile { - if in == nil { - return nil - } - out := new(AADProfile) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AKSSku) DeepCopyInto(out *AKSSku) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AKSSku. -func (in *AKSSku) DeepCopy() *AKSSku { - if in == nil { - return nil - } - out := new(AKSSku) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *APIServerAccessProfile) DeepCopyInto(out *APIServerAccessProfile) { - *out = *in - if in.AuthorizedIPRanges != nil { - in, out := &in.AuthorizedIPRanges, &out.AuthorizedIPRanges - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.EnablePrivateCluster != nil { - in, out := &in.EnablePrivateCluster, &out.EnablePrivateCluster - *out = new(bool) - **out = **in - } - if in.PrivateDNSZone != nil { - in, out := &in.PrivateDNSZone, &out.PrivateDNSZone - *out = new(string) - **out = **in - } - if in.EnablePrivateClusterPublicFQDN != nil { - in, out := &in.EnablePrivateClusterPublicFQDN, &out.EnablePrivateClusterPublicFQDN - *out = new(bool) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIServerAccessProfile. -func (in *APIServerAccessProfile) DeepCopy() *APIServerAccessProfile { - if in == nil { - return nil - } - out := new(APIServerAccessProfile) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AddressRecord) DeepCopyInto(out *AddressRecord) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddressRecord. -func (in *AddressRecord) DeepCopy() *AddressRecord { - if in == nil { - return nil - } - out := new(AddressRecord) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AllowedNamespaces) DeepCopyInto(out *AllowedNamespaces) { - *out = *in - if in.NamespaceList != nil { - in, out := &in.NamespaceList, &out.NamespaceList - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.Selector != nil { - in, out := &in.Selector, &out.Selector - *out = new(metav1.LabelSelector) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AllowedNamespaces. -func (in *AllowedNamespaces) DeepCopy() *AllowedNamespaces { - if in == nil { - return nil - } - out := new(AllowedNamespaces) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureBastion) DeepCopyInto(out *AzureBastion) { - *out = *in - in.Subnet.DeepCopyInto(&out.Subnet) - out.PublicIP = in.PublicIP -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureBastion. -func (in *AzureBastion) DeepCopy() *AzureBastion { - if in == nil { - return nil - } - out := new(AzureBastion) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureCluster) DeepCopyInto(out *AzureCluster) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureCluster. -func (in *AzureCluster) DeepCopy() *AzureCluster { - if in == nil { - return nil - } - out := new(AzureCluster) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AzureCluster) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureClusterIdentity) DeepCopyInto(out *AzureClusterIdentity) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureClusterIdentity. -func (in *AzureClusterIdentity) DeepCopy() *AzureClusterIdentity { - if in == nil { - return nil - } - out := new(AzureClusterIdentity) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AzureClusterIdentity) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureClusterIdentityList) DeepCopyInto(out *AzureClusterIdentityList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]AzureClusterIdentity, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureClusterIdentityList. -func (in *AzureClusterIdentityList) DeepCopy() *AzureClusterIdentityList { - if in == nil { - return nil - } - out := new(AzureClusterIdentityList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AzureClusterIdentityList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureClusterIdentitySpec) DeepCopyInto(out *AzureClusterIdentitySpec) { - *out = *in - out.ClientSecret = in.ClientSecret - if in.AllowedNamespaces != nil { - in, out := &in.AllowedNamespaces, &out.AllowedNamespaces - *out = new(AllowedNamespaces) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureClusterIdentitySpec. -func (in *AzureClusterIdentitySpec) DeepCopy() *AzureClusterIdentitySpec { - if in == nil { - return nil - } - out := new(AzureClusterIdentitySpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureClusterIdentityStatus) DeepCopyInto(out *AzureClusterIdentityStatus) { - *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(apiv1alpha4.Conditions, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureClusterIdentityStatus. -func (in *AzureClusterIdentityStatus) DeepCopy() *AzureClusterIdentityStatus { - if in == nil { - return nil - } - out := new(AzureClusterIdentityStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureClusterList) DeepCopyInto(out *AzureClusterList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]AzureCluster, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureClusterList. -func (in *AzureClusterList) DeepCopy() *AzureClusterList { - if in == nil { - return nil - } - out := new(AzureClusterList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AzureClusterList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureClusterSpec) DeepCopyInto(out *AzureClusterSpec) { - *out = *in - in.NetworkSpec.DeepCopyInto(&out.NetworkSpec) - out.ControlPlaneEndpoint = in.ControlPlaneEndpoint - if in.AdditionalTags != nil { - in, out := &in.AdditionalTags, &out.AdditionalTags - *out = make(Tags, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.IdentityRef != nil { - in, out := &in.IdentityRef, &out.IdentityRef - *out = new(v1.ObjectReference) - **out = **in - } - in.BastionSpec.DeepCopyInto(&out.BastionSpec) - if in.CloudProviderConfigOverrides != nil { - in, out := &in.CloudProviderConfigOverrides, &out.CloudProviderConfigOverrides - *out = new(CloudProviderConfigOverrides) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureClusterSpec. -func (in *AzureClusterSpec) DeepCopy() *AzureClusterSpec { - if in == nil { - return nil - } - out := new(AzureClusterSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureClusterStatus) DeepCopyInto(out *AzureClusterStatus) { - *out = *in - if in.FailureDomains != nil { - in, out := &in.FailureDomains, &out.FailureDomains - *out = make(apiv1alpha4.FailureDomains, len(*in)) - for key, val := range *in { - (*out)[key] = *val.DeepCopy() - } - } - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(apiv1alpha4.Conditions, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.LongRunningOperationStates != nil { - in, out := &in.LongRunningOperationStates, &out.LongRunningOperationStates - *out = make(Futures, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureClusterStatus. -func (in *AzureClusterStatus) DeepCopy() *AzureClusterStatus { - if in == nil { - return nil - } - out := new(AzureClusterStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachine) DeepCopyInto(out *AzureMachine) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachine. -func (in *AzureMachine) DeepCopy() *AzureMachine { - if in == nil { - return nil - } - out := new(AzureMachine) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AzureMachine) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachineList) DeepCopyInto(out *AzureMachineList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]AzureMachine, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachineList. -func (in *AzureMachineList) DeepCopy() *AzureMachineList { - if in == nil { - return nil - } - out := new(AzureMachineList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AzureMachineList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachineSpec) DeepCopyInto(out *AzureMachineSpec) { - *out = *in - if in.ProviderID != nil { - in, out := &in.ProviderID, &out.ProviderID - *out = new(string) - **out = **in - } - if in.FailureDomain != nil { - in, out := &in.FailureDomain, &out.FailureDomain - *out = new(string) - **out = **in - } - if in.Image != nil { - in, out := &in.Image, &out.Image - *out = new(Image) - (*in).DeepCopyInto(*out) - } - if in.UserAssignedIdentities != nil { - in, out := &in.UserAssignedIdentities, &out.UserAssignedIdentities - *out = make([]UserAssignedIdentity, len(*in)) - copy(*out, *in) - } - in.OSDisk.DeepCopyInto(&out.OSDisk) - if in.DataDisks != nil { - in, out := &in.DataDisks, &out.DataDisks - *out = make([]DataDisk, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.AdditionalTags != nil { - in, out := &in.AdditionalTags, &out.AdditionalTags - *out = make(Tags, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.AcceleratedNetworking != nil { - in, out := &in.AcceleratedNetworking, &out.AcceleratedNetworking - *out = new(bool) - **out = **in - } - if in.SpotVMOptions != nil { - in, out := &in.SpotVMOptions, &out.SpotVMOptions - *out = new(SpotVMOptions) - (*in).DeepCopyInto(*out) - } - if in.SecurityProfile != nil { - in, out := &in.SecurityProfile, &out.SecurityProfile - *out = new(SecurityProfile) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachineSpec. -func (in *AzureMachineSpec) DeepCopy() *AzureMachineSpec { - if in == nil { - return nil - } - out := new(AzureMachineSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachineStatus) DeepCopyInto(out *AzureMachineStatus) { - *out = *in - if in.Addresses != nil { - in, out := &in.Addresses, &out.Addresses - *out = make([]v1.NodeAddress, len(*in)) - copy(*out, *in) - } - if in.VMState != nil { - in, out := &in.VMState, &out.VMState - *out = new(ProvisioningState) - **out = **in - } - if in.FailureReason != nil { - in, out := &in.FailureReason, &out.FailureReason - *out = new(errors.MachineStatusError) - **out = **in - } - if in.FailureMessage != nil { - in, out := &in.FailureMessage, &out.FailureMessage - *out = new(string) - **out = **in - } - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(apiv1alpha4.Conditions, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.LongRunningOperationStates != nil { - in, out := &in.LongRunningOperationStates, &out.LongRunningOperationStates - *out = make(Futures, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachineStatus. -func (in *AzureMachineStatus) DeepCopy() *AzureMachineStatus { - if in == nil { - return nil - } - out := new(AzureMachineStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachineTemplate) DeepCopyInto(out *AzureMachineTemplate) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachineTemplate. -func (in *AzureMachineTemplate) DeepCopy() *AzureMachineTemplate { - if in == nil { - return nil - } - out := new(AzureMachineTemplate) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AzureMachineTemplate) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachineTemplateList) DeepCopyInto(out *AzureMachineTemplateList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]AzureMachineTemplate, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachineTemplateList. -func (in *AzureMachineTemplateList) DeepCopy() *AzureMachineTemplateList { - if in == nil { - return nil - } - out := new(AzureMachineTemplateList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AzureMachineTemplateList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachineTemplateResource) DeepCopyInto(out *AzureMachineTemplateResource) { - *out = *in - in.Spec.DeepCopyInto(&out.Spec) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachineTemplateResource. -func (in *AzureMachineTemplateResource) DeepCopy() *AzureMachineTemplateResource { - if in == nil { - return nil - } - out := new(AzureMachineTemplateResource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachineTemplateSpec) DeepCopyInto(out *AzureMachineTemplateSpec) { - *out = *in - in.Template.DeepCopyInto(&out.Template) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachineTemplateSpec. -func (in *AzureMachineTemplateSpec) DeepCopy() *AzureMachineTemplateSpec { - if in == nil { - return nil - } - out := new(AzureMachineTemplateSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureManagedCluster) DeepCopyInto(out *AzureManagedCluster) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec - out.Status = in.Status -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureManagedCluster. -func (in *AzureManagedCluster) DeepCopy() *AzureManagedCluster { - if in == nil { - return nil - } - out := new(AzureManagedCluster) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AzureManagedCluster) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureManagedClusterList) DeepCopyInto(out *AzureManagedClusterList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]AzureManagedCluster, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureManagedClusterList. -func (in *AzureManagedClusterList) DeepCopy() *AzureManagedClusterList { - if in == nil { - return nil - } - out := new(AzureManagedClusterList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AzureManagedClusterList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureManagedClusterSpec) DeepCopyInto(out *AzureManagedClusterSpec) { - *out = *in - out.ControlPlaneEndpoint = in.ControlPlaneEndpoint -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureManagedClusterSpec. -func (in *AzureManagedClusterSpec) DeepCopy() *AzureManagedClusterSpec { - if in == nil { - return nil - } - out := new(AzureManagedClusterSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureManagedClusterStatus) DeepCopyInto(out *AzureManagedClusterStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureManagedClusterStatus. -func (in *AzureManagedClusterStatus) DeepCopy() *AzureManagedClusterStatus { - if in == nil { - return nil - } - out := new(AzureManagedClusterStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureManagedControlPlane) DeepCopyInto(out *AzureManagedControlPlane) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureManagedControlPlane. -func (in *AzureManagedControlPlane) DeepCopy() *AzureManagedControlPlane { - if in == nil { - return nil - } - out := new(AzureManagedControlPlane) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AzureManagedControlPlane) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureManagedControlPlaneList) DeepCopyInto(out *AzureManagedControlPlaneList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]AzureManagedControlPlane, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureManagedControlPlaneList. -func (in *AzureManagedControlPlaneList) DeepCopy() *AzureManagedControlPlaneList { - if in == nil { - return nil - } - out := new(AzureManagedControlPlaneList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AzureManagedControlPlaneList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureManagedControlPlaneSpec) DeepCopyInto(out *AzureManagedControlPlaneSpec) { - *out = *in - out.VirtualNetwork = in.VirtualNetwork - out.ControlPlaneEndpoint = in.ControlPlaneEndpoint - if in.AdditionalTags != nil { - in, out := &in.AdditionalTags, &out.AdditionalTags - *out = make(Tags, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.NetworkPlugin != nil { - in, out := &in.NetworkPlugin, &out.NetworkPlugin - *out = new(string) - **out = **in - } - if in.NetworkPolicy != nil { - in, out := &in.NetworkPolicy, &out.NetworkPolicy - *out = new(string) - **out = **in - } - if in.DNSServiceIP != nil { - in, out := &in.DNSServiceIP, &out.DNSServiceIP - *out = new(string) - **out = **in - } - if in.LoadBalancerSKU != nil { - in, out := &in.LoadBalancerSKU, &out.LoadBalancerSKU - *out = new(string) - **out = **in - } - if in.IdentityRef != nil { - in, out := &in.IdentityRef, &out.IdentityRef - *out = new(v1.ObjectReference) - **out = **in - } - if in.AADProfile != nil { - in, out := &in.AADProfile, &out.AADProfile - *out = new(AADProfile) - (*in).DeepCopyInto(*out) - } - if in.SKU != nil { - in, out := &in.SKU, &out.SKU - *out = new(AKSSku) - **out = **in - } - if in.LoadBalancerProfile != nil { - in, out := &in.LoadBalancerProfile, &out.LoadBalancerProfile - *out = new(LoadBalancerProfile) - (*in).DeepCopyInto(*out) - } - if in.APIServerAccessProfile != nil { - in, out := &in.APIServerAccessProfile, &out.APIServerAccessProfile - *out = new(APIServerAccessProfile) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureManagedControlPlaneSpec. -func (in *AzureManagedControlPlaneSpec) DeepCopy() *AzureManagedControlPlaneSpec { - if in == nil { - return nil - } - out := new(AzureManagedControlPlaneSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureManagedControlPlaneStatus) DeepCopyInto(out *AzureManagedControlPlaneStatus) { - *out = *in - if in.LongRunningOperationStates != nil { - in, out := &in.LongRunningOperationStates, &out.LongRunningOperationStates - *out = make(Futures, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureManagedControlPlaneStatus. -func (in *AzureManagedControlPlaneStatus) DeepCopy() *AzureManagedControlPlaneStatus { - if in == nil { - return nil - } - out := new(AzureManagedControlPlaneStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureManagedMachinePool) DeepCopyInto(out *AzureManagedMachinePool) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureManagedMachinePool. -func (in *AzureManagedMachinePool) DeepCopy() *AzureManagedMachinePool { - if in == nil { - return nil - } - out := new(AzureManagedMachinePool) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AzureManagedMachinePool) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureManagedMachinePoolList) DeepCopyInto(out *AzureManagedMachinePoolList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]AzureManagedMachinePool, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureManagedMachinePoolList. -func (in *AzureManagedMachinePoolList) DeepCopy() *AzureManagedMachinePoolList { - if in == nil { - return nil - } - out := new(AzureManagedMachinePoolList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AzureManagedMachinePoolList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureManagedMachinePoolSpec) DeepCopyInto(out *AzureManagedMachinePoolSpec) { - *out = *in - if in.Name != nil { - in, out := &in.Name, &out.Name - *out = new(string) - **out = **in - } - if in.OSDiskSizeGB != nil { - in, out := &in.OSDiskSizeGB, &out.OSDiskSizeGB - *out = new(int32) - **out = **in - } - if in.ProviderIDList != nil { - in, out := &in.ProviderIDList, &out.ProviderIDList - *out = make([]string, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureManagedMachinePoolSpec. -func (in *AzureManagedMachinePoolSpec) DeepCopy() *AzureManagedMachinePoolSpec { - if in == nil { - return nil - } - out := new(AzureManagedMachinePoolSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureManagedMachinePoolStatus) DeepCopyInto(out *AzureManagedMachinePoolStatus) { - *out = *in - if in.ErrorReason != nil { - in, out := &in.ErrorReason, &out.ErrorReason - *out = new(errors.MachineStatusError) - **out = **in - } - if in.ErrorMessage != nil { - in, out := &in.ErrorMessage, &out.ErrorMessage - *out = new(string) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureManagedMachinePoolStatus. -func (in *AzureManagedMachinePoolStatus) DeepCopy() *AzureManagedMachinePoolStatus { - if in == nil { - return nil - } - out := new(AzureManagedMachinePoolStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMarketplaceImage) DeepCopyInto(out *AzureMarketplaceImage) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMarketplaceImage. -func (in *AzureMarketplaceImage) DeepCopy() *AzureMarketplaceImage { - if in == nil { - return nil - } - out := new(AzureMarketplaceImage) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureSharedGalleryImage) DeepCopyInto(out *AzureSharedGalleryImage) { - *out = *in - if in.Publisher != nil { - in, out := &in.Publisher, &out.Publisher - *out = new(string) - **out = **in - } - if in.Offer != nil { - in, out := &in.Offer, &out.Offer - *out = new(string) - **out = **in - } - if in.SKU != nil { - in, out := &in.SKU, &out.SKU - *out = new(string) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureSharedGalleryImage. -func (in *AzureSharedGalleryImage) DeepCopy() *AzureSharedGalleryImage { - if in == nil { - return nil - } - out := new(AzureSharedGalleryImage) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BackOffConfig) DeepCopyInto(out *BackOffConfig) { - *out = *in - if in.CloudProviderBackoffExponent != nil { - in, out := &in.CloudProviderBackoffExponent, &out.CloudProviderBackoffExponent - x := (*in).DeepCopy() - *out = &x - } - if in.CloudProviderBackoffJitter != nil { - in, out := &in.CloudProviderBackoffJitter, &out.CloudProviderBackoffJitter - x := (*in).DeepCopy() - *out = &x - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackOffConfig. -func (in *BackOffConfig) DeepCopy() *BackOffConfig { - if in == nil { - return nil - } - out := new(BackOffConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BastionSpec) DeepCopyInto(out *BastionSpec) { - *out = *in - if in.AzureBastion != nil { - in, out := &in.AzureBastion, &out.AzureBastion - *out = new(AzureBastion) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BastionSpec. -func (in *BastionSpec) DeepCopy() *BastionSpec { - if in == nil { - return nil - } - out := new(BastionSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BuildParams) DeepCopyInto(out *BuildParams) { - *out = *in - if in.Name != nil { - in, out := &in.Name, &out.Name - *out = new(string) - **out = **in - } - if in.Role != nil { - in, out := &in.Role, &out.Role - *out = new(string) - **out = **in - } - if in.Additional != nil { - in, out := &in.Additional, &out.Additional - *out = make(Tags, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BuildParams. -func (in *BuildParams) DeepCopy() *BuildParams { - if in == nil { - return nil - } - out := new(BuildParams) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CloudProviderConfigOverrides) DeepCopyInto(out *CloudProviderConfigOverrides) { - *out = *in - if in.RateLimits != nil { - in, out := &in.RateLimits, &out.RateLimits - *out = make([]RateLimitSpec, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - in.BackOffs.DeepCopyInto(&out.BackOffs) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CloudProviderConfigOverrides. -func (in *CloudProviderConfigOverrides) DeepCopy() *CloudProviderConfigOverrides { - if in == nil { - return nil - } - out := new(CloudProviderConfigOverrides) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DataDisk) DeepCopyInto(out *DataDisk) { - *out = *in - if in.ManagedDisk != nil { - in, out := &in.ManagedDisk, &out.ManagedDisk - *out = new(ManagedDiskParameters) - (*in).DeepCopyInto(*out) - } - if in.Lun != nil { - in, out := &in.Lun, &out.Lun - *out = new(int32) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataDisk. -func (in *DataDisk) DeepCopy() *DataDisk { - if in == nil { - return nil - } - out := new(DataDisk) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DiffDiskSettings) DeepCopyInto(out *DiffDiskSettings) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiffDiskSettings. -func (in *DiffDiskSettings) DeepCopy() *DiffDiskSettings { - if in == nil { - return nil - } - out := new(DiffDiskSettings) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DiskEncryptionSetParameters) DeepCopyInto(out *DiskEncryptionSetParameters) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiskEncryptionSetParameters. -func (in *DiskEncryptionSetParameters) DeepCopy() *DiskEncryptionSetParameters { - if in == nil { - return nil - } - out := new(DiskEncryptionSetParameters) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FrontendIP) DeepCopyInto(out *FrontendIP) { - *out = *in - if in.PublicIP != nil { - in, out := &in.PublicIP, &out.PublicIP - *out = new(PublicIPSpec) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FrontendIP. -func (in *FrontendIP) DeepCopy() *FrontendIP { - if in == nil { - return nil - } - out := new(FrontendIP) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Future) DeepCopyInto(out *Future) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Future. -func (in *Future) DeepCopy() *Future { - if in == nil { - return nil - } - out := new(Future) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in Futures) DeepCopyInto(out *Futures) { - { - in := &in - *out = make(Futures, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Futures. -func (in Futures) DeepCopy() Futures { - if in == nil { - return nil - } - out := new(Futures) - in.DeepCopyInto(out) - return *out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Image) DeepCopyInto(out *Image) { - *out = *in - if in.ID != nil { - in, out := &in.ID, &out.ID - *out = new(string) - **out = **in - } - if in.SharedGallery != nil { - in, out := &in.SharedGallery, &out.SharedGallery - *out = new(AzureSharedGalleryImage) - (*in).DeepCopyInto(*out) - } - if in.Marketplace != nil { - in, out := &in.Marketplace, &out.Marketplace - *out = new(AzureMarketplaceImage) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Image. -func (in *Image) DeepCopy() *Image { - if in == nil { - return nil - } - out := new(Image) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LoadBalancerProfile) DeepCopyInto(out *LoadBalancerProfile) { - *out = *in - if in.ManagedOutboundIPs != nil { - in, out := &in.ManagedOutboundIPs, &out.ManagedOutboundIPs - *out = new(int32) - **out = **in - } - if in.OutboundIPPrefixes != nil { - in, out := &in.OutboundIPPrefixes, &out.OutboundIPPrefixes - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.OutboundIPs != nil { - in, out := &in.OutboundIPs, &out.OutboundIPs - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.AllocatedOutboundPorts != nil { - in, out := &in.AllocatedOutboundPorts, &out.AllocatedOutboundPorts - *out = new(int32) - **out = **in - } - if in.IdleTimeoutInMinutes != nil { - in, out := &in.IdleTimeoutInMinutes, &out.IdleTimeoutInMinutes - *out = new(int32) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoadBalancerProfile. -func (in *LoadBalancerProfile) DeepCopy() *LoadBalancerProfile { - if in == nil { - return nil - } - out := new(LoadBalancerProfile) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LoadBalancerSpec) DeepCopyInto(out *LoadBalancerSpec) { - *out = *in - if in.FrontendIPs != nil { - in, out := &in.FrontendIPs, &out.FrontendIPs - *out = make([]FrontendIP, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.FrontendIPsCount != nil { - in, out := &in.FrontendIPsCount, &out.FrontendIPsCount - *out = new(int32) - **out = **in - } - if in.IdleTimeoutInMinutes != nil { - in, out := &in.IdleTimeoutInMinutes, &out.IdleTimeoutInMinutes - *out = new(int32) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoadBalancerSpec. -func (in *LoadBalancerSpec) DeepCopy() *LoadBalancerSpec { - if in == nil { - return nil - } - out := new(LoadBalancerSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ManagedControlPlaneSubnet) DeepCopyInto(out *ManagedControlPlaneSubnet) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedControlPlaneSubnet. -func (in *ManagedControlPlaneSubnet) DeepCopy() *ManagedControlPlaneSubnet { - if in == nil { - return nil - } - out := new(ManagedControlPlaneSubnet) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ManagedControlPlaneVirtualNetwork) DeepCopyInto(out *ManagedControlPlaneVirtualNetwork) { - *out = *in - out.Subnet = in.Subnet -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedControlPlaneVirtualNetwork. -func (in *ManagedControlPlaneVirtualNetwork) DeepCopy() *ManagedControlPlaneVirtualNetwork { - if in == nil { - return nil - } - out := new(ManagedControlPlaneVirtualNetwork) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ManagedDiskParameters) DeepCopyInto(out *ManagedDiskParameters) { - *out = *in - if in.DiskEncryptionSet != nil { - in, out := &in.DiskEncryptionSet, &out.DiskEncryptionSet - *out = new(DiskEncryptionSetParameters) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedDiskParameters. -func (in *ManagedDiskParameters) DeepCopy() *ManagedDiskParameters { - if in == nil { - return nil - } - out := new(ManagedDiskParameters) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NatGateway) DeepCopyInto(out *NatGateway) { - *out = *in - out.NatGatewayIP = in.NatGatewayIP -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NatGateway. -func (in *NatGateway) DeepCopy() *NatGateway { - if in == nil { - return nil - } - out := new(NatGateway) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NetworkSpec) DeepCopyInto(out *NetworkSpec) { - *out = *in - in.Vnet.DeepCopyInto(&out.Vnet) - if in.Subnets != nil { - in, out := &in.Subnets, &out.Subnets - *out = make(Subnets, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - in.APIServerLB.DeepCopyInto(&out.APIServerLB) - if in.NodeOutboundLB != nil { - in, out := &in.NodeOutboundLB, &out.NodeOutboundLB - *out = new(LoadBalancerSpec) - (*in).DeepCopyInto(*out) - } - if in.ControlPlaneOutboundLB != nil { - in, out := &in.ControlPlaneOutboundLB, &out.ControlPlaneOutboundLB - *out = new(LoadBalancerSpec) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkSpec. -func (in *NetworkSpec) DeepCopy() *NetworkSpec { - if in == nil { - return nil - } - out := new(NetworkSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OSDisk) DeepCopyInto(out *OSDisk) { - *out = *in - if in.DiskSizeGB != nil { - in, out := &in.DiskSizeGB, &out.DiskSizeGB - *out = new(int32) - **out = **in - } - if in.ManagedDisk != nil { - in, out := &in.ManagedDisk, &out.ManagedDisk - *out = new(ManagedDiskParameters) - (*in).DeepCopyInto(*out) - } - if in.DiffDiskSettings != nil { - in, out := &in.DiffDiskSettings, &out.DiffDiskSettings - *out = new(DiffDiskSettings) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OSDisk. -func (in *OSDisk) DeepCopy() *OSDisk { - if in == nil { - return nil - } - out := new(OSDisk) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PublicIPSpec) DeepCopyInto(out *PublicIPSpec) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PublicIPSpec. -func (in *PublicIPSpec) DeepCopy() *PublicIPSpec { - if in == nil { - return nil - } - out := new(PublicIPSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RateLimitConfig) DeepCopyInto(out *RateLimitConfig) { - *out = *in - if in.CloudProviderRateLimitQPS != nil { - in, out := &in.CloudProviderRateLimitQPS, &out.CloudProviderRateLimitQPS - x := (*in).DeepCopy() - *out = &x - } - if in.CloudProviderRateLimitQPSWrite != nil { - in, out := &in.CloudProviderRateLimitQPSWrite, &out.CloudProviderRateLimitQPSWrite - x := (*in).DeepCopy() - *out = &x - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RateLimitConfig. -func (in *RateLimitConfig) DeepCopy() *RateLimitConfig { - if in == nil { - return nil - } - out := new(RateLimitConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RateLimitSpec) DeepCopyInto(out *RateLimitSpec) { - *out = *in - in.Config.DeepCopyInto(&out.Config) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RateLimitSpec. -func (in *RateLimitSpec) DeepCopy() *RateLimitSpec { - if in == nil { - return nil - } - out := new(RateLimitSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RouteTable) DeepCopyInto(out *RouteTable) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteTable. -func (in *RouteTable) DeepCopy() *RouteTable { - if in == nil { - return nil - } - out := new(RouteTable) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SecurityGroup) DeepCopyInto(out *SecurityGroup) { - *out = *in - if in.SecurityRules != nil { - in, out := &in.SecurityRules, &out.SecurityRules - *out = make(SecurityRules, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Tags != nil { - in, out := &in.Tags, &out.Tags - *out = make(Tags, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecurityGroup. -func (in *SecurityGroup) DeepCopy() *SecurityGroup { - if in == nil { - return nil - } - out := new(SecurityGroup) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SecurityProfile) DeepCopyInto(out *SecurityProfile) { - *out = *in - if in.EncryptionAtHost != nil { - in, out := &in.EncryptionAtHost, &out.EncryptionAtHost - *out = new(bool) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecurityProfile. -func (in *SecurityProfile) DeepCopy() *SecurityProfile { - if in == nil { - return nil - } - out := new(SecurityProfile) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SecurityRule) DeepCopyInto(out *SecurityRule) { - *out = *in - if in.SourcePorts != nil { - in, out := &in.SourcePorts, &out.SourcePorts - *out = new(string) - **out = **in - } - if in.DestinationPorts != nil { - in, out := &in.DestinationPorts, &out.DestinationPorts - *out = new(string) - **out = **in - } - if in.Source != nil { - in, out := &in.Source, &out.Source - *out = new(string) - **out = **in - } - if in.Destination != nil { - in, out := &in.Destination, &out.Destination - *out = new(string) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecurityRule. -func (in *SecurityRule) DeepCopy() *SecurityRule { - if in == nil { - return nil - } - out := new(SecurityRule) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in SecurityRules) DeepCopyInto(out *SecurityRules) { - { - in := &in - *out = make(SecurityRules, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecurityRules. -func (in SecurityRules) DeepCopy() SecurityRules { - if in == nil { - return nil - } - out := new(SecurityRules) - in.DeepCopyInto(out) - return *out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SpotVMOptions) DeepCopyInto(out *SpotVMOptions) { - *out = *in - if in.MaxPrice != nil { - in, out := &in.MaxPrice, &out.MaxPrice - x := (*in).DeepCopy() - *out = &x - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpotVMOptions. -func (in *SpotVMOptions) DeepCopy() *SpotVMOptions { - if in == nil { - return nil - } - out := new(SpotVMOptions) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SubnetSpec) DeepCopyInto(out *SubnetSpec) { - *out = *in - if in.CIDRBlocks != nil { - in, out := &in.CIDRBlocks, &out.CIDRBlocks - *out = make([]string, len(*in)) - copy(*out, *in) - } - in.SecurityGroup.DeepCopyInto(&out.SecurityGroup) - out.RouteTable = in.RouteTable - out.NatGateway = in.NatGateway -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubnetSpec. -func (in *SubnetSpec) DeepCopy() *SubnetSpec { - if in == nil { - return nil - } - out := new(SubnetSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in Subnets) DeepCopyInto(out *Subnets) { - { - in := &in - *out = make(Subnets, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Subnets. -func (in Subnets) DeepCopy() Subnets { - if in == nil { - return nil - } - out := new(Subnets) - in.DeepCopyInto(out) - return *out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in Tags) DeepCopyInto(out *Tags) { - { - in := &in - *out = make(Tags, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Tags. -func (in Tags) DeepCopy() Tags { - if in == nil { - return nil - } - out := new(Tags) - in.DeepCopyInto(out) - return *out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *UserAssignedIdentity) DeepCopyInto(out *UserAssignedIdentity) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserAssignedIdentity. -func (in *UserAssignedIdentity) DeepCopy() *UserAssignedIdentity { - if in == nil { - return nil - } - out := new(UserAssignedIdentity) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VM) DeepCopyInto(out *VM) { - *out = *in - in.Image.DeepCopyInto(&out.Image) - in.OSDisk.DeepCopyInto(&out.OSDisk) - if in.Tags != nil { - in, out := &in.Tags, &out.Tags - *out = make(Tags, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.Addresses != nil { - in, out := &in.Addresses, &out.Addresses - *out = make([]v1.NodeAddress, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VM. -func (in *VM) DeepCopy() *VM { - if in == nil { - return nil - } - out := new(VM) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *VnetSpec) DeepCopyInto(out *VnetSpec) { - *out = *in - if in.CIDRBlocks != nil { - in, out := &in.CIDRBlocks, &out.CIDRBlocks - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.Tags != nil { - in, out := &in.Tags, &out.Tags - *out = make(Tags, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VnetSpec. -func (in *VnetSpec) DeepCopy() *VnetSpec { - if in == nil { - return nil - } - out := new(VnetSpec) - in.DeepCopyInto(out) - return out -} diff --git a/api/v1beta1/azurecluster_default.go b/api/v1beta1/azurecluster_default.go index e56329e83d1..a9a0526cf67 100644 --- a/api/v1beta1/azurecluster_default.go +++ b/api/v1beta1/azurecluster_default.go @@ -124,9 +124,15 @@ func (c *AzureCluster) setSubnetDefaults() { if subnet.RouteTable.Name == "" { subnet.RouteTable.Name = generateNodeRouteTableName(c.ObjectMeta.Name) } - if subnet.IsNatGatewayEnabled() { + + if !subnet.IsIPv6Enabled() { + // NAT gateway supports the use of IPv4 public IP addresses for outbound connectivity. + // So default use the NAT gateway for outbound traffic in IPv4 cluster instead of loadbalancer. + if subnet.NatGateway.Name == "" { + subnet.NatGateway.Name = withIndex(generateNatGatewayName(c.ObjectMeta.Name), nodeSubnetCounter) + } if subnet.NatGateway.NatGatewayIP.Name == "" { - subnet.NatGateway.NatGatewayIP.Name = generateNatGatewayIPName(c.ObjectMeta.Name, subnet.Name) + subnet.NatGateway.NatGatewayIP.Name = generateNatGatewayIPName(subnet.NatGateway.Name) } } @@ -146,6 +152,11 @@ func (c *AzureCluster) setSubnetDefaults() { RouteTable: RouteTable{ Name: generateNodeRouteTableName(c.ObjectMeta.Name), }, + NatGateway: NatGateway{ + NatGatewayClassSpec: NatGatewayClassSpec{ + Name: generateNatGatewayName(c.ObjectMeta.Name), + }, + }, } c.Spec.NetworkSpec.Subnets = append(c.Spec.NetworkSpec.Subnets, nodeSubnet) } @@ -193,10 +204,7 @@ func (c *AzureCluster) setAPIServerLBDefaults() { } } } - - if lb.BackendPool.Name == "" { - lb.BackendPool.Name = generateBackendAddressPoolName(lb.Name) - } + c.SetAPIServerLBBackendPoolNameDefault() } // SetNodeOutboundLBDefaults sets the default values for the NodeOutboundLB. @@ -208,7 +216,7 @@ func (c *AzureCluster) SetNodeOutboundLBDefaults() { var needsOutboundLB bool for _, subnet := range c.Spec.NetworkSpec.Subnets { - if subnet.Role == SubnetNode && !subnet.IsNatGatewayEnabled() { + if subnet.Role == SubnetNode && subnet.IsIPv6Enabled() { needsOutboundLB = true break } @@ -236,10 +244,7 @@ func (c *AzureCluster) SetNodeOutboundLBDefaults() { } c.setOutboundLBFrontendIPs(lb, generateNodeOutboundIPName) - - if lb.BackendPool.Name == "" { - lb.BackendPool.Name = generateOutboundBackendAddressPoolName(lb.Name) - } + c.SetNodeOutboundLBBackendPoolNameDefault() } // SetControlPlaneOutboundLBDefaults sets the default values for the control plane's outbound LB. @@ -258,9 +263,37 @@ func (c *AzureCluster) SetControlPlaneOutboundLBDefaults() { lb.FrontendIPsCount = pointer.Int32(1) } c.setOutboundLBFrontendIPs(lb, generateControlPlaneOutboundIPName) + c.SetControlPlaneOutboundLBBackendPoolNameDefault() +} - if lb.BackendPool.Name == "" { - lb.BackendPool.Name = generateOutboundBackendAddressPoolName(generateControlPlaneOutboundLBName(c.ObjectMeta.Name)) +// SetBackendPoolNameDefault defaults the backend pool name of the LBs. +func (c *AzureCluster) SetBackendPoolNameDefault() { + c.SetAPIServerLBBackendPoolNameDefault() + c.SetNodeOutboundLBBackendPoolNameDefault() + c.SetControlPlaneOutboundLBBackendPoolNameDefault() +} + +// SetAPIServerLBBackendPoolNameDefault defaults the name of the backend pool for apiserver LB. +func (c *AzureCluster) SetAPIServerLBBackendPoolNameDefault() { + apiServerLB := &c.Spec.NetworkSpec.APIServerLB + if apiServerLB.BackendPool.Name == "" { + apiServerLB.BackendPool.Name = generateBackendAddressPoolName(apiServerLB.Name) + } +} + +// SetNodeOutboundLBBackendPoolNameDefault defaults the name of the backend pool for node outbound LB. +func (c *AzureCluster) SetNodeOutboundLBBackendPoolNameDefault() { + nodeOutboundLB := c.Spec.NetworkSpec.NodeOutboundLB + if nodeOutboundLB != nil && nodeOutboundLB.BackendPool.Name == "" { + nodeOutboundLB.BackendPool.Name = generateOutboundBackendAddressPoolName(nodeOutboundLB.Name) + } +} + +// SetControlPlaneOutboundLBBackendPoolNameDefault defaults the name of the backend pool for control plane outbound LB. +func (c *AzureCluster) SetControlPlaneOutboundLBBackendPoolNameDefault() { + controlPlaneOutboundLB := c.Spec.NetworkSpec.ControlPlaneOutboundLB + if controlPlaneOutboundLB != nil && controlPlaneOutboundLB.BackendPool.Name == "" { + controlPlaneOutboundLB.BackendPool.Name = generateOutboundBackendAddressPoolName(generateControlPlaneOutboundLBName(c.ObjectMeta.Name)) } } @@ -436,9 +469,14 @@ func generateControlPlaneOutboundIPName(clusterName string) string { return fmt.Sprintf("pip-%s-controlplane-outbound", clusterName) } +// generateNatGatewayName generates a NAT gateway name. +func generateNatGatewayName(clusterName string) string { + return fmt.Sprintf("%s-%s", clusterName, "node-natgw") +} + // generateNatGatewayIPName generates a NAT gateway IP name. -func generateNatGatewayIPName(clusterName, subnetName string) string { - return fmt.Sprintf("pip-%s-%s-natgw", clusterName, subnetName) +func generateNatGatewayIPName(natGatewayName string) string { + return fmt.Sprintf("pip-%s", natGatewayName) } // withIndex appends the index as suffix to a generated name. diff --git a/api/v1beta1/azurecluster_default_test.go b/api/v1beta1/azurecluster_default_test.go index 119ca3aaf76..6504ae240e9 100644 --- a/api/v1beta1/azurecluster_default_test.go +++ b/api/v1beta1/azurecluster_default_test.go @@ -300,6 +300,9 @@ func TestSubnetDefaults(t *testing.T) { }, SecurityGroup: SecurityGroup{Name: "cluster-test-node-nsg"}, RouteTable: RouteTable{Name: "cluster-test-node-routetable"}, + NatGateway: NatGateway{NatGatewayClassSpec: NatGatewayClassSpec{ + Name: "cluster-test-node-natgw", + }}, }, }, }, @@ -367,7 +370,7 @@ func TestSubnetDefaults(t *testing.T) { Name: "foo-natgw", }, NatGatewayIP: PublicIPSpec{ - Name: "pip-cluster-test-my-node-subnet-natgw", + Name: "pip-foo-natgw", }, }, }, @@ -426,6 +429,14 @@ func TestSubnetDefaults(t *testing.T) { }, SecurityGroup: SecurityGroup{Name: "cluster-test-node-nsg"}, RouteTable: RouteTable{Name: "cluster-test-node-routetable"}, + NatGateway: NatGateway{ + NatGatewayClassSpec: NatGatewayClassSpec{ + Name: "cluster-test-node-natgw-1", + }, + NatGatewayIP: PublicIPSpec{ + Name: "pip-cluster-test-node-natgw-1", + }, + }, }, }, }, @@ -484,6 +495,14 @@ func TestSubnetDefaults(t *testing.T) { }, SecurityGroup: SecurityGroup{Name: "cluster-test-node-nsg"}, RouteTable: RouteTable{Name: "cluster-test-node-routetable"}, + NatGateway: NatGateway{ + NatGatewayClassSpec: NatGatewayClassSpec{ + Name: "cluster-test-node-natgw-1", + }, + NatGatewayIP: PublicIPSpec{ + Name: "pip-cluster-test-node-natgw-1", + }, + }, }, }, }, @@ -525,6 +544,14 @@ func TestSubnetDefaults(t *testing.T) { SecurityGroup: SecurityGroup{Name: "cluster-test-node-nsg"}, RouteTable: RouteTable{Name: "cluster-test-node-routetable"}, + NatGateway: NatGateway{ + NatGatewayClassSpec: NatGatewayClassSpec{ + Name: "cluster-test-node-natgw-1", + }, + NatGatewayIP: PublicIPSpec{ + Name: "pip-cluster-test-node-natgw-1", + }, + }, }, { SubnetClassSpec: SubnetClassSpec{ @@ -683,6 +710,14 @@ func TestSubnetDefaults(t *testing.T) { }, SecurityGroup: SecurityGroup{Name: "cluster-test-node-nsg"}, RouteTable: RouteTable{Name: "cluster-test-node-routetable"}, + NatGateway: NatGateway{ + NatGatewayIP: PublicIPSpec{ + Name: "", + }, + NatGatewayClassSpec: NatGatewayClassSpec{ + Name: "cluster-test-node-natgw", + }, + }, }, }, }, @@ -1074,7 +1109,7 @@ func TestNodeOutboundLBDefaults(t *testing.T) { output *AzureCluster }{ { - name: "default lb for public clusters", + name: "default no lb for public clusters", cluster: &AzureCluster{ ObjectMeta: metav1.ObjectMeta{ Name: "cluster-test", @@ -1132,30 +1167,12 @@ func TestNodeOutboundLBDefaults(t *testing.T) { Type: Public, }, }, - NodeOutboundLB: &LoadBalancerSpec{ - Name: "cluster-test", - FrontendIPs: []FrontendIP{{ - Name: "cluster-test-frontEnd", - PublicIP: &PublicIPSpec{ - Name: "pip-cluster-test-node-outbound", - }, - }}, - BackendPool: BackendPool{ - Name: "cluster-test-outboundBackendPool", - }, - FrontendIPsCount: pointer.Int32(1), - LoadBalancerClassSpec: LoadBalancerClassSpec{ - SKU: SKUStandard, - Type: Public, - IdleTimeoutInMinutes: pointer.Int32(DefaultOutboundRuleIdleTimeoutInMinutes), - }, - }, }, }, }, }, { - name: "NAT gateway enabled - no LB", + name: "IPv6 enabled", cluster: &AzureCluster{ ObjectMeta: metav1.ObjectMeta{ Name: "cluster-test", @@ -1174,16 +1191,12 @@ func TestNodeOutboundLBDefaults(t *testing.T) { }, { SubnetClassSpec: SubnetClassSpec{ - Role: SubnetNode, - Name: "node-subnet", + Role: "node", + CIDRBlocks: []string{"2001:beea::1/64"}, + Name: "cluster-test-node-subnet", }, SecurityGroup: SecurityGroup{}, RouteTable: RouteTable{}, - NatGateway: NatGateway{ - NatGatewayClassSpec: NatGatewayClassSpec{ - Name: "node-natgateway", - }, - }, }, }, }, @@ -1206,16 +1219,12 @@ func TestNodeOutboundLBDefaults(t *testing.T) { }, { SubnetClassSpec: SubnetClassSpec{ - Role: SubnetNode, - Name: "node-subnet", + Role: "node", + CIDRBlocks: []string{"2001:beea::1/64"}, + Name: "cluster-test-node-subnet", }, SecurityGroup: SecurityGroup{}, RouteTable: RouteTable{}, - NatGateway: NatGateway{ - NatGatewayClassSpec: NatGatewayClassSpec{ - Name: "node-natgateway", - }, - }, }, }, APIServerLB: LoadBalancerSpec{ @@ -1223,12 +1232,30 @@ func TestNodeOutboundLBDefaults(t *testing.T) { Type: Public, }, }, + NodeOutboundLB: &LoadBalancerSpec{ + Name: "cluster-test", + FrontendIPs: []FrontendIP{{ + Name: "cluster-test-frontEnd", + PublicIP: &PublicIPSpec{ + Name: "pip-cluster-test-node-outbound", + }, + }}, + BackendPool: BackendPool{ + Name: "cluster-test-outboundBackendPool", + }, + FrontendIPsCount: pointer.Int32(1), + LoadBalancerClassSpec: LoadBalancerClassSpec{ + SKU: SKUStandard, + Type: Public, + IdleTimeoutInMinutes: pointer.Int32(DefaultOutboundRuleIdleTimeoutInMinutes), + }, + }, }, }, }, }, { - name: "NAT gateway enabled on 1 of 2 node subnets", + name: "IPv6 enabled on 1 of 2 node subnets", cluster: &AzureCluster{ ObjectMeta: metav1.ObjectMeta{ Name: "cluster-test", @@ -1247,16 +1274,12 @@ func TestNodeOutboundLBDefaults(t *testing.T) { }, { SubnetClassSpec: SubnetClassSpec{ - Role: SubnetNode, - Name: "node-subnet", + Role: SubnetNode, + CIDRBlocks: []string{"2001:beea::1/64"}, + Name: "node-subnet-1", }, SecurityGroup: SecurityGroup{}, RouteTable: RouteTable{}, - NatGateway: NatGateway{ - NatGatewayClassSpec: NatGatewayClassSpec{ - Name: "node-natgateway", - }, - }, }, { SubnetClassSpec: SubnetClassSpec{ @@ -1287,17 +1310,12 @@ func TestNodeOutboundLBDefaults(t *testing.T) { }, { SubnetClassSpec: SubnetClassSpec{ - Role: SubnetNode, - Name: "node-subnet", + Role: SubnetNode, + CIDRBlocks: []string{"2001:beea::1/64"}, + Name: "node-subnet-1", }, SecurityGroup: SecurityGroup{}, RouteTable: RouteTable{}, - NatGateway: NatGateway{ - NatGatewayClassSpec: NatGatewayClassSpec{ - - Name: "node-natgateway", - }, - }, }, { SubnetClassSpec: SubnetClassSpec{ @@ -1336,7 +1354,7 @@ func TestNodeOutboundLBDefaults(t *testing.T) { }, }, { - name: "multiple node subnets, NAT gateway not enabled in any of them", + name: "multiple node subnets, IPv6 not enabled in any of them", cluster: &AzureCluster{ ObjectMeta: metav1.ObjectMeta{ Name: "cluster-test", @@ -1426,30 +1444,12 @@ func TestNodeOutboundLBDefaults(t *testing.T) { Type: Public, }, }, - NodeOutboundLB: &LoadBalancerSpec{ - FrontendIPs: []FrontendIP{{ - Name: "cluster-test-frontEnd", - PublicIP: &PublicIPSpec{ - Name: "pip-cluster-test-node-outbound", - }, - }}, - FrontendIPsCount: pointer.Int32(1), - BackendPool: BackendPool{ - Name: "cluster-test-outboundBackendPool", - }, - LoadBalancerClassSpec: LoadBalancerClassSpec{ - SKU: SKUStandard, - Type: Public, - IdleTimeoutInMinutes: pointer.Int32(DefaultOutboundRuleIdleTimeoutInMinutes), - }, - Name: "cluster-test", - }, }, }, }, }, { - name: "multiple node subnets, NAT gateway enabled on all of them", + name: "multiple node subnets, IPv6 enabled on all of them", cluster: &AzureCluster{ ObjectMeta: metav1.ObjectMeta{ Name: "cluster-test", @@ -1468,45 +1468,30 @@ func TestNodeOutboundLBDefaults(t *testing.T) { }, { SubnetClassSpec: SubnetClassSpec{ - Role: SubnetNode, - Name: "node-subnet", + Role: SubnetNode, + CIDRBlocks: []string{"2001:beea::1/64"}, + Name: "node-subnet-1", }, SecurityGroup: SecurityGroup{}, RouteTable: RouteTable{}, - NatGateway: NatGateway{ - NatGatewayClassSpec: NatGatewayClassSpec{ - - Name: "node-natgateway", - }, - }, }, { SubnetClassSpec: SubnetClassSpec{ - Role: SubnetNode, - Name: "node-subnet-2", + Role: SubnetNode, + CIDRBlocks: []string{"2002:beee::1/64"}, + Name: "node-subnet-2", }, SecurityGroup: SecurityGroup{}, RouteTable: RouteTable{}, - NatGateway: NatGateway{ - NatGatewayClassSpec: NatGatewayClassSpec{ - - Name: "node-natgateway-2", - }, - }, }, { SubnetClassSpec: SubnetClassSpec{ - Role: SubnetNode, - Name: "node-subnet-3", + Role: SubnetNode, + CIDRBlocks: []string{"2003:befa::1/64"}, + Name: "node-subnet-3", }, SecurityGroup: SecurityGroup{}, RouteTable: RouteTable{}, - NatGateway: NatGateway{ - NatGatewayClassSpec: NatGatewayClassSpec{ - - Name: "node-natgateway-3", - }, - }, }, }, }, @@ -1529,45 +1514,30 @@ func TestNodeOutboundLBDefaults(t *testing.T) { }, { SubnetClassSpec: SubnetClassSpec{ - Role: SubnetNode, - Name: "node-subnet", + Role: SubnetNode, + CIDRBlocks: []string{"2001:beea::1/64"}, + Name: "node-subnet-1", }, SecurityGroup: SecurityGroup{}, RouteTable: RouteTable{}, - NatGateway: NatGateway{ - NatGatewayClassSpec: NatGatewayClassSpec{ - - Name: "node-natgateway", - }, - }, }, { SubnetClassSpec: SubnetClassSpec{ - Role: SubnetNode, - Name: "node-subnet-2", + Role: SubnetNode, + CIDRBlocks: []string{"2002:beee::1/64"}, + Name: "node-subnet-2", }, SecurityGroup: SecurityGroup{}, RouteTable: RouteTable{}, - NatGateway: NatGateway{ - NatGatewayClassSpec: NatGatewayClassSpec{ - - Name: "node-natgateway-2", - }, - }, }, { SubnetClassSpec: SubnetClassSpec{ - Role: SubnetNode, - Name: "node-subnet-3", + Role: SubnetNode, + CIDRBlocks: []string{"2003:befa::1/64"}, + Name: "node-subnet-3", }, SecurityGroup: SecurityGroup{}, RouteTable: RouteTable{}, - NatGateway: NatGateway{ - NatGatewayClassSpec: NatGatewayClassSpec{ - - Name: "node-natgateway-3", - }, - }, }, }, APIServerLB: LoadBalancerSpec{ @@ -1575,6 +1545,24 @@ func TestNodeOutboundLBDefaults(t *testing.T) { Type: Public, }, }, + NodeOutboundLB: &LoadBalancerSpec{ + Name: "cluster-test", + FrontendIPs: []FrontendIP{{ + Name: "cluster-test-frontEnd", + PublicIP: &PublicIPSpec{ + Name: "pip-cluster-test-node-outbound", + }, + }}, + BackendPool: BackendPool{ + Name: "cluster-test-outboundBackendPool", + }, + FrontendIPsCount: pointer.Int32(1), + LoadBalancerClassSpec: LoadBalancerClassSpec{ + SKU: SKUStandard, + Type: Public, + IdleTimeoutInMinutes: pointer.Int32(DefaultOutboundRuleIdleTimeoutInMinutes), + }, + }, }, }, }, diff --git a/api/v1beta1/azurecluster_validation.go b/api/v1beta1/azurecluster_validation.go index 582094bc010..9c814e77233 100644 --- a/api/v1beta1/azurecluster_validation.go +++ b/api/v1beta1/azurecluster_validation.go @@ -165,14 +165,14 @@ func validateNetworkSpec(networkSpec NetworkSpec, old NetworkSpec, fldPath *fiel allErrs = append(allErrs, validateAPIServerLB(networkSpec.APIServerLB, old.APIServerLB, cidrBlocks, fldPath.Child("apiServerLB"))...) - var oneSubnetWithoutNatGateway bool + var needOutboundLB bool for _, subnet := range networkSpec.Subnets { - if subnet.Role == SubnetNode && !subnet.IsNatGatewayEnabled() { - oneSubnetWithoutNatGateway = true + if subnet.Role == SubnetNode && subnet.IsIPv6Enabled() { + needOutboundLB = true break } } - if oneSubnetWithoutNatGateway { + if needOutboundLB { allErrs = append(allErrs, validateNodeOutboundLB(networkSpec.NodeOutboundLB, old.NodeOutboundLB, networkSpec.APIServerLB, fldPath.Child("nodeOutboundLB"))...) } diff --git a/api/v1beta1/azurecluster_webhook.go b/api/v1beta1/azurecluster_webhook.go index 23a42b6071e..f218290643c 100644 --- a/api/v1beta1/azurecluster_webhook.go +++ b/api/v1beta1/azurecluster_webhook.go @@ -168,7 +168,7 @@ func (c *AzureCluster) validateSubnetUpdate(old *AzureCluster) field.ErrorList { c.Spec.NetworkSpec.Subnets[i].RouteTable.Name, "field is immutable"), ) } - if subnet.NatGateway.Name != oldSubnet.NatGateway.Name { + if (subnet.NatGateway.Name != oldSubnet.NatGateway.Name) && (oldSubnet.NatGateway.Name != "") { allErrs = append(allErrs, field.Invalid(field.NewPath("spec", "networkSpec", "subnets").Index(oldSubnetIndex[subnet.Name]).Child("NatGateway").Child("Name"), c.Spec.NetworkSpec.Subnets[i].NatGateway.Name, "field is immutable"), diff --git a/api/v1beta1/azurecluster_webhook_test.go b/api/v1beta1/azurecluster_webhook_test.go index 0bc42440d73..d226c43a36d 100644 --- a/api/v1beta1/azurecluster_webhook_test.go +++ b/api/v1beta1/azurecluster_webhook_test.go @@ -318,6 +318,30 @@ func TestAzureCluster_ValidateUpdate(t *testing.T) { }, wantErr: true, }, + { + name: "natGateway name is immutable", + oldCluster: func() *AzureCluster { + cluster := createValidCluster() + cluster.Spec.NetworkSpec.Subnets[0].NatGateway.Name = "cluster-test-node-natgw-0" + return cluster + }(), + cluster: func() *AzureCluster { + cluster := createValidCluster() + cluster.Spec.NetworkSpec.Subnets[0].NatGateway.Name = "cluster-test-node-natgw-1" + return cluster + }(), + wantErr: true, + }, + { + name: "natGateway name can be empty before AzureCluster is updated", + oldCluster: createValidCluster(), + cluster: func() *AzureCluster { + cluster := createValidCluster() + cluster.Spec.NetworkSpec.Subnets[0].NatGateway.Name = "cluster-test-node-natgw" + return cluster + }(), + wantErr: false, + }, } for _, tc := range tests { tc := tc diff --git a/api/v1beta1/azureclustertemplate_default.go b/api/v1beta1/azureclustertemplate_default.go index 2f65ecccb91..3ed11d1fb24 100644 --- a/api/v1beta1/azureclustertemplate_default.go +++ b/api/v1beta1/azureclustertemplate_default.go @@ -94,7 +94,7 @@ func (c *AzureClusterTemplate) setNodeOutboundLBDefaults() { var needsOutboundLB bool for _, subnet := range c.Spec.Template.Spec.NetworkSpec.Subnets { - if subnet.Role == SubnetNode && !subnet.IsNatGatewayEnabled() { + if subnet.Role == SubnetNode && subnet.IsIPv6Enabled() { needsOutboundLB = true break } diff --git a/api/v1beta1/azureclustertemplate_default_test.go b/api/v1beta1/azureclustertemplate_default_test.go index 9390e9d0e07..3c485e2ff29 100644 --- a/api/v1beta1/azureclustertemplate_default_test.go +++ b/api/v1beta1/azureclustertemplate_default_test.go @@ -540,7 +540,7 @@ func TestNodeOutboundLBClassDefaults(t *testing.T) { outputTemplate *AzureClusterTemplate }{ { - name: "default lb for public clusters", + name: "default no lb for public clusters", clusterTemplate: &AzureClusterTemplate{ ObjectMeta: metav1.ObjectMeta{ Name: "test-cluster-template", @@ -588,11 +588,6 @@ func TestNodeOutboundLBClassDefaults(t *testing.T) { }, }, }, - NodeOutboundLB: &LoadBalancerClassSpec{ - SKU: SKUStandard, - Type: Public, - IdleTimeoutInMinutes: pointer.Int32(DefaultOutboundRuleIdleTimeoutInMinutes), - }, }, }, }, @@ -600,7 +595,7 @@ func TestNodeOutboundLBClassDefaults(t *testing.T) { }, }, { - name: "NAT gateway enabled - no LB", + name: "default lb when IPv6 enabled", clusterTemplate: &AzureClusterTemplate{ ObjectMeta: metav1.ObjectMeta{ Name: "test-cluster-template", @@ -618,10 +613,8 @@ func TestNodeOutboundLBClassDefaults(t *testing.T) { }, { SubnetClassSpec: SubnetClassSpec{ - Role: SubnetNode, - }, - NatGateway: NatGatewayClassSpec{ - Name: "node-natgateway", + Role: SubnetNode, + CIDRBlocks: []string{"2001:beea::1/64"}, }, }, }, @@ -647,13 +640,16 @@ func TestNodeOutboundLBClassDefaults(t *testing.T) { }, { SubnetClassSpec: SubnetClassSpec{ - Role: SubnetNode, - }, - NatGateway: NatGatewayClassSpec{ - Name: "node-natgateway", + Role: SubnetNode, + CIDRBlocks: []string{"2001:beea::1/64"}, }, }, }, + NodeOutboundLB: &LoadBalancerClassSpec{ + SKU: SKUStandard, + Type: Public, + IdleTimeoutInMinutes: pointer.Int32(DefaultOutboundRuleIdleTimeoutInMinutes), + }, }, }, }, @@ -661,7 +657,7 @@ func TestNodeOutboundLBClassDefaults(t *testing.T) { }, }, { - name: "NAT gateway enabled on 1 of 2 node subnets", + name: "IPv6 enabled on 1 of 2 node subnets", clusterTemplate: &AzureClusterTemplate{ ObjectMeta: metav1.ObjectMeta{ Name: "test-cluster-template", @@ -679,10 +675,8 @@ func TestNodeOutboundLBClassDefaults(t *testing.T) { }, { SubnetClassSpec: SubnetClassSpec{ - Role: SubnetNode, - }, - NatGateway: NatGatewayClassSpec{ - Name: "node-natgateway", + Role: SubnetNode, + CIDRBlocks: []string{"2001:beea::1/64"}, }, }, { @@ -713,10 +707,8 @@ func TestNodeOutboundLBClassDefaults(t *testing.T) { }, { SubnetClassSpec: SubnetClassSpec{ - Role: SubnetNode, - }, - NatGateway: NatGatewayClassSpec{ - Name: "node-natgateway", + Role: SubnetNode, + CIDRBlocks: []string{"2001:beea::1/64"}, }, }, { @@ -737,7 +729,7 @@ func TestNodeOutboundLBClassDefaults(t *testing.T) { }, }, { - name: "multiple node subnets, NAT gateway not enabled in any of them", + name: "multiple subnets specified with IPv6 enabled", clusterTemplate: &AzureClusterTemplate{ ObjectMeta: metav1.ObjectMeta{ Name: "test-cluster-template", @@ -755,12 +747,14 @@ func TestNodeOutboundLBClassDefaults(t *testing.T) { }, { SubnetClassSpec: SubnetClassSpec{ - Role: SubnetNode, + Role: SubnetNode, + CIDRBlocks: []string{"2001:beea::1/64"}, }, }, { SubnetClassSpec: SubnetClassSpec{ - Role: SubnetNode, + Role: SubnetNode, + CIDRBlocks: []string{"2002:beeb::1/64"}, }, }, }, @@ -786,12 +780,14 @@ func TestNodeOutboundLBClassDefaults(t *testing.T) { }, { SubnetClassSpec: SubnetClassSpec{ - Role: SubnetNode, + Role: SubnetNode, + CIDRBlocks: []string{"2001:beea::1/64"}, }, }, { SubnetClassSpec: SubnetClassSpec{ - Role: SubnetNode, + Role: SubnetNode, + CIDRBlocks: []string{"2002:beeb::1/64"}, }, }, }, @@ -807,7 +803,7 @@ func TestNodeOutboundLBClassDefaults(t *testing.T) { }, }, { - name: "multiple node subnets, NAT gateway enabled in all of them", + name: "multiple node subnets, Ipv6 not enabled in any of them", clusterTemplate: &AzureClusterTemplate{ ObjectMeta: metav1.ObjectMeta{ Name: "test-cluster-template", @@ -827,17 +823,11 @@ func TestNodeOutboundLBClassDefaults(t *testing.T) { SubnetClassSpec: SubnetClassSpec{ Role: SubnetNode, }, - NatGateway: NatGatewayClassSpec{ - Name: "node-natgateway", - }, }, { SubnetClassSpec: SubnetClassSpec{ Role: SubnetNode, }, - NatGateway: NatGatewayClassSpec{ - Name: "node-natgateway-2", - }, }, }, }, @@ -864,17 +854,11 @@ func TestNodeOutboundLBClassDefaults(t *testing.T) { SubnetClassSpec: SubnetClassSpec{ Role: SubnetNode, }, - NatGateway: NatGatewayClassSpec{ - Name: "node-natgateway", - }, }, { SubnetClassSpec: SubnetClassSpec{ Role: SubnetNode, }, - NatGateway: NatGatewayClassSpec{ - Name: "node-natgateway-2", - }, }, }, }, diff --git a/api/v1beta1/azureclustertemplate_validation.go b/api/v1beta1/azureclustertemplate_validation.go index 1b1b00ada32..a3fd425ed2f 100644 --- a/api/v1beta1/azureclustertemplate_validation.go +++ b/api/v1beta1/azureclustertemplate_validation.go @@ -55,15 +55,15 @@ func (c *AzureClusterTemplate) validateClusterTemplateSpec() field.ErrorList { field.NewPath("spec").Child("template").Child("spec").Child("networkSpec").Child("apiServerLB"), )...) - var oneSubnetWithoutNatGateway bool + var needOutboundLB bool networkSpec := c.Spec.Template.Spec.NetworkSpec for _, subnet := range networkSpec.Subnets { - if subnet.Role == SubnetNode && !subnet.IsNatGatewayEnabled() { - oneSubnetWithoutNatGateway = true + if subnet.Role == SubnetNode && subnet.IsIPv6Enabled() { + needOutboundLB = true break } } - if oneSubnetWithoutNatGateway { + if needOutboundLB { allErrs = append(allErrs, c.validateNodeOutboundLB()...) } diff --git a/api/v1beta1/azuremachine_default.go b/api/v1beta1/azuremachine_default.go index ded1ace26a0..7639c81fc32 100644 --- a/api/v1beta1/azuremachine_default.go +++ b/api/v1beta1/azuremachine_default.go @@ -174,21 +174,43 @@ func (s *AzureMachineSpec) SetNetworkInterfacesDefaults() { } } -// GetSubscriptionID returns the subscription ID for the given cluster name and namespace. -func GetSubscriptionID(cli client.Client, clusterName string, namespace string, maxAttempts int) (string, error) { +// GetOwnerAzureClusterNameAndNamespace returns the owner azure cluster's name and namespace for the given cluster name and namespace. +func GetOwnerAzureClusterNameAndNamespace(cli client.Client, clusterName string, namespace string, maxAttempts int) (azureClusterName string, azureClusterNamespace string, err error) { ctx := context.Background() - ownerCluster := &AzureCluster{} + ownerCluster := &clusterv1.Cluster{} key := client.ObjectKey{ Namespace: namespace, Name: clusterName, } for i := 1; ; i++ { - err := cli.Get(ctx, key, ownerCluster) - if err != nil { + if err := cli.Get(ctx, key, ownerCluster); err != nil { if i > maxAttempts { - return "", errors.Wrapf(err, "failed to find owner cluster for %s/%s", namespace, clusterName) + return "", "", errors.Wrapf(err, "failed to find owner cluster for %s/%s", namespace, clusterName) + } + time.Sleep(1 * time.Second) + continue + } + break + } + + return ownerCluster.Spec.InfrastructureRef.Name, ownerCluster.Spec.InfrastructureRef.Namespace, nil +} + +// GetSubscriptionID returns the subscription ID for the AzureCluster given the cluster name and namespace. +func GetSubscriptionID(cli client.Client, ownerAzureClusterName string, ownerAzureClusterNamespace string, maxAttempts int) (string, error) { + ctx := context.Background() + + ownerAzureCluster := &AzureCluster{} + key := client.ObjectKey{ + Namespace: ownerAzureClusterNamespace, + Name: ownerAzureClusterName, + } + for i := 1; ; i++ { + if err := cli.Get(ctx, key, ownerAzureCluster); err != nil { + if i >= maxAttempts { + return "", errors.Wrapf(err, "failed to find AzureCluster for owner cluster %s/%s", ownerAzureClusterNamespace, ownerAzureClusterName) } time.Sleep(1 * time.Second) continue @@ -196,7 +218,7 @@ func GetSubscriptionID(cli client.Client, clusterName string, namespace string, break } - return ownerCluster.Spec.SubscriptionID, nil + return ownerAzureCluster.Spec.SubscriptionID, nil } // SetDefaults sets to the defaults for the AzureMachineSpec. @@ -207,12 +229,17 @@ func (m *AzureMachine) SetDefaults(client client.Client) error { } // Fetch the Cluster. - clusterName, ok := m.Labels[clusterv1.ClusterLabelName] + clusterName, ok := m.Labels[clusterv1.ClusterNameLabel] if !ok { errs = append(errs, errors.Errorf("failed to fetch ClusterName for AzureMachine %s/%s", m.Namespace, m.Name)) } - subscriptionID, err := GetSubscriptionID(client, clusterName, m.Namespace, 5) + ownerAzureClusterName, ownerAzureClusterNamespace, err := GetOwnerAzureClusterNameAndNamespace(client, clusterName, m.Namespace, 5) + if err != nil { + errs = append(errs, errors.Wrapf(err, "failed to fetch owner cluster for AzureMachine %s/%s", m.Namespace, m.Name)) + } + + subscriptionID, err := GetSubscriptionID(client, ownerAzureClusterName, ownerAzureClusterNamespace, 5) if err != nil { errs = append(errs, errors.Wrapf(err, "failed to fetch subscription ID for AzureMachine %s/%s", m.Namespace, m.Name)) } diff --git a/api/v1beta1/azuremachine_default_test.go b/api/v1beta1/azuremachine_default_test.go index 4acd165ead5..b18dbbea797 100644 --- a/api/v1beta1/azuremachine_default_test.go +++ b/api/v1beta1/azuremachine_default_test.go @@ -26,6 +26,7 @@ import ( "github.com/google/uuid" . "github.com/onsi/gomega" "github.com/pkg/errors" + corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/utils/pointer" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" @@ -401,39 +402,101 @@ func TestAzureMachineSpec_SetNetworkInterfacesDefaults(t *testing.T) { } } +func TestAzureMachineSpec_GetOwnerCluster(t *testing.T) { + tests := []struct { + name string + maxAttempts int + wantedName string + wantedNamespace string + wantErr bool + }{ + { + name: "ownerCluster is returned", + maxAttempts: 1, + wantedName: "test-cluster", + wantedNamespace: "default", + wantErr: false, + }, + { + name: "ownerCluster is returned after 2 attempts", + maxAttempts: 2, + wantedName: "test-cluster", + wantedNamespace: "default", + wantErr: false, + }, + { + name: "ownerCluster is not returned after 5 attempts", + maxAttempts: 5, + wantedName: "test-cluster", + wantedNamespace: "default", + wantErr: true, + }, + } + + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + g := NewWithT(t) + client := mockClient{ReturnError: tc.wantErr} + name, namespace, err := GetOwnerAzureClusterNameAndNamespace(client, "test-cluster", "default", tc.maxAttempts) + if tc.wantErr { + g.Expect(err).To(HaveOccurred()) + } else { + g.Expect(err).NotTo(HaveOccurred()) + g.Expect(name).To(Equal(tc.wantedName)) + g.Expect(namespace).To(Equal(tc.wantedNamespace)) + } + }) + } +} + func TestAzureMachineSpec_GetSubscriptionID(t *testing.T) { g := NewWithT(t) tests := []struct { - name string - maxAttempts int - want string - wantErr bool + name string + maxAttempts int + ownerAzureClusterName string + ownerAzureClusterNamespace string + want string + wantErr bool }{ { - name: "subscription ID is returned", - maxAttempts: 1, - want: "test-subscription-id", - wantErr: false, + name: "empty owner cluster name returns error", + maxAttempts: 1, + ownerAzureClusterName: "", + want: "test-subscription-id", + wantErr: true, }, { - name: "subscription ID is returned after 2 attempts", - maxAttempts: 2, - want: "test-subscription-id", - wantErr: false, + name: "subscription ID is returned", + maxAttempts: 1, + ownerAzureClusterName: "test-cluster", + ownerAzureClusterNamespace: "default", + want: "test-subscription-id", + wantErr: false, }, { - name: "subscription ID is not returned after 5 attempts", - maxAttempts: 5, - want: "", - wantErr: true, + name: "subscription ID is returned after 2 attempts", + maxAttempts: 2, + ownerAzureClusterName: "test-cluster", + ownerAzureClusterNamespace: "default", + want: "test-subscription-id", + wantErr: false, + }, + { + name: "subscription ID is not returned after 5 attempts", + maxAttempts: 5, + ownerAzureClusterName: "test-cluster", + ownerAzureClusterNamespace: "default", + want: "", + wantErr: true, }, } for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { client := mockClient{ReturnError: tc.wantErr} - result, err := GetSubscriptionID(client, "test-cluster", "default", tc.maxAttempts) + result, err := GetSubscriptionID(client, tc.ownerAzureClusterName, tc.ownerAzureClusterNamespace, tc.maxAttempts) if tc.wantErr { g.Expect(err).To(HaveOccurred()) } else { @@ -453,9 +516,19 @@ func (m mockClient) Get(ctx context.Context, key client.ObjectKey, obj client.Ob if m.ReturnError { return errors.New("AzureCluster not found: failed to find owner cluster for test-cluster") } - ac := &AzureCluster{} - ac.Spec.SubscriptionID = "test-subscription-id" - obj.(*AzureCluster).Spec.SubscriptionID = ac.Spec.SubscriptionID + // Check if we're calling Get on an AzureCluster or a Cluster + switch obj := obj.(type) { + case *AzureCluster: + obj.Spec.SubscriptionID = "test-subscription-id" + case *clusterv1.Cluster: + obj.Spec.InfrastructureRef = &corev1.ObjectReference{ + Kind: "AzureCluster", + Name: "test-cluster", + Namespace: "default", + } + default: + return errors.New("unexpected object type") + } return nil } @@ -476,7 +549,7 @@ func hardcodedAzureMachineWithSSHKey(sshPublicKey string) *AzureMachine { return &AzureMachine{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ - clusterv1.ClusterLabelName: "test-cluster", + clusterv1.ClusterNameLabel: "test-cluster", }, }, Spec: AzureMachineSpec{ diff --git a/api/v1beta1/azuremachine_validation.go b/api/v1beta1/azuremachine_validation.go index 73f476af2d6..e741838714d 100644 --- a/api/v1beta1/azuremachine_validation.go +++ b/api/v1beta1/azuremachine_validation.go @@ -38,6 +38,10 @@ func ValidateAzureMachineSpec(spec AzureMachineSpec) field.ErrorList { allErrs = append(allErrs, errs...) } + if errs := ValidateConfidentialCompute(spec.OSDisk.ManagedDisk, spec.SecurityProfile, field.NewPath("securityProfile")); len(errs) > 0 { + allErrs = append(allErrs, errs...) + } + if errs := ValidateSSHKey(spec.SSHPublicKey, field.NewPath("sshPublicKey")); len(errs) > 0 { allErrs = append(allErrs, errs...) } @@ -234,6 +238,18 @@ func validateManagedDisk(m *ManagedDiskParameters, fieldPath *field.Path, isOSDi if m != nil { allErrs = append(allErrs, validateStorageAccountType(m.StorageAccountType, fieldPath.Child("StorageAccountType"), isOSDisk)...) + + // DiskEncryptionSet can only be set when SecurityEncryptionType is set to DiskWithVMGuestState + // https://learn.microsoft.com/en-us/rest/api/compute/virtual-machines/create-or-update?tabs=HTTP#securityencryptiontypes + if isOSDisk && m.SecurityProfile != nil && m.SecurityProfile.DiskEncryptionSet != nil { + if m.SecurityProfile.SecurityEncryptionType != SecurityEncryptionTypeDiskWithVMGuestState { + allErrs = append(allErrs, field.Invalid( + fieldPath.Child("securityProfile").Child("diskEncryptionSet"), + m.SecurityProfile.DiskEncryptionSet.ID, + "diskEncryptionSet is only supported when securityEncryptionType is set to DiskWithVMGuestState", + )) + } + } } return allErrs @@ -378,3 +394,52 @@ func ValidateDiagnostics(diagnostics *Diagnostics, fieldPath *field.Path) field. return allErrs } + +// ValidateConfidentialCompute validates the configuration options when the machine is a Confidential VM. +// https://learn.microsoft.com/en-us/rest/api/compute/virtual-machines/create-or-update?tabs=HTTP#vmdisksecurityprofile +// https://learn.microsoft.com/en-us/rest/api/compute/virtual-machines/create-or-update?tabs=HTTP#securityencryptiontypes +// https://learn.microsoft.com/en-us/rest/api/compute/virtual-machines/create-or-update?tabs=HTTP#uefisettings +func ValidateConfidentialCompute(managedDisk *ManagedDiskParameters, profile *SecurityProfile, fieldPath *field.Path) field.ErrorList { + var allErrs field.ErrorList + + var securityEncryptionType SecurityEncryptionType + + if managedDisk != nil && managedDisk.SecurityProfile != nil { + securityEncryptionType = managedDisk.SecurityProfile.SecurityEncryptionType + } + + if profile != nil && securityEncryptionType != "" { + // SecurityEncryptionType can only be set for Confindential VMs + if profile.SecurityType != SecurityTypesConfidentialVM { + allErrs = append(allErrs, field.Invalid(fieldPath.Child("SecurityType"), profile.SecurityType, + fmt.Sprintf("SecurityType should be set to '%s' when securityEncryptionType is defined", SecurityTypesConfidentialVM))) + } + + // Confidential VMs require vTPM to be enabled, irrespective of the SecurityEncryptionType used + if profile.UefiSettings == nil { + allErrs = append(allErrs, field.Invalid(fieldPath.Child("UefiSettings"), profile.UefiSettings, + "UefiSettings should be set when securityEncryptionType is defined")) + } + + if profile.UefiSettings != nil && (profile.UefiSettings.VTpmEnabled == nil || !*profile.UefiSettings.VTpmEnabled) { + allErrs = append(allErrs, field.Invalid(fieldPath.Child("VTpmEnabled"), profile.UefiSettings.VTpmEnabled, + "VTpmEnabled should be set to true when securityEncryptionType is defined")) + } + + if securityEncryptionType == SecurityEncryptionTypeDiskWithVMGuestState { + // DiskWithVMGuestState encryption type is not compatible with EncryptionAtHost + if profile.EncryptionAtHost != nil && *profile.EncryptionAtHost { + allErrs = append(allErrs, field.Invalid(fieldPath.Child("EncryptionAtHost"), profile.EncryptionAtHost, + fmt.Sprintf("EncryptionAtHost cannot be set to 'true' when securityEncryptionType is set to '%s'", SecurityEncryptionTypeDiskWithVMGuestState))) + } + + // DiskWithVMGuestState encryption type requires SecureBoot to be enabled + if profile.UefiSettings != nil && (profile.UefiSettings.SecureBootEnabled == nil || !*profile.UefiSettings.SecureBootEnabled) { + allErrs = append(allErrs, field.Invalid(fieldPath.Child("SecureBootEnabled"), profile.UefiSettings.SecureBootEnabled, + fmt.Sprintf("SecureBootEnabled should be set to true when securityEncryptionType is set to '%s'", SecurityEncryptionTypeDiskWithVMGuestState))) + } + } + } + + return allErrs +} diff --git a/api/v1beta1/azuremachine_validation_test.go b/api/v1beta1/azuremachine_validation_test.go index cefc5d20be9..4443e6b6e31 100644 --- a/api/v1beta1/azuremachine_validation_test.go +++ b/api/v1beta1/azuremachine_validation_test.go @@ -868,3 +868,186 @@ func TestAzureMachine_ValidateNetwork(t *testing.T) { }) } } + +func TestAzureMachine_ValidateConfidentialCompute(t *testing.T) { + g := NewWithT(t) + + tests := []struct { + name string + managedDisk *ManagedDiskParameters + securityProfile *SecurityProfile + wantErr bool + }{ + { + name: "valid configuration without confidential compute", + managedDisk: &ManagedDiskParameters{ + SecurityProfile: &VMDiskSecurityProfile{ + SecurityEncryptionType: "", + }, + }, + securityProfile: nil, + wantErr: false, + }, + { + name: "valid configuration without confidential compute and host encryption enabled", + managedDisk: &ManagedDiskParameters{ + SecurityProfile: &VMDiskSecurityProfile{ + SecurityEncryptionType: "", + }, + }, + securityProfile: &SecurityProfile{ + EncryptionAtHost: pointer.Bool(true), + }, + wantErr: false, + }, + { + name: "valid configuration with VMGuestStateOnly encryption and secure boot disabled", + managedDisk: &ManagedDiskParameters{ + SecurityProfile: &VMDiskSecurityProfile{ + SecurityEncryptionType: SecurityEncryptionTypeVMGuestStateOnly, + }, + }, + securityProfile: &SecurityProfile{ + SecurityType: SecurityTypesConfidentialVM, + UefiSettings: &UefiSettings{ + VTpmEnabled: pointer.Bool(true), + SecureBootEnabled: pointer.Bool(false), + }, + }, + wantErr: false, + }, + { + name: "valid configuration with VMGuestStateOnly encryption and secure boot enabled", + managedDisk: &ManagedDiskParameters{ + SecurityProfile: &VMDiskSecurityProfile{ + SecurityEncryptionType: SecurityEncryptionTypeVMGuestStateOnly, + }, + }, + securityProfile: &SecurityProfile{ + SecurityType: SecurityTypesConfidentialVM, + UefiSettings: &UefiSettings{ + VTpmEnabled: pointer.Bool(true), + SecureBootEnabled: pointer.Bool(true), + }, + }, + wantErr: false, + }, + { + name: "valid configuration with VMGuestStateOnly encryption and EncryptionAtHost enabled", + managedDisk: &ManagedDiskParameters{ + SecurityProfile: &VMDiskSecurityProfile{ + SecurityEncryptionType: SecurityEncryptionTypeVMGuestStateOnly, + }, + }, + securityProfile: &SecurityProfile{ + EncryptionAtHost: pointer.Bool(true), + SecurityType: SecurityTypesConfidentialVM, + UefiSettings: &UefiSettings{ + VTpmEnabled: pointer.Bool(true), + }, + }, + wantErr: false, + }, + { + name: "valid configuration with DiskWithVMGuestState encryption", + managedDisk: &ManagedDiskParameters{ + SecurityProfile: &VMDiskSecurityProfile{ + SecurityEncryptionType: SecurityEncryptionTypeDiskWithVMGuestState, + }, + }, + securityProfile: &SecurityProfile{ + SecurityType: SecurityTypesConfidentialVM, + UefiSettings: &UefiSettings{ + SecureBootEnabled: pointer.Bool(true), + VTpmEnabled: pointer.Bool(true), + }, + }, + wantErr: false, + }, + { + name: "invalid configuration with DiskWithVMGuestState encryption and EncryptionAtHost enabled", + managedDisk: &ManagedDiskParameters{ + SecurityProfile: &VMDiskSecurityProfile{ + SecurityEncryptionType: SecurityEncryptionTypeDiskWithVMGuestState, + }, + }, + securityProfile: &SecurityProfile{ + EncryptionAtHost: pointer.Bool(true), + }, + wantErr: true, + }, + { + name: "invalid configuration with DiskWithVMGuestState encryption and vTPM disabled", + managedDisk: &ManagedDiskParameters{ + SecurityProfile: &VMDiskSecurityProfile{ + SecurityEncryptionType: SecurityEncryptionTypeDiskWithVMGuestState, + }, + }, + securityProfile: &SecurityProfile{ + SecurityType: SecurityTypesConfidentialVM, + UefiSettings: &UefiSettings{ + VTpmEnabled: pointer.Bool(false), + SecureBootEnabled: pointer.Bool(false), + }, + }, + wantErr: true, + }, + { + name: "invalid configuration with DiskWithVMGuestState encryption and secure boot disabled", + managedDisk: &ManagedDiskParameters{ + SecurityProfile: &VMDiskSecurityProfile{ + SecurityEncryptionType: SecurityEncryptionTypeDiskWithVMGuestState, + }, + }, + securityProfile: &SecurityProfile{ + SecurityType: SecurityTypesConfidentialVM, + UefiSettings: &UefiSettings{ + VTpmEnabled: pointer.Bool(true), + SecureBootEnabled: pointer.Bool(false), + }, + }, + wantErr: true, + }, + { + name: "invalid configuration with DiskWithVMGuestState encryption and SecurityType not set to ConfidentialVM", + managedDisk: &ManagedDiskParameters{ + SecurityProfile: &VMDiskSecurityProfile{ + SecurityEncryptionType: SecurityEncryptionTypeDiskWithVMGuestState, + }, + }, + securityProfile: &SecurityProfile{ + UefiSettings: &UefiSettings{ + VTpmEnabled: pointer.Bool(true), + SecureBootEnabled: pointer.Bool(true), + }, + }, + wantErr: true, + }, + { + name: "invalid configuration with VMGuestStateOnly encryption and SecurityType not set to ConfidentialVM", + managedDisk: &ManagedDiskParameters{ + SecurityProfile: &VMDiskSecurityProfile{ + SecurityEncryptionType: SecurityEncryptionTypeVMGuestStateOnly, + }, + }, + securityProfile: &SecurityProfile{ + UefiSettings: &UefiSettings{ + VTpmEnabled: pointer.Bool(true), + SecureBootEnabled: pointer.Bool(true), + }, + }, + wantErr: true, + }, + } + + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + err := ValidateConfidentialCompute(tc.managedDisk, tc.securityProfile, field.NewPath("securityProfile")) + if tc.wantErr { + g.Expect(err).NotTo(BeEmpty()) + } else { + g.Expect(err).To(BeEmpty()) + } + }) + } +} diff --git a/api/v1beta1/azuremachine_webhook.go b/api/v1beta1/azuremachine_webhook.go index 4aee5ddf41b..8082ddec352 100644 --- a/api/v1beta1/azuremachine_webhook.go +++ b/api/v1beta1/azuremachine_webhook.go @@ -154,7 +154,10 @@ func (mw *azureMachineWebhook) ValidateUpdate(ctx context.Context, oldObj, newOb allErrs = append(allErrs, err) } - if err := webhookutils.ValidateImmutable( + // Spec.AcceleratedNetworking can only be reset to nil and no other changes apart from that + // is accepted if the field is set. + // Ref issue #3518 + if err := webhookutils.ValidateZeroTransition( field.NewPath("Spec", "AcceleratedNetworking"), old.Spec.AcceleratedNetworking, m.Spec.AcceleratedNetworking); err != nil { diff --git a/api/v1beta1/azuremachine_webhook_test.go b/api/v1beta1/azuremachine_webhook_test.go index 04b78169529..bb0541ba70a 100644 --- a/api/v1beta1/azuremachine_webhook_test.go +++ b/api/v1beta1/azuremachine_webhook_test.go @@ -22,6 +22,8 @@ import ( "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute" . "github.com/onsi/gomega" + "github.com/pkg/errors" + corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/utils/pointer" @@ -147,6 +149,71 @@ func TestAzureMachine_ValidateCreate(t *testing.T) { machine: createMachineWithNetworkConfig("", nil, []NetworkInterface{{SubnetName: "subnet", PrivateIPConfigs: 1}}), wantErr: false, }, + { + name: "azuremachine without confidential compute properties and encryption at host enabled", + machine: createMachineWithConfidentialCompute("", "", true, false, false), + wantErr: false, + }, + { + name: "azuremachine with confidential compute VMGuestStateOnly encryption and encryption at host enabled", + machine: createMachineWithConfidentialCompute(SecurityEncryptionTypeVMGuestStateOnly, SecurityTypesConfidentialVM, true, false, false), + wantErr: true, + }, + { + name: "azuremachine with confidential compute DiskWithVMGuestState encryption and encryption at host enabled", + machine: createMachineWithConfidentialCompute(SecurityEncryptionTypeDiskWithVMGuestState, SecurityTypesConfidentialVM, true, true, true), + wantErr: true, + }, + { + name: "azuremachine with confidential compute VMGuestStateOnly encryption, vTPM and SecureBoot enabled", + machine: createMachineWithConfidentialCompute(SecurityEncryptionTypeVMGuestStateOnly, SecurityTypesConfidentialVM, false, true, true), + wantErr: false, + }, + { + name: "azuremachine with confidential compute VMGuestStateOnly encryption enabled, vTPM enabled and SecureBoot disabled", + machine: createMachineWithConfidentialCompute(SecurityEncryptionTypeVMGuestStateOnly, SecurityTypesConfidentialVM, false, true, false), + wantErr: false, + }, + { + name: "azuremachine with confidential compute VMGuestStateOnly encryption enabled, vTPM disabled and SecureBoot enabled", + machine: createMachineWithConfidentialCompute(SecurityEncryptionTypeVMGuestStateOnly, SecurityTypesConfidentialVM, false, false, true), + wantErr: true, + }, + { + name: "azuremachine with confidential compute VMGuestStateOnly encryption enabled, vTPM enabled, SecureBoot disabled and SecurityType empty", + machine: createMachineWithConfidentialCompute(SecurityEncryptionTypeVMGuestStateOnly, "", false, true, false), + wantErr: true, + }, + { + name: "azuremachine with confidential compute VMGuestStateOnly encryption enabled, vTPM and SecureBoot empty", + machine: createMachineWithConfidentialCompute(SecurityEncryptionTypeVMGuestStateOnly, SecurityTypesConfidentialVM, false, false, false), + wantErr: true, + }, + { + name: "azuremachine with confidential compute DiskWithVMGuestState encryption, vTPM and SecureBoot enabled", + machine: createMachineWithConfidentialCompute(SecurityEncryptionTypeDiskWithVMGuestState, SecurityTypesConfidentialVM, false, true, true), + wantErr: false, + }, + { + name: "azuremachine with confidential compute DiskWithVMGuestState encryption enabled, vTPM enabled and SecureBoot disabled", + machine: createMachineWithConfidentialCompute(SecurityEncryptionTypeDiskWithVMGuestState, SecurityTypesConfidentialVM, false, true, false), + wantErr: true, + }, + { + name: "azuremachine with confidential compute DiskWithVMGuestState encryption enabled, vTPM disabled and SecureBoot enabled", + machine: createMachineWithConfidentialCompute(SecurityEncryptionTypeDiskWithVMGuestState, SecurityTypesConfidentialVM, false, false, true), + wantErr: true, + }, + { + name: "azuremachine with confidential compute DiskWithVMGuestState encryption enabled, vTPM disabled and SecureBoot disabled", + machine: createMachineWithConfidentialCompute(SecurityEncryptionTypeDiskWithVMGuestState, SecurityTypesConfidentialVM, false, false, false), + wantErr: true, + }, + { + name: "azuremachine with confidential compute DiskWithVMGuestState encryption enabled, vTPM enabled, SecureBoot disabled and SecurityType empty", + machine: createMachineWithConfidentialCompute(SecurityEncryptionTypeDiskWithVMGuestState, "", false, true, false), + wantErr: true, + }, } for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { @@ -534,6 +601,34 @@ func TestAzureMachine_ValidateUpdate(t *testing.T) { }, wantErr: false, }, + { + name: "validTest: azuremachine.spec.AcceleratedNetworking transition(from true) to nil is acceptable", + oldMachine: &AzureMachine{ + Spec: AzureMachineSpec{ + AcceleratedNetworking: pointer.Bool(true), + }, + }, + newMachine: &AzureMachine{ + Spec: AzureMachineSpec{ + AcceleratedNetworking: nil, + }, + }, + wantErr: false, + }, + { + name: "validTest: azuremachine.spec.AcceleratedNetworking transition(from false) to nil is acceptable", + oldMachine: &AzureMachine{ + Spec: AzureMachineSpec{ + AcceleratedNetworking: pointer.Bool(false), + }, + }, + newMachine: &AzureMachine{ + Spec: AzureMachineSpec{ + AcceleratedNetworking: nil, + }, + }, + wantErr: false, + }, { name: "invalidTest: azuremachine.spec.SpotVMOptions is immutable", oldMachine: &AzureMachine{ @@ -716,7 +811,17 @@ type mockDefaultClient struct { } func (m mockDefaultClient) Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error { - obj.(*AzureCluster).Spec.SubscriptionID = m.SubscriptionID + switch obj := obj.(type) { + case *AzureCluster: + obj.Spec.SubscriptionID = m.SubscriptionID + case *clusterv1.Cluster: + obj.Spec.InfrastructureRef = &corev1.ObjectReference{ + Kind: "AzureCluster", + Name: "test-cluster", + } + default: + return errors.New("invalid object type") + } return nil } @@ -734,7 +839,7 @@ func TestAzureMachine_Default(t *testing.T) { publicKeyNotExistTest := test{machine: createMachineWithSSHPublicKey("")} testObjectMeta := metav1.ObjectMeta{ Labels: map[string]string{ - clusterv1.ClusterLabelName: "test-cluster", + clusterv1.ClusterNameLabel: "test-cluster", }, } @@ -841,7 +946,7 @@ func createMachineWithOsDiskCacheType(cacheType string) *AzureMachine { return machine } -func createMachineWithRoleAssignmentName() *AzureMachine { +func createMachineWithSystemAssignedIdentityRoleName() *AzureMachine { machine := &AzureMachine{ Spec: AzureMachineSpec{ SSHPublicKey: validSSHPublicKey, @@ -857,7 +962,7 @@ func createMachineWithRoleAssignmentName() *AzureMachine { return machine } -func createMachineWithoutRoleAssignmentName() *AzureMachine { +func createMachineWithoutSystemAssignedIdentityRoleName() *AzureMachine { machine := &AzureMachine{ Spec: AzureMachineSpec{ SSHPublicKey: validSSHPublicKey, @@ -872,6 +977,27 @@ func createMachineWithoutRoleAssignmentName() *AzureMachine { return machine } +func createMachineWithoutRoleAssignmentName() *AzureMachine { + machine := &AzureMachine{ + Spec: AzureMachineSpec{ + SSHPublicKey: validSSHPublicKey, + OSDisk: validOSDisk, + }, + } + return machine +} + +func createMachineWithRoleAssignmentName() *AzureMachine { + machine := &AzureMachine{ + Spec: AzureMachineSpec{ + SSHPublicKey: validSSHPublicKey, + OSDisk: validOSDisk, + RoleAssignmentName: "test-role-assignment", + }, + } + return machine +} + func createMachineWithDiagnostics(diagnosticsType BootDiagnosticsStorageAccountType, userManaged *UserManagedBootDiagnostics) *AzureMachine { var diagnostics *Diagnostics @@ -895,3 +1021,34 @@ func createMachineWithDiagnostics(diagnosticsType BootDiagnosticsStorageAccountT }, } } + +func createMachineWithConfidentialCompute(securityEncryptionType SecurityEncryptionType, securityType SecurityTypes, encryptionAtHost, vTpmEnabled, secureBootEnabled bool) *AzureMachine { + securityProfile := &SecurityProfile{ + EncryptionAtHost: &encryptionAtHost, + SecurityType: securityType, + UefiSettings: &UefiSettings{ + VTpmEnabled: &vTpmEnabled, + SecureBootEnabled: &secureBootEnabled, + }, + } + + osDisk := OSDisk{ + DiskSizeGB: pointer.Int32(30), + OSType: LinuxOS, + ManagedDisk: &ManagedDiskParameters{ + StorageAccountType: "Premium_LRS", + SecurityProfile: &VMDiskSecurityProfile{ + SecurityEncryptionType: securityEncryptionType, + }, + }, + CachingType: string(compute.PossibleCachingTypesValues()[0]), + } + + return &AzureMachine{ + Spec: AzureMachineSpec{ + SSHPublicKey: validSSHPublicKey, + OSDisk: osDisk, + SecurityProfile: securityProfile, + }, + } +} diff --git a/api/v1beta1/azuremachinetemplate_webhook_test.go b/api/v1beta1/azuremachinetemplate_webhook_test.go index 838fbed0d0e..8554e35ee48 100644 --- a/api/v1beta1/azuremachinetemplate_webhook_test.go +++ b/api/v1beta1/azuremachinetemplate_webhook_test.go @@ -127,6 +127,16 @@ func TestAzureMachineTemplate_ValidateCreate(t *testing.T) { ), wantErr: true, }, + { + name: "azuremachinetemplate with SystemAssignedIdentityRoleName", + machineTemplate: createAzureMachineTemplateFromMachine(createMachineWithSystemAssignedIdentityRoleName()), + wantErr: true, + }, + { + name: "azuremachinetemplate without SystemAssignedIdentityRoleName", + machineTemplate: createAzureMachineTemplateFromMachine(createMachineWithoutSystemAssignedIdentityRoleName()), + wantErr: false, + }, { name: "azuremachinetemplate with RoleAssignmentName", machineTemplate: createAzureMachineTemplateFromMachine(createMachineWithRoleAssignmentName()), @@ -137,6 +147,90 @@ func TestAzureMachineTemplate_ValidateCreate(t *testing.T) { machineTemplate: createAzureMachineTemplateFromMachine(createMachineWithoutRoleAssignmentName()), wantErr: false, }, + { + name: "azuremachinetemplate with network interfaces > 0 and subnet name", + machineTemplate: createAzureMachineTemplateFromMachine( + createMachineWithNetworkConfig( + "test-subnet", + nil, + []NetworkInterface{ + {SubnetName: "subnet1", PrivateIPConfigs: 1}, + {SubnetName: "subnet2", PrivateIPConfigs: 1}, + }, + ), + ), + wantErr: true, + }, + { + name: "azuremachinetemplate with network interfaces > 0 and no subnet name", + machineTemplate: createAzureMachineTemplateFromMachine( + createMachineWithNetworkConfig( + "", + nil, + []NetworkInterface{ + {SubnetName: "subnet1", PrivateIPConfigs: 1}, + {SubnetName: "subnet2", PrivateIPConfigs: 1}, + }, + ), + ), + wantErr: false, + }, + { + name: "azuremachinetemplate with network interfaces > 0 and AcceleratedNetworking not nil", + machineTemplate: createAzureMachineTemplateFromMachine( + createMachineWithNetworkConfig( + "", + pointer.Bool(true), + []NetworkInterface{ + {SubnetName: "subnet1", PrivateIPConfigs: 1}, + {SubnetName: "subnet2", PrivateIPConfigs: 1}, + }, + ), + ), + wantErr: true, + }, + { + name: "azuremachinetemplate with network interfaces > 0 and AcceleratedNetworking nil", + machineTemplate: createAzureMachineTemplateFromMachine( + createMachineWithNetworkConfig( + "", + nil, + []NetworkInterface{ + {SubnetName: "subnet1", PrivateIPConfigs: 1}, + {SubnetName: "subnet2", PrivateIPConfigs: 1}, + }, + ), + ), + wantErr: false, + }, + { + name: "azuremachinetemplate with network interfaces and PrivateIPConfigs < 1", + machineTemplate: createAzureMachineTemplateFromMachine( + createMachineWithNetworkConfig( + "", + nil, + []NetworkInterface{ + {SubnetName: "subnet1", PrivateIPConfigs: 0}, + {SubnetName: "subnet2", PrivateIPConfigs: -1}, + }, + ), + ), + wantErr: true, + }, + { + name: "azuremachinetemplate with network interfaces and PrivateIPConfigs >= 1", + machineTemplate: createAzureMachineTemplateFromMachine( + createMachineWithNetworkConfig( + "", + nil, + []NetworkInterface{ + {SubnetName: "subnet1", PrivateIPConfigs: 1}, + {SubnetName: "subnet2", PrivateIPConfigs: 2}, + }, + ), + ), + wantErr: false, + }, } for _, test := range tests { diff --git a/api/v1beta1/azuremanagedcluster_types.go b/api/v1beta1/azuremanagedcluster_types.go index 3433c471eac..77442a5744a 100644 --- a/api/v1beta1/azuremanagedcluster_types.go +++ b/api/v1beta1/azuremanagedcluster_types.go @@ -24,6 +24,7 @@ import ( // AzureManagedClusterSpec defines the desired state of AzureManagedCluster. type AzureManagedClusterSpec struct { // ControlPlaneEndpoint represents the endpoint used to communicate with the control plane. + // Immutable, populated by the AKS API at create. // +optional ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"` } diff --git a/api/v1beta1/azuremanagedcluster_webhook.go b/api/v1beta1/azuremanagedcluster_webhook.go index a6cbd98d43b..a6d51588cbb 100644 --- a/api/v1beta1/azuremanagedcluster_webhook.go +++ b/api/v1beta1/azuremanagedcluster_webhook.go @@ -25,7 +25,6 @@ import ( "k8s.io/apimachinery/pkg/util/validation/field" "sigs.k8s.io/cluster-api-provider-azure/feature" "sigs.k8s.io/cluster-api-provider-azure/util/maps" - webhookutils "sigs.k8s.io/cluster-api-provider-azure/util/webhook" capifeature "sigs.k8s.io/cluster-api/feature" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/webhook" @@ -38,7 +37,7 @@ func (r *AzureManagedCluster) SetupWebhookWithManager(mgr ctrl.Manager) error { Complete() } -// +kubebuilder:webhook:verbs=update,path=/validate-infrastructure-cluster-x-k8s-io-v1beta1-azuremanagedcluster,mutating=false,failurePolicy=fail,groups=infrastructure.cluster.x-k8s.io,resources=azuremanagedclusters,versions=v1beta1,name=validation.azuremanagedclusters.infrastructure.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1;v1beta1 +// +kubebuilder:webhook:verbs=create;update,path=/validate-infrastructure-cluster-x-k8s-io-v1beta1-azuremanagedcluster,mutating=false,failurePolicy=fail,groups=infrastructure.cluster.x-k8s.io,resources=azuremanagedclusters,versions=v1beta1,name=validation.azuremanagedclusters.infrastructure.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1;v1beta1 var _ webhook.Validator = &AzureManagedCluster{} @@ -52,18 +51,6 @@ func (r *AzureManagedCluster) ValidateCreate() error { "can be set only if the Cluster API 'MachinePool' feature flag is enabled", ) } - if r.Spec.ControlPlaneEndpoint.Host != "" { - return field.Forbidden( - field.NewPath("Spec", "ControlPlaneEndpoint", "Host"), - controlPlaneEndpointErrorMessage, - ) - } - if r.Spec.ControlPlaneEndpoint.Port != 0 { - return field.Forbidden( - field.NewPath("Spec", "ControlPlaneEndpoint", "Port"), - controlPlaneEndpointErrorMessage, - ) - } return nil } @@ -83,24 +70,6 @@ func (r *AzureManagedCluster) ValidateUpdate(oldRaw runtime.Object) error { fmt.Sprintf("annotations with '%s' prefix are immutable", CustomHeaderPrefix))) } - if old.Spec.ControlPlaneEndpoint.Host != "" { - if err := webhookutils.ValidateImmutable( - field.NewPath("Spec", "ControlPlaneEndpoint", "Host"), - old.Spec.ControlPlaneEndpoint.Host, - r.Spec.ControlPlaneEndpoint.Host); err != nil { - allErrs = append(allErrs, err) - } - } - - if old.Spec.ControlPlaneEndpoint.Port != 0 { - if err := webhookutils.ValidateImmutable( - field.NewPath("Spec", "ControlPlaneEndpoint", "Port"), - old.Spec.ControlPlaneEndpoint.Port, - r.Spec.ControlPlaneEndpoint.Port); err != nil { - allErrs = append(allErrs, err) - } - } - if len(allErrs) != 0 { return apierrors.NewInvalid(GroupVersion.WithKind("AzureManagedCluster").GroupKind(), r.Name, allErrs) } diff --git a/api/v1beta1/azuremanagedcluster_webhook_test.go b/api/v1beta1/azuremanagedcluster_webhook_test.go index 7131b3c83a5..1298bf8f18a 100644 --- a/api/v1beta1/azuremanagedcluster_webhook_test.go +++ b/api/v1beta1/azuremanagedcluster_webhook_test.go @@ -122,13 +122,12 @@ func TestAzureManagedCluster_ValidateUpdate(t *testing.T) { wantErr: false, }, { - name: "ControlPlaneEndpoint.Port is immutable", + name: "ControlPlaneEndpoint.Port update (AKS API-derived update scenario)", oldAMC: &AzureManagedCluster{ ObjectMeta: metav1.ObjectMeta{}, Spec: AzureManagedClusterSpec{ ControlPlaneEndpoint: clusterv1.APIEndpoint{ Host: "aks-8622-h4h26c44.hcp.eastus.azmk8s.io", - Port: 443, }, }, }, @@ -137,42 +136,22 @@ func TestAzureManagedCluster_ValidateUpdate(t *testing.T) { Spec: AzureManagedClusterSpec{ ControlPlaneEndpoint: clusterv1.APIEndpoint{ Host: "aks-8622-h4h26c44.hcp.eastus.azmk8s.io", - Port: 444, + Port: 443, }, }, }, - wantErr: true, + wantErr: false, }, { - name: "ControlPlaneEndpoint.Host is immutable", + name: "ControlPlaneEndpoint.Host update (AKS API-derived update scenario)", oldAMC: &AzureManagedCluster{ ObjectMeta: metav1.ObjectMeta{}, Spec: AzureManagedClusterSpec{ ControlPlaneEndpoint: clusterv1.APIEndpoint{ - Host: "aks-8622-h4h26c44.hcp.eastus.azmk8s.io", Port: 443, }, }, }, - amc: &AzureManagedCluster{ - ObjectMeta: metav1.ObjectMeta{}, - Spec: AzureManagedClusterSpec{ - ControlPlaneEndpoint: clusterv1.APIEndpoint{ - Host: "this-is-not-allowed", - Port: 443, - }, - }, - }, - wantErr: true, - }, - { - name: "ControlPlaneEndpoint update from zero values are allowed", - oldAMC: &AzureManagedCluster{ - ObjectMeta: metav1.ObjectMeta{}, - Spec: AzureManagedClusterSpec{ - ControlPlaneEndpoint: clusterv1.APIEndpoint{}, - }, - }, amc: &AzureManagedCluster{ ObjectMeta: metav1.ObjectMeta{}, Spec: AzureManagedClusterSpec{ @@ -211,7 +190,7 @@ func TestAzureManagedCluster_ValidateCreate(t *testing.T) { wantErr bool }{ { - name: "can't set Spec.ControlPlaneEndpoint.Host during create", + name: "can set Spec.ControlPlaneEndpoint.Host during create (clusterctl move scenario)", amc: &AzureManagedCluster{ Spec: AzureManagedClusterSpec{ ControlPlaneEndpoint: clusterv1.APIEndpoint{ @@ -219,10 +198,10 @@ func TestAzureManagedCluster_ValidateCreate(t *testing.T) { }, }, }, - wantErr: true, + wantErr: false, }, { - name: "can't set Spec.ControlPlaneEndpoint.Port during create", + name: "can set Spec.ControlPlaneEndpoint.Port during create (clusterctl move scenario)", amc: &AzureManagedCluster{ Spec: AzureManagedClusterSpec{ ControlPlaneEndpoint: clusterv1.APIEndpoint{ @@ -230,7 +209,7 @@ func TestAzureManagedCluster_ValidateCreate(t *testing.T) { }, }, }, - wantErr: true, + wantErr: false, }, } for _, tc := range tests { diff --git a/api/v1beta1/azuremanagedcontrolplane_default_test.go b/api/v1beta1/azuremanagedcontrolplane_default_test.go index b0cff2d7fe6..df91b4ffe59 100644 --- a/api/v1beta1/azuremanagedcontrolplane_default_test.go +++ b/api/v1beta1/azuremanagedcontrolplane_default_test.go @@ -20,6 +20,7 @@ import ( "testing" . "github.com/onsi/gomega" + "k8s.io/utils/pointer" ) func TestAzureManagedControlPlane_SetDefaultSSHPublicKey(t *testing.T) { @@ -53,3 +54,79 @@ func hardcodedAzureManagedControlPlaneWithSSHKey(sshPublicKey string) *AzureMana }, } } + +func TestSetDefaultAutoScalerProfile(t *testing.T) { + g := NewWithT(t) + + type test struct { + amcp *AzureManagedControlPlane + } + + defaultAMP := &AzureManagedControlPlane{ + Spec: AzureManagedControlPlaneSpec{ + AutoScalerProfile: &AutoScalerProfile{ + BalanceSimilarNodeGroups: (*BalanceSimilarNodeGroups)(pointer.String(string(BalanceSimilarNodeGroupsFalse))), + Expander: (*Expander)(pointer.String(string(ExpanderRandom))), + MaxEmptyBulkDelete: pointer.String("10"), + MaxGracefulTerminationSec: pointer.String("600"), + MaxNodeProvisionTime: pointer.String("15m"), + MaxTotalUnreadyPercentage: pointer.String("45"), + NewPodScaleUpDelay: pointer.String("0s"), + OkTotalUnreadyCount: pointer.String("3"), + ScanInterval: pointer.String("10s"), + ScaleDownDelayAfterAdd: pointer.String("10m"), + ScaleDownDelayAfterDelete: pointer.String("10s"), + ScaleDownDelayAfterFailure: pointer.String("3m"), + ScaleDownUnneededTime: pointer.String("10m"), + ScaleDownUnreadyTime: pointer.String("20m"), + ScaleDownUtilizationThreshold: pointer.String("0.5"), + SkipNodesWithLocalStorage: (*SkipNodesWithLocalStorage)(pointer.String(string(SkipNodesWithLocalStorageFalse))), + SkipNodesWithSystemPods: (*SkipNodesWithSystemPods)(pointer.String(string(SkipNodesWithSystemPodsTrue))), + }, + }, + } + + allFieldsAreNilTest := test{amcp: &AzureManagedControlPlane{ + Spec: AzureManagedControlPlaneSpec{ + AutoScalerProfile: &AutoScalerProfile{}, + }, + }} + + allFieldsAreNilTest.amcp.setDefaultAutoScalerProfile() + + g.Expect(allFieldsAreNilTest.amcp.Spec.AutoScalerProfile).To(Equal(defaultAMP.Spec.AutoScalerProfile)) + + expectedNotNil := &AzureManagedControlPlane{ + Spec: AzureManagedControlPlaneSpec{ + AutoScalerProfile: &AutoScalerProfile{ + BalanceSimilarNodeGroups: (*BalanceSimilarNodeGroups)(pointer.String(string(BalanceSimilarNodeGroupsTrue))), + Expander: (*Expander)(pointer.String(string(ExpanderLeastWaste))), + MaxEmptyBulkDelete: pointer.String("5"), + MaxGracefulTerminationSec: pointer.String("300"), + MaxNodeProvisionTime: pointer.String("10m"), + MaxTotalUnreadyPercentage: pointer.String("30"), + NewPodScaleUpDelay: pointer.String("30s"), + OkTotalUnreadyCount: pointer.String("5"), + ScanInterval: pointer.String("20s"), + ScaleDownDelayAfterAdd: pointer.String("5m"), + ScaleDownDelayAfterDelete: pointer.String("1m"), + ScaleDownDelayAfterFailure: pointer.String("2m"), + ScaleDownUnneededTime: pointer.String("5m"), + ScaleDownUnreadyTime: pointer.String("10m"), + ScaleDownUtilizationThreshold: pointer.String("0.4"), + SkipNodesWithLocalStorage: (*SkipNodesWithLocalStorage)(pointer.String(string(SkipNodesWithLocalStorageTrue))), + SkipNodesWithSystemPods: (*SkipNodesWithSystemPods)(pointer.String(string(SkipNodesWithSystemPodsFalse))), + }, + }, + } + + allFieldsAreNotNilTest := test{amcp: &AzureManagedControlPlane{ + Spec: AzureManagedControlPlaneSpec{ + AutoScalerProfile: expectedNotNil.Spec.AutoScalerProfile, + }, + }} + + allFieldsAreNotNilTest.amcp.setDefaultAutoScalerProfile() + + g.Expect(allFieldsAreNotNilTest.amcp.Spec.AutoScalerProfile).To(Equal(expectedNotNil.Spec.AutoScalerProfile)) +} diff --git a/api/v1beta1/azuremanagedcontrolplane_types.go b/api/v1beta1/azuremanagedcontrolplane_types.go index 9fc61c7d9bb..a144886c2af 100644 --- a/api/v1beta1/azuremanagedcontrolplane_types.go +++ b/api/v1beta1/azuremanagedcontrolplane_types.go @@ -55,26 +55,32 @@ type AzureManagedControlPlaneSpec struct { Version string `json:"version"` // ResourceGroupName is the name of the Azure resource group for this AKS Cluster. + // Immutable. ResourceGroupName string `json:"resourceGroupName"` // NodeResourceGroupName is the name of the resource group // containing cluster IaaS resources. Will be populated to default // in webhook. + // Immutable. // +optional NodeResourceGroupName string `json:"nodeResourceGroupName,omitempty"` // VirtualNetwork describes the vnet for the AKS cluster. Will be created if it does not exist. + // Immutable except for `subnet`. // +optional VirtualNetwork ManagedControlPlaneVirtualNetwork `json:"virtualNetwork,omitempty"` // SubscriptionID is the GUID of the Azure subscription to hold this cluster. + // Immutable. // +optional SubscriptionID string `json:"subscriptionID,omitempty"` // Location is a string matching one of the canonical Azure region names. Examples: "westus2", "eastus". + // Immutable. Location string `json:"location"` // ControlPlaneEndpoint represents the endpoint used to communicate with the control plane. + // Immutable, populated by the AKS API at create. // +optional ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint,omitempty"` @@ -84,29 +90,37 @@ type AzureManagedControlPlaneSpec struct { AdditionalTags Tags `json:"additionalTags,omitempty"` // NetworkPlugin used for building Kubernetes network. + // Allowed values are "azure", "kubenet". + // Immutable. // +kubebuilder:validation:Enum=azure;kubenet // +optional NetworkPlugin *string `json:"networkPlugin,omitempty"` // NetworkPolicy used for building Kubernetes network. + // Allowed values are "azure", "calico". + // Immutable. // +kubebuilder:validation:Enum=azure;calico // +optional NetworkPolicy *string `json:"networkPolicy,omitempty"` // Outbound configuration used by Nodes. + // Immutable. // +kubebuilder:validation:Enum=loadBalancer;managedNATGateway;userAssignedNATGateway;userDefinedRouting // +optional OutboundType *ManagedControlPlaneOutboundType `json:"outboundType,omitempty"` // SSHPublicKey is a string literal containing an ssh public key base64 encoded. + // Immutable. SSHPublicKey string `json:"sshPublicKey"` // DNSServiceIP is an IP address assigned to the Kubernetes DNS service. // It must be within the Kubernetes service address range specified in serviceCidr. + // Immutable. // +optional DNSServiceIP *string `json:"dnsServiceIP,omitempty"` // LoadBalancerSKU is the SKU of the loadBalancer to be provisioned. + // Immutable. // +kubebuilder:validation:Enum=Basic;Standard // +optional LoadBalancerSKU *string `json:"loadBalancerSKU,omitempty"` @@ -132,15 +146,27 @@ type AzureManagedControlPlaneSpec struct { LoadBalancerProfile *LoadBalancerProfile `json:"loadBalancerProfile,omitempty"` // APIServerAccessProfile is the access profile for AKS API server. + // Immutable except for `authorizedIPRanges`. // +optional APIServerAccessProfile *APIServerAccessProfile `json:"apiServerAccessProfile,omitempty"` // AutoscalerProfile is the parameters to be applied to the cluster-autoscaler when enabled // +optional AutoScalerProfile *AutoScalerProfile `json:"autoscalerProfile,omitempty"` + + // AzureEnvironment is the name of the AzureCloud to be used. + // The default value that would be used by most users is "AzurePublicCloud", other values are: + // - ChinaCloud: "AzureChinaCloud" + // - PublicCloud: "AzurePublicCloud" + // - USGovernmentCloud: "AzureUSGovernmentCloud" + // +optional + AzureEnvironment string `json:"azureEnvironment,omitempty"` } // AADProfile - AAD integration managed by AKS. +// See also [AKS doc]. +// +// [AKS doc]: https://learn.microsoft.com/azure/aks/managed-aad type AADProfile struct { // Managed - Whether to enable managed AAD. // +kubebuilder:validation:Required @@ -182,12 +208,11 @@ type AKSSku struct { } // LoadBalancerProfile - Profile of the cluster load balancer. +// At most one of `managedOutboundIPs`, `outboundIPPrefixes`, or `outboundIPs` may be specified. +// See also [AKS doc]. +// +// [AKS doc]: https://learn.microsoft.com/azure/aks/load-balancer-standard type LoadBalancerProfile struct { - // Load balancer profile must specify at most one of ManagedOutboundIPs, OutboundIPPrefixes and OutboundIPs. - // By default the AKS cluster automatically creates a public IP in the AKS-managed infrastructure resource group and assigns it to the load balancer outbound pool. - // Alternatively, you can assign your own custom public IP or public IP prefix at cluster creation time. - // See https://docs.microsoft.com/en-us/azure/aks/load-balancer-standard#provide-your-own-outbound-public-ips-or-prefixes - // ManagedOutboundIPs - Desired managed outbound IPs for the cluster load balancer. // +optional ManagedOutboundIPs *int32 `json:"managedOutboundIPs,omitempty"` @@ -209,7 +234,10 @@ type LoadBalancerProfile struct { IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` } -// APIServerAccessProfile - access profile for AKS API server. +// APIServerAccessProfile tunes the accessibility of the cluster's control plane. +// See also [AKS doc]. +// +// [AKS doc]: https://learn.microsoft.com/azure/aks/api-server-authorized-ip-ranges type APIServerAccessProfile struct { // AuthorizedIPRanges - Authorized IP Ranges to kubernetes API server. // +optional @@ -230,6 +258,7 @@ type APIServerAccessProfile struct { type ManagedControlPlaneVirtualNetwork struct { Name string `json:"name"` CIDRBlock string `json:"cidrBlock"` + // Immutable except for `serviceEndpoints`. // +optional Subnet ManagedControlPlaneSubnet `json:"subnet,omitempty"` // ResourceGroup is the name of the Azure resource group for the VNet and Subnet. @@ -274,7 +303,10 @@ type AzureManagedControlPlaneStatus struct { } // AutoScalerProfile parameters to be applied to the cluster-autoscaler. -// See the [FAQ](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-the-parameters-to-ca) for more details about each parameter. +// See also [AKS doc], [K8s doc]. +// +// [AKS doc]: https://learn.microsoft.com/azure/aks/cluster-autoscaler#use-the-cluster-autoscaler-profile +// [K8s doc]: https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-the-parameters-to-ca type AutoScalerProfile struct { // BalanceSimilarNodeGroups - Valid values are 'true' and 'false'. The default is false. // +kubebuilder:validation:Enum="true";"false" diff --git a/api/v1beta1/azuremanagedcontrolplane_webhook.go b/api/v1beta1/azuremanagedcontrolplane_webhook.go index cd364a55917..710b332e668 100644 --- a/api/v1beta1/azuremanagedcontrolplane_webhook.go +++ b/api/v1beta1/azuremanagedcontrolplane_webhook.go @@ -41,12 +41,11 @@ import ( ) var ( - kubeSemver = regexp.MustCompile(`^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)([-0-9a-zA-Z_\.+]*)?$`) - controlPlaneEndpointErrorMessage = "can not be set by the user, will be set automatically by AKS after the cluster is Ready" - rMaxNodeProvisionTime = regexp.MustCompile(`^(\d+)m$`) - rScaleDownTime = regexp.MustCompile(`^(\d+)m$`) - rScaleDownDelayAfterDelete = regexp.MustCompile(`^(\d+)s$`) - rScanInterval = regexp.MustCompile(`^(\d+)s$`) + kubeSemver = regexp.MustCompile(`^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)([-0-9a-zA-Z_\.+]*)?$`) + rMaxNodeProvisionTime = regexp.MustCompile(`^(\d+)m$`) + rScaleDownTime = regexp.MustCompile(`^(\d+)m$`) + rScaleDownDelayAfterDelete = regexp.MustCompile(`^(\d+)s$`) + rScanInterval = regexp.MustCompile(`^(\d+)s$`) ) // SetupAzureManagedControlPlaneWebhookWithManager sets up and registers the webhook with the manager. @@ -116,19 +115,6 @@ func (mw *azureManagedControlPlaneWebhook) ValidateCreate(ctx context.Context, o ) } - if m.Spec.ControlPlaneEndpoint.Host != "" { - return field.Forbidden( - field.NewPath("Spec", "ControlPlaneEndpoint", "Host"), - controlPlaneEndpointErrorMessage, - ) - } - if m.Spec.ControlPlaneEndpoint.Port != 0 { - return field.Forbidden( - field.NewPath("Spec", "ControlPlaneEndpoint", "Port"), - controlPlaneEndpointErrorMessage, - ) - } - return m.Validate(mw.Client) } @@ -207,6 +193,13 @@ func (mw *azureManagedControlPlaneWebhook) ValidateUpdate(ctx context.Context, o allErrs = append(allErrs, err) } + if err := webhookutils.ValidateImmutable( + field.NewPath("Spec", "AzureEnvironment"), + old.Spec.AzureEnvironment, + m.Spec.AzureEnvironment); err != nil { + allErrs = append(allErrs, err) + } + if old.Spec.AADProfile != nil { if m.Spec.AADProfile == nil { allErrs = append(allErrs, @@ -232,24 +225,6 @@ func (mw *azureManagedControlPlaneWebhook) ValidateUpdate(ctx context.Context, o } } - if old.Spec.ControlPlaneEndpoint.Host != "" { - if err := webhookutils.ValidateImmutable( - field.NewPath("Spec", "ControlPlaneEndpoint", "Host"), - old.Spec.ControlPlaneEndpoint.Host, - m.Spec.ControlPlaneEndpoint.Host); err != nil { - allErrs = append(allErrs, err) - } - } - - if old.Spec.ControlPlaneEndpoint.Port != 0 { - if err := webhookutils.ValidateImmutable( - field.NewPath("Spec", "ControlPlaneEndpoint", "Port"), - old.Spec.ControlPlaneEndpoint.Port, - m.Spec.ControlPlaneEndpoint.Port); err != nil { - allErrs = append(allErrs, err) - } - } - // Consider removing this once moves out of preview // Updating outboundType after cluster creation (PREVIEW) // https://learn.microsoft.com/en-us/azure/aks/egress-outboundtype#updating-outboundtype-after-cluster-creation-preview @@ -405,7 +380,7 @@ func (m *AzureManagedControlPlane) validateManagedClusterNetwork(cli client.Clie ctx := context.Background() // Fetch the Cluster. - clusterName, ok := m.Labels[clusterv1.ClusterLabelName] + clusterName, ok := m.Labels[clusterv1.ClusterNameLabel] if !ok { return nil } diff --git a/api/v1beta1/azuremanagedcontrolplane_webhook_test.go b/api/v1beta1/azuremanagedcontrolplane_webhook_test.go index 45cf3581c15..4e46d28e377 100644 --- a/api/v1beta1/azuremanagedcontrolplane_webhook_test.go +++ b/api/v1beta1/azuremanagedcontrolplane_webhook_test.go @@ -635,7 +635,7 @@ func TestAzureManagedControlPlane_ValidateCreate(t *testing.T) { errorLen: 1, }, { - name: "can't set Spec.ControlPlaneEndpoint.Host during create", + name: "set Spec.ControlPlaneEndpoint.Host during create (clusterctl move scenario)", amcp: &AzureManagedControlPlane{ Spec: AzureManagedControlPlaneSpec{ ControlPlaneEndpoint: clusterv1.APIEndpoint{ @@ -652,10 +652,10 @@ func TestAzureManagedControlPlane_ValidateCreate(t *testing.T) { }, }, }, - wantErr: true, + wantErr: false, }, { - name: "can't set Spec.ControlPlaneEndpoint.Port during create", + name: "can set Spec.ControlPlaneEndpoint.Port during create (clusterctl move scenario)", amcp: &AzureManagedControlPlane{ Spec: AzureManagedControlPlaneSpec{ ControlPlaneEndpoint: clusterv1.APIEndpoint{ @@ -672,7 +672,7 @@ func TestAzureManagedControlPlane_ValidateCreate(t *testing.T) { }, }, }, - wantErr: true, + wantErr: false, }, } for _, tc := range tests { @@ -1231,81 +1231,6 @@ func TestAzureManagedControlPlane_ValidateUpdate(t *testing.T) { }, wantErr: false, }, - { - name: "AzureManagedControlPlane ControlPlaneEndpoint.Port is immutable", - oldAMCP: &AzureManagedControlPlane{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test-cluster", - }, - Spec: AzureManagedControlPlaneSpec{ - ControlPlaneEndpoint: clusterv1.APIEndpoint{ - Host: "aks-8622-h4h26c44.hcp.eastus.azmk8s.io", - Port: 443, - }, - }, - }, - amcp: &AzureManagedControlPlane{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test-cluster", - }, - Spec: AzureManagedControlPlaneSpec{ - ControlPlaneEndpoint: clusterv1.APIEndpoint{ - Host: "aks-8622-h4h26c44.hcp.eastus.azmk8s.io", - Port: 444, - }, - }, - }, - wantErr: true, - }, - { - name: "AzureManagedControlPlane ControlPlaneEndpoint.Host is immutable", - oldAMCP: &AzureManagedControlPlane{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test-cluster", - }, - Spec: AzureManagedControlPlaneSpec{ - ControlPlaneEndpoint: clusterv1.APIEndpoint{ - Host: "aks-8622-h4h26c44.hcp.eastus.azmk8s.io", - Port: 443, - }, - }, - }, - amcp: &AzureManagedControlPlane{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test-cluster", - }, - Spec: AzureManagedControlPlaneSpec{ - ControlPlaneEndpoint: clusterv1.APIEndpoint{ - Host: "this-is-not-allowed", - Port: 443, - }, - }, - }, - wantErr: true, - }, - { - name: "ControlPlaneEndpoint update from zero values are allowed", - oldAMCP: &AzureManagedControlPlane{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test-cluster", - }, - Spec: AzureManagedControlPlaneSpec{ - ControlPlaneEndpoint: clusterv1.APIEndpoint{}, - }, - }, - amcp: &AzureManagedControlPlane{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test-cluster", - }, - Spec: AzureManagedControlPlaneSpec{ - ControlPlaneEndpoint: clusterv1.APIEndpoint{ - Host: "aks-8622-h4h26c44.hcp.eastus.azmk8s.io", - Port: 443, - }, - }, - }, - wantErr: true, - }, { name: "OutboundType update", oldAMCP: &AzureManagedControlPlane{ diff --git a/api/v1beta1/azuremanagedmachinepool_types.go b/api/v1beta1/azuremanagedmachinepool_types.go index 36e5258f191..48e9499ebc7 100644 --- a/api/v1beta1/azuremanagedmachinepool_types.go +++ b/api/v1beta1/azuremanagedmachinepool_types.go @@ -93,7 +93,11 @@ const ( TransparentHugePageOptionDeferMadvise TransparentHugePageOption = "defer+madvise" ) -// KubeletConfig defines the set of kubelet configurations for nodes in pools. +// KubeletConfig defines the supported subset of kubelet configurations for nodes in pools. +// See also [AKS doc], [K8s doc]. +// +// [AKS doc]: https://learn.microsoft.com/azure/aks/custom-node-configuration +// [K8s doc]: https://kubernetes.io/docs/reference/config-api/kubelet-config.v1beta1/ type KubeletConfig struct { // CPUManagerPolicy - CPU Manager policy to use. // +kubebuilder:validation:Enum=none;static @@ -103,14 +107,17 @@ type KubeletConfig struct { // +optional CPUCfsQuota *bool `json:"cpuCfsQuota,omitempty"` // CPUCfsQuotaPeriod - Sets CPU CFS quota period value. + // Must end in "ms", e.g. "100ms" // +optional CPUCfsQuotaPeriod *string `json:"cpuCfsQuotaPeriod,omitempty"` // ImageGcHighThreshold - The percent of disk usage after which image garbage collection is always run. + // Valid values are 0-100 (inclusive). // +kubebuilder:validation:Minimum=0 // +kubebuilder:validation:Maximum=100 // +optional ImageGcHighThreshold *int32 `json:"imageGcHighThreshold,omitempty"` // ImageGcLowThreshold - The percent of disk usage before which image garbage collection is never run. + // Valid values are 0-100 (inclusive) and must be less than `imageGcHighThreshold`. // +kubebuilder:validation:Minimum=0 // +kubebuilder:validation:Maximum=100 // +optional @@ -120,12 +127,13 @@ type KubeletConfig struct { // +optional TopologyManagerPolicy *TopologyManagerPolicy `json:"topologyManagerPolicy,omitempty"` // AllowedUnsafeSysctls - Allowlist of unsafe sysctls or unsafe sysctl patterns (ending in `*`). + // Valid values match `kernel.shm*`, `kernel.msg*`, `kernel.sem`, `fs.mqueue.*`, or `net.*`. // +optional AllowedUnsafeSysctls []string `json:"allowedUnsafeSysctls,omitempty"` // FailSwapOn - If set to true it will make the Kubelet fail to start if swap is enabled on the node. // +optional FailSwapOn *bool `json:"failSwapOn,omitempty"` - // ContainerLogMaxSizeMB - The maximum size (e.g. 10Mi) of container log file before it is rotated. + // ContainerLogMaxSizeMB - The maximum size in MB of a container log file before it is rotated. // +optional ContainerLogMaxSizeMB *int32 `json:"containerLogMaxSizeMB,omitempty"` // ContainerLogMaxFiles - The maximum number of container log files that can be present for a container. The number must be ≥ 2. @@ -133,6 +141,7 @@ type KubeletConfig struct { // +optional ContainerLogMaxFiles *int32 `json:"containerLogMaxFiles,omitempty"` // PodMaxPids - The maximum number of processes per pod. + // Must not exceed kernel PID limit. -1 disables the limit. // +kubebuilder:validation:Minimum=-1 // +optional PodMaxPids *int32 `json:"podMaxPids,omitempty"` @@ -141,6 +150,7 @@ type KubeletConfig struct { // SysctlConfig specifies the settings for Linux agent nodes. type SysctlConfig struct { // FsAioMaxNr specifies the maximum number of system-wide asynchronous io requests. + // Valid values are 65536-6553500 (inclusive). // Maps to fs.aio-max-nr. // +kubebuilder:validation:Minimum=65536 // +kubebuilder:validation:Maximum=6553500 @@ -148,6 +158,7 @@ type SysctlConfig struct { FsAioMaxNr *int32 `json:"fsAioMaxNr,omitempty"` // FsFileMax specifies the max number of file-handles that the Linux kernel will allocate, by increasing increases the maximum number of open files permitted. + // Valid values are 8192-12000500 (inclusive). // Maps to fs.file-max. // +kubebuilder:validation:Minimum=8192 // +kubebuilder:validation:Maximum=12000500 @@ -155,6 +166,7 @@ type SysctlConfig struct { FsFileMax *int32 `json:"fsFileMax,omitempty"` // FsInotifyMaxUserWatches specifies the number of file watches allowed by the system. Each watch is roughly 90 bytes on a 32-bit kernel, and roughly 160 bytes on a 64-bit kernel. + // Valid values are 781250-2097152 (inclusive). // Maps to fs.inotify.max_user_watches. // +kubebuilder:validation:Minimum=781250 // +kubebuilder:validation:Maximum=2097152 @@ -162,6 +174,7 @@ type SysctlConfig struct { FsInotifyMaxUserWatches *int32 `json:"fsInotifyMaxUserWatches,omitempty"` // FsNrOpen specifies the maximum number of file-handles a process can allocate. + // Valid values are 8192-20000500 (inclusive). // Maps to fs.nr_open. // +kubebuilder:validation:Minimum=8192 // +kubebuilder:validation:Maximum=20000500 @@ -169,6 +182,7 @@ type SysctlConfig struct { FsNrOpen *int32 `json:"fsNrOpen,omitempty"` // KernelThreadsMax specifies the maximum number of all threads that can be created. + // Valid values are 20-513785 (inclusive). // Maps to kernel.threads-max. // +kubebuilder:validation:Minimum=20 // +kubebuilder:validation:Maximum=513785 @@ -176,6 +190,7 @@ type SysctlConfig struct { KernelThreadsMax *int32 `json:"kernelThreadsMax,omitempty"` // NetCoreNetdevMaxBacklog specifies maximum number of packets, queued on the INPUT side, when the interface receives packets faster than kernel can process them. + // Valid values are 1000-3240000 (inclusive). // Maps to net.core.netdev_max_backlog. // +kubebuilder:validation:Minimum=1000 // +kubebuilder:validation:Maximum=3240000 @@ -184,6 +199,7 @@ type SysctlConfig struct { // NetCoreOptmemMax specifies the maximum ancillary buffer size (option memory buffer) allowed per socket. // Socket option memory is used in a few cases to store extra structures relating to usage of the socket. + // Valid values are 20480-4194304 (inclusive). // Maps to net.core.optmem_max. // +kubebuilder:validation:Minimum=20480 // +kubebuilder:validation:Maximum=4194304 @@ -191,6 +207,7 @@ type SysctlConfig struct { NetCoreOptmemMax *int32 `json:"netCoreOptmemMax,omitempty"` // NetCoreRmemDefault specifies the default receive socket buffer size in bytes. + // Valid values are 212992-134217728 (inclusive). // Maps to net.core.rmem_default. // +kubebuilder:validation:Minimum=212992 // +kubebuilder:validation:Maximum=134217728 @@ -198,6 +215,7 @@ type SysctlConfig struct { NetCoreRmemDefault *int32 `json:"netCoreRmemDefault,omitempty"` // NetCoreRmemMax specifies the maximum receive socket buffer size in bytes. + // Valid values are 212992-134217728 (inclusive). // Maps to net.core.rmem_max. // +kubebuilder:validation:Minimum=212992 // +kubebuilder:validation:Maximum=134217728 @@ -207,6 +225,7 @@ type SysctlConfig struct { // NetCoreSomaxconn specifies maximum number of connection requests that can be queued for any given listening socket. // An upper limit for the value of the backlog parameter passed to the listen(2)(https://man7.org/linux/man-pages/man2/listen.2.html) function. // If the backlog argument is greater than the somaxconn, then it's silently truncated to this limit. + // Valid values are 4096-3240000 (inclusive). // Maps to net.core.somaxconn. // +kubebuilder:validation:Minimum=4096 // +kubebuilder:validation:Maximum=3240000 @@ -214,6 +233,7 @@ type SysctlConfig struct { NetCoreSomaxconn *int32 `json:"netCoreSomaxconn,omitempty"` // NetCoreWmemDefault specifies the default send socket buffer size in bytes. + // Valid values are 212992-134217728 (inclusive). // Maps to net.core.wmem_default. // +kubebuilder:validation:Minimum=212992 // +kubebuilder:validation:Maximum=134217728 @@ -221,6 +241,7 @@ type SysctlConfig struct { NetCoreWmemDefault *int32 `json:"netCoreWmemDefault,omitempty"` // NetCoreWmemMax specifies the maximum send socket buffer size in bytes. + // Valid values are 212992-134217728 (inclusive). // Maps to net.core.wmem_max. // +kubebuilder:validation:Minimum=212992 // +kubebuilder:validation:Maximum=134217728 @@ -237,6 +258,7 @@ type SysctlConfig struct { // NetIpv4NeighDefaultGcThresh1 specifies the minimum number of entries that may be in the ARP cache. // Garbage collection won't be triggered if the number of entries is below this setting. + // Valid values are 128-80000 (inclusive). // Maps to net.ipv4.neigh.default.gc_thresh1. // +kubebuilder:validation:Minimum=128 // +kubebuilder:validation:Maximum=80000 @@ -245,6 +267,7 @@ type SysctlConfig struct { // NetIpv4NeighDefaultGcThresh2 specifies soft maximum number of entries that may be in the ARP cache. // ARP garbage collection will be triggered about 5 seconds after reaching this soft maximum. + // Valid values are 512-90000 (inclusive). // Maps to net.ipv4.neigh.default.gc_thresh2. // +kubebuilder:validation:Minimum=512 // +kubebuilder:validation:Maximum=90000 @@ -252,6 +275,7 @@ type SysctlConfig struct { NetIpv4NeighDefaultGcThresh2 *int32 `json:"netIpv4NeighDefaultGcThresh2,omitempty"` // NetIpv4NeighDefaultGcThresh3 specified hard maximum number of entries in the ARP cache. + // Valid values are 1024-100000 (inclusive). // Maps to net.ipv4.neigh.default.gc_thresh3. // +kubebuilder:validation:Minimum=1024 // +kubebuilder:validation:Maximum=100000 @@ -259,6 +283,7 @@ type SysctlConfig struct { NetIpv4NeighDefaultGcThresh3 *int32 `json:"netIpv4NeighDefaultGcThresh3,omitempty"` // NetIpv4TCPFinTimeout specifies the length of time an orphaned connection will remain in the FIN_WAIT_2 state before it's aborted at the local end. + // Valid values are 5-120 (inclusive). // Maps to net.ipv4.tcp_fin_timeout. // +kubebuilder:validation:Minimum=5 // +kubebuilder:validation:Maximum=120 @@ -266,6 +291,7 @@ type SysctlConfig struct { NetIpv4TCPFinTimeout *int32 `json:"netIpv4TCPFinTimeout,omitempty"` // NetIpv4TCPKeepaliveProbes specifies the number of keepalive probes TCP sends out, until it decides the connection is broken. + // Valid values are 1-15 (inclusive). // Maps to net.ipv4.tcp_keepalive_probes. // +kubebuilder:validation:Minimum=1 // +kubebuilder:validation:Maximum=15 @@ -273,6 +299,7 @@ type SysctlConfig struct { NetIpv4TCPKeepaliveProbes *int32 `json:"netIpv4TCPKeepaliveProbes,omitempty"` // NetIpv4TCPKeepaliveTime specifies the rate at which TCP sends out a keepalive message when keepalive is enabled. + // Valid values are 30-432000 (inclusive). // Maps to net.ipv4.tcp_keepalive_time. // +kubebuilder:validation:Minimum=30 // +kubebuilder:validation:Maximum=432000 @@ -281,6 +308,7 @@ type SysctlConfig struct { // NetIpv4TCPMaxSynBacklog specifies the maximum number of queued connection requests that have still not received an acknowledgment from the connecting client. // If this number is exceeded, the kernel will begin dropping requests. + // Valid values are 128-3240000 (inclusive). // Maps to net.ipv4.tcp_max_syn_backlog. // +kubebuilder:validation:Minimum=128 // +kubebuilder:validation:Maximum=3240000 @@ -289,6 +317,7 @@ type SysctlConfig struct { // NetIpv4TCPMaxTwBuckets specifies maximal number of timewait sockets held by system simultaneously. // If this number is exceeded, time-wait socket is immediately destroyed and warning is printed. + // Valid values are 8000-1440000 (inclusive). // Maps to net.ipv4.tcp_max_tw_buckets. // +kubebuilder:validation:Minimum=8000 // +kubebuilder:validation:Maximum=1440000 @@ -302,6 +331,7 @@ type SysctlConfig struct { // NetIpv4TCPkeepaliveIntvl specifies the frequency of the probes sent out. // Multiplied by tcpKeepaliveprobes, it makes up the time to kill a connection that isn't responding, after probes started. + // Valid values are 1-75 (inclusive). // Maps to net.ipv4.tcp_keepalive_intvl. // +kubebuilder:validation:Minimum=1 // +kubebuilder:validation:Maximum=75 @@ -309,6 +339,7 @@ type SysctlConfig struct { NetIpv4TCPkeepaliveIntvl *int32 `json:"netIpv4TCPkeepaliveIntvl,omitempty"` // NetNetfilterNfConntrackBuckets specifies the size of hash table used by nf_conntrack module to record the established connection record of the TCP protocol. + // Valid values are 65536-147456 (inclusive). // Maps to net.netfilter.nf_conntrack_buckets. // +kubebuilder:validation:Minimum=65536 // +kubebuilder:validation:Maximum=147456 @@ -316,6 +347,7 @@ type SysctlConfig struct { NetNetfilterNfConntrackBuckets *int32 `json:"netNetfilterNfConntrackBuckets,omitempty"` // NetNetfilterNfConntrackMax specifies the maximum number of connections supported by the nf_conntrack module or the size of connection tracking table. + // Valid values are 131072-1048576 (inclusive). // Maps to net.netfilter.nf_conntrack_max. // +kubebuilder:validation:Minimum=131072 // +kubebuilder:validation:Maximum=1048576 @@ -324,6 +356,7 @@ type SysctlConfig struct { // VMMaxMapCount specifies the maximum number of memory map areas a process may have. // Maps to vm.max_map_count. + // Valid values are 65530-262144 (inclusive). // +kubebuilder:validation:Minimum=65530 // +kubebuilder:validation:Maximum=262144 // +optional @@ -331,6 +364,7 @@ type SysctlConfig struct { // VMSwappiness specifies aggressiveness of the kernel in swapping memory pages. // Higher values will increase aggressiveness, lower values decrease the amount of swap. + // Valid values are 0-100 (inclusive). // Maps to vm.swappiness. // +kubebuilder:validation:Minimum=0 // +kubebuilder:validation:Maximum=100 @@ -338,6 +372,7 @@ type SysctlConfig struct { VMSwappiness *int32 `json:"vmSwappiness,omitempty"` // VMVfsCachePressure specifies the percentage value that controls tendency of the kernel to reclaim the memory, which is used for caching of directory and inode objects. + // Valid values are 1-500 (inclusive). // Maps to vm.vfs_cache_pressure. // +kubebuilder:validation:Minimum=1 // +kubebuilder:validation:Maximum=500 @@ -346,9 +381,16 @@ type SysctlConfig struct { } // LinuxOSConfig specifies the custom Linux OS settings and configurations. +// See also [AKS doc]. +// +// [AKS doc]: https://learn.microsoft.com/azure/aks/custom-node-configuration#linux-os-custom-configuration type LinuxOSConfig struct { // SwapFileSizeMB specifies size in MB of a swap file will be created on the agent nodes from this node pool. - // Max value of SwapFileSizeMB should be the size of temporary disk(/dev/sdb). Refer: https://learn.microsoft.com/en-us/azure/virtual-machines/managed-disks-overview#temporary-disk + // Max value of SwapFileSizeMB should be the size of temporary disk(/dev/sdb). + // Must be at least 1. + // See also [AKS doc]. + // + // [AKS doc]: https://learn.microsoft.com/azure/virtual-machines/managed-disks-overview#temporary-disk // +kubebuilder:validation:Minimum=1 // +optional SwapFileSizeMB *int32 `json:"swapFileSizeMB,omitempty"` @@ -358,12 +400,17 @@ type LinuxOSConfig struct { Sysctls *SysctlConfig `json:"sysctls,omitempty"` // TransparentHugePageDefrag specifies whether the kernel should make aggressive use of memory compaction to make more hugepages available. - // Refer to https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge for more details. + // See also [Linux doc]. + // + // [Linux doc]: https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge for more details. // +kubebuilder:validation:Enum=always;defer;defer+madvise;madvise;never // +optional TransparentHugePageDefrag *TransparentHugePageOption `json:"transparentHugePageDefrag,omitempty"` - // TransparentHugePageEnabled specifies various modes of Transparent Hugepages. Refer to https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge for more details. + // TransparentHugePageEnabled specifies various modes of Transparent Hugepages. + // See also [Linux doc]. + // + // [Linux doc]: https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge for more details. // +kubebuilder:validation:Enum=always;madvise;never // +optional TransparentHugePageEnabled *TransparentHugePageOption `json:"transparentHugePageEnabled,omitempty"` @@ -378,6 +425,7 @@ type AzureManagedMachinePoolSpec struct { AdditionalTags Tags `json:"additionalTags,omitempty"` // Name - name of the agent pool. If not specified, CAPZ uses the name of the CR as the agent pool name. + // Immutable. // +optional Name *string `json:"name,omitempty"` @@ -386,22 +434,31 @@ type AzureManagedMachinePoolSpec struct { Mode string `json:"mode"` // SKU is the size of the VMs in the node pool. + // Immutable. SKU string `json:"sku"` // OSDiskSizeGB is the disk size for every machine in this agent pool. // If you specify 0, it will apply the default osDisk size according to the vmSize specified. + // Immutable. // +optional OSDiskSizeGB *int32 `json:"osDiskSizeGB,omitempty"` // AvailabilityZones - Availability zones for nodes. Must use VirtualMachineScaleSets AgentPoolType. + // Immutable. // +optional AvailabilityZones []string `json:"availabilityZones,omitempty"` - // Node labels - labels for all of the nodes present in node pool + // Node labels - labels for all of the nodes present in node pool. + // See also [AKS doc]. + // + // [AKS doc]: https://learn.microsoft.com/azure/aks/use-labels // +optional NodeLabels map[string]string `json:"nodeLabels,omitempty"` // Taints specifies the taints for nodes present in this agent pool. + // See also [AKS doc]. + // + // [AKS doc]: https://learn.microsoft.com/azure/aks/use-multiple-node-pools#setting-node-pool-taints // +optional Taints Taints `json:"taints,omitempty"` @@ -413,56 +470,86 @@ type AzureManagedMachinePoolSpec struct { // +optional Scaling *ManagedMachinePoolScaling `json:"scaling,omitempty"` - // MaxPods specifies the kubelet --max-pods configuration for the node pool. + // MaxPods specifies the kubelet `--max-pods` configuration for the node pool. + // Immutable. + // See also [AKS doc], [K8s doc]. + // + // [AKS doc]: https://learn.microsoft.com/azure/aks/configure-azure-cni#configure-maximum---new-clusters + // [K8s doc]: https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/ // +optional MaxPods *int32 `json:"maxPods,omitempty"` - // OsDiskType specifies the OS disk type for each node in the pool. Allowed values are 'Ephemeral' and 'Managed'. + // OsDiskType specifies the OS disk type for each node in the pool. Allowed values are 'Ephemeral' and 'Managed' (default). + // Immutable. + // See also [AKS doc]. + // + // [AKS doc]: https://learn.microsoft.com/azure/aks/cluster-configuration#ephemeral-os // +kubebuilder:validation:Enum=Ephemeral;Managed // +kubebuilder:default=Managed // +optional OsDiskType *string `json:"osDiskType,omitempty"` // EnableUltraSSD enables the storage type UltraSSD_LRS for the agent pool. + // Immutable. // +optional EnableUltraSSD *bool `json:"enableUltraSSD,omitempty"` - // OSType specifies the virtual machine operating system. Default to Linux. Possible values include: 'Linux', 'Windows' + // OSType specifies the virtual machine operating system. Default to Linux. Possible values include: 'Linux', 'Windows'. + // 'Windows' requires the AzureManagedControlPlane's `spec.networkPlugin` to be `azure`. + // Immutable. + // See also [AKS doc]. + // + // [AKS doc]: https://learn.microsoft.com/rest/api/aks/agent-pools/create-or-update?tabs=HTTP#ostype // +kubebuilder:validation:Enum=Linux;Windows // +optional OSType *string `json:"osType,omitempty"` // EnableNodePublicIP controls whether or not nodes in the pool each have a public IP address. + // Immutable. // +optional EnableNodePublicIP *bool `json:"enableNodePublicIP,omitempty"` // NodePublicIPPrefixID specifies the public IP prefix resource ID which VM nodes should use IPs from. + // Immutable. // +optional NodePublicIPPrefixID *string `json:"nodePublicIPPrefixID,omitempty"` // ScaleSetPriority specifies the ScaleSetPriority value. Default to Regular. Possible values include: 'Regular', 'Spot' + // Immutable. // +kubebuilder:validation:Enum=Regular;Spot // +optional ScaleSetPriority *string `json:"scaleSetPriority,omitempty"` // KubeletConfig specifies the kubelet configurations for nodes. + // Immutable. // +optional KubeletConfig *KubeletConfig `json:"kubeletConfig,omitempty"` // KubeletDiskType specifies the kubelet disk type. Default to OS. Possible values include: 'OS', 'Temporary'. - // Requires kubeletDisk preview feature to be set. + // Requires Microsoft.ContainerService/KubeletDisk preview feature to be set. + // Immutable. + // See also [AKS doc]. + // + // [AKS doc]: https://learn.microsoft.com/rest/api/aks/agent-pools/create-or-update?tabs=HTTP#kubeletdisktype // +kubebuilder:validation:Enum=OS;Temporary // +optional KubeletDiskType *KubeletDiskType `json:"kubeletDiskType,omitempty"` // LinuxOSConfig specifies the custom Linux OS settings and configurations. + // Immutable. // +optional LinuxOSConfig *LinuxOSConfig `json:"linuxOSConfig,omitempty"` + // SubnetName specifies the Subnet where the MachinePool will be placed + // Immutable. + // +optional + SubnetName *string `json:"subnetName,omitempty"` } // ManagedMachinePoolScaling specifies scaling options. type ManagedMachinePoolScaling struct { + // MinSize is the minimum number of nodes for auto-scaling. MinSize *int32 `json:"minSize,omitempty"` + // MaxSize is the maximum number of nodes for auto-scaling. MaxSize *int32 `json:"maxSize,omitempty"` } diff --git a/api/v1beta1/azuremanagedmachinepool_webhook.go b/api/v1beta1/azuremanagedmachinepool_webhook.go index 65438dca9fd..a62158e1ba5 100644 --- a/api/v1beta1/azuremanagedmachinepool_webhook.go +++ b/api/v1beta1/azuremanagedmachinepool_webhook.go @@ -81,7 +81,7 @@ func (mw *azureManagedMachinePoolWebhook) Default(ctx context.Context, obj runti return nil } -//+kubebuilder:webhook:verbs=update;delete,path=/validate-infrastructure-cluster-x-k8s-io-v1beta1-azuremanagedmachinepool,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=infrastructure.cluster.x-k8s.io,resources=azuremanagedmachinepools,versions=v1beta1,name=validation.azuremanagedmachinepools.infrastructure.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1;v1beta1 +//+kubebuilder:webhook:verbs=create;update;delete,path=/validate-infrastructure-cluster-x-k8s-io-v1beta1-azuremanagedmachinepool,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=infrastructure.cluster.x-k8s.io,resources=azuremanagedmachinepools,versions=v1beta1,name=validation.azuremanagedmachinepools.infrastructure.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1;v1beta1 // ValidateCreate implements webhook.Validator so a webhook will be registered for the type. func (mw *azureManagedMachinePoolWebhook) ValidateCreate(ctx context.Context, obj runtime.Object) error { @@ -106,6 +106,7 @@ func (mw *azureManagedMachinePoolWebhook) ValidateCreate(ctx context.Context, ob m.validateEnableNodePublicIP, m.validateKubeletConfig, m.validateLinuxOSConfig, + m.validateSubnetName, } var errs []error @@ -166,6 +167,13 @@ func (mw *azureManagedMachinePoolWebhook) ValidateUpdate(ctx context.Context, ol allErrs = append(allErrs, err) } + if err := webhookutils.ValidateImmutable( + field.NewPath("Spec", "SubnetName"), + old.Spec.SubnetName, + m.Spec.SubnetName); err != nil && old.Spec.SubnetName != nil { + allErrs = append(allErrs, err) + } + // custom headers are immutable oldCustomHeaders := maps.FilterByKeyPrefix(old.ObjectMeta.Annotations, CustomHeaderPrefix) newCustomHeaders := maps.FilterByKeyPrefix(m.ObjectMeta.Annotations, CustomHeaderPrefix) @@ -281,7 +289,7 @@ func (m *AzureManagedMachinePool) validateLastSystemNodePool(cli client.Client) ctx := context.Background() // Fetch the Cluster. - clusterName, ok := m.Labels[clusterv1.ClusterLabelName] + clusterName, ok := m.Labels[clusterv1.ClusterNameLabel] if !ok { return nil } @@ -306,7 +314,7 @@ func (m *AzureManagedMachinePool) validateLastSystemNodePool(cli client.Client) opt1 := client.InNamespace(m.Namespace) opt2 := client.MatchingLabels(map[string]string{ - clusterv1.ClusterLabelName: clusterName, + clusterv1.ClusterNameLabel: clusterName, LabelAgentPoolMode: string(NodePoolModeSystem), }) @@ -347,13 +355,12 @@ func (m *AzureManagedMachinePool) validateOSType() error { } func (m *AzureManagedMachinePool) validateName() error { - if m.Spec.OSType != nil && *m.Spec.OSType == WindowsOS { - if len(m.Name) > 6 { - return field.Invalid( - field.NewPath("Name"), - m.Name, - "Windows agent pool name can not be longer than 6 characters.") - } + if m.Spec.OSType != nil && *m.Spec.OSType == WindowsOS && + m.Spec.Name != nil && len(*m.Spec.Name) > 6 { + return field.Invalid( + field.NewPath("Spec", "Name"), + m.Spec.Name, + "Windows agent pool name can not be longer than 6 characters.") } return nil @@ -393,6 +400,18 @@ func (m *AzureManagedMachinePool) validateEnableNodePublicIP() error { return nil } +func (m *AzureManagedMachinePool) validateSubnetName() error { + if m.Spec.SubnetName != nil { + subnetRegex := "^[a-zA-Z0-9][a-zA-Z0-9-]{0,78}[a-zA-Z0-9]$" + regex := regexp.MustCompile(subnetRegex) + if success := regex.MatchString(pointer.StringDeref(m.Spec.SubnetName, "")); !success { + return field.Invalid(field.NewPath("Spec", "SubnetName"), m.Spec.SubnetName, + fmt.Sprintf("name of subnet doesn't match regex %s", subnetRegex)) + } + } + return nil +} + // validateKubeletConfig enforces the AKS API configuration for KubeletConfig. // See: https://learn.microsoft.com/en-us/azure/aks/custom-node-configuration. func (m *AzureManagedMachinePool) validateKubeletConfig() error { diff --git a/api/v1beta1/azuremanagedmachinepool_webhook_test.go b/api/v1beta1/azuremanagedmachinepool_webhook_test.go index 2e2d65c6b1a..3b89ccb552e 100644 --- a/api/v1beta1/azuremanagedmachinepool_webhook_test.go +++ b/api/v1beta1/azuremanagedmachinepool_webhook_test.go @@ -543,6 +543,48 @@ func TestAzureManagedMachinePoolUpdatingWebhook(t *testing.T) { }, wantErr: true, }, + { + name: "Can't update SubnetName with error", + new: &AzureManagedMachinePool{ + Spec: AzureManagedMachinePoolSpec{ + SubnetName: pointer.String("my-subnet"), + }, + }, + old: &AzureManagedMachinePool{ + Spec: AzureManagedMachinePoolSpec{ + SubnetName: pointer.String("my-subnet-1"), + }, + }, + wantErr: true, + }, + { + name: "Can update SubnetName if subnetName is empty", + new: &AzureManagedMachinePool{ + Spec: AzureManagedMachinePoolSpec{ + SubnetName: pointer.String("my-subnet"), + }, + }, + old: &AzureManagedMachinePool{ + Spec: AzureManagedMachinePoolSpec{ + SubnetName: nil, + }, + }, + wantErr: false, + }, + { + name: "Can't update SubnetName without error", + new: &AzureManagedMachinePool{ + Spec: AzureManagedMachinePoolSpec{ + SubnetName: pointer.String("my-subnet"), + }, + }, + old: &AzureManagedMachinePool{ + Spec: AzureManagedMachinePoolSpec{ + SubnetName: pointer.String("my-subnet"), + }, + }, + wantErr: false, + }, } var client client.Client for _, tc := range tests { @@ -604,6 +646,112 @@ func TestAzureManagedMachinePool_ValidateCreate(t *testing.T) { wantErr: true, errorLen: 1, }, + { + name: "invalid subnetname", + ammp: &AzureManagedMachinePool{ + Spec: AzureManagedMachinePoolSpec{ + SubnetName: pointer.String("1+subnet"), + }, + }, + wantErr: true, + errorLen: 1, + }, + { + name: "invalid subnetname", + ammp: &AzureManagedMachinePool{ + Spec: AzureManagedMachinePoolSpec{ + SubnetName: pointer.String("1"), + }, + }, + wantErr: true, + errorLen: 1, + }, + { + name: "invalid subnetname", + ammp: &AzureManagedMachinePool{ + Spec: AzureManagedMachinePoolSpec{ + SubnetName: pointer.String("-a_b-c"), + }, + }, + wantErr: true, + errorLen: 1, + }, + { + name: "invalid subnetname", + ammp: &AzureManagedMachinePool{ + Spec: AzureManagedMachinePoolSpec{ + SubnetName: pointer.String("E-a_b-c"), + }, + }, + wantErr: true, + errorLen: 1, + }, + { + name: "invalid subnetname", + ammp: &AzureManagedMachinePool{ + Spec: AzureManagedMachinePoolSpec{ + SubnetName: pointer.String("-_-_"), + }, + }, + wantErr: true, + errorLen: 1, + }, + { + name: "invalid subnetname", + ammp: &AzureManagedMachinePool{ + Spec: AzureManagedMachinePoolSpec{ + SubnetName: pointer.String("abc@#$"), + }, + }, + wantErr: true, + errorLen: 1, + }, + { + name: "invalid subnetname with character length 81", + ammp: &AzureManagedMachinePool{ + Spec: AzureManagedMachinePoolSpec{ + SubnetName: pointer.String("3DgIb8EZMkLs0KlyPaTcNxoJU9ufmW6jvXrweqz1hVp5nS4RtH2QY7AFOiC5nS4RtH2QY7AFOiC3DgIb8"), + }, + }, + wantErr: true, + errorLen: 1, + }, + { + name: "valid subnetname with character length 80", + ammp: &AzureManagedMachinePool{ + Spec: AzureManagedMachinePoolSpec{ + SubnetName: pointer.String("3DgIb8EZMkLs0KlyPaTcNxoJU9ufmW6jvXrweqz1hVp5nS4RtH2QY7AFOiC5nS4RtH2QY7AFOiC3DgIb"), + }, + }, + wantErr: false, + }, + { + name: "valid subnetname", + ammp: &AzureManagedMachinePool{ + Spec: AzureManagedMachinePoolSpec{ + SubnetName: pointer.String("1abc"), + }, + }, + wantErr: false, + }, + { + name: "valid subnetname", + ammp: &AzureManagedMachinePool{ + Spec: AzureManagedMachinePoolSpec{ + SubnetName: pointer.String("1-a-b-c"), + }, + }, + wantErr: false, + }, + { + name: "valid subnetname", + ammp: &AzureManagedMachinePool{ + Spec: AzureManagedMachinePoolSpec{ + SubnetName: pointer.String("my-subnet"), + }, + }, + wantErr: false, + }, { name: "too few MaxPods", ammp: &AzureManagedMachinePool{ @@ -651,10 +799,8 @@ func TestAzureManagedMachinePool_ValidateCreate(t *testing.T) { { name: "Windows clusters with more than 6char names are not allowed", ammp: &AzureManagedMachinePool{ - ObjectMeta: metav1.ObjectMeta{ - Name: "pool0-name-too-long", - }, Spec: AzureManagedMachinePoolSpec{ + Name: pointer.String("pool0-name-too-long"), Mode: "User", OSType: pointer.String(WindowsOS), }, @@ -972,7 +1118,7 @@ func TestAzureManagedMachinePool_ValidateCreate(t *testing.T) { ammp: &AzureManagedMachinePool{ Spec: AzureManagedMachinePoolSpec{ KubeletConfig: &KubeletConfig{ - FailSwapOn: pointer.BoolPtr(true), + FailSwapOn: pointer.Bool(true), }, LinuxOSConfig: &LinuxOSConfig{ SwapFileSizeMB: pointer.Int32(1500), @@ -1057,7 +1203,7 @@ func TestAzureManagedMachinePool_validateLastSystemNodePool(t *testing.T) { ammp: systemMachinePool, cluster: &clusterv1.Cluster{ ObjectMeta: metav1.ObjectMeta{ - Name: systemMachinePool.GetLabels()[clusterv1.ClusterLabelName], + Name: systemMachinePool.GetLabels()[clusterv1.ClusterNameLabel], Namespace: systemMachinePool.Namespace, DeletionTimestamp: &deletionTime, }, @@ -1072,7 +1218,7 @@ func TestAzureManagedMachinePool_validateLastSystemNodePool(t *testing.T) { ammp: systemMachinePool, cluster: &clusterv1.Cluster{ ObjectMeta: metav1.ObjectMeta{ - Name: systemMachinePool.GetLabels()[clusterv1.ClusterLabelName], + Name: systemMachinePool.GetLabels()[clusterv1.ClusterNameLabel], Namespace: systemMachinePool.Namespace, DeletionTimestamp: &deletionTime, }, @@ -1087,7 +1233,7 @@ func TestAzureManagedMachinePool_validateLastSystemNodePool(t *testing.T) { ammp: systemMachinePool, cluster: &clusterv1.Cluster{ ObjectMeta: metav1.ObjectMeta{ - Name: systemMachinePool.GetLabels()[clusterv1.ClusterLabelName], + Name: systemMachinePool.GetLabels()[clusterv1.ClusterNameLabel], Namespace: systemMachinePool.Namespace, }, }, @@ -1098,7 +1244,7 @@ func TestAzureManagedMachinePool_validateLastSystemNodePool(t *testing.T) { ammp: systemMachinePool, cluster: &clusterv1.Cluster{ ObjectMeta: metav1.ObjectMeta{ - Name: systemMachinePool.GetLabels()[clusterv1.ClusterLabelName], + Name: systemMachinePool.GetLabels()[clusterv1.ClusterNameLabel], Namespace: systemMachinePool.Namespace, DeletionTimestamp: &deletionTime, }, @@ -1138,7 +1284,7 @@ func getManagedMachinePoolWithSystemMode() *AzureManagedMachinePool { ObjectMeta: metav1.ObjectMeta{ Namespace: metav1.NamespaceDefault, Labels: map[string]string{ - clusterv1.ClusterLabelName: "test-cluster", + clusterv1.ClusterNameLabel: "test-cluster", LabelAgentPoolMode: string(NodePoolModeSystem), }, }, diff --git a/api/v1beta1/doc.go b/api/v1beta1/doc.go index d55ab5609a7..90c54a8d675 100644 --- a/api/v1beta1/doc.go +++ b/api/v1beta1/doc.go @@ -14,4 +14,5 @@ See the License for the specific language governing permissions and limitations under the License. */ +// +groupName=infrastructure.cluster.x-k8s.io package v1beta1 diff --git a/api/v1beta1/groupversion_info.go b/api/v1beta1/groupversion_info.go index 3715bbfa5be..3d638832dc3 100644 --- a/api/v1beta1/groupversion_info.go +++ b/api/v1beta1/groupversion_info.go @@ -16,7 +16,6 @@ limitations under the License. // Package v1beta1 contains API Schema definitions for the infrastructure v1beta1 API group // +kubebuilder:object:generate=true -// +groupName=infrastructure.cluster.x-k8s.io package v1beta1 import ( diff --git a/api/v1beta1/types.go b/api/v1beta1/types.go index 2514c30b805..6ac084834e3 100644 --- a/api/v1beta1/types.go +++ b/api/v1beta1/types.go @@ -19,6 +19,7 @@ package v1beta1 import ( "github.com/pkg/errors" "k8s.io/apimachinery/pkg/api/resource" + "k8s.io/utils/net" ) const ( @@ -30,6 +31,28 @@ const ( Bastion string = "bastion" ) +// SecurityEncryptionType represents the Encryption Type when the virtual machine is a +// Confidential VM. +type SecurityEncryptionType string + +const ( + // SecurityEncryptionTypeVMGuestStateOnly disables OS disk confidential encryption. + SecurityEncryptionTypeVMGuestStateOnly SecurityEncryptionType = "VMGuestStateOnly" + // SecurityEncryptionTypeDiskWithVMGuestState OS disk confidential encryption with a + // platform-managed key (PMK) or a customer-managed key (CMK). + SecurityEncryptionTypeDiskWithVMGuestState SecurityEncryptionType = "DiskWithVMGuestState" +) + +// SecurityTypes represents the SecurityType of the virtual machine. +type SecurityTypes string + +const ( + // SecurityTypesConfidentialVM defines the SecurityType of the virtual machine as a Confidential VM. + SecurityTypesConfidentialVM SecurityTypes = "ConfidentialVM" + // SecurityTypesTrustedLaunch defines the SecurityType of the virtual machine as a Trusted Launch VM. + SecurityTypesTrustedLaunch SecurityTypes = "TrustedLaunch" +) + // Futures is a slice of Future. type Futures []Future @@ -124,6 +147,41 @@ type VnetPeeringClassSpec struct { // RemoteVnetName defines name of the remote virtual network. RemoteVnetName string `json:"remoteVnetName"` + + // ForwardPeeringProperties specifies VnetPeeringProperties for peering from the cluster's virtual network to the + // remote virtual network. + // +optional + ForwardPeeringProperties VnetPeeringProperties `json:"forwardPeeringProperties,omitempty"` + + // ReversePeeringProperties specifies VnetPeeringProperties for peering from the remote virtual network to the + // cluster's virtual network. + // +optional + ReversePeeringProperties VnetPeeringProperties `json:"reversePeeringProperties,omitempty"` +} + +// VnetPeeringProperties specifies virtual network peering properties. +type VnetPeeringProperties struct { + // AllowForwardedTraffic specifies whether the forwarded traffic from the VMs in the local virtual network will be + // allowed/disallowed in remote virtual network. + // +optional + AllowForwardedTraffic *bool `json:"allowForwardedTraffic,omitempty"` + + // AllowGatewayTransit specifies if gateway links can be used in remote virtual networking to link to this virtual + // network. + // +optional + AllowGatewayTransit *bool `json:"allowGatewayTransit,omitempty"` + + // AllowVirtualNetworkAccess specifies whether the VMs in the local virtual network space would be able to access + // the VMs in remote virtual network space. + // +optional + AllowVirtualNetworkAccess *bool `json:"allowVirtualNetworkAccess,omitempty"` + + // UseRemoteGateways specifies if remote gateways can be used on this virtual network. + // If the flag is set to true, and allowGatewayTransit on remote peering is also set to true, the virtual network + // will use the gateways of the remote virtual network for transit. Only one peering can have this flag set to true. + // This flag cannot be set if virtual network already has a gateway. + // +optional + UseRemoteGateways *bool `json:"useRemoteGateways,omitempty"` } // VnetPeerings is a slice of VnetPeering. @@ -578,8 +636,32 @@ type VMExtension struct { type ManagedDiskParameters struct { // +optional StorageAccountType string `json:"storageAccountType,omitempty"` + // DiskEncryptionSet specifies the customer-managed disk encryption set resource id for the managed disk. + // +optional + DiskEncryptionSet *DiskEncryptionSetParameters `json:"diskEncryptionSet,omitempty"` + // SecurityProfile specifies the security profile for the managed disk. + // +optional + SecurityProfile *VMDiskSecurityProfile `json:"securityProfile,omitempty"` +} + +// VMDiskSecurityProfile specifies the security profile settings for the managed disk. +// It can be set only for Confidential VMs. +type VMDiskSecurityProfile struct { + // DiskEncryptionSet specifies the customer-managed disk encryption set resource id for the + // managed disk that is used for Customer Managed Key encrypted ConfidentialVM OS Disk and + // VMGuest blob. // +optional DiskEncryptionSet *DiskEncryptionSetParameters `json:"diskEncryptionSet,omitempty"` + // SecurityEncryptionType specifies the encryption type of the managed disk. + // It is set to DiskWithVMGuestState to encrypt the managed disk along with the VMGuestState + // blob, and to VMGuestStateOnly to encrypt the VMGuestState blob only. + // When set to VMGuestStateOnly, VirtualizedTrustedPlatformModule should be set to Enabled. + // When set to DiskWithVMGuestState, EncryptionAtHost should be disabled, SecureBoot and + // VirtualizedTrustedPlatformModule should be set to Enabled. + // It can be set only for Confidential VMs. + // +kubebuilder:validation:Enum=VMGuestStateOnly;DiskWithVMGuestState + // +optional + SecurityEncryptionType SecurityEncryptionType `json:"securityEncryptionType,omitempty"` } // DiskEncryptionSetParameters defines disk encryption options. @@ -733,14 +815,51 @@ func (s SubnetSpec) IsNatGatewayEnabled() bool { return s.NatGateway.Name != "" } +// IsIPv6Enabled returns whether or not IPv6 is enabled on the subnet. +func (s SubnetSpec) IsIPv6Enabled() bool { + for _, cidr := range s.CIDRBlocks { + if net.IsIPv6CIDRString(cidr) { + return true + } + } + return false +} + // SecurityProfile specifies the Security profile settings for a // virtual machine or virtual machine scale set. type SecurityProfile struct { // This field indicates whether Host Encryption should be enabled - // or disabled for a virtual machine or virtual machine scale - // set. Default is disabled. + // or disabled for a virtual machine or virtual machine scale set. + // This should be disabled when SecurityEncryptionType is set to DiskWithVMGuestState. + // Default is disabled. // +optional EncryptionAtHost *bool `json:"encryptionAtHost,omitempty"` + // SecurityType specifies the SecurityType of the virtual machine. It has to be set to any specified value to + // enable UefiSettings. The default behavior is: UefiSettings will not be enabled unless this property is set. + // +kubebuilder:validation:Enum=ConfidentialVM;TrustedLaunch + // +optional + SecurityType SecurityTypes `json:"securityType,omitempty"` + // UefiSettings specifies the security settings like secure boot and vTPM used while creating the virtual machine. + // +optional + UefiSettings *UefiSettings `json:"uefiSettings,omitempty"` +} + +// UefiSettings specifies the security settings like secure boot and vTPM used while creating the virtual +// machine. +// +optional +type UefiSettings struct { + // SecureBootEnabled specifies whether secure boot should be enabled on the virtual machine. + // Secure Boot verifies the digital signature of all boot components and halts the boot process if signature verification fails. + // If omitted, the platform chooses a default, which is subject to change over time, currently that default is false. + //+optional + SecureBootEnabled *bool `json:"secureBootEnabled,omitempty"` + // VTpmEnabled specifies whether vTPM should be enabled on the virtual machine. + // When true it enables the virtualized trusted platform module measurements to create a known good boot integrity policy baseline. + // The integrity policy baseline is used for comparison with measurements from subsequent VM boots to determine if anything has changed. + // This is required to be set to Enabled if SecurityEncryptionType is defined. + // If omitted, the platform chooses a default, which is subject to change over time, currently that default is false. + // +optional + VTpmEnabled *bool `json:"vTpmEnabled,omitempty"` } // AddressRecord specifies a DNS record mapping a hostname to an IPV4 or IPv6 address. diff --git a/api/v1beta1/types_class.go b/api/v1beta1/types_class.go index 04f33564d26..6bc37d840e2 100644 --- a/api/v1beta1/types_class.go +++ b/api/v1beta1/types_class.go @@ -16,7 +16,9 @@ limitations under the License. package v1beta1 -import corev1 "k8s.io/api/core/v1" +import ( + corev1 "k8s.io/api/core/v1" +) // AzureClusterClassSpec defines the AzureCluster properties that may be shared across several Azure clusters. type AzureClusterClassSpec struct { @@ -50,7 +52,7 @@ type AzureClusterClassSpec struct { // CloudProviderConfigOverrides is an optional set of configuration values that can be overridden in azure cloud provider config. // This is only a subset of options that are available in azure cloud provider config. // Some values for the cloud provider config are inferred from other parts of cluster api provider azure spec, and may not be available for overrides. - // See: https://kubernetes-sigs.github.io/cloud-provider-azure/install/configs + // See: https://cloud-provider-azure.sigs.k8s.io/install/configs // Note: All cloud provider config values can be customized by creating the secret beforehand. CloudProviderConfigOverrides is only used when the secret is managed by the Azure Provider. // +optional CloudProviderConfigOverrides *CloudProviderConfigOverrides `json:"cloudProviderConfigOverrides,omitempty"` diff --git a/api/v1beta1/types_template.go b/api/v1beta1/types_template.go index 010be4700e5..baed624f26d 100644 --- a/api/v1beta1/types_template.go +++ b/api/v1beta1/types_template.go @@ -16,7 +16,10 @@ limitations under the License. package v1beta1 -import "github.com/pkg/errors" +import ( + "github.com/pkg/errors" + "k8s.io/utils/net" +) // AzureClusterTemplateResourceSpec specifies an Azure cluster template resource. type AzureClusterTemplateResourceSpec struct { @@ -106,6 +109,16 @@ func (s SubnetTemplateSpec) IsNatGatewayEnabled() bool { return s.NatGateway.Name != "" } +// IsIPv6Enabled returns whether or not IPv6 is enabled on the subnet. +func (s SubnetTemplateSpec) IsIPv6Enabled() bool { + for _, cidr := range s.CIDRBlocks { + if net.IsIPv6CIDRString(cidr) { + return true + } + } + return false +} + // SubnetTemplatesSpec specifies a list of subnet templates. // +listType=map // +listMapKey=name diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index 8d24ee954fc..b7437e6aefb 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -1417,6 +1417,11 @@ func (in *AzureManagedMachinePoolSpec) DeepCopyInto(out *AzureManagedMachinePool *out = new(LinuxOSConfig) (*in).DeepCopyInto(*out) } + if in.SubnetName != nil { + in, out := &in.SubnetName, &out.SubnetName + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureManagedMachinePoolSpec. @@ -2139,6 +2144,11 @@ func (in *ManagedDiskParameters) DeepCopyInto(out *ManagedDiskParameters) { *out = new(DiskEncryptionSetParameters) **out = **in } + if in.SecurityProfile != nil { + in, out := &in.SecurityProfile, &out.SecurityProfile + *out = new(VMDiskSecurityProfile) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedDiskParameters. @@ -2545,6 +2555,11 @@ func (in *SecurityProfile) DeepCopyInto(out *SecurityProfile) { *out = new(bool) **out = **in } + if in.UefiSettings != nil { + in, out := &in.UefiSettings, &out.UefiSettings + *out = new(UefiSettings) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecurityProfile. @@ -3017,6 +3032,31 @@ func (in Taints) DeepCopy() Taints { return *out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *UefiSettings) DeepCopyInto(out *UefiSettings) { + *out = *in + if in.SecureBootEnabled != nil { + in, out := &in.SecureBootEnabled, &out.SecureBootEnabled + *out = new(bool) + **out = **in + } + if in.VTpmEnabled != nil { + in, out := &in.VTpmEnabled, &out.VTpmEnabled + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UefiSettings. +func (in *UefiSettings) DeepCopy() *UefiSettings { + if in == nil { + return nil + } + out := new(UefiSettings) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *UserAssignedIdentity) DeepCopyInto(out *UserAssignedIdentity) { *out = *in @@ -3047,6 +3087,26 @@ func (in *UserManagedBootDiagnostics) DeepCopy() *UserManagedBootDiagnostics { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VMDiskSecurityProfile) DeepCopyInto(out *VMDiskSecurityProfile) { + *out = *in + if in.DiskEncryptionSet != nil { + in, out := &in.DiskEncryptionSet, &out.DiskEncryptionSet + *out = new(DiskEncryptionSetParameters) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VMDiskSecurityProfile. +func (in *VMDiskSecurityProfile) DeepCopy() *VMDiskSecurityProfile { + if in == nil { + return nil + } + out := new(VMDiskSecurityProfile) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VMExtension) DeepCopyInto(out *VMExtension) { *out = *in @@ -3106,6 +3166,8 @@ func (in *VnetClassSpec) DeepCopy() *VnetClassSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VnetPeeringClassSpec) DeepCopyInto(out *VnetPeeringClassSpec) { *out = *in + in.ForwardPeeringProperties.DeepCopyInto(&out.ForwardPeeringProperties) + in.ReversePeeringProperties.DeepCopyInto(&out.ReversePeeringProperties) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VnetPeeringClassSpec. @@ -3118,10 +3180,45 @@ func (in *VnetPeeringClassSpec) DeepCopy() *VnetPeeringClassSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VnetPeeringProperties) DeepCopyInto(out *VnetPeeringProperties) { + *out = *in + if in.AllowForwardedTraffic != nil { + in, out := &in.AllowForwardedTraffic, &out.AllowForwardedTraffic + *out = new(bool) + **out = **in + } + if in.AllowGatewayTransit != nil { + in, out := &in.AllowGatewayTransit, &out.AllowGatewayTransit + *out = new(bool) + **out = **in + } + if in.AllowVirtualNetworkAccess != nil { + in, out := &in.AllowVirtualNetworkAccess, &out.AllowVirtualNetworkAccess + *out = new(bool) + **out = **in + } + if in.UseRemoteGateways != nil { + in, out := &in.UseRemoteGateways, &out.UseRemoteGateways + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VnetPeeringProperties. +func (in *VnetPeeringProperties) DeepCopy() *VnetPeeringProperties { + if in == nil { + return nil + } + out := new(VnetPeeringProperties) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VnetPeeringSpec) DeepCopyInto(out *VnetPeeringSpec) { *out = *in - out.VnetPeeringClassSpec = in.VnetPeeringClassSpec + in.VnetPeeringClassSpec.DeepCopyInto(&out.VnetPeeringClassSpec) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VnetPeeringSpec. @@ -3139,7 +3236,9 @@ func (in VnetPeerings) DeepCopyInto(out *VnetPeerings) { { in := &in *out = make(VnetPeerings, len(*in)) - copy(*out, *in) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } } @@ -3158,7 +3257,9 @@ func (in VnetPeeringsTemplateSpec) DeepCopyInto(out *VnetPeeringsTemplateSpec) { { in := &in *out = make(VnetPeeringsTemplateSpec, len(*in)) - copy(*out, *in) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } } @@ -3178,7 +3279,9 @@ func (in *VnetSpec) DeepCopyInto(out *VnetSpec) { if in.Peerings != nil { in, out := &in.Peerings, &out.Peerings *out = make(VnetPeerings, len(*in)) - copy(*out, *in) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } in.VnetClassSpec.DeepCopyInto(&out.VnetClassSpec) } @@ -3200,7 +3303,9 @@ func (in *VnetTemplateSpec) DeepCopyInto(out *VnetTemplateSpec) { if in.Peerings != nil { in, out := &in.Peerings, &out.Peerings *out = make(VnetPeeringsTemplateSpec, len(*in)) - copy(*out, *in) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } } diff --git a/azure/converters/extendedlocation.go b/azure/converters/extendedlocation.go index 12b13a12e8a..60e931cad2d 100644 --- a/azure/converters/extendedlocation.go +++ b/azure/converters/extendedlocation.go @@ -19,7 +19,7 @@ package converters import ( "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-11-01/compute" "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-08-01/network" - "github.com/Azure/go-autorest/autorest/to" + "k8s.io/utils/pointer" infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" ) @@ -29,7 +29,7 @@ func ExtendedLocationToNetworkSDK(src *infrav1.ExtendedLocationSpec) *network.Ex return nil } return &network.ExtendedLocation{ - Name: to.StringPtr(src.Name), + Name: pointer.String(src.Name), Type: network.ExtendedLocationTypes(src.Type), } } @@ -40,7 +40,7 @@ func ExtendedLocationToComputeSDK(src *infrav1.ExtendedLocationSpec) *compute.Ex return nil } return &compute.ExtendedLocation{ - Name: to.StringPtr(src.Name), + Name: pointer.String(src.Name), Type: compute.ExtendedLocationTypes(src.Type), } } diff --git a/azure/converters/extendedlocation_test.go b/azure/converters/extendedlocation_test.go index 31da55d9a85..bee3153d3da 100644 --- a/azure/converters/extendedlocation_test.go +++ b/azure/converters/extendedlocation_test.go @@ -22,7 +22,7 @@ import ( "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-11-01/compute" "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-08-01/network" - "github.com/Azure/go-autorest/autorest/to" + "k8s.io/utils/pointer" infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" ) @@ -39,7 +39,7 @@ func TestExtendedLocationToNetworkSDK(t *testing.T) { Type: "Edge", }, want: &network.ExtendedLocation{ - Name: to.StringPtr("value"), + Name: pointer.String("value"), Type: network.ExtendedLocationTypes("Edge"), }, }, @@ -71,7 +71,7 @@ func TestExtendedLocationToComputeSDK(t *testing.T) { Type: "Edge", }, want: &compute.ExtendedLocation{ - Name: to.StringPtr("value"), + Name: pointer.String("value"), Type: compute.ExtendedLocationTypes("Edge"), }, }, diff --git a/azure/converters/tags.go b/azure/converters/tags.go index c082802aed2..201cd53c1e8 100644 --- a/azure/converters/tags.go +++ b/azure/converters/tags.go @@ -19,6 +19,7 @@ package converters import ( "k8s.io/utils/pointer" infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" + "sigs.k8s.io/cluster-api-provider-azure/azure" ) // MapToTags converts a map[string]*string into a infrav1.Tags. @@ -38,15 +39,5 @@ func MapToTags(src map[string]*string) infrav1.Tags { // TagsToMap converts infrav1.Tags into a map[string]*string. func TagsToMap(src infrav1.Tags) map[string]*string { - if src == nil { - return nil - } - - tags := make(map[string]*string, len(src)) - - for k, v := range src { - tags[k] = pointer.String(v) - } - - return tags + return azure.StringMapPtr(src) } diff --git a/azure/converters/vmss.go b/azure/converters/vmss.go index c5df40f2b4c..7237361ec51 100644 --- a/azure/converters/vmss.go +++ b/azure/converters/vmss.go @@ -17,6 +17,8 @@ limitations under the License. package converters import ( + "regexp" + "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-11-01/compute" "k8s.io/utils/pointer" azprovider "sigs.k8s.io/cloud-provider-azure/pkg/provider" @@ -24,6 +26,13 @@ import ( "sigs.k8s.io/cluster-api-provider-azure/azure" ) +const ( + // RegExpStrCommunityGalleryID is a regexp string used for matching community gallery IDs and capturing specific values. + RegExpStrCommunityGalleryID = `/CommunityGalleries/(?P.*)/Images/(?P.*)/Versions/(?P.*)` + // RegExpStrComputeGalleryID is a regexp string used for matching compute gallery IDs and capturing specific values. + RegExpStrComputeGalleryID = `/subscriptions/(?P.*)/resourceGroups/(?P.*)/providers/Microsoft.Compute/galleries/(?P.*)/images/(?P.*)/versions/(?P.*)` +) + // SDKToVMSS converts an Azure SDK VirtualMachineScaleSet to the AzureMachinePool type. func SDKToVMSS(sdkvmss compute.VirtualMachineScaleSet, sdkinstances []compute.VirtualMachineScaleSetVM) *azure.VMSS { vmss := &azure.VMSS{ @@ -149,8 +158,53 @@ func SDKToVMSSVM(sdkInstance compute.VirtualMachineScaleSetVM) *azure.VMSSVM { // SDKImageToImage converts a SDK image reference to infrav1.Image. func SDKImageToImage(sdkImageRef *compute.ImageReference, isThirdPartyImage bool) infrav1.Image { + if sdkImageRef.ID != nil { + return IDImageRefToImage(*sdkImageRef.ID) + } + // community gallery image + if sdkImageRef.CommunityGalleryImageID != nil { + return cgImageRefToImage(*sdkImageRef.CommunityGalleryImageID) + } + // shared gallery image + if sdkImageRef.SharedGalleryImageID != nil { + return sgImageRefToImage(*sdkImageRef.SharedGalleryImageID) + } + // marketplace image + return mpImageRefToImage(sdkImageRef, isThirdPartyImage) +} + +// GetOrchestrationMode returns the compute.OrchestrationMode for the given infrav1.OrchestrationModeType. +func GetOrchestrationMode(modeType infrav1.OrchestrationModeType) compute.OrchestrationMode { + if modeType == infrav1.FlexibleOrchestrationMode { + return compute.OrchestrationModeFlexible + } + return compute.OrchestrationModeUniform +} + +// IDImageRefToImage converts an ID to a infrav1.Image with ComputerGallery set or ID, depending on the structure of the ID. +func IDImageRefToImage(id string) infrav1.Image { + // compute gallery image + if ok, params := getParams(RegExpStrComputeGalleryID, id); ok { + return infrav1.Image{ + ComputeGallery: &infrav1.AzureComputeGalleryImage{ + Gallery: params["gallery"], + Name: params["name"], + Version: params["version"], + SubscriptionID: pointer.String(params["subID"]), + ResourceGroup: pointer.String(params["rg"]), + }, + } + } + + // specific image + return infrav1.Image{ + ID: &id, + } +} + +// mpImageRefToImage converts a marketplace gallery ImageReference to an infrav1.Image. +func mpImageRefToImage(sdkImageRef *compute.ImageReference, isThirdPartyImage bool) infrav1.Image { return infrav1.Image{ - ID: sdkImageRef.ID, Marketplace: &infrav1.AzureMarketplaceImage{ ImagePlan: infrav1.ImagePlan{ Publisher: pointer.StringDeref(sdkImageRef.Publisher, ""), @@ -163,10 +217,49 @@ func SDKImageToImage(sdkImageRef *compute.ImageReference, isThirdPartyImage bool } } -// GetOrchestrationMode returns the compute.OrchestrationMode for the given infrav1.OrchestrationModeType. -func GetOrchestrationMode(modeType infrav1.OrchestrationModeType) compute.OrchestrationMode { - if modeType == infrav1.FlexibleOrchestrationMode { - return compute.OrchestrationModeFlexible +// cgImageRefToImage converts a community gallery ImageReference to an infrav1.Image. +func cgImageRefToImage(id string) infrav1.Image { + if ok, params := getParams(RegExpStrCommunityGalleryID, id); ok { + return infrav1.Image{ + ComputeGallery: &infrav1.AzureComputeGalleryImage{ + Gallery: params["gallery"], + Name: params["name"], + Version: params["version"], + }, + } } - return compute.OrchestrationModeUniform + return infrav1.Image{} +} + +// sgImageRefToImage converts a shared gallery ImageReference to an infrav1.Image. +func sgImageRefToImage(id string) infrav1.Image { + if ok, params := getParams(RegExpStrComputeGalleryID, id); ok { + return infrav1.Image{ + SharedGallery: &infrav1.AzureSharedGalleryImage{ + SubscriptionID: params["subID"], + ResourceGroup: params["rg"], + Gallery: params["gallery"], + Name: params["name"], + Version: params["version"], + }, + } + } + return infrav1.Image{} +} + +func getParams(regStr, str string) (matched bool, params map[string]string) { + re := regexp.MustCompile(regStr) + match := re.FindAllStringSubmatch(str, -1) + + if len(match) == 1 { + params = make(map[string]string) + for i, name := range re.SubexpNames() { + if i > 0 && i <= len(match[0]) { + params[name] = match[0][i] + } + } + matched = true + } + + return matched, params } diff --git a/azure/converters/vmss_test.go b/azure/converters/vmss_test.go index ad19da33df4..024a51b1c4c 100644 --- a/azure/converters/vmss_test.go +++ b/azure/converters/vmss_test.go @@ -181,8 +181,7 @@ func Test_SDKToVMSSVM(t *testing.T) { ID: "/subscriptions/foo/resourceGroups/my_resource_group/providers/bar", Name: "instance-000001", Image: infrav1.Image{ - ID: pointer.String("imageID"), - Marketplace: &infrav1.AzureMarketplaceImage{}, + ID: pointer.String("imageID"), }, State: "Creating", }, @@ -223,20 +222,18 @@ func Test_SDKImageToImage(t *testing.T) { Image infrav1.Image }{ { - Name: "minimal image", + Name: "id image", SDKImageRef: &compute.ImageReference{ ID: pointer.String("imageID"), }, IsThirdParty: false, Image: infrav1.Image{ - ID: pointer.String("imageID"), - Marketplace: &infrav1.AzureMarketplaceImage{}, + ID: pointer.String("imageID"), }, }, { Name: "marketplace image", SDKImageRef: &compute.ImageReference{ - ID: pointer.String("imageID"), Publisher: pointer.String("publisher"), Offer: pointer.String("offer"), Sku: pointer.String("sku"), @@ -244,7 +241,6 @@ func Test_SDKImageToImage(t *testing.T) { }, IsThirdParty: true, Image: infrav1.Image{ - ID: pointer.String("imageID"), Marketplace: &infrav1.AzureMarketplaceImage{ ImagePlan: infrav1.ImagePlan{ Publisher: "publisher", @@ -256,6 +252,65 @@ func Test_SDKImageToImage(t *testing.T) { }, }, }, + { + Name: "shared gallery image", + SDKImageRef: &compute.ImageReference{ + SharedGalleryImageID: pointer.String("/subscriptions/subscription/resourceGroups/rg/providers/Microsoft.Compute/galleries/gallery/images/image/versions/version"), + }, + Image: infrav1.Image{ + SharedGallery: &infrav1.AzureSharedGalleryImage{ + SubscriptionID: "subscription", + ResourceGroup: "rg", + Gallery: "gallery", + Name: "image", + Version: "version", + }, + }, + }, + { + Name: "community gallery image", + SDKImageRef: &compute.ImageReference{ + CommunityGalleryImageID: pointer.String("/CommunityGalleries/gallery/Images/image/Versions/version"), + }, + Image: infrav1.Image{ + ComputeGallery: &infrav1.AzureComputeGalleryImage{ + Gallery: "gallery", + Name: "image", + Version: "version", + }, + }, + }, + { + Name: "compute gallery image", + SDKImageRef: &compute.ImageReference{ + ID: pointer.String("/subscriptions/subscription/resourceGroups/rg/providers/Microsoft.Compute/galleries/gallery/images/image/versions/version"), + }, + Image: infrav1.Image{ + ComputeGallery: &infrav1.AzureComputeGalleryImage{ + Gallery: "gallery", + Name: "image", + Version: "version", + SubscriptionID: pointer.String("subscription"), + ResourceGroup: pointer.String("rg"), + }, + }, + }, + { + Name: "compute gallery image not formatted as expected", + SDKImageRef: &compute.ImageReference{ + ID: pointer.String("/compute/gallery/not/formatted/as/expected"), + }, + Image: infrav1.Image{ + ID: pointer.String("/compute/gallery/not/formatted/as/expected"), + }, + }, + { + Name: "community gallery image not formatted as expected", + SDKImageRef: &compute.ImageReference{ + CommunityGalleryImageID: pointer.String("/community/gallery/not/formatted/as/expected"), + }, + Image: infrav1.Image{}, + }, } for _, c := range cases { @@ -319,8 +374,7 @@ func Test_SDKVMToVMSSVM(t *testing.T) { Expected: &azure.VMSSVM{ ID: "vmID3", Image: infrav1.Image{ - ID: pointer.String("imageID"), - Marketplace: &infrav1.AzureMarketplaceImage{}, + ID: pointer.String("imageID"), }, Name: "vmwithstorage", State: "Creating", diff --git a/azure/defaults.go b/azure/defaults.go index 9f348fdce7e..d6eeb7abaaf 100644 --- a/azure/defaults.go +++ b/azure/defaults.go @@ -21,7 +21,6 @@ import ( "net/http" "github.com/Azure/go-autorest/autorest" - azureautorest "github.com/Azure/go-autorest/autorest/azure" "sigs.k8s.io/cluster-api-provider-azure/util/tele" "sigs.k8s.io/cluster-api-provider-azure/version" ) @@ -31,6 +30,8 @@ const ( DefaultUserName = "capi" // DefaultAKSUserName is the default username for a created AKS VM. DefaultAKSUserName = "azureuser" + // PublicCloudName is the name of the Azure public cloud. + PublicCloudName = "AzurePublicCloud" ) const ( @@ -127,11 +128,6 @@ func GenerateFrontendIPConfigName(lbName string) string { return fmt.Sprintf("%s-%s", lbName, "frontEnd") } -// GenerateNatGatewayIPName generates a NAT gateway IP name. -func GenerateNatGatewayIPName(clusterName, subnetName string) string { - return fmt.Sprintf("pip-%s-%s-natgw", clusterName, subnetName) -} - // GenerateNodeOutboundIPName generates a public IP name, based on the cluster name. func GenerateNodeOutboundIPName(clusterName string) string { return fmt.Sprintf("pip-%s-node-outbound", clusterName) @@ -300,7 +296,7 @@ func ManagedClusterID(subscriptionID, resourceGroup, managedClusterName string) // Its role is to detect and report Kubernetes bootstrap failure or success. func GetBootstrappingVMExtension(osType string, cloud string, vmName string) *ExtensionSpec { // currently, the bootstrap extension is only available in AzurePublicCloud. - if osType == LinuxOS && cloud == azureautorest.PublicCloud.Name { + if osType == LinuxOS && cloud == PublicCloudName { // The command checks for the existence of the bootstrapSentinelFile on the machine, with retries and sleep between retries. return &ExtensionSpec{ Name: BootstrappingExtensionLinux, @@ -311,7 +307,7 @@ func GetBootstrappingVMExtension(osType string, cloud string, vmName string) *Ex "commandToExecute": LinuxBootstrapExtensionCommand, }, } - } else if osType == WindowsOS && cloud == azureautorest.PublicCloud.Name { + } else if osType == WindowsOS && cloud == PublicCloudName { // This command for the existence of the bootstrapSentinelFile on the machine, with retries and sleep between reties. // If the file is not present after the retries are exhausted the extension fails with return code '-2' - ERROR_FILE_NOT_FOUND. return &ExtensionSpec{ diff --git a/azure/errors.go b/azure/errors.go index 79ef19e4f24..18925094755 100644 --- a/azure/errors.go +++ b/azure/errors.go @@ -17,6 +17,7 @@ limitations under the License. package azure import ( + "context" "errors" "fmt" "time" @@ -153,3 +154,12 @@ func IsOperationNotDoneError(target error) bool { } return errors.As(target, &OperationNotDoneError{}) } + +// IsContextDeadlineExceededOrCanceledError checks if it's a context deadline +// exceeded or canceled error. +func IsContextDeadlineExceededOrCanceledError(err error) bool { + if err == nil { + return false + } + return errors.Is(err, context.DeadlineExceeded) || errors.Is(err, context.Canceled) +} diff --git a/azure/errors_test.go b/azure/errors_test.go new file mode 100644 index 00000000000..d8523e78711 --- /dev/null +++ b/azure/errors_test.go @@ -0,0 +1,53 @@ +package azure + +import ( + "context" + "testing" + "time" + + "github.com/pkg/errors" +) + +func TestIsContextDeadlineExceededOrCanceled(t *testing.T) { + tests := []struct { + name string + want bool + err error + }{ + { + name: "Context deadline exceeded error", + err: func() error { + ctx, cancel := context.WithDeadline(context.Background(), time.Now().Add(-7*time.Hour)) + defer cancel() + return ctx.Err() + }(), + want: true, + }, + { + name: "Context canceled exceeded error", + err: func() error { + ctx, cancel := context.WithDeadline(context.Background(), time.Now().Add(1*time.Hour)) + cancel() + return ctx.Err() + }(), + want: true, + }, + { + name: "Nil error", + err: nil, + want: false, + }, + { + name: "Error other than context deadline exceeded or canceled error", + err: errors.New("dummy error"), + want: false, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := IsContextDeadlineExceededOrCanceledError(tt.err); got != tt.want { + t.Errorf("IsContextDeadlineExceededOrCanceled() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/azure/interfaces.go b/azure/interfaces.go index d6a1f6021b3..696740b53eb 100644 --- a/azure/interfaces.go +++ b/azure/interfaces.go @@ -19,6 +19,7 @@ package azure import ( "context" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime" "github.com/Azure/go-autorest/autorest" infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" @@ -127,3 +128,13 @@ type ResourceSpecGetterWithHeaders interface { // CustomHeaders returns the headers that should be added to Azure API calls. CustomHeaders() map[string]string } + +// ASOResourceSpecGetter is an interface for getting all the required information to create/update/delete an Azure resource. +type ASOResourceSpecGetter interface { + // ResourceRef returns a concrete, named (and namespaced if applicable) ASO + // resource type to facilitate a strongly-typed GET. + ResourceRef() genruntime.MetaObject + // Parameters returns a modified object if it points to a non-nil resource. + // Otherwise it returns a new value or nil if no updates are needed. + Parameters(ctx context.Context, object genruntime.MetaObject) (genruntime.MetaObject, error) +} diff --git a/azure/mock_azure/azure_mock.go b/azure/mock_azure/azure_mock.go index e7563710238..d23c8e4b2d4 100644 --- a/azure/mock_azure/azure_mock.go +++ b/azure/mock_azure/azure_mock.go @@ -24,6 +24,7 @@ import ( context "context" reflect "reflect" + genruntime "github.com/Azure/azure-service-operator/v2/pkg/genruntime" autorest "github.com/Azure/go-autorest/autorest" gomock "github.com/golang/mock/gomock" v1beta1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" @@ -1872,3 +1873,55 @@ func (mr *MockResourceSpecGetterWithHeadersMockRecorder) ResourceName() *gomock. mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResourceName", reflect.TypeOf((*MockResourceSpecGetterWithHeaders)(nil).ResourceName)) } + +// MockASOResourceSpecGetter is a mock of ASOResourceSpecGetter interface. +type MockASOResourceSpecGetter struct { + ctrl *gomock.Controller + recorder *MockASOResourceSpecGetterMockRecorder +} + +// MockASOResourceSpecGetterMockRecorder is the mock recorder for MockASOResourceSpecGetter. +type MockASOResourceSpecGetterMockRecorder struct { + mock *MockASOResourceSpecGetter +} + +// NewMockASOResourceSpecGetter creates a new mock instance. +func NewMockASOResourceSpecGetter(ctrl *gomock.Controller) *MockASOResourceSpecGetter { + mock := &MockASOResourceSpecGetter{ctrl: ctrl} + mock.recorder = &MockASOResourceSpecGetterMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockASOResourceSpecGetter) EXPECT() *MockASOResourceSpecGetterMockRecorder { + return m.recorder +} + +// Parameters mocks base method. +func (m *MockASOResourceSpecGetter) Parameters(ctx context.Context, object genruntime.MetaObject) (genruntime.MetaObject, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Parameters", ctx, object) + ret0, _ := ret[0].(genruntime.MetaObject) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Parameters indicates an expected call of Parameters. +func (mr *MockASOResourceSpecGetterMockRecorder) Parameters(ctx, object interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Parameters", reflect.TypeOf((*MockASOResourceSpecGetter)(nil).Parameters), ctx, object) +} + +// ResourceRef mocks base method. +func (m *MockASOResourceSpecGetter) ResourceRef() genruntime.MetaObject { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ResourceRef") + ret0, _ := ret[0].(genruntime.MetaObject) + return ret0 +} + +// ResourceRef indicates an expected call of ResourceRef. +func (mr *MockASOResourceSpecGetterMockRecorder) ResourceRef() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResourceRef", reflect.TypeOf((*MockASOResourceSpecGetter)(nil).ResourceRef)) +} diff --git a/azure/pointers.go b/azure/pointers.go index 350bc33379d..12f387e1a5f 100644 --- a/azure/pointers.go +++ b/azure/pointers.go @@ -27,11 +27,14 @@ func StringSlice(s *[]string) []string { return nil } -// StringMapPtr returns a pointer to a given string map, or nil if the map is nil. -func StringMapPtr(m map[string]string) *map[string]*string { //nolint:gocritic +// StringMapPtr converts a map[string]string into a map[string]*string. It returns nil if the map is nil. +func StringMapPtr(m map[string]string) map[string]*string { + if m == nil { + return nil + } msp := make(map[string]*string, len(m)) for k, v := range m { msp[k] = pointer.String(v) } - return &msp + return msp } diff --git a/azure/pointers_test.go b/azure/pointers_test.go new file mode 100644 index 00000000000..fd9e3e1d267 --- /dev/null +++ b/azure/pointers_test.go @@ -0,0 +1,78 @@ +/* +Copyright 2023 The Kubernetes Authors. + +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 azure + +import ( + "testing" + + "github.com/google/go-cmp/cmp" + . "github.com/onsi/gomega" + "k8s.io/utils/pointer" +) + +func TestStringSlice(t *testing.T) { + cases := []struct { + Name string + Arg *[]string + Expected []string + }{ + { + Name: "Should return nil if the pointer is nil", + Arg: nil, + Expected: nil, + }, + { + Name: "Should return string slice value for the passed string slice pointer", + Arg: &[]string{"foo", "bar"}, + Expected: []string{"foo", "bar"}, + }, + } + for _, tc := range cases { + t.Run(tc.Name, func(t *testing.T) { + g := NewWithT(t) + actual := StringSlice(tc.Arg) + g.Expect(tc.Expected).To(Equal(actual)) + }) + } +} + +func TestStringMapPtr(t *testing.T) { + cases := []struct { + Name string + Arg map[string]string + Expected map[string]*string + }{ + { + Name: "Should return nil if the map is nil", + Arg: nil, + Expected: nil, + }, + { + Name: "Should convert to a map[string]*string", + Arg: map[string]string{"foo": "baz", "bar": "qux"}, + Expected: map[string]*string{"foo": pointer.String("baz"), "bar": pointer.String("qux")}, + }, + } + for _, tc := range cases { + t.Run(tc.Name, func(t *testing.T) { + actual := StringMapPtr(tc.Arg) + if !cmp.Equal(tc.Expected, actual) { + t.Errorf("Got difference between expected result and result %v", cmp.Diff(tc.Expected, actual)) + } + }) + } +} diff --git a/azure/scope/cluster.go b/azure/scope/cluster.go index f0edb2b1971..0de2fdf214a 100644 --- a/azure/scope/cluster.go +++ b/azure/scope/cluster.go @@ -27,10 +27,12 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/pkg/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/utils/net" "k8s.io/utils/pointer" infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" "sigs.k8s.io/cluster-api-provider-azure/azure" + "sigs.k8s.io/cluster-api-provider-azure/azure/services/asogroups" "sigs.k8s.io/cluster-api-provider-azure/azure/services/bastionhosts" "sigs.k8s.io/cluster-api-provider-azure/azure/services/groups" "sigs.k8s.io/cluster-api-provider-azure/azure/services/loadbalancers" @@ -134,6 +136,11 @@ func (s *ClusterScope) Authorizer() autorest.Authorizer { return s.AzureClients.Authorizer } +// GetClient returns the controller-runtime client. +func (s *ClusterScope) GetClient() client.Client { + return s.Client +} + // PublicIPSpecs returns the public IP specs. func (s *ClusterScope) PublicIPSpecs() []azure.ResourceSpecGetter { var publicIPSpecs []azure.ResourceSpecGetter @@ -420,25 +427,45 @@ func (s *ClusterScope) GroupSpec() azure.ResourceSpecGetter { } } +// ASOGroupSpec returns the resource group spec. +func (s *ClusterScope) ASOGroupSpec() azure.ASOResourceSpecGetter { + return &asogroups.GroupSpec{ + Name: s.ResourceGroup(), + Namespace: s.Namespace(), + Location: s.Location(), + ClusterName: s.ClusterName(), + AdditionalTags: s.AdditionalTags(), + Owner: *metav1.NewControllerRef(s.AzureCluster, infrav1.GroupVersion.WithKind("AzureCluster")), + } +} + // VnetPeeringSpecs returns the virtual network peering specs. func (s *ClusterScope) VnetPeeringSpecs() []azure.ResourceSpecGetter { peeringSpecs := make([]azure.ResourceSpecGetter, 2*len(s.Vnet().Peerings)) for i, peering := range s.Vnet().Peerings { forwardPeering := &vnetpeerings.VnetPeeringSpec{ - PeeringName: azure.GenerateVnetPeeringName(s.Vnet().Name, peering.RemoteVnetName), - SourceVnetName: s.Vnet().Name, - SourceResourceGroup: s.Vnet().ResourceGroup, - RemoteVnetName: peering.RemoteVnetName, - RemoteResourceGroup: peering.ResourceGroup, - SubscriptionID: s.SubscriptionID(), + PeeringName: azure.GenerateVnetPeeringName(s.Vnet().Name, peering.RemoteVnetName), + SourceVnetName: s.Vnet().Name, + SourceResourceGroup: s.Vnet().ResourceGroup, + RemoteVnetName: peering.RemoteVnetName, + RemoteResourceGroup: peering.ResourceGroup, + SubscriptionID: s.SubscriptionID(), + AllowForwardedTraffic: peering.ForwardPeeringProperties.AllowForwardedTraffic, + AllowGatewayTransit: peering.ForwardPeeringProperties.AllowGatewayTransit, + AllowVirtualNetworkAccess: peering.ForwardPeeringProperties.AllowVirtualNetworkAccess, + UseRemoteGateways: peering.ForwardPeeringProperties.UseRemoteGateways, } reversePeering := &vnetpeerings.VnetPeeringSpec{ - PeeringName: azure.GenerateVnetPeeringName(peering.RemoteVnetName, s.Vnet().Name), - SourceVnetName: peering.RemoteVnetName, - SourceResourceGroup: peering.ResourceGroup, - RemoteVnetName: s.Vnet().Name, - RemoteResourceGroup: s.Vnet().ResourceGroup, - SubscriptionID: s.SubscriptionID(), + PeeringName: azure.GenerateVnetPeeringName(peering.RemoteVnetName, s.Vnet().Name), + SourceVnetName: peering.RemoteVnetName, + SourceResourceGroup: peering.ResourceGroup, + RemoteVnetName: s.Vnet().Name, + RemoteResourceGroup: s.Vnet().ResourceGroup, + SubscriptionID: s.SubscriptionID(), + AllowForwardedTraffic: peering.ReversePeeringProperties.AllowForwardedTraffic, + AllowGatewayTransit: peering.ReversePeeringProperties.AllowGatewayTransit, + AllowVirtualNetworkAccess: peering.ReversePeeringProperties.AllowVirtualNetworkAccess, + UseRemoteGateways: peering.ReversePeeringProperties.UseRemoteGateways, } peeringSpecs[i*2] = forwardPeering peeringSpecs[i*2+1] = reversePeering @@ -789,7 +816,7 @@ func (s *ClusterScope) GenerateLegacyFQDN() (ip string, domain string) { // ListOptionsLabelSelector returns a ListOptions with a label selector for clusterName. func (s *ClusterScope) ListOptionsLabelSelector() client.ListOption { return client.MatchingLabels(map[string]string{ - clusterv1.ClusterLabelName: s.Cluster.Name, + clusterv1.ClusterNameLabel: s.Cluster.Name, }) } diff --git a/azure/scope/cluster_test.go b/azure/scope/cluster_test.go index 4bbac99a388..f3d0ae94954 100644 --- a/azure/scope/cluster_test.go +++ b/azure/scope/cluster_test.go @@ -39,6 +39,7 @@ import ( "sigs.k8s.io/cluster-api-provider-azure/azure/services/routetables" "sigs.k8s.io/cluster-api-provider-azure/azure/services/securitygroups" "sigs.k8s.io/cluster-api-provider-azure/azure/services/subnets" + "sigs.k8s.io/cluster-api-provider-azure/azure/services/vnetpeerings" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/controller-runtime/pkg/client/fake" ) @@ -2005,7 +2006,7 @@ func TestOutboundLBName(t *testing.T) { clusterName: "my-cluster", name: "public cluster node outbound lb", role: "node", - expected: "my-cluster", + expected: "", }, { clusterName: "my-cluster", @@ -3111,3 +3112,235 @@ func TestExtendedLocationType(t *testing.T) { }) } } + +func TestVNetPeerings(t *testing.T) { + fakeSubscriptionID := "123" + + tests := []struct { + name string + subscriptionID string + azureClusterVNetSpec infrav1.VnetSpec + want []azure.ResourceSpecGetter + }{ + { + name: "VNet peerings are not specified", + subscriptionID: fakeSubscriptionID, + azureClusterVNetSpec: infrav1.VnetSpec{ + ResourceGroup: "rg1", + Name: "vnet1", + }, + want: []azure.ResourceSpecGetter{}, + }, + { + name: "One VNet peering is specified", + subscriptionID: fakeSubscriptionID, + azureClusterVNetSpec: infrav1.VnetSpec{ + ResourceGroup: "rg1", + Name: "vnet1", + Peerings: infrav1.VnetPeerings{ + { + VnetPeeringClassSpec: infrav1.VnetPeeringClassSpec{ + ResourceGroup: "rg2", + RemoteVnetName: "vnet2", + }, + }, + }, + }, + want: []azure.ResourceSpecGetter{ + &vnetpeerings.VnetPeeringSpec{ + PeeringName: "vnet1-To-vnet2", + SourceResourceGroup: "rg1", + SourceVnetName: "vnet1", + RemoteResourceGroup: "rg2", + RemoteVnetName: "vnet2", + SubscriptionID: fakeSubscriptionID, + }, + &vnetpeerings.VnetPeeringSpec{ + PeeringName: "vnet2-To-vnet1", + SourceResourceGroup: "rg2", + SourceVnetName: "vnet2", + RemoteResourceGroup: "rg1", + RemoteVnetName: "vnet1", + SubscriptionID: fakeSubscriptionID, + }, + }, + }, + { + name: "One VNet peering with optional properties is specified", + subscriptionID: fakeSubscriptionID, + azureClusterVNetSpec: infrav1.VnetSpec{ + ResourceGroup: "rg1", + Name: "vnet1", + Peerings: infrav1.VnetPeerings{ + { + VnetPeeringClassSpec: infrav1.VnetPeeringClassSpec{ + ResourceGroup: "rg2", + RemoteVnetName: "vnet2", + ForwardPeeringProperties: infrav1.VnetPeeringProperties{ + AllowForwardedTraffic: pointer.Bool(true), + AllowGatewayTransit: pointer.Bool(false), + UseRemoteGateways: pointer.Bool(true), + }, + ReversePeeringProperties: infrav1.VnetPeeringProperties{ + AllowForwardedTraffic: pointer.Bool(true), + AllowGatewayTransit: pointer.Bool(true), + UseRemoteGateways: pointer.Bool(false), + }, + }, + }, + }, + }, + want: []azure.ResourceSpecGetter{ + &vnetpeerings.VnetPeeringSpec{ + PeeringName: "vnet1-To-vnet2", + SourceResourceGroup: "rg1", + SourceVnetName: "vnet1", + RemoteResourceGroup: "rg2", + RemoteVnetName: "vnet2", + SubscriptionID: fakeSubscriptionID, + AllowForwardedTraffic: pointer.Bool(true), + AllowGatewayTransit: pointer.Bool(false), + UseRemoteGateways: pointer.Bool(true), + }, + &vnetpeerings.VnetPeeringSpec{ + PeeringName: "vnet2-To-vnet1", + SourceResourceGroup: "rg2", + SourceVnetName: "vnet2", + RemoteResourceGroup: "rg1", + RemoteVnetName: "vnet1", + SubscriptionID: fakeSubscriptionID, + AllowForwardedTraffic: pointer.Bool(true), + AllowGatewayTransit: pointer.Bool(true), + UseRemoteGateways: pointer.Bool(false), + }, + }, + }, + { + name: "Two VNet peerings are specified", + subscriptionID: fakeSubscriptionID, + azureClusterVNetSpec: infrav1.VnetSpec{ + ResourceGroup: "rg1", + Name: "vnet1", + Peerings: infrav1.VnetPeerings{ + { + VnetPeeringClassSpec: infrav1.VnetPeeringClassSpec{ + ResourceGroup: "rg2", + RemoteVnetName: "vnet2", + ForwardPeeringProperties: infrav1.VnetPeeringProperties{ + AllowForwardedTraffic: pointer.Bool(true), + AllowGatewayTransit: pointer.Bool(false), + UseRemoteGateways: pointer.Bool(true), + }, + ReversePeeringProperties: infrav1.VnetPeeringProperties{ + AllowForwardedTraffic: pointer.Bool(true), + AllowGatewayTransit: pointer.Bool(true), + UseRemoteGateways: pointer.Bool(false), + }, + }, + }, + { + VnetPeeringClassSpec: infrav1.VnetPeeringClassSpec{ + ResourceGroup: "rg3", + RemoteVnetName: "vnet3", + }, + }, + }, + }, + want: []azure.ResourceSpecGetter{ + &vnetpeerings.VnetPeeringSpec{ + PeeringName: "vnet1-To-vnet2", + SourceResourceGroup: "rg1", + SourceVnetName: "vnet1", + RemoteResourceGroup: "rg2", + RemoteVnetName: "vnet2", + SubscriptionID: fakeSubscriptionID, + AllowForwardedTraffic: pointer.Bool(true), + AllowGatewayTransit: pointer.Bool(false), + UseRemoteGateways: pointer.Bool(true), + }, + &vnetpeerings.VnetPeeringSpec{ + PeeringName: "vnet2-To-vnet1", + SourceResourceGroup: "rg2", + SourceVnetName: "vnet2", + RemoteResourceGroup: "rg1", + RemoteVnetName: "vnet1", + SubscriptionID: fakeSubscriptionID, + AllowForwardedTraffic: pointer.Bool(true), + AllowGatewayTransit: pointer.Bool(true), + UseRemoteGateways: pointer.Bool(false), + }, + &vnetpeerings.VnetPeeringSpec{ + PeeringName: "vnet1-To-vnet3", + SourceResourceGroup: "rg1", + SourceVnetName: "vnet1", + RemoteResourceGroup: "rg3", + RemoteVnetName: "vnet3", + SubscriptionID: fakeSubscriptionID, + }, + &vnetpeerings.VnetPeeringSpec{ + PeeringName: "vnet3-To-vnet1", + SourceResourceGroup: "rg3", + SourceVnetName: "vnet3", + RemoteResourceGroup: "rg1", + RemoteVnetName: "vnet1", + SubscriptionID: fakeSubscriptionID, + }, + }, + }, + } + + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + g := NewWithT(t) + scheme := runtime.NewScheme() + _ = infrav1.AddToScheme(scheme) + _ = clusterv1.AddToScheme(scheme) + clusterName := "my-cluster" + clusterNamespace := "default" + + cluster := &clusterv1.Cluster{ + ObjectMeta: metav1.ObjectMeta{ + Name: clusterName, + Namespace: clusterNamespace, + }, + } + azureCluster := &infrav1.AzureCluster{ + ObjectMeta: metav1.ObjectMeta{ + Name: clusterName, + Namespace: clusterNamespace, + OwnerReferences: []metav1.OwnerReference{ + { + APIVersion: "cluster.x-k8s.io/v1beta1", + Kind: "Cluster", + Name: clusterName, + }, + }, + }, + Spec: infrav1.AzureClusterSpec{ + ResourceGroup: "rg1", + AzureClusterClassSpec: infrav1.AzureClusterClassSpec{ + SubscriptionID: tc.subscriptionID, + }, + NetworkSpec: infrav1.NetworkSpec{ + Vnet: tc.azureClusterVNetSpec, + }, + }, + } + + initObjects := []runtime.Object{cluster, azureCluster} + fakeClient := fake.NewClientBuilder().WithScheme(scheme).WithRuntimeObjects(initObjects...).Build() + + clusterScope, err := NewClusterScope(context.TODO(), ClusterScopeParams{ + AzureClients: AzureClients{ + Authorizer: autorest.NullAuthorizer{}, + }, + Cluster: cluster, + AzureCluster: azureCluster, + Client: fakeClient, + }) + g.Expect(err).NotTo(HaveOccurred()) + got := clusterScope.VnetPeeringSpecs() + g.Expect(tc.want).To(Equal(got)) + }) + } +} diff --git a/azure/scope/identity.go b/azure/scope/identity.go index b43f5ff1b1e..e9ee0eb31b3 100644 --- a/azure/scope/identity.go +++ b/azure/scope/identity.go @@ -250,9 +250,9 @@ func createAzureIdentityWithBindings(ctx context.Context, azureIdentity *infrav1 aadpodv1.BehaviorKey: "namespaced", }, Labels: map[string]string{ - clusterv1.ClusterLabelName: clusterMeta.Name, - infrav1.ClusterLabelNamespace: clusterMeta.Namespace, - clusterctl.ClusterctlMoveHierarchyLabelName: "true", + clusterv1.ClusterNameLabel: clusterMeta.Name, + infrav1.ClusterLabelNamespace: clusterMeta.Namespace, + clusterctl.ClusterctlMoveHierarchyLabel: "true", }, }, Spec: aadpodv1.AzureIdentitySpec{ @@ -279,9 +279,9 @@ func createAzureIdentityWithBindings(ctx context.Context, azureIdentity *infrav1 Name: fmt.Sprintf("%s-binding", copiedIdentity.Name), Namespace: copiedIdentity.Namespace, Labels: map[string]string{ - clusterv1.ClusterLabelName: clusterMeta.Name, - infrav1.ClusterLabelNamespace: clusterMeta.Namespace, - clusterctl.ClusterctlMoveHierarchyLabelName: "true", + clusterv1.ClusterNameLabel: clusterMeta.Name, + infrav1.ClusterLabelNamespace: clusterMeta.Namespace, + clusterctl.ClusterctlMoveHierarchyLabel: "true", }, }, Spec: aadpodv1.AzureIdentityBindingSpec{ diff --git a/azure/scope/machine.go b/azure/scope/machine.go index da5586a136c..e8e7a94e555 100644 --- a/azure/scope/machine.go +++ b/azure/scope/machine.go @@ -504,12 +504,12 @@ func (m *MachineScope) AvailabilitySet() (string, bool) { } // get machine deployment name from labels for machines that maybe part of a machine deployment. - if mdName, ok := m.Machine.Labels[clusterv1.MachineDeploymentLabelName]; ok { + if mdName, ok := m.Machine.Labels[clusterv1.MachineDeploymentNameLabel]; ok { return azure.GenerateAvailabilitySetName(m.ClusterName(), mdName), true } // if machine deployment name label is not available, use machine set name. - if msName, ok := m.Machine.Labels[clusterv1.MachineSetLabelName]; ok { + if msName, ok := m.Machine.Labels[clusterv1.MachineSetNameLabel]; ok { return azure.GenerateAvailabilitySetName(m.ClusterName(), msName), true } diff --git a/azure/scope/machine_test.go b/azure/scope/machine_test.go index 11fce00def1..c0b83cab3dd 100644 --- a/azure/scope/machine_test.go +++ b/azure/scope/machine_test.go @@ -360,7 +360,7 @@ func TestMachineScope_InboundNatSpecs(t *testing.T) { Machine: &clusterv1.Machine{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ - clusterv1.MachineControlPlaneLabelName: "", + clusterv1.MachineControlPlaneLabel: "", }, }, }, @@ -1091,7 +1091,7 @@ func TestMachineScope_IsControlPlane(t *testing.T) { Machine: &clusterv1.Machine{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ - clusterv1.MachineControlPlaneLabelName: "", + clusterv1.MachineControlPlaneLabel: "", }, }, }, @@ -1137,7 +1137,7 @@ func TestMachineScope_Role(t *testing.T) { Machine: &clusterv1.Machine{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ - clusterv1.MachineControlPlaneLabelName: "", + clusterv1.MachineControlPlaneLabel: "", }, }, }, @@ -1205,7 +1205,7 @@ func TestMachineScope_AvailabilitySet(t *testing.T) { Machine: &clusterv1.Machine{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ - clusterv1.MachineControlPlaneLabelName: "", + clusterv1.MachineControlPlaneLabel: "", }, }, }, @@ -1230,7 +1230,7 @@ func TestMachineScope_AvailabilitySet(t *testing.T) { Machine: &clusterv1.Machine{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ - clusterv1.MachineDeploymentLabelName: "foo-machine-deployment", + clusterv1.MachineDeploymentNameLabel: "foo-machine-deployment", }, }, }, @@ -1255,7 +1255,7 @@ func TestMachineScope_AvailabilitySet(t *testing.T) { Machine: &clusterv1.Machine{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ - clusterv1.MachineSetLabelName: "foo-machine-set", + clusterv1.MachineSetNameLabel: "foo-machine-set", }, }, }, @@ -1280,8 +1280,8 @@ func TestMachineScope_AvailabilitySet(t *testing.T) { Machine: &clusterv1.Machine{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ - clusterv1.MachineDeploymentLabelName: "foo-machine-deployment", - clusterv1.MachineSetLabelName: "foo-machine-set", + clusterv1.MachineDeploymentNameLabel: "foo-machine-deployment", + clusterv1.MachineSetNameLabel: "foo-machine-set", }, }, }, @@ -1736,7 +1736,7 @@ func TestMachineScope_NICSpecs(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "machine", Labels: map[string]string{ - // clusterv1.MachineControlPlaneLabelName: "true", + // clusterv1.MachineControlPlaneLabel: "true", }, }, }, @@ -1840,7 +1840,7 @@ func TestMachineScope_NICSpecs(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "machine", Labels: map[string]string{ - // clusterv1.MachineControlPlaneLabelName: "true", + // clusterv1.MachineControlPlaneLabel: "true", }, }, }, @@ -1956,7 +1956,7 @@ func TestMachineScope_NICSpecs(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "machine", Labels: map[string]string{ - // clusterv1.MachineControlPlaneLabelName: "true", + // clusterv1.MachineControlPlaneLabel: "true", }, }, }, @@ -2061,7 +2061,7 @@ func TestMachineScope_NICSpecs(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "machine", Labels: map[string]string{ - // clusterv1.MachineControlPlaneLabelName: "true", + // clusterv1.MachineControlPlaneLabel: "true", }, }, }, @@ -2171,7 +2171,7 @@ func TestMachineScope_NICSpecs(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "machine", Labels: map[string]string{ - clusterv1.MachineControlPlaneLabelName: "true", + clusterv1.MachineControlPlaneLabel: "true", }, }, }, @@ -2278,7 +2278,7 @@ func TestMachineScope_NICSpecs(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "machine", Labels: map[string]string{ - clusterv1.MachineControlPlaneLabelName: "true", + clusterv1.MachineControlPlaneLabel: "true", }, }, }, @@ -2386,7 +2386,7 @@ func TestMachineScope_NICSpecs(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "machine", Labels: map[string]string{ - clusterv1.MachineControlPlaneLabelName: "true", + clusterv1.MachineControlPlaneLabel: "true", }, }, }, diff --git a/azure/scope/machinepool.go b/azure/scope/machinepool.go index acd34212844..418267c0582 100644 --- a/azure/scope/machinepool.go +++ b/azure/scope/machinepool.go @@ -24,7 +24,7 @@ import ( "io" "strings" - azureautorest "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,6 +140,7 @@ func (m *MachinePoolScope) ScaleSetSpec() azure.ScaleSetSpec { FailureDomains: m.MachinePool.Spec.FailureDomains, TerminateNotificationTimeout: m.AzureMachinePool.Spec.Template.TerminateNotificationTimeout, NetworkInterfaces: m.AzureMachinePool.Spec.Template.NetworkInterfaces, + IPv6Enabled: m.IsIPv6Enabled(), OrchestrationMode: m.AzureMachinePool.Spec.OrchestrationMode, } } @@ -269,7 +270,7 @@ func (m *MachinePoolScope) getMachinePoolMachines(ctx context.Context) ([]infrav defer done() labels := map[string]string{ - clusterv1.ClusterLabelName: m.ClusterName(), + clusterv1.ClusterNameLabel: m.ClusterName(), infrav1exp.MachinePoolNameLabel: m.AzureMachinePool.Name, } ampml := &infrav1exp.AzureMachinePoolMachineList{} @@ -290,7 +291,7 @@ func (m *MachinePoolScope) applyAzureMachinePoolMachines(ctx context.Context) er } labels := map[string]string{ - clusterv1.ClusterLabelName: m.ClusterName(), + clusterv1.ClusterNameLabel: m.ClusterName(), infrav1exp.MachinePoolNameLabel: m.AzureMachinePool.Name, } ampml := &infrav1exp.AzureMachinePoolMachineList{} @@ -377,11 +378,11 @@ func (m *MachinePoolScope) createMachine(ctx context.Context, machine azure.VMSS ctx, _, done := tele.StartSpanWithLogger(ctx, "scope.MachinePoolScope.createMachine") defer done() - parsed, err := azureautorest.ParseResourceID(machine.ID) + parsed, err := arm.ParseResourceID(machine.ID) if err != nil { return errors.Wrap(err, fmt.Sprintf("failed to parse resource id %q", machine.ID)) } - instanceID := strings.ReplaceAll(parsed.ResourceName, "_", "-") + instanceID := strings.ReplaceAll(parsed.Name, "_", "-") ampm := infrav1exp.AzureMachinePoolMachine{ ObjectMeta: metav1.ObjectMeta{ @@ -398,7 +399,7 @@ func (m *MachinePoolScope) createMachine(ctx context.Context, machine azure.VMSS }, Labels: map[string]string{ m.ClusterName(): string(infrav1.ResourceLifecycleOwned), - clusterv1.ClusterLabelName: m.ClusterName(), + clusterv1.ClusterNameLabel: m.ClusterName(), infrav1exp.MachinePoolNameLabel: m.AzureMachinePool.Name, }, }, diff --git a/azure/scope/machinepool_test.go b/azure/scope/machinepool_test.go index 07a4d3229c7..6030fd319fc 100644 --- a/azure/scope/machinepool_test.go +++ b/azure/scope/machinepool_test.go @@ -596,7 +596,7 @@ func TestMachinePoolScope_updateReplicasAndProviderIDs(t *testing.T) { Name: "should only count machines with matching cluster name label", Setup: func(cb *fake.ClientBuilder) { machines := getReadyAzureMachinePoolMachines(3) - machines[0].Labels[clusterv1.ClusterLabelName] = "not_correct" + machines[0].Labels[clusterv1.ClusterNameLabel] = "not_correct" for _, machine := range machines { obj := machine cb.WithObjects(&obj) @@ -1111,7 +1111,7 @@ func getReadyAzureMachinePoolMachines(count int32) []infrav1exp.AzureMachinePool }, }, Labels: map[string]string{ - clusterv1.ClusterLabelName: "cluster1", + clusterv1.ClusterNameLabel: "cluster1", infrav1exp.MachinePoolNameLabel: "amp1", }, }, diff --git a/azure/scope/machinepoolmachine.go b/azure/scope/machinepoolmachine.go index 64664bcb5fd..e8d81843841 100644 --- a/azure/scope/machinepoolmachine.go +++ b/azure/scope/machinepoolmachine.go @@ -31,6 +31,7 @@ import ( "k8s.io/utils/pointer" infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" "sigs.k8s.io/cluster-api-provider-azure/azure" + "sigs.k8s.io/cluster-api-provider-azure/azure/converters" infrav1exp "sigs.k8s.io/cluster-api-provider-azure/exp/api/v1beta1" "sigs.k8s.io/cluster-api-provider-azure/util/futures" "sigs.k8s.io/cluster-api-provider-azure/util/tele" @@ -542,6 +543,16 @@ func (s *MachinePoolMachineScope) hasLatestModelApplied(ctx context.Context) (bo return false, errors.New("machinepoolscope image must not be nil") } + // check if image.ID is actually a compute gallery image + if s.instance.Image.ComputeGallery != nil && image.ID != nil { + newImage := converters.IDImageRefToImage(*image.ID) + + // this means the ID was a compute gallery image ID + if newImage.ComputeGallery != nil { + return reflect.DeepEqual(s.instance.Image, newImage), nil + } + } + // if the images match, then the VM is of the same model return reflect.DeepEqual(s.instance.Image, *image), nil } diff --git a/azure/scope/managedcontrolplane.go b/azure/scope/managedcontrolplane.go index 6907e42bb7d..66678df642c 100644 --- a/azure/scope/managedcontrolplane.go +++ b/azure/scope/managedcontrolplane.go @@ -30,6 +30,7 @@ import ( "k8s.io/utils/pointer" infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" "sigs.k8s.io/cluster-api-provider-azure/azure" + "sigs.k8s.io/cluster-api-provider-azure/azure/services/asogroups" "sigs.k8s.io/cluster-api-provider-azure/azure/services/groups" "sigs.k8s.io/cluster-api-provider-azure/azure/services/managedclusters" "sigs.k8s.io/cluster-api-provider-azure/azure/services/privateendpoints" @@ -73,7 +74,7 @@ func NewManagedControlPlaneScope(ctx context.Context, params ManagedControlPlane } if params.ControlPlane.Spec.IdentityRef == nil { - if err := params.AzureClients.setCredentials(params.ControlPlane.Spec.SubscriptionID, ""); err != nil { + if err := params.AzureClients.setCredentials(params.ControlPlane.Spec.SubscriptionID, params.ControlPlane.Spec.AzureEnvironment); err != nil { return nil, errors.Wrap(err, "failed to create Azure session") } } else { @@ -82,7 +83,7 @@ func NewManagedControlPlaneScope(ctx context.Context, params ManagedControlPlane return nil, errors.Wrap(err, "failed to init credentials provider") } - if err := params.AzureClients.setCredentialsWithProvider(ctx, params.ControlPlane.Spec.SubscriptionID, "", credentialsProvider); err != nil { + if err := params.AzureClients.setCredentialsWithProvider(ctx, params.ControlPlane.Spec.SubscriptionID, params.ControlPlane.Spec.AzureEnvironment, credentialsProvider); err != nil { return nil, errors.Wrap(err, "failed to configure azure settings and credentials for Identity") } } @@ -125,6 +126,11 @@ type ManagedControlPlaneCache struct { isVnetManaged *bool } +// GetClient returns the controller-runtime client. +func (s *ManagedControlPlaneScope) GetClient() client.Client { + return s.Client +} + // ResourceGroup returns the managed control plane's resource group. func (s *ManagedControlPlaneScope) ResourceGroup() string { if s.ControlPlane == nil { @@ -248,6 +254,18 @@ func (s *ManagedControlPlaneScope) GroupSpec() azure.ResourceSpecGetter { } } +// ASOGroupSpec returns the resource group spec. +func (s *ManagedControlPlaneScope) ASOGroupSpec() azure.ASOResourceSpecGetter { + return &asogroups.GroupSpec{ + Name: s.ResourceGroup(), + Namespace: s.Cluster.Namespace, + Location: s.Location(), + ClusterName: s.ClusterName(), + AdditionalTags: s.AdditionalTags(), + Owner: *metav1.NewControllerRef(s.ControlPlane, infrav1.GroupVersion.WithKind("AzureManagedControlPlane")), + } +} + // VNetSpec returns the virtual network spec. func (s *ManagedControlPlaneScope) VNetSpec() azure.ResourceSpecGetter { return &virtualnetworks.VNetSpec{ @@ -578,12 +596,8 @@ func (s *ManagedControlPlaneScope) GetAllAgentPoolSpecs() ([]azure.ResourceSpecG // SetControlPlaneEndpoint sets a control plane endpoint. func (s *ManagedControlPlaneScope) SetControlPlaneEndpoint(endpoint clusterv1.APIEndpoint) { - if s.ControlPlane.Spec.ControlPlaneEndpoint.Host == "" { - s.ControlPlane.Spec.ControlPlaneEndpoint.Host = endpoint.Host - } - if s.ControlPlane.Spec.ControlPlaneEndpoint.Port == 0 { - s.ControlPlane.Spec.ControlPlaneEndpoint.Port = endpoint.Port - } + s.ControlPlane.Spec.ControlPlaneEndpoint.Host = endpoint.Host + s.ControlPlane.Spec.ControlPlaneEndpoint.Port = endpoint.Port } // MakeEmptyKubeConfigSecret creates an empty secret object that is used for storing kubeconfig secret data. diff --git a/azure/scope/managedmachinepool.go b/azure/scope/managedmachinepool.go index eb23772a45e..9e4b6cc5cb5 100644 --- a/azure/scope/managedmachinepool.go +++ b/azure/scope/managedmachinepool.go @@ -134,11 +134,23 @@ func (s *ManagedMachinePoolScope) Name() string { return s.InfraMachinePool.Name } +// SetSubnetName updates AzureManagedMachinePool.SubnetName if AzureManagedMachinePool.SubnetName is empty with s.ControlPlane.Spec.VirtualNetwork.Subnet.Name. +func (s *ManagedMachinePoolScope) SetSubnetName() { + s.InfraMachinePool.Spec.SubnetName = getAgentPoolSubnet(s.ControlPlane, s.InfraMachinePool) +} + // AgentPoolSpec returns an azure.ResourceSpecGetter for currently reconciled AzureManagedMachinePool. func (s *ManagedMachinePoolScope) AgentPoolSpec() azure.ResourceSpecGetter { return buildAgentPoolSpec(s.ControlPlane, s.MachinePool, s.InfraMachinePool, s.AgentPoolAnnotations()) } +func getAgentPoolSubnet(controlPlane *infrav1.AzureManagedControlPlane, infraMachinePool *infrav1.AzureManagedMachinePool) *string { + if infraMachinePool.Spec.SubnetName == nil { + return pointer.String(controlPlane.Spec.VirtualNetwork.Subnet.Name) + } + return infraMachinePool.Spec.SubnetName +} + func buildAgentPoolSpec(managedControlPlane *infrav1.AzureManagedControlPlane, machinePool *expv1.MachinePool, managedMachinePool *infrav1.AzureManagedMachinePool, @@ -166,7 +178,7 @@ func buildAgentPoolSpec(managedControlPlane *infrav1.AzureManagedControlPlane, managedControlPlane.Spec.SubscriptionID, managedControlPlane.Spec.VirtualNetwork.ResourceGroup, managedControlPlane.Spec.VirtualNetwork.Name, - managedControlPlane.Spec.VirtualNetwork.Subnet.Name, + pointer.StringDeref(getAgentPoolSubnet(managedControlPlane, managedMachinePool), ""), ), Mode: managedMachinePool.Spec.Mode, MaxPods: managedMachinePool.Spec.MaxPods, diff --git a/azure/scope/managedmachinepool_test.go b/azure/scope/managedmachinepool_test.go index 6723e51d141..971f07ee6b2 100644 --- a/azure/scope/managedmachinepool_test.go +++ b/azure/scope/managedmachinepool_test.go @@ -623,6 +623,148 @@ func TestManagedMachinePoolScope_OSDiskType(t *testing.T) { } } +func TestManagedMachinePoolScope_SubnetName(t *testing.T) { + scheme := runtime.NewScheme() + _ = expv1.AddToScheme(scheme) + _ = infrav1.AddToScheme(scheme) + + cases := []struct { + Name string + Input ManagedMachinePoolScopeParams + Expected azure.ResourceSpecGetter + }{ + { + Name: "Without Vnet and SubnetName", + Input: ManagedMachinePoolScopeParams{ + Cluster: &clusterv1.Cluster{ + ObjectMeta: metav1.ObjectMeta{ + Name: "cluster1", + Namespace: "default", + }, + }, + ControlPlane: &infrav1.AzureManagedControlPlane{ + ObjectMeta: metav1.ObjectMeta{ + Name: "cluster1", + Namespace: "default", + }, + Spec: infrav1.AzureManagedControlPlaneSpec{ + SubscriptionID: "00000000-0000-0000-0000-000000000000", + }, + }, + ManagedMachinePool: ManagedMachinePool{ + MachinePool: getMachinePool("pool0"), + InfraMachinePool: getAzureMachinePool("pool0", infrav1.NodePoolModeSystem), + }, + }, + Expected: &agentpools.AgentPoolSpec{ + Name: "pool0", + SKU: "Standard_D2s_v3", + Replicas: 1, + Mode: "System", + Cluster: "cluster1", + VnetSubnetID: "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups//providers/Microsoft.Network/virtualNetworks//subnets/", + Headers: map[string]string{}, + }, + }, + { + Name: "With Vnet and Without SubnetName", + Input: ManagedMachinePoolScopeParams{ + Cluster: &clusterv1.Cluster{ + ObjectMeta: metav1.ObjectMeta{ + Name: "cluster1", + Namespace: "default", + }, + }, + ControlPlane: &infrav1.AzureManagedControlPlane{ + ObjectMeta: metav1.ObjectMeta{ + Name: "cluster1", + Namespace: "default", + }, + Spec: infrav1.AzureManagedControlPlaneSpec{ + SubscriptionID: "00000000-0000-0000-0000-000000000000", + VirtualNetwork: infrav1.ManagedControlPlaneVirtualNetwork{ + Name: "my-vnet", + Subnet: infrav1.ManagedControlPlaneSubnet{ + Name: "my-vnet-subnet", + }, + ResourceGroup: "my-resource-group", + }, + }, + }, + ManagedMachinePool: ManagedMachinePool{ + MachinePool: getMachinePool("pool1"), + InfraMachinePool: getAzureMachinePool("pool1", infrav1.NodePoolModeUser), + }, + }, + Expected: &agentpools.AgentPoolSpec{ + Name: "pool1", + SKU: "Standard_D2s_v3", + Mode: "User", + Cluster: "cluster1", + Replicas: 1, + VnetSubnetID: "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.Network/virtualNetworks/my-vnet/subnets/my-vnet-subnet", + Headers: map[string]string{}, + }, + }, + { + Name: "With Vnet and With SubnetName", + Input: ManagedMachinePoolScopeParams{ + Cluster: &clusterv1.Cluster{ + ObjectMeta: metav1.ObjectMeta{ + Name: "cluster1", + Namespace: "default", + }, + }, + ControlPlane: &infrav1.AzureManagedControlPlane{ + ObjectMeta: metav1.ObjectMeta{ + Name: "cluster1", + Namespace: "default", + }, + Spec: infrav1.AzureManagedControlPlaneSpec{ + SubscriptionID: "00000000-0000-0000-0000-000000000000", + VirtualNetwork: infrav1.ManagedControlPlaneVirtualNetwork{ + Name: "my-vnet", + Subnet: infrav1.ManagedControlPlaneSubnet{ + Name: "my-vnet-subnet", + }, + ResourceGroup: "my-resource-group", + }, + }, + }, + ManagedMachinePool: ManagedMachinePool{ + MachinePool: getMachinePool("pool1"), + InfraMachinePool: getAzureMachinePoolWithSubnetName("pool1", pointer.String("my-subnet")), + }, + }, + Expected: &agentpools.AgentPoolSpec{ + Name: "pool1", + SKU: "Standard_D2s_v3", + Mode: "User", + Cluster: "cluster1", + Replicas: 1, + VnetSubnetID: "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.Network/virtualNetworks/my-vnet/subnets/my-subnet", + Headers: map[string]string{}, + }, + }, + } + + for _, c := range cases { + c := c + t.Run(c.Name, func(t *testing.T) { + g := NewWithT(t) + fakeClient := fake.NewClientBuilder().WithScheme(scheme).WithObjects(c.Input.MachinePool, c.Input.InfraMachinePool, c.Input.ControlPlane).Build() + c.Input.Client = fakeClient + s, err := NewManagedMachinePoolScope(context.TODO(), c.Input) + g.Expect(err).To(Succeed()) + s.SetSubnetName() + agentPool := s.AgentPoolSpec() + if !reflect.DeepEqual(c.Expected, agentPool) { + t.Errorf("Got difference between expected result and result:\n%s", cmp.Diff(c.Expected, agentPool)) + } + }) + } +} + func TestManagedMachinePoolScope_KubeletDiskType(t *testing.T) { scheme := runtime.NewScheme() _ = expv1.AddToScheme(scheme) @@ -724,7 +866,7 @@ func getAzureMachinePool(name string, mode infrav1.NodePoolMode) *infrav1.AzureM Name: name, Namespace: "default", Labels: map[string]string{ - clusterv1.ClusterLabelName: "cluster1", + clusterv1.ClusterNameLabel: "cluster1", }, OwnerReferences: []metav1.OwnerReference{ { @@ -763,6 +905,12 @@ func getAzureMachinePoolWithTaints(name string, taints infrav1.Taints) *infrav1. return managedPool } +func getAzureMachinePoolWithSubnetName(name string, subnetName *string) *infrav1.AzureManagedMachinePool { + managedPool := getAzureMachinePool(name, infrav1.NodePoolModeUser) + managedPool.Spec.SubnetName = subnetName + return managedPool +} + func getAzureMachinePoolWithOsDiskType(name string, osDiskType string) *infrav1.AzureManagedMachinePool { managedPool := getAzureMachinePool(name, infrav1.NodePoolModeUser) managedPool.Spec.OsDiskType = pointer.String(osDiskType) @@ -793,7 +941,7 @@ func getMachinePool(name string) *expv1.MachinePool { Name: name, Namespace: "default", Labels: map[string]string{ - clusterv1.ClusterLabelName: "cluster1", + clusterv1.ClusterNameLabel: "cluster1", }, }, Spec: expv1.MachinePoolSpec{ diff --git a/azure/scope/strategies/machinepool_deployments/machinepool_deployment_strategy.go b/azure/scope/strategies/machinepool_deployments/machinepool_deployment_strategy.go index c1e25ab020f..607d9bab9e1 100644 --- a/azure/scope/strategies/machinepool_deployments/machinepool_deployment_strategy.go +++ b/azure/scope/strategies/machinepool_deployments/machinepool_deployment_strategy.go @@ -290,8 +290,9 @@ func orderByOldest(machines []infrav1exp.AzureMachinePoolMachine) []infrav1exp.A } func orderRandom(machines []infrav1exp.AzureMachinePoolMachine) []infrav1exp.AzureMachinePoolMachine { - rand.Seed(time.Now().UnixNano()) - rand.Shuffle(len(machines), func(i, j int) { machines[i], machines[j] = machines[j], machines[i] }) + //nolint:gosec // We don't need a cryptographically appropriate random number here + r := rand.New(rand.NewSource(time.Now().UnixNano())) + r.Shuffle(len(machines), func(i, j int) { machines[i], machines[j] = machines[j], machines[i] }) return machines } diff --git a/azure/services/agentpools/agentpools.go b/azure/services/agentpools/agentpools.go index 9361c29cff2..f4b1bba6359 100644 --- a/azure/services/agentpools/agentpools.go +++ b/azure/services/agentpools/agentpools.go @@ -46,6 +46,7 @@ type AgentPoolScope interface { SetCAPIMachinePoolReplicas(replicas *int32) SetCAPIMachinePoolAnnotation(key, value string) RemoveCAPIMachinePoolAnnotation(key string) + SetSubnetName() } // Service provides operations on Azure resources. diff --git a/azure/services/agentpools/mock_agentpools/agentpools_mock.go b/azure/services/agentpools/mock_agentpools/agentpools_mock.go index 91eefee9fa9..c9e0d6f3061 100644 --- a/azure/services/agentpools/mock_agentpools/agentpools_mock.go +++ b/azure/services/agentpools/mock_agentpools/agentpools_mock.go @@ -443,6 +443,18 @@ func (mr *MockAgentPoolScopeMockRecorder) SetLongRunningOperationState(arg0 inte return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetLongRunningOperationState", reflect.TypeOf((*MockAgentPoolScope)(nil).SetLongRunningOperationState), arg0) } +// SetSubnetName mocks base method. +func (m *MockAgentPoolScope) SetSubnetName() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetSubnetName") +} + +// SetSubnetName indicates an expected call of SetSubnetName. +func (mr *MockAgentPoolScopeMockRecorder) SetSubnetName() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetSubnetName", reflect.TypeOf((*MockAgentPoolScope)(nil).SetSubnetName)) +} + // SubscriptionID mocks base method. func (m *MockAgentPoolScope) SubscriptionID() string { m.ctrl.T.Helper() diff --git a/azure/services/agentpools/spec.go b/azure/services/agentpools/spec.go index 595f1ff4e2d..7f3821fa84d 100644 --- a/azure/services/agentpools/spec.go +++ b/azure/services/agentpools/spec.go @@ -265,6 +265,11 @@ func (s *AgentPoolSpec) Parameters(ctx context.Context, existing interface{}) (p if s.SKU != "" { sku = &s.SKU } + tags := converters.TagsToMap(s.AdditionalTags) + if tags == nil { + // Make sure we send a non-nil, empty map if AdditionalTags are nil as this tells AKS to delete any existing tags. + tags = make(map[string]*string, 0) + } var vnetSubnetID *string if s.VnetSubnetID != "" { vnetSubnetID = &s.VnetSubnetID @@ -352,7 +357,7 @@ func (s *AgentPoolSpec) Parameters(ctx context.Context, existing interface{}) (p VnetSubnetID: vnetSubnetID, EnableNodePublicIP: s.EnableNodePublicIP, NodePublicIPPrefixID: s.NodePublicIPPrefixID, - Tags: *azure.StringMapPtr(s.AdditionalTags), + Tags: tags, LinuxOSConfig: linuxOSConfig, }, } diff --git a/azure/services/aso/aso.go b/azure/services/aso/aso.go new file mode 100644 index 00000000000..01f8cf34691 --- /dev/null +++ b/azure/services/aso/aso.go @@ -0,0 +1,190 @@ +/* +Copyright 2023 The Kubernetes Authors. + +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 aso + +import ( + "context" + "fmt" + "time" + + "github.com/Azure/azure-service-operator/v2/pkg/genruntime" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime/conditions" + "github.com/google/go-cmp/cmp" + "github.com/pkg/errors" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" + "sigs.k8s.io/cluster-api-provider-azure/azure" + "sigs.k8s.io/cluster-api-provider-azure/util/tele" + "sigs.k8s.io/cluster-api/util/patch" + "sigs.k8s.io/controller-runtime/pkg/client" +) + +const ( + requeueInterval = 20 * time.Second + + createOrUpdateFutureType = "ASOCreateOrUpdate" + deleteFutureType = "ASODelete" +) + +// Service is an implementation of the Reconciler interface. It handles creation +// and deletion of resources using ASO. +type Service struct { + client.Client +} + +// New creates a new ASO service. +func New(ctrlClient client.Client) *Service { + return &Service{ + Client: ctrlClient, + } +} + +// CreateOrUpdateResource implements the logic for creating a new or updating an +// existing resource with ASO. +func (s *Service) CreateOrUpdateResource(ctx context.Context, spec azure.ASOResourceSpecGetter, serviceName string) (result genruntime.MetaObject, err error) { + ctx, log, done := tele.StartSpanWithLogger(ctx, "aso.Service.CreateOrUpdateResource") + defer done() + + resource := spec.ResourceRef() + resourceName := resource.GetName() + resourceNamespace := resource.GetNamespace() + + log = log.WithValues("service", serviceName, "resource", resourceName, "namespace", resourceNamespace) + + var existing genruntime.MetaObject + if err := s.Client.Get(ctx, client.ObjectKeyFromObject(resource), resource); err != nil { + if !apierrors.IsNotFound(err) { + return nil, errors.Wrapf(err, "failed to get existing resource %s/%s (service: %s)", resourceNamespace, resourceName, serviceName) + } + } else { + existing = resource + log.V(2).Info("successfully got existing resource") + + // Check if there is an ongoing long running operation. + conds := existing.GetConditions() + i, readyExists := conds.FindIndexByType(conditions.ConditionTypeReady) + if !readyExists { + return nil, azure.WithTransientError(errors.New("ready status unknown"), requeueInterval) + } + var readyErr error + if cond := conds[i]; cond.Status != metav1.ConditionTrue { + switch { + case cond.Reason == conditions.ReasonReconciling.Name: + readyErr = azure.NewOperationNotDoneError(&infrav1.Future{ + Type: createOrUpdateFutureType, + ResourceGroup: existing.GetNamespace(), + Name: existing.GetName(), + }) + default: + readyErr = fmt.Errorf("resource is not Ready: %s", conds[i].Message) + } + + if readyErr != nil { + if conds[i].Severity == conditions.ConditionSeverityError { + return nil, azure.WithTerminalError(readyErr) + } + return nil, azure.WithTransientError(readyErr, requeueInterval) + } + } + } + + // Construct parameters using the resource spec and information from the existing resource, if there is one. + parameters, err := spec.Parameters(ctx, deepCopyOrNil(existing)) + if err != nil { + return nil, errors.Wrapf(err, "failed to get desired parameters for resource %s/%s (service: %s)", resourceNamespace, resourceName, serviceName) + } + // a nil result here is a special case for compatibility with the old + // SDK-driven service implementations. + if parameters == nil { + if existing == nil { + return nil, errors.New("parameters cannot be nil if no object already exists") + } + parameters = existing.DeepCopyObject().(genruntime.MetaObject) + } + + parameters.SetName(resourceName) + parameters.SetNamespace(resourceNamespace) + + diff := cmp.Diff(existing, parameters) + if diff == "" { + log.V(2).Info("resource up to date") + return existing, nil + } + + // Create or update the resource with the desired parameters. + logMessageVerbPrefix := "creat" + if existing != nil { + logMessageVerbPrefix = "updat" + } + log.V(2).Info(logMessageVerbPrefix+"ing resource", "diff", diff) + if existing != nil { + var helper *patch.Helper + helper, err = patch.NewHelper(existing, s.Client) + if err != nil { + return nil, errors.Errorf("failed to init patch helper: %v", err) + } + err = helper.Patch(ctx, parameters) + } else { + err = s.Client.Create(ctx, parameters) + } + if err == nil { + // Resources need to be requeued to wait for the create or update to finish. + return nil, azure.WithTransientError(azure.NewOperationNotDoneError(&infrav1.Future{ + Type: createOrUpdateFutureType, + ResourceGroup: resourceNamespace, + Name: resourceName, + }), requeueInterval) + } + return nil, errors.Wrapf(err, fmt.Sprintf("failed to %se resource %s/%s (service: %s)", logMessageVerbPrefix, resourceNamespace, resourceName, serviceName)) +} + +// DeleteResource implements the logic for deleting a resource Asynchronously. +func (s *Service) DeleteResource(ctx context.Context, spec azure.ASOResourceSpecGetter, serviceName string) (err error) { + ctx, log, done := tele.StartSpanWithLogger(ctx, "aso.Service.DeleteResource") + defer done() + + resource := spec.ResourceRef() + resourceName := resource.GetName() + resourceNamespace := resource.GetNamespace() + + log = log.WithValues("service", serviceName, "resource", resourceName, "namespace", resourceNamespace) + + log.V(2).Info("deleting resource") + err = s.Client.Delete(ctx, resource) + if err != nil { + if apierrors.IsNotFound(err) { + // already deleted + log.V(2).Info("successfully deleted resource") + return nil + } + return errors.Wrapf(err, "failed to delete resource %s/%s (service: %s)", resourceNamespace, resourceName, serviceName) + } + + return azure.WithTransientError(azure.NewOperationNotDoneError(&infrav1.Future{ + Type: deleteFutureType, + ResourceGroup: resourceNamespace, + Name: resourceName, + }), requeueInterval) +} + +func deepCopyOrNil(obj genruntime.MetaObject) genruntime.MetaObject { + if obj == nil { + return nil + } + return obj.DeepCopyObject().(genruntime.MetaObject) +} diff --git a/azure/services/aso/aso_test.go b/azure/services/aso/aso_test.go new file mode 100644 index 00000000000..943abbffaa3 --- /dev/null +++ b/azure/services/aso/aso_test.go @@ -0,0 +1,580 @@ +/* +Copyright 2023 The Kubernetes Authors. + +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 aso + +import ( + "context" + "errors" + "testing" + + asoresourcesv1 "github.com/Azure/azure-service-operator/v2/api/resources/v1api20200601" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime/conditions" + "github.com/golang/mock/gomock" + . "github.com/onsi/gomega" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" + "k8s.io/utils/pointer" + "sigs.k8s.io/cluster-api-provider-azure/azure" + "sigs.k8s.io/cluster-api-provider-azure/azure/mock_azure" + gomockinternal "sigs.k8s.io/cluster-api-provider-azure/internal/test/matchers/gomock" + "sigs.k8s.io/controller-runtime/pkg/client" + fakeclient "sigs.k8s.io/controller-runtime/pkg/client/fake" +) + +type ErroringGetClient struct { + client.Client + err error +} + +func (e ErroringGetClient) Get(_ context.Context, _ client.ObjectKey, _ client.Object, _ ...client.GetOption) error { + return e.err +} + +type ErroringPatchClient struct { + client.Client + err error +} + +func (e ErroringPatchClient) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error { + return e.err +} + +type ErroringDeleteClient struct { + client.Client + err error +} + +func (e ErroringDeleteClient) Delete(_ context.Context, _ client.Object, _ ...client.DeleteOption) error { + return e.err +} + +// TestCreateOrUpdateResource tests the CreateOrUpdateResource function. +func TestCreateOrUpdateResource(t *testing.T) { + t.Run("ready status unknown", func(t *testing.T) { + g := NewGomegaWithT(t) + + sch := runtime.NewScheme() + g.Expect(asoresourcesv1.AddToScheme(sch)).To(Succeed()) + c := fakeclient.NewClientBuilder(). + WithScheme(sch). + Build() + s := New(c) + + mockCtrl := gomock.NewController(t) + specMock := mock_azure.NewMockASOResourceSpecGetter(mockCtrl) + specMock.EXPECT().ResourceRef().Return(&asoresourcesv1.ResourceGroup{ + ObjectMeta: metav1.ObjectMeta{ + Name: "name", + Namespace: "namespace", + }, + }) + + ctx := context.Background() + g.Expect(c.Create(ctx, &asoresourcesv1.ResourceGroup{ + ObjectMeta: metav1.ObjectMeta{ + Name: "name", + Namespace: "namespace", + }, + Status: asoresourcesv1.ResourceGroup_STATUS{}, + })).To(Succeed()) + + result, err := s.CreateOrUpdateResource(ctx, specMock, "service") + g.Expect(result).To(BeNil()) + g.Expect(err).NotTo(BeNil()) + g.Expect(err.Error()).To(ContainSubstring("ready status unknown")) + }) + + t.Run("create resource that doesn't already exist", func(t *testing.T) { + g := NewGomegaWithT(t) + + sch := runtime.NewScheme() + g.Expect(asoresourcesv1.AddToScheme(sch)).To(Succeed()) + c := fakeclient.NewClientBuilder(). + WithScheme(sch). + Build() + s := New(c) + + mockCtrl := gomock.NewController(t) + specMock := mock_azure.NewMockASOResourceSpecGetter(mockCtrl) + specMock.EXPECT().ResourceRef().Return(&asoresourcesv1.ResourceGroup{ + ObjectMeta: metav1.ObjectMeta{ + Name: "name", + Namespace: "namespace", + }, + }) + specMock.EXPECT().Parameters(gomockinternal.AContext(), gomock.Nil()).Return(&asoresourcesv1.ResourceGroup{ + Spec: asoresourcesv1.ResourceGroup_Spec{ + Location: pointer.String("location"), + }, + }, nil) + + ctx := context.Background() + result, err := s.CreateOrUpdateResource(ctx, specMock, "service") + g.Expect(result).To(BeNil()) + g.Expect(err).NotTo(BeNil()) + g.Expect(azure.IsOperationNotDoneError(err)).To(BeTrue()) + var recerr azure.ReconcileError + g.Expect(errors.As(err, &recerr)).To(BeTrue()) + g.Expect(recerr.IsTransient()).To(BeTrue()) + + created := &asoresourcesv1.ResourceGroup{} + g.Expect(c.Get(ctx, types.NamespacedName{Name: "name", Namespace: "namespace"}, created)).To(Succeed()) + g.Expect(created.Name).To(Equal("name")) + g.Expect(created.Namespace).To(Equal("namespace")) + g.Expect(created.Spec).To(Equal(asoresourcesv1.ResourceGroup_Spec{ + Location: pointer.String("location"), + })) + }) + + t.Run("resource is not ready in non-terminal state", func(t *testing.T) { + g := NewGomegaWithT(t) + + sch := runtime.NewScheme() + g.Expect(asoresourcesv1.AddToScheme(sch)).To(Succeed()) + c := fakeclient.NewClientBuilder(). + WithScheme(sch). + Build() + s := New(c) + + mockCtrl := gomock.NewController(t) + specMock := mock_azure.NewMockASOResourceSpecGetter(mockCtrl) + specMock.EXPECT().ResourceRef().Return(&asoresourcesv1.ResourceGroup{ + ObjectMeta: metav1.ObjectMeta{ + Name: "name", + Namespace: "namespace", + }, + }) + + ctx := context.Background() + g.Expect(c.Create(ctx, &asoresourcesv1.ResourceGroup{ + ObjectMeta: metav1.ObjectMeta{ + Name: "name", + Namespace: "namespace", + }, + Status: asoresourcesv1.ResourceGroup_STATUS{ + Conditions: []conditions.Condition{ + { + Type: conditions.ConditionTypeReady, + Status: metav1.ConditionFalse, + Severity: conditions.ConditionSeverityInfo, + }, + }, + }, + })).To(Succeed()) + + result, err := s.CreateOrUpdateResource(ctx, specMock, "service") + g.Expect(result).To(BeNil()) + g.Expect(err).NotTo(BeNil()) + g.Expect(err.Error()).To(ContainSubstring("resource is not Ready")) + var recerr azure.ReconcileError + g.Expect(errors.As(err, &recerr)).To(BeTrue()) + g.Expect(recerr.IsTransient()).To(BeTrue()) + }) + + t.Run("resource is not ready in reconciling state", func(t *testing.T) { + g := NewGomegaWithT(t) + + sch := runtime.NewScheme() + g.Expect(asoresourcesv1.AddToScheme(sch)).To(Succeed()) + c := fakeclient.NewClientBuilder(). + WithScheme(sch). + Build() + s := New(c) + + mockCtrl := gomock.NewController(t) + specMock := mock_azure.NewMockASOResourceSpecGetter(mockCtrl) + specMock.EXPECT().ResourceRef().Return(&asoresourcesv1.ResourceGroup{ + ObjectMeta: metav1.ObjectMeta{ + Name: "name", + Namespace: "namespace", + }, + }) + + ctx := context.Background() + g.Expect(c.Create(ctx, &asoresourcesv1.ResourceGroup{ + ObjectMeta: metav1.ObjectMeta{ + Name: "name", + Namespace: "namespace", + }, + Status: asoresourcesv1.ResourceGroup_STATUS{ + Conditions: []conditions.Condition{ + { + Type: conditions.ConditionTypeReady, + Status: metav1.ConditionFalse, + Severity: conditions.ConditionSeverityInfo, + Reason: conditions.ReasonReconciling.Name, + }, + }, + }, + })).To(Succeed()) + + result, err := s.CreateOrUpdateResource(ctx, specMock, "service") + g.Expect(result).To(BeNil()) + g.Expect(azure.IsOperationNotDoneError(err)).To(BeTrue()) + }) + + t.Run("resource is not ready in terminal state", func(t *testing.T) { + g := NewGomegaWithT(t) + + sch := runtime.NewScheme() + g.Expect(asoresourcesv1.AddToScheme(sch)).To(Succeed()) + c := fakeclient.NewClientBuilder(). + WithScheme(sch). + Build() + s := New(c) + + mockCtrl := gomock.NewController(t) + specMock := mock_azure.NewMockASOResourceSpecGetter(mockCtrl) + specMock.EXPECT().ResourceRef().Return(&asoresourcesv1.ResourceGroup{ + ObjectMeta: metav1.ObjectMeta{ + Name: "name", + Namespace: "namespace", + }, + }) + + ctx := context.Background() + g.Expect(c.Create(ctx, &asoresourcesv1.ResourceGroup{ + ObjectMeta: metav1.ObjectMeta{ + Name: "name", + Namespace: "namespace", + }, + Status: asoresourcesv1.ResourceGroup_STATUS{ + Conditions: []conditions.Condition{ + { + Type: conditions.ConditionTypeReady, + Status: metav1.ConditionFalse, + Severity: conditions.ConditionSeverityError, + }, + }, + }, + })).To(Succeed()) + + result, err := s.CreateOrUpdateResource(ctx, specMock, "service") + g.Expect(result).To(BeNil()) + g.Expect(err).NotTo(BeNil()) + g.Expect(err.Error()).To(ContainSubstring("resource is not Ready")) + var recerr azure.ReconcileError + g.Expect(errors.As(err, &recerr)).To(BeTrue()) + g.Expect(recerr.IsTerminal()).To(BeTrue()) + }) + + t.Run("error getting existing resource", func(t *testing.T) { + g := NewGomegaWithT(t) + + sch := runtime.NewScheme() + g.Expect(asoresourcesv1.AddToScheme(sch)).To(Succeed()) + c := fakeclient.NewClientBuilder(). + WithScheme(sch). + Build() + s := New(ErroringGetClient{Client: c, err: errors.New("an error")}) + + mockCtrl := gomock.NewController(t) + specMock := mock_azure.NewMockASOResourceSpecGetter(mockCtrl) + specMock.EXPECT().ResourceRef().Return(&asoresourcesv1.ResourceGroup{ + ObjectMeta: metav1.ObjectMeta{ + Name: "name", + Namespace: "namespace", + }, + }) + + ctx := context.Background() + result, err := s.CreateOrUpdateResource(ctx, specMock, "service") + g.Expect(result).To(BeNil()) + g.Expect(err).NotTo(BeNil()) + g.Expect(err.Error()).To(ContainSubstring("failed to get existing resource")) + }) + + t.Run("begin an update", func(t *testing.T) { + g := NewGomegaWithT(t) + + sch := runtime.NewScheme() + g.Expect(asoresourcesv1.AddToScheme(sch)).To(Succeed()) + c := fakeclient.NewClientBuilder(). + WithScheme(sch). + Build() + s := New(c) + + mockCtrl := gomock.NewController(t) + specMock := mock_azure.NewMockASOResourceSpecGetter(mockCtrl) + specMock.EXPECT().ResourceRef().Return(&asoresourcesv1.ResourceGroup{ + ObjectMeta: metav1.ObjectMeta{ + Name: "name", + Namespace: "namespace", + }, + }) + specMock.EXPECT().Parameters(gomockinternal.AContext(), gomock.Not(gomock.Nil())).DoAndReturn(func(_ context.Context, object genruntime.MetaObject) (genruntime.MetaObject, error) { + group := object.DeepCopyObject().(*asoresourcesv1.ResourceGroup) + group.Spec.Location = pointer.String("location") + return group, nil + }) + + ctx := context.Background() + g.Expect(c.Create(ctx, &asoresourcesv1.ResourceGroup{ + ObjectMeta: metav1.ObjectMeta{ + Name: "name", + Namespace: "namespace", + }, + Status: asoresourcesv1.ResourceGroup_STATUS{ + Conditions: []conditions.Condition{ + { + Type: conditions.ConditionTypeReady, + Status: metav1.ConditionTrue, + }, + }, + }, + })).To(Succeed()) + + result, err := s.CreateOrUpdateResource(ctx, specMock, "service") + g.Expect(result).To(BeNil()) + g.Expect(err).NotTo(BeNil()) + }) + + t.Run("Parameters error", func(t *testing.T) { + g := NewGomegaWithT(t) + + sch := runtime.NewScheme() + g.Expect(asoresourcesv1.AddToScheme(sch)).To(Succeed()) + c := fakeclient.NewClientBuilder(). + WithScheme(sch). + Build() + s := New(c) + + mockCtrl := gomock.NewController(t) + specMock := mock_azure.NewMockASOResourceSpecGetter(mockCtrl) + specMock.EXPECT().ResourceRef().Return(&asoresourcesv1.ResourceGroup{ + ObjectMeta: metav1.ObjectMeta{ + Name: "name", + Namespace: "namespace", + }, + }) + specMock.EXPECT().Parameters(gomockinternal.AContext(), gomock.Not(gomock.Nil())).Return(nil, errors.New("parameters error")) + + ctx := context.Background() + g.Expect(c.Create(ctx, &asoresourcesv1.ResourceGroup{ + ObjectMeta: metav1.ObjectMeta{ + Name: "name", + Namespace: "namespace", + }, + Status: asoresourcesv1.ResourceGroup_STATUS{ + Conditions: []conditions.Condition{ + { + Type: conditions.ConditionTypeReady, + Status: metav1.ConditionTrue, + }, + }, + }, + })).To(Succeed()) + + result, err := s.CreateOrUpdateResource(ctx, specMock, "service") + g.Expect(result).To(BeNil()) + g.Expect(err).NotTo(BeNil()) + g.Expect(err.Error()).To(ContainSubstring("parameters error")) + }) + + t.Run("resource up to date", func(t *testing.T) { + g := NewGomegaWithT(t) + + sch := runtime.NewScheme() + g.Expect(asoresourcesv1.AddToScheme(sch)).To(Succeed()) + c := fakeclient.NewClientBuilder(). + WithScheme(sch). + Build() + s := New(c) + + mockCtrl := gomock.NewController(t) + specMock := mock_azure.NewMockASOResourceSpecGetter(mockCtrl) + specMock.EXPECT().ResourceRef().Return(&asoresourcesv1.ResourceGroup{ + ObjectMeta: metav1.ObjectMeta{ + Name: "name", + Namespace: "namespace", + }, + }) + specMock.EXPECT().Parameters(gomockinternal.AContext(), gomock.Any()).DoAndReturn(func(_ context.Context, object genruntime.MetaObject) (genruntime.MetaObject, error) { + return nil, nil + }) + + ctx := context.Background() + g.Expect(c.Create(ctx, &asoresourcesv1.ResourceGroup{ + ObjectMeta: metav1.ObjectMeta{ + Name: "name", + Namespace: "namespace", + }, + Spec: asoresourcesv1.ResourceGroup_Spec{ + Location: pointer.String("location"), + }, + Status: asoresourcesv1.ResourceGroup_STATUS{ + Conditions: []conditions.Condition{ + { + Type: conditions.ConditionTypeReady, + Status: metav1.ConditionTrue, + }, + }, + }, + })).To(Succeed()) + + result, err := s.CreateOrUpdateResource(ctx, specMock, "service") + g.Expect(result).NotTo(BeNil()) + g.Expect(err).To(BeNil()) + + g.Expect(result.GetName()).To(Equal("name")) + g.Expect(result.GetNamespace()).To(Equal("namespace")) + g.Expect(result.GetLabels()).To(BeEmpty()) // label only added on create + g.Expect(result.(*asoresourcesv1.ResourceGroup).Spec.Location).To(Equal(pointer.String("location"))) + }) + + t.Run("error updating", func(t *testing.T) { + g := NewGomegaWithT(t) + + sch := runtime.NewScheme() + g.Expect(asoresourcesv1.AddToScheme(sch)).To(Succeed()) + c := fakeclient.NewClientBuilder(). + WithScheme(sch). + Build() + s := New(ErroringPatchClient{Client: c, err: errors.New("an error")}) + + mockCtrl := gomock.NewController(t) + specMock := mock_azure.NewMockASOResourceSpecGetter(mockCtrl) + specMock.EXPECT().ResourceRef().Return(&asoresourcesv1.ResourceGroup{ + ObjectMeta: metav1.ObjectMeta{ + Name: "name", + Namespace: "namespace", + }, + }) + specMock.EXPECT().Parameters(gomockinternal.AContext(), gomock.Any()).DoAndReturn(func(_ context.Context, object genruntime.MetaObject) (genruntime.MetaObject, error) { + group := object.DeepCopyObject().(*asoresourcesv1.ResourceGroup) + group.Spec.Location = pointer.String("location") + return group, nil + }) + + ctx := context.Background() + g.Expect(c.Create(ctx, &asoresourcesv1.ResourceGroup{ + ObjectMeta: metav1.ObjectMeta{ + Name: "name", + Namespace: "namespace", + }, + Status: asoresourcesv1.ResourceGroup_STATUS{ + Conditions: []conditions.Condition{ + { + Type: conditions.ConditionTypeReady, + Status: metav1.ConditionTrue, + }, + }, + }, + })).To(Succeed()) + + result, err := s.CreateOrUpdateResource(ctx, specMock, "service") + g.Expect(result).To(BeNil()) + g.Expect(err).NotTo(BeNil()) + g.Expect(err.Error()).To(ContainSubstring("failed to update resource")) + }) +} + +// TestDeleteResource tests the DeleteResource function. +func TestDeleteResource(t *testing.T) { + t.Run("successful delete", func(t *testing.T) { + g := NewGomegaWithT(t) + + sch := runtime.NewScheme() + g.Expect(asoresourcesv1.AddToScheme(sch)).To(Succeed()) + c := fakeclient.NewClientBuilder(). + WithScheme(sch). + Build() + s := New(c) + + mockCtrl := gomock.NewController(t) + specMock := mock_azure.NewMockASOResourceSpecGetter(mockCtrl) + specMock.EXPECT().ResourceRef().Return(&asoresourcesv1.ResourceGroup{ + ObjectMeta: metav1.ObjectMeta{ + Name: "name", + Namespace: "namespace", + }, + }) + + ctx := context.Background() + err := s.DeleteResource(ctx, specMock, "service") + g.Expect(err).To(BeNil()) + }) + + t.Run("delete in progress", func(t *testing.T) { + g := NewGomegaWithT(t) + + sch := runtime.NewScheme() + g.Expect(asoresourcesv1.AddToScheme(sch)).To(Succeed()) + c := fakeclient.NewClientBuilder(). + WithScheme(sch). + Build() + s := New(c) + + mockCtrl := gomock.NewController(t) + specMock := mock_azure.NewMockASOResourceSpecGetter(mockCtrl) + specMock.EXPECT().ResourceRef().Return(&asoresourcesv1.ResourceGroup{ + ObjectMeta: metav1.ObjectMeta{ + Name: "name", + Namespace: "namespace", + }, + }) + + ctx := context.Background() + g.Expect(c.Create(ctx, &asoresourcesv1.ResourceGroup{ + ObjectMeta: metav1.ObjectMeta{ + Name: "name", + Namespace: "namespace", + }, + })).To(Succeed()) + + err := s.DeleteResource(ctx, specMock, "service") + g.Expect(err).NotTo(BeNil()) + g.Expect(azure.IsOperationNotDoneError(err)).To(BeTrue()) + var recerr azure.ReconcileError + g.Expect(errors.As(err, &recerr)).To(BeTrue()) + g.Expect(recerr.IsTransient()).To(BeTrue()) + }) + + t.Run("error deleting", func(t *testing.T) { + g := NewGomegaWithT(t) + + sch := runtime.NewScheme() + g.Expect(asoresourcesv1.AddToScheme(sch)).To(Succeed()) + c := fakeclient.NewClientBuilder(). + WithScheme(sch). + Build() + s := New(ErroringDeleteClient{Client: c, err: errors.New("an error")}) + + mockCtrl := gomock.NewController(t) + specMock := mock_azure.NewMockASOResourceSpecGetter(mockCtrl) + specMock.EXPECT().ResourceRef().Return(&asoresourcesv1.ResourceGroup{ + ObjectMeta: metav1.ObjectMeta{ + Name: "name", + Namespace: "namespace", + }, + }) + + ctx := context.Background() + g.Expect(c.Create(ctx, &asoresourcesv1.ResourceGroup{ + ObjectMeta: metav1.ObjectMeta{ + Name: "name", + Namespace: "namespace", + }, + })).To(Succeed()) + + err := s.DeleteResource(ctx, specMock, "service") + g.Expect(err).NotTo(BeNil()) + g.Expect(err.Error()).To(ContainSubstring("failed to delete resource")) + }) +} diff --git a/azure/services/aso/interfaces.go b/azure/services/aso/interfaces.go new file mode 100644 index 00000000000..ddb2b27a62b --- /dev/null +++ b/azure/services/aso/interfaces.go @@ -0,0 +1,30 @@ +/* +Copyright 2023 The Kubernetes Authors. + +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 aso + +import ( + "context" + + "github.com/Azure/azure-service-operator/v2/pkg/genruntime" + "sigs.k8s.io/cluster-api-provider-azure/azure" +) + +// Reconciler is a generic interface used to perform reconciliation of Azure resources backed by ASO. +type Reconciler interface { + CreateOrUpdateResource(ctx context.Context, spec azure.ASOResourceSpecGetter, serviceName string) (result genruntime.MetaObject, err error) + DeleteResource(ctx context.Context, spec azure.ASOResourceSpecGetter, serviceName string) (err error) +} diff --git a/azure/services/aso/mock_aso/aso_mock.go b/azure/services/aso/mock_aso/aso_mock.go new file mode 100644 index 00000000000..090975aee6a --- /dev/null +++ b/azure/services/aso/mock_aso/aso_mock.go @@ -0,0 +1,82 @@ +/* +Copyright The Kubernetes Authors. + +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. +*/ + +// Code generated by MockGen. DO NOT EDIT. +// Source: ../interfaces.go + +// Package mock_aso is a generated GoMock package. +package mock_aso + +import ( + context "context" + reflect "reflect" + + genruntime "github.com/Azure/azure-service-operator/v2/pkg/genruntime" + gomock "github.com/golang/mock/gomock" + azure "sigs.k8s.io/cluster-api-provider-azure/azure" +) + +// MockReconciler is a mock of Reconciler interface. +type MockReconciler struct { + ctrl *gomock.Controller + recorder *MockReconcilerMockRecorder +} + +// MockReconcilerMockRecorder is the mock recorder for MockReconciler. +type MockReconcilerMockRecorder struct { + mock *MockReconciler +} + +// NewMockReconciler creates a new mock instance. +func NewMockReconciler(ctrl *gomock.Controller) *MockReconciler { + mock := &MockReconciler{ctrl: ctrl} + mock.recorder = &MockReconcilerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockReconciler) EXPECT() *MockReconcilerMockRecorder { + return m.recorder +} + +// CreateOrUpdateResource mocks base method. +func (m *MockReconciler) CreateOrUpdateResource(ctx context.Context, spec azure.ASOResourceSpecGetter, serviceName string) (genruntime.MetaObject, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateOrUpdateResource", ctx, spec, serviceName) + ret0, _ := ret[0].(genruntime.MetaObject) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateOrUpdateResource indicates an expected call of CreateOrUpdateResource. +func (mr *MockReconcilerMockRecorder) CreateOrUpdateResource(ctx, spec, serviceName interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdateResource", reflect.TypeOf((*MockReconciler)(nil).CreateOrUpdateResource), ctx, spec, serviceName) +} + +// DeleteResource mocks base method. +func (m *MockReconciler) DeleteResource(ctx context.Context, spec azure.ASOResourceSpecGetter, serviceName string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteResource", ctx, spec, serviceName) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteResource indicates an expected call of DeleteResource. +func (mr *MockReconcilerMockRecorder) DeleteResource(ctx, spec, serviceName interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteResource", reflect.TypeOf((*MockReconciler)(nil).DeleteResource), ctx, spec, serviceName) +} diff --git a/api/v1alpha3/doc.go b/azure/services/aso/mock_aso/doc.go similarity index 58% rename from api/v1alpha3/doc.go rename to azure/services/aso/mock_aso/doc.go index 16d0c345b95..9998c589b58 100644 --- a/api/v1alpha3/doc.go +++ b/azure/services/aso/mock_aso/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Kubernetes Authors. +Copyright 2023 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha3 - -// +k8s:conversion-gen=sigs.k8s.io/cluster-api-provider-azure/api/v1beta1 +// Run go generate to regenerate this mock. +// +//go:generate ../../../../hack/tools/bin/mockgen -destination aso_mock.go -package mock_aso -source ../interfaces.go +//go:generate /usr/bin/env bash -c "cat ../../../../hack/boilerplate/boilerplate.generatego.txt aso_mock.go > _aso_mock.go && mv _aso_mock.go aso_mock.go" +package mock_aso diff --git a/azure/services/asogroups/groups.go b/azure/services/asogroups/groups.go new file mode 100644 index 00000000000..5e403c4a47c --- /dev/null +++ b/azure/services/asogroups/groups.go @@ -0,0 +1,128 @@ +/* +Copyright 2023 The Kubernetes Authors. + +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 asogroups + +import ( + "context" + + asoresourcesv1 "github.com/Azure/azure-service-operator/v2/api/resources/v1api20200601" + "github.com/pkg/errors" + apierrors "k8s.io/apimachinery/pkg/api/errors" + infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" + "sigs.k8s.io/cluster-api-provider-azure/azure" + "sigs.k8s.io/cluster-api-provider-azure/azure/services/aso" + "sigs.k8s.io/cluster-api-provider-azure/util/reconciler" + "sigs.k8s.io/cluster-api-provider-azure/util/tele" + "sigs.k8s.io/controller-runtime/pkg/client" +) + +// ServiceName is the name of this service. +const ServiceName = "group" + +// Service provides operations on Azure resources. +type Service struct { + Scope GroupScope + aso.Reconciler +} + +// GroupScope defines the scope interface for a group service. +type GroupScope interface { + azure.AsyncStatusUpdater + ASOGroupSpec() azure.ASOResourceSpecGetter + GetClient() client.Client +} + +// New creates a new service. +func New(scope GroupScope) *Service { + return &Service{ + Scope: scope, + Reconciler: aso.New(scope.GetClient()), + } +} + +// Name returns the service name. +func (s *Service) Name() string { + return ServiceName +} + +// Reconcile idempotently creates or updates a resource group. +func (s *Service) Reconcile(ctx context.Context) error { + ctx, _, done := tele.StartSpanWithLogger(ctx, "groups.Service.Reconcile") + defer done() + + ctx, cancel := context.WithTimeout(ctx, reconciler.DefaultAzureServiceReconcileTimeout) + defer cancel() + + groupSpec := s.Scope.ASOGroupSpec() + if groupSpec == nil { + return nil + } + + _, err := s.CreateOrUpdateResource(ctx, groupSpec, ServiceName) + s.Scope.UpdatePutStatus(infrav1.ResourceGroupReadyCondition, ServiceName, err) + return err +} + +// Delete deletes the resource group if it is managed by capz. +func (s *Service) Delete(ctx context.Context) error { + ctx, log, done := tele.StartSpanWithLogger(ctx, "groups.Service.Delete") + defer done() + + ctx, cancel := context.WithTimeout(ctx, reconciler.DefaultAzureServiceReconcileTimeout) + defer cancel() + + groupSpec := s.Scope.ASOGroupSpec() + if groupSpec == nil { + return nil + } + + // check that the resource group is not BYO. + managed, err := s.IsManaged(ctx) + if err != nil { + if apierrors.IsNotFound(err) { + // already deleted or doesn't exist, cleanup status and return. + s.Scope.UpdateDeleteStatus(infrav1.ResourceGroupReadyCondition, ServiceName, nil) + return nil + } + return errors.Wrap(err, "could not get resource group management state") + } + if !managed { + log.V(2).Info("Skipping resource group deletion in unmanaged mode") + return nil + } + + err = s.DeleteResource(ctx, groupSpec, ServiceName) + s.Scope.UpdateDeleteStatus(infrav1.ResourceGroupReadyCondition, ServiceName, err) + return err +} + +// IsManaged returns true if the resource group has an owned tag with the cluster name as value, +// meaning that the resource group's lifecycle is managed. +func (s *Service) IsManaged(ctx context.Context) (bool, error) { + ctx, log, done := tele.StartSpanWithLogger(ctx, "groups.Service.IsManaged") + defer done() + + spec := s.Scope.ASOGroupSpec() + group := &asoresourcesv1.ResourceGroup{} + err := s.Scope.GetClient().Get(ctx, client.ObjectKeyFromObject(spec.ResourceRef()), group) + if err != nil { + log.Error(err, "error getting resource group") + return false, err + } + + return true, nil // not yet implemented +} diff --git a/azure/services/asogroups/groups_test.go b/azure/services/asogroups/groups_test.go new file mode 100644 index 00000000000..a7a834bc024 --- /dev/null +++ b/azure/services/asogroups/groups_test.go @@ -0,0 +1,252 @@ +/* +Copyright 2023 The Kubernetes Authors. + +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 asogroups + +import ( + "context" + "errors" + "testing" + + asoresourcesv1 "github.com/Azure/azure-service-operator/v2/api/resources/v1api20200601" + "github.com/golang/mock/gomock" + . "github.com/onsi/gomega" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/utils/pointer" + infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" + "sigs.k8s.io/cluster-api-provider-azure/azure/services/aso/mock_aso" + "sigs.k8s.io/cluster-api-provider-azure/azure/services/asogroups/mock_asogroups" + gomockinternal "sigs.k8s.io/cluster-api-provider-azure/internal/test/matchers/gomock" + "sigs.k8s.io/controller-runtime/pkg/client" + fakeclient "sigs.k8s.io/controller-runtime/pkg/client/fake" +) + +var ( + fakeGroupSpec = GroupSpec{ + Name: "test-group", + Namespace: "test-group-ns", + Location: "test-location", + ClusterName: "test-cluster", + AdditionalTags: map[string]string{"foo": "bar"}, + } + errInternal = errors.New("internal error") + sampleManagedGroup = &asoresourcesv1.ResourceGroup{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-group", + Namespace: "test-group-ns", + }, + Spec: asoresourcesv1.ResourceGroup_Spec{ + Location: pointer.String("test-location"), + }, + } +) + +func TestReconcileGroups(t *testing.T) { + testcases := []struct { + name string + expectedError string + expect func(s *mock_asogroups.MockGroupScopeMockRecorder, r *mock_aso.MockReconcilerMockRecorder) + }{ + { + name: "noop if no group spec is found", + expectedError: "", + expect: func(s *mock_asogroups.MockGroupScopeMockRecorder, _ *mock_aso.MockReconcilerMockRecorder) { + s.ASOGroupSpec().Return(nil) + }, + }, + { + name: "create group succeeds", + expectedError: "", + expect: func(s *mock_asogroups.MockGroupScopeMockRecorder, r *mock_aso.MockReconcilerMockRecorder) { + s.ASOGroupSpec().Return(&fakeGroupSpec) + r.CreateOrUpdateResource(gomockinternal.AContext(), &fakeGroupSpec, ServiceName).Return(nil, nil) + s.UpdatePutStatus(infrav1.ResourceGroupReadyCondition, ServiceName, nil) + }, + }, + { + name: "create resource group fails", + expectedError: "internal error", + expect: func(s *mock_asogroups.MockGroupScopeMockRecorder, r *mock_aso.MockReconcilerMockRecorder) { + s.ASOGroupSpec().Return(&fakeGroupSpec) + r.CreateOrUpdateResource(gomockinternal.AContext(), &fakeGroupSpec, ServiceName).Return(nil, errInternal) + s.UpdatePutStatus(infrav1.ResourceGroupReadyCondition, ServiceName, errInternal) + }, + }, + } + + for _, tc := range testcases { + tc := tc + t.Run(tc.name, func(t *testing.T) { + g := NewWithT(t) + + mockCtrl := gomock.NewController(t) + defer mockCtrl.Finish() + scopeMock := mock_asogroups.NewMockGroupScope(mockCtrl) + asoMock := mock_aso.NewMockReconciler(mockCtrl) + + tc.expect(scopeMock.EXPECT(), asoMock.EXPECT()) + + s := &Service{ + Scope: scopeMock, + Reconciler: asoMock, + } + + err := s.Reconcile(context.TODO()) + if tc.expectedError != "" { + g.Expect(err).To(HaveOccurred()) + g.Expect(err).To(MatchError(ContainSubstring(tc.expectedError))) + } else { + g.Expect(err).NotTo(HaveOccurred()) + } + }) + } +} + +type ErroringGetClient struct { + client.Client + err error +} + +func (e *ErroringGetClient) Get(_ context.Context, _ client.ObjectKey, _ client.Object, _ ...client.GetOption) error { + return e.err +} + +type ErroringDeleteClient struct { + client.Client + err error +} + +func (e *ErroringDeleteClient) Delete(_ context.Context, _ client.Object, _ ...client.DeleteOption) error { + return e.err +} + +func TestDeleteGroups(t *testing.T) { + testcases := []struct { + name string + clientBuilder func(g Gomega) client.Client + expectedError string + expect func(s *mock_asogroups.MockGroupScopeMockRecorder, r *mock_aso.MockReconcilerMockRecorder) + }{ + { + name: "noop if no group spec is found", + expectedError: "", + expect: func(s *mock_asogroups.MockGroupScopeMockRecorder, _ *mock_aso.MockReconcilerMockRecorder) { + s.ASOGroupSpec().Return(nil) + }, + }, + { + name: "delete operation is successful for managed resource group", + expectedError: "", + clientBuilder: func(g Gomega) client.Client { + scheme := runtime.NewScheme() + g.Expect(asoresourcesv1.AddToScheme(scheme)).To(Succeed()) + return fakeclient.NewClientBuilder(). + WithScheme(scheme). + WithObjects(sampleManagedGroup.DeepCopy()). + Build() + }, + expect: func(s *mock_asogroups.MockGroupScopeMockRecorder, r *mock_aso.MockReconcilerMockRecorder) { + s.ASOGroupSpec().AnyTimes().Return(&fakeGroupSpec) + r.DeleteResource(gomockinternal.AContext(), &fakeGroupSpec, ServiceName).Return(nil) + s.UpdateDeleteStatus(infrav1.ResourceGroupReadyCondition, ServiceName, nil) + }, + }, + { + name: "fail to check if resource group is managed", + clientBuilder: func(g Gomega) client.Client { + scheme := runtime.NewScheme() + g.Expect(asoresourcesv1.AddToScheme(scheme)).To(Succeed()) + c := fakeclient.NewClientBuilder(). + WithScheme(scheme). + Build() + return &ErroringGetClient{Client: c, err: errInternal} + }, + expectedError: "could not get resource group management state", + expect: func(s *mock_asogroups.MockGroupScopeMockRecorder, _ *mock_aso.MockReconcilerMockRecorder) { + s.ASOGroupSpec().AnyTimes().Return(&fakeGroupSpec) + }, + }, + { + name: "resource group doesn't exist", + clientBuilder: func(g Gomega) client.Client { + scheme := runtime.NewScheme() + g.Expect(asoresourcesv1.AddToScheme(scheme)).To(Succeed()) + c := fakeclient.NewClientBuilder(). + WithScheme(scheme). + Build() + return &ErroringDeleteClient{Client: c, err: errInternal} + }, + expectedError: "", + expect: func(s *mock_asogroups.MockGroupScopeMockRecorder, _ *mock_aso.MockReconcilerMockRecorder) { + s.ASOGroupSpec().AnyTimes().Return(&fakeGroupSpec) + s.UpdateDeleteStatus(infrav1.ResourceGroupReadyCondition, ServiceName, nil) + }, + }, + { + name: "error occurs when deleting resource group", + clientBuilder: func(g Gomega) client.Client { + scheme := runtime.NewScheme() + g.Expect(asoresourcesv1.AddToScheme(scheme)).To(Succeed()) + c := fakeclient.NewClientBuilder(). + WithScheme(scheme). + WithObjects(sampleManagedGroup.DeepCopy()). + Build() + return &ErroringDeleteClient{Client: c, err: errInternal} + }, + expectedError: "internal error", + expect: func(s *mock_asogroups.MockGroupScopeMockRecorder, r *mock_aso.MockReconcilerMockRecorder) { + s.ASOGroupSpec().AnyTimes().Return(&fakeGroupSpec) + r.DeleteResource(gomockinternal.AContext(), &fakeGroupSpec, ServiceName).Return(errInternal) + s.UpdateDeleteStatus(infrav1.ResourceGroupReadyCondition, ServiceName, gomockinternal.ErrStrEq("internal error")) + }, + }, + } + + for _, tc := range testcases { + tc := tc + t.Run(tc.name, func(t *testing.T) { + g := NewWithT(t) + + t.Parallel() + mockCtrl := gomock.NewController(t) + defer mockCtrl.Finish() + scopeMock := mock_asogroups.NewMockGroupScope(mockCtrl) + asyncMock := mock_aso.NewMockReconciler(mockCtrl) + + var ctrlClient client.Client + if tc.clientBuilder != nil { + ctrlClient = tc.clientBuilder(g) + } + + scopeMock.EXPECT().GetClient().Return(ctrlClient).AnyTimes() + tc.expect(scopeMock.EXPECT(), asyncMock.EXPECT()) + + s := &Service{ + Scope: scopeMock, + Reconciler: asyncMock, + } + + err := s.Delete(context.TODO()) + if tc.expectedError != "" { + g.Expect(err).To(HaveOccurred()) + g.Expect(err.Error()).To(ContainSubstring(tc.expectedError)) + } else { + g.Expect(err).NotTo(HaveOccurred()) + } + }) + } +} diff --git a/api/v1alpha4/doc.go b/azure/services/asogroups/mock_asogroups/doc.go similarity index 56% rename from api/v1alpha4/doc.go rename to azure/services/asogroups/mock_asogroups/doc.go index e6a873b2c8e..25af7f377ac 100644 --- a/api/v1alpha4/doc.go +++ b/azure/services/asogroups/mock_asogroups/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Kubernetes Authors. +Copyright 2023 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha4 - -// +k8s:conversion-gen=sigs.k8s.io/cluster-api-provider-azure/api/v1beta1 +// Run go generate to regenerate this mock. +// +//go:generate ../../../../hack/tools/bin/mockgen -destination groups_mock.go -package mock_asogroups -source ../groups.go GroupScope +//go:generate /usr/bin/env bash -c "cat ../../../../hack/boilerplate/boilerplate.generatego.txt groups_mock.go > _groups_mock.go && mv _groups_mock.go groups_mock.go" +package mock_asogroups diff --git a/azure/services/asogroups/mock_asogroups/groups_mock.go b/azure/services/asogroups/mock_asogroups/groups_mock.go new file mode 100644 index 00000000000..4e04c28f7e5 --- /dev/null +++ b/azure/services/asogroups/mock_asogroups/groups_mock.go @@ -0,0 +1,156 @@ +/* +Copyright The Kubernetes Authors. + +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. +*/ + +// Code generated by MockGen. DO NOT EDIT. +// Source: ../groups.go + +// Package mock_asogroups is a generated GoMock package. +package mock_asogroups + +import ( + reflect "reflect" + + gomock "github.com/golang/mock/gomock" + v1beta1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" + azure "sigs.k8s.io/cluster-api-provider-azure/azure" + v1beta10 "sigs.k8s.io/cluster-api/api/v1beta1" + client "sigs.k8s.io/controller-runtime/pkg/client" +) + +// MockGroupScope is a mock of GroupScope interface. +type MockGroupScope struct { + ctrl *gomock.Controller + recorder *MockGroupScopeMockRecorder +} + +// MockGroupScopeMockRecorder is the mock recorder for MockGroupScope. +type MockGroupScopeMockRecorder struct { + mock *MockGroupScope +} + +// NewMockGroupScope creates a new mock instance. +func NewMockGroupScope(ctrl *gomock.Controller) *MockGroupScope { + mock := &MockGroupScope{ctrl: ctrl} + mock.recorder = &MockGroupScopeMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockGroupScope) EXPECT() *MockGroupScopeMockRecorder { + return m.recorder +} + +// ASOGroupSpec mocks base method. +func (m *MockGroupScope) ASOGroupSpec() azure.ASOResourceSpecGetter { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ASOGroupSpec") + ret0, _ := ret[0].(azure.ASOResourceSpecGetter) + return ret0 +} + +// ASOGroupSpec indicates an expected call of ASOGroupSpec. +func (mr *MockGroupScopeMockRecorder) ASOGroupSpec() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ASOGroupSpec", reflect.TypeOf((*MockGroupScope)(nil).ASOGroupSpec)) +} + +// DeleteLongRunningOperationState mocks base method. +func (m *MockGroupScope) DeleteLongRunningOperationState(arg0, arg1, arg2 string) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "DeleteLongRunningOperationState", arg0, arg1, arg2) +} + +// DeleteLongRunningOperationState indicates an expected call of DeleteLongRunningOperationState. +func (mr *MockGroupScopeMockRecorder) DeleteLongRunningOperationState(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteLongRunningOperationState", reflect.TypeOf((*MockGroupScope)(nil).DeleteLongRunningOperationState), arg0, arg1, arg2) +} + +// GetClient mocks base method. +func (m *MockGroupScope) GetClient() client.Client { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetClient") + ret0, _ := ret[0].(client.Client) + return ret0 +} + +// GetClient indicates an expected call of GetClient. +func (mr *MockGroupScopeMockRecorder) GetClient() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetClient", reflect.TypeOf((*MockGroupScope)(nil).GetClient)) +} + +// GetLongRunningOperationState mocks base method. +func (m *MockGroupScope) GetLongRunningOperationState(arg0, arg1, arg2 string) *v1beta1.Future { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetLongRunningOperationState", arg0, arg1, arg2) + ret0, _ := ret[0].(*v1beta1.Future) + return ret0 +} + +// GetLongRunningOperationState indicates an expected call of GetLongRunningOperationState. +func (mr *MockGroupScopeMockRecorder) GetLongRunningOperationState(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLongRunningOperationState", reflect.TypeOf((*MockGroupScope)(nil).GetLongRunningOperationState), arg0, arg1, arg2) +} + +// SetLongRunningOperationState mocks base method. +func (m *MockGroupScope) SetLongRunningOperationState(arg0 *v1beta1.Future) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetLongRunningOperationState", arg0) +} + +// SetLongRunningOperationState indicates an expected call of SetLongRunningOperationState. +func (mr *MockGroupScopeMockRecorder) SetLongRunningOperationState(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetLongRunningOperationState", reflect.TypeOf((*MockGroupScope)(nil).SetLongRunningOperationState), arg0) +} + +// UpdateDeleteStatus mocks base method. +func (m *MockGroupScope) UpdateDeleteStatus(arg0 v1beta10.ConditionType, arg1 string, arg2 error) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "UpdateDeleteStatus", arg0, arg1, arg2) +} + +// UpdateDeleteStatus indicates an expected call of UpdateDeleteStatus. +func (mr *MockGroupScopeMockRecorder) UpdateDeleteStatus(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateDeleteStatus", reflect.TypeOf((*MockGroupScope)(nil).UpdateDeleteStatus), arg0, arg1, arg2) +} + +// UpdatePatchStatus mocks base method. +func (m *MockGroupScope) UpdatePatchStatus(arg0 v1beta10.ConditionType, arg1 string, arg2 error) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "UpdatePatchStatus", arg0, arg1, arg2) +} + +// UpdatePatchStatus indicates an expected call of UpdatePatchStatus. +func (mr *MockGroupScopeMockRecorder) UpdatePatchStatus(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdatePatchStatus", reflect.TypeOf((*MockGroupScope)(nil).UpdatePatchStatus), arg0, arg1, arg2) +} + +// UpdatePutStatus mocks base method. +func (m *MockGroupScope) UpdatePutStatus(arg0 v1beta10.ConditionType, arg1 string, arg2 error) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "UpdatePutStatus", arg0, arg1, arg2) +} + +// UpdatePutStatus indicates an expected call of UpdatePutStatus. +func (mr *MockGroupScopeMockRecorder) UpdatePutStatus(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdatePutStatus", reflect.TypeOf((*MockGroupScope)(nil).UpdatePutStatus), arg0, arg1, arg2) +} diff --git a/azure/services/asogroups/spec.go b/azure/services/asogroups/spec.go new file mode 100644 index 00000000000..6a4fed33da4 --- /dev/null +++ b/azure/services/asogroups/spec.go @@ -0,0 +1,70 @@ +/* +Copyright 2023 The Kubernetes Authors. + +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 asogroups + +import ( + "context" + + asoresourcesv1 "github.com/Azure/azure-service-operator/v2/api/resources/v1api20200601" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/utils/pointer" + infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" +) + +// GroupSpec defines the specification for a Resource Group. +type GroupSpec struct { + Name string + Namespace string + Location string + ClusterName string + AdditionalTags infrav1.Tags + Owner metav1.OwnerReference +} + +// ResourceRef implements aso.ResourceSpecGetter. +func (s *GroupSpec) ResourceRef() genruntime.MetaObject { + return &asoresourcesv1.ResourceGroup{ + ObjectMeta: metav1.ObjectMeta{ + Name: s.Name, + Namespace: s.Namespace, + }, + } +} + +// Parameters implements aso.ResourceSpecGetter. +func (s *GroupSpec) Parameters(ctx context.Context, object genruntime.MetaObject) (genruntime.MetaObject, error) { + if object != nil { + return nil, nil + } + + return &asoresourcesv1.ResourceGroup{ + ObjectMeta: metav1.ObjectMeta{ + OwnerReferences: []metav1.OwnerReference{s.Owner}, + }, + Spec: asoresourcesv1.ResourceGroup_Spec{ + Location: pointer.String(s.Location), + Tags: infrav1.Build(infrav1.BuildParams{ + ClusterName: s.ClusterName, + Lifecycle: infrav1.ResourceLifecycleOwned, + Name: pointer.String(s.Name), + Role: pointer.String(infrav1.CommonRole), + Additional: s.AdditionalTags, + }), + }, + }, nil +} diff --git a/azure/services/asogroups/spec_test.go b/azure/services/asogroups/spec_test.go new file mode 100644 index 00000000000..60da82a5154 --- /dev/null +++ b/azure/services/asogroups/spec_test.go @@ -0,0 +1,88 @@ +/* +Copyright 2023 The Kubernetes Authors. + +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 asogroups + +import ( + "context" + "testing" + + asoresourcesv1 "github.com/Azure/azure-service-operator/v2/api/resources/v1api20200601" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime" + . "github.com/onsi/gomega" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/utils/pointer" + infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" +) + +func TestParameters(t *testing.T) { + tests := []struct { + name string + spec *GroupSpec + existing genruntime.MetaObject + expected genruntime.MetaObject + }{ + { + name: "no existing group", + spec: &GroupSpec{ + Name: "name", + Location: "location", + ClusterName: "cluster", + AdditionalTags: infrav1.Tags{"some": "tags"}, + Namespace: "namespace", + Owner: metav1.OwnerReference{ + Kind: "kind", + }, + }, + existing: nil, + expected: &asoresourcesv1.ResourceGroup{ + ObjectMeta: metav1.ObjectMeta{ + OwnerReferences: []metav1.OwnerReference{ + { + Kind: "kind", + }, + }, + }, + Spec: asoresourcesv1.ResourceGroup_Spec{ + Location: pointer.String("location"), + Tags: map[string]string{ + "some": "tags", + "sigs.k8s.io_cluster-api-provider-azure_cluster_cluster": "owned", + "sigs.k8s.io_cluster-api-provider-azure_role": "common", + "Name": "name", + }, + }, + }, + }, + { + name: "existing group", + existing: &asoresourcesv1.ResourceGroup{}, + expected: nil, + }, + } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + g := NewWithT(t) + + actual, err := test.spec.Parameters(context.Background(), test.existing) + g.Expect(err).NotTo(HaveOccurred()) + if test.expected == nil { + g.Expect(actual).To(BeNil()) + } else { + g.Expect(actual).To(Equal(test.expected)) + } + }) + } +} diff --git a/azure/services/async/async.go b/azure/services/async/async.go index 8885922e25f..d2646cfbbb7 100644 --- a/azure/services/async/async.go +++ b/azure/services/async/async.go @@ -140,6 +140,7 @@ func (s *Service) CreateOrUpdateResource(ctx context.Context, spec azure.Resourc log.V(2).Info(fmt.Sprintf("%sing resource", logMessageVerbPrefix), "service", serviceName, "resource", resourceName, "resourceGroup", rgName) result, sdkFuture, err := s.Creator.CreateOrUpdateAsync(ctx, spec, parameters) errWrapped := errors.Wrapf(err, fmt.Sprintf("failed to %se resource %s/%s (service: %s)", logMessageVerbPrefix, rgName, resourceName, serviceName)) + if sdkFuture != nil { future, err := converters.SDKToFuture(sdkFuture, infrav1.PutFuture, serviceName, resourceName, rgName) if err != nil { @@ -148,6 +149,11 @@ func (s *Service) CreateOrUpdateResource(ctx context.Context, spec azure.Resourc s.Scope.SetLongRunningOperationState(future) return nil, azure.WithTransientError(azure.NewOperationNotDoneError(future), getRequeueAfterFromFuture(sdkFuture)) } else if err != nil { + // If it is an intermittent failure with context deadline exceeded or canceled as the reconciler could not complete + // in the max amount of time, mark it as a transient error and return. + if azure.IsContextDeadlineExceededOrCanceledError(ctx.Err()) { + return nil, azure.WithTransientError(errWrapped, getRetryAfterFromError(err)) + } return nil, errWrapped } @@ -174,6 +180,7 @@ func (s *Service) DeleteResource(ctx context.Context, spec azure.ResourceSpecGet // No long running operation is active, so delete the resource. log.V(2).Info("deleting resource", "service", serviceName, "resource", resourceName, "resourceGroup", rgName) sdkFuture, err := s.Deleter.DeleteAsync(ctx, spec) + if sdkFuture != nil { future, err := converters.SDKToFuture(sdkFuture, infrav1.DeleteFuture, serviceName, resourceName, rgName) if err != nil { @@ -186,6 +193,11 @@ func (s *Service) DeleteResource(ctx context.Context, spec azure.ResourceSpecGet // already deleted return nil } + // If it is an intermittent failure with context deadline exceeded or canceled as the reconciler could not complete + // in the max amount of time, mark it as a transient error and return. + if azure.IsContextDeadlineExceededOrCanceledError(ctx.Err()) { + return azure.WithTransientError(err, getRetryAfterFromError(err)) + } return errors.Wrapf(err, "failed to delete resource %s/%s (service: %s)", rgName, resourceName, serviceName) } diff --git a/azure/services/identities/client.go b/azure/services/identities/client.go index d05e1e7feb5..34591e39fbb 100644 --- a/azure/services/identities/client.go +++ b/azure/services/identities/client.go @@ -19,9 +19,9 @@ package identities import ( "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/services/msi/mgmt/2018-11-30/msi" "github.com/Azure/go-autorest/autorest" - azureautorest "github.com/Azure/go-autorest/autorest/azure" "sigs.k8s.io/cluster-api-provider-azure/azure" "sigs.k8s.io/cluster-api-provider-azure/util/tele" ) @@ -63,11 +63,11 @@ func (ac *AzureClient) GetClientID(ctx context.Context, providerID string) (stri ctx, _, done := tele.StartSpanWithLogger(ctx, "identities.GetClientID") defer done() - parsed, err := azureautorest.ParseResourceID(providerID) + parsed, err := arm.ParseResourceID(providerID) if err != nil { return "", err } - ident, err := ac.Get(ctx, parsed.ResourceGroup, parsed.ResourceName) + ident, err := ac.Get(ctx, parsed.ResourceGroupName, parsed.Name) if err != nil { return "", err } diff --git a/azure/services/loadbalancers/loadbalancers.go b/azure/services/loadbalancers/loadbalancers.go index 6d46565afeb..0d633b5ec25 100644 --- a/azure/services/loadbalancers/loadbalancers.go +++ b/azure/services/loadbalancers/loadbalancers.go @@ -27,10 +27,11 @@ import ( ) const ( - serviceName = "loadbalancers" - tcpProbe = "TCPProbe" - lbRuleHTTPS = "LBRuleHTTPS" - outboundNAT = "OutboundNATAllProtocols" + serviceName = "loadbalancers" + httpsProbe = "HTTPSProbe" + httpsProbeRequestPath = "/readyz" + lbRuleHTTPS = "LBRuleHTTPS" + outboundNAT = "OutboundNATAllProtocols" ) // LBScope defines the scope interface for a load balancer service. diff --git a/azure/services/loadbalancers/spec.go b/azure/services/loadbalancers/spec.go index 5dff099ed72..4643730afab 100644 --- a/azure/services/loadbalancers/spec.go +++ b/azure/services/loadbalancers/spec.go @@ -236,7 +236,7 @@ func getLoadBalancingRules(lbSpec LBSpec, frontendIDs []network.SubResource) []n ID: pointer.String(azure.AddressPoolID(lbSpec.SubscriptionID, lbSpec.ResourceGroup, lbSpec.Name, lbSpec.BackendPoolName)), }, Probe: &network.SubResource{ - ID: pointer.String(azure.ProbeID(lbSpec.SubscriptionID, lbSpec.ResourceGroup, lbSpec.Name, tcpProbe)), + ID: pointer.String(azure.ProbeID(lbSpec.SubscriptionID, lbSpec.ResourceGroup, lbSpec.Name, httpsProbe)), }, }, }, @@ -257,10 +257,11 @@ func getProbes(lbSpec LBSpec) []network.Probe { if lbSpec.Role == infrav1.APIServerRole { return []network.Probe{ { - Name: pointer.String(tcpProbe), + Name: pointer.String(httpsProbe), ProbePropertiesFormat: &network.ProbePropertiesFormat{ - Protocol: network.ProbeProtocolTCP, + Protocol: network.ProbeProtocolHTTPS, Port: pointer.Int32(lbSpec.APIServerPort), + RequestPath: pointer.String(httpsProbeRequestPath), IntervalInSeconds: pointer.Int32(15), NumberOfProbes: pointer.Int32(4), }, diff --git a/azure/services/loadbalancers/spec_test.go b/azure/services/loadbalancers/spec_test.go index 14022ddf02b..8820866b969 100644 --- a/azure/services/loadbalancers/spec_test.go +++ b/azure/services/loadbalancers/spec_test.go @@ -276,17 +276,18 @@ func newSamplePublicAPIServerLB(verifyFrontendIP bool, verifyBackendAddressPools ID: pointer.String("/subscriptions/123/resourceGroups/my-rg/providers/Microsoft.Network/loadBalancers/my-publiclb/backendAddressPools/my-publiclb-backendPool"), }, Probe: &network.SubResource{ - ID: pointer.String("/subscriptions/123/resourceGroups/my-rg/providers/Microsoft.Network/loadBalancers/my-publiclb/probes/TCPProbe"), + ID: pointer.String("/subscriptions/123/resourceGroups/my-rg/providers/Microsoft.Network/loadBalancers/my-publiclb/probes/HTTPSProbe"), }, }, }, }, Probes: &[]network.Probe{ { - Name: pointer.String(tcpProbe), + Name: pointer.String(httpsProbe), ProbePropertiesFormat: &network.ProbePropertiesFormat{ - Protocol: network.ProbeProtocolTCP, + Protocol: network.ProbeProtocolHTTPS, Port: pointer.Int32(6443), + RequestPath: pointer.String(httpsProbeRequestPath), IntervalInSeconds: pointer.Int32(15), NumberOfProbes: numProbes, // Add to verify that Probes aren't overwritten on update }, @@ -355,7 +356,7 @@ func newDefaultInternalAPIServerLB() network.LoadBalancer { ID: pointer.String("/subscriptions/123/resourceGroups/my-rg/providers/Microsoft.Network/loadBalancers/my-private-lb/backendAddressPools/my-private-lb-backendPool"), }, Probe: &network.SubResource{ - ID: pointer.String("/subscriptions/123/resourceGroups/my-rg/providers/Microsoft.Network/loadBalancers/my-private-lb/probes/TCPProbe"), + ID: pointer.String("/subscriptions/123/resourceGroups/my-rg/providers/Microsoft.Network/loadBalancers/my-private-lb/probes/HTTPSProbe"), }, }, }, @@ -363,10 +364,11 @@ func newDefaultInternalAPIServerLB() network.LoadBalancer { OutboundRules: &[]network.OutboundRule{}, Probes: &[]network.Probe{ { - Name: pointer.String(tcpProbe), + Name: pointer.String(httpsProbe), ProbePropertiesFormat: &network.ProbePropertiesFormat{ - Protocol: network.ProbeProtocolTCP, + Protocol: network.ProbeProtocolHTTPS, Port: pointer.Int32(6443), + RequestPath: pointer.String(httpsProbeRequestPath), IntervalInSeconds: pointer.Int32(15), NumberOfProbes: pointer.Int32(4), }, diff --git a/azure/services/managedclusters/spec.go b/azure/services/managedclusters/spec.go index 02e1ea4f658..aed2ec29180 100644 --- a/azure/services/managedclusters/spec.go +++ b/azure/services/managedclusters/spec.go @@ -347,7 +347,7 @@ func (s *ManagedClusterSpec) Parameters(ctx context.Context, existing interface{ Enabled: &item.Enabled, } if item.Config != nil { - addonProfile.Config = *azure.StringMapPtr(item.Config) + addonProfile.Config = azure.StringMapPtr(item.Config) } managedCluster.AddonProfiles[item.Name] = addonProfile } diff --git a/azure/services/natgateways/natgateways_test.go b/azure/services/natgateways/natgateways_test.go index abe0cfcbd1b..d5242999b6a 100644 --- a/azure/services/natgateways/natgateways_test.go +++ b/azure/services/natgateways/natgateways_test.go @@ -32,11 +32,11 @@ import ( "sigs.k8s.io/cluster-api-provider-azure/azure/services/async/mock_async" "sigs.k8s.io/cluster-api-provider-azure/azure/services/natgateways/mock_natgateways" gomockinternal "sigs.k8s.io/cluster-api-provider-azure/internal/test/matchers/gomock" - clusterv1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" ) func init() { - _ = clusterv1alpha3.AddToScheme(scheme.Scheme) + _ = clusterv1.AddToScheme(scheme.Scheme) } var ( diff --git a/azure/services/natgateways/spec.go b/azure/services/natgateways/spec.go index 9009be1c033..f45f4341a80 100644 --- a/azure/services/natgateways/spec.go +++ b/azure/services/natgateways/spec.go @@ -19,8 +19,8 @@ package natgateways import ( "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-08-01/network" - azureautorest "github.com/Azure/go-autorest/autorest/azure" "github.com/pkg/errors" "k8s.io/utils/pointer" infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" @@ -97,11 +97,11 @@ func hasPublicIP(natGateway network.NatGateway, publicIPName string) bool { } for _, publicIP := range *natGateway.PublicIPAddresses { - resource, err := azureautorest.ParseResourceID(*publicIP.ID) + resource, err := arm.ParseResourceID(*publicIP.ID) if err != nil { continue } - if resource.ResourceName == publicIPName { + if resource.Name == publicIPName { return true } } diff --git a/azure/services/resourceskus/sku.go b/azure/services/resourceskus/sku.go index cd12217a201..81b5985a4b9 100644 --- a/azure/services/resourceskus/sku.go +++ b/azure/services/resourceskus/sku.go @@ -68,6 +68,10 @@ const ( MaximumPlatformFaultDomainCount = "MaximumPlatformFaultDomainCount" // UltraSSDAvailable identifies the capability for the support of UltraSSD data disks. UltraSSDAvailable = "UltraSSDAvailable" + // TrustedLaunchDisabled identifies the absence of the trusted launch capability. + TrustedLaunchDisabled = "TrustedLaunchDisabled" + // ConfidentialComputingType identifies the capability for confidentical computing. + ConfidentialComputingType = "ConfidentialComputingType" ) // HasCapability return true for a capability which can be either diff --git a/azure/services/scalesets/scalesets.go b/azure/services/scalesets/scalesets.go index 9ec607d9b1f..7aa0e90a22e 100644 --- a/azure/services/scalesets/scalesets.go +++ b/azure/services/scalesets/scalesets.go @@ -298,7 +298,7 @@ func (s *Service) patchVMSSIfNeeded(ctx context.Context, infraVMSS *azure.VMSS) if !isFlex { updated = infraVMSS.HasEnoughLatestModelOrNotMixedModel() } - if maxSurge > 0 && (hasModelChanges || !updated) { + if maxSurge > 0 && (hasModelChanges || !updated) && !s.Scope.HasReplicasExternallyManaged(ctx) { // surge capacity with the intention of lowering during instance reconciliation surge := spec.Capacity + int64(maxSurge) log.V(4).Info("surging...", "surge", surge, "hasModelChanges", hasModelChanges, "updated", updated) @@ -474,17 +474,6 @@ func (s *Service) buildVMSSFromSpec(ctx context.Context, vmssSpec azure.ScaleSet diagnosticsProfile := converters.GetDiagnosticsProfile(vmssSpec.DiagnosticsProfile) - // Get the node outbound LB backend pool ID - var backendAddressPools []compute.SubResource - if vmssSpec.PublicLBName != "" { - if vmssSpec.PublicLBAddressPoolName != "" { - backendAddressPools = append(backendAddressPools, - compute.SubResource{ - ID: pointer.String(azure.AddressPoolID(s.Scope.SubscriptionID(), s.Scope.ResourceGroup(), vmssSpec.PublicLBName, vmssSpec.PublicLBAddressPoolName)), - }) - } - } - osProfile, err := s.generateOSProfile(ctx, vmssSpec) if err != nil { return compute.VirtualMachineScaleSet{}, err @@ -509,29 +498,7 @@ func (s *Service) buildVMSSFromSpec(ctx context.Context, vmssSpec azure.ScaleSet SecurityProfile: securityProfile, DiagnosticsProfile: diagnosticsProfile, NetworkProfile: &compute.VirtualMachineScaleSetNetworkProfile{ - NetworkInterfaceConfigurations: &[]compute.VirtualMachineScaleSetNetworkConfiguration{ - { - Name: pointer.String(vmssSpec.Name), - VirtualMachineScaleSetNetworkConfigurationProperties: &compute.VirtualMachineScaleSetNetworkConfigurationProperties{ - Primary: pointer.Bool(true), - EnableIPForwarding: pointer.Bool(true), - IPConfigurations: &[]compute.VirtualMachineScaleSetIPConfiguration{ - { - Name: pointer.String(vmssSpec.Name), - VirtualMachineScaleSetIPConfigurationProperties: &compute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &compute.APIEntityReference{ - ID: pointer.String(azure.SubnetID(s.Scope.SubscriptionID(), vmssSpec.VNetResourceGroup, vmssSpec.VNetName, vmssSpec.SubnetName)), - }, - Primary: pointer.Bool(true), - PrivateIPAddressVersion: compute.IPVersionIPv4, - LoadBalancerBackendAddressPools: &backendAddressPools, - }, - }, - }, - EnableAcceleratedNetworking: vmssSpec.AcceleratedNetworking, - }, - }, - }, + NetworkInterfaceConfigurations: s.getVirtualMachineScaleSetNetworkConfiguration(vmssSpec), }, Priority: priority, EvictionPolicy: evictionPolicy, @@ -557,71 +524,6 @@ func (s *Service) buildVMSSFromSpec(ctx context.Context, vmssSpec azure.ScaleSet } } - // Use custom NIC definitions in VMSS if set - if len(vmssSpec.NetworkInterfaces) > 0 { - nicConfigs := []compute.VirtualMachineScaleSetNetworkConfiguration{} - for i, n := range vmssSpec.NetworkInterfaces { - nicConfig := compute.VirtualMachineScaleSetNetworkConfiguration{} - nicConfig.VirtualMachineScaleSetNetworkConfigurationProperties = &compute.VirtualMachineScaleSetNetworkConfigurationProperties{} - nicConfig.Name = pointer.String(vmssSpec.Name + "-" + strconv.Itoa(i)) - nicConfig.EnableIPForwarding = pointer.Bool(true) - - if n.AcceleratedNetworking == nil { - nicConfig.VirtualMachineScaleSetNetworkConfigurationProperties.EnableAcceleratedNetworking = vmssSpec.AcceleratedNetworking - } else { - nicConfig.VirtualMachineScaleSetNetworkConfigurationProperties.EnableAcceleratedNetworking = n.AcceleratedNetworking - } - - if n.PrivateIPConfigs == 0 { - nicConfig.VirtualMachineScaleSetNetworkConfigurationProperties.IPConfigurations = &[]compute.VirtualMachineScaleSetIPConfiguration{ - { - Name: pointer.String(vmssSpec.Name + "-" + strconv.Itoa(i)), - VirtualMachineScaleSetIPConfigurationProperties: &compute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &compute.APIEntityReference{ - ID: pointer.String(azure.SubnetID(s.Scope.SubscriptionID(), vmssSpec.VNetResourceGroup, vmssSpec.VNetName, n.SubnetName)), - }, - Primary: pointer.Bool(true), - PrivateIPAddressVersion: compute.IPVersionIPv4, - LoadBalancerBackendAddressPools: &backendAddressPools, - }, - }, - } - } else { - ipconfigs := []compute.VirtualMachineScaleSetIPConfiguration{} - - // Create IPConfigs - for j := 0; j < n.PrivateIPConfigs; j++ { - ipconfig := compute.VirtualMachineScaleSetIPConfiguration{ - Name: pointer.String(fmt.Sprintf("private-ipConfig-%v", j)), - VirtualMachineScaleSetIPConfigurationProperties: &compute.VirtualMachineScaleSetIPConfigurationProperties{ - PrivateIPAddressVersion: compute.IPVersionIPv4, - Subnet: &compute.APIEntityReference{ - ID: pointer.String(azure.SubnetID(s.Scope.SubscriptionID(), vmssSpec.VNetResourceGroup, vmssSpec.VNetName, n.SubnetName)), - }, - }, - } - - ipconfig.Subnet = &compute.APIEntityReference{ - ID: pointer.String(azure.SubnetID(s.Scope.SubscriptionID(), vmssSpec.VNetResourceGroup, vmssSpec.VNetName, n.SubnetName)), - } - ipconfigs = append(ipconfigs, ipconfig) - } - if i == 0 { - ipconfigs[0].LoadBalancerBackendAddressPools = &backendAddressPools - } - // Always use the first IPConfig as the Primary - ipconfigs[0].Primary = pointer.Bool(true) - nicConfig.VirtualMachineScaleSetNetworkConfigurationProperties.IPConfigurations = &ipconfigs - } - nicConfigs = append(nicConfigs, nicConfig) - } - nicConfigs[0].VirtualMachineScaleSetNetworkConfigurationProperties.Primary = pointer.Bool(true) - vmss.VirtualMachineScaleSetProperties.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations = &nicConfigs - } else { - // Set default interface configuration if no custom ones are specified - vmss.VirtualMachineScaleSetProperties.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations = s.getVirtualMachineScaleSetDefaultNetworkConfiguration(vmssSpec) - } - // Assign Identity to VMSS if vmssSpec.Identity == infrav1.VMIdentitySystemAssigned { vmss.Identity = &compute.VirtualMachineScaleSetIdentity{ @@ -677,7 +579,7 @@ func (s *Service) buildVMSSFromSpec(ctx context.Context, vmssSpec azure.ScaleSet return vmss, nil } -func (s *Service) getVirtualMachineScaleSetDefaultNetworkConfiguration(vmssSpec azure.ScaleSetSpec) *[]compute.VirtualMachineScaleSetNetworkConfiguration { +func (s *Service) getVirtualMachineScaleSetNetworkConfiguration(vmssSpec azure.ScaleSetSpec) *[]compute.VirtualMachineScaleSetNetworkConfiguration { var backendAddressPools []compute.SubResource if vmssSpec.PublicLBName != "" { if vmssSpec.PublicLBAddressPoolName != "" { @@ -687,27 +589,60 @@ func (s *Service) getVirtualMachineScaleSetDefaultNetworkConfiguration(vmssSpec }) } } - return &[]compute.VirtualMachineScaleSetNetworkConfiguration{{ - Name: pointer.String(vmssSpec.Name), - VirtualMachineScaleSetNetworkConfigurationProperties: &compute.VirtualMachineScaleSetNetworkConfigurationProperties{ - Primary: pointer.Bool(true), - EnableIPForwarding: pointer.Bool(true), - IPConfigurations: &[]compute.VirtualMachineScaleSetIPConfiguration{ - { - Name: pointer.String(vmssSpec.Name), - VirtualMachineScaleSetIPConfigurationProperties: &compute.VirtualMachineScaleSetIPConfigurationProperties{ - Subnet: &compute.APIEntityReference{ - ID: pointer.String(azure.SubnetID(s.Scope.SubscriptionID(), vmssSpec.VNetResourceGroup, vmssSpec.VNetName, vmssSpec.SubnetName)), - }, - Primary: pointer.Bool(true), - PrivateIPAddressVersion: compute.IPVersionIPv4, - LoadBalancerBackendAddressPools: &backendAddressPools, + nicConfigs := []compute.VirtualMachineScaleSetNetworkConfiguration{} + for i, n := range vmssSpec.NetworkInterfaces { + nicConfig := compute.VirtualMachineScaleSetNetworkConfiguration{} + nicConfig.VirtualMachineScaleSetNetworkConfigurationProperties = &compute.VirtualMachineScaleSetNetworkConfigurationProperties{} + nicConfig.Name = pointer.String(vmssSpec.Name + "-nic-" + strconv.Itoa(i)) + nicConfig.EnableIPForwarding = pointer.Bool(true) + if n.AcceleratedNetworking != nil { + nicConfig.VirtualMachineScaleSetNetworkConfigurationProperties.EnableAcceleratedNetworking = n.AcceleratedNetworking + } else { + // If AcceleratedNetworking is not specified, use the value from the VMSS spec. + // It will be set to true if the VMSS SKU supports it. + nicConfig.VirtualMachineScaleSetNetworkConfigurationProperties.EnableAcceleratedNetworking = vmssSpec.AcceleratedNetworking + } + + // Create IPConfigs + ipconfigs := []compute.VirtualMachineScaleSetIPConfiguration{} + for j := 0; j < n.PrivateIPConfigs; j++ { + ipconfig := compute.VirtualMachineScaleSetIPConfiguration{ + Name: pointer.String(fmt.Sprintf("ipConfig" + strconv.Itoa(j))), + VirtualMachineScaleSetIPConfigurationProperties: &compute.VirtualMachineScaleSetIPConfigurationProperties{ + PrivateIPAddressVersion: compute.IPVersionIPv4, + Subnet: &compute.APIEntityReference{ + ID: pointer.String(azure.SubnetID(s.Scope.SubscriptionID(), vmssSpec.VNetResourceGroup, vmssSpec.VNetName, n.SubnetName)), }, }, - }, - EnableAcceleratedNetworking: vmssSpec.AcceleratedNetworking, - }, - }} + } + + if j == 0 { + // Always use the first IPConfig as the Primary + ipconfig.Primary = pointer.Bool(true) + } + ipconfigs = append(ipconfigs, ipconfig) + } + if vmssSpec.IPv6Enabled { + ipv6Config := compute.VirtualMachineScaleSetIPConfiguration{ + Name: pointer.String("ipConfigv6"), + VirtualMachineScaleSetIPConfigurationProperties: &compute.VirtualMachineScaleSetIPConfigurationProperties{ + PrivateIPAddressVersion: compute.IPVersionIPv6, + Primary: pointer.Bool(false), + Subnet: &compute.APIEntityReference{ + ID: pointer.String(azure.SubnetID(s.Scope.SubscriptionID(), vmssSpec.VNetResourceGroup, vmssSpec.VNetName, n.SubnetName)), + }, + }, + } + ipconfigs = append(ipconfigs, ipv6Config) + } + if i == 0 { + ipconfigs[0].LoadBalancerBackendAddressPools = &backendAddressPools + nicConfig.VirtualMachineScaleSetNetworkConfigurationProperties.Primary = pointer.Bool(true) + } + nicConfig.VirtualMachineScaleSetNetworkConfigurationProperties.IPConfigurations = &ipconfigs + nicConfigs = append(nicConfigs, nicConfig) + } + return &nicConfigs } // getVirtualMachineScaleSet provides information about a Virtual Machine Scale Set and its instances. diff --git a/azure/services/scalesets/scalesets_test.go b/azure/services/scalesets/scalesets_test.go index c1903812dec..d966573cb53 100644 --- a/azure/services/scalesets/scalesets_test.go +++ b/azure/services/scalesets/scalesets_test.go @@ -275,11 +275,11 @@ func TestReconcileVMSS(t *testing.T) { setupDefaultVMSSStartCreatingExpectations(s, m) vmss := newDefaultVMSS("VM_SIZE_AN") netConfigs := vmss.VirtualMachineScaleSetProperties.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations - (*netConfigs)[0].Name = pointer.String("my-vmss-0") + (*netConfigs)[0].Name = pointer.String("my-vmss-nic-0") (*netConfigs)[0].EnableIPForwarding = pointer.Bool(true) (*netConfigs)[0].EnableAcceleratedNetworking = pointer.Bool(true) nic1IPConfigs := (*netConfigs)[0].IPConfigurations - (*nic1IPConfigs)[0].Name = pointer.String("private-ipConfig-0") + (*nic1IPConfigs)[0].Name = pointer.String("ipConfig0") (*nic1IPConfigs)[0].PrivateIPAddressVersion = compute.IPVersionIPv4 (*nic1IPConfigs)[0].Subnet = &compute.APIEntityReference{ ID: pointer.String("/subscriptions/123/resourceGroups/my-rg/providers/Microsoft.Network/virtualNetworks/my-vnet/subnets/somesubnet"), @@ -321,16 +321,16 @@ func TestReconcileVMSS(t *testing.T) { vmss := newDefaultVMSS("VM_SIZE") vmss.VirtualMachineScaleSetProperties.AdditionalCapabilities = &compute.AdditionalCapabilities{UltraSSDEnabled: pointer.Bool(true)} netConfigs := vmss.VirtualMachineScaleSetProperties.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations - (*netConfigs)[0].Name = pointer.String("my-vmss-0") + (*netConfigs)[0].Name = pointer.String("my-vmss-nic-0") (*netConfigs)[0].EnableIPForwarding = pointer.Bool(true) nic1IPConfigs := (*netConfigs)[0].IPConfigurations - (*nic1IPConfigs)[0].Name = pointer.String("private-ipConfig-0") + (*nic1IPConfigs)[0].Name = pointer.String("ipConfig0") (*nic1IPConfigs)[0].PrivateIPAddressVersion = compute.IPVersionIPv4 (*netConfigs)[0].EnableAcceleratedNetworking = pointer.Bool(true) (*netConfigs)[0].Primary = pointer.Bool(true) vmssIPConfigs := []compute.VirtualMachineScaleSetIPConfiguration{ { - Name: pointer.String("private-ipConfig-0"), + Name: pointer.String("ipConfig0"), VirtualMachineScaleSetIPConfigurationProperties: &compute.VirtualMachineScaleSetIPConfigurationProperties{ Primary: pointer.Bool(true), PrivateIPAddressVersion: compute.IPVersionIPv4, @@ -340,7 +340,7 @@ func TestReconcileVMSS(t *testing.T) { }, }, { - Name: pointer.String("private-ipConfig-1"), + Name: pointer.String("ipConfig1"), VirtualMachineScaleSetIPConfigurationProperties: &compute.VirtualMachineScaleSetIPConfigurationProperties{ PrivateIPAddressVersion: compute.IPVersionIPv4, Subnet: &compute.APIEntityReference{ @@ -350,7 +350,7 @@ func TestReconcileVMSS(t *testing.T) { }, } *netConfigs = append(*netConfigs, compute.VirtualMachineScaleSetNetworkConfiguration{ - Name: pointer.String("my-vmss-1"), + Name: pointer.String("my-vmss-nic-1"), VirtualMachineScaleSetNetworkConfigurationProperties: &compute.VirtualMachineScaleSetNetworkConfigurationProperties{ EnableAcceleratedNetworking: pointer.Bool(true), IPConfigurations: &vmssIPConfigs, @@ -617,7 +617,7 @@ func TestReconcileVMSS(t *testing.T) { m.GetResultIfDone(gomockinternal.AContext(), patchFuture).Return(compute.VirtualMachineScaleSet{}, azure.NewOperationNotDoneError(patchFuture)) m.Get(gomockinternal.AContext(), defaultResourceGroup, defaultVMSSName).Return(clone, nil) m.ListInstances(gomockinternal.AContext(), defaultResourceGroup, defaultVMSSName).Return(instances, nil) - s.HasReplicasExternallyManaged(gomockinternal.AContext()).Return(false) + s.HasReplicasExternallyManaged(gomockinternal.AContext()).Times(2).Return(false) }, }, { @@ -1281,6 +1281,12 @@ func newDefaultVMSSSpec() azure.ScaleSetSpec { AcceleratedNetworking: nil, TerminateNotificationTimeout: pointer.Int(7), FailureDomains: []string{"1", "3"}, + NetworkInterfaces: []infrav1.NetworkInterface{ + { + SubnetName: "my-subnet", + PrivateIPConfigs: 1, + }, + }, } } @@ -1376,14 +1382,14 @@ func newDefaultVMSS(vmSize string) compute.VirtualMachineScaleSet { NetworkProfile: &compute.VirtualMachineScaleSetNetworkProfile{ NetworkInterfaceConfigurations: &[]compute.VirtualMachineScaleSetNetworkConfiguration{ { - Name: pointer.String("my-vmss"), + Name: pointer.String("my-vmss-nic-0"), VirtualMachineScaleSetNetworkConfigurationProperties: &compute.VirtualMachineScaleSetNetworkConfigurationProperties{ Primary: pointer.Bool(true), EnableAcceleratedNetworking: pointer.Bool(false), EnableIPForwarding: pointer.Bool(true), IPConfigurations: &[]compute.VirtualMachineScaleSetIPConfiguration{ { - Name: pointer.String("my-vmss"), + Name: pointer.String("ipConfig0"), VirtualMachineScaleSetIPConfigurationProperties: &compute.VirtualMachineScaleSetIPConfigurationProperties{ Subnet: &compute.APIEntityReference{ ID: pointer.String("/subscriptions/123/resourceGroups/my-rg/providers/Microsoft.Network/virtualNetworks/my-vnet/subnets/my-subnet"), diff --git a/azure/services/scalesetvms/scalesetvms.go b/azure/services/scalesetvms/scalesetvms.go index f257497d3d4..43283e61423 100644 --- a/azure/services/scalesetvms/scalesetvms.go +++ b/azure/services/scalesetvms/scalesetvms.go @@ -22,7 +22,7 @@ import ( "strings" "time" - azureautorest "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/go-logr/logr" "github.com/pkg/errors" infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" @@ -147,11 +147,11 @@ func (s *Service) deleteVMSSFlexVM(ctx context.Context, resourceID string) error } }() - parsed, err := azureautorest.ParseResourceID(resourceID) + parsed, err := arm.ParseResourceID(resourceID) if err != nil { return errors.Wrap(err, fmt.Sprintf("failed to parse resource id %q", resourceID)) } - resourceGroup, resourceName := parsed.ResourceGroup, parsed.ResourceName + resourceGroup, resourceName := parsed.ResourceGroupName, parsed.Name log.V(4).Info("entering delete") future := s.Scope.GetLongRunningOperationState(resourceName, serviceName, infrav1.DeleteFuture) diff --git a/azure/services/scalesetvms/scalesetvms_test.go b/azure/services/scalesetvms/scalesetvms_test.go index be4373ee715..e1f7545bc19 100644 --- a/azure/services/scalesetvms/scalesetvms_test.go +++ b/azure/services/scalesetvms/scalesetvms_test.go @@ -293,7 +293,7 @@ func TestService_Delete(t *testing.T) { s.OrchestrationMode().Return(infrav1.FlexibleOrchestrationMode) v.GetByID(gomock2.AContext(), "foo").Return(compute.VirtualMachine{}, nil) }, - Err: errors.Wrap(fmt.Errorf("parsing failed for %s. Invalid resource Id format", "foo"), fmt.Sprintf("failed to parse resource id %q", "foo")), + Err: errors.Wrap(fmt.Errorf("invalid resource ID: resource id '%s' must start with '/'", "foo"), fmt.Sprintf("failed to parse resource id %q", "foo")), }, } diff --git a/azure/services/virtualmachines/client.go b/azure/services/virtualmachines/client.go index a2951069927..6438fe54fcb 100644 --- a/azure/services/virtualmachines/client.go +++ b/azure/services/virtualmachines/client.go @@ -23,6 +23,7 @@ import ( "fmt" "time" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-11-01/compute" "github.com/Azure/go-autorest/autorest" azureautorest "github.com/Azure/go-autorest/autorest/azure" @@ -89,14 +90,14 @@ func (ac *AzureClient) GetByID(ctx context.Context, resourceID string) (compute. ctx, log, done := tele.StartSpanWithLogger(ctx, "virtualmachines.AzureClient.GetByID") defer done() - parsed, err := azureautorest.ParseResourceID(resourceID) + parsed, err := arm.ParseResourceID(resourceID) if err != nil { return compute.VirtualMachine{}, errors.Wrap(err, fmt.Sprintf("failed parsing the VM resource id %q", resourceID)) } log.V(4).Info("parsed VM resourceID", "parsed", parsed) - return ac.virtualmachines.Get(ctx, parsed.ResourceGroup, parsed.ResourceName, "") + return ac.virtualmachines.Get(ctx, parsed.ResourceGroupName, parsed.Name, "") } // CreateOrUpdateAsync creates or updates a virtual machine asynchronously. diff --git a/azure/services/virtualmachines/spec.go b/azure/services/virtualmachines/spec.go index 673e7844fd9..00287edfdca 100644 --- a/azure/services/virtualmachines/spec.go +++ b/azure/services/virtualmachines/spec.go @@ -94,7 +94,7 @@ func (s *VMSpec) Parameters(ctx context.Context, existing interface{}) (params i return nil, err } - securityProfile, err := s.generateSecurityProfile() + securityProfile, err := s.generateSecurityProfile(storageProfile) if err != nil { return nil, err } @@ -165,7 +165,7 @@ func (s *VMSpec) generateStorageProfile() (*compute.StorageProfile, error) { return nil, azure.WithTerminalError(errors.Wrap(err, "failed to validate the vCPU capability")) } if !vCPUCapability { - return nil, azure.WithTerminalError(errors.New("vm size should be bigger or equal to at least 2 vCPUs")) + return nil, azure.WithTerminalError(errors.New("VM size should be bigger or equal to at least 2 vCPUs")) } // Checking if the requested VM size has at least 2 Gi of memory @@ -175,12 +175,12 @@ func (s *VMSpec) generateStorageProfile() (*compute.StorageProfile, error) { } if !MemoryCapability { - return nil, azure.WithTerminalError(errors.New("vm memory should be bigger or equal to at least 2Gi")) + return nil, azure.WithTerminalError(errors.New("VM memory should be bigger or equal to at least 2Gi")) } // enable ephemeral OS if s.OSDisk.DiffDiskSettings != nil { if !s.SKU.HasCapability(resourceskus.EphemeralOSDisk) { - return nil, azure.WithTerminalError(fmt.Errorf("vm size %s does not support ephemeral os. select a different vm size or disable ephemeral os", s.Size)) + return nil, azure.WithTerminalError(fmt.Errorf("VM size %s does not support ephemeral os. Select a different VM size or disable ephemeral os", s.Size)) } storageProfile.OsDisk.DiffDiskSettings = &compute.DiffDiskSettings{ @@ -196,6 +196,20 @@ func (s *VMSpec) generateStorageProfile() (*compute.StorageProfile, error) { if s.OSDisk.ManagedDisk.DiskEncryptionSet != nil { storageProfile.OsDisk.ManagedDisk.DiskEncryptionSet = &compute.DiskEncryptionSetParameters{ID: pointer.String(s.OSDisk.ManagedDisk.DiskEncryptionSet.ID)} } + if s.OSDisk.ManagedDisk.SecurityProfile != nil { + if _, exists := s.SKU.GetCapability(resourceskus.ConfidentialComputingType); !exists { + return nil, azure.WithTerminalError(fmt.Errorf("VM size %s does not support confidential computing. Select a different VM size or remove the security profile of the OS disk", s.Size)) + } + + storageProfile.OsDisk.ManagedDisk.SecurityProfile = &compute.VMDiskSecurityProfile{} + + if s.OSDisk.ManagedDisk.SecurityProfile.DiskEncryptionSet != nil { + storageProfile.OsDisk.ManagedDisk.SecurityProfile.DiskEncryptionSet = &compute.DiskEncryptionSetParameters{ID: pointer.String(s.OSDisk.ManagedDisk.SecurityProfile.DiskEncryptionSet.ID)} + } + if s.OSDisk.ManagedDisk.SecurityProfile.SecurityEncryptionType != "" { + storageProfile.OsDisk.ManagedDisk.SecurityProfile.SecurityEncryptionType = compute.SecurityEncryptionTypes(string(s.OSDisk.ManagedDisk.SecurityProfile.SecurityEncryptionType)) + } + } } dataDisks := make([]compute.DataDisk, len(s.DataDisks)) @@ -219,7 +233,7 @@ func (s *VMSpec) generateStorageProfile() (*compute.StorageProfile, error) { // check the support for ultra disks based on location and vm size if disk.ManagedDisk.StorageAccountType == string(compute.StorageAccountTypesUltraSSDLRS) && !s.SKU.HasLocationCapability(resourceskus.UltraSSDAvailable, s.Location, s.Zone) { - return nil, azure.WithTerminalError(fmt.Errorf("vm size %s does not support ultra disks in location %s. select a different vm size or disable ultra disks", s.Size, s.Location)) + return nil, azure.WithTerminalError(fmt.Errorf("VM size %s does not support ultra disks in location %s. Select a different VM size or disable ultra disks", s.Size, s.Location)) } } } @@ -277,18 +291,89 @@ func (s *VMSpec) generateOSProfile() (*compute.OSProfile, error) { return osProfile, nil } -func (s *VMSpec) generateSecurityProfile() (*compute.SecurityProfile, error) { +func (s *VMSpec) generateSecurityProfile(storageProfile *compute.StorageProfile) (*compute.SecurityProfile, error) { if s.SecurityProfile == nil { return nil, nil } - if !s.SKU.HasCapability(resourceskus.EncryptionAtHost) { - return nil, azure.WithTerminalError(errors.Errorf("encryption at host is not supported for VM type %s", s.Size)) + securityProfile := &compute.SecurityProfile{} + + if storageProfile.OsDisk.ManagedDisk != nil && + storageProfile.OsDisk.ManagedDisk.SecurityProfile != nil && + storageProfile.OsDisk.ManagedDisk.SecurityProfile.SecurityEncryptionType != "" { + if s.SecurityProfile.EncryptionAtHost != nil && *s.SecurityProfile.EncryptionAtHost && + storageProfile.OsDisk.ManagedDisk.SecurityProfile.SecurityEncryptionType == compute.SecurityEncryptionTypesDiskWithVMGuestState { + return nil, azure.WithTerminalError(errors.Errorf("encryption at host is not supported when securityEncryptionType is set to %s", compute.SecurityEncryptionTypesDiskWithVMGuestState)) + } + + if s.SecurityProfile.SecurityType != infrav1.SecurityTypesConfidentialVM { + return nil, azure.WithTerminalError(errors.Errorf("securityType should be set to %s when securityEncryptionType is set", infrav1.SecurityTypesConfidentialVM)) + } + + if s.SecurityProfile.UefiSettings == nil { + return nil, azure.WithTerminalError(errors.New("vTpmEnabled should be true when securityEncryptionType is set")) + } + + if storageProfile.OsDisk.ManagedDisk.SecurityProfile.SecurityEncryptionType == compute.SecurityEncryptionTypesDiskWithVMGuestState && + !*s.SecurityProfile.UefiSettings.SecureBootEnabled { + return nil, azure.WithTerminalError(errors.Errorf("secureBootEnabled should be true when securityEncryptionType is set to %s", compute.SecurityEncryptionTypesDiskWithVMGuestState)) + } + + if s.SecurityProfile.UefiSettings.VTpmEnabled != nil && !*s.SecurityProfile.UefiSettings.VTpmEnabled { + return nil, azure.WithTerminalError(errors.New("vTpmEnabled should be true when securityEncryptionType is set")) + } + + securityProfile.SecurityType = compute.SecurityTypesConfidentialVM + + securityProfile.UefiSettings = &compute.UefiSettings{ + SecureBootEnabled: s.SecurityProfile.UefiSettings.SecureBootEnabled, + VTpmEnabled: s.SecurityProfile.UefiSettings.VTpmEnabled, + } + + return securityProfile, nil + } + + if s.SecurityProfile.EncryptionAtHost != nil { + if !s.SKU.HasCapability(resourceskus.EncryptionAtHost) && *s.SecurityProfile.EncryptionAtHost { + return nil, azure.WithTerminalError(errors.Errorf("encryption at host is not supported for VM type %s", s.Size)) + } + + securityProfile.EncryptionAtHost = s.SecurityProfile.EncryptionAtHost } - return &compute.SecurityProfile{ - EncryptionAtHost: s.SecurityProfile.EncryptionAtHost, - }, nil + hasTrustedLaunchDisabled := s.SKU.HasCapability(resourceskus.TrustedLaunchDisabled) + + if s.SecurityProfile.UefiSettings != nil { + securityProfile.UefiSettings = &compute.UefiSettings{} + + if s.SecurityProfile.UefiSettings.SecureBootEnabled != nil && *s.SecurityProfile.UefiSettings.SecureBootEnabled { + if hasTrustedLaunchDisabled { + return nil, azure.WithTerminalError(errors.Errorf("secure boot is not supported for VM type %s", s.Size)) + } + + if s.SecurityProfile.SecurityType != infrav1.SecurityTypesTrustedLaunch { + return nil, azure.WithTerminalError(errors.Errorf("securityType should be set to %s when secureBootEnabled is true", infrav1.SecurityTypesTrustedLaunch)) + } + + securityProfile.SecurityType = compute.SecurityTypesTrustedLaunch + securityProfile.UefiSettings.SecureBootEnabled = pointer.Bool(true) + } + + if s.SecurityProfile.UefiSettings.VTpmEnabled != nil && *s.SecurityProfile.UefiSettings.VTpmEnabled { + if hasTrustedLaunchDisabled { + return nil, azure.WithTerminalError(errors.Errorf("vTPM is not supported for VM type %s", s.Size)) + } + + if s.SecurityProfile.SecurityType != infrav1.SecurityTypesTrustedLaunch { + return nil, azure.WithTerminalError(errors.Errorf("securityType should be set to %s when vTpmEnabled is true", infrav1.SecurityTypesTrustedLaunch)) + } + + securityProfile.SecurityType = compute.SecurityTypesTrustedLaunch + securityProfile.UefiSettings.VTpmEnabled = pointer.Bool(true) + } + } + + return securityProfile, nil } func (s *VMSpec) generateNICRefs() *[]compute.NetworkInterfaceReference { diff --git a/azure/services/virtualmachines/spec_test.go b/azure/services/virtualmachines/spec_test.go index 69ddfde51de..c396927b137 100644 --- a/azure/services/virtualmachines/spec_test.go +++ b/azure/services/virtualmachines/spec_test.go @@ -72,6 +72,50 @@ var ( }, } + validSKUWithTrustedLaunchDisabled = resourceskus.SKU{ + Name: pointer.String("Standard_D2v3"), + Kind: pointer.String(string(resourceskus.VirtualMachines)), + Locations: &[]string{ + "test-location", + }, + Capabilities: &[]compute.ResourceSkuCapabilities{ + { + Name: pointer.String(resourceskus.VCPUs), + Value: pointer.String("2"), + }, + { + Name: pointer.String(resourceskus.MemoryGB), + Value: pointer.String("4"), + }, + { + Name: pointer.String(resourceskus.TrustedLaunchDisabled), + Value: pointer.String(string(resourceskus.CapabilitySupported)), + }, + }, + } + + validSKUWithConfidentialComputingType = resourceskus.SKU{ + Name: pointer.String("Standard_D2v3"), + Kind: pointer.String(string(resourceskus.VirtualMachines)), + Locations: &[]string{ + "test-location", + }, + Capabilities: &[]compute.ResourceSkuCapabilities{ + { + Name: pointer.String(resourceskus.VCPUs), + Value: pointer.String("2"), + }, + { + Name: pointer.String(resourceskus.MemoryGB), + Value: pointer.String("4"), + }, + { + Name: pointer.String(resourceskus.ConfidentialComputingType), + Value: pointer.String(string(resourceskus.CapabilitySupported)), + }, + }, + } + validSKUWithEphemeralOS = resourceskus.SKU{ Name: pointer.String("Standard_D2v3"), Kind: pointer.String(string(resourceskus.VirtualMachines)), @@ -417,6 +461,108 @@ func TestParameters(t *testing.T) { }, expectedError: "", }, + { + name: "can create a trusted launch vm", + spec: &VMSpec{ + Name: "my-vm", + Role: infrav1.Node, + NICIDs: []string{"my-nic"}, + SSHKeyData: "fakesshpublickey", + Size: "Standard_D2v3", + AvailabilitySetID: "fake-availability-set-id", + Zone: "", + Image: &infrav1.Image{ID: pointer.String("fake-image-id")}, + SecurityProfile: &infrav1.SecurityProfile{ + SecurityType: infrav1.SecurityTypesTrustedLaunch, + UefiSettings: &infrav1.UefiSettings{ + SecureBootEnabled: pointer.Bool(true), + VTpmEnabled: pointer.Bool(true), + }, + }, + SKU: validSKU, + }, + existing: nil, + expect: func(g *WithT, result interface{}) { + g.Expect(result).To(BeAssignableToTypeOf(compute.VirtualMachine{})) + g.Expect(*result.(compute.VirtualMachine).SecurityProfile.UefiSettings.SecureBootEnabled).To(BeTrue()) + g.Expect(*result.(compute.VirtualMachine).SecurityProfile.UefiSettings.VTpmEnabled).To(BeTrue()) + }, + expectedError: "", + }, + { + name: "can create a confidential vm", + spec: &VMSpec{ + Name: "my-vm", + Role: infrav1.Node, + NICIDs: []string{"my-nic"}, + SSHKeyData: "fakesshpublickey", + Size: "Standard_D2v3", + AvailabilitySetID: "fake-availability-set-id", + Zone: "", + Image: &infrav1.Image{ID: pointer.String("fake-image-id")}, + OSDisk: infrav1.OSDisk{ + OSType: "Linux", + DiskSizeGB: pointer.Int32(128), + ManagedDisk: &infrav1.ManagedDiskParameters{ + StorageAccountType: "Premium_LRS", + SecurityProfile: &infrav1.VMDiskSecurityProfile{ + SecurityEncryptionType: infrav1.SecurityEncryptionTypeVMGuestStateOnly, + }, + }, + }, + SecurityProfile: &infrav1.SecurityProfile{ + SecurityType: infrav1.SecurityTypesConfidentialVM, + UefiSettings: &infrav1.UefiSettings{ + SecureBootEnabled: pointer.Bool(false), + VTpmEnabled: pointer.Bool(true), + }, + }, + SKU: validSKUWithConfidentialComputingType, + }, + existing: nil, + expect: func(g *WithT, result interface{}) { + g.Expect(result).To(BeAssignableToTypeOf(compute.VirtualMachine{})) + g.Expect(result.(compute.VirtualMachine).StorageProfile.OsDisk.ManagedDisk.SecurityProfile.SecurityEncryptionType).To(Equal(compute.SecurityEncryptionTypesVMGuestStateOnly)) + g.Expect(*result.(compute.VirtualMachine).SecurityProfile.UefiSettings.VTpmEnabled).To(BeTrue()) + }, + expectedError: "", + }, + { + name: "creating a confidential vm without the SecurityType set to ConfidentialVM fails", + spec: &VMSpec{ + Name: "my-vm", + Role: infrav1.Node, + NICIDs: []string{"my-nic"}, + SSHKeyData: "fakesshpublickey", + Size: "Standard_D2v3", + AvailabilitySetID: "fake-availability-set-id", + Zone: "", + Image: &infrav1.Image{ID: pointer.String("fake-image-id")}, + OSDisk: infrav1.OSDisk{ + OSType: "Linux", + DiskSizeGB: pointer.Int32(128), + ManagedDisk: &infrav1.ManagedDiskParameters{ + StorageAccountType: "Premium_LRS", + SecurityProfile: &infrav1.VMDiskSecurityProfile{ + SecurityEncryptionType: infrav1.SecurityEncryptionTypeVMGuestStateOnly, + }, + }, + }, + SecurityProfile: &infrav1.SecurityProfile{ + SecurityType: "", + UefiSettings: &infrav1.UefiSettings{ + SecureBootEnabled: pointer.Bool(false), + VTpmEnabled: pointer.Bool(true), + }, + }, + SKU: validSKUWithConfidentialComputingType, + }, + existing: nil, + expect: func(g *WithT, result interface{}) { + g.Expect(result).To(BeNil()) + }, + expectedError: "reconcile error that cannot be recovered occurred: securityType should be set to ConfidentialVM when securityEncryptionType is set. Object will not be requeued", + }, { name: "creating a vm with encryption at host enabled for unsupported VM type fails", spec: &VMSpec{ @@ -437,6 +583,231 @@ func TestParameters(t *testing.T) { }, expectedError: "reconcile error that cannot be recovered occurred: encryption at host is not supported for VM type Standard_D2v3. Object will not be requeued", }, + { + name: "creating a trusted launch vm without the SecurityType set to TrustedLaunch fails", + spec: &VMSpec{ + Name: "my-vm", + Role: infrav1.Node, + NICIDs: []string{"my-nic"}, + SSHKeyData: "fakesshpublickey", + Size: "Standard_D2v3", + AvailabilitySetID: "fake-availability-set-id", + Zone: "", + Image: &infrav1.Image{ID: pointer.String("fake-image-id")}, + OSDisk: infrav1.OSDisk{ + OSType: "Linux", + DiskSizeGB: pointer.Int32(128), + ManagedDisk: &infrav1.ManagedDiskParameters{ + StorageAccountType: "Premium_LRS", + }, + }, + SecurityProfile: &infrav1.SecurityProfile{ + SecurityType: "", + UefiSettings: &infrav1.UefiSettings{ + SecureBootEnabled: pointer.Bool(false), + VTpmEnabled: pointer.Bool(true), + }, + }, + SKU: validSKUWithConfidentialComputingType, + }, + existing: nil, + expect: func(g *WithT, result interface{}) { + g.Expect(result).To(BeNil()) + }, + expectedError: "reconcile error that cannot be recovered occurred: securityType should be set to TrustedLaunch when vTpmEnabled is true. Object will not be requeued", + }, + { + name: "creating a trusted launch vm with secure boot enabled on unsupported VM type fails", + spec: &VMSpec{ + Name: "my-vm", + Role: infrav1.Node, + NICIDs: []string{"my-nic"}, + SSHKeyData: "fakesshpublickey", + Size: "Standard_D2v3", + AvailabilitySetID: "fake-availability-set-id", + Zone: "", + Image: &infrav1.Image{ID: pointer.String("fake-image-id")}, + SecurityProfile: &infrav1.SecurityProfile{ + SecurityType: infrav1.SecurityTypesTrustedLaunch, + UefiSettings: &infrav1.UefiSettings{ + SecureBootEnabled: pointer.Bool(true), + }, + }, + SKU: validSKUWithTrustedLaunchDisabled, + }, + existing: nil, + expect: func(g *WithT, result interface{}) { + g.Expect(result).To(BeNil()) + }, + expectedError: "reconcile error that cannot be recovered occurred: secure boot is not supported for VM type Standard_D2v3. Object will not be requeued", + }, + { + name: "creating a trusted launch vm with vTPM enabled on unsupported VM type fails", + spec: &VMSpec{ + Name: "my-vm", + Role: infrav1.Node, + NICIDs: []string{"my-nic"}, + SSHKeyData: "fakesshpublickey", + Size: "Standard_D2v3", + AvailabilitySetID: "fake-availability-set-id", + Zone: "", + Image: &infrav1.Image{ID: pointer.String("fake-image-id")}, + SecurityProfile: &infrav1.SecurityProfile{ + SecurityType: infrav1.SecurityTypesTrustedLaunch, + UefiSettings: &infrav1.UefiSettings{ + VTpmEnabled: pointer.Bool(true), + }, + }, + SKU: validSKUWithTrustedLaunchDisabled, + }, + existing: nil, + expect: func(g *WithT, result interface{}) { + g.Expect(result).To(BeNil()) + }, + expectedError: "reconcile error that cannot be recovered occurred: vTPM is not supported for VM type Standard_D2v3. Object will not be requeued", + }, + { + name: "creating a confidential vm with securityTypeEncryption DiskWithVMGuestState and encryption at host enabled fails", + spec: &VMSpec{ + Name: "my-vm", + Role: infrav1.Node, + NICIDs: []string{"my-nic"}, + SSHKeyData: "fakesshpublickey", + Size: "Standard_D2v3", + AvailabilitySetID: "fake-availability-set-id", + Zone: "", + Image: &infrav1.Image{ID: pointer.String("fake-image-id")}, + OSDisk: infrav1.OSDisk{ + OSType: "Linux", + DiskSizeGB: pointer.Int32(128), + ManagedDisk: &infrav1.ManagedDiskParameters{ + StorageAccountType: "Premium_LRS", + SecurityProfile: &infrav1.VMDiskSecurityProfile{ + SecurityEncryptionType: infrav1.SecurityEncryptionTypeDiskWithVMGuestState, + }, + }, + }, + SecurityProfile: &infrav1.SecurityProfile{ + EncryptionAtHost: pointer.Bool(true), + SecurityType: infrav1.SecurityTypesConfidentialVM, + UefiSettings: &infrav1.UefiSettings{ + VTpmEnabled: pointer.Bool(true), + }, + }, + SKU: validSKUWithConfidentialComputingType, + }, + existing: nil, + expect: func(g *WithT, result interface{}) { + g.Expect(result).To(BeNil()) + }, + expectedError: "reconcile error that cannot be recovered occurred: encryption at host is not supported when securityEncryptionType is set to DiskWithVMGuestState. Object will not be requeued", + }, + { + name: "creating a confidential vm with DiskWithVMGuestState encryption type and secure boot disabled fails", + spec: &VMSpec{ + Name: "my-vm", + Role: infrav1.Node, + NICIDs: []string{"my-nic"}, + SSHKeyData: "fakesshpublickey", + Size: "Standard_D2v3", + AvailabilitySetID: "fake-availability-set-id", + Zone: "", + Image: &infrav1.Image{ID: pointer.String("fake-image-id")}, + OSDisk: infrav1.OSDisk{ + OSType: "Linux", + DiskSizeGB: pointer.Int32(128), + ManagedDisk: &infrav1.ManagedDiskParameters{ + StorageAccountType: "Premium_LRS", + SecurityProfile: &infrav1.VMDiskSecurityProfile{ + SecurityEncryptionType: infrav1.SecurityEncryptionTypeDiskWithVMGuestState, + }, + }, + }, + SecurityProfile: &infrav1.SecurityProfile{ + SecurityType: infrav1.SecurityTypesConfidentialVM, + UefiSettings: &infrav1.UefiSettings{ + SecureBootEnabled: pointer.Bool(false), + VTpmEnabled: pointer.Bool(true), + }, + }, + SKU: validSKUWithConfidentialComputingType, + }, + existing: nil, + expect: func(g *WithT, result interface{}) { + g.Expect(result).To(BeNil()) + }, + expectedError: "reconcile error that cannot be recovered occurred: secureBootEnabled should be true when securityEncryptionType is set to DiskWithVMGuestState. Object will not be requeued", + }, + { + name: "creating a confidential vm with vTPM disabled fails", + spec: &VMSpec{ + Name: "my-vm", + Role: infrav1.Node, + NICIDs: []string{"my-nic"}, + SSHKeyData: "fakesshpublickey", + Size: "Standard_D2v3", + AvailabilitySetID: "fake-availability-set-id", + Zone: "", + Image: &infrav1.Image{ID: pointer.String("fake-image-id")}, + OSDisk: infrav1.OSDisk{ + OSType: "Linux", + DiskSizeGB: pointer.Int32(128), + ManagedDisk: &infrav1.ManagedDiskParameters{ + StorageAccountType: "Premium_LRS", + SecurityProfile: &infrav1.VMDiskSecurityProfile{ + SecurityEncryptionType: infrav1.SecurityEncryptionTypeVMGuestStateOnly, + }, + }, + }, + SecurityProfile: &infrav1.SecurityProfile{ + SecurityType: infrav1.SecurityTypesConfidentialVM, + UefiSettings: &infrav1.UefiSettings{ + VTpmEnabled: pointer.Bool(false), + }, + }, + SKU: validSKUWithConfidentialComputingType, + }, + existing: nil, + expect: func(g *WithT, result interface{}) { + g.Expect(result).To(BeNil()) + }, + expectedError: "reconcile error that cannot be recovered occurred: vTpmEnabled should be true when securityEncryptionType is set. Object will not be requeued", + }, + { + name: "creating a confidential vm with unsupported VM type fails", + spec: &VMSpec{ + Name: "my-vm", + Role: infrav1.Node, + NICIDs: []string{"my-nic"}, + SSHKeyData: "fakesshpublickey", + Size: "Standard_D2v3", + AvailabilitySetID: "fake-availability-set-id", + Zone: "", + Image: &infrav1.Image{ID: pointer.String("fake-image-id")}, + OSDisk: infrav1.OSDisk{ + OSType: "Linux", + DiskSizeGB: pointer.Int32(128), + ManagedDisk: &infrav1.ManagedDiskParameters{ + StorageAccountType: "Premium_LRS", + SecurityProfile: &infrav1.VMDiskSecurityProfile{ + SecurityEncryptionType: infrav1.SecurityEncryptionTypeVMGuestStateOnly, + }, + }, + }, + SecurityProfile: &infrav1.SecurityProfile{ + SecurityType: infrav1.SecurityTypesConfidentialVM, + UefiSettings: &infrav1.UefiSettings{ + VTpmEnabled: pointer.Bool(true), + }, + }, + SKU: validSKU, + }, + existing: nil, + expect: func(g *WithT, result interface{}) { + g.Expect(result).To(BeNil()) + }, + expectedError: "reconcile error that cannot be recovered occurred: VM size Standard_D2v3 does not support confidential computing. Select a different VM size or remove the security profile of the OS disk. Object will not be requeued", + }, { name: "cannot create vm with EphemeralOSDisk if does not support ephemeral os", spec: &VMSpec{ @@ -462,7 +833,7 @@ func TestParameters(t *testing.T) { expect: func(g *WithT, result interface{}) { g.Expect(result).To(BeNil()) }, - expectedError: "reconcile error that cannot be recovered occurred: vm size Standard_D2v3 does not support ephemeral os. select a different vm size or disable ephemeral os. Object will not be requeued", + expectedError: "reconcile error that cannot be recovered occurred: VM size Standard_D2v3 does not support ephemeral os. Select a different VM size or disable ephemeral os. Object will not be requeued", }, { name: "cannot create vm if vCPU is less than 2", @@ -479,7 +850,7 @@ func TestParameters(t *testing.T) { expect: func(g *WithT, result interface{}) { g.Expect(result).To(BeNil()) }, - expectedError: "reconcile error that cannot be recovered occurred: vm size should be bigger or equal to at least 2 vCPUs. Object will not be requeued", + expectedError: "reconcile error that cannot be recovered occurred: VM size should be bigger or equal to at least 2 vCPUs. Object will not be requeued", }, { name: "cannot create vm if memory is less than 2Gi", @@ -496,7 +867,7 @@ func TestParameters(t *testing.T) { expect: func(g *WithT, result interface{}) { g.Expect(result).To(BeNil()) }, - expectedError: "reconcile error that cannot be recovered occurred: vm memory should be bigger or equal to at least 2Gi. Object will not be requeued", + expectedError: "reconcile error that cannot be recovered occurred: VM memory should be bigger or equal to at least 2Gi. Object will not be requeued", }, { name: "can create a vm with a marketplace image using a plan", @@ -684,7 +1055,7 @@ func TestParameters(t *testing.T) { expect: func(g *WithT, result interface{}) { g.Expect(result).To(BeNil()) }, - expectedError: "reconcile error that cannot be recovered occurred: vm size Standard_D2v3 does not support ultra disks in location test-location. select a different vm size or disable ultra disks. Object will not be requeued", + expectedError: "reconcile error that cannot be recovered occurred: VM size Standard_D2v3 does not support ultra disks in location test-location. Select a different VM size or disable ultra disks. Object will not be requeued", }, { name: "creates a vm with AdditionalCapabilities.UltraSSDEnabled false, if an ultra disk is specified as data disk but AdditionalCapabilities.UltraSSDEnabled is false", diff --git a/azure/services/vnetpeerings/spec.go b/azure/services/vnetpeerings/spec.go index 9cc8a649cf7..a7ee3ff9f42 100644 --- a/azure/services/vnetpeerings/spec.go +++ b/azure/services/vnetpeerings/spec.go @@ -27,12 +27,16 @@ import ( // VnetPeeringSpec defines the specification for a virtual network peering. type VnetPeeringSpec struct { - SourceResourceGroup string - SourceVnetName string - RemoteResourceGroup string - RemoteVnetName string - PeeringName string - SubscriptionID string + SourceResourceGroup string + SourceVnetName string + RemoteResourceGroup string + RemoteVnetName string + PeeringName string + SubscriptionID string + AllowForwardedTraffic *bool + AllowGatewayTransit *bool + AllowVirtualNetworkAccess *bool + UseRemoteGateways *bool } // ResourceName returns the name of the virtual network peering. @@ -64,6 +68,10 @@ func (s *VnetPeeringSpec) Parameters(ctx context.Context, existing interface{}) RemoteVirtualNetwork: &network.SubResource{ ID: pointer.String(vnetID), }, + AllowForwardedTraffic: s.AllowForwardedTraffic, + AllowGatewayTransit: s.AllowGatewayTransit, + AllowVirtualNetworkAccess: s.AllowVirtualNetworkAccess, + UseRemoteGateways: s.UseRemoteGateways, } return network.VirtualNetworkPeering{ Name: pointer.String(s.PeeringName), diff --git a/azure/services/vnetpeerings/vnetpeerings_test.go b/azure/services/vnetpeerings/vnetpeerings_test.go index a05e3f9cafc..7b1c9ab7d04 100644 --- a/azure/services/vnetpeerings/vnetpeerings_test.go +++ b/azure/services/vnetpeerings/vnetpeerings_test.go @@ -25,6 +25,7 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/golang/mock/gomock" . "github.com/onsi/gomega" + "k8s.io/utils/pointer" infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" "sigs.k8s.io/cluster-api-provider-azure/azure" "sigs.k8s.io/cluster-api-provider-azure/azure/services/async/mock_async" @@ -65,6 +66,30 @@ var ( RemoteResourceGroup: "group1", SubscriptionID: "sub1", } + fakePeeringHubToSpoke = VnetPeeringSpec{ + PeeringName: "hub-to-spoke", + SourceVnetName: "hub-vnet", + SourceResourceGroup: "hub-group", + RemoteVnetName: "spoke-vnet", + RemoteResourceGroup: "spoke-group", + SubscriptionID: "sub1", + AllowForwardedTraffic: pointer.Bool(true), + AllowGatewayTransit: pointer.Bool(true), + AllowVirtualNetworkAccess: pointer.Bool(true), + UseRemoteGateways: pointer.Bool(false), + } + fakePeeringSpokeToHub = VnetPeeringSpec{ + PeeringName: "spoke-to-hub", + SourceVnetName: "spoke-vnet", + SourceResourceGroup: "spoke-group", + RemoteVnetName: "hub-vnet", + RemoteResourceGroup: "hub-group", + SubscriptionID: "sub1", + AllowForwardedTraffic: pointer.Bool(true), + AllowGatewayTransit: pointer.Bool(false), + AllowVirtualNetworkAccess: pointer.Bool(true), + UseRemoteGateways: pointer.Bool(true), + } fakePeeringExtra = VnetPeeringSpec{ PeeringName: "extra-peering", SourceVnetName: "vnet3", @@ -73,7 +98,7 @@ var ( RemoteResourceGroup: "group4", SubscriptionID: "sub1", } - fakePeeringSpecs = []azure.ResourceSpecGetter{&fakePeering1To2, &fakePeering2To1, &fakePeering1To3, &fakePeering3To1} + fakePeeringSpecs = []azure.ResourceSpecGetter{&fakePeering1To2, &fakePeering2To1, &fakePeering1To3, &fakePeering3To1, &fakePeeringHubToSpoke, &fakePeeringSpokeToHub} fakePeeringExtraSpecs = []azure.ResourceSpecGetter{&fakePeering1To2, &fakePeering2To1, &fakePeeringExtra} internalError = autorest.NewErrorWithResponse("", "", &http.Response{StatusCode: http.StatusInternalServerError}, "Internal Server Error") notDoneError = azure.NewOperationNotDoneError(&infrav1.Future{}) @@ -131,6 +156,8 @@ func TestReconcileVnetPeerings(t *testing.T) { r.CreateOrUpdateResource(gomockinternal.AContext(), &fakePeering2To1, ServiceName).Return(&fakePeering2To1, nil) r.CreateOrUpdateResource(gomockinternal.AContext(), &fakePeering1To3, ServiceName).Return(&fakePeering1To3, nil) r.CreateOrUpdateResource(gomockinternal.AContext(), &fakePeering3To1, ServiceName).Return(&fakePeering3To1, nil) + r.CreateOrUpdateResource(gomockinternal.AContext(), &fakePeeringHubToSpoke, ServiceName).Return(&fakePeeringHubToSpoke, nil) + r.CreateOrUpdateResource(gomockinternal.AContext(), &fakePeeringSpokeToHub, ServiceName).Return(&fakePeeringSpokeToHub, nil) p.UpdatePutStatus(infrav1.VnetPeeringReadyCondition, ServiceName, nil) }, }, @@ -143,18 +170,8 @@ func TestReconcileVnetPeerings(t *testing.T) { r.CreateOrUpdateResource(gomockinternal.AContext(), &fakePeering2To1, ServiceName).Return(&fakePeering2To1, nil) r.CreateOrUpdateResource(gomockinternal.AContext(), &fakePeering1To3, ServiceName).Return(nil, internalError) r.CreateOrUpdateResource(gomockinternal.AContext(), &fakePeering3To1, ServiceName).Return(&fakePeering3To1, nil) - p.UpdatePutStatus(infrav1.VnetPeeringReadyCondition, ServiceName, internalError) - }, - }, - { - name: "error in creating peering", - expectedError: "#: Internal Server Error: StatusCode=500", - expect: func(p *mock_vnetpeerings.MockVnetPeeringScopeMockRecorder, r *mock_async.MockReconcilerMockRecorder) { - p.VnetPeeringSpecs().Return(fakePeeringSpecs) - r.CreateOrUpdateResource(gomockinternal.AContext(), &fakePeering1To2, ServiceName).Return(&fakePeering1To2, nil) - r.CreateOrUpdateResource(gomockinternal.AContext(), &fakePeering2To1, ServiceName).Return(&fakePeering2To1, nil) - r.CreateOrUpdateResource(gomockinternal.AContext(), &fakePeering1To3, ServiceName).Return(nil, internalError) - r.CreateOrUpdateResource(gomockinternal.AContext(), &fakePeering3To1, ServiceName).Return(&fakePeering3To1, nil) + r.CreateOrUpdateResource(gomockinternal.AContext(), &fakePeeringHubToSpoke, ServiceName).Return(&fakePeeringHubToSpoke, nil) + r.CreateOrUpdateResource(gomockinternal.AContext(), &fakePeeringSpokeToHub, ServiceName).Return(&fakePeeringSpokeToHub, nil) p.UpdatePutStatus(infrav1.VnetPeeringReadyCondition, ServiceName, internalError) }, }, @@ -167,6 +184,8 @@ func TestReconcileVnetPeerings(t *testing.T) { r.CreateOrUpdateResource(gomockinternal.AContext(), &fakePeering2To1, ServiceName).Return(nil, internalError) r.CreateOrUpdateResource(gomockinternal.AContext(), &fakePeering1To3, ServiceName).Return(nil, notDoneError) r.CreateOrUpdateResource(gomockinternal.AContext(), &fakePeering3To1, ServiceName).Return(&fakePeering3To1, nil) + r.CreateOrUpdateResource(gomockinternal.AContext(), &fakePeeringHubToSpoke, ServiceName).Return(&fakePeeringHubToSpoke, nil) + r.CreateOrUpdateResource(gomockinternal.AContext(), &fakePeeringSpokeToHub, ServiceName).Return(&fakePeeringSpokeToHub, nil) p.UpdatePutStatus(infrav1.VnetPeeringReadyCondition, ServiceName, internalError) }, }, @@ -179,6 +198,8 @@ func TestReconcileVnetPeerings(t *testing.T) { r.CreateOrUpdateResource(gomockinternal.AContext(), &fakePeering2To1, ServiceName).Return(&fakePeering2To1, nil) r.CreateOrUpdateResource(gomockinternal.AContext(), &fakePeering1To3, ServiceName).Return(nil, notDoneError) r.CreateOrUpdateResource(gomockinternal.AContext(), &fakePeering3To1, ServiceName).Return(nil, internalError) + r.CreateOrUpdateResource(gomockinternal.AContext(), &fakePeeringHubToSpoke, ServiceName).Return(&fakePeeringHubToSpoke, nil) + r.CreateOrUpdateResource(gomockinternal.AContext(), &fakePeeringSpokeToHub, ServiceName).Return(&fakePeeringSpokeToHub, nil) p.UpdatePutStatus(infrav1.VnetPeeringReadyCondition, ServiceName, internalError) }, }, @@ -191,6 +212,8 @@ func TestReconcileVnetPeerings(t *testing.T) { r.CreateOrUpdateResource(gomockinternal.AContext(), &fakePeering2To1, ServiceName).Return(&fakePeering2To1, nil) r.CreateOrUpdateResource(gomockinternal.AContext(), &fakePeering1To3, ServiceName).Return(nil, notDoneError) r.CreateOrUpdateResource(gomockinternal.AContext(), &fakePeering3To1, ServiceName).Return(&fakePeering3To1, nil) + r.CreateOrUpdateResource(gomockinternal.AContext(), &fakePeeringHubToSpoke, ServiceName).Return(&fakePeeringHubToSpoke, nil) + r.CreateOrUpdateResource(gomockinternal.AContext(), &fakePeeringSpokeToHub, ServiceName).Return(&fakePeeringSpokeToHub, nil) p.UpdatePutStatus(infrav1.VnetPeeringReadyCondition, ServiceName, notDoneError) }, }, @@ -277,6 +300,8 @@ func TestDeleteVnetPeerings(t *testing.T) { r.DeleteResource(gomockinternal.AContext(), &fakePeering2To1, ServiceName).Return(nil) r.DeleteResource(gomockinternal.AContext(), &fakePeering1To3, ServiceName).Return(nil) r.DeleteResource(gomockinternal.AContext(), &fakePeering3To1, ServiceName).Return(nil) + r.DeleteResource(gomockinternal.AContext(), &fakePeeringHubToSpoke, ServiceName).Return(nil) + r.DeleteResource(gomockinternal.AContext(), &fakePeeringSpokeToHub, ServiceName).Return(nil) p.UpdateDeleteStatus(infrav1.VnetPeeringReadyCondition, ServiceName, nil) }, }, @@ -289,6 +314,8 @@ func TestDeleteVnetPeerings(t *testing.T) { r.DeleteResource(gomockinternal.AContext(), &fakePeering2To1, ServiceName).Return(nil) r.DeleteResource(gomockinternal.AContext(), &fakePeering1To3, ServiceName).Return(internalError) r.DeleteResource(gomockinternal.AContext(), &fakePeering3To1, ServiceName).Return(nil) + r.DeleteResource(gomockinternal.AContext(), &fakePeeringHubToSpoke, ServiceName).Return(nil) + r.DeleteResource(gomockinternal.AContext(), &fakePeeringSpokeToHub, ServiceName).Return(nil) p.UpdateDeleteStatus(infrav1.VnetPeeringReadyCondition, ServiceName, internalError) }, }, @@ -301,6 +328,8 @@ func TestDeleteVnetPeerings(t *testing.T) { r.DeleteResource(gomockinternal.AContext(), &fakePeering2To1, ServiceName).Return(internalError) r.DeleteResource(gomockinternal.AContext(), &fakePeering1To3, ServiceName).Return(notDoneError) r.DeleteResource(gomockinternal.AContext(), &fakePeering3To1, ServiceName).Return(nil) + r.DeleteResource(gomockinternal.AContext(), &fakePeeringHubToSpoke, ServiceName).Return(nil) + r.DeleteResource(gomockinternal.AContext(), &fakePeeringSpokeToHub, ServiceName).Return(nil) p.UpdateDeleteStatus(infrav1.VnetPeeringReadyCondition, ServiceName, internalError) }, }, @@ -313,6 +342,8 @@ func TestDeleteVnetPeerings(t *testing.T) { r.DeleteResource(gomockinternal.AContext(), &fakePeering2To1, ServiceName).Return(nil) r.DeleteResource(gomockinternal.AContext(), &fakePeering1To3, ServiceName).Return(notDoneError) r.DeleteResource(gomockinternal.AContext(), &fakePeering3To1, ServiceName).Return(internalError) + r.DeleteResource(gomockinternal.AContext(), &fakePeeringHubToSpoke, ServiceName).Return(nil) + r.DeleteResource(gomockinternal.AContext(), &fakePeeringSpokeToHub, ServiceName).Return(nil) p.UpdateDeleteStatus(infrav1.VnetPeeringReadyCondition, ServiceName, internalError) }, }, @@ -325,6 +356,8 @@ func TestDeleteVnetPeerings(t *testing.T) { r.DeleteResource(gomockinternal.AContext(), &fakePeering2To1, ServiceName).Return(nil) r.DeleteResource(gomockinternal.AContext(), &fakePeering1To3, ServiceName).Return(notDoneError) r.DeleteResource(gomockinternal.AContext(), &fakePeering3To1, ServiceName).Return(nil) + r.DeleteResource(gomockinternal.AContext(), &fakePeeringHubToSpoke, ServiceName).Return(nil) + r.DeleteResource(gomockinternal.AContext(), &fakePeeringSpokeToHub, ServiceName).Return(nil) p.UpdateDeleteStatus(infrav1.VnetPeeringReadyCondition, ServiceName, notDoneError) }, }, diff --git a/azure/types.go b/azure/types.go index 60f7ff15e3d..873cf1cced4 100644 --- a/azure/types.go +++ b/azure/types.go @@ -68,6 +68,7 @@ type ScaleSetSpec struct { FailureDomains []string VMExtensions []infrav1.VMExtension NetworkInterfaces []infrav1.NetworkInterface + IPv6Enabled bool OrchestrationMode infrav1.OrchestrationModeType } diff --git a/cloudbuild.yaml b/cloudbuild.yaml index a2f67329240..9a6e51447d7 100644 --- a/cloudbuild.yaml +++ b/cloudbuild.yaml @@ -2,7 +2,7 @@ timeout: 2700s options: substitution_option: ALLOW_LOOSE - machineType: 'N1_HIGHCPU_8' + machineType: 'E2_HIGHCPU_8' steps: - name: 'gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20220609-2e4c91eb7e' entrypoint: make diff --git a/config/aso/crds.yaml b/config/aso/crds.yaml new file mode 100644 index 00000000000..f037c67c0c0 --- /dev/null +++ b/config/aso/crds.yaml @@ -0,0 +1,502 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + cert-manager.io/inject-ca-from: azureserviceoperator-system/azureserviceoperator-serving-cert + controller-gen.kubebuilder.io/version: v0.9.2 + labels: + serviceoperator.azure.com/version: v2.0.0 + name: resourcegroups.resources.azure.com +spec: + conversion: + strategy: Webhook + webhook: + clientConfig: + service: + name: azureserviceoperator-webhook-service + namespace: azureserviceoperator-system + path: /convert + port: 443 + conversionReviewVersions: + - v1 + group: resources.azure.com + names: + kind: ResourceGroup + listKind: ResourceGroupList + plural: resourcegroups + singular: resourcegroup + preserveUnknownFields: false + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .status.conditions[?(@.type=='Ready')].status + name: Ready + type: string + - jsonPath: .status.conditions[?(@.type=='Ready')].severity + name: Severity + type: string + - jsonPath: .status.conditions[?(@.type=='Ready')].reason + name: Reason + type: string + - jsonPath: .status.conditions[?(@.type=='Ready')].message + name: Message + type: string + name: v1api20200601 + schema: + openAPIV3Schema: + description: 'Generator information: - Generated from: /resources/resource-manager/Microsoft.Resources/stable/2020-06-01/resources.json - ARM URI: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}' + 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' + 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' + type: string + metadata: + type: object + spec: + properties: + azureName: + description: 'AzureName: The name of the resource in Azure. This is often the same as the name of the resource in Kubernetes but it doesn''t have to be.' + maxLength: 90 + minLength: 1 + type: string + location: + description: 'Location: The location of the resource group. It cannot be changed after the resource group has been created. It must be one of the supported Azure locations.' + type: string + managedBy: + description: 'ManagedBy: The ID of the resource that manages this resource group.' + type: string + tags: + additionalProperties: + type: string + description: 'Tags: The tags attached to the resource group.' + type: object + required: + - location + type: object + status: + description: Resource group information. + properties: + conditions: + description: 'Conditions: The observed state of the resource' + items: + description: Condition defines an extension to status (an observation) of a resource + properties: + lastTransitionTime: + description: LastTransitionTime is the last time the condition transitioned from one status to another. + format: date-time + type: string + message: + description: Message is a human readable message indicating details about the transition. This field may be empty. + type: string + observedGeneration: + description: ObservedGeneration is the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.condition[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance. + format: int64 + type: integer + reason: + description: Reason for the condition's last transition. Reasons are upper CamelCase (PascalCase) with no spaces. A reason is always provided, this field will not be empty. + type: string + severity: + description: Severity with which to treat failures of this type of condition. For conditions which have positive polarity (Status == True is their normal/healthy state), this will be omitted when Status == True For conditions which have negative polarity (Status == False is their normal/healthy state), this will be omitted when Status == False. This is omitted in all cases when Status == Unknown + type: string + status: + description: Status of the condition, one of True, False, or Unknown. + type: string + type: + description: Type of condition. + type: string + required: + - lastTransitionTime + - reason + - status + - type + type: object + type: array + id: + description: 'Id: The ID of the resource group.' + type: string + location: + description: 'Location: The location of the resource group. It cannot be changed after the resource group has been created. It must be one of the supported Azure locations.' + type: string + managedBy: + description: 'ManagedBy: The ID of the resource that manages this resource group.' + type: string + name: + description: 'Name: The name of the resource group.' + type: string + properties: + description: 'Properties: The resource group properties.' + properties: + provisioningState: + description: 'ProvisioningState: The provisioning state.' + type: string + type: object + tags: + additionalProperties: + type: string + description: 'Tags: The tags attached to the resource group.' + type: object + type: + description: 'Type: The type of the resource group.' + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} + - additionalPrinterColumns: + - jsonPath: .status.conditions[?(@.type=='Ready')].status + name: Ready + type: string + - jsonPath: .status.conditions[?(@.type=='Ready')].severity + name: Severity + type: string + - jsonPath: .status.conditions[?(@.type=='Ready')].reason + name: Reason + type: string + - jsonPath: .status.conditions[?(@.type=='Ready')].message + name: Message + type: string + name: v1api20200601storage + schema: + openAPIV3Schema: + description: 'Storage version of v1api20200601.ResourceGroup Generator information: - Generated from: /resources/resource-manager/Microsoft.Resources/stable/2020-06-01/resources.json - ARM URI: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}' + 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' + 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' + type: string + metadata: + type: object + spec: + description: Storage version of v1api20200601.ResourceGroup_Spec + properties: + $propertyBag: + additionalProperties: + type: string + description: PropertyBag is an unordered set of stashed information that used for properties not directly supported by storage resources, allowing for full fidelity round trip conversions + type: object + azureName: + description: 'AzureName: The name of the resource in Azure. This is often the same as the name of the resource in Kubernetes but it doesn''t have to be.' + maxLength: 90 + minLength: 1 + type: string + location: + type: string + managedBy: + type: string + originalVersion: + type: string + tags: + additionalProperties: + type: string + type: object + type: object + status: + description: Storage version of v1api20200601.ResourceGroup_STATUS Resource group information. + properties: + $propertyBag: + additionalProperties: + type: string + description: PropertyBag is an unordered set of stashed information that used for properties not directly supported by storage resources, allowing for full fidelity round trip conversions + type: object + conditions: + items: + description: Condition defines an extension to status (an observation) of a resource + properties: + lastTransitionTime: + description: LastTransitionTime is the last time the condition transitioned from one status to another. + format: date-time + type: string + message: + description: Message is a human readable message indicating details about the transition. This field may be empty. + type: string + observedGeneration: + description: ObservedGeneration is the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.condition[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance. + format: int64 + type: integer + reason: + description: Reason for the condition's last transition. Reasons are upper CamelCase (PascalCase) with no spaces. A reason is always provided, this field will not be empty. + type: string + severity: + description: Severity with which to treat failures of this type of condition. For conditions which have positive polarity (Status == True is their normal/healthy state), this will be omitted when Status == True For conditions which have negative polarity (Status == False is their normal/healthy state), this will be omitted when Status == False. This is omitted in all cases when Status == Unknown + type: string + status: + description: Status of the condition, one of True, False, or Unknown. + type: string + type: + description: Type of condition. + type: string + required: + - lastTransitionTime + - reason + - status + - type + type: object + type: array + id: + type: string + location: + type: string + managedBy: + type: string + name: + type: string + properties: + description: Storage version of v1api20200601.ResourceGroupProperties_STATUS The resource group properties. + properties: + $propertyBag: + additionalProperties: + type: string + description: PropertyBag is an unordered set of stashed information that used for properties not directly supported by storage resources, allowing for full fidelity round trip conversions + type: object + provisioningState: + type: string + type: object + tags: + additionalProperties: + type: string + type: object + type: + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {} + - additionalPrinterColumns: + - jsonPath: .status.conditions[?(@.type=='Ready')].status + name: Ready + type: string + - jsonPath: .status.conditions[?(@.type=='Ready')].severity + name: Severity + type: string + - jsonPath: .status.conditions[?(@.type=='Ready')].reason + name: Reason + type: string + - jsonPath: .status.conditions[?(@.type=='Ready')].message + name: Message + type: string + name: v1beta20200601 + schema: + openAPIV3Schema: + description: Deprecated version of ResourceGroup. Use v1api20200601.ResourceGroup instead + 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' + 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' + type: string + metadata: + type: object + spec: + properties: + azureName: + description: 'AzureName: The name of the resource in Azure. This is often the same as the name of the resource in Kubernetes but it doesn''t have to be.' + maxLength: 90 + minLength: 1 + type: string + location: + type: string + managedBy: + type: string + tags: + additionalProperties: + type: string + type: object + required: + - location + type: object + status: + description: Deprecated version of ResourceGroup_STATUS. Use v1api20200601.ResourceGroup_STATUS instead + properties: + conditions: + description: 'Conditions: The observed state of the resource' + items: + description: Condition defines an extension to status (an observation) of a resource + properties: + lastTransitionTime: + description: LastTransitionTime is the last time the condition transitioned from one status to another. + format: date-time + type: string + message: + description: Message is a human readable message indicating details about the transition. This field may be empty. + type: string + observedGeneration: + description: ObservedGeneration is the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.condition[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance. + format: int64 + type: integer + reason: + description: Reason for the condition's last transition. Reasons are upper CamelCase (PascalCase) with no spaces. A reason is always provided, this field will not be empty. + type: string + severity: + description: Severity with which to treat failures of this type of condition. For conditions which have positive polarity (Status == True is their normal/healthy state), this will be omitted when Status == True For conditions which have negative polarity (Status == False is their normal/healthy state), this will be omitted when Status == False. This is omitted in all cases when Status == Unknown + type: string + status: + description: Status of the condition, one of True, False, or Unknown. + type: string + type: + description: Type of condition. + type: string + required: + - lastTransitionTime + - reason + - status + - type + type: object + type: array + id: + type: string + location: + type: string + managedBy: + type: string + name: + type: string + properties: + description: Deprecated version of ResourceGroupProperties_STATUS. Use v1api20200601.ResourceGroupProperties_STATUS instead + properties: + provisioningState: + type: string + type: object + tags: + additionalProperties: + type: string + type: object + type: + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} + - additionalPrinterColumns: + - jsonPath: .status.conditions[?(@.type=='Ready')].status + name: Ready + type: string + - jsonPath: .status.conditions[?(@.type=='Ready')].severity + name: Severity + type: string + - jsonPath: .status.conditions[?(@.type=='Ready')].reason + name: Reason + type: string + - jsonPath: .status.conditions[?(@.type=='Ready')].message + name: Message + type: string + name: v1beta20200601storage + schema: + openAPIV3Schema: + description: Storage version of v1beta20200601.ResourceGroup Deprecated version of ResourceGroup. Use v1api20200601.ResourceGroup instead + 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' + 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' + type: string + metadata: + type: object + spec: + description: Storage version of v1beta20200601.ResourceGroup_Spec + properties: + $propertyBag: + additionalProperties: + type: string + description: PropertyBag is an unordered set of stashed information that used for properties not directly supported by storage resources, allowing for full fidelity round trip conversions + type: object + azureName: + description: 'AzureName: The name of the resource in Azure. This is often the same as the name of the resource in Kubernetes but it doesn''t have to be.' + maxLength: 90 + minLength: 1 + type: string + location: + type: string + managedBy: + type: string + originalVersion: + type: string + tags: + additionalProperties: + type: string + type: object + type: object + status: + description: Storage version of v1beta20200601.ResourceGroup_STATUS Deprecated version of ResourceGroup_STATUS. Use v1api20200601.ResourceGroup_STATUS instead + properties: + $propertyBag: + additionalProperties: + type: string + description: PropertyBag is an unordered set of stashed information that used for properties not directly supported by storage resources, allowing for full fidelity round trip conversions + type: object + conditions: + items: + description: Condition defines an extension to status (an observation) of a resource + properties: + lastTransitionTime: + description: LastTransitionTime is the last time the condition transitioned from one status to another. + format: date-time + type: string + message: + description: Message is a human readable message indicating details about the transition. This field may be empty. + type: string + observedGeneration: + description: ObservedGeneration is the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.condition[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance. + format: int64 + type: integer + reason: + description: Reason for the condition's last transition. Reasons are upper CamelCase (PascalCase) with no spaces. A reason is always provided, this field will not be empty. + type: string + severity: + description: Severity with which to treat failures of this type of condition. For conditions which have positive polarity (Status == True is their normal/healthy state), this will be omitted when Status == True For conditions which have negative polarity (Status == False is their normal/healthy state), this will be omitted when Status == False. This is omitted in all cases when Status == Unknown + type: string + status: + description: Status of the condition, one of True, False, or Unknown. + type: string + type: + description: Type of condition. + type: string + required: + - lastTransitionTime + - reason + - status + - type + type: object + type: array + id: + type: string + location: + type: string + managedBy: + type: string + name: + type: string + properties: + description: Storage version of v1beta20200601.ResourceGroupProperties_STATUS Deprecated version of ResourceGroupProperties_STATUS. Use v1api20200601.ResourceGroupProperties_STATUS instead + properties: + $propertyBag: + additionalProperties: + type: string + description: PropertyBag is an unordered set of stashed information that used for properties not directly supported by storage resources, allowing for full fidelity round trip conversions + type: object + provisioningState: + type: string + type: object + tags: + additionalProperties: + type: string + type: object + type: + type: string + type: object + type: object + served: true + storage: false + subresources: + status: {} diff --git a/config/aso/credentials.yaml b/config/aso/credentials.yaml new file mode 100644 index 00000000000..6476ac11352 --- /dev/null +++ b/config/aso/credentials.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: Secret +metadata: + name: aso-controller-settings +type: Opaque +data: + AZURE_SUBSCRIPTION_ID: ${AZURE_SUBSCRIPTION_ID_B64:=""} + AZURE_TENANT_ID: ${AZURE_TENANT_ID_B64:=""} + AZURE_CLIENT_ID: ${AZURE_CLIENT_ID_B64:=""} + AZURE_CLIENT_SECRET: ${AZURE_CLIENT_SECRET_B64:=""} diff --git a/config/aso/kustomization.yaml b/config/aso/kustomization.yaml new file mode 100644 index 00000000000..b43b545b5b8 --- /dev/null +++ b/config/aso/kustomization.yaml @@ -0,0 +1,65 @@ +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component +namespace: capz-system +resources: +- https://github.com/Azure/azure-service-operator/releases/download/v2.0.0/azureserviceoperator_v2.0.0.yaml +- crds.yaml +- credentials.yaml + +patches: + - patch: |- # default kustomization includes a namespace already + $patch: delete + apiVersion: v1 + kind: Namespace + metadata: + name: capz-system + - patch: |- # CAPZ will manage ASO's CRDs + - op: test + path: /spec/template/spec/containers/0/args/4 + value: --crd-pattern=* + - op: remove + path: /spec/template/spec/containers/0/args/4 + target: + group: apps + version: v1 + kind: Deployment + name: azureserviceoperator-controller-manager + - patch: |- # remove permissions to manage CRDs + $patch: delete + apiVersion: rbac.authorization.k8s.io/v1 + kind: ClusterRole + metadata: + name: azureserviceoperator-crd-manager-role + - patch: |- + $patch: delete + apiVersion: rbac.authorization.k8s.io/v1 + kind: ClusterRoleBinding + metadata: + name: azureserviceoperator-crd-manager-rolebinding + +replacements: + - source: + kind: Certificate + group: cert-manager.io + version: v1 + name: azureserviceoperator-serving-cert + fieldPath: metadata.namespace + targets: + - select: + version: v1 + fieldPaths: + - metadata.annotations.cert-manager\.io/inject-ca-from + options: + delimiter: / + index: 0 + - select: + group: cert-manager.io + version: v1 + kind: Certificate + name: azureserviceoperator-serving-cert + fieldPaths: + - spec.dnsNames.0 + - spec.dnsNames.1 + options: + delimiter: . + index: 1 diff --git a/config/default/aad-pod-identity-deployment.yaml b/config/capz/aad-pod-identity-deployment.yaml similarity index 100% rename from config/default/aad-pod-identity-deployment.yaml rename to config/capz/aad-pod-identity-deployment.yaml diff --git a/config/default/credentials.yaml b/config/capz/credentials.yaml similarity index 100% rename from config/default/credentials.yaml rename to config/capz/credentials.yaml diff --git a/config/capz/kustomization.yaml b/config/capz/kustomization.yaml new file mode 100644 index 00000000000..e5e7199c267 --- /dev/null +++ b/config/capz/kustomization.yaml @@ -0,0 +1,57 @@ +namespace: capz-system + +namePrefix: capz- + +# Labels to add to all resources and selectors. +commonLabels: + cluster.x-k8s.io/provider: "infrastructure-azure" + +resources: + - namespace.yaml + - credentials.yaml + - aad-pod-identity-deployment.yaml + +bases: + - ../crd + - ../rbac + - ../manager + - ../webhook + - ../certmanager + +patchesStrategicMerge: + - manager_image_patch.yaml + - manager_pull_policy.yaml + - manager_credentials_patch.yaml + - manager_webhook_patch.yaml + - webhookcainjection_patch.yaml + +vars: + - name: CERTIFICATE_NAMESPACE # namespace of the certificate CR + objref: + kind: Certificate + group: cert-manager.io + version: v1 + name: serving-cert # this name should match the one in certificate.yaml + fieldref: + fieldpath: metadata.namespace + - name: CERTIFICATE_NAME + objref: + kind: Certificate + group: cert-manager.io + version: v1 + name: serving-cert # this name should match the one in certificate.yaml + - name: SERVICE_NAMESPACE # namespace of the service + objref: + kind: Service + version: v1 + name: webhook-service + fieldref: + fieldpath: metadata.namespace + - name: SERVICE_NAME + objref: + kind: Service + version: v1 + name: webhook-service + +configurations: + - kustomizeconfig.yaml diff --git a/config/default/kustomizeconfig.yaml b/config/capz/kustomizeconfig.yaml similarity index 100% rename from config/default/kustomizeconfig.yaml rename to config/capz/kustomizeconfig.yaml diff --git a/config/default/manager_credentials_patch.yaml b/config/capz/manager_credentials_patch.yaml similarity index 100% rename from config/default/manager_credentials_patch.yaml rename to config/capz/manager_credentials_patch.yaml diff --git a/config/default/manager_image_patch.yaml b/config/capz/manager_image_patch.yaml similarity index 100% rename from config/default/manager_image_patch.yaml rename to config/capz/manager_image_patch.yaml diff --git a/config/default/manager_prometheus_metrics_patch.yaml b/config/capz/manager_prometheus_metrics_patch.yaml similarity index 100% rename from config/default/manager_prometheus_metrics_patch.yaml rename to config/capz/manager_prometheus_metrics_patch.yaml diff --git a/config/default/manager_pull_policy.yaml b/config/capz/manager_pull_policy.yaml similarity index 100% rename from config/default/manager_pull_policy.yaml rename to config/capz/manager_pull_policy.yaml diff --git a/config/default/manager_webhook_patch.yaml b/config/capz/manager_webhook_patch.yaml similarity index 100% rename from config/default/manager_webhook_patch.yaml rename to config/capz/manager_webhook_patch.yaml diff --git a/config/capz/namespace.yaml b/config/capz/namespace.yaml new file mode 100644 index 00000000000..d331b0ad036 --- /dev/null +++ b/config/capz/namespace.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: system + labels: + # this is required due to the nmi daemonset + pod-security.kubernetes.io/enforce: privileged diff --git a/config/default/webhookcainjection_patch.yaml b/config/capz/webhookcainjection_patch.yaml similarity index 100% rename from config/default/webhookcainjection_patch.yaml rename to config/capz/webhookcainjection_patch.yaml diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_azureclusteridentities.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_azureclusteridentities.yaml index 5f78d92e64f..6d0333e5f03 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_azureclusteridentities.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_azureclusteridentities.yaml @@ -17,304 +17,6 @@ spec: singular: azureclusteridentity scope: Namespaced versions: - - name: v1alpha3 - schema: - openAPIV3Schema: - description: AzureClusterIdentity is the Schema for the azureclustersidentities - 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' - 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' - type: string - metadata: - type: object - spec: - description: AzureClusterIdentitySpec defines the parameters that are - used to create an AzureIdentity. - properties: - allowedNamespaces: - description: "AllowedNamespaces is an array of namespaces that AzureClusters - can use this Identity from. \n An empty list (default) indicates - that AzureClusters can use this Identity from any namespace. This - field is intentionally not a pointer because the nil behavior (no - namespaces) is undesirable here." - items: - type: string - type: array - clientID: - description: Both User Assigned MSI and SP can use this field. - type: string - clientSecret: - description: ClientSecret is a secret reference which should contain - either a Service Principal password or certificate secret. - properties: - name: - description: name is unique within a namespace to reference a - secret resource. - type: string - namespace: - description: namespace defines the space within which the secret - name must be unique. - type: string - type: object - x-kubernetes-map-type: atomic - resourceID: - description: User assigned MSI resource id. - type: string - tenantID: - description: Service principal primary tenant id. - type: string - type: - description: UserAssignedMSI or Service Principal - enum: - - ServicePrincipal - - UserAssignedMSI - type: string - required: - - clientID - - tenantID - - type - type: object - status: - description: AzureClusterIdentityStatus defines the observed state of - AzureClusterIdentity. - properties: - conditions: - description: Conditions defines current service state of the AzureClusterIdentity. - items: - description: Condition defines an observation of a Cluster API resource - 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. - format: date-time - type: string - message: - 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. - 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. - 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. - type: string - required: - - status - - type - type: object - type: array - type: object - type: object - served: true - storage: false - subresources: - status: {} - - name: v1alpha4 - schema: - openAPIV3Schema: - description: AzureClusterIdentity is the Schema for the azureclustersidentities - 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' - 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' - type: string - metadata: - type: object - spec: - description: AzureClusterIdentitySpec defines the parameters that are - used to create an AzureIdentity. - properties: - allowedNamespaces: - description: AllowedNamespaces is used to identify the namespaces - the clusters are allowed to use the identity from. Namespaces can - be selected either using an array of namespaces or with label selector. - An empty allowedNamespaces object indicates that AzureClusters can - use this identity from any namespace. If this object is nil, no - namespaces will be allowed (default behaviour, if this field is - not provided) A namespace should be either in the NamespaceList - or match with Selector to use the identity. - nullable: true - properties: - list: - description: A nil or empty list indicates that AzureCluster cannot - use the identity from any namespace. - items: - type: string - nullable: true - type: array - selector: - description: "Selector is a selector of namespaces that AzureCluster - can use this Identity from. This is a standard Kubernetes LabelSelector, - a label query over a set of resources. The result of matchLabels - and matchExpressions are ANDed. \n A nil or empty selector indicates - that AzureCluster cannot use this AzureClusterIdentity from - any namespace." - properties: - matchExpressions: - description: matchExpressions is a list of label selector - requirements. The requirements are ANDed. - items: - description: A label selector requirement is a selector - that contains values, a key, and an operator that relates - the key and values. - properties: - key: - description: key is the label key that the selector - applies to. - type: string - operator: - description: operator represents a key's relationship - to a set of values. Valid operators are In, NotIn, - Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. If - the operator is In or NotIn, the values array must - be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced - during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: matchLabels is a map of {key,value} pairs. A - single {key,value} in the matchLabels map is equivalent - to an element of matchExpressions, whose key field is "key", - the operator is "In", and the values array contains only - "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - type: object - clientID: - description: Both User Assigned MSI and SP can use this field. - type: string - clientSecret: - description: ClientSecret is a secret reference which should contain - either a Service Principal password or certificate secret. - properties: - name: - description: name is unique within a namespace to reference a - secret resource. - type: string - namespace: - description: namespace defines the space within which the secret - name must be unique. - type: string - type: object - x-kubernetes-map-type: atomic - resourceID: - description: User assigned MSI resource id. - type: string - tenantID: - description: Service principal primary tenant id. - type: string - type: - description: UserAssignedMSI or Service Principal - enum: - - ServicePrincipal - - UserAssignedMSI - type: string - required: - - clientID - - tenantID - - type - type: object - status: - description: AzureClusterIdentityStatus defines the observed state of - AzureClusterIdentity. - properties: - conditions: - description: Conditions defines current service state of the AzureClusterIdentity. - items: - description: Condition defines an observation of a Cluster API resource - 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. - format: date-time - type: string - message: - 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. - 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. - 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. - type: string - required: - - status - - type - type: object - type: array - type: object - type: object - served: true - storage: false - subresources: - status: {} - additionalPrinterColumns: - description: Type of Azure Identity jsonPath: .spec.type diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_azureclusters.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_azureclusters.yaml index 041665518c9..2bd43f2772d 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_azureclusters.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_azureclusters.yaml @@ -17,1229 +17,6 @@ spec: singular: azurecluster scope: Namespaced versions: - - additionalPrinterColumns: - - description: Cluster to which this AzureCluster belongs - jsonPath: .metadata.labels.cluster\.x-k8s\.io/cluster-name - name: Cluster - type: string - - jsonPath: .status.ready - name: Ready - type: boolean - - jsonPath: .spec.resourceGroup - name: Resource Group - priority: 1 - type: string - - jsonPath: .spec.subscriptionID - name: SubscriptionID - priority: 1 - type: string - - jsonPath: .spec.location - name: Location - priority: 1 - type: string - - description: Control Plane Endpoint - jsonPath: .spec.controlPlaneEndpoint.host - name: Endpoint - priority: 1 - type: string - name: v1alpha3 - schema: - openAPIV3Schema: - description: AzureCluster is the Schema for the azureclusters 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' - 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' - type: string - metadata: - type: object - spec: - description: AzureClusterSpec defines the desired state of AzureCluster. - properties: - additionalTags: - additionalProperties: - type: string - description: AdditionalTags is an optional set of tags to add to Azure - resources managed by the Azure provider, in addition to the ones - added by default. - type: object - controlPlaneEndpoint: - description: ControlPlaneEndpoint represents the endpoint used to - communicate with the control plane. - properties: - host: - description: The hostname on which the API server is serving. - type: string - port: - description: The port on which the API server is serving. - format: int32 - type: integer - required: - - host - - port - type: object - identityRef: - description: IdentityRef is a reference to a AzureIdentity to be used - when reconciling this cluster - 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.' - type: string - kind: - 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' - type: string - namespace: - 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' - type: string - uid: - 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 - location: - type: string - networkSpec: - description: NetworkSpec encapsulates all things related to Azure - network. - properties: - apiServerLB: - description: APIServerLB is the configuration for the control-plane - load balancer. - properties: - frontendIPs: - items: - description: FrontendIP defines a load balancer frontend - IP configuration. - properties: - name: - minLength: 1 - type: string - privateIP: - type: string - publicIP: - description: PublicIPSpec defines the inputs to create - an Azure public IP address. - properties: - dnsName: - type: string - name: - type: string - required: - - name - type: object - required: - - name - type: object - type: array - id: - type: string - name: - type: string - sku: - description: SKU defines an Azure load balancer SKU. - type: string - type: - description: LBType defines an Azure load balancer Type. - type: string - type: object - subnets: - description: Subnets is the configuration for the control-plane - subnet and the node subnet. - items: - description: SubnetSpec configures an Azure subnet. - properties: - cidrBlock: - description: 'CidrBlock is the CIDR block to be used when - the provider creates a managed Vnet. Deprecated: Use CIDRBlocks - instead' - type: string - cidrBlocks: - description: CIDRBlocks defines the subnet's address space, - specified as one or more address prefixes in CIDR notation. - items: - type: string - type: array - id: - description: ID defines a unique identifier to reference - this resource. - type: string - internalLBIPAddress: - description: 'InternalLBIPAddress is the IP address that - will be used as the internal LB private IP. For the control - plane subnet only. Deprecated: Use LoadBalancer private - IP instead' - type: string - name: - description: Name defines a name for the subnet resource. - type: string - role: - description: Role defines the subnet role (eg. Node, ControlPlane) - type: string - routeTable: - description: RouteTable defines the route table that should - be attached to this subnet. - properties: - id: - type: string - name: - type: string - type: object - securityGroup: - description: SecurityGroup defines the NSG (network security - group) that should be attached to this subnet. - properties: - id: - type: string - ingressRule: - description: IngressRules is a slice of Azure ingress - rules for security groups. - items: - description: IngressRule defines an Azure ingress - rule for security groups. - properties: - description: - type: string - destination: - description: Destination - The destination address - prefix. CIDR or destination IP range. Asterix - '*' can also be used to match all source IPs. - Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' - and 'Internet' can also be used. - type: string - destinationPorts: - description: DestinationPorts - The destination - port or range. Integer or range between 0 and - 65535. Asterix '*' can also be used to match - all ports. - type: string - name: - type: string - priority: - description: Priority - A number between 100 and - 4096. Each rule should have a unique value for - priority. Rules are processed in priority order, - with lower numbers processed before higher numbers. - Once traffic matches a rule, processing stops. - format: int32 - type: integer - protocol: - description: SecurityGroupProtocol defines the - protocol type for a security group rule. - type: string - source: - description: Source - The CIDR or source IP range. - Asterix '*' can also be used to match all source - IPs. Default tags such as 'VirtualNetwork', - 'AzureLoadBalancer' and 'Internet' can also - be used. If this is an ingress rule, specifies - where network traffic originates from. - type: string - sourcePorts: - description: SourcePorts - The source port or - range. Integer or range between 0 and 65535. - Asterix '*' can also be used to match all ports. - type: string - required: - - description - - name - - protocol - type: object - type: array - name: - type: string - tags: - additionalProperties: - type: string - description: Tags defines a map of tags. - type: object - type: object - required: - - name - type: object - type: array - vnet: - description: Vnet is the configuration for the Azure virtual network. - properties: - cidrBlock: - description: 'CidrBlock is the CIDR block to be used when - the provider creates a managed virtual network. Deprecated: - Use CIDRBlocks instead' - type: string - cidrBlocks: - description: CIDRBlocks defines the virtual network's address - space, specified as one or more address prefixes in CIDR - notation. - items: - type: string - type: array - id: - description: ID is the identifier of the virtual network this - provider should use to create resources. - type: string - name: - description: Name defines a name for the virtual network resource. - type: string - resourceGroup: - description: ResourceGroup is the name of the resource group - of the existing virtual network or the resource group where - a managed virtual network should be created. - type: string - tags: - additionalProperties: - type: string - description: Tags is a collection of tags describing the resource. - type: object - required: - - name - type: object - type: object - resourceGroup: - type: string - subscriptionID: - type: string - required: - - location - type: object - status: - description: AzureClusterStatus defines the observed state of AzureCluster. - properties: - conditions: - description: Conditions defines current service state of the AzureCluster. - items: - description: Condition defines an observation of a Cluster API resource - 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. - format: date-time - type: string - message: - 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. - 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. - 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. - type: string - required: - - status - - type - type: object - 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. - properties: - attributes: - additionalProperties: - type: string - description: Attributes is a free form map of attributes an - infrastructure provider might use or require. - type: object - controlPlane: - description: ControlPlane determines if this failure domain - is suitable for use by control plane machines. - type: boolean - type: object - description: 'FailureDomains specifies the list of unique failure - domains for the location/region of the cluster. A FailureDomain - maps to Availability Zone with an Azure Region (if the region support - them). An Availability Zone is a separate data center within a region - and they can be used to ensure the cluster is more resilient to - failure. See: https://learn.microsoft.com/azure/reliability/availability-zones-overview - This list will be used by Cluster API to try and spread the machines - across the failure domains.' - type: object - ready: - description: Ready is true when the provider resource is ready. - type: boolean - type: object - type: object - served: true - storage: false - subresources: - status: {} - - additionalPrinterColumns: - - description: Cluster to which this AzureCluster belongs - jsonPath: .metadata.labels.cluster\.x-k8s\.io/cluster-name - name: Cluster - type: string - - jsonPath: .status.conditions[?(@.type=='Ready')].status - name: Ready - type: string - - jsonPath: .status.conditions[?(@.type=='Ready')].reason - name: Reason - type: string - - jsonPath: .status.conditions[?(@.type=='Ready')].message - name: Message - priority: 1 - type: string - - jsonPath: .spec.resourceGroup - name: Resource Group - priority: 1 - type: string - - jsonPath: .spec.subscriptionID - name: SubscriptionID - priority: 1 - type: string - - jsonPath: .spec.location - name: Location - priority: 1 - type: string - - description: Control Plane Endpoint - jsonPath: .spec.controlPlaneEndpoint.host - name: Endpoint - priority: 1 - type: string - name: v1alpha4 - schema: - openAPIV3Schema: - description: AzureCluster is the Schema for the azureclusters 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' - 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' - type: string - metadata: - type: object - spec: - description: AzureClusterSpec defines the desired state of AzureCluster. - properties: - additionalTags: - additionalProperties: - type: string - description: AdditionalTags is an optional set of tags to add to Azure - resources managed by the Azure provider, in addition to the ones - added by default. - type: object - azureEnvironment: - description: 'AzureEnvironment is the name of the AzureCloud to be - used. The default value that would be used by most users is "AzurePublicCloud", - other values are: - ChinaCloud: "AzureChinaCloud" - GermanCloud: - "AzureGermanCloud" - PublicCloud: "AzurePublicCloud" - USGovernmentCloud: - "AzureUSGovernmentCloud"' - type: string - bastionSpec: - description: BastionSpec encapsulates all things related to the Bastions - in the cluster. - properties: - azureBastion: - description: AzureBastion specifies how the Azure Bastion cloud - component should be configured. - properties: - name: - type: string - publicIP: - description: PublicIPSpec defines the inputs to create an - Azure public IP address. - properties: - dnsName: - type: string - name: - type: string - required: - - name - type: object - subnet: - description: SubnetSpec configures an Azure subnet. - properties: - cidrBlocks: - description: CIDRBlocks defines the subnet's address space, - specified as one or more address prefixes in CIDR notation. - items: - type: string - type: array - id: - description: ID defines a unique identifier to reference - this resource. - type: string - name: - description: Name defines a name for the subnet resource. - type: string - natGateway: - description: NatGateway associated with this subnet. - properties: - id: - type: string - ip: - description: PublicIPSpec defines the inputs to create - an Azure public IP address. - properties: - dnsName: - type: string - name: - type: string - required: - - name - type: object - name: - type: string - type: object - role: - description: Role defines the subnet role (eg. Node, ControlPlane) - type: string - routeTable: - description: RouteTable defines the route table that should - be attached to this subnet. - properties: - id: - type: string - name: - type: string - type: object - securityGroup: - description: SecurityGroup defines the NSG (network security - group) that should be attached to this subnet. - properties: - id: - type: string - name: - type: string - securityRules: - description: SecurityRules is a slice of Azure security - rules for security groups. - items: - description: SecurityRule defines an Azure security - rule for security groups. - properties: - description: - description: A description for this rule. Restricted - to 140 chars. - type: string - destination: - description: Destination is the destination - address prefix. CIDR or destination IP range. - Asterix '*' can also be used to match all - source IPs. Default tags such as 'VirtualNetwork', - 'AzureLoadBalancer' and 'Internet' can also - be used. - type: string - destinationPorts: - description: DestinationPorts specifies the - destination port or range. Integer or range - between 0 and 65535. Asterix '*' can also - be used to match all ports. - type: string - direction: - description: Direction indicates whether the - rule applies to inbound, or outbound traffic. - "Inbound" or "Outbound". - enum: - - Inbound - - Outbound - type: string - name: - description: Name is a unique name within the - network security group. - type: string - priority: - description: Priority is a number between 100 - and 4096. Each rule should have a unique value - for priority. Rules are processed in priority - order, with lower numbers processed before - higher numbers. Once traffic matches a rule, - processing stops. - format: int32 - type: integer - protocol: - description: Protocol specifies the protocol - type. "Tcp", "Udp", "Icmp", or "*". - enum: - - Tcp - - Udp - - Icmp - - '*' - type: string - source: - description: Source specifies the CIDR or source - IP range. Asterix '*' can also be used to - match all source IPs. Default tags such as - 'VirtualNetwork', 'AzureLoadBalancer' and - 'Internet' can also be used. If this is an - ingress rule, specifies where network traffic - originates from. - type: string - sourcePorts: - description: SourcePorts specifies source port - or range. Integer or range between 0 and 65535. - Asterix '*' can also be used to match all - ports. - type: string - required: - - description - - direction - - name - - protocol - type: object - type: array - tags: - additionalProperties: - type: string - description: Tags defines a map of tags. - type: object - type: object - required: - - name - type: object - type: object - type: object - cloudProviderConfigOverrides: - description: 'CloudProviderConfigOverrides is an optional set of configuration - values that can be overridden in azure cloud provider config. This - is only a subset of options that are available in azure cloud provider - config. Some values for the cloud provider config are inferred from - other parts of cluster api provider azure spec, and may not be available - for overrides. See: https://kubernetes-sigs.github.io/cloud-provider-azure/install/configs - Note: All cloud provider config values can be customized by creating - the secret beforehand. CloudProviderConfigOverrides is only used - when the secret is managed by the Azure Provider.' - properties: - backOffs: - description: BackOffConfig indicates the back-off config options. - properties: - cloudProviderBackoff: - type: boolean - cloudProviderBackoffDuration: - type: integer - cloudProviderBackoffExponent: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - cloudProviderBackoffJitter: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - cloudProviderBackoffRetries: - type: integer - type: object - rateLimits: - items: - description: 'RateLimitSpec represents the rate limit configuration - for a particular kind of resource. Eg. loadBalancerRateLimit - is used to configure rate limits for load balancers. This - eventually gets converted to CloudProviderRateLimitConfig - that cloud-provider-azure expects. See: https://github.com/kubernetes-sigs/cloud-provider-azure/blob/d585c2031925b39c925624302f22f8856e29e352/pkg/provider/azure_ratelimit.go#L25 - We cannot use CloudProviderRateLimitConfig directly because - floating point values are not supported in controller-tools. - See: https://github.com/kubernetes-sigs/controller-tools/issues/245' - properties: - config: - description: RateLimitConfig indicates the rate limit config - options. - properties: - cloudProviderRateLimit: - type: boolean - cloudProviderRateLimitBucket: - type: integer - cloudProviderRateLimitBucketWrite: - type: integer - cloudProviderRateLimitQPS: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - cloudProviderRateLimitQPSWrite: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - name: - description: Name is the name of the rate limit spec. - enum: - - defaultRateLimit - - routeRateLimit - - subnetsRateLimit - - interfaceRateLimit - - routeTableRateLimit - - loadBalancerRateLimit - - publicIPAddressRateLimit - - securityGroupRateLimit - - virtualMachineRateLimit - - storageAccountRateLimit - - diskRateLimit - - snapshotRateLimit - - virtualMachineScaleSetRateLimit - - virtualMachineSizesRateLimit - - availabilitySetRateLimit - type: string - type: object - type: array - type: object - controlPlaneEndpoint: - description: ControlPlaneEndpoint represents the endpoint used to - communicate with the control plane. - properties: - host: - description: The hostname on which the API server is serving. - type: string - port: - description: The port on which the API server is serving. - format: int32 - type: integer - required: - - host - - port - type: object - identityRef: - description: IdentityRef is a reference to an AzureIdentity to be - used when reconciling this cluster - 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.' - type: string - kind: - 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' - type: string - namespace: - 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' - type: string - uid: - 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 - location: - type: string - networkSpec: - description: NetworkSpec encapsulates all things related to Azure - network. - properties: - apiServerLB: - description: APIServerLB is the configuration for the control-plane - load balancer. - properties: - frontendIPs: - items: - description: FrontendIP defines a load balancer frontend - IP configuration. - properties: - name: - minLength: 1 - type: string - privateIP: - type: string - publicIP: - description: PublicIPSpec defines the inputs to create - an Azure public IP address. - properties: - dnsName: - type: string - name: - type: string - required: - - name - type: object - required: - - name - type: object - type: array - frontendIPsCount: - description: FrontendIPsCount specifies the number of frontend - IP addresses for the load balancer. - format: int32 - type: integer - id: - type: string - idleTimeoutInMinutes: - description: IdleTimeoutInMinutes specifies the timeout for - the TCP idle connection. - format: int32 - type: integer - name: - type: string - sku: - description: SKU defines an Azure load balancer SKU. - type: string - type: - description: LBType defines an Azure load balancer Type. - type: string - type: object - controlPlaneOutboundLB: - description: ControlPlaneOutboundLB is the configuration for the - control-plane outbound load balancer. This is different from - APIServerLB, and is used only in private clusters (optionally) - for enabling outbound traffic. - properties: - frontendIPs: - items: - description: FrontendIP defines a load balancer frontend - IP configuration. - properties: - name: - minLength: 1 - type: string - privateIP: - type: string - publicIP: - description: PublicIPSpec defines the inputs to create - an Azure public IP address. - properties: - dnsName: - type: string - name: - type: string - required: - - name - type: object - required: - - name - type: object - type: array - frontendIPsCount: - description: FrontendIPsCount specifies the number of frontend - IP addresses for the load balancer. - format: int32 - type: integer - id: - type: string - idleTimeoutInMinutes: - description: IdleTimeoutInMinutes specifies the timeout for - the TCP idle connection. - format: int32 - type: integer - name: - type: string - sku: - description: SKU defines an Azure load balancer SKU. - type: string - type: - description: LBType defines an Azure load balancer Type. - type: string - type: object - nodeOutboundLB: - description: NodeOutboundLB is the configuration for the node - outbound load balancer. - properties: - frontendIPs: - items: - description: FrontendIP defines a load balancer frontend - IP configuration. - properties: - name: - minLength: 1 - type: string - privateIP: - type: string - publicIP: - description: PublicIPSpec defines the inputs to create - an Azure public IP address. - properties: - dnsName: - type: string - name: - type: string - required: - - name - type: object - required: - - name - type: object - type: array - frontendIPsCount: - description: FrontendIPsCount specifies the number of frontend - IP addresses for the load balancer. - format: int32 - type: integer - id: - type: string - idleTimeoutInMinutes: - description: IdleTimeoutInMinutes specifies the timeout for - the TCP idle connection. - format: int32 - type: integer - name: - type: string - sku: - description: SKU defines an Azure load balancer SKU. - type: string - type: - description: LBType defines an Azure load balancer Type. - type: string - type: object - privateDNSZoneName: - description: PrivateDNSZoneName defines the zone name for the - Azure Private DNS. - type: string - subnets: - description: Subnets is the configuration for the control-plane - subnet and the node subnet. - items: - description: SubnetSpec configures an Azure subnet. - properties: - cidrBlocks: - description: CIDRBlocks defines the subnet's address space, - specified as one or more address prefixes in CIDR notation. - items: - type: string - type: array - id: - description: ID defines a unique identifier to reference - this resource. - type: string - name: - description: Name defines a name for the subnet resource. - type: string - natGateway: - description: NatGateway associated with this subnet. - properties: - id: - type: string - ip: - description: PublicIPSpec defines the inputs to create - an Azure public IP address. - properties: - dnsName: - type: string - name: - type: string - required: - - name - type: object - name: - type: string - type: object - role: - description: Role defines the subnet role (eg. Node, ControlPlane) - type: string - routeTable: - description: RouteTable defines the route table that should - be attached to this subnet. - properties: - id: - type: string - name: - type: string - type: object - securityGroup: - description: SecurityGroup defines the NSG (network security - group) that should be attached to this subnet. - properties: - id: - type: string - name: - type: string - securityRules: - description: SecurityRules is a slice of Azure security - rules for security groups. - items: - description: SecurityRule defines an Azure security - rule for security groups. - properties: - description: - description: A description for this rule. Restricted - to 140 chars. - type: string - destination: - description: Destination is the destination address - prefix. CIDR or destination IP range. Asterix - '*' can also be used to match all source IPs. - Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' - and 'Internet' can also be used. - type: string - destinationPorts: - description: DestinationPorts specifies the destination - port or range. Integer or range between 0 and - 65535. Asterix '*' can also be used to match - all ports. - type: string - direction: - description: Direction indicates whether the rule - applies to inbound, or outbound traffic. "Inbound" - or "Outbound". - enum: - - Inbound - - Outbound - type: string - name: - description: Name is a unique name within the - network security group. - type: string - priority: - description: Priority is a number between 100 - and 4096. Each rule should have a unique value - for priority. Rules are processed in priority - order, with lower numbers processed before higher - numbers. Once traffic matches a rule, processing - stops. - format: int32 - type: integer - protocol: - description: Protocol specifies the protocol type. - "Tcp", "Udp", "Icmp", or "*". - enum: - - Tcp - - Udp - - Icmp - - '*' - type: string - source: - description: Source specifies the CIDR or source - IP range. Asterix '*' can also be used to match - all source IPs. Default tags such as 'VirtualNetwork', - 'AzureLoadBalancer' and 'Internet' can also - be used. If this is an ingress rule, specifies - where network traffic originates from. - type: string - sourcePorts: - description: SourcePorts specifies source port - or range. Integer or range between 0 and 65535. - Asterix '*' can also be used to match all ports. - type: string - required: - - description - - direction - - name - - protocol - type: object - type: array - tags: - additionalProperties: - type: string - description: Tags defines a map of tags. - type: object - type: object - required: - - name - type: object - type: array - vnet: - description: Vnet is the configuration for the Azure virtual network. - properties: - cidrBlocks: - description: CIDRBlocks defines the virtual network's address - space, specified as one or more address prefixes in CIDR - notation. - items: - type: string - type: array - id: - description: ID is the identifier of the virtual network this - provider should use to create resources. - type: string - name: - description: Name defines a name for the virtual network resource. - type: string - resourceGroup: - description: ResourceGroup is the name of the resource group - of the existing virtual network or the resource group where - a managed virtual network should be created. - type: string - tags: - additionalProperties: - type: string - description: Tags is a collection of tags describing the resource. - type: object - required: - - name - type: object - type: object - resourceGroup: - type: string - subscriptionID: - type: string - required: - - location - type: object - status: - description: AzureClusterStatus defines the observed state of AzureCluster. - properties: - conditions: - description: Conditions defines current service state of the AzureCluster. - items: - description: Condition defines an observation of a Cluster API resource - 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. - format: date-time - type: string - message: - 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. - 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. - 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. - type: string - required: - - status - - type - type: object - 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. - properties: - attributes: - additionalProperties: - type: string - description: Attributes is a free form map of attributes an - infrastructure provider might use or require. - type: object - controlPlane: - description: ControlPlane determines if this failure domain - is suitable for use by control plane machines. - type: boolean - type: object - description: 'FailureDomains specifies the list of unique failure - domains for the location/region of the cluster. A FailureDomain - maps to Availability Zone with an Azure Region (if the region support - them). An Availability Zone is a separate data center within a region - and they can be used to ensure the cluster is more resilient to - failure. See: https://learn.microsoft.com/azure/reliability/availability-zones-overview - This list will be used by Cluster API to try and spread the machines - across the failure domains.' - type: object - longRunningOperationStates: - description: LongRunningOperationStates saves the states for Azure - long-running operations so they can be continued on the next reconciliation - loop. - items: - description: Future contains the data needed for an Azure long-running - operation to continue across reconcile loops. - properties: - data: - description: Data is the base64 url encoded json Azure AutoRest - Future. - type: string - name: - description: Name is the name of the Azure resource. Together - with the service name, this forms the unique identifier for - the future. - type: string - resourceGroup: - description: ResourceGroup is the Azure resource group for the - resource. - type: string - serviceName: - description: ServiceName is the name of the Azure service. Together - with the name of the resource, this forms the unique identifier - for the future. - type: string - type: - description: Type describes the type of future, such as update, - create, delete, etc. - type: string - required: - - name - - serviceName - - type - type: object - type: array - ready: - description: Ready is true when the provider resource is ready. - type: boolean - type: object - type: object - served: true - storage: false - subresources: - status: {} - additionalPrinterColumns: - description: Cluster to which this AzureCluster belongs jsonPath: .metadata.labels.cluster\.x-k8s\.io/cluster-name @@ -1654,7 +431,7 @@ spec: is only a subset of options that are available in azure cloud provider config. Some values for the cloud provider config are inferred from other parts of cluster api provider azure spec, and may not be available - for overrides. See: https://kubernetes-sigs.github.io/cloud-provider-azure/install/configs + for overrides. See: https://cloud-provider-azure.sigs.k8s.io/install/configs Note: All cloud provider config values can be customized by creating the secret beforehand. CloudProviderConfigOverrides is only used when the secret is managed by the Azure Provider.' @@ -2377,6 +1154,39 @@ spec: virtual network to peer with the AzureCluster's virtual network. properties: + forwardPeeringProperties: + description: ForwardPeeringProperties specifies VnetPeeringProperties + for peering from the cluster's virtual network to + the remote virtual network. + properties: + allowForwardedTraffic: + description: AllowForwardedTraffic specifies whether + the forwarded traffic from the VMs in the local + virtual network will be allowed/disallowed in + remote virtual network. + type: boolean + allowGatewayTransit: + description: AllowGatewayTransit specifies if gateway + links can be used in remote virtual networking + to link to this virtual network. + type: boolean + allowVirtualNetworkAccess: + description: AllowVirtualNetworkAccess specifies + whether the VMs in the local virtual network space + would be able to access the VMs in remote virtual + network space. + type: boolean + useRemoteGateways: + description: UseRemoteGateways specifies if remote + gateways can be used on this virtual network. + If the flag is set to true, and allowGatewayTransit + on remote peering is also set to true, the virtual + network will use the gateways of the remote virtual + network for transit. Only one peering can have + this flag set to true. This flag cannot be set + if virtual network already has a gateway. + type: boolean + type: object remoteVnetName: description: RemoteVnetName defines name of the remote virtual network. @@ -2385,6 +1195,39 @@ spec: description: ResourceGroup is the resource group name of the remote virtual network. type: string + reversePeeringProperties: + description: ReversePeeringProperties specifies VnetPeeringProperties + for peering from the remote virtual network to the + cluster's virtual network. + properties: + allowForwardedTraffic: + description: AllowForwardedTraffic specifies whether + the forwarded traffic from the VMs in the local + virtual network will be allowed/disallowed in + remote virtual network. + type: boolean + allowGatewayTransit: + description: AllowGatewayTransit specifies if gateway + links can be used in remote virtual networking + to link to this virtual network. + type: boolean + allowVirtualNetworkAccess: + description: AllowVirtualNetworkAccess specifies + whether the VMs in the local virtual network space + would be able to access the VMs in remote virtual + network space. + type: boolean + useRemoteGateways: + description: UseRemoteGateways specifies if remote + gateways can be used on this virtual network. + If the flag is set to true, and allowGatewayTransit + on remote peering is also set to true, the virtual + network will use the gateways of the remote virtual + network for transit. Only one peering can have + this flag set to true. This flag cannot be set + if virtual network already has a gateway. + type: boolean + type: object required: - remoteVnetName type: object diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_azureclustertemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_azureclustertemplates.yaml index 850314b6c7e..6508478b743 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_azureclustertemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_azureclustertemplates.yaml @@ -318,7 +318,7 @@ spec: that are available in azure cloud provider config. Some values for the cloud provider config are inferred from other parts of cluster api provider azure spec, and may not be - available for overrides. See: https://kubernetes-sigs.github.io/cloud-provider-azure/install/configs + available for overrides. See: https://cloud-provider-azure.sigs.k8s.io/install/configs Note: All cloud provider config values can be customized by creating the secret beforehand. CloudProviderConfigOverrides is only used when the secret is managed by the Azure Provider.' @@ -787,6 +787,44 @@ spec: description: VnetPeeringClassSpec specifies a virtual network peering class. properties: + forwardPeeringProperties: + description: ForwardPeeringProperties specifies + VnetPeeringProperties for peering from the + cluster's virtual network to the remote virtual + network. + properties: + allowForwardedTraffic: + description: AllowForwardedTraffic specifies + whether the forwarded traffic from the + VMs in the local virtual network will + be allowed/disallowed in remote virtual + network. + type: boolean + allowGatewayTransit: + description: AllowGatewayTransit specifies + if gateway links can be used in remote + virtual networking to link to this virtual + network. + type: boolean + allowVirtualNetworkAccess: + description: AllowVirtualNetworkAccess specifies + whether the VMs in the local virtual network + space would be able to access the VMs + in remote virtual network space. + type: boolean + useRemoteGateways: + description: UseRemoteGateways specifies + if remote gateways can be used on this + virtual network. If the flag is set to + true, and allowGatewayTransit on remote + peering is also set to true, the virtual + network will use the gateways of the remote + virtual network for transit. Only one + peering can have this flag set to true. + This flag cannot be set if virtual network + already has a gateway. + type: boolean + type: object remoteVnetName: description: RemoteVnetName defines name of the remote virtual network. @@ -795,6 +833,44 @@ spec: description: ResourceGroup is the resource group name of the remote virtual network. type: string + reversePeeringProperties: + description: ReversePeeringProperties specifies + VnetPeeringProperties for peering from the + remote virtual network to the cluster's virtual + network. + properties: + allowForwardedTraffic: + description: AllowForwardedTraffic specifies + whether the forwarded traffic from the + VMs in the local virtual network will + be allowed/disallowed in remote virtual + network. + type: boolean + allowGatewayTransit: + description: AllowGatewayTransit specifies + if gateway links can be used in remote + virtual networking to link to this virtual + network. + type: boolean + allowVirtualNetworkAccess: + description: AllowVirtualNetworkAccess specifies + whether the VMs in the local virtual network + space would be able to access the VMs + in remote virtual network space. + type: boolean + useRemoteGateways: + description: UseRemoteGateways specifies + if remote gateways can be used on this + virtual network. If the flag is set to + true, and allowGatewayTransit on remote + peering is also set to true, the virtual + network will use the gateways of the remote + virtual network for transit. Only one + peering can have this flag set to true. + This flag cannot be set if virtual network + already has a gateway. + type: boolean + type: object required: - remoteVnetName type: object diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremachinepoolmachines.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremachinepoolmachines.yaml index eab638aadbd..c4ef3f3bf30 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremachinepoolmachines.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremachinepoolmachines.yaml @@ -19,228 +19,6 @@ spec: singular: azuremachinepoolmachine scope: Namespaced versions: - - additionalPrinterColumns: - - description: Kubernetes version - jsonPath: .status.version - name: Version - type: string - - description: Flag indicating infrastructure is successfully provisioned - jsonPath: .status.ready - name: Ready - type: string - - description: Azure VMSS VM provisioning state - jsonPath: .status.provisioningState - name: State - type: string - - description: Cluster to which this AzureMachinePoolMachine belongs - jsonPath: .metadata.labels.cluster\.x-k8s\.io/cluster-name - name: Cluster - priority: 1 - type: string - - description: Azure VMSS VM ID - jsonPath: .spec.providerID - name: VMSS VM ID - priority: 1 - type: string - name: v1alpha4 - schema: - openAPIV3Schema: - description: AzureMachinePoolMachine is the Schema for the azuremachinepoolmachines - 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' - 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' - type: string - metadata: - type: object - spec: - description: AzureMachinePoolMachineSpec defines the desired state of - AzureMachinePoolMachine. - properties: - instanceID: - description: InstanceID is the identification of the Machine Instance - within the VMSS - type: string - providerID: - description: ProviderID is the identification ID of the Virtual Machine - Scale Set - type: string - required: - - instanceID - - providerID - type: object - status: - description: AzureMachinePoolMachineStatus defines the observed state - of AzureMachinePoolMachine. - properties: - conditions: - description: Conditions defines current service state of the AzureMachinePool. - items: - description: Condition defines an observation of a Cluster API resource - 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. - format: date-time - type: string - message: - 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. - 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. - 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. - type: string - required: - - status - - type - type: object - type: array - failureMessage: - description: "FailureMessage will be set in the event that there is - a terminal problem reconciling the MachinePool and will contain - a more verbose string suitable for logging and human consumption. - \n Any transient errors that occur during the reconciliation of - MachinePools can be added as events to the MachinePool object and/or - logged in the controller's output." - type: string - failureReason: - description: "FailureReason will be set in the event that there is - a terminal problem reconciling the MachinePool machine and will - contain a succinct value suitable for machine interpretation. \n - Any transient errors that occur during the reconciliation of MachinePools - can be added as events to the MachinePool object and/or logged in - the controller's output." - type: string - instanceName: - description: InstanceName is the name of the Machine Instance within - the VMSS - type: string - latestModelApplied: - description: LatestModelApplied indicates the instance is running - the most up-to-date VMSS model. A VMSS model describes the image - version the VM is running. If the instance is not running the latest - model, it means the instance may not be running the version of Kubernetes - the Machine Pool has specified and needs to be updated. - type: boolean - longRunningOperationStates: - description: LongRunningOperationStates saves the state for Azure - long running operations so they can be continued on the next reconciliation - loop. - items: - description: Future contains the data needed for an Azure long-running - operation to continue across reconcile loops. - properties: - data: - description: Data is the base64 url encoded json Azure AutoRest - Future. - type: string - name: - description: Name is the name of the Azure resource. Together - with the service name, this forms the unique identifier for - the future. - type: string - resourceGroup: - description: ResourceGroup is the Azure resource group for the - resource. - type: string - serviceName: - description: ServiceName is the name of the Azure service. Together - with the name of the resource, this forms the unique identifier - for the future. - type: string - type: - description: Type describes the type of future, such as update, - create, delete, etc. - type: string - required: - - name - - serviceName - - type - type: object - type: array - nodeRef: - description: NodeRef will point to the corresponding Node if it exists. - 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.' - type: string - kind: - 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' - type: string - namespace: - 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' - type: string - uid: - description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' - type: string - type: object - provisioningState: - description: ProvisioningState is the provisioning state of the Azure - virtual machine instance. - type: string - ready: - description: Ready is true when the provider resource is ready. - type: boolean - version: - description: Version defines the Kubernetes version for the VM Instance - type: string - required: - - latestModelApplied - type: object - type: object - served: true - storage: false - subresources: - status: {} - additionalPrinterColumns: - description: Kubernetes version jsonPath: .status.version diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremachinepools.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremachinepools.yaml index e1bfcd5d61b..a9b31403f9f 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremachinepools.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremachinepools.yaml @@ -19,1280 +19,6 @@ spec: singular: azuremachinepool scope: Namespaced versions: - - additionalPrinterColumns: - - description: AzureMachinePool replicas count - jsonPath: .status.replicas - name: Replicas - type: string - - description: AzureMachinePool replicas count - jsonPath: .status.ready - name: Ready - type: string - - description: Azure VMSS provisioning state - jsonPath: .status.provisioningState - name: State - type: string - - description: Cluster to which this AzureMachinePool belongs - jsonPath: .metadata.labels.cluster\.x-k8s\.io/cluster-name - name: Cluster - priority: 1 - type: string - - description: MachinePool object to which this AzureMachinePool belongs - jsonPath: .metadata.ownerReferences[?(@.kind=="MachinePool")].name - name: MachinePool - priority: 1 - type: string - - description: Azure VMSS ID - jsonPath: .spec.providerID - name: VMSS ID - priority: 1 - type: string - - description: Azure VM Size - jsonPath: .spec.template.vmSize - name: VM Size - priority: 1 - type: string - name: v1alpha3 - schema: - openAPIV3Schema: - description: AzureMachinePool is the Schema for the azuremachinepools 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' - 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' - type: string - metadata: - type: object - spec: - description: AzureMachinePoolSpec defines the desired state of AzureMachinePool. - properties: - additionalTags: - additionalProperties: - type: string - description: AdditionalTags is an optional set of tags to add to an - instance, in addition to the ones added by default by the Azure - provider. If both the AzureCluster and the AzureMachine specify - the same tag name with different values, the AzureMachine's value - takes precedence. - type: object - identity: - default: None - description: Identity is the type of identity used for the Virtual - Machine Scale Set. The type 'SystemAssigned' is an implicitly created - identity. The generated identity will be assigned a Subscription - contributor role. The type 'UserAssigned' is a standalone Azure - resource provided by the user and assigned to the VM - enum: - - None - - SystemAssigned - - UserAssigned - type: string - location: - description: Location is the Azure region location e.g. westus2 - type: string - providerID: - description: ProviderID is the identification ID of the Virtual Machine - Scale Set - type: string - providerIDList: - description: ProviderIDList are the identification IDs of machine - instances provided by the provider. This field must match the provider - IDs as seen on the node objects corresponding to a machine pool's - machine instances. - items: - type: string - type: array - roleAssignmentName: - description: RoleAssignmentName is the name of the role assignment - to create for a system assigned identity. It can be any valid GUID. - If not specified, a random GUID will be generated. - type: string - template: - description: Template contains the details used to build a replica - virtual machine within the Machine Pool. - properties: - acceleratedNetworking: - description: AcceleratedNetworking enables or disables Azure accelerated - networking. If omitted, it will be set based on whether the - requested VMSize supports accelerated networking. If AcceleratedNetworking - is set to true with a VMSize that does not support it, Azure - will return an error. - type: boolean - dataDisks: - description: DataDisks specifies the list of data disks to be - created for a Virtual Machine - items: - description: DataDisk specifies the parameters that are used - to add one or more data disks to the machine. - properties: - cachingType: - type: string - diskSizeGB: - description: DiskSizeGB is the size in GB to assign to the - data disk. - format: int32 - type: integer - lun: - description: Lun Specifies the logical unit number of the - data disk. This value is used to identify data disks within - the VM and therefore must be unique for each data disk - attached to a VM. The value must be between 0 and 63. - format: int32 - type: integer - managedDisk: - description: ManagedDisk defines the managed disk options - for a VM. - properties: - diskEncryptionSet: - description: DiskEncryptionSetParameters defines disk - encryption options. - properties: - id: - description: ID defines resourceID for diskEncryptionSet - resource. It must be in the same subscription - type: string - type: object - storageAccountType: - type: string - required: - - storageAccountType - type: object - nameSuffix: - description: NameSuffix is the suffix to be appended to - the machine name to generate the disk name. Each disk - name will be in format _. - type: string - required: - - diskSizeGB - - nameSuffix - type: object - type: array - image: - description: Image is used to provide details of an image to use - during Virtual Machine creation. If image details are omitted - the image will default the Azure Marketplace "capi" offer, which - is based on Ubuntu. - properties: - id: - description: ID specifies an image to use by ID - type: string - marketplace: - description: Marketplace specifies an image to use from the - Azure Marketplace - properties: - offer: - description: Offer specifies the name of a group of related - images created by the publisher. For example, UbuntuServer, - WindowsServer - minLength: 1 - type: string - publisher: - description: Publisher is the name of the organization - that created the image - minLength: 1 - type: string - sku: - description: SKU specifies an instance of an offer, such - as a major release of a distribution. For example, 18.04-LTS, - 2019-Datacenter - minLength: 1 - type: string - thirdPartyImage: - default: false - description: ThirdPartyImage indicates the image is published - by a third party publisher and a Plan will be generated - for it. - type: boolean - version: - description: Version specifies the version of an image - sku. The allowed formats are Major.Minor.Build or 'latest'. - Major, Minor, and Build are decimal numbers. Specify - 'latest' to use the latest version of an image available - at deploy time. Even if you use 'latest', the VM image - will not automatically update after deploy time even - if a new version becomes available. - minLength: 1 - type: string - required: - - offer - - publisher - - sku - - version - type: object - sharedGallery: - description: SharedGallery specifies an image to use from - an Azure Shared Image Gallery - properties: - gallery: - description: Gallery specifies the name of the shared - image gallery that contains the image - minLength: 1 - type: string - name: - description: Name is the name of the image - minLength: 1 - type: string - resourceGroup: - description: ResourceGroup specifies the resource group - containing the shared image gallery - minLength: 1 - type: string - subscriptionID: - description: SubscriptionID is the identifier of the subscription - that contains the shared image gallery - minLength: 1 - type: string - version: - description: Version specifies the version of the marketplace - image. The allowed formats are Major.Minor.Build or - 'latest'. Major, Minor, and Build are decimal numbers. - Specify 'latest' to use the latest version of an image - available at deploy time. Even if you use 'latest', - the VM image will not automatically update after deploy - time even if a new version becomes available. - minLength: 1 - type: string - required: - - gallery - - name - - resourceGroup - - subscriptionID - - version - type: object - type: object - osDisk: - description: OSDisk contains the operating system disk information - for a Virtual Machine - properties: - cachingType: - type: string - diffDiskSettings: - description: DiffDiskSettings describe ephemeral disk settings - for the os disk. - properties: - option: - description: Option enables ephemeral OS when set to "Local" - See https://docs.microsoft.com/en-us/azure/virtual-machines/ephemeral-os-disks - for full details - enum: - - Local - type: string - required: - - option - type: object - diskSizeGB: - format: int32 - type: integer - managedDisk: - description: ManagedDisk defines the managed disk options - for a VM. - properties: - diskEncryptionSet: - description: DiskEncryptionSetParameters defines disk - encryption options. - properties: - id: - description: ID defines resourceID for diskEncryptionSet - resource. It must be in the same subscription - type: string - type: object - storageAccountType: - type: string - required: - - storageAccountType - type: object - osType: - type: string - required: - - diskSizeGB - - managedDisk - - osType - type: object - securityProfile: - description: SecurityProfile specifies the Security profile settings - for a virtual machine. - properties: - encryptionAtHost: - description: This field indicates whether Host Encryption - should be enabled or disabled for a virtual machine or virtual - machine scale set. Default is disabled. - type: boolean - type: object - spotVMOptions: - description: SpotVMOptions allows the ability to specify the Machine - should use a Spot VM - properties: - maxPrice: - anyOf: - - type: integer - - type: string - description: MaxPrice defines the maximum price the user is - willing to pay for Spot VM instances - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - sshPublicKey: - description: SSHPublicKey is the SSH public key string base64 - encoded to add to a Virtual Machine - type: string - terminateNotificationTimeout: - description: TerminateNotificationTimeout enables or disables - VMSS scheduled events termination notification with specified - timeout allowed values are between 5 and 15 (mins) - type: integer - vmSize: - description: VMSize is the size of the Virtual Machine to build. - See https://docs.microsoft.com/en-us/rest/api/compute/virtualmachines/createorupdate#virtualmachinesizetypes - type: string - required: - - osDisk - - sshPublicKey - - vmSize - type: object - userAssignedIdentities: - description: UserAssignedIdentities is a list of standalone Azure - identities provided by the user The lifecycle of a user-assigned - identity is managed separately from the lifecycle of the AzureMachinePool. - See https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/how-to-manage-ua-identity-cli - items: - description: UserAssignedIdentity defines the user-assigned identities - provided by the user to be assigned to Azure resources. - properties: - providerID: - description: 'ProviderID is the identification ID of the user-assigned - Identity, the format of an identity is: ''azure:///subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}''' - type: string - required: - - providerID - type: object - type: array - required: - - location - - template - type: object - status: - description: AzureMachinePoolStatus defines the observed state of AzureMachinePool. - properties: - conditions: - description: Conditions defines current service state of the AzureMachinePool. - items: - description: Condition defines an observation of a Cluster API resource - 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. - format: date-time - type: string - message: - 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. - 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. - 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. - type: string - required: - - status - - type - type: object - type: array - failureMessage: - description: "FailureMessage will be set in the event that there is - a terminal problem reconciling the MachinePool and will contain - a more verbose string suitable for logging and human consumption. - \n This field should not be set for transitive errors that a controller - faces that are expected to be fixed automatically over time (like - service outages), but instead indicate that something is fundamentally - wrong with the MachinePool's spec or the configuration of the controller, - and that manual intervention is required. Examples of terminal errors - would be invalid combinations of settings in the spec, values that - are unsupported by the controller, or the responsible controller - itself being critically misconfigured. \n Any transient errors that - occur during the reconciliation of MachinePools can be added as - events to the MachinePool object and/or logged in the controller's - output." - type: string - failureReason: - description: "FailureReason will be set in the event that there is - a terminal problem reconciling the MachinePool and will contain - a succinct value suitable for machine interpretation. \n This field - should not be set for transitive errors that a controller faces - that are expected to be fixed automatically over time (like service - outages), but instead indicate that something is fundamentally wrong - with the MachinePool's spec or the configuration of the controller, - and that manual intervention is required. Examples of terminal errors - would be invalid combinations of settings in the spec, values that - are unsupported by the controller, or the responsible controller - itself being critically misconfigured. \n Any transient errors that - occur during the reconciliation of MachinePools can be added as - events to the MachinePool object and/or logged in the controller's - output." - type: string - instances: - description: Instances is the VM instance status for each VM in the - VMSS - items: - description: AzureMachinePoolInstanceStatus provides status information - for each instance in the VMSS. - properties: - instanceID: - description: InstanceID is the identification of the Machine - Instance within the VMSS - type: string - instanceName: - description: InstanceName is the name of the Machine Instance - within the VMSS - type: string - latestModelApplied: - description: LatestModelApplied indicates the instance is running - the most up-to-date VMSS model. A VMSS model describes the - image version the VM is running. If the instance is not running - the latest model, it means the instance may not be running - the version of Kubernetes the Machine Pool has specified and - needs to be updated. - type: boolean - providerID: - description: ProviderID is the provider identification of the - VMSS Instance - type: string - provisioningState: - description: ProvisioningState is the provisioning state of - the Azure virtual machine instance. - type: string - version: - description: Version defines the Kubernetes version for the - VM Instance - type: string - required: - - latestModelApplied - type: object - type: array - longRunningOperationState: - description: LongRunningOperationState saves the state for an Azure - long running operations so it can be continued on the next reconciliation - loop. - properties: - futureData: - description: FutureData is the base64 url encoded json Azure AutoRest - Future. - type: string - name: - description: Name is the name of the Azure resource. - type: string - resourceGroup: - description: ResourceGroup is the Azure resource group for the - resource. - type: string - type: - description: Type describes the type of future, update, create, - delete, etc. - type: string - required: - - type - type: object - provisioningState: - description: ProvisioningState is the provisioning state of the Azure - virtual machine. - type: string - ready: - description: Ready is true when the provider resource is ready. - type: boolean - replicas: - description: Replicas is the most recently observed number of replicas. - format: int32 - type: integer - version: - description: Version is the Kubernetes version for the current VMSS - model - type: string - type: object - type: object - served: true - storage: false - subresources: - status: {} - - additionalPrinterColumns: - - description: AzureMachinePool replicas count - jsonPath: .status.replicas - name: Replicas - type: string - - description: AzureMachinePool replicas count - jsonPath: .status.ready - name: Ready - type: string - - description: Azure VMSS provisioning state - jsonPath: .status.provisioningState - name: State - type: string - - description: Cluster to which this AzureMachinePool belongs - jsonPath: .metadata.labels.cluster\.x-k8s\.io/cluster-name - name: Cluster - priority: 1 - type: string - - description: MachinePool object to which this AzureMachinePool belongs - jsonPath: .metadata.ownerReferences[?(@.kind=="MachinePool")].name - name: MachinePool - priority: 1 - type: string - - description: Azure VMSS ID - jsonPath: .spec.providerID - name: VMSS ID - priority: 1 - type: string - - description: Azure VM Size - jsonPath: .spec.template.vmSize - name: VM Size - priority: 1 - type: string - name: v1alpha4 - schema: - openAPIV3Schema: - description: AzureMachinePool is the Schema for the azuremachinepools 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' - 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' - type: string - metadata: - type: object - spec: - description: AzureMachinePoolSpec defines the desired state of AzureMachinePool. - properties: - additionalTags: - additionalProperties: - type: string - description: AdditionalTags is an optional set of tags to add to an - instance, in addition to the ones added by default by the Azure - provider. If both the AzureCluster and the AzureMachine specify - the same tag name with different values, the AzureMachine's value - takes precedence. - type: object - identity: - default: None - description: Identity is the type of identity used for the Virtual - Machine Scale Set. The type 'SystemAssigned' is an implicitly created - identity. The generated identity will be assigned a Subscription - contributor role. The type 'UserAssigned' is a standalone Azure - resource provided by the user and assigned to the VM - enum: - - None - - SystemAssigned - - UserAssigned - type: string - location: - description: Location is the Azure region location e.g. westus2 - type: string - nodeDrainTimeout: - description: 'NodeDrainTimeout is the total amount of time that the - controller will spend on draining a node. The default value is 0, - meaning that the node can be drained without any time limitations. - NOTE: NodeDrainTimeout is different from `kubectl drain --timeout`' - type: string - providerID: - description: ProviderID is the identification ID of the Virtual Machine - Scale Set - type: string - providerIDList: - description: ProviderIDList are the identification IDs of machine - instances provided by the provider. This field must match the provider - IDs as seen on the node objects corresponding to a machine pool's - machine instances. - items: - type: string - type: array - roleAssignmentName: - description: RoleAssignmentName is the name of the role assignment - to create for a system assigned identity. It can be any valid GUID. - If not specified, a random GUID will be generated. - type: string - strategy: - default: - rollingUpdate: - deletePolicy: Oldest - maxSurge: 1 - maxUnavailable: 0 - type: RollingUpdate - description: The deployment strategy to use to replace existing AzureMachinePoolMachines - with new ones. - properties: - rollingUpdate: - description: Rolling update config params. Present only if MachineDeploymentStrategyType - = RollingUpdate. - properties: - deletePolicy: - default: Oldest - description: DeletePolicy defines the policy used by the MachineDeployment - to identify nodes to delete when downscaling. Valid values - are "Random, "Newest", "Oldest" When no value is supplied, - the default is Oldest - enum: - - Random - - Newest - - Oldest - type: string - maxSurge: - anyOf: - - type: integer - - type: string - default: 1 - description: 'The maximum number of machines that can be scheduled - above the desired number of machines. Value can be an absolute - number (ex: 5) or a percentage of desired machines (ex: - 10%). This can not be 0 if MaxUnavailable is 0. Absolute - number is calculated from percentage by rounding up. Defaults - to 1. Example: when this is set to 30%, the new MachineSet - can be scaled up immediately when the rolling update starts, - such that the total number of old and new machines do not - exceed 130% of desired machines. Once old machines have - been killed, new MachineSet can be scaled up further, ensuring - that total number of machines running at any time during - the update is at most 130% of desired machines.' - x-kubernetes-int-or-string: true - maxUnavailable: - anyOf: - - type: integer - - type: string - default: 0 - description: 'The maximum number of machines that can be unavailable - during the update. Value can be an absolute number (ex: - 5) or a percentage of desired machines (ex: 10%). Absolute - number is calculated from percentage by rounding down. This - can not be 0 if MaxSurge is 0. Defaults to 0. Example: when - this is set to 30%, the old MachineSet can be scaled down - to 70% of desired machines immediately when the rolling - update starts. Once new machines are ready, old MachineSet - can be scaled down further, followed by scaling up the new - MachineSet, ensuring that the total number of machines available - at all times during the update is at least 70% of desired - machines.' - x-kubernetes-int-or-string: true - type: object - type: - default: RollingUpdate - description: Type of deployment. Currently the only supported - strategy is RollingUpdate - enum: - - RollingUpdate - type: string - type: object - template: - description: Template contains the details used to build a replica - virtual machine within the Machine Pool - properties: - acceleratedNetworking: - description: AcceleratedNetworking enables or disables Azure accelerated - networking. If omitted, it will be set based on whether the - requested VMSize supports accelerated networking. If AcceleratedNetworking - is set to true with a VMSize that does not support it, Azure - will return an error. - type: boolean - dataDisks: - description: DataDisks specifies the list of data disks to be - created for a Virtual Machine - items: - description: DataDisk specifies the parameters that are used - to add one or more data disks to the machine. - properties: - cachingType: - description: CachingType specifies the caching requirements. - enum: - - None - - ReadOnly - - ReadWrite - type: string - diskSizeGB: - description: DiskSizeGB is the size in GB to assign to the - data disk. - format: int32 - type: integer - lun: - description: Lun Specifies the logical unit number of the - data disk. This value is used to identify data disks within - the VM and therefore must be unique for each data disk - attached to a VM. The value must be between 0 and 63. - format: int32 - type: integer - managedDisk: - description: ManagedDisk specifies the Managed Disk parameters - for the data disk. - properties: - diskEncryptionSet: - description: DiskEncryptionSetParameters defines disk - encryption options. - properties: - id: - description: ID defines resourceID for diskEncryptionSet - resource. It must be in the same subscription - type: string - type: object - storageAccountType: - type: string - type: object - nameSuffix: - description: NameSuffix is the suffix to be appended to - the machine name to generate the disk name. Each disk - name will be in format _. - type: string - required: - - diskSizeGB - - nameSuffix - type: object - type: array - image: - description: Image is used to provide details of an image to use - during VM creation. If image details are omitted the image will - default the Azure Marketplace "capi" offer, which is based on - Ubuntu. - properties: - id: - description: ID specifies an image to use by ID - type: string - marketplace: - description: Marketplace specifies an image to use from the - Azure Marketplace - properties: - offer: - description: Offer specifies the name of a group of related - images created by the publisher. For example, UbuntuServer, - WindowsServer - minLength: 1 - type: string - publisher: - description: Publisher is the name of the organization - that created the image - minLength: 1 - type: string - sku: - description: SKU specifies an instance of an offer, such - as a major release of a distribution. For example, 18.04-LTS, - 2019-Datacenter - minLength: 1 - type: string - thirdPartyImage: - default: false - description: ThirdPartyImage indicates the image is published - by a third party publisher and a Plan will be generated - for it. - type: boolean - version: - description: Version specifies the version of an image - sku. The allowed formats are Major.Minor.Build or 'latest'. - Major, Minor, and Build are decimal numbers. Specify - 'latest' to use the latest version of an image available - at deploy time. Even if you use 'latest', the VM image - will not automatically update after deploy time even - if a new version becomes available. - minLength: 1 - type: string - required: - - offer - - publisher - - sku - - version - type: object - sharedGallery: - description: SharedGallery specifies an image to use from - an Azure Shared Image Gallery - properties: - gallery: - description: Gallery specifies the name of the shared - image gallery that contains the image - minLength: 1 - type: string - name: - description: Name is the name of the image - minLength: 1 - type: string - offer: - description: Offer specifies the name of a group of related - images created by the publisher. For example, UbuntuServer, - WindowsServer This value will be used to add a `Plan` - in the API request when creating the VM/VMSS resource. - This is needed when the source image from which this - SIG image was built requires the `Plan` to be used. - type: string - publisher: - description: Publisher is the name of the organization - that created the image. This value will be used to add - a `Plan` in the API request when creating the VM/VMSS - resource. This is needed when the source image from - which this SIG image was built requires the `Plan` to - be used. - type: string - resourceGroup: - description: ResourceGroup specifies the resource group - containing the shared image gallery - minLength: 1 - type: string - sku: - description: SKU specifies an instance of an offer, such - as a major release of a distribution. For example, 18.04-LTS, - 2019-Datacenter This value will be used to add a `Plan` - in the API request when creating the VM/VMSS resource. - This is needed when the source image from which this - SIG image was built requires the `Plan` to be used. - type: string - subscriptionID: - description: SubscriptionID is the identifier of the subscription - that contains the shared image gallery - minLength: 1 - type: string - version: - description: Version specifies the version of the marketplace - image. The allowed formats are Major.Minor.Build or - 'latest'. Major, Minor, and Build are decimal numbers. - Specify 'latest' to use the latest version of an image - available at deploy time. Even if you use 'latest', - the VM image will not automatically update after deploy - time even if a new version becomes available. - minLength: 1 - type: string - required: - - gallery - - name - - resourceGroup - - subscriptionID - - version - type: object - type: object - osDisk: - description: OSDisk contains the operating system disk information - for a Virtual Machine - properties: - cachingType: - description: CachingType specifies the caching requirements. - enum: - - None - - ReadOnly - - ReadWrite - type: string - diffDiskSettings: - description: DiffDiskSettings describe ephemeral disk settings - for the os disk. - properties: - option: - description: Option enables ephemeral OS when set to "Local" - See https://docs.microsoft.com/en-us/azure/virtual-machines/ephemeral-os-disks - for full details - enum: - - Local - type: string - required: - - option - type: object - diskSizeGB: - description: DiskSizeGB is the size in GB to assign to the - OS disk. Will have a default of 30GB if not provided - format: int32 - type: integer - managedDisk: - description: ManagedDisk specifies the Managed Disk parameters - for the OS disk. - properties: - diskEncryptionSet: - description: DiskEncryptionSetParameters defines disk - encryption options. - properties: - id: - description: ID defines resourceID for diskEncryptionSet - resource. It must be in the same subscription - type: string - type: object - storageAccountType: - type: string - type: object - osType: - type: string - required: - - osType - type: object - securityProfile: - description: SecurityProfile specifies the Security profile settings - for a virtual machine. - properties: - encryptionAtHost: - description: This field indicates whether Host Encryption - should be enabled or disabled for a virtual machine or virtual - machine scale set. Default is disabled. - type: boolean - type: object - spotVMOptions: - description: SpotVMOptions allows the ability to specify the Machine - should use a Spot VM - properties: - maxPrice: - anyOf: - - type: integer - - type: string - description: MaxPrice defines the maximum price the user is - willing to pay for Spot VM instances - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - sshPublicKey: - description: SSHPublicKey is the SSH public key string base64 - encoded to add to a Virtual Machine - type: string - subnetName: - description: SubnetName selects the Subnet where the VMSS will - be placed - type: string - terminateNotificationTimeout: - description: TerminateNotificationTimeout enables or disables - VMSS scheduled events termination notification with specified - timeout allowed values are between 5 and 15 (mins) - type: integer - vmSize: - description: VMSize is the size of the Virtual Machine to build. - See https://docs.microsoft.com/en-us/rest/api/compute/virtualmachines/createorupdate#virtualmachinesizetypes - type: string - required: - - osDisk - - sshPublicKey - - vmSize - type: object - userAssignedIdentities: - description: UserAssignedIdentities is a list of standalone Azure - identities provided by the user The lifecycle of a user-assigned - identity is managed separately from the lifecycle of the AzureMachinePool. - See https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/how-to-manage-ua-identity-cli - items: - description: UserAssignedIdentity defines the user-assigned identities - provided by the user to be assigned to Azure resources. - properties: - providerID: - description: 'ProviderID is the identification ID of the user-assigned - Identity, the format of an identity is: ''azure:///subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}''' - type: string - required: - - providerID - type: object - type: array - required: - - location - - template - type: object - status: - description: AzureMachinePoolStatus defines the observed state of AzureMachinePool. - properties: - conditions: - description: Conditions defines current service state of the AzureMachinePool. - items: - description: Condition defines an observation of a Cluster API resource - 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. - format: date-time - type: string - message: - 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. - 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. - 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. - type: string - required: - - status - - type - type: object - type: array - failureMessage: - description: "FailureMessage will be set in the event that there is - a terminal problem reconciling the MachinePool and will contain - a more verbose string suitable for logging and human consumption. - \n This field should not be set for transitive errors that a controller - faces that are expected to be fixed automatically over time (like - service outages), but instead indicate that something is fundamentally - wrong with the MachinePool's spec or the configuration of the controller, - and that manual intervention is required. Examples of terminal errors - would be invalid combinations of settings in the spec, values that - are unsupported by the controller, or the responsible controller - itself being critically misconfigured. \n Any transient errors that - occur during the reconciliation of MachinePools can be added as - events to the MachinePool object and/or logged in the controller's - output." - type: string - failureReason: - description: "FailureReason will be set in the event that there is - a terminal problem reconciling the MachinePool and will contain - a succinct value suitable for machine interpretation. \n This field - should not be set for transitive errors that a controller faces - that are expected to be fixed automatically over time (like service - outages), but instead indicate that something is fundamentally wrong - with the MachinePool's spec or the configuration of the controller, - and that manual intervention is required. Examples of terminal errors - would be invalid combinations of settings in the spec, values that - are unsupported by the controller, or the responsible controller - itself being critically misconfigured. \n Any transient errors that - occur during the reconciliation of MachinePools can be added as - events to the MachinePool object and/or logged in the controller's - output." - type: string - image: - description: Image is the current image used in the AzureMachinePool. - When the spec image is nil, this image is populated with the details - of the defaulted Azure Marketplace "capi" offer. - properties: - id: - description: ID specifies an image to use by ID - type: string - marketplace: - description: Marketplace specifies an image to use from the Azure - Marketplace - properties: - offer: - description: Offer specifies the name of a group of related - images created by the publisher. For example, UbuntuServer, - WindowsServer - minLength: 1 - type: string - publisher: - description: Publisher is the name of the organization that - created the image - minLength: 1 - type: string - sku: - description: SKU specifies an instance of an offer, such as - a major release of a distribution. For example, 18.04-LTS, - 2019-Datacenter - minLength: 1 - type: string - thirdPartyImage: - default: false - description: ThirdPartyImage indicates the image is published - by a third party publisher and a Plan will be generated - for it. - type: boolean - version: - description: Version specifies the version of an image sku. - The allowed formats are Major.Minor.Build or 'latest'. Major, - Minor, and Build are decimal numbers. Specify 'latest' to - use the latest version of an image available at deploy time. - Even if you use 'latest', the VM image will not automatically - update after deploy time even if a new version becomes available. - minLength: 1 - type: string - required: - - offer - - publisher - - sku - - version - type: object - sharedGallery: - description: SharedGallery specifies an image to use from an Azure - Shared Image Gallery - properties: - gallery: - description: Gallery specifies the name of the shared image - gallery that contains the image - minLength: 1 - type: string - name: - description: Name is the name of the image - minLength: 1 - type: string - offer: - description: Offer specifies the name of a group of related - images created by the publisher. For example, UbuntuServer, - WindowsServer This value will be used to add a `Plan` in - the API request when creating the VM/VMSS resource. This - is needed when the source image from which this SIG image - was built requires the `Plan` to be used. - type: string - publisher: - description: Publisher is the name of the organization that - created the image. This value will be used to add a `Plan` - in the API request when creating the VM/VMSS resource. This - is needed when the source image from which this SIG image - was built requires the `Plan` to be used. - type: string - resourceGroup: - description: ResourceGroup specifies the resource group containing - the shared image gallery - minLength: 1 - type: string - sku: - description: SKU specifies an instance of an offer, such as - a major release of a distribution. For example, 18.04-LTS, - 2019-Datacenter This value will be used to add a `Plan` - in the API request when creating the VM/VMSS resource. This - is needed when the source image from which this SIG image - was built requires the `Plan` to be used. - type: string - subscriptionID: - description: SubscriptionID is the identifier of the subscription - that contains the shared image gallery - minLength: 1 - type: string - version: - description: Version specifies the version of the marketplace - image. The allowed formats are Major.Minor.Build or 'latest'. - Major, Minor, and Build are decimal numbers. Specify 'latest' - to use the latest version of an image available at deploy - time. Even if you use 'latest', the VM image will not automatically - update after deploy time even if a new version becomes available. - minLength: 1 - type: string - required: - - gallery - - name - - resourceGroup - - subscriptionID - - version - type: object - type: object - instances: - description: Instances is the VM instance status for each VM in the - VMSS - items: - description: AzureMachinePoolInstanceStatus provides status information - for each instance in the VMSS. - properties: - instanceID: - description: InstanceID is the identification of the Machine - Instance within the VMSS - type: string - instanceName: - description: InstanceName is the name of the Machine Instance - within the VMSS - type: string - latestModelApplied: - description: LatestModelApplied indicates the instance is running - the most up-to-date VMSS model. A VMSS model describes the - image version the VM is running. If the instance is not running - the latest model, it means the instance may not be running - the version of Kubernetes the Machine Pool has specified and - needs to be updated. - type: boolean - providerID: - description: ProviderID is the provider identification of the - VMSS Instance - type: string - provisioningState: - description: ProvisioningState is the provisioning state of - the Azure virtual machine instance. - type: string - version: - description: Version defines the Kubernetes version for the - VM Instance - type: string - required: - - latestModelApplied - type: object - type: array - longRunningOperationStates: - description: LongRunningOperationStates saves the state for Azure - long-running operations so they can be continued on the next reconciliation - loop. - items: - description: Future contains the data needed for an Azure long-running - operation to continue across reconcile loops. - properties: - data: - description: Data is the base64 url encoded json Azure AutoRest - Future. - type: string - name: - description: Name is the name of the Azure resource. Together - with the service name, this forms the unique identifier for - the future. - type: string - resourceGroup: - description: ResourceGroup is the Azure resource group for the - resource. - type: string - serviceName: - description: ServiceName is the name of the Azure service. Together - with the name of the resource, this forms the unique identifier - for the future. - type: string - type: - description: Type describes the type of future, such as update, - create, delete, etc. - type: string - required: - - name - - serviceName - - type - type: object - type: array - provisioningState: - description: ProvisioningState is the provisioning state of the Azure - virtual machine. - type: string - ready: - description: Ready is true when the provider resource is ready. - type: boolean - replicas: - description: Replicas is the most recently observed number of replicas. - format: int32 - type: integer - version: - description: Version is the Kubernetes version for the current VMSS - model - type: string - type: object - type: object - served: true - storage: false - subresources: - status: {} - additionalPrinterColumns: - description: AzureMachinePool replicas count jsonPath: .status.replicas @@ -1533,14 +259,46 @@ spec: for the data disk. properties: diskEncryptionSet: - description: DiskEncryptionSetParameters defines disk - encryption options. + description: DiskEncryptionSet specifies the customer-managed + disk encryption set resource id for the managed disk. properties: id: description: ID defines resourceID for diskEncryptionSet resource. It must be in the same subscription type: string type: object + securityProfile: + description: SecurityProfile specifies the security + profile for the managed disk. + properties: + diskEncryptionSet: + description: DiskEncryptionSet specifies the customer-managed + disk encryption set resource id for the managed + disk that is used for Customer Managed Key encrypted + ConfidentialVM OS Disk and VMGuest blob. + properties: + id: + description: ID defines resourceID for diskEncryptionSet + resource. It must be in the same subscription + type: string + type: object + securityEncryptionType: + description: SecurityEncryptionType specifies the + encryption type of the managed disk. It is set + to DiskWithVMGuestState to encrypt the managed + disk along with the VMGuestState blob, and to + VMGuestStateOnly to encrypt the VMGuestState blob + only. When set to VMGuestStateOnly, VirtualizedTrustedPlatformModule + should be set to Enabled. When set to DiskWithVMGuestState, + EncryptionAtHost should be disabled, SecureBoot + and VirtualizedTrustedPlatformModule should be + set to Enabled. It can be set only for Confidential + VMs. + enum: + - VMGuestStateOnly + - DiskWithVMGuestState + type: string + type: object storageAccountType: type: string type: object @@ -1841,14 +599,46 @@ spec: for the OS disk. properties: diskEncryptionSet: - description: DiskEncryptionSetParameters defines disk - encryption options. + description: DiskEncryptionSet specifies the customer-managed + disk encryption set resource id for the managed disk. properties: id: description: ID defines resourceID for diskEncryptionSet resource. It must be in the same subscription type: string type: object + securityProfile: + description: SecurityProfile specifies the security profile + for the managed disk. + properties: + diskEncryptionSet: + description: DiskEncryptionSet specifies the customer-managed + disk encryption set resource id for the managed + disk that is used for Customer Managed Key encrypted + ConfidentialVM OS Disk and VMGuest blob. + properties: + id: + description: ID defines resourceID for diskEncryptionSet + resource. It must be in the same subscription + type: string + type: object + securityEncryptionType: + description: SecurityEncryptionType specifies the + encryption type of the managed disk. It is set to + DiskWithVMGuestState to encrypt the managed disk + along with the VMGuestState blob, and to VMGuestStateOnly + to encrypt the VMGuestState blob only. When set + to VMGuestStateOnly, VirtualizedTrustedPlatformModule + should be set to Enabled. When set to DiskWithVMGuestState, + EncryptionAtHost should be disabled, SecureBoot + and VirtualizedTrustedPlatformModule should be set + to Enabled. It can be set only for Confidential + VMs. + enum: + - VMGuestStateOnly + - DiskWithVMGuestState + type: string + type: object storageAccountType: type: string type: object @@ -1864,8 +654,45 @@ spec: encryptionAtHost: description: This field indicates whether Host Encryption should be enabled or disabled for a virtual machine or virtual - machine scale set. Default is disabled. + machine scale set. This should be disabled when SecurityEncryptionType + is set to DiskWithVMGuestState. Default is disabled. type: boolean + securityType: + description: 'SecurityType specifies the SecurityType of the + virtual machine. It has to be set to any specified value + to enable UefiSettings. The default behavior is: UefiSettings + will not be enabled unless this property is set.' + enum: + - ConfidentialVM + - TrustedLaunch + type: string + uefiSettings: + description: UefiSettings specifies the security settings + like secure boot and vTPM used while creating the virtual + machine. + properties: + secureBootEnabled: + description: SecureBootEnabled specifies whether secure + boot should be enabled on the virtual machine. Secure + Boot verifies the digital signature of all boot components + and halts the boot process if signature verification + fails. If omitted, the platform chooses a default, which + is subject to change over time, currently that default + is false. + type: boolean + vTpmEnabled: + description: VTpmEnabled specifies whether vTPM should + be enabled on the virtual machine. When true it enables + the virtualized trusted platform module measurements + to create a known good boot integrity policy baseline. + The integrity policy baseline is used for comparison + with measurements from subsequent VM boots to determine + if anything has changed. This is required to be set + to Enabled if SecurityEncryptionType is defined. If + omitted, the platform chooses a default, which is subject + to change over time, currently that default is false. + type: boolean + type: object type: object spotVMOptions: description: SpotVMOptions allows the ability to specify the Machine diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremachines.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremachines.yaml index db1b61af662..56f4e1c3490 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremachines.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremachines.yaml @@ -17,977 +17,6 @@ spec: singular: azuremachine scope: Namespaced versions: - - additionalPrinterColumns: - - description: AzureMachine ready status - jsonPath: .status.ready - name: Ready - type: string - - description: Azure VM provisioning state - jsonPath: .status.vmState - name: State - type: string - - description: Cluster to which this AzureMachine belongs - jsonPath: .metadata.labels.cluster\.x-k8s\.io/cluster-name - name: Cluster - priority: 1 - type: string - - description: Machine object to which this AzureMachine belongs - jsonPath: .metadata.ownerReferences[?(@.kind=="Machine")].name - name: Machine - priority: 1 - type: string - - description: Azure VM ID - jsonPath: .spec.providerID - name: VM ID - priority: 1 - type: string - - description: Azure VM Size - jsonPath: .spec.vmSize - name: VM Size - priority: 1 - type: string - name: v1alpha3 - schema: - openAPIV3Schema: - description: AzureMachine is the Schema for the azuremachines 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' - 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' - type: string - metadata: - type: object - spec: - description: AzureMachineSpec defines the desired state of AzureMachine. - properties: - acceleratedNetworking: - description: AcceleratedNetworking enables or disables Azure accelerated - networking. If omitted, it will be set based on whether the requested - VMSize supports accelerated networking. If AcceleratedNetworking - is set to true with a VMSize that does not support it, Azure will - return an error. - type: boolean - additionalTags: - additionalProperties: - type: string - description: AdditionalTags is an optional set of tags to add to an - instance, in addition to the ones added by default by the Azure - provider. If both the AzureCluster and the AzureMachine specify - the same tag name with different values, the AzureMachine's value - takes precedence. - type: object - allocatePublicIP: - description: AllocatePublicIP allows the ability to create dynamic - public ips for machines where this value is true. - type: boolean - availabilityZone: - description: 'Deprecated: use FailureDomain instead' - properties: - enabled: - type: boolean - id: - type: string - type: object - dataDisks: - description: DataDisk specifies the parameters that are used to add - one or more data disks to the machine - items: - description: DataDisk specifies the parameters that are used to - add one or more data disks to the machine. - properties: - cachingType: - type: string - diskSizeGB: - description: DiskSizeGB is the size in GB to assign to the data - disk. - format: int32 - type: integer - lun: - description: Lun Specifies the logical unit number of the data - disk. This value is used to identify data disks within the - VM and therefore must be unique for each data disk attached - to a VM. The value must be between 0 and 63. - format: int32 - type: integer - managedDisk: - description: ManagedDisk defines the managed disk options for - a VM. - properties: - diskEncryptionSet: - description: DiskEncryptionSetParameters defines disk encryption - options. - properties: - id: - description: ID defines resourceID for diskEncryptionSet - resource. It must be in the same subscription - type: string - type: object - storageAccountType: - type: string - required: - - storageAccountType - type: object - nameSuffix: - description: NameSuffix is the suffix to be appended to the - machine name to generate the disk name. Each disk name will - be in format _. - type: string - required: - - diskSizeGB - - nameSuffix - type: object - type: array - enableIPForwarding: - description: EnableIPForwarding enables IP Forwarding in Azure which - is required for some CNI's to send traffic from a pods on one machine - to another. This is required for IpV6 with Calico in combination - with User Defined Routes (set by the Azure Cloud Controller manager). - Default is false for disabled. - type: boolean - failureDomain: - description: FailureDomain is the failure domain unique identifier - this Machine should be attached to, as defined in Cluster API. This - relates to an Azure Availability Zone - type: string - identity: - default: None - description: Identity is the type of identity used for the virtual - machine. The type 'SystemAssigned' is an implicitly created identity. - The generated identity will be assigned a Subscription contributor - role. The type 'UserAssigned' is a standalone Azure resource provided - by the user and assigned to the VM - enum: - - None - - SystemAssigned - - UserAssigned - type: string - image: - description: Image is used to provide details of an image to use during - VM creation. If image details are omitted the image will default - the Azure Marketplace "capi" offer, which is based on Ubuntu. - properties: - id: - description: ID specifies an image to use by ID - type: string - marketplace: - description: Marketplace specifies an image to use from the Azure - Marketplace - properties: - offer: - description: Offer specifies the name of a group of related - images created by the publisher. For example, UbuntuServer, - WindowsServer - minLength: 1 - type: string - publisher: - description: Publisher is the name of the organization that - created the image - minLength: 1 - type: string - sku: - description: SKU specifies an instance of an offer, such as - a major release of a distribution. For example, 18.04-LTS, - 2019-Datacenter - minLength: 1 - type: string - thirdPartyImage: - default: false - description: ThirdPartyImage indicates the image is published - by a third party publisher and a Plan will be generated - for it. - type: boolean - version: - description: Version specifies the version of an image sku. - The allowed formats are Major.Minor.Build or 'latest'. Major, - Minor, and Build are decimal numbers. Specify 'latest' to - use the latest version of an image available at deploy time. - Even if you use 'latest', the VM image will not automatically - update after deploy time even if a new version becomes available. - minLength: 1 - type: string - required: - - offer - - publisher - - sku - - version - type: object - sharedGallery: - description: SharedGallery specifies an image to use from an Azure - Shared Image Gallery - properties: - gallery: - description: Gallery specifies the name of the shared image - gallery that contains the image - minLength: 1 - type: string - name: - description: Name is the name of the image - minLength: 1 - type: string - resourceGroup: - description: ResourceGroup specifies the resource group containing - the shared image gallery - minLength: 1 - type: string - subscriptionID: - description: SubscriptionID is the identifier of the subscription - that contains the shared image gallery - minLength: 1 - type: string - version: - description: Version specifies the version of the marketplace - image. The allowed formats are Major.Minor.Build or 'latest'. - Major, Minor, and Build are decimal numbers. Specify 'latest' - to use the latest version of an image available at deploy - time. Even if you use 'latest', the VM image will not automatically - update after deploy time even if a new version becomes available. - minLength: 1 - type: string - required: - - gallery - - name - - resourceGroup - - subscriptionID - - version - type: object - type: object - location: - description: 'Deprecated: to support old clients, will be removed - in v1alpha4/v1beta1' - type: string - osDisk: - description: OSDisk specifies the parameters for the operating system - disk of the machine - properties: - cachingType: - type: string - diffDiskSettings: - description: DiffDiskSettings describe ephemeral disk settings - for the os disk. - properties: - option: - description: Option enables ephemeral OS when set to "Local" - See https://docs.microsoft.com/en-us/azure/virtual-machines/ephemeral-os-disks - for full details - enum: - - Local - type: string - required: - - option - type: object - diskSizeGB: - format: int32 - type: integer - managedDisk: - description: ManagedDisk defines the managed disk options for - a VM. - properties: - diskEncryptionSet: - description: DiskEncryptionSetParameters defines disk encryption - options. - properties: - id: - description: ID defines resourceID for diskEncryptionSet - resource. It must be in the same subscription - type: string - type: object - storageAccountType: - type: string - required: - - storageAccountType - type: object - osType: - type: string - required: - - diskSizeGB - - managedDisk - - osType - type: object - providerID: - description: ProviderID is the unique identifier as specified by the - cloud provider. - type: string - roleAssignmentName: - description: RoleAssignmentName is the name of the role assignment - to create for a system assigned identity. It can be any valid GUID. - If not specified, a random GUID will be generated. - type: string - securityProfile: - description: SecurityProfile specifies the Security profile settings - for a virtual machine. - properties: - encryptionAtHost: - description: This field indicates whether Host Encryption should - be enabled or disabled for a virtual machine or virtual machine - scale set. Default is disabled. - type: boolean - type: object - spotVMOptions: - description: SpotVMOptions allows the ability to specify the Machine - should use a Spot VM. - properties: - maxPrice: - anyOf: - - type: integer - - type: string - description: MaxPrice defines the maximum price the user is willing - to pay for Spot VM instances - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - sshPublicKey: - type: string - userAssignedIdentities: - description: UserAssignedIdentities is a list of standalone Azure - identities provided by the user The lifecycle of a user-assigned - identity is managed separately from the lifecycle of the AzureMachine. - See https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/how-to-manage-ua-identity-cli - items: - description: UserAssignedIdentity defines the user-assigned identities - provided by the user to be assigned to Azure resources. - properties: - providerID: - description: 'ProviderID is the identification ID of the user-assigned - Identity, the format of an identity is: ''azure:///subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}''' - type: string - required: - - providerID - type: object - type: array - vmSize: - type: string - required: - - location - - osDisk - - sshPublicKey - - vmSize - type: object - status: - description: AzureMachineStatus defines the observed state of AzureMachine. - properties: - addresses: - description: Addresses contains the Azure instance associated addresses. - items: - description: NodeAddress contains information for the node's address. - properties: - address: - description: The node address. - type: string - type: - description: Node address type, one of Hostname, ExternalIP - or InternalIP. - type: string - required: - - address - - type - type: object - type: array - conditions: - description: Conditions defines current service state of the AzureMachine. - items: - description: Condition defines an observation of a Cluster API resource - 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. - format: date-time - type: string - message: - 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. - 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. - 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. - type: string - required: - - status - - type - type: object - type: array - failureMessage: - description: "ErrorMessage will be set in the event that there is - a terminal problem reconciling the Machine and will contain a more - verbose string suitable for logging and human consumption. \n This - field should not be set for transitive errors that a controller - faces that are expected to be fixed automatically over time (like - service outages), but instead indicate that something is fundamentally - wrong with the Machine's spec or the configuration of the controller, - and that manual intervention is required. Examples of terminal errors - would be invalid combinations of settings in the spec, values that - are unsupported by the controller, or the responsible controller - itself being critically misconfigured. \n Any transient errors that - occur during the reconciliation of Machines can be added as events - to the Machine object and/or logged in the controller's output." - type: string - failureReason: - description: "ErrorReason will be set in the event that there is a - terminal problem reconciling the Machine and will contain a succinct - value suitable for machine interpretation. \n This field should - not be set for transitive errors that a controller faces that are - expected to be fixed automatically over time (like service outages), - but instead indicate that something is fundamentally wrong with - the Machine's spec or the configuration of the controller, and that - manual intervention is required. Examples of terminal errors would - be invalid combinations of settings in the spec, values that are - unsupported by the controller, or the responsible controller itself - being critically misconfigured. \n Any transient errors that occur - during the reconciliation of Machines can be added as events to - the Machine object and/or logged in the controller's output." - type: string - ready: - description: Ready is true when the provider resource is ready. - type: boolean - vmState: - description: VMState is the provisioning state of the Azure virtual - machine. - type: string - type: object - type: object - served: true - storage: false - subresources: - status: {} - - additionalPrinterColumns: - - description: AzureMachine ready status - jsonPath: .status.ready - name: Ready - type: string - - description: Azure VM provisioning state - jsonPath: .status.vmState - name: State - type: string - - description: Cluster to which this AzureMachine belongs - jsonPath: .metadata.labels.cluster\.x-k8s\.io/cluster-name - name: Cluster - priority: 1 - type: string - - description: Machine object to which this AzureMachine belongs - jsonPath: .metadata.ownerReferences[?(@.kind=="Machine")].name - name: Machine - priority: 1 - type: string - - description: Azure VM ID - jsonPath: .spec.providerID - name: VM ID - priority: 1 - type: string - - description: Azure VM Size - jsonPath: .spec.vmSize - name: VM Size - priority: 1 - type: string - name: v1alpha4 - schema: - openAPIV3Schema: - description: AzureMachine is the Schema for the azuremachines 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' - 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' - type: string - metadata: - type: object - spec: - description: AzureMachineSpec defines the desired state of AzureMachine. - properties: - acceleratedNetworking: - description: AcceleratedNetworking enables or disables Azure accelerated - networking. If omitted, it will be set based on whether the requested - VMSize supports accelerated networking. If AcceleratedNetworking - is set to true with a VMSize that does not support it, Azure will - return an error. - type: boolean - additionalTags: - additionalProperties: - type: string - description: AdditionalTags is an optional set of tags to add to an - instance, in addition to the ones added by default by the Azure - provider. If both the AzureCluster and the AzureMachine specify - the same tag name with different values, the AzureMachine's value - takes precedence. - type: object - allocatePublicIP: - description: AllocatePublicIP allows the ability to create dynamic - public ips for machines where this value is true. - type: boolean - dataDisks: - description: DataDisk specifies the parameters that are used to add - one or more data disks to the machine - items: - description: DataDisk specifies the parameters that are used to - add one or more data disks to the machine. - properties: - cachingType: - description: CachingType specifies the caching requirements. - enum: - - None - - ReadOnly - - ReadWrite - type: string - diskSizeGB: - description: DiskSizeGB is the size in GB to assign to the data - disk. - format: int32 - type: integer - lun: - description: Lun Specifies the logical unit number of the data - disk. This value is used to identify data disks within the - VM and therefore must be unique for each data disk attached - to a VM. The value must be between 0 and 63. - format: int32 - type: integer - managedDisk: - description: ManagedDisk specifies the Managed Disk parameters - for the data disk. - properties: - diskEncryptionSet: - description: DiskEncryptionSetParameters defines disk encryption - options. - properties: - id: - description: ID defines resourceID for diskEncryptionSet - resource. It must be in the same subscription - type: string - type: object - storageAccountType: - type: string - type: object - nameSuffix: - description: NameSuffix is the suffix to be appended to the - machine name to generate the disk name. Each disk name will - be in format _. - type: string - required: - - diskSizeGB - - nameSuffix - type: object - type: array - enableIPForwarding: - description: EnableIPForwarding enables IP Forwarding in Azure which - is required for some CNI's to send traffic from a pods on one machine - to another. This is required for IpV6 with Calico in combination - with User Defined Routes (set by the Azure Cloud Controller manager). - Default is false for disabled. - type: boolean - failureDomain: - description: FailureDomain is the failure domain unique identifier - this Machine should be attached to, as defined in Cluster API. This - relates to an Azure Availability Zone - type: string - identity: - default: None - description: Identity is the type of identity used for the virtual - machine. The type 'SystemAssigned' is an implicitly created identity. - The generated identity will be assigned a Subscription contributor - role. The type 'UserAssigned' is a standalone Azure resource provided - by the user and assigned to the VM - enum: - - None - - SystemAssigned - - UserAssigned - type: string - image: - description: Image is used to provide details of an image to use during - VM creation. If image details are omitted the image will default - the Azure Marketplace "capi" offer, which is based on Ubuntu. - properties: - id: - description: ID specifies an image to use by ID - type: string - marketplace: - description: Marketplace specifies an image to use from the Azure - Marketplace - properties: - offer: - description: Offer specifies the name of a group of related - images created by the publisher. For example, UbuntuServer, - WindowsServer - minLength: 1 - type: string - publisher: - description: Publisher is the name of the organization that - created the image - minLength: 1 - type: string - sku: - description: SKU specifies an instance of an offer, such as - a major release of a distribution. For example, 18.04-LTS, - 2019-Datacenter - minLength: 1 - type: string - thirdPartyImage: - default: false - description: ThirdPartyImage indicates the image is published - by a third party publisher and a Plan will be generated - for it. - type: boolean - version: - description: Version specifies the version of an image sku. - The allowed formats are Major.Minor.Build or 'latest'. Major, - Minor, and Build are decimal numbers. Specify 'latest' to - use the latest version of an image available at deploy time. - Even if you use 'latest', the VM image will not automatically - update after deploy time even if a new version becomes available. - minLength: 1 - type: string - required: - - offer - - publisher - - sku - - version - type: object - sharedGallery: - description: SharedGallery specifies an image to use from an Azure - Shared Image Gallery - properties: - gallery: - description: Gallery specifies the name of the shared image - gallery that contains the image - minLength: 1 - type: string - name: - description: Name is the name of the image - minLength: 1 - type: string - offer: - description: Offer specifies the name of a group of related - images created by the publisher. For example, UbuntuServer, - WindowsServer This value will be used to add a `Plan` in - the API request when creating the VM/VMSS resource. This - is needed when the source image from which this SIG image - was built requires the `Plan` to be used. - type: string - publisher: - description: Publisher is the name of the organization that - created the image. This value will be used to add a `Plan` - in the API request when creating the VM/VMSS resource. This - is needed when the source image from which this SIG image - was built requires the `Plan` to be used. - type: string - resourceGroup: - description: ResourceGroup specifies the resource group containing - the shared image gallery - minLength: 1 - type: string - sku: - description: SKU specifies an instance of an offer, such as - a major release of a distribution. For example, 18.04-LTS, - 2019-Datacenter This value will be used to add a `Plan` - in the API request when creating the VM/VMSS resource. This - is needed when the source image from which this SIG image - was built requires the `Plan` to be used. - type: string - subscriptionID: - description: SubscriptionID is the identifier of the subscription - that contains the shared image gallery - minLength: 1 - type: string - version: - description: Version specifies the version of the marketplace - image. The allowed formats are Major.Minor.Build or 'latest'. - Major, Minor, and Build are decimal numbers. Specify 'latest' - to use the latest version of an image available at deploy - time. Even if you use 'latest', the VM image will not automatically - update after deploy time even if a new version becomes available. - minLength: 1 - type: string - required: - - gallery - - name - - resourceGroup - - subscriptionID - - version - type: object - type: object - osDisk: - description: OSDisk specifies the parameters for the operating system - disk of the machine - properties: - cachingType: - description: CachingType specifies the caching requirements. - enum: - - None - - ReadOnly - - ReadWrite - type: string - diffDiskSettings: - description: DiffDiskSettings describe ephemeral disk settings - for the os disk. - properties: - option: - description: Option enables ephemeral OS when set to "Local" - See https://docs.microsoft.com/en-us/azure/virtual-machines/ephemeral-os-disks - for full details - enum: - - Local - type: string - required: - - option - type: object - diskSizeGB: - description: DiskSizeGB is the size in GB to assign to the OS - disk. Will have a default of 30GB if not provided - format: int32 - type: integer - managedDisk: - description: ManagedDisk specifies the Managed Disk parameters - for the OS disk. - properties: - diskEncryptionSet: - description: DiskEncryptionSetParameters defines disk encryption - options. - properties: - id: - description: ID defines resourceID for diskEncryptionSet - resource. It must be in the same subscription - type: string - type: object - storageAccountType: - type: string - type: object - osType: - type: string - required: - - osType - type: object - providerID: - description: ProviderID is the unique identifier as specified by the - cloud provider. - type: string - roleAssignmentName: - description: RoleAssignmentName is the name of the role assignment - to create for a system assigned identity. It can be any valid GUID. - If not specified, a random GUID will be generated. - type: string - securityProfile: - description: SecurityProfile specifies the Security profile settings - for a virtual machine. - properties: - encryptionAtHost: - description: This field indicates whether Host Encryption should - be enabled or disabled for a virtual machine or virtual machine - scale set. Default is disabled. - type: boolean - type: object - spotVMOptions: - description: SpotVMOptions allows the ability to specify the Machine - should use a Spot VM - properties: - maxPrice: - anyOf: - - type: integer - - type: string - description: MaxPrice defines the maximum price the user is willing - to pay for Spot VM instances - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - sshPublicKey: - type: string - subnetName: - description: SubnetName selects the Subnet where the VM will be placed - type: string - userAssignedIdentities: - description: UserAssignedIdentities is a list of standalone Azure - identities provided by the user The lifecycle of a user-assigned - identity is managed separately from the lifecycle of the AzureMachine. - See https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/how-to-manage-ua-identity-cli - items: - description: UserAssignedIdentity defines the user-assigned identities - provided by the user to be assigned to Azure resources. - properties: - providerID: - description: 'ProviderID is the identification ID of the user-assigned - Identity, the format of an identity is: ''azure:///subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}''' - type: string - required: - - providerID - type: object - type: array - vmSize: - type: string - required: - - osDisk - - sshPublicKey - - vmSize - type: object - status: - description: AzureMachineStatus defines the observed state of AzureMachine. - properties: - addresses: - description: Addresses contains the Azure instance associated addresses. - items: - description: NodeAddress contains information for the node's address. - properties: - address: - description: The node address. - type: string - type: - description: Node address type, one of Hostname, ExternalIP - or InternalIP. - type: string - required: - - address - - type - type: object - type: array - conditions: - description: Conditions defines current service state of the AzureMachine. - items: - description: Condition defines an observation of a Cluster API resource - 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. - format: date-time - type: string - message: - 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. - 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. - 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. - type: string - required: - - status - - type - type: object - type: array - failureMessage: - description: "ErrorMessage will be set in the event that there is - a terminal problem reconciling the Machine and will contain a more - verbose string suitable for logging and human consumption. \n This - field should not be set for transitive errors that a controller - faces that are expected to be fixed automatically over time (like - service outages), but instead indicate that something is fundamentally - wrong with the Machine's spec or the configuration of the controller, - and that manual intervention is required. Examples of terminal errors - would be invalid combinations of settings in the spec, values that - are unsupported by the controller, or the responsible controller - itself being critically misconfigured. \n Any transient errors that - occur during the reconciliation of Machines can be added as events - to the Machine object and/or logged in the controller's output." - type: string - failureReason: - description: "ErrorReason will be set in the event that there is a - terminal problem reconciling the Machine and will contain a succinct - value suitable for machine interpretation. \n This field should - not be set for transitive errors that a controller faces that are - expected to be fixed automatically over time (like service outages), - but instead indicate that something is fundamentally wrong with - the Machine's spec or the configuration of the controller, and that - manual intervention is required. Examples of terminal errors would - be invalid combinations of settings in the spec, values that are - unsupported by the controller, or the responsible controller itself - being critically misconfigured. \n Any transient errors that occur - during the reconciliation of Machines can be added as events to - the Machine object and/or logged in the controller's output." - type: string - longRunningOperationStates: - description: LongRunningOperationStates saves the states for Azure - long-running operations so they can be continued on the next reconciliation - loop. - items: - description: Future contains the data needed for an Azure long-running - operation to continue across reconcile loops. - properties: - data: - description: Data is the base64 url encoded json Azure AutoRest - Future. - type: string - name: - description: Name is the name of the Azure resource. Together - with the service name, this forms the unique identifier for - the future. - type: string - resourceGroup: - description: ResourceGroup is the Azure resource group for the - resource. - type: string - serviceName: - description: ServiceName is the name of the Azure service. Together - with the name of the resource, this forms the unique identifier - for the future. - type: string - type: - description: Type describes the type of future, such as update, - create, delete, etc. - type: string - required: - - name - - serviceName - - type - type: object - type: array - ready: - description: Ready is true when the provider resource is ready. - type: boolean - vmState: - description: VMState is the provisioning state of the Azure virtual - machine. - type: string - type: object - type: object - served: true - storage: false - subresources: - status: {} - additionalPrinterColumns: - jsonPath: .status.conditions[?(@.type=='Ready')].status name: Ready @@ -1106,14 +135,44 @@ spec: for the data disk. properties: diskEncryptionSet: - description: DiskEncryptionSetParameters defines disk encryption - options. + description: DiskEncryptionSet specifies the customer-managed + disk encryption set resource id for the managed disk. properties: id: description: ID defines resourceID for diskEncryptionSet resource. It must be in the same subscription type: string type: object + securityProfile: + description: SecurityProfile specifies the security profile + for the managed disk. + properties: + diskEncryptionSet: + description: DiskEncryptionSet specifies the customer-managed + disk encryption set resource id for the managed disk + that is used for Customer Managed Key encrypted ConfidentialVM + OS Disk and VMGuest blob. + properties: + id: + description: ID defines resourceID for diskEncryptionSet + resource. It must be in the same subscription + type: string + type: object + securityEncryptionType: + description: SecurityEncryptionType specifies the encryption + type of the managed disk. It is set to DiskWithVMGuestState + to encrypt the managed disk along with the VMGuestState + blob, and to VMGuestStateOnly to encrypt the VMGuestState + blob only. When set to VMGuestStateOnly, VirtualizedTrustedPlatformModule + should be set to Enabled. When set to DiskWithVMGuestState, + EncryptionAtHost should be disabled, SecureBoot and + VirtualizedTrustedPlatformModule should be set to + Enabled. It can be set only for Confidential VMs. + enum: + - VMGuestStateOnly + - DiskWithVMGuestState + type: string + type: object storageAccountType: type: string type: object @@ -1437,14 +496,44 @@ spec: for the OS disk. properties: diskEncryptionSet: - description: DiskEncryptionSetParameters defines disk encryption - options. + description: DiskEncryptionSet specifies the customer-managed + disk encryption set resource id for the managed disk. properties: id: description: ID defines resourceID for diskEncryptionSet resource. It must be in the same subscription type: string type: object + securityProfile: + description: SecurityProfile specifies the security profile + for the managed disk. + properties: + diskEncryptionSet: + description: DiskEncryptionSet specifies the customer-managed + disk encryption set resource id for the managed disk + that is used for Customer Managed Key encrypted ConfidentialVM + OS Disk and VMGuest blob. + properties: + id: + description: ID defines resourceID for diskEncryptionSet + resource. It must be in the same subscription + type: string + type: object + securityEncryptionType: + description: SecurityEncryptionType specifies the encryption + type of the managed disk. It is set to DiskWithVMGuestState + to encrypt the managed disk along with the VMGuestState + blob, and to VMGuestStateOnly to encrypt the VMGuestState + blob only. When set to VMGuestStateOnly, VirtualizedTrustedPlatformModule + should be set to Enabled. When set to DiskWithVMGuestState, + EncryptionAtHost should be disabled, SecureBoot and + VirtualizedTrustedPlatformModule should be set to Enabled. + It can be set only for Confidential VMs. + enum: + - VMGuestStateOnly + - DiskWithVMGuestState + type: string + type: object storageAccountType: type: string type: object @@ -1468,8 +557,43 @@ spec: encryptionAtHost: description: This field indicates whether Host Encryption should be enabled or disabled for a virtual machine or virtual machine - scale set. Default is disabled. + scale set. This should be disabled when SecurityEncryptionType + is set to DiskWithVMGuestState. Default is disabled. type: boolean + securityType: + description: 'SecurityType specifies the SecurityType of the virtual + machine. It has to be set to any specified value to enable UefiSettings. + The default behavior is: UefiSettings will not be enabled unless + this property is set.' + enum: + - ConfidentialVM + - TrustedLaunch + type: string + uefiSettings: + description: UefiSettings specifies the security settings like + secure boot and vTPM used while creating the virtual machine. + properties: + secureBootEnabled: + description: SecureBootEnabled specifies whether secure boot + should be enabled on the virtual machine. Secure Boot verifies + the digital signature of all boot components and halts the + boot process if signature verification fails. If omitted, + the platform chooses a default, which is subject to change + over time, currently that default is false. + type: boolean + vTpmEnabled: + description: VTpmEnabled specifies whether vTPM should be + enabled on the virtual machine. When true it enables the + virtualized trusted platform module measurements to create + a known good boot integrity policy baseline. The integrity + policy baseline is used for comparison with measurements + from subsequent VM boots to determine if anything has changed. + This is required to be set to Enabled if SecurityEncryptionType + is defined. If omitted, the platform chooses a default, + which is subject to change over time, currently that default + is false. + type: boolean + type: object type: object spotVMOptions: description: SpotVMOptions allows the ability to specify the Machine diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremachinetemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremachinetemplates.yaml index bcf10582ad2..e0d37f0f1e0 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremachinetemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremachinetemplates.yaml @@ -17,729 +17,6 @@ spec: singular: azuremachinetemplate scope: Namespaced versions: - - name: v1alpha3 - schema: - openAPIV3Schema: - description: AzureMachineTemplate is the Schema for the azuremachinetemplates - 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' - 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' - type: string - metadata: - type: object - spec: - description: AzureMachineTemplateSpec defines the desired state of AzureMachineTemplate. - properties: - template: - description: AzureMachineTemplateResource describes the data needed - to create an AzureMachine from a template. - properties: - spec: - description: Spec is the specification of the desired behavior - of the machine. - properties: - acceleratedNetworking: - description: AcceleratedNetworking enables or disables Azure - accelerated networking. If omitted, it will be set based - on whether the requested VMSize supports accelerated networking. - If AcceleratedNetworking is set to true with a VMSize that - does not support it, Azure will return an error. - type: boolean - additionalTags: - additionalProperties: - type: string - description: AdditionalTags is an optional set of tags to - add to an instance, in addition to the ones added by default - by the Azure provider. If both the AzureCluster and the - AzureMachine specify the same tag name with different values, - the AzureMachine's value takes precedence. - type: object - allocatePublicIP: - description: AllocatePublicIP allows the ability to create - dynamic public ips for machines where this value is true. - type: boolean - availabilityZone: - description: 'Deprecated: use FailureDomain instead' - properties: - enabled: - type: boolean - id: - type: string - type: object - dataDisks: - description: DataDisk specifies the parameters that are used - to add one or more data disks to the machine - items: - description: DataDisk specifies the parameters that are - used to add one or more data disks to the machine. - properties: - cachingType: - type: string - diskSizeGB: - description: DiskSizeGB is the size in GB to assign - to the data disk. - format: int32 - type: integer - lun: - description: Lun Specifies the logical unit number of - the data disk. This value is used to identify data - disks within the VM and therefore must be unique for - each data disk attached to a VM. The value must be - between 0 and 63. - format: int32 - type: integer - managedDisk: - description: ManagedDisk defines the managed disk options - for a VM. - properties: - diskEncryptionSet: - description: DiskEncryptionSetParameters defines - disk encryption options. - properties: - id: - description: ID defines resourceID for diskEncryptionSet - resource. It must be in the same subscription - type: string - type: object - storageAccountType: - type: string - required: - - storageAccountType - type: object - nameSuffix: - description: NameSuffix is the suffix to be appended - to the machine name to generate the disk name. Each - disk name will be in format _. - type: string - required: - - diskSizeGB - - nameSuffix - type: object - type: array - enableIPForwarding: - description: EnableIPForwarding enables IP Forwarding in Azure - which is required for some CNI's to send traffic from a - pods on one machine to another. This is required for IpV6 - with Calico in combination with User Defined Routes (set - by the Azure Cloud Controller manager). Default is false - for disabled. - type: boolean - failureDomain: - description: FailureDomain is the failure domain unique identifier - this Machine should be attached to, as defined in Cluster - API. This relates to an Azure Availability Zone - type: string - identity: - default: None - description: Identity is the type of identity used for the - virtual machine. The type 'SystemAssigned' is an implicitly - created identity. The generated identity will be assigned - a Subscription contributor role. The type 'UserAssigned' - is a standalone Azure resource provided by the user and - assigned to the VM - enum: - - None - - SystemAssigned - - UserAssigned - type: string - image: - description: Image is used to provide details of an image - to use during VM creation. If image details are omitted - the image will default the Azure Marketplace "capi" offer, - which is based on Ubuntu. - properties: - id: - description: ID specifies an image to use by ID - type: string - marketplace: - description: Marketplace specifies an image to use from - the Azure Marketplace - properties: - offer: - description: Offer specifies the name of a group of - related images created by the publisher. For example, - UbuntuServer, WindowsServer - minLength: 1 - type: string - publisher: - description: Publisher is the name of the organization - that created the image - minLength: 1 - type: string - sku: - description: SKU specifies an instance of an offer, - such as a major release of a distribution. For example, - 18.04-LTS, 2019-Datacenter - minLength: 1 - type: string - thirdPartyImage: - default: false - description: ThirdPartyImage indicates the image is - published by a third party publisher and a Plan - will be generated for it. - type: boolean - version: - description: Version specifies the version of an image - sku. The allowed formats are Major.Minor.Build or - 'latest'. Major, Minor, and Build are decimal numbers. - Specify 'latest' to use the latest version of an - image available at deploy time. Even if you use - 'latest', the VM image will not automatically update - after deploy time even if a new version becomes - available. - minLength: 1 - type: string - required: - - offer - - publisher - - sku - - version - type: object - sharedGallery: - description: SharedGallery specifies an image to use from - an Azure Shared Image Gallery - properties: - gallery: - description: Gallery specifies the name of the shared - image gallery that contains the image - minLength: 1 - type: string - name: - description: Name is the name of the image - minLength: 1 - type: string - resourceGroup: - description: ResourceGroup specifies the resource - group containing the shared image gallery - minLength: 1 - type: string - subscriptionID: - description: SubscriptionID is the identifier of the - subscription that contains the shared image gallery - minLength: 1 - type: string - version: - description: Version specifies the version of the - marketplace image. The allowed formats are Major.Minor.Build - or 'latest'. Major, Minor, and Build are decimal - numbers. Specify 'latest' to use the latest version - of an image available at deploy time. Even if you - use 'latest', the VM image will not automatically - update after deploy time even if a new version becomes - available. - minLength: 1 - type: string - required: - - gallery - - name - - resourceGroup - - subscriptionID - - version - type: object - type: object - location: - description: 'Deprecated: to support old clients, will be - removed in v1alpha4/v1beta1' - type: string - osDisk: - description: OSDisk specifies the parameters for the operating - system disk of the machine - properties: - cachingType: - type: string - diffDiskSettings: - description: DiffDiskSettings describe ephemeral disk - settings for the os disk. - properties: - option: - description: Option enables ephemeral OS when set - to "Local" See https://docs.microsoft.com/en-us/azure/virtual-machines/ephemeral-os-disks - for full details - enum: - - Local - type: string - required: - - option - type: object - diskSizeGB: - format: int32 - type: integer - managedDisk: - description: ManagedDisk defines the managed disk options - for a VM. - properties: - diskEncryptionSet: - description: DiskEncryptionSetParameters defines disk - encryption options. - properties: - id: - description: ID defines resourceID for diskEncryptionSet - resource. It must be in the same subscription - type: string - type: object - storageAccountType: - type: string - required: - - storageAccountType - type: object - osType: - type: string - required: - - diskSizeGB - - managedDisk - - osType - type: object - providerID: - description: ProviderID is the unique identifier as specified - by the cloud provider. - type: string - roleAssignmentName: - description: RoleAssignmentName is the name of the role assignment - to create for a system assigned identity. It can be any - valid GUID. If not specified, a random GUID will be generated. - type: string - securityProfile: - description: SecurityProfile specifies the Security profile - settings for a virtual machine. - properties: - encryptionAtHost: - description: This field indicates whether Host Encryption - should be enabled or disabled for a virtual machine - or virtual machine scale set. Default is disabled. - type: boolean - type: object - spotVMOptions: - description: SpotVMOptions allows the ability to specify the - Machine should use a Spot VM. - properties: - maxPrice: - anyOf: - - type: integer - - type: string - description: MaxPrice defines the maximum price the user - is willing to pay for Spot VM instances - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - sshPublicKey: - type: string - userAssignedIdentities: - description: UserAssignedIdentities is a list of standalone - Azure identities provided by the user The lifecycle of a - user-assigned identity is managed separately from the lifecycle - of the AzureMachine. See https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/how-to-manage-ua-identity-cli - items: - description: UserAssignedIdentity defines the user-assigned - identities provided by the user to be assigned to Azure - resources. - properties: - providerID: - description: 'ProviderID is the identification ID of - the user-assigned Identity, the format of an identity - is: ''azure:///subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}''' - type: string - required: - - providerID - type: object - type: array - vmSize: - type: string - required: - - location - - osDisk - - sshPublicKey - - vmSize - type: object - required: - - spec - type: object - required: - - template - type: object - type: object - served: true - storage: false - - name: v1alpha4 - schema: - openAPIV3Schema: - description: AzureMachineTemplate is the Schema for the azuremachinetemplates - 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' - 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' - type: string - metadata: - type: object - spec: - description: AzureMachineTemplateSpec defines the desired state of AzureMachineTemplate. - properties: - template: - description: AzureMachineTemplateResource describes the data needed - to create an AzureMachine from a template. - properties: - spec: - description: Spec is the specification of the desired behavior - of the machine. - properties: - acceleratedNetworking: - description: AcceleratedNetworking enables or disables Azure - accelerated networking. If omitted, it will be set based - on whether the requested VMSize supports accelerated networking. - If AcceleratedNetworking is set to true with a VMSize that - does not support it, Azure will return an error. - type: boolean - additionalTags: - additionalProperties: - type: string - description: AdditionalTags is an optional set of tags to - add to an instance, in addition to the ones added by default - by the Azure provider. If both the AzureCluster and the - AzureMachine specify the same tag name with different values, - the AzureMachine's value takes precedence. - type: object - allocatePublicIP: - description: AllocatePublicIP allows the ability to create - dynamic public ips for machines where this value is true. - type: boolean - dataDisks: - description: DataDisk specifies the parameters that are used - to add one or more data disks to the machine - items: - description: DataDisk specifies the parameters that are - used to add one or more data disks to the machine. - properties: - cachingType: - description: CachingType specifies the caching requirements. - enum: - - None - - ReadOnly - - ReadWrite - type: string - diskSizeGB: - description: DiskSizeGB is the size in GB to assign - to the data disk. - format: int32 - type: integer - lun: - description: Lun Specifies the logical unit number of - the data disk. This value is used to identify data - disks within the VM and therefore must be unique for - each data disk attached to a VM. The value must be - between 0 and 63. - format: int32 - type: integer - managedDisk: - description: ManagedDisk specifies the Managed Disk - parameters for the data disk. - properties: - diskEncryptionSet: - description: DiskEncryptionSetParameters defines - disk encryption options. - properties: - id: - description: ID defines resourceID for diskEncryptionSet - resource. It must be in the same subscription - type: string - type: object - storageAccountType: - type: string - type: object - nameSuffix: - description: NameSuffix is the suffix to be appended - to the machine name to generate the disk name. Each - disk name will be in format _. - type: string - required: - - diskSizeGB - - nameSuffix - type: object - type: array - enableIPForwarding: - description: EnableIPForwarding enables IP Forwarding in Azure - which is required for some CNI's to send traffic from a - pods on one machine to another. This is required for IpV6 - with Calico in combination with User Defined Routes (set - by the Azure Cloud Controller manager). Default is false - for disabled. - type: boolean - failureDomain: - description: FailureDomain is the failure domain unique identifier - this Machine should be attached to, as defined in Cluster - API. This relates to an Azure Availability Zone - type: string - identity: - default: None - description: Identity is the type of identity used for the - virtual machine. The type 'SystemAssigned' is an implicitly - created identity. The generated identity will be assigned - a Subscription contributor role. The type 'UserAssigned' - is a standalone Azure resource provided by the user and - assigned to the VM - enum: - - None - - SystemAssigned - - UserAssigned - type: string - image: - description: Image is used to provide details of an image - to use during VM creation. If image details are omitted - the image will default the Azure Marketplace "capi" offer, - which is based on Ubuntu. - properties: - id: - description: ID specifies an image to use by ID - type: string - marketplace: - description: Marketplace specifies an image to use from - the Azure Marketplace - properties: - offer: - description: Offer specifies the name of a group of - related images created by the publisher. For example, - UbuntuServer, WindowsServer - minLength: 1 - type: string - publisher: - description: Publisher is the name of the organization - that created the image - minLength: 1 - type: string - sku: - description: SKU specifies an instance of an offer, - such as a major release of a distribution. For example, - 18.04-LTS, 2019-Datacenter - minLength: 1 - type: string - thirdPartyImage: - default: false - description: ThirdPartyImage indicates the image is - published by a third party publisher and a Plan - will be generated for it. - type: boolean - version: - description: Version specifies the version of an image - sku. The allowed formats are Major.Minor.Build or - 'latest'. Major, Minor, and Build are decimal numbers. - Specify 'latest' to use the latest version of an - image available at deploy time. Even if you use - 'latest', the VM image will not automatically update - after deploy time even if a new version becomes - available. - minLength: 1 - type: string - required: - - offer - - publisher - - sku - - version - type: object - sharedGallery: - description: SharedGallery specifies an image to use from - an Azure Shared Image Gallery - properties: - gallery: - description: Gallery specifies the name of the shared - image gallery that contains the image - minLength: 1 - type: string - name: - description: Name is the name of the image - minLength: 1 - type: string - offer: - description: Offer specifies the name of a group of - related images created by the publisher. For example, - UbuntuServer, WindowsServer This value will be used - to add a `Plan` in the API request when creating - the VM/VMSS resource. This is needed when the source - image from which this SIG image was built requires - the `Plan` to be used. - type: string - publisher: - description: Publisher is the name of the organization - that created the image. This value will be used - to add a `Plan` in the API request when creating - the VM/VMSS resource. This is needed when the source - image from which this SIG image was built requires - the `Plan` to be used. - type: string - resourceGroup: - description: ResourceGroup specifies the resource - group containing the shared image gallery - minLength: 1 - type: string - sku: - description: SKU specifies an instance of an offer, - such as a major release of a distribution. For example, - 18.04-LTS, 2019-Datacenter This value will be used - to add a `Plan` in the API request when creating - the VM/VMSS resource. This is needed when the source - image from which this SIG image was built requires - the `Plan` to be used. - type: string - subscriptionID: - description: SubscriptionID is the identifier of the - subscription that contains the shared image gallery - minLength: 1 - type: string - version: - description: Version specifies the version of the - marketplace image. The allowed formats are Major.Minor.Build - or 'latest'. Major, Minor, and Build are decimal - numbers. Specify 'latest' to use the latest version - of an image available at deploy time. Even if you - use 'latest', the VM image will not automatically - update after deploy time even if a new version becomes - available. - minLength: 1 - type: string - required: - - gallery - - name - - resourceGroup - - subscriptionID - - version - type: object - type: object - osDisk: - description: OSDisk specifies the parameters for the operating - system disk of the machine - properties: - cachingType: - description: CachingType specifies the caching requirements. - enum: - - None - - ReadOnly - - ReadWrite - type: string - diffDiskSettings: - description: DiffDiskSettings describe ephemeral disk - settings for the os disk. - properties: - option: - description: Option enables ephemeral OS when set - to "Local" See https://docs.microsoft.com/en-us/azure/virtual-machines/ephemeral-os-disks - for full details - enum: - - Local - type: string - required: - - option - type: object - diskSizeGB: - description: DiskSizeGB is the size in GB to assign to - the OS disk. Will have a default of 30GB if not provided - format: int32 - type: integer - managedDisk: - description: ManagedDisk specifies the Managed Disk parameters - for the OS disk. - properties: - diskEncryptionSet: - description: DiskEncryptionSetParameters defines disk - encryption options. - properties: - id: - description: ID defines resourceID for diskEncryptionSet - resource. It must be in the same subscription - type: string - type: object - storageAccountType: - type: string - type: object - osType: - type: string - required: - - osType - type: object - providerID: - description: ProviderID is the unique identifier as specified - by the cloud provider. - type: string - roleAssignmentName: - description: RoleAssignmentName is the name of the role assignment - to create for a system assigned identity. It can be any - valid GUID. If not specified, a random GUID will be generated. - type: string - securityProfile: - description: SecurityProfile specifies the Security profile - settings for a virtual machine. - properties: - encryptionAtHost: - description: This field indicates whether Host Encryption - should be enabled or disabled for a virtual machine - or virtual machine scale set. Default is disabled. - type: boolean - type: object - spotVMOptions: - description: SpotVMOptions allows the ability to specify the - Machine should use a Spot VM - properties: - maxPrice: - anyOf: - - type: integer - - type: string - description: MaxPrice defines the maximum price the user - is willing to pay for Spot VM instances - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - sshPublicKey: - type: string - subnetName: - description: SubnetName selects the Subnet where the VM will - be placed - type: string - userAssignedIdentities: - description: UserAssignedIdentities is a list of standalone - Azure identities provided by the user The lifecycle of a - user-assigned identity is managed separately from the lifecycle - of the AzureMachine. See https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/how-to-manage-ua-identity-cli - items: - description: UserAssignedIdentity defines the user-assigned - identities provided by the user to be assigned to Azure - resources. - properties: - providerID: - description: 'ProviderID is the identification ID of - the user-assigned Identity, the format of an identity - is: ''azure:///subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}''' - type: string - required: - - providerID - type: object - type: array - vmSize: - type: string - required: - - osDisk - - sshPublicKey - - vmSize - type: object - required: - - spec - type: object - required: - - template - type: object - type: object - served: true - storage: false - name: v1beta1 schema: openAPIV3Schema: @@ -871,14 +148,49 @@ spec: parameters for the data disk. properties: diskEncryptionSet: - description: DiskEncryptionSetParameters defines - disk encryption options. + description: DiskEncryptionSet specifies the customer-managed + disk encryption set resource id for the managed + disk. properties: id: description: ID defines resourceID for diskEncryptionSet resource. It must be in the same subscription type: string type: object + securityProfile: + description: SecurityProfile specifies the security + profile for the managed disk. + properties: + diskEncryptionSet: + description: DiskEncryptionSet specifies the + customer-managed disk encryption set resource + id for the managed disk that is used for Customer + Managed Key encrypted ConfidentialVM OS Disk + and VMGuest blob. + properties: + id: + description: ID defines resourceID for diskEncryptionSet + resource. It must be in the same subscription + type: string + type: object + securityEncryptionType: + description: SecurityEncryptionType specifies + the encryption type of the managed disk. It + is set to DiskWithVMGuestState to encrypt + the managed disk along with the VMGuestState + blob, and to VMGuestStateOnly to encrypt the + VMGuestState blob only. When set to VMGuestStateOnly, + VirtualizedTrustedPlatformModule should be + set to Enabled. When set to DiskWithVMGuestState, + EncryptionAtHost should be disabled, SecureBoot + and VirtualizedTrustedPlatformModule should + be set to Enabled. It can be set only for + Confidential VMs. + enum: + - VMGuestStateOnly + - DiskWithVMGuestState + type: string + type: object storageAccountType: type: string type: object @@ -1220,14 +532,47 @@ spec: for the OS disk. properties: diskEncryptionSet: - description: DiskEncryptionSetParameters defines disk - encryption options. + description: DiskEncryptionSet specifies the customer-managed + disk encryption set resource id for the managed + disk. properties: id: description: ID defines resourceID for diskEncryptionSet resource. It must be in the same subscription type: string type: object + securityProfile: + description: SecurityProfile specifies the security + profile for the managed disk. + properties: + diskEncryptionSet: + description: DiskEncryptionSet specifies the customer-managed + disk encryption set resource id for the managed + disk that is used for Customer Managed Key encrypted + ConfidentialVM OS Disk and VMGuest blob. + properties: + id: + description: ID defines resourceID for diskEncryptionSet + resource. It must be in the same subscription + type: string + type: object + securityEncryptionType: + description: SecurityEncryptionType specifies + the encryption type of the managed disk. It + is set to DiskWithVMGuestState to encrypt the + managed disk along with the VMGuestState blob, + and to VMGuestStateOnly to encrypt the VMGuestState + blob only. When set to VMGuestStateOnly, VirtualizedTrustedPlatformModule + should be set to Enabled. When set to DiskWithVMGuestState, + EncryptionAtHost should be disabled, SecureBoot + and VirtualizedTrustedPlatformModule should + be set to Enabled. It can be set only for Confidential + VMs. + enum: + - VMGuestStateOnly + - DiskWithVMGuestState + type: string + type: object storageAccountType: type: string type: object @@ -1251,8 +596,48 @@ spec: encryptionAtHost: description: This field indicates whether Host Encryption should be enabled or disabled for a virtual machine - or virtual machine scale set. Default is disabled. + or virtual machine scale set. This should be disabled + when SecurityEncryptionType is set to DiskWithVMGuestState. + Default is disabled. type: boolean + securityType: + description: 'SecurityType specifies the SecurityType + of the virtual machine. It has to be set to any specified + value to enable UefiSettings. The default behavior is: + UefiSettings will not be enabled unless this property + is set.' + enum: + - ConfidentialVM + - TrustedLaunch + type: string + uefiSettings: + description: UefiSettings specifies the security settings + like secure boot and vTPM used while creating the virtual + machine. + properties: + secureBootEnabled: + description: SecureBootEnabled specifies whether secure + boot should be enabled on the virtual machine. Secure + Boot verifies the digital signature of all boot + components and halts the boot process if signature + verification fails. If omitted, the platform chooses + a default, which is subject to change over time, + currently that default is false. + type: boolean + vTpmEnabled: + description: VTpmEnabled specifies whether vTPM should + be enabled on the virtual machine. When true it + enables the virtualized trusted platform module + measurements to create a known good boot integrity + policy baseline. The integrity policy baseline is + used for comparison with measurements from subsequent + VM boots to determine if anything has changed. This + is required to be set to Enabled if SecurityEncryptionType + is defined. If omitted, the platform chooses a default, + which is subject to change over time, currently + that default is false. + type: boolean + type: object type: object spotVMOptions: description: SpotVMOptions allows the ability to specify the diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremanagedclusters.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremanagedclusters.yaml index 1d0f4b3a746..dc426ec5803 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremanagedclusters.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremanagedclusters.yaml @@ -19,104 +19,6 @@ spec: singular: azuremanagedcluster scope: Namespaced versions: - - name: v1alpha3 - schema: - openAPIV3Schema: - description: AzureManagedCluster is the Schema for the azuremanagedclusters - 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' - 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' - type: string - metadata: - type: object - spec: - description: AzureManagedClusterSpec defines the desired state of AzureManagedCluster. - properties: - controlPlaneEndpoint: - description: ControlPlaneEndpoint represents the endpoint used to - communicate with the control plane. - properties: - host: - description: The hostname on which the API server is serving. - type: string - port: - description: The port on which the API server is serving. - format: int32 - type: integer - required: - - host - - port - type: object - type: object - status: - description: AzureManagedClusterStatus defines the observed state of AzureManagedCluster. - properties: - ready: - description: Ready is true when the provider resource is ready. - type: boolean - type: object - type: object - served: true - storage: false - subresources: - status: {} - - name: v1alpha4 - schema: - openAPIV3Schema: - description: AzureManagedCluster is the Schema for the azuremanagedclusters - 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' - 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' - type: string - metadata: - type: object - spec: - description: AzureManagedClusterSpec defines the desired state of AzureManagedCluster. - properties: - controlPlaneEndpoint: - description: ControlPlaneEndpoint represents the endpoint used to - communicate with the control plane. - properties: - host: - description: The hostname on which the API server is serving. - type: string - port: - description: The port on which the API server is serving. - format: int32 - type: integer - required: - - host - - port - type: object - type: object - status: - description: AzureManagedClusterStatus defines the observed state of AzureManagedCluster. - properties: - ready: - description: Ready is true when the provider resource is ready. - type: boolean - type: object - type: object - served: true - storage: false - subresources: - status: {} - name: v1beta1 schema: openAPIV3Schema: @@ -140,7 +42,8 @@ spec: properties: controlPlaneEndpoint: description: ControlPlaneEndpoint represents the endpoint used to - communicate with the control plane. + communicate with the control plane. Immutable, populated by the + AKS API at create. properties: host: description: The hostname on which the API server is serving. diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremanagedcontrolplanes.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremanagedcontrolplanes.yaml index 6da6f73490b..c26d17abbf9 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremanagedcontrolplanes.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremanagedcontrolplanes.yaml @@ -19,472 +19,6 @@ spec: singular: azuremanagedcontrolplane scope: Namespaced versions: - - name: v1alpha3 - schema: - openAPIV3Schema: - description: AzureManagedControlPlane is the Schema for the azuremanagedcontrolplanes - 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' - 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' - type: string - metadata: - type: object - spec: - description: AzureManagedControlPlaneSpec defines the desired state of - AzureManagedControlPlane. - properties: - aadProfile: - description: AadProfile is Azure Active Directory configuration to - integrate with AKS for aad authentication. - properties: - adminGroupObjectIDs: - description: AdminGroupObjectIDs - AAD group object IDs that will - have admin role of the cluster. - items: - type: string - type: array - managed: - description: Managed - Whether to enable managed AAD. - type: boolean - required: - - adminGroupObjectIDs - - managed - type: object - additionalTags: - additionalProperties: - type: string - description: AdditionalTags is an optional set of tags to add to Azure - resources managed by the Azure provider, in addition to the ones - added by default. - type: object - controlPlaneEndpoint: - description: ControlPlaneEndpoint represents the endpoint used to - communicate with the control plane. - properties: - host: - description: The hostname on which the API server is serving. - type: string - port: - description: The port on which the API server is serving. - format: int32 - type: integer - required: - - host - - port - type: object - dnsServiceIP: - description: DNSServiceIP is an IP address assigned to the Kubernetes - DNS service. It must be within the Kubernetes service address range - specified in serviceCidr. - type: string - loadBalancerSKU: - description: LoadBalancerSKU is the SKU of the loadBalancer to be - provisioned. - enum: - - Basic - - Standard - type: string - location: - description: 'Location is a string matching one of the canonical Azure - region names. Examples: "westus2", "eastus".' - type: string - networkPlugin: - description: NetworkPlugin used for building Kubernetes network. - enum: - - azure - - kubenet - type: string - networkPolicy: - description: NetworkPolicy used for building Kubernetes network. - enum: - - azure - - calico - type: string - nodeResourceGroupName: - description: NodeResourceGroupName is the name of the resource group - containing cluster IaaS resources. Will be populated to default - in webhook. - type: string - resourceGroupName: - description: ResourceGroupName is the name of the Azure resource group - for this AKS Cluster. - type: string - sshPublicKey: - description: SSHPublicKey is a string literal containing an ssh public - key base64 encoded. - type: string - subscriptionID: - description: SubscriotionID is the GUID of the Azure subscription - to hold this cluster. - type: string - version: - description: Version defines the desired Kubernetes version. - minLength: 2 - type: string - virtualNetwork: - description: VirtualNetwork describes the vnet for the AKS cluster. - Will be created if it does not exist. - properties: - cidrBlock: - type: string - name: - type: string - subnet: - description: ManagedControlPlaneSubnet describes a subnet for - an AKS cluster. - properties: - cidrBlock: - type: string - name: - type: string - required: - - cidrBlock - - name - type: object - required: - - cidrBlock - - name - type: object - required: - - location - - nodeResourceGroupName - - resourceGroupName - - sshPublicKey - - version - type: object - status: - description: AzureManagedControlPlaneStatus defines the observed state - of AzureManagedControlPlane. - properties: - initialized: - description: Initialized is true when the the control plane is available - for initial contact. This may occur before the control plane is - fully ready. In the AzureManagedControlPlane implementation, these - are identical. - type: boolean - ready: - description: Ready is true when the provider resource is ready. - type: boolean - type: object - type: object - served: true - storage: false - subresources: - status: {} - - name: v1alpha4 - schema: - openAPIV3Schema: - description: AzureManagedControlPlane is the Schema for the azuremanagedcontrolplanes - 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' - 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' - type: string - metadata: - type: object - spec: - description: AzureManagedControlPlaneSpec defines the desired state of - AzureManagedControlPlane. - properties: - aadProfile: - description: AadProfile is Azure Active Directory configuration to - integrate with AKS for aad authentication. - properties: - adminGroupObjectIDs: - description: AdminGroupObjectIDs - AAD group object IDs that will - have admin role of the cluster. - items: - type: string - type: array - managed: - description: Managed - Whether to enable managed AAD. - type: boolean - required: - - adminGroupObjectIDs - - managed - type: object - additionalTags: - additionalProperties: - type: string - description: AdditionalTags is an optional set of tags to add to Azure - resources managed by the Azure provider, in addition to the ones - added by default. - type: object - apiServerAccessProfile: - description: APIServerAccessProfile is the access profile for AKS - API server. - properties: - authorizedIPRanges: - description: AuthorizedIPRanges - Authorized IP Ranges to kubernetes - API server. - items: - type: string - type: array - enablePrivateCluster: - description: EnablePrivateCluster - Whether to create the cluster - as a private cluster or not. - type: boolean - enablePrivateClusterPublicFQDN: - description: EnablePrivateClusterPublicFQDN - Whether to create - additional public FQDN for private cluster or not. - type: boolean - privateDNSZone: - description: PrivateDNSZone - Private dns zone mode for private - cluster. - enum: - - System - - None - type: string - type: object - controlPlaneEndpoint: - description: ControlPlaneEndpoint represents the endpoint used to - communicate with the control plane. - properties: - host: - description: The hostname on which the API server is serving. - type: string - port: - description: The port on which the API server is serving. - format: int32 - type: integer - required: - - host - - port - type: object - dnsServiceIP: - description: DNSServiceIP is an IP address assigned to the Kubernetes - DNS service. It must be within the Kubernetes service address range - specified in serviceCidr. - type: string - identityRef: - description: IdentityRef is a reference to a AzureClusterIdentity - to be used when reconciling this cluster - 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.' - type: string - kind: - 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' - type: string - namespace: - 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' - type: string - uid: - 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 - loadBalancerProfile: - description: LoadBalancerProfile is the profile of the cluster load - balancer. - properties: - allocatedOutboundPorts: - description: AllocatedOutboundPorts - Desired number of allocated - SNAT ports per VM. Allowed values must be in the range of 0 - to 64000 (inclusive). The default value is 0 which results in - Azure dynamically allocating ports. - format: int32 - type: integer - idleTimeoutInMinutes: - description: IdleTimeoutInMinutes - Desired outbound flow idle - timeout in minutes. Allowed values must be in the range of 4 - to 120 (inclusive). The default value is 30 minutes. - format: int32 - type: integer - managedOutboundIPs: - description: ManagedOutboundIPs - Desired managed outbound IPs - for the cluster load balancer. - format: int32 - type: integer - outboundIPPrefixes: - description: OutboundIPPrefixes - Desired outbound IP Prefix resources - for the cluster load balancer. - items: - type: string - type: array - outboundIPs: - description: OutboundIPs - Desired outbound IP resources for the - cluster load balancer. - items: - type: string - type: array - type: object - loadBalancerSKU: - description: LoadBalancerSKU is the SKU of the loadBalancer to be - provisioned. - enum: - - Basic - - Standard - type: string - location: - description: 'Location is a string matching one of the canonical Azure - region names. Examples: "westus2", "eastus".' - type: string - networkPlugin: - description: NetworkPlugin used for building Kubernetes network. - enum: - - azure - - kubenet - type: string - networkPolicy: - description: NetworkPolicy used for building Kubernetes network. - enum: - - azure - - calico - type: string - nodeResourceGroupName: - description: NodeResourceGroupName is the name of the resource group - containing cluster IaaS resources. Will be populated to default - in webhook. - type: string - resourceGroupName: - description: ResourceGroupName is the name of the Azure resource group - for this AKS Cluster. - type: string - sku: - description: SKU is the AKSSku of the AKS to be provisioned. - properties: - tier: - description: Tier - Tier of a managed cluster SKU. - enum: - - Free - - Paid - type: string - required: - - tier - type: object - sshPublicKey: - description: SSHPublicKey is a string literal containing an ssh public - key base64 encoded. - type: string - subscriptionID: - description: SubscriptionID is the GUID of the Azure subscription - to hold this cluster. - type: string - version: - description: Version defines the desired Kubernetes version. - minLength: 2 - type: string - virtualNetwork: - description: VirtualNetwork describes the vnet for the AKS cluster. - Will be created if it does not exist. - properties: - cidrBlock: - type: string - name: - type: string - subnet: - description: ManagedControlPlaneSubnet describes a subnet for - an AKS cluster. - properties: - cidrBlock: - type: string - name: - type: string - required: - - cidrBlock - - name - type: object - required: - - cidrBlock - - name - type: object - required: - - location - - resourceGroupName - - sshPublicKey - - version - type: object - status: - description: AzureManagedControlPlaneStatus defines the observed state - of AzureManagedControlPlane. - properties: - initialized: - description: Initialized is true when the the control plane is available - for initial contact. This may occur before the control plane is - fully ready. In the AzureManagedControlPlane implementation, these - are identical. - type: boolean - longRunningOperationStates: - description: LongRunningOperationStates saves the states for Azure - long-running operations so they can be continued on the next reconciliation - loop. - items: - description: Future contains the data needed for an Azure long-running - operation to continue across reconcile loops. - properties: - data: - description: Data is the base64 url encoded json Azure AutoRest - Future. - type: string - name: - description: Name is the name of the Azure resource. Together - with the service name, this forms the unique identifier for - the future. - type: string - resourceGroup: - description: ResourceGroup is the Azure resource group for the - resource. - type: string - serviceName: - description: ServiceName is the name of the Azure service. Together - with the name of the resource, this forms the unique identifier - for the future. - type: string - type: - description: Type describes the type of future, such as update, - create, delete, etc. - type: string - required: - - name - - serviceName - - type - type: object - type: array - ready: - description: Ready is true when the provider resource is ready. - type: boolean - type: object - type: object - served: true - storage: false - subresources: - status: {} - name: v1beta1 schema: openAPIV3Schema: @@ -554,7 +88,7 @@ spec: type: array apiServerAccessProfile: description: APIServerAccessProfile is the access profile for AKS - API server. + API server. Immutable except for `authorizedIPRanges`. properties: authorizedIPRanges: description: AuthorizedIPRanges - Authorized IP Ranges to kubernetes @@ -683,9 +217,16 @@ spec: - "false" type: string type: object + azureEnvironment: + description: 'AzureEnvironment is the name of the AzureCloud to be + used. The default value that would be used by most users is "AzurePublicCloud", + other values are: - ChinaCloud: "AzureChinaCloud" - PublicCloud: + "AzurePublicCloud" - USGovernmentCloud: "AzureUSGovernmentCloud"' + type: string controlPlaneEndpoint: description: ControlPlaneEndpoint represents the endpoint used to - communicate with the control plane. + communicate with the control plane. Immutable, populated by the + AKS API at create. properties: host: description: The hostname on which the API server is serving. @@ -701,7 +242,7 @@ spec: dnsServiceIP: description: DNSServiceIP is an IP address assigned to the Kubernetes DNS service. It must be within the Kubernetes service address range - specified in serviceCidr. + specified in serviceCidr. Immutable. type: string identityRef: description: IdentityRef is a reference to a AzureClusterIdentity @@ -778,23 +319,25 @@ spec: type: object loadBalancerSKU: description: LoadBalancerSKU is the SKU of the loadBalancer to be - provisioned. + provisioned. Immutable. enum: - Basic - Standard type: string location: description: 'Location is a string matching one of the canonical Azure - region names. Examples: "westus2", "eastus".' + region names. Examples: "westus2", "eastus". Immutable.' type: string networkPlugin: - description: NetworkPlugin used for building Kubernetes network. + description: NetworkPlugin used for building Kubernetes network. Allowed + values are "azure", "kubenet". Immutable. enum: - azure - kubenet type: string networkPolicy: - description: NetworkPolicy used for building Kubernetes network. + description: NetworkPolicy used for building Kubernetes network. Allowed + values are "azure", "calico". Immutable. enum: - azure - calico @@ -802,10 +345,10 @@ spec: nodeResourceGroupName: description: NodeResourceGroupName is the name of the resource group containing cluster IaaS resources. Will be populated to default - in webhook. + in webhook. Immutable. type: string outboundType: - description: Outbound configuration used by Nodes. + description: Outbound configuration used by Nodes. Immutable. enum: - loadBalancer - managedNATGateway @@ -814,7 +357,7 @@ spec: type: string resourceGroupName: description: ResourceGroupName is the name of the Azure resource group - for this AKS Cluster. + for this AKS Cluster. Immutable. type: string sku: description: SKU is the SKU of the AKS to be provisioned. @@ -830,11 +373,11 @@ spec: type: object sshPublicKey: description: SSHPublicKey is a string literal containing an ssh public - key base64 encoded. + key base64 encoded. Immutable. type: string subscriptionID: description: SubscriptionID is the GUID of the Azure subscription - to hold this cluster. + to hold this cluster. Immutable. type: string version: description: Version defines the desired Kubernetes version. @@ -842,7 +385,7 @@ spec: type: string virtualNetwork: description: VirtualNetwork describes the vnet for the AKS cluster. - Will be created if it does not exist. + Will be created if it does not exist. Immutable except for `subnet`. properties: cidrBlock: type: string @@ -853,8 +396,7 @@ spec: for the VNet and Subnet. type: string subnet: - description: ManagedControlPlaneSubnet describes a subnet for - an AKS cluster. + description: Immutable except for `serviceEndpoints`. properties: cidrBlock: type: string diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremanagedmachinepools.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremanagedmachinepools.yaml index 04f9e824c48..cac7edf571c 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremanagedmachinepools.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremanagedmachinepools.yaml @@ -19,160 +19,6 @@ spec: singular: azuremanagedmachinepool scope: Namespaced versions: - - name: v1alpha3 - schema: - openAPIV3Schema: - description: AzureManagedMachinePool is the Schema for the azuremanagedmachinepools - 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' - 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' - type: string - metadata: - type: object - spec: - description: AzureManagedMachinePoolSpec defines the desired state of - AzureManagedMachinePool. - properties: - mode: - description: 'Mode - represents mode of an agent pool. Possible values - include: System, User.' - enum: - - System - - User - type: string - osDiskSizeGB: - description: OSDiskSizeGB is the disk size for every machine in this - agent pool. If you specify 0, it will apply the default osDisk size - according to the vmSize specified. - format: int32 - type: integer - providerIDList: - description: ProviderIDList is the unique identifier as specified - by the cloud provider. - items: - type: string - type: array - sku: - description: SKU is the size of the VMs in the node pool. - type: string - required: - - mode - - sku - type: object - status: - description: AzureManagedMachinePoolStatus defines the observed state - of AzureManagedMachinePool. - properties: - errorMessage: - description: Any transient errors that occur during the reconciliation - of Machines can be added as events to the Machine object and/or - logged in the controller's output. - type: string - errorReason: - description: Any transient errors that occur during the reconciliation - of Machines can be added as events to the Machine object and/or - logged in the controller's output. - type: string - ready: - description: Ready is true when the provider resource is ready. - type: boolean - replicas: - description: Replicas is the most recently observed number of replicas. - format: int32 - type: integer - type: object - type: object - served: true - storage: false - subresources: - status: {} - - name: v1alpha4 - schema: - openAPIV3Schema: - description: AzureManagedMachinePool is the Schema for the azuremanagedmachinepools - 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' - 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' - type: string - metadata: - type: object - spec: - description: AzureManagedMachinePoolSpec defines the desired state of - AzureManagedMachinePool. - properties: - mode: - description: 'Mode - represents mode of an agent pool. Possible values - include: System, User.' - enum: - - System - - User - type: string - name: - description: Name - name of the agent pool. If not specified, CAPZ - uses the name of the CR as the agent pool name. - type: string - osDiskSizeGB: - description: OSDiskSizeGB is the disk size for every machine in this - agent pool. If you specify 0, it will apply the default osDisk size - according to the vmSize specified. - format: int32 - type: integer - providerIDList: - description: ProviderIDList is the unique identifier as specified - by the cloud provider. - items: - type: string - type: array - sku: - description: SKU is the size of the VMs in the node pool. - type: string - required: - - mode - - sku - type: object - status: - description: AzureManagedMachinePoolStatus defines the observed state - of AzureManagedMachinePool. - properties: - errorMessage: - description: Any transient errors that occur during the reconciliation - of Machines can be added as events to the Machine object and/or - logged in the controller's output. - type: string - errorReason: - description: Any transient errors that occur during the reconciliation - of Machines can be added as events to the Machine object and/or - logged in the controller's output. - type: string - ready: - description: Ready is true when the provider resource is ready. - type: boolean - replicas: - description: Replicas is the most recently observed number of replicas. - format: int32 - type: integer - type: object - type: object - served: true - storage: false - subresources: - status: {} - additionalPrinterColumns: - jsonPath: .spec.mode name: Mode @@ -208,25 +54,27 @@ spec: type: object availabilityZones: description: AvailabilityZones - Availability zones for nodes. Must - use VirtualMachineScaleSets AgentPoolType. + use VirtualMachineScaleSets AgentPoolType. Immutable. items: type: string type: array enableNodePublicIP: description: EnableNodePublicIP controls whether or not nodes in the - pool each have a public IP address. + pool each have a public IP address. Immutable. type: boolean enableUltraSSD: description: EnableUltraSSD enables the storage type UltraSSD_LRS - for the agent pool. + for the agent pool. Immutable. type: boolean kubeletConfig: description: KubeletConfig specifies the kubelet configurations for - nodes. + nodes. Immutable. properties: allowedUnsafeSysctls: description: AllowedUnsafeSysctls - Allowlist of unsafe sysctls - or unsafe sysctl patterns (ending in `*`). + or unsafe sysctl patterns (ending in `*`). Valid values match + `kernel.shm*`, `kernel.msg*`, `kernel.sem`, `fs.mqueue.*`, or + `net.*`. items: type: string type: array @@ -238,8 +86,8 @@ spec: minimum: 2 type: integer containerLogMaxSizeMB: - description: ContainerLogMaxSizeMB - The maximum size (e.g. 10Mi) - of container log file before it is rotated. + description: ContainerLogMaxSizeMB - The maximum size in MB of + a container log file before it is rotated. format: int32 type: integer cpuCfsQuota: @@ -248,6 +96,7 @@ spec: type: boolean cpuCfsQuotaPeriod: description: CPUCfsQuotaPeriod - Sets CPU CFS quota period value. + Must end in "ms", e.g. "100ms" type: string cpuManagerPolicy: description: CPUManagerPolicy - CPU Manager policy to use. @@ -261,21 +110,23 @@ spec: type: boolean imageGcHighThreshold: description: ImageGcHighThreshold - The percent of disk usage - after which image garbage collection is always run. + after which image garbage collection is always run. Valid values + are 0-100 (inclusive). format: int32 maximum: 100 minimum: 0 type: integer imageGcLowThreshold: description: ImageGcLowThreshold - The percent of disk usage before - which image garbage collection is never run. + which image garbage collection is never run. Valid values are + 0-100 (inclusive) and must be less than `imageGcHighThreshold`. format: int32 maximum: 100 minimum: 0 type: integer podMaxPids: description: PodMaxPids - The maximum number of processes per - pod. + pod. Must not exceed kernel PID limit. -1 disables the limit. format: int32 minimum: -1 type: integer @@ -290,22 +141,23 @@ spec: type: string type: object kubeletDiskType: - description: 'KubeletDiskType specifies the kubelet disk type. Default - to OS. Possible values include: ''OS'', ''Temporary''. Requires - kubeletDisk preview feature to be set.' + description: "KubeletDiskType specifies the kubelet disk type. Default + to OS. Possible values include: 'OS', 'Temporary'. Requires Microsoft.ContainerService/KubeletDisk + preview feature to be set. Immutable. See also [AKS doc]. \n [AKS + doc]: https://learn.microsoft.com/rest/api/aks/agent-pools/create-or-update?tabs=HTTP#kubeletdisktype" enum: - OS - Temporary type: string linuxOSConfig: description: LinuxOSConfig specifies the custom Linux OS settings - and configurations. + and configurations. Immutable. properties: swapFileSizeMB: - description: 'SwapFileSizeMB specifies size in MB of a swap file + description: "SwapFileSizeMB specifies size in MB of a swap file will be created on the agent nodes from this node pool. Max value of SwapFileSizeMB should be the size of temporary disk(/dev/sdb). - Refer: https://learn.microsoft.com/en-us/azure/virtual-machines/managed-disks-overview#temporary-disk' + Must be at least 1. See also [AKS doc]. \n [AKS doc]: https://learn.microsoft.com/azure/virtual-machines/managed-disks-overview#temporary-disk" format: int32 minimum: 1 type: integer @@ -314,7 +166,8 @@ spec: properties: fsAioMaxNr: description: FsAioMaxNr specifies the maximum number of system-wide - asynchronous io requests. Maps to fs.aio-max-nr. + asynchronous io requests. Valid values are 65536-6553500 + (inclusive). Maps to fs.aio-max-nr. format: int32 maximum: 6553500 minimum: 65536 @@ -322,7 +175,8 @@ spec: fsFileMax: description: FsFileMax specifies the max number of file-handles that the Linux kernel will allocate, by increasing increases - the maximum number of open files permitted. Maps to fs.file-max. + the maximum number of open files permitted. Valid values + are 8192-12000500 (inclusive). Maps to fs.file-max. format: int32 maximum: 12000500 minimum: 8192 @@ -331,21 +185,24 @@ spec: description: FsInotifyMaxUserWatches specifies the number of file watches allowed by the system. Each watch is roughly 90 bytes on a 32-bit kernel, and roughly 160 bytes on a - 64-bit kernel. Maps to fs.inotify.max_user_watches. + 64-bit kernel. Valid values are 781250-2097152 (inclusive). + Maps to fs.inotify.max_user_watches. format: int32 maximum: 2097152 minimum: 781250 type: integer fsNrOpen: description: FsNrOpen specifies the maximum number of file-handles - a process can allocate. Maps to fs.nr_open. + a process can allocate. Valid values are 8192-20000500 (inclusive). + Maps to fs.nr_open. format: int32 maximum: 20000500 minimum: 8192 type: integer kernelThreadsMax: description: KernelThreadsMax specifies the maximum number - of all threads that can be created. Maps to kernel.threads-max. + of all threads that can be created. Valid values are 20-513785 + (inclusive). Maps to kernel.threads-max. format: int32 maximum: 513785 minimum: 20 @@ -353,8 +210,8 @@ spec: netCoreNetdevMaxBacklog: description: NetCoreNetdevMaxBacklog specifies maximum number of packets, queued on the INPUT side, when the interface - receives packets faster than kernel can process them. Maps - to net.core.netdev_max_backlog. + receives packets faster than kernel can process them. Valid + values are 1000-3240000 (inclusive). Maps to net.core.netdev_max_backlog. format: int32 maximum: 3240000 minimum: 1000 @@ -363,21 +220,24 @@ spec: description: NetCoreOptmemMax specifies the maximum ancillary buffer size (option memory buffer) allowed per socket. Socket option memory is used in a few cases to store extra structures - relating to usage of the socket. Maps to net.core.optmem_max. + relating to usage of the socket. Valid values are 20480-4194304 + (inclusive). Maps to net.core.optmem_max. format: int32 maximum: 4194304 minimum: 20480 type: integer netCoreRmemDefault: description: NetCoreRmemDefault specifies the default receive - socket buffer size in bytes. Maps to net.core.rmem_default. + socket buffer size in bytes. Valid values are 212992-134217728 + (inclusive). Maps to net.core.rmem_default. format: int32 maximum: 134217728 minimum: 212992 type: integer netCoreRmemMax: description: NetCoreRmemMax specifies the maximum receive - socket buffer size in bytes. Maps to net.core.rmem_max. + socket buffer size in bytes. Valid values are 212992-134217728 + (inclusive). Maps to net.core.rmem_max. format: int32 maximum: 134217728 minimum: 212992 @@ -388,21 +248,24 @@ spec: socket. An upper limit for the value of the backlog parameter passed to the listen(2)(https://man7.org/linux/man-pages/man2/listen.2.html) function. If the backlog argument is greater than the somaxconn, - then it's silently truncated to this limit. Maps to net.core.somaxconn. + then it's silently truncated to this limit. Valid values + are 4096-3240000 (inclusive). Maps to net.core.somaxconn. format: int32 maximum: 3240000 minimum: 4096 type: integer netCoreWmemDefault: description: NetCoreWmemDefault specifies the default send - socket buffer size in bytes. Maps to net.core.wmem_default. + socket buffer size in bytes. Valid values are 212992-134217728 + (inclusive). Maps to net.core.wmem_default. format: int32 maximum: 134217728 minimum: 212992 type: integer netCoreWmemMax: description: NetCoreWmemMax specifies the maximum send socket - buffer size in bytes. Maps to net.core.wmem_max. + buffer size in bytes. Valid values are 212992-134217728 + (inclusive). Maps to net.core.wmem_max. format: int32 maximum: 134217728 minimum: 212992 @@ -418,7 +281,8 @@ spec: description: NetIpv4NeighDefaultGcThresh1 specifies the minimum number of entries that may be in the ARP cache. Garbage collection won't be triggered if the number of entries is - below this setting. Maps to net.ipv4.neigh.default.gc_thresh1. + below this setting. Valid values are 128-80000 (inclusive). + Maps to net.ipv4.neigh.default.gc_thresh1. format: int32 maximum: 80000 minimum: 128 @@ -427,14 +291,16 @@ spec: description: NetIpv4NeighDefaultGcThresh2 specifies soft maximum number of entries that may be in the ARP cache. ARP garbage collection will be triggered about 5 seconds after reaching - this soft maximum. Maps to net.ipv4.neigh.default.gc_thresh2. + this soft maximum. Valid values are 512-90000 (inclusive). + Maps to net.ipv4.neigh.default.gc_thresh2. format: int32 maximum: 90000 minimum: 512 type: integer netIpv4NeighDefaultGcThresh3: description: NetIpv4NeighDefaultGcThresh3 specified hard maximum - number of entries in the ARP cache. Maps to net.ipv4.neigh.default.gc_thresh3. + number of entries in the ARP cache. Valid values are 1024-100000 + (inclusive). Maps to net.ipv4.neigh.default.gc_thresh3. format: int32 maximum: 100000 minimum: 1024 @@ -442,7 +308,8 @@ spec: netIpv4TCPFinTimeout: description: NetIpv4TCPFinTimeout specifies the length of time an orphaned connection will remain in the FIN_WAIT_2 - state before it's aborted at the local end. Maps to net.ipv4.tcp_fin_timeout. + state before it's aborted at the local end. Valid values + are 5-120 (inclusive). Maps to net.ipv4.tcp_fin_timeout. format: int32 maximum: 120 minimum: 5 @@ -450,7 +317,8 @@ spec: netIpv4TCPKeepaliveProbes: description: NetIpv4TCPKeepaliveProbes specifies the number of keepalive probes TCP sends out, until it decides the - connection is broken. Maps to net.ipv4.tcp_keepalive_probes. + connection is broken. Valid values are 1-15 (inclusive). + Maps to net.ipv4.tcp_keepalive_probes. format: int32 maximum: 15 minimum: 1 @@ -458,7 +326,8 @@ spec: netIpv4TCPKeepaliveTime: description: NetIpv4TCPKeepaliveTime specifies the rate at which TCP sends out a keepalive message when keepalive is - enabled. Maps to net.ipv4.tcp_keepalive_time. + enabled. Valid values are 30-432000 (inclusive). Maps to + net.ipv4.tcp_keepalive_time. format: int32 maximum: 432000 minimum: 30 @@ -468,7 +337,8 @@ spec: number of queued connection requests that have still not received an acknowledgment from the connecting client. If this number is exceeded, the kernel will begin dropping - requests. Maps to net.ipv4.tcp_max_syn_backlog. + requests. Valid values are 128-3240000 (inclusive). Maps + to net.ipv4.tcp_max_syn_backlog. format: int32 maximum: 3240000 minimum: 128 @@ -477,7 +347,8 @@ spec: description: NetIpv4TCPMaxTwBuckets specifies maximal number of timewait sockets held by system simultaneously. If this number is exceeded, time-wait socket is immediately destroyed - and warning is printed. Maps to net.ipv4.tcp_max_tw_buckets. + and warning is printed. Valid values are 8000-1440000 (inclusive). + Maps to net.ipv4.tcp_max_tw_buckets. format: int32 maximum: 1440000 minimum: 8000 @@ -491,7 +362,8 @@ spec: description: NetIpv4TCPkeepaliveIntvl specifies the frequency of the probes sent out. Multiplied by tcpKeepaliveprobes, it makes up the time to kill a connection that isn't responding, - after probes started. Maps to net.ipv4.tcp_keepalive_intvl. + after probes started. Valid values are 1-75 (inclusive). + Maps to net.ipv4.tcp_keepalive_intvl. format: int32 maximum: 75 minimum: 1 @@ -499,8 +371,8 @@ spec: netNetfilterNfConntrackBuckets: description: NetNetfilterNfConntrackBuckets specifies the size of hash table used by nf_conntrack module to record - the established connection record of the TCP protocol. Maps - to net.netfilter.nf_conntrack_buckets. + the established connection record of the TCP protocol. Valid + values are 65536-147456 (inclusive). Maps to net.netfilter.nf_conntrack_buckets. format: int32 maximum: 147456 minimum: 65536 @@ -508,7 +380,8 @@ spec: netNetfilterNfConntrackMax: description: NetNetfilterNfConntrackMax specifies the maximum number of connections supported by the nf_conntrack module - or the size of connection tracking table. Maps to net.netfilter.nf_conntrack_max. + or the size of connection tracking table. Valid values are + 131072-1048576 (inclusive). Maps to net.netfilter.nf_conntrack_max. format: int32 maximum: 1048576 minimum: 131072 @@ -516,6 +389,7 @@ spec: vmMaxMapCount: description: VMMaxMapCount specifies the maximum number of memory map areas a process may have. Maps to vm.max_map_count. + Valid values are 65530-262144 (inclusive). format: int32 maximum: 262144 minimum: 65530 @@ -524,7 +398,7 @@ spec: description: VMSwappiness specifies aggressiveness of the kernel in swapping memory pages. Higher values will increase aggressiveness, lower values decrease the amount of swap. - Maps to vm.swappiness. + Valid values are 0-100 (inclusive). Maps to vm.swappiness. format: int32 maximum: 100 minimum: 0 @@ -533,17 +407,18 @@ spec: description: VMVfsCachePressure specifies the percentage value that controls tendency of the kernel to reclaim the memory, which is used for caching of directory and inode objects. - Maps to vm.vfs_cache_pressure. + Valid values are 1-500 (inclusive). Maps to vm.vfs_cache_pressure. format: int32 maximum: 500 minimum: 1 type: integer type: object transparentHugePageDefrag: - description: TransparentHugePageDefrag specifies whether the kernel - should make aggressive use of memory compaction to make more - hugepages available. Refer to https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge - for more details. + description: "TransparentHugePageDefrag specifies whether the + kernel should make aggressive use of memory compaction to make + more hugepages available. See also [Linux doc]. \n [Linux doc]: + https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge + for more details." enum: - always - defer @@ -552,9 +427,10 @@ spec: - never type: string transparentHugePageEnabled: - description: TransparentHugePageEnabled specifies various modes - of Transparent Hugepages. Refer to https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge - for more details. + description: "TransparentHugePageEnabled specifies various modes + of Transparent Hugepages. See also [Linux doc]. \n [Linux doc]: + https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge + for more details." enum: - always - madvise @@ -562,8 +438,10 @@ spec: type: string type: object maxPods: - description: MaxPods specifies the kubelet --max-pods configuration - for the node pool. + description: "MaxPods specifies the kubelet `--max-pods` configuration + for the node pool. Immutable. See also [AKS doc], [K8s doc]. \n + [AKS doc]: https://learn.microsoft.com/azure/aks/configure-azure-cni#configure-maximum---new-clusters + [K8s doc]: https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/" format: int32 type: integer mode: @@ -575,35 +453,38 @@ spec: type: string name: description: Name - name of the agent pool. If not specified, CAPZ - uses the name of the CR as the agent pool name. + uses the name of the CR as the agent pool name. Immutable. type: string nodeLabels: additionalProperties: type: string - description: Node labels - labels for all of the nodes present in - node pool + description: "Node labels - labels for all of the nodes present in + node pool. See also [AKS doc]. \n [AKS doc]: https://learn.microsoft.com/azure/aks/use-labels" type: object nodePublicIPPrefixID: description: NodePublicIPPrefixID specifies the public IP prefix resource - ID which VM nodes should use IPs from. + ID which VM nodes should use IPs from. Immutable. type: string osDiskSizeGB: description: OSDiskSizeGB is the disk size for every machine in this agent pool. If you specify 0, it will apply the default osDisk size - according to the vmSize specified. + according to the vmSize specified. Immutable. format: int32 type: integer osDiskType: default: Managed - description: OsDiskType specifies the OS disk type for each node in - the pool. Allowed values are 'Ephemeral' and 'Managed'. + description: "OsDiskType specifies the OS disk type for each node + in the pool. Allowed values are 'Ephemeral' and 'Managed' (default). + Immutable. See also [AKS doc]. \n [AKS doc]: https://learn.microsoft.com/azure/aks/cluster-configuration#ephemeral-os" enum: - Ephemeral - Managed type: string osType: - description: 'OSType specifies the virtual machine operating system. - Default to Linux. Possible values include: ''Linux'', ''Windows''' + description: "OSType specifies the virtual machine operating system. + Default to Linux. Possible values include: 'Linux', 'Windows'. 'Windows' + requires the AzureManagedControlPlane's `spec.networkPlugin` to + be `azure`. Immutable. See also [AKS doc]. \n [AKS doc]: https://learn.microsoft.com/rest/api/aks/agent-pools/create-or-update?tabs=HTTP#ostype" enum: - Linux - Windows @@ -616,7 +497,8 @@ spec: type: array scaleSetPriority: description: 'ScaleSetPriority specifies the ScaleSetPriority value. - Default to Regular. Possible values include: ''Regular'', ''Spot''' + Default to Regular. Possible values include: ''Regular'', ''Spot'' + Immutable.' enum: - Regular - Spot @@ -626,18 +508,24 @@ spec: node pool. properties: maxSize: + description: MaxSize is the maximum number of nodes for auto-scaling. format: int32 type: integer minSize: + description: MinSize is the minimum number of nodes for auto-scaling. format: int32 type: integer type: object sku: - description: SKU is the size of the VMs in the node pool. + description: SKU is the size of the VMs in the node pool. Immutable. + type: string + subnetName: + description: SubnetName specifies the Subnet where the MachinePool + will be placed Immutable. type: string taints: - description: Taints specifies the taints for nodes present in this - agent pool. + description: "Taints specifies the taints for nodes present in this + agent pool. See also [AKS doc]. \n [AKS doc]: https://learn.microsoft.com/azure/aks/use-multiple-node-pools#setting-node-pool-taints" items: description: Taint represents a Kubernetes taint. properties: diff --git a/config/default/kustomization.yaml b/config/default/kustomization.yaml index e5e7199c267..dcabdd0cbf1 100644 --- a/config/default/kustomization.yaml +++ b/config/default/kustomization.yaml @@ -1,57 +1,2 @@ -namespace: capz-system - -namePrefix: capz- - -# Labels to add to all resources and selectors. -commonLabels: - cluster.x-k8s.io/provider: "infrastructure-azure" - resources: - - namespace.yaml - - credentials.yaml - - aad-pod-identity-deployment.yaml - -bases: - - ../crd - - ../rbac - - ../manager - - ../webhook - - ../certmanager - -patchesStrategicMerge: - - manager_image_patch.yaml - - manager_pull_policy.yaml - - manager_credentials_patch.yaml - - manager_webhook_patch.yaml - - webhookcainjection_patch.yaml - -vars: - - name: CERTIFICATE_NAMESPACE # namespace of the certificate CR - objref: - kind: Certificate - group: cert-manager.io - version: v1 - name: serving-cert # this name should match the one in certificate.yaml - fieldref: - fieldpath: metadata.namespace - - name: CERTIFICATE_NAME - objref: - kind: Certificate - group: cert-manager.io - version: v1 - name: serving-cert # this name should match the one in certificate.yaml - - name: SERVICE_NAMESPACE # namespace of the service - objref: - kind: Service - version: v1 - name: webhook-service - fieldref: - fieldpath: metadata.namespace - - name: SERVICE_NAME - objref: - kind: Service - version: v1 - name: webhook-service - -configurations: - - kustomizeconfig.yaml + - ../capz diff --git a/config/default/namespace.yaml b/config/default/namespace.yaml deleted file mode 100644 index 1ab3a72555d..00000000000 --- a/config/default/namespace.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: system diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index 98b04bd30b0..0375abd93a7 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -57,6 +57,17 @@ spec: valueFrom: fieldRef: fieldPath: metadata.namespace + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + runAsUser: 65532 + runAsGroup: 65532 + securityContext: + runAsNonRoot: true + seccompProfile: + type: RuntimeDefault terminationGracePeriodSeconds: 10 serviceAccountName: manager tolerations: diff --git a/config/webhook/manifests.yaml b/config/webhook/manifests.yaml index 5b81638d0c3..90a8fe4a8c8 100644 --- a/config/webhook/manifests.yaml +++ b/config/webhook/manifests.yaml @@ -290,6 +290,7 @@ webhooks: apiVersions: - v1beta1 operations: + - CREATE - UPDATE resources: - azuremanagedclusters @@ -332,6 +333,7 @@ webhooks: apiVersions: - v1beta1 operations: + - CREATE - UPDATE - DELETE resources: diff --git a/controllers/azurecluster_controller.go b/controllers/azurecluster_controller.go index 4f9fad9cada..876f25f9aa8 100644 --- a/controllers/azurecluster_controller.go +++ b/controllers/azurecluster_controller.go @@ -204,10 +204,11 @@ func (acr *AzureClusterReconciler) reconcileNormal(ctx context.Context, clusterS azureCluster := clusterScope.AzureCluster // If the AzureCluster doesn't have our finalizer, add it. - controllerutil.AddFinalizer(azureCluster, infrav1.ClusterFinalizer) - // Register the finalizer immediately to avoid orphaning Azure resources on delete - if err := clusterScope.PatchObject(ctx); err != nil { - return reconcile.Result{}, err + if controllerutil.AddFinalizer(azureCluster, infrav1.ClusterFinalizer) { + // Register the finalizer immediately to avoid orphaning Azure resources on delete + if err := clusterScope.PatchObject(ctx); err != nil { + return reconcile.Result{}, err + } } acs, err := acr.createAzureClusterService(clusterScope) diff --git a/controllers/azurecluster_reconciler.go b/controllers/azurecluster_reconciler.go index a4e3787978c..c78141730de 100644 --- a/controllers/azurecluster_reconciler.go +++ b/controllers/azurecluster_reconciler.go @@ -85,6 +85,7 @@ func (s *azureClusterService) Reconcile(ctx context.Context) error { return errors.Wrap(err, "failed to get availability zones") } + s.scope.AzureCluster.SetBackendPoolNameDefault() s.scope.SetDNSName() s.scope.SetControlPlaneSecurityRules() diff --git a/controllers/azureidentity_controller.go b/controllers/azureidentity_controller.go index d8af4c13b63..5132648ffed 100644 --- a/controllers/azureidentity_controller.go +++ b/controllers/azureidentity_controller.go @@ -154,7 +154,7 @@ func (r *AzureIdentityReconciler) Reconcile(ctx context.Context, req ctrl.Reques log = log.WithValues("azureidentitybinding", b.Name) binding := b - clusterName := binding.ObjectMeta.Labels[clusterv1.ClusterLabelName] + clusterName := binding.ObjectMeta.Labels[clusterv1.ClusterNameLabel] clusterNamespace := binding.ObjectMeta.Labels[infrav1.ClusterLabelNamespace] key := client.ObjectKey{Name: clusterName, Namespace: clusterNamespace} diff --git a/controllers/azurejson_machine_controller_test.go b/controllers/azurejson_machine_controller_test.go index 21b330b09cb..27754196f05 100644 --- a/controllers/azurejson_machine_controller_test.go +++ b/controllers/azurejson_machine_controller_test.go @@ -52,7 +52,7 @@ func TestUnclonedMachinesPredicate(t *testing.T) { "uncloned control plane node should return true": { expected: true, labels: map[string]string{ - clusterv1.MachineControlPlaneLabelName: "", + clusterv1.MachineControlPlaneLabel: "", }, annotations: nil, }, @@ -137,7 +137,7 @@ func TestAzureJSONMachineReconciler(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "my-machine", Labels: map[string]string{ - clusterv1.ClusterLabelName: "my-cluster", + clusterv1.ClusterNameLabel: "my-cluster", }, OwnerReferences: []metav1.OwnerReference{ { diff --git a/controllers/azurejson_machinepool_controller_test.go b/controllers/azurejson_machinepool_controller_test.go index 7993353e81c..59dcbd71479 100644 --- a/controllers/azurejson_machinepool_controller_test.go +++ b/controllers/azurejson_machinepool_controller_test.go @@ -87,7 +87,7 @@ func TestAzureJSONPoolReconciler(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "my-machine-pool", Labels: map[string]string{ - clusterv1.ClusterLabelName: "my-cluster", + clusterv1.ClusterNameLabel: "my-cluster", }, OwnerReferences: []metav1.OwnerReference{ { diff --git a/controllers/azuremachine_controller.go b/controllers/azuremachine_controller.go index ff881cc2dbc..a5a38577b5f 100644 --- a/controllers/azuremachine_controller.go +++ b/controllers/azuremachine_controller.go @@ -248,10 +248,11 @@ func (amr *AzureMachineReconciler) reconcileNormal(ctx context.Context, machineS } // If the AzureMachine doesn't have our finalizer, add it. - controllerutil.AddFinalizer(machineScope.AzureMachine, infrav1.MachineFinalizer) - // Register the finalizer immediately to avoid orphaning Azure resources on delete - if err := machineScope.PatchObject(ctx); err != nil { - return reconcile.Result{}, err + if controllerutil.AddFinalizer(machineScope.AzureMachine, infrav1.MachineFinalizer) { + // Register the finalizer immediately to avoid orphaning Azure resources on delete + if err := machineScope.PatchObject(ctx); err != nil { + return reconcile.Result{}, err + } } // Make sure the Cluster Infrastructure is ready. diff --git a/controllers/azuremachine_controller_test.go b/controllers/azuremachine_controller_test.go index 14761c7b990..fee8d4b83ba 100644 --- a/controllers/azuremachine_controller_test.go +++ b/controllers/azuremachine_controller_test.go @@ -19,47 +19,556 @@ package controllers import ( "context" "testing" + "time" "github.com/Azure/go-autorest/autorest" - . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/tools/record" + "k8s.io/utils/pointer" infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" + "sigs.k8s.io/cluster-api-provider-azure/azure" "sigs.k8s.io/cluster-api-provider-azure/azure/scope" - "sigs.k8s.io/cluster-api-provider-azure/internal/test" + "sigs.k8s.io/cluster-api-provider-azure/azure/services/resourceskus" "sigs.k8s.io/cluster-api-provider-azure/util/reconciler" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" + capierrors "sigs.k8s.io/cluster-api/errors" ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" + "sigs.k8s.io/controller-runtime/pkg/reconcile" ) -var _ = Describe("AzureMachineReconciler", func() { - BeforeEach(func() {}) - AfterEach(func() {}) - - Context("Reconcile an AzureMachine", func() { - It("should not error with minimal set up", func() { - reconciler := NewAzureMachineReconciler(testEnv, testEnv.GetEventRecorderFor("azuremachine-reconciler"), reconciler.DefaultLoopTimeout, "") - - By("Calling reconcile") - name := test.RandomName("foo", 10) - instance := &infrav1.AzureMachine{ObjectMeta: metav1.ObjectMeta{Name: name, Namespace: "default"}} - result, err := reconciler.Reconcile(context.Background(), ctrl.Request{ - NamespacedName: client.ObjectKey{ - Namespace: instance.Namespace, - Name: instance.Name, +type TestReconcileInput struct { + createAzureMachineService func(*scope.MachineScope) (*azureMachineService, error) + azureMachineOptions func(am *infrav1.AzureMachine) + expectedErr string + machineScopeFailureReason capierrors.MachineStatusError + ready bool + cache *scope.MachineCache + expectedResult reconcile.Result +} + +func TestAzureMachineReconcile(t *testing.T) { + g := NewWithT(t) + scheme, err := newScheme() + g.Expect(err).NotTo(HaveOccurred()) + + defaultCluster := getFakeCluster() + defaultAzureCluster := getFakeAzureCluster() + defaultAzureMachine := getFakeAzureMachine() + defaultMachine := getFakeMachine(defaultAzureMachine) + + cases := map[string]struct { + objects []runtime.Object + fail bool + err string + event string + }{ + "should reconcile normally": { + objects: []runtime.Object{ + defaultCluster, + defaultAzureCluster, + defaultAzureMachine, + defaultMachine, + }, + }, + "should not fail if the azure machine is not found": { + objects: []runtime.Object{ + defaultCluster, + defaultAzureCluster, + defaultMachine, + }, + }, + "should fail if machine is not found": { + objects: []runtime.Object{ + defaultCluster, + defaultAzureCluster, + defaultAzureMachine, + }, + fail: true, + err: "machines.cluster.x-k8s.io \"my-machine\" not found", + }, + "should return if azureMachine has not yet set ownerref": { + objects: []runtime.Object{ + defaultCluster, + defaultAzureCluster, + getFakeAzureMachine(func(am *infrav1.AzureMachine) { + am.OwnerReferences = nil + }), + defaultMachine, + }, + event: "Machine controller dependency not yet met", + }, + "should return if cluster does not exist": { + objects: []runtime.Object{ + defaultAzureCluster, + defaultAzureMachine, + defaultMachine, + }, + event: "Unable to get cluster from metadata", + }, + "should return if cluster is paused": { + objects: []runtime.Object{ + getFakeCluster(func(c *clusterv1.Cluster) { + c.Spec.Paused = true + }), + defaultAzureCluster, + defaultAzureMachine, + defaultMachine, + }, + }, + "should return if azureCluster does not yet available": { + objects: []runtime.Object{ + defaultCluster, + defaultAzureMachine, + defaultMachine, + }, + event: "AzureCluster unavailable", + }, + } + + for name, tc := range cases { + t.Run(name, func(t *testing.T) { + client := fake.NewClientBuilder().WithScheme(scheme).WithRuntimeObjects(tc.objects...).Build() + + reconciler := &AzureMachineReconciler{ + Client: client, + Recorder: record.NewFakeRecorder(128), + } + + _, err := reconciler.Reconcile(context.Background(), ctrl.Request{ + NamespacedName: types.NamespacedName{ + Namespace: "default", + Name: "my-machine", }, }) + if tc.event != "" { + g.Expect(reconciler.Recorder.(*record.FakeRecorder).Events).To(Receive(ContainSubstring(tc.event))) + } + if tc.fail { + g.Expect(err).To(MatchError(tc.err)) + } else { + g.Expect(err).NotTo(HaveOccurred()) + } + }) + } +} + +func TestAzureMachineReconcileNormal(t *testing.T) { + cases := map[string]TestReconcileInput{ + "should reconcile normally": { + createAzureMachineService: getFakeAzureMachineService, + cache: &scope.MachineCache{}, + ready: true, + }, + "should skip reconciliation if error state is detected on azure machine": { + azureMachineOptions: func(am *infrav1.AzureMachine) { + updateError := capierrors.UpdateMachineError + am.Status.FailureReason = &updateError + }, + createAzureMachineService: getFakeAzureMachineService, + }, + "should fail if failed to initialize machine cache": { + createAzureMachineService: getFakeAzureMachineService, + cache: nil, + expectedErr: "failed to init machine scope cache", + }, + "should fail if identities are not ready": { + azureMachineOptions: func(am *infrav1.AzureMachine) { + am.Status.Conditions = clusterv1.Conditions{ + { + Type: infrav1.VMIdentitiesReadyCondition, + Reason: infrav1.UserAssignedIdentityMissingReason, + Status: corev1.ConditionFalse, + }, + } + }, + createAzureMachineService: getFakeAzureMachineService, + cache: &scope.MachineCache{}, + expectedErr: "VM identities are not ready", + }, + "should fail if azure machine service creator fails": { + createAzureMachineService: func(*scope.MachineScope) (*azureMachineService, error) { + return nil, errors.New("failed to create azure machine service") + }, + cache: &scope.MachineCache{}, + expectedErr: "failed to create azure machine service", + }, + "should fail if VM is deleted": { + createAzureMachineService: getFakeAzureMachineServiceWithVMDeleted, + machineScopeFailureReason: capierrors.UpdateMachineError, + cache: &scope.MachineCache{}, + expectedErr: "failed to reconcile AzureMachine", + }, + "should reconcile if terminal error is received": { + createAzureMachineService: getFakeAzureMachineServiceWithTerminalError, + machineScopeFailureReason: capierrors.CreateMachineError, + cache: &scope.MachineCache{}, + }, + "should requeue if transient error is received": { + createAzureMachineService: getFakeAzureMachineServiceWithTransientError, + cache: &scope.MachineCache{}, + expectedResult: reconcile.Result{RequeueAfter: 10 * time.Second}, + }, + "should return error for general failures": { + createAzureMachineService: getFakeAzureMachineServiceWithGeneralError, + cache: &scope.MachineCache{}, + expectedErr: "failed to reconcile AzureMachine", + }, + } + + for name, c := range cases { + tc := c + t.Run(name, func(t *testing.T) { + g := NewWithT(t) + + reconciler, machineScope, clusterScope, err := getReconcileInputs(tc) + g.Expect(err).NotTo(HaveOccurred()) + + result, err := reconciler.reconcileNormal(context.Background(), machineScope, clusterScope) + g.Expect(result).To(Equal(tc.expectedResult)) - Expect(err).To(BeNil()) - Expect(result.RequeueAfter).To(BeZero()) + if tc.ready { + g.Expect(machineScope.AzureMachine.Status.Ready).To(BeTrue()) + } + if tc.machineScopeFailureReason != "" { + g.Expect(machineScope.AzureMachine.Status.FailureReason).ToNot(BeNil()) + g.Expect(*machineScope.AzureMachine.Status.FailureReason).To(Equal(tc.machineScopeFailureReason)) + } + if tc.expectedErr != "" { + g.Expect(err).To(HaveOccurred()) + g.Expect(err.Error()).To(ContainSubstring(tc.expectedErr)) + } else { + g.Expect(err).NotTo(HaveOccurred()) + } }) + } +} + +func TestAzureMachineReconcileDelete(t *testing.T) { + cases := map[string]TestReconcileInput{ + "should delete successfully": { + createAzureMachineService: getFakeAzureMachineService, + cache: &scope.MachineCache{}, + }, + "should fail if failed to create azure machine service": { + createAzureMachineService: getFakeAzureMachineServiceWithFailure, + cache: &scope.MachineCache{}, + expectedErr: "failed to create AzureMachineService", + }, + "should requeue if transient error is received": { + createAzureMachineService: getFakeAzureMachineServiceWithTransientError, + cache: &scope.MachineCache{}, + expectedResult: reconcile.Result{RequeueAfter: 10 * time.Second}, + }, + "should fail to delete for non-transient errors": { + createAzureMachineService: getFakeAzureMachineServiceWithGeneralError, + cache: &scope.MachineCache{}, + expectedErr: "error deleting AzureMachine", + }, + } + + for name, c := range cases { + tc := c + t.Run(name, func(t *testing.T) { + g := NewWithT(t) + + reconciler, machineScope, clusterScope, err := getReconcileInputs(tc) + g.Expect(err).NotTo(HaveOccurred()) + + result, err := reconciler.reconcileDelete(context.Background(), machineScope, clusterScope) + g.Expect(result).To(Equal(tc.expectedResult)) + + if tc.expectedErr != "" { + g.Expect(err).To(HaveOccurred()) + g.Expect(err.Error()).To(ContainSubstring(tc.expectedErr)) + } else { + g.Expect(err).NotTo(HaveOccurred()) + } + }) + } +} + +func getReconcileInputs(tc TestReconcileInput) (*AzureMachineReconciler, *scope.MachineScope, *scope.ClusterScope, error) { + scheme, err := newScheme() + if err != nil { + return nil, nil, nil, err + } + + var azureMachine *infrav1.AzureMachine + if tc.azureMachineOptions != nil { + azureMachine = getFakeAzureMachine(tc.azureMachineOptions) + } else { + azureMachine = getFakeAzureMachine() + } + + cluster := getFakeCluster() + azureCluster := getFakeAzureCluster(func(ac *infrav1.AzureCluster) { + ac.Spec.Location = "westus2" + }) + machine := getFakeMachine(azureMachine, func(m *clusterv1.Machine) { + m.Spec.Bootstrap = clusterv1.Bootstrap{ + DataSecretName: pointer.String("fooSecret"), + } + }) + + objects := []runtime.Object{ + cluster, + azureCluster, + machine, + azureMachine, + &corev1.Secret{ + ObjectMeta: metav1.ObjectMeta{ + Name: "fooSecret", + Namespace: "default", + }, + Data: map[string][]byte{ + "value": []byte("foo"), + }, + }, + } + + client := fake.NewClientBuilder().WithScheme(scheme).WithRuntimeObjects(objects...).Build() + + reconciler := &AzureMachineReconciler{ + Client: client, + Recorder: record.NewFakeRecorder(128), + createAzureMachineService: tc.createAzureMachineService, + } + + clusterScope, err := scope.NewClusterScope(context.Background(), scope.ClusterScopeParams{ + Client: client, + Cluster: cluster, + AzureCluster: azureCluster, + }) + if err != nil { + return nil, nil, nil, err + } + + machineScope, err := scope.NewMachineScope(scope.MachineScopeParams{ + Client: client, + Machine: machine, + AzureMachine: azureMachine, + ClusterScope: clusterScope, + Cache: tc.cache, }) -}) + if err != nil { + return nil, nil, nil, err + } + + return reconciler, machineScope, clusterScope, nil +} + +func getFakeAzureMachineService(machineScope *scope.MachineScope) (*azureMachineService, error) { + cache, err := resourceskus.GetCache(machineScope, machineScope.Location()) + if err != nil { + return nil, errors.Wrap(err, "failed creating a NewCache") + } + + return getDefaultAzureMachineService(machineScope, cache), nil +} + +func getFakeAzureMachineServiceWithFailure(_ *scope.MachineScope) (*azureMachineService, error) { + return nil, errors.New("failed to create AzureMachineService") +} + +func getFakeAzureMachineServiceWithVMDeleted(machineScope *scope.MachineScope) (*azureMachineService, error) { + cache, err := resourceskus.GetCache(machineScope, machineScope.Location()) + if err != nil { + return nil, errors.Wrap(err, "failed creating a NewCache") + } + + ams := getDefaultAzureMachineService(machineScope, cache) + ams.Reconcile = func(context.Context) error { + return azure.VMDeletedError{} + } + + return ams, nil +} + +func getFakeAzureMachineServiceWithTerminalError(machineScope *scope.MachineScope) (*azureMachineService, error) { + cache, err := resourceskus.GetCache(machineScope, machineScope.Location()) + if err != nil { + return nil, errors.Wrap(err, "failed creating a NewCache") + } + + ams := getDefaultAzureMachineService(machineScope, cache) + ams.Reconcile = func(context.Context) error { + return azure.WithTerminalError(errors.New("failed to reconcile AzureMachine")) + } + + return ams, nil +} + +func getFakeAzureMachineServiceWithTransientError(machineScope *scope.MachineScope) (*azureMachineService, error) { + cache, err := resourceskus.GetCache(machineScope, machineScope.Location()) + if err != nil { + return nil, errors.Wrap(err, "failed creating a NewCache") + } + + ams := getDefaultAzureMachineService(machineScope, cache) + ams.Reconcile = func(context.Context) error { + return azure.WithTransientError(errors.New("failed to reconcile AzureMachine"), 10*time.Second) + } + ams.Delete = func(context.Context) error { + return azure.WithTransientError(errors.New("failed to reconcile AzureMachine"), 10*time.Second) + } + + return ams, nil +} + +func getFakeAzureMachineServiceWithGeneralError(machineScope *scope.MachineScope) (*azureMachineService, error) { + cache, err := resourceskus.GetCache(machineScope, machineScope.Location()) + if err != nil { + return nil, errors.Wrap(err, "failed creating a NewCache") + } + + ams := getDefaultAzureMachineService(machineScope, cache) + ams.Reconcile = func(context.Context) error { + return errors.New("foo error") + } + ams.Delete = func(context.Context) error { + return errors.New("foo error") + } + + return ams, nil +} + +func getDefaultAzureMachineService(machineScope *scope.MachineScope, cache *resourceskus.Cache) *azureMachineService { + return &azureMachineService{ + scope: machineScope, + services: []azure.ServiceReconciler{}, + skuCache: cache, + Reconcile: func(context.Context) error { + return nil + }, + Delete: func(context.Context) error { + return nil + }, + } +} + +func getFakeCluster(changes ...func(*clusterv1.Cluster)) *clusterv1.Cluster { + input := &clusterv1.Cluster{ + ObjectMeta: metav1.ObjectMeta{ + Name: "my-cluster", + Namespace: "default", + }, + Spec: clusterv1.ClusterSpec{ + InfrastructureRef: &corev1.ObjectReference{ + APIVersion: "infrastructure.cluster.x-k8s.io/v1beta1", + Kind: "AzureCluster", + Name: "my-azure-cluster", + }, + }, + Status: clusterv1.ClusterStatus{ + InfrastructureReady: true, + }, + } + + for _, change := range changes { + change(input) + } + + return input +} + +func getFakeAzureCluster(changes ...func(*infrav1.AzureCluster)) *infrav1.AzureCluster { + input := &infrav1.AzureCluster{ + ObjectMeta: metav1.ObjectMeta{ + Name: "my-azure-cluster", + Namespace: "default", + OwnerReferences: []metav1.OwnerReference{ + { + APIVersion: "cluster.x-k8s.io/v1beta1", + Kind: "Cluster", + Name: "my-cluster", + }, + }, + }, + Spec: infrav1.AzureClusterSpec{ + AzureClusterClassSpec: infrav1.AzureClusterClassSpec{ + SubscriptionID: "123", + }, + NetworkSpec: infrav1.NetworkSpec{ + Subnets: infrav1.Subnets{ + { + SubnetClassSpec: infrav1.SubnetClassSpec{ + Name: "node", + Role: infrav1.SubnetNode, + }, + }, + }, + }, + }, + } + for _, change := range changes { + change(input) + } + + return input +} + +func getFakeAzureMachine(changes ...func(*infrav1.AzureMachine)) *infrav1.AzureMachine { + input := &infrav1.AzureMachine{ + ObjectMeta: metav1.ObjectMeta{ + Name: "my-machine", + Namespace: "default", + Labels: map[string]string{ + clusterv1.ClusterNameLabel: "my-cluster", + }, + OwnerReferences: []metav1.OwnerReference{ + { + APIVersion: "cluster.x-k8s.io/v1beta1", + Kind: "Machine", + Name: "my-machine", + }, + }, + }, + Spec: infrav1.AzureMachineSpec{ + VMSize: "Standard_D2s_v3", + }, + } + for _, change := range changes { + change(input) + } + + return input +} + +func getFakeMachine(azureMachine *infrav1.AzureMachine, changes ...func(*clusterv1.Machine)) *clusterv1.Machine { + input := &clusterv1.Machine{ + ObjectMeta: metav1.ObjectMeta{ + Name: "my-machine", + Namespace: "default", + Labels: map[string]string{ + clusterv1.ClusterNameLabel: "my-cluster", + }, + }, + TypeMeta: metav1.TypeMeta{ + APIVersion: "cluster.x-k8s.io/v1beta1", + Kind: "Machine", + }, + Spec: clusterv1.MachineSpec{ + InfrastructureRef: corev1.ObjectReference{ + APIVersion: "infrastructure.cluster.x-k8s.io/v1beta1", + Kind: "AzureMachine", + Name: azureMachine.Name, + Namespace: azureMachine.Namespace, + }, + Version: pointer.String("v1.22.0"), + }, + } + for _, change := range changes { + change(input) + } + + return input +} func TestConditions(t *testing.T) { g := NewWithT(t) @@ -80,7 +589,7 @@ func TestConditions(t *testing.T) { machine: &clusterv1.Machine{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ - clusterv1.ClusterLabelName: "my-cluster", + clusterv1.ClusterNameLabel: "my-cluster", }, Name: "my-machine", }, @@ -112,7 +621,7 @@ func TestConditions(t *testing.T) { machine: &clusterv1.Machine{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ - clusterv1.ClusterLabelName: "my-cluster", + clusterv1.ClusterNameLabel: "my-cluster", }, Name: "my-machine", }, diff --git a/controllers/azuremachine_reconciler.go b/controllers/azuremachine_reconciler.go index 5eb0ef60bb9..5fef6972e45 100644 --- a/controllers/azuremachine_reconciler.go +++ b/controllers/azuremachine_reconciler.go @@ -40,8 +40,10 @@ type azureMachineService struct { scope *scope.MachineScope // services is the list of services to be reconciled. // The order of the services is important as it determines the order in which the services are reconciled. - services []azure.ServiceReconciler - skuCache *resourceskus.Cache + services []azure.ServiceReconciler + skuCache *resourceskus.Cache + Reconcile func(context.Context) error + Delete func(context.Context) error } // newAzureMachineService populates all the services based on input scope. @@ -50,8 +52,7 @@ func newAzureMachineService(machineScope *scope.MachineScope) (*azureMachineServ if err != nil { return nil, errors.Wrap(err, "failed creating a NewCache") } - - return &azureMachineService{ + ams := &azureMachineService{ scope: machineScope, services: []azure.ServiceReconciler{ publicips.New(machineScope), @@ -65,11 +66,15 @@ func newAzureMachineService(machineScope *scope.MachineScope) (*azureMachineServ tags.New(machineScope), }, skuCache: cache, - }, nil + } + ams.Reconcile = ams.reconcile + ams.Delete = ams.delete + + return ams, nil } -// Reconcile reconciles all the services in a predetermined order. -func (s *azureMachineService) Reconcile(ctx context.Context) error { +// reconcile reconciles all the services in a predetermined order. +func (s *azureMachineService) reconcile(ctx context.Context) error { ctx, _, done := tele.StartSpanWithLogger(ctx, "controllers.azureMachineService.Reconcile") defer done() @@ -89,8 +94,8 @@ func (s *azureMachineService) Reconcile(ctx context.Context) error { return nil } -// Delete deletes all the services in a predetermined order. -func (s *azureMachineService) Delete(ctx context.Context) error { +// delete deletes all the services in a predetermined order. +func (s *azureMachineService) delete(ctx context.Context) error { ctx, _, done := tele.StartSpanWithLogger(ctx, "controllers.azureMachineService.Delete") defer done() diff --git a/controllers/azuremachine_reconciler_test.go b/controllers/azuremachine_reconciler_test.go index fab0d76e5be..1779c576b53 100644 --- a/controllers/azuremachine_reconciler_test.go +++ b/controllers/azuremachine_reconciler_test.go @@ -93,7 +93,7 @@ func TestAzureMachineServiceReconcile(t *testing.T) { skuCache: resourceskus.NewStaticCache([]compute.ResourceSku{}, ""), } - err := s.Reconcile(context.TODO()) + err := s.reconcile(context.TODO()) if tc.expectedError != "" { g.Expect(err).To(HaveOccurred()) g.Expect(err).To(MatchError(tc.expectedError)) @@ -160,7 +160,7 @@ func TestAzureMachineServiceDelete(t *testing.T) { skuCache: resourceskus.NewStaticCache([]compute.ResourceSku{}, ""), } - err := s.Delete(context.TODO()) + err := s.delete(context.TODO()) if tc.expectedError != "" { g.Expect(err).To(HaveOccurred()) g.Expect(err).To(MatchError(tc.expectedError)) diff --git a/controllers/azuremanagedcluster_controller.go b/controllers/azuremanagedcluster_controller.go index 7f70ca0d13d..4411beeb779 100644 --- a/controllers/azuremanagedcluster_controller.go +++ b/controllers/azuremanagedcluster_controller.go @@ -161,14 +161,7 @@ func (amcr *AzureManagedClusterReconciler) Reconcile(ctx context.Context, req ct // Infrastructure must be ready before control plane. We should also enqueue // requests from control plane to infra cluster to keep control plane endpoint accurate. aksCluster.Status.Ready = true - // We only expect to set the apiserver endpoint values once; - // if we attempted to update existing ControlPlaneEndpoint values, they would be rejected via webhook enforcement. - if aksCluster.Spec.ControlPlaneEndpoint.Host == "" { - aksCluster.Spec.ControlPlaneEndpoint.Host = controlPlane.Spec.ControlPlaneEndpoint.Host - } - if aksCluster.Spec.ControlPlaneEndpoint.Port == 0 { - aksCluster.Spec.ControlPlaneEndpoint.Port = controlPlane.Spec.ControlPlaneEndpoint.Port - } + aksCluster.Spec.ControlPlaneEndpoint = controlPlane.Spec.ControlPlaneEndpoint if err := patchhelper.Patch(ctx, aksCluster); err != nil { return reconcile.Result{}, err diff --git a/controllers/azuremanagedcontrolplane_controller.go b/controllers/azuremanagedcontrolplane_controller.go index 56984c7024b..74bf627ec53 100644 --- a/controllers/azuremanagedcontrolplane_controller.go +++ b/controllers/azuremanagedcontrolplane_controller.go @@ -155,7 +155,7 @@ func (amcpr *AzureManagedControlPlaneReconciler) Reconcile(ctx context.Context, // Fetch all the ManagedMachinePools owned by this Cluster. opt1 := client.InNamespace(azureControlPlane.Namespace) opt2 := client.MatchingLabels(map[string]string{ - clusterv1.ClusterLabelName: cluster.Name, + clusterv1.ClusterNameLabel: cluster.Name, }) ammpList := &infrav1.AzureManagedMachinePoolList{} @@ -223,14 +223,14 @@ func (amcpr *AzureManagedControlPlaneReconciler) reconcileNormal(ctx context.Con log.Info("Reconciling AzureManagedControlPlane") - // Remove deprecated Cluster finalizer if it exists. - controllerutil.RemoveFinalizer(scope.ControlPlane, infrav1.ClusterFinalizer) - // If the AzureManagedControlPlane doesn't have our finalizer, add it. - controllerutil.AddFinalizer(scope.ControlPlane, infrav1.ManagedClusterFinalizer) - // Register the finalizer immediately to avoid orphaning Azure resources on delete - if err := scope.PatchObject(ctx); err != nil { - amcpr.Recorder.Eventf(scope.ControlPlane, corev1.EventTypeWarning, "AzureManagedControlPlane unavailable", "failed to patch resource: %s", err) - return reconcile.Result{}, err + // Remove deprecated Cluster finalizer if it exists, if the AzureManagedControlPlane doesn't have our finalizer, add it. + if controllerutil.RemoveFinalizer(scope.ControlPlane, infrav1.ClusterFinalizer) || + controllerutil.AddFinalizer(scope.ControlPlane, infrav1.ManagedClusterFinalizer) { + // Register the finalizer immediately to avoid orphaning Azure resources on delete + if err := scope.PatchObject(ctx); err != nil { + amcpr.Recorder.Eventf(scope.ControlPlane, corev1.EventTypeWarning, "AzureManagedControlPlane unavailable", "failed to patch resource: %s", err) + return reconcile.Result{}, err + } } if err := newAzureManagedControlPlaneReconciler(scope).Reconcile(ctx); err != nil { @@ -270,6 +270,16 @@ func (amcpr *AzureManagedControlPlaneReconciler) reconcileDelete(ctx context.Con log.Info("Reconciling AzureManagedControlPlane delete") if err := newAzureManagedControlPlaneReconciler(scope).Delete(ctx); err != nil { + // Handle transient errors + var reconcileError azure.ReconcileError + if errors.As(err, &reconcileError) && reconcileError.IsTransient() { + if azure.IsOperationNotDoneError(reconcileError) { + log.V(2).Info(fmt.Sprintf("AzureManagedControlPlane delete not done: %s", reconcileError.Error())) + } else { + log.V(2).Info("transient failure to delete AzureManagedControlPlane, retrying") + } + return reconcile.Result{RequeueAfter: reconcileError.RequeueAfter()}, nil + } return reconcile.Result{}, errors.Wrapf(err, "error deleting AzureManagedControlPlane %s/%s", scope.ControlPlane.Namespace, scope.ControlPlane.Name) } diff --git a/controllers/azuremanagedmachinepool_controller.go b/controllers/azuremanagedmachinepool_controller.go index e21d7e16b47..e3d11155290 100644 --- a/controllers/azuremanagedmachinepool_controller.go +++ b/controllers/azuremanagedmachinepool_controller.go @@ -244,10 +244,11 @@ func (ammpr *AzureManagedMachinePoolReconciler) reconcileNormal(ctx context.Cont log.Info("Reconciling AzureManagedMachinePool") // If the AzureManagedMachinePool doesn't have our finalizer, add it. - controllerutil.AddFinalizer(scope.InfraMachinePool, infrav1.ClusterFinalizer) - // Register the finalizer immediately to avoid orphaning Azure resources on delete - if err := scope.PatchObject(ctx); err != nil { - return reconcile.Result{}, err + if controllerutil.AddFinalizer(scope.InfraMachinePool, infrav1.ClusterFinalizer) { + // Register the finalizer immediately to avoid orphaning Azure resources on delete + if err := scope.PatchObject(ctx); err != nil { + return reconcile.Result{}, err + } } svc, err := ammpr.createAzureManagedMachinePoolService(scope) diff --git a/controllers/azuremanagedmachinepool_controller_test.go b/controllers/azuremanagedmachinepool_controller_test.go index 025cb96924b..629b6b923d1 100644 --- a/controllers/azuremanagedmachinepool_controller_test.go +++ b/controllers/azuremanagedmachinepool_controller_test.go @@ -65,6 +65,7 @@ func TestAzureManagedMachinePoolReconcile(t *testing.T) { fakeVirtualMachineScaleSetVM := fakeVirtualMachineScaleSetVM() reconciler.Reconcile(gomock2.AContext()).Return(nil) + agentpools.SetSubnetName() agentpools.AgentPoolSpec().Return(&fakeAgentPoolSpec) agentpools.NodeResourceGroup().Return("fake-rg") agentpools.SetAgentPoolProviderIDList(providerIDs) diff --git a/controllers/azuremanagedmachinepool_reconciler.go b/controllers/azuremanagedmachinepool_reconciler.go index dd928ea8368..3b670fd43b5 100644 --- a/controllers/azuremanagedmachinepool_reconciler.go +++ b/controllers/azuremanagedmachinepool_reconciler.go @@ -74,27 +74,35 @@ func (a *AgentPoolVMSSNotFoundError) Is(target error) bool { // newAzureManagedMachinePoolService populates all the services based on input scope. func newAzureManagedMachinePoolService(scope *scope.ManagedMachinePoolScope) (*azureManagedMachinePoolService, error) { - var authorizer azure.Authorizer = scope - if scope.Location() != "" { - regionalAuthorizer, err := azure.WithRegionalBaseURI(scope, scope.Location()) - if err != nil { - return nil, errors.Wrap(err, "failed to create a regional authorizer") - } - authorizer = regionalAuthorizer + scaleSetAuthorizer, err := scaleSetAuthorizer(scope) + if err != nil { + return nil, err } return &azureManagedMachinePoolService{ scope: scope, agentPoolsSvc: agentpools.New(scope), - scaleSetsSvc: scalesets.NewClient(authorizer), + scaleSetsSvc: scalesets.NewClient(scaleSetAuthorizer), }, nil } +// scaleSetAuthorizer takes a scope and determines if a regional authorizer is needed for scale sets +// see https://github.com/kubernetes-sigs/cluster-api-provider-azure/pull/1850 for context on region based authorizer. +func scaleSetAuthorizer(scope *scope.ManagedMachinePoolScope) (azure.Authorizer, error) { + if scope.ControlPlane.Spec.AzureEnvironment == azure.PublicCloudName { + return azure.WithRegionalBaseURI(scope, scope.Location()) // public cloud supports regional end points + } + + return scope, nil +} + // Reconcile reconciles all the services in a predetermined order. func (s *azureManagedMachinePoolService) Reconcile(ctx context.Context) error { ctx, log, done := tele.StartSpanWithLogger(ctx, "controllers.azureManagedMachinePoolService.Reconcile") defer done() + s.scope.SetSubnetName() + log.Info("reconciling managed machine pool") agentPoolName := s.scope.AgentPoolSpec().ResourceName() diff --git a/controllers/helpers.go b/controllers/helpers.go index 5c92dc47ea9..7b4bd3a49e8 100644 --- a/controllers/helpers.go +++ b/controllers/helpers.go @@ -110,7 +110,7 @@ func AzureClusterToAzureMachinesMapper(ctx context.Context, c client.Client, obj machineList := &clusterv1.MachineList{} machineList.SetGroupVersionKind(gvk) // list all of the requested objects within the cluster namespace with the cluster name label - if err := c.List(ctx, machineList, client.InNamespace(azCluster.Namespace), client.MatchingLabels{clusterv1.ClusterLabelName: clusterName}); err != nil { + if err := c.List(ctx, machineList, client.InNamespace(azCluster.Namespace), client.MatchingLabels{clusterv1.ClusterNameLabel: clusterName}); err != nil { return nil } @@ -146,7 +146,7 @@ func GetOwnerClusterName(obj metav1.ObjectMeta) (string, bool) { // GetObjectsToRequestsByNamespaceAndClusterName returns the slice of ctrl.Requests consisting the list items contained in the unstructured list. func GetObjectsToRequestsByNamespaceAndClusterName(ctx context.Context, c client.Client, clusterKey client.ObjectKey, list *unstructured.UnstructuredList) []ctrl.Request { // list all of the requested objects within the cluster namespace with the cluster name label - if err := c.List(ctx, list, client.InNamespace(clusterKey.Namespace), client.MatchingLabels{clusterv1.ClusterLabelName: clusterKey.Name}); err != nil { + if err := c.List(ctx, list, client.InNamespace(clusterKey.Namespace), client.MatchingLabels{clusterv1.ClusterNameLabel: clusterKey.Name}); err != nil { return nil } @@ -404,7 +404,7 @@ func toCloudProviderRateLimitConfig(source infrav1.RateLimitConfig) *RateLimitCo } // CloudProviderRateLimitConfig represents the rate limiting configurations in azure cloud provider config. -// See: https://kubernetes-sigs.github.io/cloud-provider-azure/install/configs/#per-client-rate-limiting. +// See: https://cloud-provider-azure.sigs.k8s.io/install/configs/#per-client-rate-limiting. // This is a copy of the struct used in cloud-provider-azure: https://github.com/kubernetes-sigs/cloud-provider-azure/blob/d585c2031925b39c925624302f22f8856e29e352/pkg/provider/azure_ratelimit.go#L25 type CloudProviderRateLimitConfig struct { RateLimitConfig @@ -649,20 +649,24 @@ func EnsureClusterIdentity(ctx context.Context, c client.Client, object conditio if err != nil { return err } + if !scope.IsClusterNamespaceAllowed(ctx, c, identity.Spec.AllowedNamespaces, namespace) { conditions.MarkFalse(object, infrav1.NetworkInfrastructureReadyCondition, infrav1.NamespaceNotAllowedByIdentity, clusterv1.ConditionSeverityError, "") return errors.New("AzureClusterIdentity list of allowed namespaces doesn't include current cluster namespace") } - identityHelper, err := patch.NewHelper(identity, c) - if err != nil { - return errors.Wrap(err, "failed to init patch helper") + + // Remove deprecated finalizer if it exists, Register the finalizer immediately to avoid orphaning Azure resources on delete. + if controllerutil.RemoveFinalizer(identity, deprecatedClusterIdentityFinalizer(finalizerPrefix, namespace, name)) || + controllerutil.AddFinalizer(identity, clusterIdentityFinalizer(finalizerPrefix, namespace, name)) { + // finalizers are added/removed then patch the object + identityHelper, err := patch.NewHelper(identity, c) + if err != nil { + return errors.Wrap(err, "failed to init patch helper") + } + return identityHelper.Patch(ctx, identity) } - // Remove deprecated finalizer if it exists. - controllerutil.RemoveFinalizer(identity, deprecatedClusterIdentityFinalizer(finalizerPrefix, namespace, name)) - // If the AzureClusterIdentity doesn't have our finalizer, add it. - controllerutil.AddFinalizer(identity, clusterIdentityFinalizer(finalizerPrefix, namespace, name)) - // Register the finalizer immediately to avoid orphaning Azure resources on delete. - return identityHelper.Patch(ctx, identity) + + return nil } // RemoveClusterIdentityFinalizer removes the finalizer on an AzureClusterIdentity. @@ -752,7 +756,7 @@ func AzureManagedClusterToAzureManagedMachinePoolsMapper(ctx context.Context, c machineList := &expv1.MachinePoolList{} machineList.SetGroupVersionKind(gvk) // list all of the requested objects within the cluster namespace with the cluster name label - if err := c.List(ctx, machineList, client.InNamespace(azCluster.Namespace), client.MatchingLabels{clusterv1.ClusterLabelName: clusterName}); err != nil { + if err := c.List(ctx, machineList, client.InNamespace(azCluster.Namespace), client.MatchingLabels{clusterv1.ClusterNameLabel: clusterName}); err != nil { return nil } @@ -805,7 +809,7 @@ func AzureManagedControlPlaneToAzureManagedMachinePoolsMapper(ctx context.Contex machineList := &expv1.MachinePoolList{} machineList.SetGroupVersionKind(gvk) // list all of the requested objects within the cluster namespace with the cluster name label - if err := c.List(ctx, machineList, client.InNamespace(azControlPlane.Namespace), client.MatchingLabels{clusterv1.ClusterLabelName: clusterName}); err != nil { + if err := c.List(ctx, machineList, client.InNamespace(azControlPlane.Namespace), client.MatchingLabels{clusterv1.ClusterNameLabel: clusterName}); err != nil { return nil } diff --git a/controllers/helpers_test.go b/controllers/helpers_test.go index 2ee209bf1e7..cc0d2ea34b4 100644 --- a/controllers/helpers_test.go +++ b/controllers/helpers_test.go @@ -350,7 +350,7 @@ func newMachine(clusterName, machineName string) *clusterv1.Machine { return &clusterv1.Machine{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ - clusterv1.ClusterLabelName: clusterName, + clusterv1.ClusterNameLabel: clusterName, }, Name: machineName, Namespace: "default", @@ -484,7 +484,7 @@ const ( "subnetName": "foo-node-subnet", "routeTableName": "foo-node-routetable", "loadBalancerSku": "Standard", - "loadBalancerName": "foo", + "loadBalancerName": "", "maximumLoadBalancerRuleCount": 250, "useManagedIdentityExtension": false, "useInstanceMetadata": true @@ -506,7 +506,7 @@ const ( "subnetName": "foo-node-subnet", "routeTableName": "foo-node-routetable", "loadBalancerSku": "Standard", - "loadBalancerName": "foo", + "loadBalancerName": "", "maximumLoadBalancerRuleCount": 250, "useManagedIdentityExtension": false, "useInstanceMetadata": true @@ -526,7 +526,7 @@ const ( "subnetName": "foo-node-subnet", "routeTableName": "foo-node-routetable", "loadBalancerSku": "Standard", - "loadBalancerName": "foo", + "loadBalancerName": "", "maximumLoadBalancerRuleCount": 250, "useManagedIdentityExtension": true, "useInstanceMetadata": true @@ -545,7 +545,7 @@ const ( "subnetName": "foo-node-subnet", "routeTableName": "foo-node-routetable", "loadBalancerSku": "Standard", - "loadBalancerName": "foo", + "loadBalancerName": "", "maximumLoadBalancerRuleCount": 250, "useManagedIdentityExtension": true, "useInstanceMetadata": true @@ -565,7 +565,7 @@ const ( "subnetName": "foo-node-subnet", "routeTableName": "foo-node-routetable", "loadBalancerSku": "Standard", - "loadBalancerName": "foo", + "loadBalancerName": "", "maximumLoadBalancerRuleCount": 250, "useManagedIdentityExtension": true, "useInstanceMetadata": true, @@ -585,7 +585,7 @@ const ( "subnetName": "foo-node-subnet", "routeTableName": "foo-node-routetable", "loadBalancerSku": "Standard", - "loadBalancerName": "foo", + "loadBalancerName": "", "maximumLoadBalancerRuleCount": 250, "useManagedIdentityExtension": true, "useInstanceMetadata": true, @@ -607,7 +607,7 @@ const ( "subnetName": "foo-node-subnet", "routeTableName": "foo-node-routetable", "loadBalancerSku": "Standard", - "loadBalancerName": "foo", + "loadBalancerName": "", "maximumLoadBalancerRuleCount": 250, "useManagedIdentityExtension": false, "useInstanceMetadata": true @@ -628,7 +628,7 @@ const ( "subnetName": "foo-node-subnet", "routeTableName": "foo-node-routetable", "loadBalancerSku": "Standard", - "loadBalancerName": "foo", + "loadBalancerName": "", "maximumLoadBalancerRuleCount": 250, "useManagedIdentityExtension": false, "useInstanceMetadata": true @@ -649,7 +649,7 @@ const ( "subnetName": "foo-node-subnet", "routeTableName": "foo-node-routetable", "loadBalancerSku": "Standard", - "loadBalancerName": "foo", + "loadBalancerName": "", "maximumLoadBalancerRuleCount": 250, "useManagedIdentityExtension": false, "useInstanceMetadata": true, @@ -675,7 +675,7 @@ const ( "subnetName": "foo-node-subnet", "routeTableName": "foo-node-routetable", "loadBalancerSku": "Standard", - "loadBalancerName": "foo", + "loadBalancerName": "", "maximumLoadBalancerRuleCount": 250, "useManagedIdentityExtension": false, "useInstanceMetadata": true, @@ -701,7 +701,7 @@ const ( "subnetName": "foo-node-subnet", "routeTableName": "foo-node-routetable", "loadBalancerSku": "Standard", - "loadBalancerName": "foo", + "loadBalancerName": "", "maximumLoadBalancerRuleCount": 250, "useManagedIdentityExtension": false, "useInstanceMetadata": true, @@ -727,7 +727,7 @@ const ( "subnetName": "foo-node-subnet", "routeTableName": "foo-node-routetable", "loadBalancerSku": "Standard", - "loadBalancerName": "foo", + "loadBalancerName": "", "maximumLoadBalancerRuleCount": 250, "useManagedIdentityExtension": false, "useInstanceMetadata": true, @@ -1189,7 +1189,7 @@ func newAzureManagedMachinePool(clusterName, poolName, mode string) *infrav1.Azu return &infrav1.AzureManagedMachinePool{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ - clusterv1.ClusterLabelName: clusterName, + clusterv1.ClusterNameLabel: clusterName, }, Name: poolName, Namespace: "default", @@ -1214,7 +1214,7 @@ func newMachinePool(clusterName, poolName string) *expv1.MachinePool { return &expv1.MachinePool{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ - clusterv1.ClusterLabelName: clusterName, + clusterv1.ClusterNameLabel: clusterName, }, Name: poolName, Namespace: "default", diff --git a/docs/book/install-and-build.sh b/docs/book/install-and-build.sh index e6e6c496e07..b587c05c859 100755 --- a/docs/book/install-and-build.sh +++ b/docs/book/install-and-build.sh @@ -24,6 +24,7 @@ cd "${KUBE_ROOT}" || exit 1 os=$(go env GOOS) arch=$(go env GOARCH) mdBookVersion="v0.4.5" +genCRDAPIReferenceDocsVersion="11fe95cbdcb91e9c25446fc99e6f2cdd8cbeb91a" # translate arch to rust's conventions (if we can) if [[ ${arch} == "amd64" ]]; then @@ -61,5 +62,19 @@ curl --retry 3 -sL -o /tmp/mdbook.${ext} "https://github.com/rust-lang-nursery/m ${cmd} /tmp/mdbook.${ext} chmod +x /tmp/mdbook +# Generate API docs +genCRDAPIReferenceDocsPath="/tmp/gen-crd-api-reference-docs-${genCRDAPIReferenceDocsVersion}" +genCRDAPIReferenceDocs="${genCRDAPIReferenceDocsPath}/gen-crd-api-reference-docs" +( + cd /tmp + curl --retry 3 -sL -o gen-crd-api-reference-docs.zip "https://github.com/ahmetb/gen-crd-api-reference-docs/archive/${genCRDAPIReferenceDocsVersion}.zip" + unzip gen-crd-api-reference-docs.zip + cd "gen-crd-api-reference-docs-${genCRDAPIReferenceDocsVersion}" + go build . +) + +${genCRDAPIReferenceDocs} -config "${genCRDAPIReferenceDocsPath}/example-config.json" -template-dir "${genCRDAPIReferenceDocsPath}/template" -api-dir ./api/v1beta1 -out-file ./docs/book/src/reference/v1beta1-api-raw.html +${genCRDAPIReferenceDocs} -config "${genCRDAPIReferenceDocsPath}/example-config.json" -template-dir "${genCRDAPIReferenceDocsPath}/template" -api-dir ./exp/api/v1beta1 -out-file ./docs/book/src/reference/v1beta1-exp-api-raw.html + # Finally build the book. (cd docs/book && /tmp/mdbook build) diff --git a/docs/book/src/SUMMARY.md b/docs/book/src/SUMMARY.md index 40613f0cf0f..ac3bc96e754 100644 --- a/docs/book/src/SUMMARY.md +++ b/docs/book/src/SUMMARY.md @@ -18,12 +18,14 @@ - [Externally managed Azure infrastructure](./topics/externally-managed-azure-infrastructure.md) - [Failure Domains](./topics/failure-domains.md) - [GPU-enabled Clusters](./topics/gpu.md) + - [Confidential VMs](./topics/confidential-vms.md) + - [Trusted Launch for VMs](./topics/trusted-launch-for-vms.md) - [Identity use cases](./topics/identities-use-cases.md) - [IPv6](./topics/ipv6.md) - [Machine Pools (VMSS)](./topics/machinepools.md) - [Managed Clusters (AKS)](./topics/managedcluster.md) - [Multitenancy](./topics/multitenancy.md) - - [Node Outbound Load Balancer](./topics/node-outbound-lb.md) + - [Node Outbound Connection](./topics/node-outbound-connection.md) - [OS Disk](./topics/os-disk.md) - [Spot Virtual Machines](./topics/spot-vms.md) - [SSH Access to nodes](./topics/ssh-access.md) @@ -36,3 +38,6 @@ - [Kubernetes Developers](./developers/kubernetes-developers.md) - [Releasing](./developers/releasing.md) - [Jobs](./developers/jobs.md) +- [Reference](./reference/reference.md) + - [v1beta1 API](./reference/v1beta1-api.md) + - [v1beta1 exp API](./reference/v1beta1-exp-api.md) diff --git a/docs/book/src/developers/development.md b/docs/book/src/developers/development.md index c8d000e7494..31bcd53ae93 100644 --- a/docs/book/src/developers/development.md +++ b/docs/book/src/developers/development.md @@ -46,7 +46,7 @@ ### Base requirements 1. Install [go][go] - - Get the latest patch version for go v1.19. + - Get the latest patch version for go v1.20. 2. Install [jq][jq] - `brew install jq` on macOS. - `sudo apt install jq` on Windows + WSL2 @@ -56,7 +56,7 @@ - `sudo apt install gettext` on Windows + WSL2. - `sudo apt install gettext` on Ubuntu Linux. 4. Install [KIND][kind] - - `GO111MODULE="on" go get sigs.k8s.io/kind@v0.17.0`. + - `GO111MODULE="on" go get sigs.k8s.io/kind@v0.18.0`. 5. Install [Kustomize][kustomize] - `brew install kustomize` on macOS. - [install instructions](https://kubectl.docs.kubernetes.io/installation/kustomize/) on Windows + WSL2. @@ -369,7 +369,7 @@ export CONTROL_PLANE_MACHINE_COUNT=3 export AZURE_CONTROL_PLANE_MACHINE_TYPE="Standard_B2s" export AZURE_NODE_MACHINE_TYPE="Standard_B2s" export WORKER_MACHINE_COUNT=2 -export KUBERNETES_VERSION="v1.24.6" +export KUBERNETES_VERSION="v1.25.6" # Identity secret. export AZURE_CLUSTER_IDENTITY_SECRET_NAME="cluster-identity-secret" @@ -530,7 +530,7 @@ With the following environment variables defined, you can build a CAPZ cluster f | ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `E2E_ARGS` | `-kubetest.use-ci-artifacts` | | `KUBERNETES_VERSION` | `latest` - extract Kubernetes version from https://dl.k8s.io/ci/latest.txt (main's HEAD)
`latest-1.25` - extract Kubernetes version from https://dl.k8s.io/ci/latest-1.25.txt (release branch's HEAD) | -| `WINDOWS_FLAVOR` | Optional, can be `containerd` or `containerd-2022`, when not specified dockershim is used | +| `WINDOWS_SERVER_VERSION` | Optional, can be `windows-2019` (default) or `windows-2022` | | `KUBETEST_WINDOWS_CONFIG` | Optional, can be `upstream-windows-serial-slow.yaml`, when not specified `upstream-windows.yaml` is used | | `WINDOWS_CONTAINERD_URL` | Optional, can be any url to a `tar.gz` file containing binaries for containerd in the same format as upstream package | diff --git a/docs/book/src/reference/reference.md b/docs/book/src/reference/reference.md new file mode 100644 index 00000000000..659ca625062 --- /dev/null +++ b/docs/book/src/reference/reference.md @@ -0,0 +1,3 @@ +# Reference + +This section contains reference documentation for CAPZ API types. diff --git a/docs/book/src/reference/v1beta1-api.md b/docs/book/src/reference/v1beta1-api.md new file mode 100644 index 00000000000..e56dc3a806a --- /dev/null +++ b/docs/book/src/reference/v1beta1-api.md @@ -0,0 +1 @@ +{{ #include v1beta1-api-raw.html }} diff --git a/docs/book/src/reference/v1beta1-exp-api.md b/docs/book/src/reference/v1beta1-exp-api.md new file mode 100644 index 00000000000..266f9ec375e --- /dev/null +++ b/docs/book/src/reference/v1beta1-exp-api.md @@ -0,0 +1 @@ +{{ #include v1beta1-exp-api-raw.html }} diff --git a/docs/book/src/topics/addons.md b/docs/book/src/topics/addons.md index f143599bcdc..6b6255f9a9e 100644 --- a/docs/book/src/topics/addons.md +++ b/docs/book/src/topics/addons.md @@ -29,7 +29,7 @@ Then install the Helm chart on the workload cluster: ```bash helm repo add projectcalico https://docs.tigera.io/calico/charts && \ -helm install calico projectcalico/tigera-operator -f https://raw.githubusercontent.com/kubernetes-sigs/cluster-api-provider-azure/main/templates/addons/calico/values.yaml --set-string "installation.calicoNetwork.ipPools[0].cidr=${IPV4_CIDR_BLOCK}" --namespace tigera-operator --create-namespace +helm install calico projectcalico/tigera-operator --version v3.25.1 -f https://raw.githubusercontent.com/kubernetes-sigs/cluster-api-provider-azure/main/templates/addons/calico/values.yaml --set-string "installation.calicoNetwork.ipPools[0].cidr=${IPV4_CIDR_BLOCK}" --namespace tigera-operator --create-namespace ``` ### For IPv6 Clusters @@ -44,7 +44,7 @@ Then install the Helm chart on the workload cluster: ```bash helm repo add projectcalico https://docs.tigera.io/calico/charts && \ -helm install calico projectcalico/tigera-operator -f https://raw.githubusercontent.com/kubernetes-sigs/cluster-api-provider-azure/main/templates/addons/calico-ipv6/values.yaml --set-string "installation.calicoNetwork.ipPools[0].cidr=${IPV6_CIDR_BLOCK}" --namespace tigera-operator --create-namespace +helm install calico projectcalico/tigera-operator --version v3.25.1 -f https://raw.githubusercontent.com/kubernetes-sigs/cluster-api-provider-azure/main/templates/addons/calico-ipv6/values.yaml --set-string "installation.calicoNetwork.ipPools[0].cidr=${IPV6_CIDR_BLOCK}" --namespace tigera-operator --create-namespace ``` ### For Dual-Stack Clusters @@ -60,7 +60,7 @@ Then install the Helm chart on the workload cluster: ```bash helm repo add projectcalico https://docs.tigera.io/calico/charts && \ -helm install calico projectcalico/tigera-operator -f https://raw.githubusercontent.com/kubernetes-sigs/cluster-api-provider-azure/main/templates/addons/calico-dual-stack/values.yaml --set-string "installation.calicoNetwork.ipPools[0].cidr=${IPV4_CIDR_BLOCK}","installation.calicoNetwork.ipPools[1].cidr=${IPV6_CIDR_BLOCK}" --namespace tigera-operator --create-namespace +helm install calico projectcalico/tigera-operator --version v3.25.1 -f https://raw.githubusercontent.com/kubernetes-sigs/cluster-api-provider-azure/main/templates/addons/calico-dual-stack/values.yaml --set-string "installation.calicoNetwork.ipPools[0].cidr=${IPV4_CIDR_BLOCK}","installation.calicoNetwork.ipPools[1].cidr=${IPV6_CIDR_BLOCK}" --namespace tigera-operator --create-namespace ``` diff --git a/docs/book/src/topics/confidential-vms.md b/docs/book/src/topics/confidential-vms.md new file mode 100644 index 00000000000..9cdc51445eb --- /dev/null +++ b/docs/book/src/topics/confidential-vms.md @@ -0,0 +1,69 @@ +# Confidential VMs + +This document describes how to deploy a cluster with Azure [Confidential VM](https://learn.microsoft.com/azure/confidential-computing/confidential-vm-overview) nodes. + +## Limitations + +Before you begin, be aware of the following: + +- [VM Size Support](https://learn.microsoft.com/en-us/azure/confidential-computing/confidential-vm-overview#size-support) +- [OS Support](https://learn.microsoft.com/en-us/azure/confidential-computing/confidential-vm-overview#os-support) +- [Limitations](https://learn.microsoft.com/en-us/azure/confidential-computing/confidential-vm-overview#limitations) + +## Confidential VM Images + +One of the limitations of Confidential VMs is that they support specific OS images, as they need to get [successfully attested](https://learn.microsoft.com/en-us/azure/confidential-computing/confidential-vm-overview#attestation-and-tpm) during boot. + +Confidential VM images are not included in the list of `capi` reference images. Before creating a cluster hosted on Azure Confidential VMs, you can create a [custom image](custom-images.md) based on a Confidential VM supported OS image using [image-builder](https://github.com/kubernetes-sigs/image-builder). For example, you can run the following to create such an image based on Ubuntu Server 22.04 LTS for CVMs: + +```bash +$ make -C images/capi build-azure-sig-ubuntu-2204-cvm +# many minutes later... +==> sig-ubuntu-2204-cvm: +Build 'sig-ubuntu-2204-cvm' finished. + +==> Builds finished. The artifacts of successful builds are: +--> sig-ubuntu-2204-cvm: Azure.ResourceManagement.VMImage: + +OSType: Linux +ManagedImageResourceGroupName: cluster-api-images +ManagedImageName: capi-ubuntu-2204-cvm-1684153817 +ManagedImageId: /subscriptions/01234567-89ab-cdef-0123-4567890abcde/resourceGroups/cluster-api-images/providers/Microsoft.Compute/images/capi-ubuntu-2204-cvm-1684153817 +ManagedImageLocation: southcentralus +ManagedImageSharedImageGalleryId: /subscriptions/01234567-89ab-cdef-0123-4567890abcde/resourceGroups/cluster-api-images/providers/Microsoft.Compute/galleries/ClusterAPI/images/capi-ubuntu-2204-cvm/versions/0.3.1684153817 +``` + +## Example + +The below example shows how to deploy a cluster with the control-plane nodes as Confidential VMs. SecurityEncryptionType is set to VMGuestStateOnly (i.e. only the VMGuestState blob will be encrypted), while VTpmEnabled and SecureBootEnabled are both set to true. Make sure to choose a supported VM size (e.g. `Standard_DC4as_v5`) and OS (e.g. Ubuntu Server 22.04 LTS for Confidential VMs). +NOTE: the same can be applied to worker nodes + +```yaml +kind: AzureMachineTemplate +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +metadata: + name: capz-confidential-vms-example +spec: + template: + spec: + image: + computeGallery: + subscriptionID: "01234567-89ab-cdef-0123-4567890abcde" + resourceGroup: "cluster-api-images" + gallery: "ClusterAPI" + name: "capi-ubuntu-2204-cvm-1684153817" + version: "0.3.1684153817" + securityProfile: + securityType: "ConfidentialVM" + uefiSettings: + vTpmEnabled: true + secureBootEnabled: true + osDisk: + diskSizeGB: 128 + osType: "Linux" + managedDisk: + storageAccountType: "Premium_LRS" + securityProfile: + securityEncryptionType: "VMGuestStateOnly" + vmSize: "Standard_DC4as_v5" +```` diff --git a/docs/book/src/topics/failure-domains.md b/docs/book/src/topics/failure-domains.md index 1b5bb6e1981..3eec227409f 100644 --- a/docs/book/src/topics/failure-domains.md +++ b/docs/book/src/topics/failure-domains.md @@ -134,7 +134,7 @@ You can use an `AzureMachinePool` object to deploy a Virtual Machine Scale Set w Set the **FailureDomains** field to the list of availability zones that you want to use. Be aware that not all regions have the same availability zones. You can use `az vm list-skus -l --zone -o table` to list all the available zones per vm size in that location/region. ```yaml -apiVersion: cluster.x-k8s.io/v1alpha3 +apiVersion: cluster.x-k8s.io/v1beta1 kind: MachinePool metadata: labels: @@ -152,16 +152,16 @@ spec: clusterName: my-cluster bootstrap: configRef: - apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 + apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 kind: KubeadmConfigTemplate name: ${CLUSTER_NAME}-vmss-0 infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 kind: AzureMachinePool name: ${CLUSTER_NAME}-vmss-0 version: ${KUBERNETES_VERSION} --- -apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 kind: AzureMachinePool metadata: labels: @@ -191,7 +191,7 @@ The availability sets created are as follows: Consider the following cluster configuration: ```yaml -apiVersion: cluster.x-k8s.io/v1alpha3 +apiVersion: cluster.x-k8s.io/v1beta1 kind: Cluster metadata: labels: @@ -204,15 +204,15 @@ spec: cidrBlocks: - 192.168.0.0/16 controlPlaneRef: - apiVersion: controlplane.cluster.x-k8s.io/v1alpha3 + apiVersion: controlplane.cluster.x-k8s.io/v1beta1 kind: KubeadmControlPlane name: ${CLUSTER_NAME}-control-plane infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 kind: AzureCluster name: ${CLUSTER_NAME} --- -apiVersion: cluster.x-k8s.io/v1alpha3 +apiVersion: cluster.x-k8s.io/v1beta1 kind: MachineDeployment metadata: name: ${CLUSTER_NAME}-md-0 @@ -226,17 +226,17 @@ spec: spec: bootstrap: configRef: - apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 + apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 kind: KubeadmConfigTemplate name: ${CLUSTER_NAME}-md-0 clusterName: ${CLUSTER_NAME} infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 kind: AzureMachineTemplate name: ${CLUSTER_NAME}-md-0 version: ${KUBERNETES_VERSION} --- -apiVersion: cluster.x-k8s.io/v1alpha3 +apiVersion: cluster.x-k8s.io/v1beta1 kind: MachineDeployment metadata: name: ${CLUSTER_NAME}-md-1 @@ -250,17 +250,17 @@ spec: spec: bootstrap: configRef: - apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 + apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 kind: KubeadmConfigTemplate name: ${CLUSTER_NAME}-md-1 clusterName: ${CLUSTER_NAME} infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 kind: AzureMachineTemplate name: ${CLUSTER_NAME}-md-1 version: ${KUBERNETES_VERSION} --- -apiVersion: cluster.x-k8s.io/v1alpha3 +apiVersion: cluster.x-k8s.io/v1beta1 kind: MachineDeployment metadata: name: ${CLUSTER_NAME}-md-2 @@ -274,12 +274,12 @@ spec: spec: bootstrap: configRef: - apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 + apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 kind: KubeadmConfigTemplate name: ${CLUSTER_NAME}-md-2 clusterName: ${CLUSTER_NAME} infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 kind: AzureMachineTemplate name: ${CLUSTER_NAME}-md-2 version: ${KUBERNETES_VERSION} diff --git a/docs/book/src/topics/flatcar.md b/docs/book/src/topics/flatcar.md index 6a478d398cb..a3fdd1bdd48 100644 --- a/docs/book/src/topics/flatcar.md +++ b/docs/book/src/topics/flatcar.md @@ -39,3 +39,6 @@ If you would like customize your images please refer to the documentation on bui ## Trying it out To create a cluster using Flatcar Container Linux, use `flatcar` cluster flavor. + +- Note: When working with **Flatcar machines**, append `--set-string cloudControllerManager.caCertDir=/usr/share/ca-certificates` to the `cloud-provider-azure` _helm_ command. Refer ["External Cloud Provider's Note for flatcar-flavored machine"](https://github.com/kubernetes-sigs/cluster-api-provider-azure/blob/764aa1e8bd02d150dff90ff6bc7f8daa2b38810f/docs/book/src/topics/addons.md#external-cloud-provider) + - However, no changes are needed when using tilt to bring up flatcar-flavored workload clusters. diff --git a/docs/book/src/topics/getting-started.md b/docs/book/src/topics/getting-started.md index d80a44afdc1..e2525916a07 100644 --- a/docs/book/src/topics/getting-started.md +++ b/docs/book/src/topics/getting-started.md @@ -11,6 +11,7 @@ - `Microsoft.ContainerService` - `Microsoft.ManagedIdentity` - `Microsoft.Authorization` + - `Microsoft.ResourceHealth` (if the `EXP_AKS_RESOURCE_HEALTH` feature flag is enabled) - Install the [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest) - A [supported version](https://github.com/kubernetes-sigs/cluster-api-provider-azure#compatibility) of `clusterctl` diff --git a/docs/book/src/topics/managedcluster.md b/docs/book/src/topics/managedcluster.md index 400450ffb5e..e015fadeee0 100644 --- a/docs/book/src/topics/managedcluster.md +++ b/docs/book/src/topics/managedcluster.md @@ -16,7 +16,7 @@ corresponds to provisioning an AKS cluster. AzureManagedMachinePool corresponds one-to-one with AKS node pools. This also means that creating an AzureManagedControlPlane requires at least one AzureManagedMachinePool with `spec.mode` `System`, since AKS expects at least one system pool at creation -time. For more documentation on system node pool refer [AKS Docs](https://docs.microsoft.com/en-us/azure/aks/use-system-pools) +time. For more documentation on system node pool refer [AKS Docs](https://learn.microsoft.com/azure/aks/use-system-pools) ## Deploy with clusterctl @@ -28,7 +28,7 @@ executing clusterctl. # Kubernetes values export CLUSTER_NAME="my-cluster" export WORKER_MACHINE_COUNT=2 -export KUBERNETES_VERSION="v1.24.6" +export KUBERNETES_VERSION="v1.25.6" # Azure values export AZURE_LOCATION="southcentralus" @@ -50,6 +50,7 @@ export the following variables in your current shell. export AZURE_SUBSCRIPTION_ID="$(cat sp.json | jq -r .subscriptionId | tr -d '\n')" export AZURE_CLIENT_SECRET="$(cat sp.json | jq -r .clientSecret | tr -d '\n')" export AZURE_CLIENT_ID="$(cat sp.json | jq -r .clientId | tr -d '\n')" +export AZURE_TENANT_ID="$(cat sp.json | jq -r .tenantId | tr -d '\n')" export AZURE_NODE_MACHINE_TYPE="Standard_D2s_v3" export AZURE_CLUSTER_IDENTITY_SECRET_NAME="cluster-identity-secret" export AZURE_CLUSTER_IDENTITY_SECRET_NAMESPACE="default" @@ -62,7 +63,7 @@ Managed clusters require the Cluster API "MachinePool" feature flag enabled. You export EXP_MACHINE_POOL=true ``` -Optionally, the you can enable the CAPZ "AKSResourceHealth" feature flag as well: +Optionally, you can enable the CAPZ "AKSResourceHealth" feature flag as well: ```bash export EXP_AKS_RESOURCE_HEALTH=true @@ -194,19 +195,15 @@ spec: sku: Standard_D2s_v4 ``` -The main features for configuration are: +Please note that we don't declare a configuration for the apiserver endpoint. This configuration data will be populated automatically based on the data returned from AKS API during cluster create as `.spec.controlPlaneEndpoint.Host` and `.spec.controlPlaneEndpoint.Port` in both the `AzureManagedCluster` and `AzureManagedControlPlane` resources. Any user-provided data will be ignored and overwritten by data returned from the AKS API. -- [networkPolicy](https://docs.microsoft.com/en-us/azure/aks/concepts-network#network-policies) -- [networkPlugin](https://docs.microsoft.com/en-us/azure/aks/concepts-network#azure-virtual-networks) -- [addonProfiles](https://learn.microsoft.com/cli/azure/aks/addon?view=azure-cli-latest#az-aks-addon-list-available) - for additional addons not listed below, look for the `*ADDON_NAME` values in [this code](https://github.com/Azure/azure-cli/blob/main/src/azure-cli/azure/cli/command_modules/acs/_consts.py). +The [CAPZ API reference documentation](../reference/v1beta1-api.html) describes all of the available options. See also the AKS API documentation for [Agent Pools](https://learn.microsoft.com/rest/api/aks/agent-pools/create-or-update?tabs=HTTP) and [Managed Clusters](https://learn.microsoft.com/rest/api/aks/managed-clusters/create-or-update?tabs=HTTP). -Other configuration values like subscriptionId and node machine type -should be fairly clear from context. +The main features for configuration are: -| option | available values | -|---------------------------|-------------------------------| -| networkPlugin | azure, kubenet | -| networkPolicy | azure, calico | +- [networkPolicy](https://learn.microsoft.com/azure/aks/concepts-network#network-policies) +- [networkPlugin](https://learn.microsoft.com/azure/aks/concepts-network#azure-virtual-networks) +- [addonProfiles](https://learn.microsoft.com/cli/azure/aks/addon?view=azure-cli-latest#az-aks-addon-list-available) - for additional addons not listed below, look for the `*ADDON_NAME` values in [this code](https://github.com/Azure/azure-cli/blob/main/src/azure-cli/azure/cli/command_modules/acs/_consts.py). | addon name | YAML value | |---------------------------|---------------------------| @@ -246,297 +243,10 @@ spec: name: test-subnet ``` -### Multitenancy - -Multitenancy for managed clusters can be configured by using `aks-multi-tenancy` flavor. The steps for creating an azure managed identity and mapping it to an `AzureClusterIdentity` are similar to the ones described [here](https://capz.sigs.k8s.io/topics/multitenancy.html). -The `AzureClusterIdentity` object is then mapped to a managed cluster through the `identityRef` field in `AzureManagedControlPlane.spec`. -Following is an example configuration: - -```yaml -apiVersion: cluster.x-k8s.io/v1beta1 -kind: Cluster -metadata: - name: ${CLUSTER_NAME} - namespace: default -spec: - clusterNetwork: - services: - cidrBlocks: - - 192.168.0.0/16 - controlPlaneRef: - apiVersion: exp.infrastructure.cluster.x-k8s.io/v1beta1 - kind: AzureManagedControlPlane - name: ${CLUSTER_NAME} - infrastructureRef: - apiVersion: exp.infrastructure.cluster.x-k8s.io/v1beta1 - kind: AzureManagedCluster - name: ${CLUSTER_NAME} ---- -apiVersion: exp.infrastructure.cluster.x-k8s.io/v1beta1 -kind: AzureManagedControlPlane -metadata: - name: ${CLUSTER_NAME} - namespace: default -spec: - identityRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 - kind: AzureClusterIdentity - name: ${CLUSTER_IDENTITY_NAME} - namespace: ${CLUSTER_IDENTITY_NAMESPACE} - location: ${AZURE_LOCATION} - resourceGroupName: ${AZURE_RESOURCE_GROUP:=${CLUSTER_NAME}} - sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""} - subscriptionID: ${AZURE_SUBSCRIPTION_ID} - version: ${KUBERNETES_VERSION} ---- -``` - -### AKS Managed Azure Active Directory Integration - -Azure Kubernetes Service can be configured to use Azure Active Directory for user authentication. -AAD for managed clusters can be configured by enabling the `managed` spec in `AzureManagedControlPlane` to `true` -and by providing Azure AD GroupObjectId in `AdminGroupObjectIDs` array. The group is needed as admin group for -the cluster to grant cluster admin permissions. You can use an existing Azure AD group, or create a new one. For more documentation about AAD refer [AKS AAD Docs](https://docs.microsoft.com/en-us/azure/aks/managed-aad) - -```yaml -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 -kind: AzureManagedControlPlane -metadata: - name: my-cluster-control-plane -spec: - location: southcentralus - resourceGroupName: foo-bar - sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""} - subscriptionID: fae7cc14-bfba-4471-9435-f945b42a16dd # fake uuid - version: v1.21.2 - aadProfile: - managed: true - adminGroupObjectIDs: - - 917056a9-8eb5-439c-g679-b34901ade75h # fake admin groupId -``` - -### AKS Cluster Autoscaler - -Azure Kubernetes Service can have the cluster autoscaler enabled by specifying `scaling` spec in any of the `AzureManagedMachinePool` defined. - -```yaml -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 -kind: AzureManagedMachinePool -metadata: - name: agentpool0 -spec: - mode: System - osDiskSizeGB: 30 - sku: Standard_D2s_v3 - scaling: - minSize: 2 - maxSize: 10 -``` - -The cluster autoscaler behavior settings can be set in the `AzureManagedControlPlane`. Not setting a property will default to the value used by AKS. All values are expected to be strings. - -```yaml -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 -kind: AzureManagedControlPlane -metadata: - name: my-cluster-control-plane -spec: - autoscalerProfile: - balanceSimilarNodeGroups: "false" - expander: "random" - maxEmptyBulkDelete: "10" - maxGracefulTerminationSec: "600" - maxNodeProvisionTime: "15m" - maxTotalUnreadyPercentage: "45" - newPodScaleUpDelay: "0s" - okTotalUnreadyCount: "3" - scanInterval: "10s" - scaleDownDelayAfterAdd: "10m" - scaleDownDelayAfterDelete: "10s" - scaleDownDelayAfterFailure: "3m" - scaleDownUnneededTime: "10m" - scaleDownUnreadyTime: "20m" - scaleDownUtilizationThreshold: "0.5" - skipNodesWithLocalStorage: "false" - skipNodesWithSystemPods: "true" -``` - -### AKS Node Labels to an Agent Pool - -You can configure the `NodeLabels` value for each AKS node pool (`AzureManagedMachinePool`) that you define in your spec. - -Below an example `nodeLabels` configuration is assigned to `agentpool0`, specifying that each node in the pool will add a label `dedicated : kafka` - -```yaml -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 -kind: AzureManagedMachinePool -metadata: - name: agentpool0 -spec: - mode: System - osDiskSizeGB: 512 - sku: Standard_D2s_v3 - nodeLabels: - dedicated: kafka -``` - -### AKS Node Pool MaxPods configuration - -You can configure the `MaxPods` value for each AKS node pool (`AzureManagedMachinePool`) that you define in your spec (see [here](https://docs.microsoft.com/en-us/azure/aks/configure-azure-cni#configure-maximum---new-clusters) for the official AKS documentation). This corresponds to the kubelet `--max-pods` configuration (official kubelet configuration documentation can be found [here](https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/)). - -Below an example `maxPods` configuration is assigned to `agentpool0`, specifying that each node in the pool will enforce a maximum of 24 scheduled pods: - -```yaml -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 -kind: AzureManagedMachinePool -metadata: - name: agentpool0 -spec: - mode: System - osDiskSizeGB: 30 - sku: Standard_D2s_v3 - maxPods: 32 -``` - -### AKS Node Pool OsDiskType configuration - -You can configure the `OsDiskType` value for each AKS node pool (`AzureManagedMachinePool`) that you define in your spec (see [here](https://docs.microsoft.com/en-us/azure/aks/cluster-configuration#ephemeral-os) for the official AKS documentation). There are two options to choose from: `"Managed"` (the default) or `"Ephemeral"`. - -Below an example `osDiskType` configuration is assigned to `agentpool0`, specifying that each node in the pool will use a local, ephemeral OS disk for faster disk I/O at the expense of possible data loss: - -```yaml -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 -kind: AzureManagedMachinePool -metadata: - name: agentpool0 -spec: - mode: System - osDiskSizeGB: 30 - sku: Standard_D2s_v3 - osDiskType: "Ephemeral" -``` - -## AKS Node Pool KubeletDiskType configuration - -You can configure the `KubeletDiskType` value for each AKS node pool (`AzureManagedMachinePool`) that you define in your spec (see [here](https://learn.microsoft.com/en-us/rest/api/aks/agent-pools/create-or-update?tabs=HTTP#kubeletdisktype) for the official AKS documentation). There are two options to choose from: `"OS"` or `"Temporary"`. - -Before this feature can be used, you must register the `KubeletDisk` feature on your Azure subscription with the following az cli command. - -```bash -az feature register --namespace Microsoft.ContainerService --name KubeletDisk -``` - -Below an example `kubeletDiskType` configuration is assigned to `agentpool0`, specifying that the emptyDir volumes, container runtime data root, and Kubelet ephemeral storage will be stored on the temporary disk: - -```yaml -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 -kind: AzureManagedMachinePool -metadata: - name: agentpool0 -spec: - mode: System - osDiskSizeGB: 30 - sku: Standard_D2s_v3 - kubeletDiskType: "Temporary" -``` - -### AKS Node Pool Taints - -You can configure the `Taints` value for each AKS node pool (`AzureManagedMachinePool`) that you define in your spec. - -Below is an example of `taints` configuration for the `agentpool0`: - -```yaml -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 -kind: AzureManagedMachinePool -metadata: - name: agentpool0 -spec: - mode: System - osDiskSizeGB: 512 - sku: Standard_D2s_v3 - taints: - - effect: no-schedule - key: dedicated - value: kafka -``` - -### AKS Node Pool OS Type - -If your cluster uses the Azure network plugin (`AzureManagedControlPlane.networkPlugin`) you can set the operating system -for your User nodepools. The `osType` field is immutable and only can be set at creation time, it defaults to `Linux` and -can be either `Linux` or `Windows`. - -```yaml -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 -kind: AzureManagedMachinePool -metadata: - name: agentpool0 -spec: - mode: User - osDiskSizeGB: 30 - sku: Standard_D2s_v3 - osDiskType: "Ephemeral" - osType: Windows -``` - -### AKS Node Pool Kubelet Custom Configuration - -Reference: - -- https://learn.microsoft.com/en-us/azure/aks/custom-node-configuration - -When you create your node pool (`AzureManagedMachinePool`), you may specify various kubelet configuration which tunes the kubelet runtime on all nodes in that pool. For example: - -```yaml -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 -kind: AzureManagedMachinePool -metadata: - name: pool1 -spec: - mode: User - kubeletConfig: - cpuManagerPolicy: "static" - cpuCfsQuota: true - cpuCfsQuotaPeriod: "110ms" - imageGcHighThreshold: 70 - imageGcLowThreshold: 50 - topologyManagerPolicy: "best-effort" - allowedUnsafeSysctls: - - "net.*" - - "kernel.msg*" - failSwapOn: false - containerLogMaxSizeMB: 500 - containerLogMaxFiles: 50 - podMaxPids: 2048 -``` - -Below are the full set of AKS-supported kubeletConfig configurations. All properties are children of the `spec.kubeletConfig` configuration in an `AzureManagedMachinePool` resource: - -| Configuration | Property Type | Allowed Value(s) | -|-----------------------------|-------------------|------------------------------------------------------------------------------------------| -| `cpuManagerPolicy` | string | `"none"`, `"static"` | -| `cpuCfsQuota` | boolean | `true`, `false` | -| `cpuCfsQuotaPeriod` | string | value in milliseconds, must end in `"ms"`, e.g., `"100ms"` | -| `failSwapOn` | boolean | `true`, `false` | -| `imageGcHighThreshold` | integer | integer values in the range 0-100 (inclusive) | -| `imageGcLowThreshold` | integer | integer values in the range 0-100 (inclusive), must be lower than `imageGcHighThreshold` | -| `topologyManagerPolicy` | string | `"none"`, `"best-effort"`, `"restricted"`, `"single-numa-node"` | -| `allowedUnsafeSysctls` | string | `"kernel.shm*"`, `"kernel.msg*"`, `"kernel.sem"`, `"fs.mqueue.*"`, `"net.*"` | -| `containerLogMaxSizeMB` | integer | any integer | -| `containerLogMaxFiles` | integer | any integer >= `2` | -| `podMaxPids` | integer | any integer >= `-1`, note that this must not be higher than kernel PID limit | - -For more detailed information on the behaviors of the above configurations, see [the official Kubernetes documentation](https://kubernetes.io/docs/reference/config-api/kubelet-config.v1beta1/). Note that not all possible Kubernetes Kubelet Configuration options are available to use on your AKS node pool, only those specified above. - -CAPZ will not assign any default values for any excluded configuration properties. It is also not required to include the `spec.kubeletConfig` configuration in an `AzureManagedMachinePool` resource spec. In cases where no CAPZ configuration is declared, AKS will apply its own opinionated default configurations when the node pool is created. - -Note: these configurations can not be updated after a node pool is created. - ### Enable AKS features with custom headers (--aks-custom-headers) To enable some AKS cluster / node pool features you need to pass special headers to the cluster / node pool create request. -For example, to [add a node pool for GPU nodes](https://docs.microsoft.com/en-us/azure/aks/gpu-cluster#add-a-node-pool-for-gpu-nodes), +For example, to [add a node pool for GPU nodes](https://learn.microsoft.com/azure/aks/gpu-cluster#add-a-node-pool-for-gpu-nodes), you need to pass a custom header `UseGPUDedicatedVHD=true` (with `--aks-custom-headers UseGPUDedicatedVHD=true` argument). To do this with CAPZ, you need to add special annotations to AzureManagedCluster (for cluster features) or AzureManagedMachinePool (for node pool features). These annotations should have a prefix `infrastructure.cluster.x-k8s.io/custom-header-` followed @@ -555,193 +265,6 @@ spec: ... ``` -### Use a public Standard Load Balancer - -A public Load Balancer when integrated with AKS serves two purposes: - -- To provide outbound connections to the cluster nodes inside the AKS virtual network. It achieves this objective by translating the nodes private IP address to a public IP address that is part of its Outbound Pool. -- To provide access to applications via Kubernetes services of type LoadBalancer. With it, you can easily scale your applications and create highly available services. - -For more documentation about public Standard Load Balancer refer [AKS Doc](https://docs.microsoft.com/en-us/azure/aks/load-balancer-standard) and [AKS REST API Doc](https://docs.microsoft.com/en-us/rest/api/aks/managed-clusters/create-or-update) - -```yaml -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 -kind: AzureManagedControlPlane -metadata: - name: my-cluster-control-plane -spec: - location: southcentralus - resourceGroupName: foo-bar - sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""} - subscriptionID: 00000000-0000-0000-0000-000000000000 # fake uuid - version: v1.21.2 - loadBalancerProfile: # Load balancer profile must specify at most one of ManagedOutboundIPs, OutboundIPPrefixes and OutboundIPs - managedOutboundIPs: 2 # 1-100 - outboundIPPrefixes: - - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/foo-bar/providers/Microsoft.Network/publicIPPrefixes/my-public-ip-prefix # fake public ip prefix - outboundIPs: - - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/foo-bar/providers/Microsoft.Network/publicIPAddresses/my-public-ip # fake public ip - allocatedOutboundPorts: 100 # 0-64000 - idleTimeoutInMinutes: 10 # 4-120 -``` - -### Secure access to the API server using authorized IP address ranges - -In Kubernetes, the API server receives requests to perform actions in the cluster such as to create resources or scale the number of nodes. The API server is the central way to interact with and manage a cluster. To improve cluster security and minimize attacks, the API server should only be accessible from a limited set of IP address ranges. - -For more documentation about authorized IP address ranges refer [AKS Doc](https://docs.microsoft.com/en-us/azure/aks/api-server-authorized-ip-ranges) and [AKS REST API Doc](https://docs.microsoft.com/en-us/rest/api/aks/managed-clusters/create-or-update) - -```yaml -apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 -kind: AzureManagedControlPlane -metadata: - name: my-cluster-control-plane -spec: - location: southcentralus - resourceGroupName: foo-bar - sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""} - subscriptionID: 00000000-0000-0000-0000-000000000000 # fake uuid - version: v1.21.2 - apiServerAccessProfile: - authorizedIPRanges: - - 12.34.56.78/32 - enablePrivateCluster: false - privateDNSZone: None # System, None. Allowed only when enablePrivateCluster is true - enablePrivateClusterPublicFQDN: false # Allowed only when enablePrivateCluster is true -``` - -### OS configurations of Linux agent nodes (AKS) - -Reference: - -- [How-to-guide Linux OS Custom Configuration](https://learn.microsoft.com/en-us/azure/aks/custom-node-configuration#linux-os-custom-configuration) -- [AKS API definition Linux OS Config](https://learn.microsoft.com/en-us/rest/api/aks/agent-pools/create-or-update?tabs=HTTP#linuxosconfig) - -When you create your node pool (`AzureManagedMachinePool`), you can specify configuration which tunes the linux OS configuration on all nodes in that pool. For example: - -```yaml -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 -kind: AzureManagedMachinePool -metadata: - name: "${CLUSTER_NAME}-pool1" -spec: - linuxOSConfig: - swapFileSizeMB: 1500 - sysctls: - fsAioMaxNr: 65536 - fsFileMax: 8192 - fsInotifyMaxUserWatches: 781250 - fsNrOpen: 8192 - kernelThreadsMax: 20 - netCoreNetdevMaxBacklog: 1000 - netCoreOptmemMax: 20480 - netCoreRmemDefault: 212992 - netCoreRmemMax: 212992 - netCoreSomaxconn: 163849 - netCoreWmemDefault: 212992 - netCoreWmemMax: 212992 - netIpv4IPLocalPortRange: "32000 60000" - netIpv4NeighDefaultGcThresh1: 128 - netIpv4NeighDefaultGcThresh2: 512 - netIpv4NeighDefaultGcThresh3: 1024 - netIpv4TCPFinTimeout: 5 - netIpv4TCPKeepaliveProbes: 1 - netIpv4TCPKeepaliveTime: 30 - netIpv4TCPMaxSynBacklog: 128 - netIpv4TCPMaxTwBuckets: 8000 - netIpv4TCPTwReuse: true - netIpv4TCPkeepaliveIntvl: 10 - netNetfilterNfConntrackBuckets: 65536 - netNetfilterNfConntrackMax: 131072 - vmMaxMapCount: 65530 - vmSwappiness: 10 - vmVfsCachePressure: 15 - transparentHugePageDefrag: "defer+madvise" - transparentHugePageEnabled: "madvise" -``` - -Below are the full set of AKS-supported `linuxOSConfig` configurations. All properties are children of the `spec.linuxOSConfig` configuration in an `AzureManagedMachinePool` resource: - -| Configuration | Property Type | Allowed Value(s) | -|-----------------------------|-------------------|------------------------------------------------------------------------------------------| -| `swapFileSizeMB` | integer | minimum value `1`. | -| `sysctls` | SysctlConfig | | -| `transparentHugePageDefrag` | string | `"always"`, `"defer"`, `"defer+madvise"`, `"madvise"` or `"never"` | -| `transparentHugePageEnabled`| string | `"always"`, `"madvise"` or `"never"` | - -**Note**: To enable swap file on nodes, i.e.`swapFileSizeMB` to be applied, `Kubeletconfig.failSwapOn` must be set to `false` - -#### SysctlsConfig - -Below are the full set of supported `SysctlConfig` configurations. All properties are children of the `spec.linuxOSConfig.sysctls` configuration in an `AzureManagedMachinePool` resource: - -| Configuration | Property Type | Allowed Value(s) | -|---------------------------------|-------------------|------------------------------------------------------------------------------------------| -| `fsAioMaxNr` | integer | allowed value in the range [`65536` - `6553500`] (inclusive) | -| `fsFileMax` | integer | allowed value in the range [`8192` - `12000500`] (inclusive) | -| `fsInotifyMaxUserWatches` | integer | allowed value in the range [`781250` - `2097152`] (inclusive) | -| `fsNrOpen` | integer | allowed value in the range [`8192` - `20000500`] (inclusive) | -| `kernelThreadsMax` | integer | allowed value in the range [`20` - `513785`] (inclusive) | -| `netCoreNetdevMaxBacklog` | integer | allowed value in the range [`1000` - `3240000`] (inclusive) | -| `netCoreOptmemMax` | integer | allowed value in the range [`20480` - `4194304`] (inclusive) | -| `netCoreRmemDefault` | integer | allowed value in the range [`212992` - `134217728`] (inclusive) | -| `netCoreRmemMax` | integer | allowed value in the range [`212992` - `134217728`] (inclusive) | -| `netCoreSomaxconn` | integer | allowed value in the range [`4096` - `3240000`] (inclusive) | -| `netCoreWmemDefault` | integer | allowed value in the range [`212992` - `134217728`] (inclusive) | -| `netCoreWmemMax` | integer | allowed value in the range [`212992`- `134217728`] (inclusive) | -| `netIpv4IPLocalPortRange` | string | Must be specified as `"first last"`. Ex: `1024 33000`. First must be in `[1024 - 60999]` and last must be in `[32768 - 65000]`| -| `netIpv4NeighDefaultGcThresh1` | integer | allowed value in the range [`128` - `80000`] (inclusive) | -| `netIpv4NeighDefaultGcThresh2` | integer | allowed value in the range [`512` - `90000`] (inclusive) | -| `netIpv4NeighDefaultGcThresh3` | integer | allowed value in the range [`1024` - `100000`] (inclusive) | -| `netIpv4TCPFinTimeout` | integer | allowed value in the range [`5` - `120`] (inclusive) | -| `netIpv4TCPKeepaliveProbes` | integer | allowed value in the range [`1` - `15`] (inclusive) | -| `netIpv4TCPKeepaliveTime` | integer | allowed value in the range [`30` - `432000`] (inclusive) | -| `netIpv4TCPMaxSynBacklog` | integer | allowed value in the range [`128` - `3240000`] (inclusive) | -| `netIpv4TCPMaxTwBuckets` | integer | allowed value in the range [`8000` - `1440000`] (inclusive) | -| `netIpv4TCPTwReuse` | bool | allowed values `true` or `false` | -| `netIpv4TCPkeepaliveIntvl` | integer | allowed value in the range [`1` - `75`] (inclusive) | -| `netNetfilterNfConntrackBuckets`| integer | allowed value in the range [`65536` - `147456`] (inclusive) | -| `netNetfilterNfConntrackMax` | integer | allowed value in the range [`131072` - `1048576`] (inclusive) | -| `vmMaxMapCount` | integer | allowed value in the range [`65530` - `262144`] (inclusive) | -| `vmSwappiness` | integer | allowed value in the range [`0` - `100`] (inclusive) | -| `vmVfsCachePressure` | integer | allowed value in the range [`1` - `500`] (inclusive) | - -**Note**: Both of the values must be specified to enforce `NetIpv4IPLocalPortRange`. - -## Immutable fields for Managed Clusters (AKS) - -Some fields from the family of Managed Clusters CRD are immutable. Which means -those can only be set during the creation time. - -Following is the list of immutable fields for managed clusters: - -| CRD | jsonPath | Comment | -|---------------------------|------------------------------|---------------------------| -| AzureManagedControlPlane | .name | | -| AzureManagedControlPlane | .spec.subscriptionID | | -| AzureManagedControlPlane | .spec.resourceGroupName | | -| AzureManagedControlPlane | .spec.nodeResourceGroupName | | -| AzureManagedControlPlane | .spec.location | | -| AzureManagedControlPlane | .spec.sshPublicKey | | -| AzureManagedControlPlane | .spec.dnsServiceIP | | -| AzureManagedControlPlane | .spec.networkPlugin | | -| AzureManagedControlPlane | .spec.networkPolicy | | -| AzureManagedControlPlane | .spec.loadBalancerSKU | | -| AzureManagedControlPlane | .spec.apiServerAccessProfile | except AuthorizedIPRanges | -| AzureManagedControlPlane | .spec.virtualNetwork | | -| AzureManagedControlPlane | .spec.virtualNetwork.subnet | except serviceEndpoints | -| AzureManagedMachinePool | .spec.name | | -| AzureManagedMachinePool | .spec.sku | | -| AzureManagedMachinePool | .spec.osDiskSizeGB | | -| AzureManagedMachinePool | .spec.osDiskType | | -| AzureManagedMachinePool | .spec.availabilityZones | | -| AzureManagedMachinePool | .spec.maxPods | | -| AzureManagedMachinePool | .spec.osType | | -| AzureManagedMachinePool | .spec.enableNodePublicIP | | -| AzureManagedMachinePool | .spec.nodePublicIPPrefixID | | -| AzureManagedMachinePool | .spec.kubeletConfig | | -| AzureManagedMachinePool | .spec.linuxOSConfig | | - ## Features AKS clusters deployed from CAPZ currently only support a limited, @@ -762,6 +285,10 @@ Current limitations - Only supports Azure Active Directory Managed by Azure. - We will not support Legacy Azure Active Directory +## Best Practices + +A set of best practices for managing AKS clusters is documented here: https://learn.microsoft.com/azure/aks/best-practices + ## Troubleshooting If a user tries to delete the MachinePool which refers to the last system node pool AzureManagedMachinePool webhook will reject deletion, so time stamp never gets set on the AzureManagedMachinePool. However the timestamp would be set on the MachinePool and would be in deletion state. To recover from this state create a new MachinePool manually referencing the AzureManagedMachinePool, edit the required references and finalizers to link the MachinePool to the AzureManagedMachinePool. In the AzureManagedMachinePool remove the owner reference to the old MachinePool, and set it to the new MachinePool. Once the new MachinePool is pointing to the AzureManagedMachinePool you can delete the old MachinePool. To delete the old MachinePool remove the finalizers in that object. diff --git a/docs/book/src/topics/node-outbound-lb.md b/docs/book/src/topics/node-outbound-connection.md similarity index 53% rename from docs/book/src/topics/node-outbound-lb.md rename to docs/book/src/topics/node-outbound-connection.md index 082671c893b..13de09f3f0e 100644 --- a/docs/book/src/topics/node-outbound-lb.md +++ b/docs/book/src/topics/node-outbound-connection.md @@ -2,11 +2,92 @@ This document describes how to configure your clusters' node outbound traffic. -## Node Outbound Load Balancer +## IPv4 Clusters -### Public Clusters +For IPv4 clusters ie. clusters with CIDR type is `IPv4`, CAPZ automatically configures a [NAT gateway](https://docs.microsoft.com/en-us/azure/virtual-network/nat-gateway-resource) for node outbound traffic with the default settings. Default, the cluster is IPv4 type unless you specify the CIDR to be an IPv6 address. -For public clusters ie. clusters with api server load balancer type set to `Public`, CAPZ automatically configures a node outbound load balancer with the default settings. +To provide custom settings for a node NAT gateway, you can configure the NAT gateway in the node `subnets` section of cluster configuration by setting the NAT gateway's name. A Public IP will also be created for the NAT gateway once the NAT gateway name is provided. + +```yaml +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +kind: AzureCluster +metadata: + name: cluster-natgw + namespace: default +spec: + location: southcentralus + networkSpec: + vnet: + name: my-vnet + subnets: + - name: subnet-cp + role: control-plane + - name: subnet-node + role: node + natGateway: + name: node-natgw + NatGatewayIP: + name: pip-cluster-natgw-subnet-node-natgw + resourceGroup: cluster-natgw + ``` + +You can also specify the Public IP name that should be used when creating the Public IP for the NAT gateway. +If you don't specify it, CAPZ will automatically generate a name for it. + + + +```yaml +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +kind: AzureCluster +metadata: + name: cluster-natgw + namespace: default +spec: + location: southcentralus + networkSpec: + vnet: + name: my-vnet + subnets: + - name: subnet-cp + role: control-plane + - name: subnet-node-1 + role: node + natGateway: + name: node-natgw-1 + NatGatewayIP: + name: pip-cluster-natgw-subnet-node-natgw-1 + - name: subnet-node-2 + role: node + natGateway: + name: node-natgw-2 + NatGatewayIP: + name: pip-cluster-natgw-subnet-node-natgw-2 + resourceGroup: cluster-natgw +``` + + + + +## IPv6 Clusters + +For IPv6 clusters ie. clusters with CIDR type is `IPv6`, NAT gateway is not supported for IPv6 cluster. IPv6 cluster uses load balancer for outbound connections. + +### Public IPv6 Clusters + +For public IPv6 clusters ie. clusters with api server load balancer type set to `Public` and CIDR type set to `IPv6`, CAPZ automatically configures a node outbound load balancer with the default settings. To provide custom settings for the node outbound load balancer, use the `nodeOutboundLB` section in cluster configuration. @@ -34,6 +115,11 @@ spec: networkSpec: apiServerLB: type: Public + subnets: + - cidrBlocks: + - 2001:0DB8:0000:1/64 + name: subnet-node + role: node nodeOutboundLB: frontendIPsCount: 3 idleTimeoutInMinutes: 4 @@ -47,12 +133,12 @@ Only `frontendIPsCount` and `idleTimeoutInMinutes` can be configured for any nod -### Private Clusters +### Private IPv6 Clusters -For private clusters ie. clusters with api server load balancer type set to `Internal`, CAPZ does not create a node outbound load balancer by default. +For private IPv6 clusters ie. clusters with api server load balancer type set to `Internal` and CIDR type set to `IPv6`, CAPZ does not create a node outbound load balancer by default. To create a node outbound load balancer, include the `nodeOutboundLB` section with the desired settings. -Here is an example of configuring a node outbound load balancer with 1 front end ip for a private cluster: +Here is an example of configuring a node outbound load balancer with 1 front end ip for a private IPv6 cluster: ```yaml apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 @@ -65,47 +151,11 @@ spec: networkSpec: apiServerLB: type: Internal + subnets: + - cidrBlocks: + - 2001:0DB8:0000:1/64 + name: subnet-node + role: node nodeOutboundLB: frontendIPsCount: 1 ``` - -## Node Outbound NAT gateway - -You can configure a [NAT gateway](https://docs.microsoft.com/en-us/azure/virtual-network/nat-gateway-resource) in a subnet to enable outbound traffic in the cluster nodes by setting the NAT gateway's name in the subnet configuration. -A Public IP will also be created for the NAT gateway. - -Using this configuration, [a Load Balancer for the nodes outbound traffic](./node-outbound-lb.md) won't be created. - - - -```yaml -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 -kind: AzureCluster -metadata: - name: cluster-natgw - namespace: default -spec: - location: southcentralus - networkSpec: - vnet: - name: my-vnet - subnets: - - name: subnet-cp - role: control-plane - - name: subnet-node - role: node - natGateway: - name: node-natgw - NatGatewayIP: - name: pip-cluster-natgw-subnet-node-natgw - resourceGroup: cluster-natgw - ``` - -You can also define the Public IP name that should be used when creating the Public IP for the NAT gateway. -If you don't specify it, CAPZ will automatically generate a name for it. diff --git a/docs/book/src/topics/ssh-access.md b/docs/book/src/topics/ssh-access.md index e7e56fb932a..87d326dbe18 100644 --- a/docs/book/src/topics/ssh-access.md +++ b/docs/book/src/topics/ssh-access.md @@ -124,7 +124,7 @@ In order to add an SSH authorized key for user `username` and provide `sudo` acc as in the following example: ```yaml -apiVersion: controlplane.cluster.x-k8s.io/v1alpha3 +apiVersion: controlplane.cluster.x-k8s.io/v1beta1 kind: KubeadmControlPlane ... spec: @@ -146,7 +146,7 @@ spec: Similarly, you can achieve the same result for `Machine Deployments` by customizing the `KubeadmConfigTemplate` CR: ```yaml -apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 +apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 kind: KubeadmConfigTemplate metadata: name: test1-md-0 diff --git a/docs/book/src/topics/trusted-launch-for-vms.md b/docs/book/src/topics/trusted-launch-for-vms.md new file mode 100644 index 00000000000..0e3b723c4a8 --- /dev/null +++ b/docs/book/src/topics/trusted-launch-for-vms.md @@ -0,0 +1,65 @@ +# Trusted launch for VMs + +This document describes how to deploy a cluster with nodes that support [trusted launch](https://learn.microsoft.com/azure/virtual-machines/trusted-launch). + +## Limitations + +Before you begin, be aware of the following: + +- [Limitations](https://learn.microsoft.com/en-us/azure/virtual-machines/trusted-launch#limitations) +- [SecureBoot](https://learn.microsoft.com/en-us/azure/virtual-machines/trusted-launch#secure-boot) +- [vTPM](https://learn.microsoft.com/en-us/azure/virtual-machines/trusted-launch#vtpm) + +## Trusted Launch Images + +One of the limitations of trusted launch for VMs is that they require [generation 2](https://learn.microsoft.com/en-us/azure/virtual-machines/generation-2) VMs. + +Trusted launch supported OS images are not included in the list of `capi` reference images. Before creating a cluster hosted on VMs with trusted launch features enabled, you can create a [custom image](custom-images.md) based on a one of the trusted launch supported OS images using [image-builder](https://github.com/kubernetes-sigs/image-builder). For example, you can run the following to create such an image based on Ubuntu Server 22.04 LTS: + +```bash +$ make -C images/capi build-azure-sig-ubuntu-2204-gen2 +# many minutes later... +==> sig-ubuntu-2204-gen2: +Build 'sig-ubuntu-2204-gen2' finished. + +==> Builds finished. The artifacts of successful builds are: +--> sig-ubuntu-2204-gen2: Azure.ResourceManagement.VMImage: + +OSType: Linux +ManagedImageResourceGroupName: cluster-api-images +ManagedImageName: capi-ubuntu-2204-gen2-1684153817 +ManagedImageId: /subscriptions/01234567-89ab-cdef-0123-4567890abcde/resourceGroups/cluster-api-images/providers/Microsoft.Compute/images/capi-ubuntu-2204-gen2-1684153817 +ManagedImageLocation: southcentralus +ManagedImageSharedImageGalleryId: /subscriptions/01234567-89ab-cdef-0123-4567890abcde/resourceGroups/cluster-api-images/providers/Microsoft.Compute/galleries/ClusterAPI/images/capi-ubuntu-2204-gen2/versions/0.3.1684153817 +``` + +## Example + +The below example shows how to deploy a cluster with control-plane nodes that have SecureBoot and vTPM enabled. Make sure to choose a supported generation 2 VM size (e.g. `Standard_B2s`) and OS (e.g. Ubuntu Server 22.04 LTS). +NOTE: the same can be applied to worker nodes + +```yaml +kind: AzureMachineTemplate +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +metadata: + name: capz-trusted-launch-example +spec: + template: + spec: + image: + computeGallery: + subscriptionID: "01234567-89ab-cdef-0123-4567890abcde" + resourceGroup: "cluster-api-images" + gallery: "ClusterAPI" + name: "capi-ubuntu-2204-gen2-1684153817" + version: "0.3.1684153817" + securityProfile: + securityType: "TrustedLaunch" + uefiSettings: + vTpmEnabled: true + secureBootEnabled: true + osDisk: + diskSizeGB: 128 + osType: "Linux" + vmSize: "Standard_B2s" +``` diff --git a/docs/book/src/topics/windows.md b/docs/book/src/topics/windows.md index f5a9b9fd88a..73f4f27e88f 100644 --- a/docs/book/src/topics/windows.md +++ b/docs/book/src/topics/windows.md @@ -81,9 +81,9 @@ The Windows HostProcess Container feature is Alpha for Kubernetes v1.22 and Beta Current requirements: -- Kubernetes 1.22+ +- Kubernetes 1.23+ - containerd 1.6+ -- `WindowsHostProcessContainers` feature-gate (Alpha for v1.22) turned on for kube-apiserver and kubelet if using Kubernetes 1.22 +- `WindowsHostProcessContainers` feature-gate (Beta / on-by-default for v1.23) turned on for kube-apiserver and kubelet These requirements are satisfied by the Windows Containerd Template and Azure Marketplace reference image `cncf-upstream:capi-windows:k8s-1dot22dot1-windows-2019-containerd:2021.10.15` @@ -107,7 +107,7 @@ It's required to specify the SSH key using the `users` property in the Kubeadm c For example like this: ```yaml -apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 +apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 kind: KubeadmConfigTemplate metadata: name: test1-md-0 diff --git a/docs/proposals/20230123-azure-service-operator.md b/docs/proposals/20230123-azure-service-operator.md new file mode 100644 index 00000000000..1b40c989636 --- /dev/null +++ b/docs/proposals/20230123-azure-service-operator.md @@ -0,0 +1,251 @@ +--- +title: Managing Azure Resources with Azure Service Operator +authors: + - "@nojnhuh" +reviewers: + - "@CecileRobertMichon" + - "@jackfrancis" + - "@matthchr" + - "@devigned" + - "@mboersma" +creation-date: 2023-01-23 +last-updated: 2023-02-21 +status: provisional +see-also: + - https://github.com/kubernetes-sigs/cluster-api-provider-azure/issues/416 + - "/docs/proposals/20210716-async-azure-resource-creation-deletion.md" +--- + +# Managing Azure Resources with Azure Service Operator + +## Table of Contents + +- [Managing Azure Resources with Azure Service Operator](#managing-azure-resources-with-azure-service-operator) + - [Table of Contents](#table-of-contents) + - [Glossary](#glossary) + - [Summary](#summary) + - [Motivation](#motivation) + - [Goals](#goals) + - [Non-Goals/Future Work](#non-goalsfuture-work) + - [Proposal](#proposal) + - [User Stories](#user-stories) + - [Story 1 - Users of new Azure features](#story-1---users-of-new-azure-features) + - [Story 2 - Developer experience](#story-2---developer-experience) + - [Implementation Details/Notes/Constraints](#implementation-detailsnotesconstraints) + - [Reconciliation](#reconciliation) + - [API Changes](#api-changes) + - [Installation](#installation) + - [Caveats](#caveats) + - [Security Model](#security-model) + - [Risks and Mitigations](#risks-and-mitigations) + - [Alternatives](#alternatives) + - [Adopt new SDK directly](#adopt-new-sdk-directly) + - [Crossplane](#crossplane) + - [Upgrade Strategy](#upgrade-strategy) + - [Additional Details](#additional-details) + - [Test Plan](#test-plan) + - [Graduation Criteria](#graduation-criteria) + - [Implementation History](#implementation-history) + +## Glossary + +- **Azure Service Operator (ASO)** - ([link](https://azure.github.io/azure-service-operator/)) a collection of Kubernetes CRDs and controllers which extend the Kubernetes API to manage Azure resources like virtual machines and resource groups. +- **Bring-your-own (BYO) resource** - an Azure resource participating in a Cluster API cluster but managed by the user. CAPI and CAPZ should not modify or delete this resource. + +## Summary + +This proposal describes how CAPZ could utilize Azure Service Operator (ASO) to create, read, update, and delete Azure resources via the Kubernetes API using custom resources defined and reconciled by ASO. + +## Motivation + +As a Cluster API infrastructure provider, CAPZ's functionality can be broadly divided into: +1. Translating Cluster API resource definitions into Azure infrastructure definitions +2. Interfacing with the Azure platform to manage creating, updating, and deleting that infrastructure + +Currently, CAPZ handles `2.` with Azure API calls, which requires ensuring dependencies between Azure resources are met and maintaining state to asynchronously handle long-running operations. Because ASO's primary objective is to handle `2.`, CAPZ's controller implementations could then interact with the Kubernetes API declaratively to manage Azure resources through ASO objects and let ASO handle the finer details of ensuring that desired state is achieved in Azure. By then primarily focusing on `1.`, CAPZ reduces its overall code maintenance burden and affirms ASO as the canonical way to manage Azure infrastructure from Kubernetes. + +In addition, the [Azure Go SDK](https://github.com/Azure/azure-sdk-for-go) has recently deprecated its set of APIs that CAPZ currently uses in favor of a new set of backwards-incompatible APIs. Because the deprecated Azure Go SDK APIs are no longer receiving updates to adopt new Azure API versions, CAPZ must adopt the new APIs to be able to expose the newest features in Azure to its users. Because ASO already uses the new APIs, adopting ASO in CAPZ accomplishes the goal of migrating off of the deprecated APIs. + +### Goals + +- Logically separate transformation of Cluster API resources to infrastructure definitions from reconciliation of that infrastructure in Azure +- Determine a method to migrate CAPZ's Azure service interfaces iteratively to use ASO without requiring any single major change affecting every interface +- Determine how ASO will be installed on Cluster API management clusters + +### Non-Goals/Future Work + +- Entirely eliminate direct usage of any Azure Go SDK +- Reconcile long-running Azure operations asynchronously by waiting for + Kubernetes watch events from changes to the `status` of ASO resources instead + of periodically checking if the operation is complete +- Reconcile different Azure resource types for the same workload cluster in parallel +- Allow users to interact with CAPZ-created ASO resources directly, out-of-band with CAPZ +- Adopt Azure Workload Identity to authenticate with Azure APIs +- Deprecate the `status.longRunningOperationStates` field on CAPZ resources + +## Proposal + +### User Stories + +#### Story 1 - Users of new Azure features + +As a CAPZ user I want to take advantage of the latest and greatest features in Azure only available in the newest Azure API versions in my clusters managed by CAPZ. This would allow me to adopt CAPZ for a wider range of use cases and continue evolving my CAPZ clusters alongside the Azure API. + +#### Story 2 - Developer experience + +As a CAPZ developer I would like to only need to interact with the Kubernetes API server using Custom Resource Definitions representing Azure resources rather than having to deal with the impedance of interacting with the Azure APIs. This would enable me to focus more on the core value of CAPZ, transforming Cluster API resource definitions to Azure resource definitions. + +### Implementation Details/Notes/Constraints + +#### Reconciliation + +To minimize impact initially, much of the existing pattern in `/azure/services` for interfacing with Azure services will be reused. The biggest change will involve a new wrapper adjacent to `/azure/services/async` such as `/azure/services/aso` which will handle functionality common to all ASO resources. The following diagram is based on the [async reconciliation diagram](./images/async-reconcile.png) and shows how resources will be reconciled with ASO: + +![Figure 1](./images/aso-reconcile.png) + +Similarly for the [async delete diagram](./images/async-delete.png), the following diagram shows how resources will be deleted with ASO: + +![Figure 2](./images/aso-delete.png) + +A proof-of-concept of the reconciliation flow has been implemented for Azure resource groups and is available here: https://github.com/nojnhuh/cluster-api-provider-azure/tree/aso/azure/services/asogroups + +##### BYO Resources + +BYO resources likely will not exist as ASO resources, so determining whether or not a given expected Azure resource exists becomes less straightforward using ASO. Initially, both BYO and CAPZ-managed resources will be created in ASO with ASO's `serviceoperator.azure.com/reconcile-policy: skip` label which tells ASO not to make any changes to the corresponding Azure resource, essentially assuming the resource is BYO. ASO will then perform a GET request against the Azure API to fill in the resource's `status`, which may indicate the resource does not exist with a status condition with a `reason: AzureResourceNotFound`. Then, if a future CAPZ reconciliation reveals the Azure resource does not exist, CAPZ will change its assumption and make ASO "adopt" the resource by setting `serviceoperator.azure.com/reconcile-policy: manage` to allow changes made to the ASO resource to be reflected in Azure. + +#### API Changes + +Integration with ASO will not require any updates to CAPZ resources and CAPZ's CRDs will not require any updates. The only potentially user-affecting change is that the `status.longRunningOperationStates` on CAPZ resources will no longer be populated. This field is currently set for CAPZ's internal use to inform the `status.conditions` of the resource. With ASO, a CAPZ resource's `status.conditions` will now be derived from ASO resources' `status.conditions`. + +#### Installation + +ASO is a self-contained component published independently of CAPZ. When CAPZ is relying on ASO for critical functionality, CAPZ's installation process should also automatically install ASO. + +When installing CAPZ with `clusterctl init`, the Kubernetes resources defined by CAPZ's `infrastructure-components.yaml` published on the corresponding release are installed. ASO can also be [installed with a YAML manifest](https://azure.github.io/azure-service-operator/guide/installing-from-yaml/) published for each of its releases describing its components that can be incorporated with CAPZ's `infrastructure-components.yaml`. This method installs ASO in the `azureserviceoperator-system` namespace and expects a Secret named `aso-controller-settings` to exist with Service Principal credentials. The easiest and most flexible way to customize that manifest further would likely be to generate a manifest from ASO's Helm chart with any necessary values overridden. + +Other than integrating with CAPZ's `infrastructure-components.yaml`, the `capz-controller-manager` container itself could assume responsibility for installing ASO by using the Helm Go library to install the ASO chart when it starts. Installing ASO this way allows CAPZ to hook in additional logic, such as to check if ASO is already installed in the cluster or to verify ASO is healthy after it's installed, which would not be possible if a static manifest was embedded in `infrastructure-components.yaml`. However, installing ASO components from CAPZ itself would also require CAPZ to have additional RBAC permissions to create, update, and delete ASO's Deployment, Service, and other components which would not be required if the components were managed from `infrastructure-components.yaml`. + +For either method of installing the rest of ASO, ASO's CRDs will be installed from `infrastructure-components.yaml` to more easily facilitate `clusterctl move` and to keep the `capz-controller-manager` Pod from requiring RBAC permissions to create, update, and delete CRDs. + +In terms of specific options, ASO offers both [single- and multi-operator configurations](https://azure.github.io/azure-service-operator/guide/authentication/multitenant-deployment/). The single-operator option is the default, and assumes a single ASO installation managing resources for the whole cluster. The multi-operator method allows several ASO installations to coexist, each monitoring resources in a unique set of namespaces to enable multitenancy. ASO's single-operator configuration also allows multitenancy with more tightly-scoped credentials. Overall, a single ASO installation will likely be the easier path forward since it's consistent with CAPZ's multitenancy model and doesn't involve managing ASO's CRDs and webhooks across multiple installations. + +The recommendation in this proposal is to install a single-operator, ["reduced permissions"](https://azure.github.io/azure-service-operator/design/adr-2023-02-helm-chart-size-limitations/#decision) configuration of ASO entirely from `infrastructure-components.yaml` to keep CAPZ from needing any new RBAC permissions to install ASO and to align with how CAPZ handles its existing dependency on AAD Pod Identity. + +#### `clusterctl move` + +`clusterctl move` is expected to work automatically following ASO's [documented best practices](https://azure.github.io/azure-service-operator/guide/frequently-asked-questions/#what-is-the-best-practice-for-transferring-aso-resources-from-one-cluster-to-another) to move its resources pending a solution to this issue in Cluster API: https://github.com/kubernetes-sigs/cluster-api/issues/8473 + +### Security Model + +ASO requires credentials to interact with Azure which are documented here: https://azure.github.io/azure-service-operator/guide/authentication/. Specifically, ASO needs the values of `$AZURE_CLIENT_ID`, `$AZURE_CLIENT_SECRET` or `$AZURE_CLIENT_CERTIFICATE`, `$AZURE_SUBSCRIPTION_ID`, and `$AZURE_TENANT_ID` for Service Principal authentication. These credentials must be defined in a Kubernetes Secret that either applies to all ASO resources in all namespaces, all ASO resources in a particular namespace, or individual ASO resources referring to the Secret in its `serviceoperator.azure.com/credential-from` annotation. ASO allows different credentials to be used for different resources to enable multitenancy, similar to CAPZ and its AzureClusterIdentity. To mediate between the two mechanisms, CAPZ will ensure a cluster's AzureClusterIdentity or default parameters from environment variables are reflected in a Secret to be used by ASO and ensure each ASO resource it manages is created with the annotation pointing to the Secret. + +Consumers of ASO's APIs (such as CAPZ) also need Kubernetes RBAC permissions to interact with ASO resources. For example, this ClusterRole snippet is required by CAPZ to manage resource groups with ASO: +```yaml +- apiGroups: + - resources.azure.com + resources: + - resourcegroups + - resourcegroups/status + verbs: + - get + - list + - watch + - create + - update + - delete +``` +The above permissions may overlap with ASO resources already installed by a user not intended to be managed by CAPZ. + +### Risks and Mitigations + +The most immediate risks with adopting ASO are regressions of various forms. Firstly, Azure API calls are core to CAPZ's functionality, so even small behavioral differences may cause issues preventing Azure resources from being reconciled as expected. Next, the modified reconciliation flow may cause operations against workload clusters to take longer to complete, in particular if it takes more reconciliations to perform a task. Finally, integration with ASO may introduce new or worsen existing bottlenecks limiting how many CAPZ resources can be managed. Scaling bottlenecks might be Azure API rate limits or management cluster Kubernetes API server load because of the increased number of CRDs and custom Kubernetes resources required to represent each individual Azure resource making up Cluster API clusters. These risks will be monitored closely as described in the [Test Plan](#test-plan). Any significant regressions found can be rolled back backwards-compatibly by reverting the relevant changes. + +Along those same lines, there is a risk that if a service is implemented both with the SDK and with ASO in different supported versions of CAPZ, then the fix for an issue affecting both versions will need to be implemented separately for each version. Such issues are not expected to be common given the implementation for each ASO service is expected to be mostly disjoint from its SDK-based implementation. When they do arise, however, the cost of the extra work required for a second implementation of a fix will be accepted since the risk will only be present for a few months at most as newer CAPZ releases push SDK-backed service implementations out of support. + +Another shorter-term risk is that although ASO v2 is [officially supported by Microsoft](https://azure.github.io/azure-service-operator/guide/frequently-asked-questions/#what-is-the-support-model), it has not yet published a GA release. The remaining work to be completed before ASO v2's first GA release is being tracked here: https://github.com/Azure/azure-service-operator/milestone/20. + +Similarly, ASO does not currently support some Azure services used by CAPZ currently which are being tracked here: https://github.com/Azure/azure-service-operator/issues/2237. If a service is not yet implemented in ASO by the time CAPZ is ready for it, a track 2 SDK-backed implementation can be added instead. Additionally, some Azure services like Resource Health do not represent infrastructure and therefore don't closely align with ASO's model for creating, updating, and deleting resources. If those kinds of services are determined not to ever be a good fit for ASO, then SDK-backed implementations for those interfaces could be added as well. + +Further down the road, there is an apparent increased risk that CAPZ's lifespan may extend beyond that of its Azure interface when ASO is used instead of the API or SDK directly, as ASO has not yet been proven as a mission-critical interface to Azure to the same extent as Azure's REST API and Go SDK. + +Since ASO can be freely installed by users, there is also a risk that a CAPZ-installed ASO may conflict with a user-installed instance. Before CAPZ installs ASO, it should verify that ASO is already either not installed or installed and configured as expected by CAPZ. + +The difference between CAPZ's and ASO's metrics stories may also be considered a risk. CAPZ's metrics currently include traces that measure how long each step in a reconciliation takes, including all Azure API calls. Once those equivalent API calls are being done from ASO instead of CAPZ, CAPZ's metrics will lose that data. However, that lost data may no longer be meaningful to CAPZ since Azure API calls will be happening out-of-band with CAPZ reconciliations. ASO does measure how many Azure API calls are made and how long each takes and exposes those in the Prometheus format, along with other metrics as documented at https://azure.github.io/azure-service-operator/guide/metrics/. However, users relying on the current structure of metrics will likely experience breaking changes. + +Dependency on ASO may also negatively impact the time between new features being available in Azure and CAPZ being able to take advantage of them. Although ASO can publish updated CRDs with new Azure API versions independently from the SDK, a few factors contribute to the likelihood of ASO lagging a bit behind the SDK: +- The Azure SDK's code generation pipeline is currently more mature than ASO's. +- The SDK ships one package at a time whereas ASO ships all resources together, which could result in scenarios where some resources may have updated API versions but are waiting on other unrelated resources to be updated so ASO can batch several updates into a single release. +- ASO provides some features not included in the SDK, like populating ConfigMaps and Secrets with credentials and other outputs from provisioning, and implementing those features is not automatic. +- Resource types generated for the SDK occasionally cannot be represented as Kubernetes types for ASO, like resources that are potentially infinitely recursive. + +This risk that newer features may not be available as quickly is mitigated by the historical precedent that CAPZ has not often been blocked on adding new features because no SDK includes the newest API versions yet. CAPZ's current cadence of adding new features to releases every two months also provides a buffer which means even if the SDK makes a new feature available before ASO, CAPZ's next feature release may not be scheduled until after the feature is available from both and implemented in CAPZ. + +## Alternatives + +### Adopt new SDK directly + +To shed its dependency on the deprecated Azure Go SDK, CAPZ could adopt the new Azure Go SDK and use it directly instead of transitively through ASO. The newer SDK's concepts like how Azure resources are defined and operated against map much more directly to those of the older SDK, so a transition to using the newer SDK directly is likely much more mechanical than a similar move to ASO. A simpler transition would not be as prone to many of the risks listed above, particularly the risk of introducing regressions. It would also likely take less time to complete, mitigating any risks and reducing maintenance costs associated with using both the old and new patterns at the same time in different service implementations. + +The new Go SDK also separates each Azure service (containerservice, network, etc.) into distinct Go modules, where each module version maps to a single Azure API version. Modules for stable APIs use semantic versions like "v1.0.0" while for preview APIs they have pre-release versions like "v1.0.0-beta.1" with the same major version as the stable API. This would make it difficult to use different API versions side-by-side, like a preview and stable version for https://github.com/kubernetes-sigs/cluster-api-provider-azure/issues/2625, since the Go toolchain likely will never natively support importing two different minor/patch versions of the same module: https://github.com/golang/go/issues/31578. ASO instead exposes multiple Azure API versions in each of its releases with different Kubernetes API versions of its types, so CAPZ can use a single version of ASO to gain access to several Azure API versions more easily than with the SDK directly. + +CAPZ is currently also experimenting with this approach and that effort is being tracked in this issue: https://github.com/kubernetes-sigs/cluster-api-provider-azure/issues/2670 + +### Crossplane + +Another alternative is [Crossplane](https://www.crossplane.io/), a CNCF project which is a set of Kubernetes controllers and Custom Resource Definitions like ASO that define and operate on resources for Azure and other cloud providers. A number of factors indicate that ASO may be a better fit for CAPZ: +- CRD definitions generated from the Azure Terraform provider maintained by + HashiCorp, which may not keep up with changes as fast as the Azure API swagger + specification from which ASO generates its definitions +- Still using the [deprecated Azure Go SDK](https://github.com/crossplane/crossplane/blob/08f11debb66cdf10ff0ddd14f1ee23aa9b4489b1/go.mod#L46-L55), no apparent plans to update +- [Open issue](https://github.com/upbound/provider-azure/issues/94) to support workload identity, which ASO already handles + +## Upgrade Strategy + +There are two main upgrade paths CAPZ needs to consider: the first between a version of CAPZ that does not use ASO to one that does, and the second between two versions of CAPZ that use different versions of ASO. + +During the initial adoption of ASO, CAPZ's ASO-based [reconciliation flow](#reconciliation) will automatically adopt resources previously managed by CAPZ. This would be based on the `sigs.k8s.io_cluster-api-provider-azure_cluster_*` tag for Azure resources types that are known to possibly have the tag. CAPZ currently reconciles some Azure resources that either do not have the tag or cannot have tags at all, so some custom logic will be necessary to fill the gap. Affected resource types include the following: +- Agent pools +- Disks +- Inbound NAT rules +- Managed clusters +- Role assignments +- Subnets +- VM extensions +- Virtual network peerings + +All of the resource types above are always assumed to be owned by CAPZ except for subnets, whose status is derived from its owning virtual network. + +After that, a CAPZ upgrade may include a bump in the API version used for some ASO resource types. ASO will handle those changes transparently from CAPZ's perspective with its own conversion webhooks. The limit on the size of Kubernetes resources will likely force ASO to remove certain API versions of resources in CRDs in the future. When a version is deprecated in ASO, CAPZ will have to upgrade its use of the resource to a newer API version. + +Separate from API version upgrades of resources, upgrades to ASO itself may be included in new versions of CAPZ. [ASO's documentation](https://azure.github.io/azure-service-operator/guide/upgrading/) recommends upgrading using the same mechanism used to initially install. At the same time when CAPZ installs ASO, it will also upgrade an existing ASO it installed if necessary. + +## Additional Details + +### Test Plan + +Adoption of ASO to manage Azure infrastructure is at the core of CAPZ's functionality. As such, changes made to integrate ASO must be thoroughly tested. + +e2e tests will give the best indication if any regressions are introduced. Because no user-facing changes to CAPZ are expected as a result of integrating with ASO, all of the existing e2e tests will not need any changes to continue providing the same value they do already and do not need to compensate for the transition period where ASO is only partially integrated. New tests or additions to the test framework may include the following: +- a checkpoint when installing CAPZ in the framework that ASO is also installed and healthy +- upgrade tests from a version of CAPZ that does not use ASO to one that does, + verifying that CAPZ-managed and unmanaged Azure resources become correctly + reflected in ASO after the upgrade +- a test to verify when a CAPZ upgrade includes an upgrade of the ASO control plane +- a test to verify when a CAPZ upgrade includes a newer API version of an ASO resource + +To catch performance and scalability regressions, one-off tests against CAPZ instances managing many and/or large workload clusters will also be performed. Telemetry will be inspected to ensure the time it takes to reconcile a high volume of clusters and the overhead required in the management cluster to run ASO are still acceptable. + +Finally, unit tests will be added to cover tightly-scoped functional changes related to ASO adoption, like error handling. + +### Graduation Criteria + +ASO integration will not be kept behind a feature flag or matriculate through the usual alpha, beta, and stable phases. Instead, the transition will be made gradually so as to distribute potential impact over time. + +Each Azure service package, such as `virtualmachines` or `loadbalancers` can be transitioned separately from using the SDK to ASO. The transition for a package will be made in one atomic change, so the SDK- and ASO-based implementations will never exist side-by-side for a given service. However, there will be a period of time where the SDK and ASO are driving mutually exclusive sets of services at the same time, and that time span may include several releases of CAPZ. If significant regressions are found in a particular service implementation, that service (and others that rely on it) can be rolled back in isolation to the SDK-based implementation independently of unaffected services. + +Since the transition for each service is expected to take some time, it's worth considering which services to transition first. Because of how some ASO resource types reference each other, some ordering will be necessary. For example, a VirtualNetworksSubnet's `spec.owner` refers to the Kubernetes name of the owning ASO VirtualNetwork, so the `virtualnetworks` service would be implemented to use ASO before the same is done for `subnets`. When no ordering is otherwise necessary, the priority to implement each service will be based on new features which are blocked on newer Azure API versions available in ASO but not the SDK and also community involvement. + +## Implementation History + +- [ ] 01/23/2023: Document first created +- [ ] 02/21/2023: First complete draft of this document finished diff --git a/docs/proposals/images/aso-delete.plantuml b/docs/proposals/images/aso-delete.plantuml new file mode 100644 index 00000000000..a32fe0a5f63 --- /dev/null +++ b/docs/proposals/images/aso-delete.plantuml @@ -0,0 +1,15 @@ +@startuml +title Figure 2. Deleting Azure resources through ASO + +state deleteerr <> +state resourcenotfound <> + +[*] --> Delete +Delete : DELETE the resource from ASO +Delete --> deleteerr +deleteerr --> [*] : delete started\nsuccessfully, requeue +deleteerr --> resourcenotfound : an error occurred +resourcenotfound --> [*] : resource doesn't\nexist, delete done +resourcenotfound --> [*] : a different error\noccurred, requeue + +@enduml diff --git a/docs/proposals/images/aso-delete.png b/docs/proposals/images/aso-delete.png new file mode 100644 index 00000000000..51d4197acf2 Binary files /dev/null and b/docs/proposals/images/aso-delete.png differ diff --git a/docs/proposals/images/aso-reconcile.plantuml b/docs/proposals/images/aso-reconcile.plantuml new file mode 100644 index 00000000000..a8c6b56c654 --- /dev/null +++ b/docs/proposals/images/aso-reconcile.plantuml @@ -0,0 +1,34 @@ +@startuml +title Figure 1. Reconciling Azure resources through ASO + +[*] --> GetExisting +GetExisting : GET the ASO resource if it exists +SetReconcilePolicySkip : set the ASO reconcile policy annotation +GetExisting --> SetReconcilePolicySkip : resource does not exist +SetReconcilePolicySkip --> CreateOrUpdate + +state asoresourceready <> +state asoresourcenotfound <> +state asoresourceskip <> + +state capzownedtag <> + +GetExisting --> asoresourceready : ASO resource exists +asoresourceready --> capzownedtag : ASO resource is ready +capzownedtag --> SetReconcilePolicyManage : Azure resource has\nCAPZ "owned" tag +capzownedtag --> CreateOrUpdate : Azure resource has no\nCAPZ "owned" tag +asoresourceready --> asoresourcenotfound : ASO resource is not Ready +asoresourcenotfound --> UpdateStatus : non-"not found" Azure error +asoresourcenotfound --> asoresourceskip : Azure resource doesn't exist +asoresourceskip --> UpdateStatus : reconcile-policy is "manage" +SetReconcilePolicyManage : set the ASO reconcile policy annotation +asoresourceskip --> SetReconcilePolicyManage : reconcile-policy is "skip" +SetReconcilePolicyManage --> CreateOrUpdate + +CreateOrUpdate : PUT the resource to ASO +CreateOrUpdate --> UpdateStatus +UpdateStatus : update the resource spec and status +UpdateStatus : update the object conditions +UpdateStatus --> [*] + +@enduml diff --git a/docs/proposals/images/aso-reconcile.png b/docs/proposals/images/aso-reconcile.png new file mode 100644 index 00000000000..ebc3e55cc31 Binary files /dev/null and b/docs/proposals/images/aso-reconcile.png differ diff --git a/exp/PROJECT b/exp/PROJECT index 2345197f0dc..74e3b27b1d5 100644 --- a/exp/PROJECT +++ b/exp/PROJECT @@ -4,7 +4,4 @@ version: "2" resources: - group: infrastructure kind: AzureMachinePool - version: v1alpha3 -- group: infrastructure - kind: AzureMachinePool - version: v1alpha4 + version: v1beta1 diff --git a/exp/api/v1alpha3/azuremachinepool_conversion.go b/exp/api/v1alpha3/azuremachinepool_conversion.go deleted file mode 100644 index 32550eebad1..00000000000 --- a/exp/api/v1alpha3/azuremachinepool_conversion.go +++ /dev/null @@ -1,186 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha3 - -import ( - unsafe "unsafe" - - "k8s.io/apimachinery/pkg/api/resource" - convert "k8s.io/apimachinery/pkg/conversion" - infrav1alpha3 "sigs.k8s.io/cluster-api-provider-azure/api/v1alpha3" - infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" - infrav1exp "sigs.k8s.io/cluster-api-provider-azure/exp/api/v1beta1" - utilconversion "sigs.k8s.io/cluster-api/util/conversion" - "sigs.k8s.io/controller-runtime/pkg/conversion" -) - -// ConvertTo converts this AzureMachinePool to the Hub version (v1beta1). -func (src *AzureMachinePool) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*infrav1exp.AzureMachinePool) - if err := Convert_v1alpha3_AzureMachinePool_To_v1beta1_AzureMachinePool(src, dst, nil); err != nil { - return err - } - - // Manually restore data. - restored := &infrav1exp.AzureMachinePool{} - if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { - return err - } - - // Handle special case for conversion of ManagedDisk to pointer. - if restored.Spec.Template.OSDisk.ManagedDisk == nil && dst.Spec.Template.OSDisk.ManagedDisk != nil { - if *dst.Spec.Template.OSDisk.ManagedDisk == (infrav1.ManagedDiskParameters{}) { - // restore nil value if nothing has changed since conversion - dst.Spec.Template.OSDisk.ManagedDisk = nil - } - } - - //nolint:staticcheck // SubnetName is now deprecated, but the v1beta1 defaulting webhook will migrate it to the networkInterfaces field - dst.Spec.Template.SubnetName = restored.Spec.Template.SubnetName - - dst.Spec.Strategy.Type = restored.Spec.Strategy.Type - if restored.Spec.Strategy.RollingUpdate != nil { - if dst.Spec.Strategy.RollingUpdate == nil { - dst.Spec.Strategy.RollingUpdate = &infrav1exp.MachineRollingUpdateDeployment{} - } - - dst.Spec.Strategy.RollingUpdate.DeletePolicy = restored.Spec.Strategy.RollingUpdate.DeletePolicy - } - - if restored.Spec.NodeDrainTimeout != nil { - dst.Spec.NodeDrainTimeout = restored.Spec.NodeDrainTimeout - } - - if restored.Status.Image != nil { - dst.Status.Image = restored.Status.Image - } - - if restored.Spec.Template.Image != nil && restored.Spec.Template.Image.SharedGallery != nil { - dst.Spec.Template.Image.SharedGallery.Offer = restored.Spec.Template.Image.SharedGallery.Offer - dst.Spec.Template.Image.SharedGallery.Publisher = restored.Spec.Template.Image.SharedGallery.Publisher - dst.Spec.Template.Image.SharedGallery.SKU = restored.Spec.Template.Image.SharedGallery.SKU - } - - if dst.Spec.Template.Image != nil && restored.Spec.Template.Image.ComputeGallery != nil { - dst.Spec.Template.Image.ComputeGallery = restored.Spec.Template.Image.ComputeGallery - } - - if restored.Spec.Template.NetworkInterfaces != nil { - dst.Spec.Template.NetworkInterfaces = restored.Spec.Template.NetworkInterfaces - } - - if len(dst.Annotations) == 0 { - dst.Annotations = nil - } - - for i, r := range restored.Status.LongRunningOperationStates { - if r.Name == dst.Status.LongRunningOperationStates[i].Name { - dst.Status.LongRunningOperationStates[i].ServiceName = r.ServiceName - } - } - - if len(restored.Spec.Template.VMExtensions) > 0 { - dst.Spec.Template.VMExtensions = restored.Spec.Template.VMExtensions - } - - if restored.Spec.Template.SpotVMOptions != nil && restored.Spec.Template.SpotVMOptions.EvictionPolicy != nil { - dst.Spec.Template.SpotVMOptions.EvictionPolicy = restored.Spec.Template.SpotVMOptions.EvictionPolicy - } - - if restored.Spec.Template.Diagnostics != nil { - dst.Spec.Template.Diagnostics = restored.Spec.Template.Diagnostics - } - - // Restore orchestration mode - dst.Spec.OrchestrationMode = restored.Spec.OrchestrationMode - - if restored.Spec.SystemAssignedIdentityRole != nil { - dst.Spec.SystemAssignedIdentityRole = restored.Spec.SystemAssignedIdentityRole - } - - return nil -} - -// ConvertFrom converts from the Hub version (v1beta1) to this version. -func (dst *AzureMachinePool) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*infrav1exp.AzureMachinePool) - if err := Convert_v1beta1_AzureMachinePool_To_v1alpha3_AzureMachinePool(src, dst, nil); err != nil { - return err - } - - // Preserve Hub data on down-conversion. - return utilconversion.MarshalData(src, dst) -} - -// Convert_v1beta1_AzureMachinePoolMachineTemplate_To_v1alpha3_AzureMachinePoolMachineTemplate converts an Azure Machine Pool Machine Template from v1beta1 to v1alpha3. -func Convert_v1beta1_AzureMachinePoolMachineTemplate_To_v1alpha3_AzureMachinePoolMachineTemplate(in *infrav1exp.AzureMachinePoolMachineTemplate, out *AzureMachinePoolMachineTemplate, s convert.Scope) error { - return autoConvert_v1beta1_AzureMachinePoolMachineTemplate_To_v1alpha3_AzureMachinePoolMachineTemplate(in, out, s) -} - -// Convert_v1beta1_AzureMachinePoolSpec_To_v1alpha3_AzureMachinePoolSpec converts an Azure Machine Pool Spec from v1beta1 to v1alpha3. -func Convert_v1beta1_AzureMachinePoolSpec_To_v1alpha3_AzureMachinePoolSpec(in *infrav1exp.AzureMachinePoolSpec, out *AzureMachinePoolSpec, s convert.Scope) error { - return autoConvert_v1beta1_AzureMachinePoolSpec_To_v1alpha3_AzureMachinePoolSpec(in, out, s) -} - -// Convert_v1beta1_AzureMachinePoolStatus_To_v1alpha3_AzureMachinePoolStatus converts an Azure Machine Pool Status from v1beta1 to v1alpha3. -func Convert_v1beta1_AzureMachinePoolStatus_To_v1alpha3_AzureMachinePoolStatus(in *infrav1exp.AzureMachinePoolStatus, out *AzureMachinePoolStatus, s convert.Scope) error { - if len(in.LongRunningOperationStates) > 0 { - if out.LongRunningOperationState == nil { - out.LongRunningOperationState = &infrav1alpha3.Future{} - } - if err := infrav1alpha3.Convert_v1beta1_Future_To_v1alpha3_Future(&in.LongRunningOperationStates[0], out.LongRunningOperationState, s); err != nil { - return err - } - } - return autoConvert_v1beta1_AzureMachinePoolStatus_To_v1alpha3_AzureMachinePoolStatus(in, out, s) -} - -// Convert_v1alpha3_AzureMachinePoolStatus_To_v1beta1_AzureMachinePoolStatus converts an Azure Machine Pool Status from v1alpha3 to v1beta1. -func Convert_v1alpha3_AzureMachinePoolStatus_To_v1beta1_AzureMachinePoolStatus(in *AzureMachinePoolStatus, out *infrav1exp.AzureMachinePoolStatus, s convert.Scope) error { - if in.LongRunningOperationState != nil { - f := infrav1.Future{} - if err := infrav1alpha3.Convert_v1alpha3_Future_To_v1beta1_Future(in.LongRunningOperationState, &f, s); err != nil { - return err - } - out.LongRunningOperationStates = []infrav1.Future{f} - } - return autoConvert_v1alpha3_AzureMachinePoolStatus_To_v1beta1_AzureMachinePoolStatus(in, out, s) -} - -// Convert_v1beta1_SpotVMOptions_To_v1alpha3_SpotVMOptions converts a SpotVMOptions from v1beta1 to v1alpha3. -func Convert_v1beta1_SpotVMOptions_To_v1alpha3_SpotVMOptions(in *infrav1.SpotVMOptions, out *infrav1alpha3.SpotVMOptions, s convert.Scope) error { - out.MaxPrice = (*resource.Quantity)(unsafe.Pointer(in.MaxPrice)) - return nil -} - -// Convert_v1alpha3_SpotVMOptions_To_v1beta1_SpotVMOptions converts a SpotVMOptions from v1alpha3 to v1beta1. -func Convert_v1alpha3_SpotVMOptions_To_v1beta1_SpotVMOptions(in *infrav1alpha3.SpotVMOptions, out *infrav1.SpotVMOptions, s convert.Scope) error { - out.MaxPrice = (*resource.Quantity)(unsafe.Pointer(in.MaxPrice)) - return nil -} - -// ConvertTo converts this AzureMachinePoolList to the Hub version (v1beta1). -func (src *AzureMachinePoolList) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*infrav1exp.AzureMachinePoolList) - return Convert_v1alpha3_AzureMachinePoolList_To_v1beta1_AzureMachinePoolList(src, dst, nil) -} - -// ConvertFrom converts from the Hub version (v1beta1) to this version. -func (dst *AzureMachinePoolList) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*infrav1exp.AzureMachinePoolList) - return Convert_v1beta1_AzureMachinePoolList_To_v1alpha3_AzureMachinePoolList(src, dst, nil) -} diff --git a/exp/api/v1alpha3/azuremachinepool_types.go b/exp/api/v1alpha3/azuremachinepool_types.go deleted file mode 100644 index a4f45e2e857..00000000000 --- a/exp/api/v1alpha3/azuremachinepool_types.go +++ /dev/null @@ -1,255 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -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 v1alpha3 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - infrav1alpha3 "sigs.k8s.io/cluster-api-provider-azure/api/v1alpha3" - clusterv1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3" - "sigs.k8s.io/cluster-api/errors" -) - -type ( - // AzureMachinePoolMachineTemplate defines the template for an AzureMachinePool machine. - AzureMachinePoolMachineTemplate struct { - // VMSize is the size of the Virtual Machine to build. - // See https://docs.microsoft.com/en-us/rest/api/compute/virtualmachines/createorupdate#virtualmachinesizetypes - VMSize string `json:"vmSize"` - - // Image is used to provide details of an image to use during Virtual Machine creation. - // If image details are omitted the image will default the Azure Marketplace "capi" offer, - // which is based on Ubuntu. - // +kubebuilder:validation:nullable - // +optional - Image *infrav1alpha3.Image `json:"image,omitempty"` - - // OSDisk contains the operating system disk information for a Virtual Machine - OSDisk infrav1alpha3.OSDisk `json:"osDisk"` - - // DataDisks specifies the list of data disks to be created for a Virtual Machine - // +optional - DataDisks []infrav1alpha3.DataDisk `json:"dataDisks,omitempty"` - - // SSHPublicKey is the SSH public key string base64 encoded to add to a Virtual Machine - SSHPublicKey string `json:"sshPublicKey"` - - // AcceleratedNetworking enables or disables Azure accelerated networking. If omitted, it will be set based on - // whether the requested VMSize supports accelerated networking. - // If AcceleratedNetworking is set to true with a VMSize that does not support it, Azure will return an error. - // +optional - AcceleratedNetworking *bool `json:"acceleratedNetworking,omitempty"` - - // TerminateNotificationTimeout enables or disables VMSS scheduled events termination notification with specified timeout - // allowed values are between 5 and 15 (mins) - // +optional - TerminateNotificationTimeout *int `json:"terminateNotificationTimeout,omitempty"` - - // SecurityProfile specifies the Security profile settings for a virtual machine. - // +optional - SecurityProfile *infrav1alpha3.SecurityProfile `json:"securityProfile,omitempty"` - - // SpotVMOptions allows the ability to specify the Machine should use a Spot VM - // +optional - SpotVMOptions *infrav1alpha3.SpotVMOptions `json:"spotVMOptions,omitempty"` - } - - // AzureMachinePoolSpec defines the desired state of AzureMachinePool. - AzureMachinePoolSpec struct { - // Location is the Azure region location e.g. westus2 - Location string `json:"location"` - - // Template contains the details used to build a replica virtual machine within the Machine Pool. - Template AzureMachinePoolMachineTemplate `json:"template"` - - // AdditionalTags is an optional set of tags to add to an instance, in addition to the ones added by default by the - // Azure provider. If both the AzureCluster and the AzureMachine specify the same tag name with different values, the - // AzureMachine's value takes precedence. - // +optional - AdditionalTags infrav1alpha3.Tags `json:"additionalTags,omitempty"` - - // ProviderID is the identification ID of the Virtual Machine Scale Set - // +optional - ProviderID string `json:"providerID,omitempty"` - - // ProviderIDList are the identification IDs of machine instances provided by the provider. - // This field must match the provider IDs as seen on the node objects corresponding to a machine pool's machine instances. - // +optional - ProviderIDList []string `json:"providerIDList,omitempty"` - - // Identity is the type of identity used for the Virtual Machine Scale Set. - // The type 'SystemAssigned' is an implicitly created identity. - // The generated identity will be assigned a Subscription contributor role. - // The type 'UserAssigned' is a standalone Azure resource provided by the user - // and assigned to the VM - // +kubebuilder:default=None - // +optional - Identity infrav1alpha3.VMIdentity `json:"identity,omitempty"` - - // UserAssignedIdentities is a list of standalone Azure identities provided by the user - // The lifecycle of a user-assigned identity is managed separately from the lifecycle of - // the AzureMachinePool. - // See https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/how-to-manage-ua-identity-cli - // +optional - UserAssignedIdentities []infrav1alpha3.UserAssignedIdentity `json:"userAssignedIdentities,omitempty"` - - // RoleAssignmentName is the name of the role assignment to create for a system assigned identity. It can be any valid GUID. - // If not specified, a random GUID will be generated. - // +optional - RoleAssignmentName string `json:"roleAssignmentName,omitempty"` - } - - // AzureMachinePoolStatus defines the observed state of AzureMachinePool. - AzureMachinePoolStatus struct { - // Ready is true when the provider resource is ready. - // +optional - Ready bool `json:"ready"` - - // Replicas is the most recently observed number of replicas. - // +optional - Replicas int32 `json:"replicas"` - - // Instances is the VM instance status for each VM in the VMSS - // +optional - Instances []*AzureMachinePoolInstanceStatus `json:"instances,omitempty"` - - // Version is the Kubernetes version for the current VMSS model - // +optional - Version string `json:"version"` - - // ProvisioningState is the provisioning state of the Azure virtual machine. - // +optional - ProvisioningState *infrav1alpha3.VMState `json:"provisioningState,omitempty"` - - // FailureReason will be set in the event that there is a terminal problem - // reconciling the MachinePool and will contain a succinct value suitable - // for machine interpretation. - // - // This field should not be set for transitive errors that a controller - // faces that are expected to be fixed automatically over - // time (like service outages), but instead indicate that something is - // fundamentally wrong with the MachinePool's spec or the configuration of - // the controller, and that manual intervention is required. Examples - // of terminal errors would be invalid combinations of settings in the - // spec, values that are unsupported by the controller, or the - // responsible controller itself being critically misconfigured. - // - // Any transient errors that occur during the reconciliation of MachinePools - // can be added as events to the MachinePool object and/or logged in the - // controller's output. - // +optional - FailureReason *errors.MachineStatusError `json:"failureReason,omitempty"` - - // FailureMessage will be set in the event that there is a terminal problem - // reconciling the MachinePool and will contain a more verbose string suitable - // for logging and human consumption. - // - // This field should not be set for transitive errors that a controller - // faces that are expected to be fixed automatically over - // time (like service outages), but instead indicate that something is - // fundamentally wrong with the MachinePool's spec or the configuration of - // the controller, and that manual intervention is required. Examples - // of terminal errors would be invalid combinations of settings in the - // spec, values that are unsupported by the controller, or the - // responsible controller itself being critically misconfigured. - // - // Any transient errors that occur during the reconciliation of MachinePools - // can be added as events to the MachinePool object and/or logged in the - // controller's output. - // +optional - FailureMessage *string `json:"failureMessage,omitempty"` - - // Conditions defines current service state of the AzureMachinePool. - // +optional - Conditions clusterv1alpha3.Conditions `json:"conditions,omitempty"` - - // LongRunningOperationState saves the state for an Azure long running operations so it can be continued on the - // next reconciliation loop. - // +optional - LongRunningOperationState *infrav1alpha3.Future `json:"longRunningOperationState,omitempty"` - } - - // AzureMachinePoolInstanceStatus provides status information for each instance in the VMSS. - AzureMachinePoolInstanceStatus struct { - // Version defines the Kubernetes version for the VM Instance - // +optional - Version string `json:"version"` - - // ProvisioningState is the provisioning state of the Azure virtual machine instance. - // +optional - ProvisioningState *infrav1alpha3.VMState `json:"provisioningState"` - - // ProviderID is the provider identification of the VMSS Instance - // +optional - ProviderID string `json:"providerID"` - - // InstanceID is the identification of the Machine Instance within the VMSS - // +optional - InstanceID string `json:"instanceID"` - - // InstanceName is the name of the Machine Instance within the VMSS - // +optional - InstanceName string `json:"instanceName"` - - // LatestModelApplied indicates the instance is running the most up-to-date VMSS model. A VMSS model describes - // the image version the VM is running. If the instance is not running the latest model, it means the instance - // may not be running the version of Kubernetes the Machine Pool has specified and needs to be updated. - LatestModelApplied bool `json:"latestModelApplied"` - } - - // +kubebuilder:object:root=true - // +kubebuilder:subresource:status - // +kubebuilder:resource:path=azuremachinepools,scope=Namespaced,categories=cluster-api,shortName=amp - // +kubebuilder:printcolumn:name="Replicas",type="string",JSONPath=".status.replicas",description="AzureMachinePool replicas count" - // +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.ready",description="AzureMachinePool replicas count" - // +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.provisioningState",description="Azure VMSS provisioning state" - // +kubebuilder:printcolumn:name="Cluster",type="string",priority=1,JSONPath=".metadata.labels.cluster\\.x-k8s\\.io/cluster-name",description="Cluster to which this AzureMachinePool belongs" - // +kubebuilder:printcolumn:name="MachinePool",type="string",priority=1,JSONPath=".metadata.ownerReferences[?(@.kind==\"MachinePool\")].name",description="MachinePool object to which this AzureMachinePool belongs" - // +kubebuilder:printcolumn:name="VMSS ID",type="string",priority=1,JSONPath=".spec.providerID",description="Azure VMSS ID" - // +kubebuilder:printcolumn:name="VM Size",type="string",priority=1,JSONPath=".spec.template.vmSize",description="Azure VM Size" - - // AzureMachinePool is the Schema for the azuremachinepools API. - AzureMachinePool struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec AzureMachinePoolSpec `json:"spec,omitempty"` - Status AzureMachinePoolStatus `json:"status,omitempty"` - } - - // +kubebuilder:object:root=true - - // AzureMachinePoolList contains a list of AzureMachinePools. - AzureMachinePoolList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []AzureMachinePool `json:"items"` - } -) - -// GetConditions returns the list of conditions for an AzureMachinePool API object. -func (amp *AzureMachinePool) GetConditions() clusterv1alpha3.Conditions { - return amp.Status.Conditions -} - -// SetConditions will set the given conditions on an AzureMachinePool object. -func (amp *AzureMachinePool) SetConditions(conditions clusterv1alpha3.Conditions) { - amp.Status.Conditions = conditions -} - -func init() { - SchemeBuilder.Register(&AzureMachinePool{}, &AzureMachinePoolList{}) -} diff --git a/exp/api/v1alpha3/conversion.go b/exp/api/v1alpha3/conversion.go deleted file mode 100644 index 0a2c4d9a4c8..00000000000 --- a/exp/api/v1alpha3/conversion.go +++ /dev/null @@ -1,55 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -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 v1alpha3 - -import ( - conversion "k8s.io/apimachinery/pkg/conversion" - infrav1alpha3 "sigs.k8s.io/cluster-api-provider-azure/api/v1alpha3" - infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" - clusterv1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3" - clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" -) - -// Convert_v1alpha3_OSDisk_To_v1beta1_OSDisk is a conversion function. -func Convert_v1alpha3_OSDisk_To_v1beta1_OSDisk(in *infrav1alpha3.OSDisk, out *infrav1.OSDisk, s conversion.Scope) error { - return infrav1alpha3.Convert_v1alpha3_OSDisk_To_v1beta1_OSDisk(in, out, s) -} - -// Convert_v1beta1_OSDisk_To_v1alpha3_OSDisk is a conversion function. -func Convert_v1beta1_OSDisk_To_v1alpha3_OSDisk(in *infrav1.OSDisk, out *infrav1alpha3.OSDisk, s conversion.Scope) error { - return infrav1alpha3.Convert_v1beta1_OSDisk_To_v1alpha3_OSDisk(in, out, s) -} - -// Convert_v1alpha3_Image_To_v1beta1_Image is a conversion function. -func Convert_v1alpha3_Image_To_v1beta1_Image(in *infrav1alpha3.Image, out *infrav1.Image, s conversion.Scope) error { - return infrav1alpha3.Convert_v1alpha3_Image_To_v1beta1_Image(in, out, s) -} - -// Convert_v1beta1_Image_To_v1alpha3_Image is a conversion function. -func Convert_v1beta1_Image_To_v1alpha3_Image(in *infrav1.Image, out *infrav1alpha3.Image, s conversion.Scope) error { - return infrav1alpha3.Convert_v1beta1_Image_To_v1alpha3_Image(in, out, s) -} - -// Convert_v1alpha3_APIEndpoint_To_v1beta1_APIEndpoint is an autogenerated conversion function. -func Convert_v1alpha3_APIEndpoint_To_v1beta1_APIEndpoint(in *clusterv1alpha3.APIEndpoint, out *clusterv1.APIEndpoint, s conversion.Scope) error { - return clusterv1alpha3.Convert_v1alpha3_APIEndpoint_To_v1beta1_APIEndpoint(in, out, s) -} - -// Convert_v1beta1_APIEndpoint_To_v1alpha3_APIEndpoint is an autogenerated conversion function. -func Convert_v1beta1_APIEndpoint_To_v1alpha3_APIEndpoint(in *clusterv1.APIEndpoint, out *clusterv1alpha3.APIEndpoint, s conversion.Scope) error { - return clusterv1alpha3.Convert_v1beta1_APIEndpoint_To_v1alpha3_APIEndpoint(in, out, s) -} diff --git a/exp/api/v1alpha3/conversion_test.go b/exp/api/v1alpha3/conversion_test.go deleted file mode 100644 index 105c195e001..00000000000 --- a/exp/api/v1alpha3/conversion_test.go +++ /dev/null @@ -1,39 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha3 - -import ( - "testing" - - . "github.com/onsi/gomega" - "k8s.io/apimachinery/pkg/runtime" - infrav1exp "sigs.k8s.io/cluster-api-provider-azure/exp/api/v1beta1" - utilconversion "sigs.k8s.io/cluster-api/util/conversion" -) - -func TestFuzzyConversion(t *testing.T) { - g := NewWithT(t) - scheme := runtime.NewScheme() - g.Expect(AddToScheme(scheme)).To(Succeed()) - g.Expect(infrav1exp.AddToScheme(scheme)).To(Succeed()) - - t.Run("for AzureMachinePool", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ - Scheme: scheme, - Hub: &infrav1exp.AzureMachinePool{}, - Spoke: &AzureMachinePool{}, - })) -} diff --git a/exp/api/v1alpha3/doc.go b/exp/api/v1alpha3/doc.go deleted file mode 100644 index 1b94a57465b..00000000000 --- a/exp/api/v1alpha3/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -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 v1alpha3 - -// +k8s:conversion-gen=sigs.k8s.io/cluster-api-provider-azure/exp/api/v1beta1 diff --git a/exp/api/v1alpha3/groupversion_info.go b/exp/api/v1alpha3/groupversion_info.go deleted file mode 100644 index a9f2265eeab..00000000000 --- a/exp/api/v1alpha3/groupversion_info.go +++ /dev/null @@ -1,39 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -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 v1alpha3 contains API Schema definitions for the exp v1alpha3 API group -// +kubebuilder:object:generate=true -// +groupName=infrastructure.cluster.x-k8s.io -package v1alpha3 - -import ( - "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/scheme" -) - -var ( - // GroupVersion is the group version used to register these objects. - GroupVersion = schema.GroupVersion{Group: "infrastructure.cluster.x-k8s.io", Version: "v1alpha3"} - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme. - SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} - - // AddToScheme adds the types in this group-version to the given scheme. - AddToScheme = SchemeBuilder.AddToScheme - - // localSchemeBuilder is used for type conversions. - localSchemeBuilder = SchemeBuilder.SchemeBuilder -) diff --git a/exp/api/v1alpha3/zz_generated.conversion.go b/exp/api/v1alpha3/zz_generated.conversion.go deleted file mode 100644 index bea4d377864..00000000000 --- a/exp/api/v1alpha3/zz_generated.conversion.go +++ /dev/null @@ -1,384 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright The Kubernetes Authors. - -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. -*/ - -// Code generated by conversion-gen-v0.23.1. DO NOT EDIT. - -package v1alpha3 - -import ( - unsafe "unsafe" - - conversion "k8s.io/apimachinery/pkg/conversion" - runtime "k8s.io/apimachinery/pkg/runtime" - clusterapiproviderazureapiv1alpha3 "sigs.k8s.io/cluster-api-provider-azure/api/v1alpha3" - clusterapiproviderazureapiv1beta1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" - v1beta1 "sigs.k8s.io/cluster-api-provider-azure/exp/api/v1beta1" - apiv1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3" - apiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" - errors "sigs.k8s.io/cluster-api/errors" -) - -func init() { - localSchemeBuilder.Register(RegisterConversions) -} - -// RegisterConversions adds conversion functions to the given scheme. -// Public to allow building arbitrary schemes. -func RegisterConversions(s *runtime.Scheme) error { - if err := s.AddGeneratedConversionFunc((*AzureMachinePool)(nil), (*v1beta1.AzureMachinePool)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureMachinePool_To_v1beta1_AzureMachinePool(a.(*AzureMachinePool), b.(*v1beta1.AzureMachinePool), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureMachinePool)(nil), (*AzureMachinePool)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMachinePool_To_v1alpha3_AzureMachinePool(a.(*v1beta1.AzureMachinePool), b.(*AzureMachinePool), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureMachinePoolInstanceStatus)(nil), (*v1beta1.AzureMachinePoolInstanceStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureMachinePoolInstanceStatus_To_v1beta1_AzureMachinePoolInstanceStatus(a.(*AzureMachinePoolInstanceStatus), b.(*v1beta1.AzureMachinePoolInstanceStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureMachinePoolInstanceStatus)(nil), (*AzureMachinePoolInstanceStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMachinePoolInstanceStatus_To_v1alpha3_AzureMachinePoolInstanceStatus(a.(*v1beta1.AzureMachinePoolInstanceStatus), b.(*AzureMachinePoolInstanceStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureMachinePoolList)(nil), (*v1beta1.AzureMachinePoolList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureMachinePoolList_To_v1beta1_AzureMachinePoolList(a.(*AzureMachinePoolList), b.(*v1beta1.AzureMachinePoolList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureMachinePoolList)(nil), (*AzureMachinePoolList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMachinePoolList_To_v1alpha3_AzureMachinePoolList(a.(*v1beta1.AzureMachinePoolList), b.(*AzureMachinePoolList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureMachinePoolMachineTemplate)(nil), (*v1beta1.AzureMachinePoolMachineTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureMachinePoolMachineTemplate_To_v1beta1_AzureMachinePoolMachineTemplate(a.(*AzureMachinePoolMachineTemplate), b.(*v1beta1.AzureMachinePoolMachineTemplate), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureMachinePoolSpec)(nil), (*v1beta1.AzureMachinePoolSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureMachinePoolSpec_To_v1beta1_AzureMachinePoolSpec(a.(*AzureMachinePoolSpec), b.(*v1beta1.AzureMachinePoolSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*apiv1alpha3.APIEndpoint)(nil), (*apiv1beta1.APIEndpoint)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_APIEndpoint_To_v1beta1_APIEndpoint(a.(*apiv1alpha3.APIEndpoint), b.(*apiv1beta1.APIEndpoint), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*AzureMachinePoolStatus)(nil), (*v1beta1.AzureMachinePoolStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureMachinePoolStatus_To_v1beta1_AzureMachinePoolStatus(a.(*AzureMachinePoolStatus), b.(*v1beta1.AzureMachinePoolStatus), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*clusterapiproviderazureapiv1alpha3.Image)(nil), (*clusterapiproviderazureapiv1beta1.Image)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_Image_To_v1beta1_Image(a.(*clusterapiproviderazureapiv1alpha3.Image), b.(*clusterapiproviderazureapiv1beta1.Image), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*clusterapiproviderazureapiv1alpha3.OSDisk)(nil), (*clusterapiproviderazureapiv1beta1.OSDisk)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_OSDisk_To_v1beta1_OSDisk(a.(*clusterapiproviderazureapiv1alpha3.OSDisk), b.(*clusterapiproviderazureapiv1beta1.OSDisk), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*clusterapiproviderazureapiv1alpha3.SpotVMOptions)(nil), (*clusterapiproviderazureapiv1beta1.SpotVMOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_SpotVMOptions_To_v1beta1_SpotVMOptions(a.(*clusterapiproviderazureapiv1alpha3.SpotVMOptions), b.(*clusterapiproviderazureapiv1beta1.SpotVMOptions), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*apiv1beta1.APIEndpoint)(nil), (*apiv1alpha3.APIEndpoint)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_APIEndpoint_To_v1alpha3_APIEndpoint(a.(*apiv1beta1.APIEndpoint), b.(*apiv1alpha3.APIEndpoint), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.AzureMachinePoolMachineTemplate)(nil), (*AzureMachinePoolMachineTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMachinePoolMachineTemplate_To_v1alpha3_AzureMachinePoolMachineTemplate(a.(*v1beta1.AzureMachinePoolMachineTemplate), b.(*AzureMachinePoolMachineTemplate), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.AzureMachinePoolSpec)(nil), (*AzureMachinePoolSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMachinePoolSpec_To_v1alpha3_AzureMachinePoolSpec(a.(*v1beta1.AzureMachinePoolSpec), b.(*AzureMachinePoolSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.AzureMachinePoolStatus)(nil), (*AzureMachinePoolStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMachinePoolStatus_To_v1alpha3_AzureMachinePoolStatus(a.(*v1beta1.AzureMachinePoolStatus), b.(*AzureMachinePoolStatus), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*clusterapiproviderazureapiv1beta1.Image)(nil), (*clusterapiproviderazureapiv1alpha3.Image)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_Image_To_v1alpha3_Image(a.(*clusterapiproviderazureapiv1beta1.Image), b.(*clusterapiproviderazureapiv1alpha3.Image), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*clusterapiproviderazureapiv1beta1.OSDisk)(nil), (*clusterapiproviderazureapiv1alpha3.OSDisk)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_OSDisk_To_v1alpha3_OSDisk(a.(*clusterapiproviderazureapiv1beta1.OSDisk), b.(*clusterapiproviderazureapiv1alpha3.OSDisk), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*clusterapiproviderazureapiv1beta1.SpotVMOptions)(nil), (*clusterapiproviderazureapiv1alpha3.SpotVMOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_SpotVMOptions_To_v1alpha3_SpotVMOptions(a.(*clusterapiproviderazureapiv1beta1.SpotVMOptions), b.(*clusterapiproviderazureapiv1alpha3.SpotVMOptions), scope) - }); err != nil { - return err - } - return nil -} - -func autoConvert_v1alpha3_AzureMachinePool_To_v1beta1_AzureMachinePool(in *AzureMachinePool, out *v1beta1.AzureMachinePool, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha3_AzureMachinePoolSpec_To_v1beta1_AzureMachinePoolSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1alpha3_AzureMachinePoolStatus_To_v1beta1_AzureMachinePoolStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha3_AzureMachinePool_To_v1beta1_AzureMachinePool is an autogenerated conversion function. -func Convert_v1alpha3_AzureMachinePool_To_v1beta1_AzureMachinePool(in *AzureMachinePool, out *v1beta1.AzureMachinePool, s conversion.Scope) error { - return autoConvert_v1alpha3_AzureMachinePool_To_v1beta1_AzureMachinePool(in, out, s) -} - -func autoConvert_v1beta1_AzureMachinePool_To_v1alpha3_AzureMachinePool(in *v1beta1.AzureMachinePool, out *AzureMachinePool, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1beta1_AzureMachinePoolSpec_To_v1alpha3_AzureMachinePoolSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1beta1_AzureMachinePoolStatus_To_v1alpha3_AzureMachinePoolStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta1_AzureMachinePool_To_v1alpha3_AzureMachinePool is an autogenerated conversion function. -func Convert_v1beta1_AzureMachinePool_To_v1alpha3_AzureMachinePool(in *v1beta1.AzureMachinePool, out *AzureMachinePool, s conversion.Scope) error { - return autoConvert_v1beta1_AzureMachinePool_To_v1alpha3_AzureMachinePool(in, out, s) -} - -func autoConvert_v1alpha3_AzureMachinePoolInstanceStatus_To_v1beta1_AzureMachinePoolInstanceStatus(in *AzureMachinePoolInstanceStatus, out *v1beta1.AzureMachinePoolInstanceStatus, s conversion.Scope) error { - out.Version = in.Version - out.ProvisioningState = (*clusterapiproviderazureapiv1beta1.ProvisioningState)(unsafe.Pointer(in.ProvisioningState)) - out.ProviderID = in.ProviderID - out.InstanceID = in.InstanceID - out.InstanceName = in.InstanceName - out.LatestModelApplied = in.LatestModelApplied - return nil -} - -// Convert_v1alpha3_AzureMachinePoolInstanceStatus_To_v1beta1_AzureMachinePoolInstanceStatus is an autogenerated conversion function. -func Convert_v1alpha3_AzureMachinePoolInstanceStatus_To_v1beta1_AzureMachinePoolInstanceStatus(in *AzureMachinePoolInstanceStatus, out *v1beta1.AzureMachinePoolInstanceStatus, s conversion.Scope) error { - return autoConvert_v1alpha3_AzureMachinePoolInstanceStatus_To_v1beta1_AzureMachinePoolInstanceStatus(in, out, s) -} - -func autoConvert_v1beta1_AzureMachinePoolInstanceStatus_To_v1alpha3_AzureMachinePoolInstanceStatus(in *v1beta1.AzureMachinePoolInstanceStatus, out *AzureMachinePoolInstanceStatus, s conversion.Scope) error { - out.Version = in.Version - out.ProvisioningState = (*clusterapiproviderazureapiv1alpha3.VMState)(unsafe.Pointer(in.ProvisioningState)) - out.ProviderID = in.ProviderID - out.InstanceID = in.InstanceID - out.InstanceName = in.InstanceName - out.LatestModelApplied = in.LatestModelApplied - return nil -} - -// Convert_v1beta1_AzureMachinePoolInstanceStatus_To_v1alpha3_AzureMachinePoolInstanceStatus is an autogenerated conversion function. -func Convert_v1beta1_AzureMachinePoolInstanceStatus_To_v1alpha3_AzureMachinePoolInstanceStatus(in *v1beta1.AzureMachinePoolInstanceStatus, out *AzureMachinePoolInstanceStatus, s conversion.Scope) error { - return autoConvert_v1beta1_AzureMachinePoolInstanceStatus_To_v1alpha3_AzureMachinePoolInstanceStatus(in, out, s) -} - -func autoConvert_v1alpha3_AzureMachinePoolList_To_v1beta1_AzureMachinePoolList(in *AzureMachinePoolList, out *v1beta1.AzureMachinePoolList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]v1beta1.AzureMachinePool, len(*in)) - for i := range *in { - if err := Convert_v1alpha3_AzureMachinePool_To_v1beta1_AzureMachinePool(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1alpha3_AzureMachinePoolList_To_v1beta1_AzureMachinePoolList is an autogenerated conversion function. -func Convert_v1alpha3_AzureMachinePoolList_To_v1beta1_AzureMachinePoolList(in *AzureMachinePoolList, out *v1beta1.AzureMachinePoolList, s conversion.Scope) error { - return autoConvert_v1alpha3_AzureMachinePoolList_To_v1beta1_AzureMachinePoolList(in, out, s) -} - -func autoConvert_v1beta1_AzureMachinePoolList_To_v1alpha3_AzureMachinePoolList(in *v1beta1.AzureMachinePoolList, out *AzureMachinePoolList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]AzureMachinePool, len(*in)) - for i := range *in { - if err := Convert_v1beta1_AzureMachinePool_To_v1alpha3_AzureMachinePool(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1beta1_AzureMachinePoolList_To_v1alpha3_AzureMachinePoolList is an autogenerated conversion function. -func Convert_v1beta1_AzureMachinePoolList_To_v1alpha3_AzureMachinePoolList(in *v1beta1.AzureMachinePoolList, out *AzureMachinePoolList, s conversion.Scope) error { - return autoConvert_v1beta1_AzureMachinePoolList_To_v1alpha3_AzureMachinePoolList(in, out, s) -} - -func autoConvert_v1alpha3_AzureMachinePoolMachineTemplate_To_v1beta1_AzureMachinePoolMachineTemplate(in *AzureMachinePoolMachineTemplate, out *v1beta1.AzureMachinePoolMachineTemplate, s conversion.Scope) error { - out.VMSize = in.VMSize - if in.Image != nil { - in, out := &in.Image, &out.Image - *out = new(clusterapiproviderazureapiv1beta1.Image) - if err := Convert_v1alpha3_Image_To_v1beta1_Image(*in, *out, s); err != nil { - return err - } - } else { - out.Image = nil - } - if err := Convert_v1alpha3_OSDisk_To_v1beta1_OSDisk(&in.OSDisk, &out.OSDisk, s); err != nil { - return err - } - out.DataDisks = *(*[]clusterapiproviderazureapiv1beta1.DataDisk)(unsafe.Pointer(&in.DataDisks)) - out.SSHPublicKey = in.SSHPublicKey - out.AcceleratedNetworking = (*bool)(unsafe.Pointer(in.AcceleratedNetworking)) - out.TerminateNotificationTimeout = (*int)(unsafe.Pointer(in.TerminateNotificationTimeout)) - out.SecurityProfile = (*clusterapiproviderazureapiv1beta1.SecurityProfile)(unsafe.Pointer(in.SecurityProfile)) - if in.SpotVMOptions != nil { - in, out := &in.SpotVMOptions, &out.SpotVMOptions - *out = new(clusterapiproviderazureapiv1beta1.SpotVMOptions) - if err := Convert_v1alpha3_SpotVMOptions_To_v1beta1_SpotVMOptions(*in, *out, s); err != nil { - return err - } - } else { - out.SpotVMOptions = nil - } - return nil -} - -// Convert_v1alpha3_AzureMachinePoolMachineTemplate_To_v1beta1_AzureMachinePoolMachineTemplate is an autogenerated conversion function. -func Convert_v1alpha3_AzureMachinePoolMachineTemplate_To_v1beta1_AzureMachinePoolMachineTemplate(in *AzureMachinePoolMachineTemplate, out *v1beta1.AzureMachinePoolMachineTemplate, s conversion.Scope) error { - return autoConvert_v1alpha3_AzureMachinePoolMachineTemplate_To_v1beta1_AzureMachinePoolMachineTemplate(in, out, s) -} - -func autoConvert_v1beta1_AzureMachinePoolMachineTemplate_To_v1alpha3_AzureMachinePoolMachineTemplate(in *v1beta1.AzureMachinePoolMachineTemplate, out *AzureMachinePoolMachineTemplate, s conversion.Scope) error { - out.VMSize = in.VMSize - if in.Image != nil { - in, out := &in.Image, &out.Image - *out = new(clusterapiproviderazureapiv1alpha3.Image) - if err := Convert_v1beta1_Image_To_v1alpha3_Image(*in, *out, s); err != nil { - return err - } - } else { - out.Image = nil - } - if err := Convert_v1beta1_OSDisk_To_v1alpha3_OSDisk(&in.OSDisk, &out.OSDisk, s); err != nil { - return err - } - out.DataDisks = *(*[]clusterapiproviderazureapiv1alpha3.DataDisk)(unsafe.Pointer(&in.DataDisks)) - out.SSHPublicKey = in.SSHPublicKey - out.AcceleratedNetworking = (*bool)(unsafe.Pointer(in.AcceleratedNetworking)) - // WARNING: in.Diagnostics requires manual conversion: does not exist in peer-type - out.TerminateNotificationTimeout = (*int)(unsafe.Pointer(in.TerminateNotificationTimeout)) - out.SecurityProfile = (*clusterapiproviderazureapiv1alpha3.SecurityProfile)(unsafe.Pointer(in.SecurityProfile)) - if in.SpotVMOptions != nil { - in, out := &in.SpotVMOptions, &out.SpotVMOptions - *out = new(clusterapiproviderazureapiv1alpha3.SpotVMOptions) - if err := Convert_v1beta1_SpotVMOptions_To_v1alpha3_SpotVMOptions(*in, *out, s); err != nil { - return err - } - } else { - out.SpotVMOptions = nil - } - // WARNING: in.SubnetName requires manual conversion: does not exist in peer-type - // WARNING: in.VMExtensions requires manual conversion: does not exist in peer-type - // WARNING: in.NetworkInterfaces requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha3_AzureMachinePoolSpec_To_v1beta1_AzureMachinePoolSpec(in *AzureMachinePoolSpec, out *v1beta1.AzureMachinePoolSpec, s conversion.Scope) error { - out.Location = in.Location - if err := Convert_v1alpha3_AzureMachinePoolMachineTemplate_To_v1beta1_AzureMachinePoolMachineTemplate(&in.Template, &out.Template, s); err != nil { - return err - } - out.AdditionalTags = *(*clusterapiproviderazureapiv1beta1.Tags)(unsafe.Pointer(&in.AdditionalTags)) - out.ProviderID = in.ProviderID - out.ProviderIDList = *(*[]string)(unsafe.Pointer(&in.ProviderIDList)) - out.Identity = clusterapiproviderazureapiv1beta1.VMIdentity(in.Identity) - out.UserAssignedIdentities = *(*[]clusterapiproviderazureapiv1beta1.UserAssignedIdentity)(unsafe.Pointer(&in.UserAssignedIdentities)) - out.RoleAssignmentName = in.RoleAssignmentName - return nil -} - -// Convert_v1alpha3_AzureMachinePoolSpec_To_v1beta1_AzureMachinePoolSpec is an autogenerated conversion function. -func Convert_v1alpha3_AzureMachinePoolSpec_To_v1beta1_AzureMachinePoolSpec(in *AzureMachinePoolSpec, out *v1beta1.AzureMachinePoolSpec, s conversion.Scope) error { - return autoConvert_v1alpha3_AzureMachinePoolSpec_To_v1beta1_AzureMachinePoolSpec(in, out, s) -} - -func autoConvert_v1beta1_AzureMachinePoolSpec_To_v1alpha3_AzureMachinePoolSpec(in *v1beta1.AzureMachinePoolSpec, out *AzureMachinePoolSpec, s conversion.Scope) error { - out.Location = in.Location - if err := Convert_v1beta1_AzureMachinePoolMachineTemplate_To_v1alpha3_AzureMachinePoolMachineTemplate(&in.Template, &out.Template, s); err != nil { - return err - } - out.AdditionalTags = *(*clusterapiproviderazureapiv1alpha3.Tags)(unsafe.Pointer(&in.AdditionalTags)) - out.ProviderID = in.ProviderID - out.ProviderIDList = *(*[]string)(unsafe.Pointer(&in.ProviderIDList)) - out.Identity = clusterapiproviderazureapiv1alpha3.VMIdentity(in.Identity) - // WARNING: in.SystemAssignedIdentityRole requires manual conversion: does not exist in peer-type - out.UserAssignedIdentities = *(*[]clusterapiproviderazureapiv1alpha3.UserAssignedIdentity)(unsafe.Pointer(&in.UserAssignedIdentities)) - out.RoleAssignmentName = in.RoleAssignmentName - // WARNING: in.Strategy requires manual conversion: does not exist in peer-type - // WARNING: in.NodeDrainTimeout requires manual conversion: does not exist in peer-type - // WARNING: in.OrchestrationMode requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha3_AzureMachinePoolStatus_To_v1beta1_AzureMachinePoolStatus(in *AzureMachinePoolStatus, out *v1beta1.AzureMachinePoolStatus, s conversion.Scope) error { - out.Ready = in.Ready - out.Replicas = in.Replicas - out.Instances = *(*[]*v1beta1.AzureMachinePoolInstanceStatus)(unsafe.Pointer(&in.Instances)) - out.Version = in.Version - out.ProvisioningState = (*clusterapiproviderazureapiv1beta1.ProvisioningState)(unsafe.Pointer(in.ProvisioningState)) - out.FailureReason = (*errors.MachineStatusError)(unsafe.Pointer(in.FailureReason)) - out.FailureMessage = (*string)(unsafe.Pointer(in.FailureMessage)) - out.Conditions = *(*apiv1beta1.Conditions)(unsafe.Pointer(&in.Conditions)) - // WARNING: in.LongRunningOperationState requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1beta1_AzureMachinePoolStatus_To_v1alpha3_AzureMachinePoolStatus(in *v1beta1.AzureMachinePoolStatus, out *AzureMachinePoolStatus, s conversion.Scope) error { - out.Ready = in.Ready - out.Replicas = in.Replicas - out.Instances = *(*[]*AzureMachinePoolInstanceStatus)(unsafe.Pointer(&in.Instances)) - // WARNING: in.Image requires manual conversion: does not exist in peer-type - out.Version = in.Version - out.ProvisioningState = (*clusterapiproviderazureapiv1alpha3.VMState)(unsafe.Pointer(in.ProvisioningState)) - out.FailureReason = (*errors.MachineStatusError)(unsafe.Pointer(in.FailureReason)) - out.FailureMessage = (*string)(unsafe.Pointer(in.FailureMessage)) - out.Conditions = *(*apiv1alpha3.Conditions)(unsafe.Pointer(&in.Conditions)) - // WARNING: in.LongRunningOperationStates requires manual conversion: does not exist in peer-type - return nil -} diff --git a/exp/api/v1alpha3/zz_generated.deepcopy.go b/exp/api/v1alpha3/zz_generated.deepcopy.go deleted file mode 100644 index 1c55e29e266..00000000000 --- a/exp/api/v1alpha3/zz_generated.deepcopy.go +++ /dev/null @@ -1,242 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright The Kubernetes Authors. - -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. -*/ - -// Code generated by controller-gen. DO NOT EDIT. - -package v1alpha3 - -import ( - runtime "k8s.io/apimachinery/pkg/runtime" - apiv1alpha3 "sigs.k8s.io/cluster-api-provider-azure/api/v1alpha3" - cluster_apiapiv1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3" - "sigs.k8s.io/cluster-api/errors" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachinePool) DeepCopyInto(out *AzureMachinePool) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachinePool. -func (in *AzureMachinePool) DeepCopy() *AzureMachinePool { - if in == nil { - return nil - } - out := new(AzureMachinePool) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AzureMachinePool) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachinePoolInstanceStatus) DeepCopyInto(out *AzureMachinePoolInstanceStatus) { - *out = *in - if in.ProvisioningState != nil { - in, out := &in.ProvisioningState, &out.ProvisioningState - *out = new(apiv1alpha3.VMState) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachinePoolInstanceStatus. -func (in *AzureMachinePoolInstanceStatus) DeepCopy() *AzureMachinePoolInstanceStatus { - if in == nil { - return nil - } - out := new(AzureMachinePoolInstanceStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachinePoolList) DeepCopyInto(out *AzureMachinePoolList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]AzureMachinePool, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachinePoolList. -func (in *AzureMachinePoolList) DeepCopy() *AzureMachinePoolList { - if in == nil { - return nil - } - out := new(AzureMachinePoolList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AzureMachinePoolList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachinePoolMachineTemplate) DeepCopyInto(out *AzureMachinePoolMachineTemplate) { - *out = *in - if in.Image != nil { - in, out := &in.Image, &out.Image - *out = new(apiv1alpha3.Image) - (*in).DeepCopyInto(*out) - } - in.OSDisk.DeepCopyInto(&out.OSDisk) - if in.DataDisks != nil { - in, out := &in.DataDisks, &out.DataDisks - *out = make([]apiv1alpha3.DataDisk, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.AcceleratedNetworking != nil { - in, out := &in.AcceleratedNetworking, &out.AcceleratedNetworking - *out = new(bool) - **out = **in - } - if in.TerminateNotificationTimeout != nil { - in, out := &in.TerminateNotificationTimeout, &out.TerminateNotificationTimeout - *out = new(int) - **out = **in - } - if in.SecurityProfile != nil { - in, out := &in.SecurityProfile, &out.SecurityProfile - *out = new(apiv1alpha3.SecurityProfile) - (*in).DeepCopyInto(*out) - } - if in.SpotVMOptions != nil { - in, out := &in.SpotVMOptions, &out.SpotVMOptions - *out = new(apiv1alpha3.SpotVMOptions) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachinePoolMachineTemplate. -func (in *AzureMachinePoolMachineTemplate) DeepCopy() *AzureMachinePoolMachineTemplate { - if in == nil { - return nil - } - out := new(AzureMachinePoolMachineTemplate) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachinePoolSpec) DeepCopyInto(out *AzureMachinePoolSpec) { - *out = *in - in.Template.DeepCopyInto(&out.Template) - if in.AdditionalTags != nil { - in, out := &in.AdditionalTags, &out.AdditionalTags - *out = make(apiv1alpha3.Tags, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.ProviderIDList != nil { - in, out := &in.ProviderIDList, &out.ProviderIDList - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.UserAssignedIdentities != nil { - in, out := &in.UserAssignedIdentities, &out.UserAssignedIdentities - *out = make([]apiv1alpha3.UserAssignedIdentity, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachinePoolSpec. -func (in *AzureMachinePoolSpec) DeepCopy() *AzureMachinePoolSpec { - if in == nil { - return nil - } - out := new(AzureMachinePoolSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachinePoolStatus) DeepCopyInto(out *AzureMachinePoolStatus) { - *out = *in - if in.Instances != nil { - in, out := &in.Instances, &out.Instances - *out = make([]*AzureMachinePoolInstanceStatus, len(*in)) - for i := range *in { - if (*in)[i] != nil { - in, out := &(*in)[i], &(*out)[i] - *out = new(AzureMachinePoolInstanceStatus) - (*in).DeepCopyInto(*out) - } - } - } - if in.ProvisioningState != nil { - in, out := &in.ProvisioningState, &out.ProvisioningState - *out = new(apiv1alpha3.VMState) - **out = **in - } - if in.FailureReason != nil { - in, out := &in.FailureReason, &out.FailureReason - *out = new(errors.MachineStatusError) - **out = **in - } - if in.FailureMessage != nil { - in, out := &in.FailureMessage, &out.FailureMessage - *out = new(string) - **out = **in - } - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(cluster_apiapiv1alpha3.Conditions, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.LongRunningOperationState != nil { - in, out := &in.LongRunningOperationState, &out.LongRunningOperationState - *out = new(apiv1alpha3.Future) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachinePoolStatus. -func (in *AzureMachinePoolStatus) DeepCopy() *AzureMachinePoolStatus { - if in == nil { - return nil - } - out := new(AzureMachinePoolStatus) - in.DeepCopyInto(out) - return out -} diff --git a/exp/api/v1alpha4/azuremachinepool_conversion.go b/exp/api/v1alpha4/azuremachinepool_conversion.go deleted file mode 100644 index 582640bd94e..00000000000 --- a/exp/api/v1alpha4/azuremachinepool_conversion.go +++ /dev/null @@ -1,131 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha4 - -import ( - unsafe "unsafe" - - "k8s.io/apimachinery/pkg/api/resource" - apiconversion "k8s.io/apimachinery/pkg/conversion" - infrav1alpha4 "sigs.k8s.io/cluster-api-provider-azure/api/v1alpha4" - infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" - infrav1exp "sigs.k8s.io/cluster-api-provider-azure/exp/api/v1beta1" - utilconversion "sigs.k8s.io/cluster-api/util/conversion" - "sigs.k8s.io/controller-runtime/pkg/conversion" -) - -// ConvertTo converts this AzureMachinePool to the Hub version (v1beta1). -func (src *AzureMachinePool) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*infrav1exp.AzureMachinePool) - if err := Convert_v1alpha4_AzureMachinePool_To_v1beta1_AzureMachinePool(src, dst, nil); err != nil { - return err - } - - // Manually restore data. - restored := &infrav1exp.AzureMachinePool{} - if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { - return err - } - - if restored.Spec.Template.NetworkInterfaces != nil { - dst.Spec.Template.NetworkInterfaces = restored.Spec.Template.NetworkInterfaces - } - - if restored.Spec.Template.Image != nil && restored.Spec.Template.Image.ComputeGallery != nil { - dst.Spec.Template.Image.ComputeGallery = restored.Spec.Template.Image.ComputeGallery - } - - if restored.Status.Image != nil && restored.Status.Image.ComputeGallery != nil { - dst.Status.Image.ComputeGallery = restored.Status.Image.ComputeGallery - } - - if len(restored.Spec.Template.VMExtensions) > 0 { - dst.Spec.Template.VMExtensions = restored.Spec.Template.VMExtensions - } - - if restored.Spec.Template.SpotVMOptions != nil && restored.Spec.Template.SpotVMOptions.EvictionPolicy != nil { - dst.Spec.Template.SpotVMOptions.EvictionPolicy = restored.Spec.Template.SpotVMOptions.EvictionPolicy - } - - if restored.Spec.Template.Diagnostics != nil { - dst.Spec.Template.Diagnostics = restored.Spec.Template.Diagnostics - } - - for i, r := range restored.Status.LongRunningOperationStates { - if r.Name == dst.Status.LongRunningOperationStates[i].Name { - dst.Status.LongRunningOperationStates[i].ServiceName = r.ServiceName - } - } - - // Restore orchestration mode - dst.Spec.OrchestrationMode = restored.Spec.OrchestrationMode - - if restored.Spec.SystemAssignedIdentityRole != nil { - dst.Spec.SystemAssignedIdentityRole = restored.Spec.SystemAssignedIdentityRole - } - - return nil -} - -// ConvertFrom converts from the Hub version (v1beta1) to this version. -func (dst *AzureMachinePool) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*infrav1exp.AzureMachinePool) - if err := Convert_v1beta1_AzureMachinePool_To_v1alpha4_AzureMachinePool(src, dst, nil); err != nil { - return err - } - - if err := utilconversion.MarshalData(src, dst); err != nil { - return err - } - - // Preserve Hub data on down-conversion. - return utilconversion.MarshalData(src, dst) -} - -// Convert_v1beta1_AzureMachinePoolSpec_To_v1alpha4_AzureMachinePoolSpec converts a v1beta1 AzureMachinePool.Spec to a v1alpha4 AzureMachinePool.Spec. -func Convert_v1beta1_AzureMachinePoolSpec_To_v1alpha4_AzureMachinePoolSpec(in *infrav1exp.AzureMachinePoolSpec, out *AzureMachinePoolSpec, s apiconversion.Scope) error { - return autoConvert_v1beta1_AzureMachinePoolSpec_To_v1alpha4_AzureMachinePoolSpec(in, out, s) -} - -// ConvertTo converts this AzureMachinePool to the Hub version (v1beta1). -func (src *AzureMachinePoolList) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*infrav1exp.AzureMachinePoolList) - return Convert_v1alpha4_AzureMachinePoolList_To_v1beta1_AzureMachinePoolList(src, dst, nil) -} - -// ConvertFrom converts from the Hub version (v1beta1) to this version. -func (dst *AzureMachinePoolList) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*infrav1exp.AzureMachinePoolList) - return Convert_v1beta1_AzureMachinePoolList_To_v1alpha4_AzureMachinePoolList(src, dst, nil) -} - -// Convert_v1beta1_AzureMachinePoolMachineTemplate_To_v1alpha4_AzureMachinePoolMachineTemplate converts an Azure Machine Pool Machine Template from v1beta1 to v1alpha4. -func Convert_v1beta1_AzureMachinePoolMachineTemplate_To_v1alpha4_AzureMachinePoolMachineTemplate(in *infrav1exp.AzureMachinePoolMachineTemplate, out *AzureMachinePoolMachineTemplate, s apiconversion.Scope) error { - return autoConvert_v1beta1_AzureMachinePoolMachineTemplate_To_v1alpha4_AzureMachinePoolMachineTemplate(in, out, s) -} - -// Convert_v1beta1_SpotVMOptions_To_v1alpha4_SpotVMOptions converts a SpotVMOptions from v1beta1 to v1alpha4. -func Convert_v1beta1_SpotVMOptions_To_v1alpha4_SpotVMOptions(in *infrav1.SpotVMOptions, out *infrav1alpha4.SpotVMOptions, s apiconversion.Scope) error { - out.MaxPrice = (*resource.Quantity)(unsafe.Pointer(in.MaxPrice)) - return nil -} - -// Convert_v1alpha4_SpotVMOptions_To_v1beta1_SpotVMOptions converts a SpotVMOptions from v1alpha4 to v1beta1. -func Convert_v1alpha4_SpotVMOptions_To_v1beta1_SpotVMOptions(in *infrav1alpha4.SpotVMOptions, out *infrav1.SpotVMOptions, s apiconversion.Scope) error { - out.MaxPrice = (*resource.Quantity)(unsafe.Pointer(in.MaxPrice)) - return nil -} diff --git a/exp/api/v1alpha4/azuremachinepool_types.go b/exp/api/v1alpha4/azuremachinepool_types.go deleted file mode 100644 index a64c6084d96..00000000000 --- a/exp/api/v1alpha4/azuremachinepool_types.go +++ /dev/null @@ -1,370 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha4 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/intstr" - infrav1alpha4 "sigs.k8s.io/cluster-api-provider-azure/api/v1alpha4" - clusterv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" - "sigs.k8s.io/cluster-api/errors" -) - -const ( - // MachinePoolNameLabel indicates the AzureMachinePool name the AzureMachinePoolMachine belongs. - MachinePoolNameLabel = "azuremachinepool.infrastructure.cluster.x-k8s.io/machine-pool" - - // RollingUpdateAzureMachinePoolDeploymentStrategyType replaces AzureMachinePoolMachines with older models with - // AzureMachinePoolMachines based on the latest model. - // i.e. gradually scale down the old AzureMachinePoolMachines and scale up the new ones. - RollingUpdateAzureMachinePoolDeploymentStrategyType AzureMachinePoolDeploymentStrategyType = "RollingUpdate" - - // OldestDeletePolicyType will delete machines with the oldest creation date first. - OldestDeletePolicyType AzureMachinePoolDeletePolicyType = "Oldest" - // NewestDeletePolicyType will delete machines with the newest creation date first. - NewestDeletePolicyType AzureMachinePoolDeletePolicyType = "Newest" - // RandomDeletePolicyType will delete machines in random order. - RandomDeletePolicyType AzureMachinePoolDeletePolicyType = "Random" -) - -type ( - // AzureMachinePoolMachineTemplate defines the template for an AzureMachine. - AzureMachinePoolMachineTemplate struct { - // VMSize is the size of the Virtual Machine to build. - // See https://docs.microsoft.com/en-us/rest/api/compute/virtualmachines/createorupdate#virtualmachinesizetypes - VMSize string `json:"vmSize"` - - // Image is used to provide details of an image to use during VM creation. - // If image details are omitted the image will default the Azure Marketplace "capi" offer, - // which is based on Ubuntu. - // +kubebuilder:validation:nullable - // +optional - Image *infrav1alpha4.Image `json:"image,omitempty"` - - // OSDisk contains the operating system disk information for a Virtual Machine - OSDisk infrav1alpha4.OSDisk `json:"osDisk"` - - // DataDisks specifies the list of data disks to be created for a Virtual Machine - // +optional - DataDisks []infrav1alpha4.DataDisk `json:"dataDisks,omitempty"` - - // SSHPublicKey is the SSH public key string base64 encoded to add to a Virtual Machine - SSHPublicKey string `json:"sshPublicKey"` - - // AcceleratedNetworking enables or disables Azure accelerated networking. If omitted, it will be set based on - // whether the requested VMSize supports accelerated networking. - // If AcceleratedNetworking is set to true with a VMSize that does not support it, Azure will return an error. - // +optional - AcceleratedNetworking *bool `json:"acceleratedNetworking,omitempty"` - - // TerminateNotificationTimeout enables or disables VMSS scheduled events termination notification with specified timeout - // allowed values are between 5 and 15 (mins) - // +optional - TerminateNotificationTimeout *int `json:"terminateNotificationTimeout,omitempty"` - - // SecurityProfile specifies the Security profile settings for a virtual machine. - // +optional - SecurityProfile *infrav1alpha4.SecurityProfile `json:"securityProfile,omitempty"` - - // SpotVMOptions allows the ability to specify the Machine should use a Spot VM - // +optional - SpotVMOptions *infrav1alpha4.SpotVMOptions `json:"spotVMOptions,omitempty"` - - // SubnetName selects the Subnet where the VMSS will be placed - // +optional - SubnetName string `json:"subnetName,omitempty"` - } - - // AzureMachinePoolSpec defines the desired state of AzureMachinePool. - AzureMachinePoolSpec struct { - // Location is the Azure region location e.g. westus2 - Location string `json:"location"` - - // Template contains the details used to build a replica virtual machine within the Machine Pool - Template AzureMachinePoolMachineTemplate `json:"template"` - - // AdditionalTags is an optional set of tags to add to an instance, in addition to the ones added by default by the - // Azure provider. If both the AzureCluster and the AzureMachine specify the same tag name with different values, the - // AzureMachine's value takes precedence. - // +optional - AdditionalTags infrav1alpha4.Tags `json:"additionalTags,omitempty"` - - // ProviderID is the identification ID of the Virtual Machine Scale Set - // +optional - ProviderID string `json:"providerID,omitempty"` - - // ProviderIDList are the identification IDs of machine instances provided by the provider. - // This field must match the provider IDs as seen on the node objects corresponding to a machine pool's machine instances. - // +optional - ProviderIDList []string `json:"providerIDList,omitempty"` - - // Identity is the type of identity used for the Virtual Machine Scale Set. - // The type 'SystemAssigned' is an implicitly created identity. - // The generated identity will be assigned a Subscription contributor role. - // The type 'UserAssigned' is a standalone Azure resource provided by the user - // and assigned to the VM - // +kubebuilder:default=None - // +optional - Identity infrav1alpha4.VMIdentity `json:"identity,omitempty"` - - // UserAssignedIdentities is a list of standalone Azure identities provided by the user - // The lifecycle of a user-assigned identity is managed separately from the lifecycle of - // the AzureMachinePool. - // See https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/how-to-manage-ua-identity-cli - // +optional - UserAssignedIdentities []infrav1alpha4.UserAssignedIdentity `json:"userAssignedIdentities,omitempty"` - - // RoleAssignmentName is the name of the role assignment to create for a system assigned identity. It can be any valid GUID. - // If not specified, a random GUID will be generated. - // +optional - RoleAssignmentName string `json:"roleAssignmentName,omitempty"` - - // The deployment strategy to use to replace existing AzureMachinePoolMachines with new ones. - // +optional - // +kubebuilder:default={type: "RollingUpdate", rollingUpdate: {maxSurge: 1, maxUnavailable: 0, deletePolicy: Oldest}} - Strategy AzureMachinePoolDeploymentStrategy `json:"strategy,omitempty"` - - // NodeDrainTimeout is the total amount of time that the controller will spend on draining a node. - // The default value is 0, meaning that the node can be drained without any time limitations. - // NOTE: NodeDrainTimeout is different from `kubectl drain --timeout` - // +optional - NodeDrainTimeout *metav1.Duration `json:"nodeDrainTimeout,omitempty"` - } - - // AzureMachinePoolDeploymentStrategyType is the type of deployment strategy employed to rollout a new version of - // the AzureMachinePool. - AzureMachinePoolDeploymentStrategyType string - - // AzureMachinePoolDeploymentStrategy describes how to replace existing machines with new ones. - AzureMachinePoolDeploymentStrategy struct { - // Type of deployment. Currently the only supported strategy is RollingUpdate - // +optional - // +kubebuilder:validation:Enum=RollingUpdate - // +optional - // +kubebuilder:default=RollingUpdate - Type AzureMachinePoolDeploymentStrategyType `json:"type,omitempty"` - - // Rolling update config params. Present only if - // MachineDeploymentStrategyType = RollingUpdate. - // +optional - RollingUpdate *MachineRollingUpdateDeployment `json:"rollingUpdate,omitempty"` - } - - // AzureMachinePoolDeletePolicyType is the type of DeletePolicy employed to select machines to be deleted during an - // upgrade. - AzureMachinePoolDeletePolicyType string - - // MachineRollingUpdateDeployment is used to control the desired behavior of rolling update. - MachineRollingUpdateDeployment struct { - // The maximum number of machines that can be unavailable during the update. - // Value can be an absolute number (ex: 5) or a percentage of desired - // machines (ex: 10%). - // Absolute number is calculated from percentage by rounding down. - // This can not be 0 if MaxSurge is 0. - // Defaults to 0. - // Example: when this is set to 30%, the old MachineSet can be scaled - // down to 70% of desired machines immediately when the rolling update - // starts. Once new machines are ready, old MachineSet can be scaled - // down further, followed by scaling up the new MachineSet, ensuring - // that the total number of machines available at all times - // during the update is at least 70% of desired machines. - // +optional - // +kubebuilder:default:=0 - MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"` - - // The maximum number of machines that can be scheduled above the - // desired number of machines. - // Value can be an absolute number (ex: 5) or a percentage of - // desired machines (ex: 10%). - // This can not be 0 if MaxUnavailable is 0. - // Absolute number is calculated from percentage by rounding up. - // Defaults to 1. - // Example: when this is set to 30%, the new MachineSet can be scaled - // up immediately when the rolling update starts, such that the total - // number of old and new machines do not exceed 130% of desired - // machines. Once old machines have been killed, new MachineSet can - // be scaled up further, ensuring that total number of machines running - // at any time during the update is at most 130% of desired machines. - // +optional - // +kubebuilder:default:=1 - MaxSurge *intstr.IntOrString `json:"maxSurge,omitempty"` - - // DeletePolicy defines the policy used by the MachineDeployment to identify nodes to delete when downscaling. - // Valid values are "Random, "Newest", "Oldest" - // When no value is supplied, the default is Oldest - // +optional - // +kubebuilder:validation:Enum=Random;Newest;Oldest - // +kubebuilder:default:=Oldest - DeletePolicy AzureMachinePoolDeletePolicyType `json:"deletePolicy,omitempty"` - } - - // AzureMachinePoolStatus defines the observed state of AzureMachinePool. - AzureMachinePoolStatus struct { - // Ready is true when the provider resource is ready. - // +optional - Ready bool `json:"ready"` - - // Replicas is the most recently observed number of replicas. - // +optional - Replicas int32 `json:"replicas"` - - // Instances is the VM instance status for each VM in the VMSS - // +optional - Instances []*AzureMachinePoolInstanceStatus `json:"instances,omitempty"` - - // Image is the current image used in the AzureMachinePool. When the spec image is nil, this image is populated - // with the details of the defaulted Azure Marketplace "capi" offer. - // +optional - Image *infrav1alpha4.Image `json:"image,omitempty"` - - // Version is the Kubernetes version for the current VMSS model - // +optional - Version string `json:"version"` - - // ProvisioningState is the provisioning state of the Azure virtual machine. - // +optional - ProvisioningState *infrav1alpha4.ProvisioningState `json:"provisioningState,omitempty"` - - // FailureReason will be set in the event that there is a terminal problem - // reconciling the MachinePool and will contain a succinct value suitable - // for machine interpretation. - // - // This field should not be set for transitive errors that a controller - // faces that are expected to be fixed automatically over - // time (like service outages), but instead indicate that something is - // fundamentally wrong with the MachinePool's spec or the configuration of - // the controller, and that manual intervention is required. Examples - // of terminal errors would be invalid combinations of settings in the - // spec, values that are unsupported by the controller, or the - // responsible controller itself being critically misconfigured. - // - // Any transient errors that occur during the reconciliation of MachinePools - // can be added as events to the MachinePool object and/or logged in the - // controller's output. - // +optional - FailureReason *errors.MachineStatusError `json:"failureReason,omitempty"` - - // FailureMessage will be set in the event that there is a terminal problem - // reconciling the MachinePool and will contain a more verbose string suitable - // for logging and human consumption. - // - // This field should not be set for transitive errors that a controller - // faces that are expected to be fixed automatically over - // time (like service outages), but instead indicate that something is - // fundamentally wrong with the MachinePool's spec or the configuration of - // the controller, and that manual intervention is required. Examples - // of terminal errors would be invalid combinations of settings in the - // spec, values that are unsupported by the controller, or the - // responsible controller itself being critically misconfigured. - // - // Any transient errors that occur during the reconciliation of MachinePools - // can be added as events to the MachinePool object and/or logged in the - // controller's output. - // +optional - FailureMessage *string `json:"failureMessage,omitempty"` - - // Conditions defines current service state of the AzureMachinePool. - // +optional - Conditions clusterv1alpha4.Conditions `json:"conditions,omitempty"` - - // LongRunningOperationStates saves the state for Azure long-running operations so they can be continued on the - // next reconciliation loop. - // +optional - LongRunningOperationStates infrav1alpha4.Futures `json:"longRunningOperationStates,omitempty"` - } - - // AzureMachinePoolInstanceStatus provides status information for each instance in the VMSS. - AzureMachinePoolInstanceStatus struct { - // Version defines the Kubernetes version for the VM Instance - // +optional - Version string `json:"version"` - - // ProvisioningState is the provisioning state of the Azure virtual machine instance. - // +optional - ProvisioningState *infrav1alpha4.ProvisioningState `json:"provisioningState"` - - // ProviderID is the provider identification of the VMSS Instance - // +optional - ProviderID string `json:"providerID"` - - // InstanceID is the identification of the Machine Instance within the VMSS - // +optional - InstanceID string `json:"instanceID"` - - // InstanceName is the name of the Machine Instance within the VMSS - // +optional - InstanceName string `json:"instanceName"` - - // LatestModelApplied indicates the instance is running the most up-to-date VMSS model. A VMSS model describes - // the image version the VM is running. If the instance is not running the latest model, it means the instance - // may not be running the version of Kubernetes the Machine Pool has specified and needs to be updated. - LatestModelApplied bool `json:"latestModelApplied"` - } - - // +kubebuilder:object:root=true - // +kubebuilder:subresource:status - // +kubebuilder:resource:path=azuremachinepools,scope=Namespaced,categories=cluster-api,shortName=amp - // +kubebuilder:printcolumn:name="Replicas",type="string",JSONPath=".status.replicas",description="AzureMachinePool replicas count" - // +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.ready",description="AzureMachinePool replicas count" - // +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.provisioningState",description="Azure VMSS provisioning state" - // +kubebuilder:printcolumn:name="Cluster",type="string",priority=1,JSONPath=".metadata.labels.cluster\\.x-k8s\\.io/cluster-name",description="Cluster to which this AzureMachinePool belongs" - // +kubebuilder:printcolumn:name="MachinePool",type="string",priority=1,JSONPath=".metadata.ownerReferences[?(@.kind==\"MachinePool\")].name",description="MachinePool object to which this AzureMachinePool belongs" - // +kubebuilder:printcolumn:name="VMSS ID",type="string",priority=1,JSONPath=".spec.providerID",description="Azure VMSS ID" - // +kubebuilder:printcolumn:name="VM Size",type="string",priority=1,JSONPath=".spec.template.vmSize",description="Azure VM Size" - - // AzureMachinePool is the Schema for the azuremachinepools API. - AzureMachinePool struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec AzureMachinePoolSpec `json:"spec,omitempty"` - Status AzureMachinePoolStatus `json:"status,omitempty"` - } - - // +kubebuilder:object:root=true - - // AzureMachinePoolList contains a list of AzureMachinePools. - AzureMachinePoolList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []AzureMachinePool `json:"items"` - } -) - -// GetConditions returns the list of conditions for an AzureMachinePool API object. -func (amp *AzureMachinePool) GetConditions() clusterv1alpha4.Conditions { - return amp.Status.Conditions -} - -// SetConditions will set the given conditions on an AzureMachinePool object. -func (amp *AzureMachinePool) SetConditions(conditions clusterv1alpha4.Conditions) { - amp.Status.Conditions = conditions -} - -// GetFutures returns the list of long running operation states for an AzureMachinePool API object. -func (amp *AzureMachinePool) GetFutures() infrav1alpha4.Futures { - return amp.Status.LongRunningOperationStates -} - -// SetFutures will set the given long running operation states on an AzureMachinePool object. -func (amp *AzureMachinePool) SetFutures(futures infrav1alpha4.Futures) { - amp.Status.LongRunningOperationStates = futures -} - -func init() { - SchemeBuilder.Register(&AzureMachinePool{}, &AzureMachinePoolList{}) -} diff --git a/exp/api/v1alpha4/azuremachinepoolmachine_conversion.go b/exp/api/v1alpha4/azuremachinepoolmachine_conversion.go deleted file mode 100644 index 5591d3f5318..00000000000 --- a/exp/api/v1alpha4/azuremachinepoolmachine_conversion.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha4 - -import ( - infrav1exp "sigs.k8s.io/cluster-api-provider-azure/exp/api/v1beta1" - utilconversion "sigs.k8s.io/cluster-api/util/conversion" - "sigs.k8s.io/controller-runtime/pkg/conversion" -) - -// ConvertTo converts this AzureMachinePoolMachine to the Hub version (v1beta1). -func (src *AzureMachinePoolMachine) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*infrav1exp.AzureMachinePoolMachine) - if err := Convert_v1alpha4_AzureMachinePoolMachine_To_v1beta1_AzureMachinePoolMachine(src, dst, nil); err != nil { - return err - } - restored := &infrav1exp.AzureMachinePoolMachine{} - if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { - return err - } - dst.Spec = restored.Spec - - return nil -} - -// ConvertFrom converts from the Hub version (v1beta1) to this version. -func (dst *AzureMachinePoolMachine) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*infrav1exp.AzureMachinePoolMachine) - - if err := Convert_v1beta1_AzureMachinePoolMachine_To_v1alpha4_AzureMachinePoolMachine(src, dst, nil); err != nil { - return err - } - - // Preserve Hub data on down-conversion. - return utilconversion.MarshalData(src, dst) -} - -// ConvertTo converts this AzureMachinePoolMachineList to the Hub version (v1beta1). -func (src *AzureMachinePoolMachineList) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*infrav1exp.AzureMachinePoolMachineList) - return Convert_v1alpha4_AzureMachinePoolMachineList_To_v1beta1_AzureMachinePoolMachineList(src, dst, nil) -} - -// ConvertFrom converts from the Hub version (v1beta1) to this version. -func (dst *AzureMachinePoolMachineList) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*infrav1exp.AzureMachinePoolMachineList) - return Convert_v1beta1_AzureMachinePoolMachineList_To_v1alpha4_AzureMachinePoolMachineList(src, dst, nil) -} diff --git a/exp/api/v1alpha4/azuremachinepoolmachine_types.go b/exp/api/v1alpha4/azuremachinepoolmachine_types.go deleted file mode 100644 index c864e3078b3..00000000000 --- a/exp/api/v1alpha4/azuremachinepoolmachine_types.go +++ /dev/null @@ -1,150 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -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 v1alpha4 - -import ( - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - infrav1alpha4 "sigs.k8s.io/cluster-api-provider-azure/api/v1alpha4" - clusterv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" - "sigs.k8s.io/cluster-api/errors" -) - -const ( - // AzureMachinePoolMachineFinalizer is used to ensure deletion of dependencies (nodes, infra). - AzureMachinePoolMachineFinalizer = "azuremachinepoolmachine.infrastructure.cluster.x-k8s.io" -) - -type ( - - // AzureMachinePoolMachineSpec defines the desired state of AzureMachinePoolMachine. - AzureMachinePoolMachineSpec struct { - // ProviderID is the identification ID of the Virtual Machine Scale Set - ProviderID string `json:"providerID"` - - // InstanceID is the identification of the Machine Instance within the VMSS - InstanceID string `json:"instanceID"` - } - - // AzureMachinePoolMachineStatus defines the observed state of AzureMachinePoolMachine. - AzureMachinePoolMachineStatus struct { - // NodeRef will point to the corresponding Node if it exists. - // +optional - NodeRef *corev1.ObjectReference `json:"nodeRef,omitempty"` - - // Version defines the Kubernetes version for the VM Instance - // +optional - Version string `json:"version"` - - // ProvisioningState is the provisioning state of the Azure virtual machine instance. - // +optional - ProvisioningState *infrav1alpha4.ProvisioningState `json:"provisioningState"` - - // InstanceName is the name of the Machine Instance within the VMSS - // +optional - InstanceName string `json:"instanceName"` - - // FailureReason will be set in the event that there is a terminal problem - // reconciling the MachinePool machine and will contain a succinct value suitable - // for machine interpretation. - // - // Any transient errors that occur during the reconciliation of MachinePools - // can be added as events to the MachinePool object and/or logged in the - // controller's output. - // +optional - FailureReason *errors.MachineStatusError `json:"failureReason,omitempty"` - - // FailureMessage will be set in the event that there is a terminal problem - // reconciling the MachinePool and will contain a more verbose string suitable - // for logging and human consumption. - // - // Any transient errors that occur during the reconciliation of MachinePools - // can be added as events to the MachinePool object and/or logged in the - // controller's output. - // +optional - FailureMessage *string `json:"failureMessage,omitempty"` - - // Conditions defines current service state of the AzureMachinePool. - // +optional - Conditions clusterv1alpha4.Conditions `json:"conditions,omitempty"` - - // LongRunningOperationStates saves the state for Azure long running operations so they can be continued on the - // next reconciliation loop. - // +optional - LongRunningOperationStates infrav1alpha4.Futures `json:"longRunningOperationStates,omitempty"` - - // LatestModelApplied indicates the instance is running the most up-to-date VMSS model. A VMSS model describes - // the image version the VM is running. If the instance is not running the latest model, it means the instance - // may not be running the version of Kubernetes the Machine Pool has specified and needs to be updated. - LatestModelApplied bool `json:"latestModelApplied"` - - // Ready is true when the provider resource is ready. - // +optional - Ready bool `json:"ready"` - } - - // +kubebuilder:object:root=true - // +kubebuilder:subresource:status - // +kubebuilder:resource:path=azuremachinepoolmachines,scope=Namespaced,categories=cluster-api,shortName=ampm - // +kubebuilder:printcolumn:name="Version",type="string",JSONPath=".status.version",description="Kubernetes version" - // +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.ready",description="Flag indicating infrastructure is successfully provisioned" - // +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.provisioningState",description="Azure VMSS VM provisioning state" - // +kubebuilder:printcolumn:name="Cluster",type="string",priority=1,JSONPath=".metadata.labels.cluster\\.x-k8s\\.io/cluster-name",description="Cluster to which this AzureMachinePoolMachine belongs" - // +kubebuilder:printcolumn:name="VMSS VM ID",type="string",priority=1,JSONPath=".spec.providerID",description="Azure VMSS VM ID" - - // AzureMachinePoolMachine is the Schema for the azuremachinepoolmachines API. - AzureMachinePoolMachine struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec AzureMachinePoolMachineSpec `json:"spec,omitempty"` - Status AzureMachinePoolMachineStatus `json:"status,omitempty"` - } - - // +kubebuilder:object:root=true - - // AzureMachinePoolMachineList contains a list of AzureMachinePoolMachines. - AzureMachinePoolMachineList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []AzureMachinePoolMachine `json:"items"` - } -) - -// GetConditions returns the list of conditions for an AzureMachinePool API object. -func (ampm *AzureMachinePoolMachine) GetConditions() clusterv1alpha4.Conditions { - return ampm.Status.Conditions -} - -// SetConditions will set the given conditions on an AzureMachinePool object. -func (ampm *AzureMachinePoolMachine) SetConditions(conditions clusterv1alpha4.Conditions) { - ampm.Status.Conditions = conditions -} - -// GetFutures returns the list of long running operation states for an AzureMachinePoolMachine API object. -func (ampm *AzureMachinePoolMachine) GetFutures() infrav1alpha4.Futures { - return ampm.Status.LongRunningOperationStates -} - -// SetFutures will set the given long running operation states on an AzureMachinePoolMachine object. -func (ampm *AzureMachinePoolMachine) SetFutures(futures infrav1alpha4.Futures) { - ampm.Status.LongRunningOperationStates = futures -} - -func init() { - SchemeBuilder.Register(&AzureMachinePoolMachine{}, &AzureMachinePoolMachineList{}) -} diff --git a/exp/api/v1alpha4/conversion.go b/exp/api/v1alpha4/conversion.go deleted file mode 100644 index b0c3a1ef545..00000000000 --- a/exp/api/v1alpha4/conversion.go +++ /dev/null @@ -1,55 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -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 v1alpha4 - -import ( - "k8s.io/apimachinery/pkg/conversion" - infrav1alpha4 "sigs.k8s.io/cluster-api-provider-azure/api/v1alpha4" - infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" - clusterv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" - clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" -) - -// Convert_v1alpha4_OSDisk_To_v1beta1_OSDisk is a conversion function. -func Convert_v1alpha4_OSDisk_To_v1beta1_OSDisk(in *infrav1alpha4.OSDisk, out *infrav1.OSDisk, s conversion.Scope) error { - return infrav1alpha4.Convert_v1alpha4_OSDisk_To_v1beta1_OSDisk(in, out, s) -} - -// Convert_v1beta1_OSDisk_To_v1alpha4_OSDisk is a conversion function. -func Convert_v1beta1_OSDisk_To_v1alpha4_OSDisk(in *infrav1.OSDisk, out *infrav1alpha4.OSDisk, s conversion.Scope) error { - return infrav1alpha4.Convert_v1beta1_OSDisk_To_v1alpha4_OSDisk(in, out, s) -} - -// Convert_v1alpha4_Image_To_v1beta1_Image is a conversion function. -func Convert_v1alpha4_Image_To_v1beta1_Image(in *infrav1alpha4.Image, out *infrav1.Image, s conversion.Scope) error { - return infrav1alpha4.Convert_v1alpha4_Image_To_v1beta1_Image(in, out, s) -} - -// Convert_v1beta1_Image_To_v1alpha4_Image is a conversion function. -func Convert_v1beta1_Image_To_v1alpha4_Image(in *infrav1.Image, out *infrav1alpha4.Image, s conversion.Scope) error { - return infrav1alpha4.Convert_v1beta1_Image_To_v1alpha4_Image(in, out, s) -} - -// Convert_v1alpha4_APIEndpoint_To_v1beta1_APIEndpoint is an autogenerated conversion function. -func Convert_v1alpha4_APIEndpoint_To_v1beta1_APIEndpoint(in *clusterv1alpha4.APIEndpoint, out *clusterv1.APIEndpoint, s conversion.Scope) error { - return clusterv1alpha4.Convert_v1alpha4_APIEndpoint_To_v1beta1_APIEndpoint(in, out, s) -} - -// Convert_v1beta1_APIEndpoint_To_v1alpha4_APIEndpoint is an autogenerated conversion function. -func Convert_v1beta1_APIEndpoint_To_v1alpha4_APIEndpoint(in *clusterv1.APIEndpoint, out *clusterv1alpha4.APIEndpoint, s conversion.Scope) error { - return clusterv1alpha4.Convert_v1beta1_APIEndpoint_To_v1alpha4_APIEndpoint(in, out, s) -} diff --git a/exp/api/v1alpha4/conversion_test.go b/exp/api/v1alpha4/conversion_test.go deleted file mode 100644 index f7b3f27fe90..00000000000 --- a/exp/api/v1alpha4/conversion_test.go +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha4 - -import ( - "testing" - - . "github.com/onsi/gomega" - "k8s.io/apimachinery/pkg/runtime" - infrav1exp "sigs.k8s.io/cluster-api-provider-azure/exp/api/v1beta1" - utilconversion "sigs.k8s.io/cluster-api/util/conversion" -) - -func TestFuzzyConversion(t *testing.T) { - g := NewWithT(t) - scheme := runtime.NewScheme() - g.Expect(AddToScheme(scheme)).To(Succeed()) - g.Expect(infrav1exp.AddToScheme(scheme)).To(Succeed()) - - t.Run("for AzureMachinePool", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ - Scheme: scheme, - Hub: &infrav1exp.AzureMachinePool{}, - Spoke: &AzureMachinePool{}, - })) - - t.Run("for AzureMachinePoolMachine", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ - Scheme: scheme, - Hub: &infrav1exp.AzureMachinePoolMachine{}, - Spoke: &AzureMachinePoolMachine{}, - })) -} diff --git a/exp/api/v1alpha4/doc.go b/exp/api/v1alpha4/doc.go deleted file mode 100644 index c13c5b77f4f..00000000000 --- a/exp/api/v1alpha4/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha4 - -// +k8s:conversion-gen=sigs.k8s.io/cluster-api-provider-azure/exp/api/v1beta1 diff --git a/exp/api/v1alpha4/groupversion_info.go b/exp/api/v1alpha4/groupversion_info.go deleted file mode 100644 index adb87d30049..00000000000 --- a/exp/api/v1alpha4/groupversion_info.go +++ /dev/null @@ -1,39 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -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 v1alpha4 contains API Schema definitions for the exp v1alpha4 API group -// +kubebuilder:object:generate=true -// +groupName=infrastructure.cluster.x-k8s.io -package v1alpha4 - -import ( - "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/scheme" -) - -var ( - // GroupVersion is group version used to register these objects. - GroupVersion = schema.GroupVersion{Group: "infrastructure.cluster.x-k8s.io", Version: "v1alpha4"} - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme. - SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} - - // AddToScheme adds the types in this group-version to the given scheme. - AddToScheme = SchemeBuilder.AddToScheme - - // localSchemeBuilder is used for type conversions. - localSchemeBuilder = SchemeBuilder.SchemeBuilder -) diff --git a/exp/api/v1alpha4/zz_generated.conversion.go b/exp/api/v1alpha4/zz_generated.conversion.go deleted file mode 100644 index e15b1205d3d..00000000000 --- a/exp/api/v1alpha4/zz_generated.conversion.go +++ /dev/null @@ -1,641 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright The Kubernetes Authors. - -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. -*/ - -// Code generated by conversion-gen-v0.23.1. DO NOT EDIT. - -package v1alpha4 - -import ( - unsafe "unsafe" - - v1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - conversion "k8s.io/apimachinery/pkg/conversion" - runtime "k8s.io/apimachinery/pkg/runtime" - intstr "k8s.io/apimachinery/pkg/util/intstr" - clusterapiproviderazureapiv1alpha4 "sigs.k8s.io/cluster-api-provider-azure/api/v1alpha4" - clusterapiproviderazureapiv1beta1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" - v1beta1 "sigs.k8s.io/cluster-api-provider-azure/exp/api/v1beta1" - apiv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" - apiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" - errors "sigs.k8s.io/cluster-api/errors" -) - -func init() { - localSchemeBuilder.Register(RegisterConversions) -} - -// RegisterConversions adds conversion functions to the given scheme. -// Public to allow building arbitrary schemes. -func RegisterConversions(s *runtime.Scheme) error { - if err := s.AddGeneratedConversionFunc((*AzureMachinePool)(nil), (*v1beta1.AzureMachinePool)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureMachinePool_To_v1beta1_AzureMachinePool(a.(*AzureMachinePool), b.(*v1beta1.AzureMachinePool), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureMachinePool)(nil), (*AzureMachinePool)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMachinePool_To_v1alpha4_AzureMachinePool(a.(*v1beta1.AzureMachinePool), b.(*AzureMachinePool), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureMachinePoolDeploymentStrategy)(nil), (*v1beta1.AzureMachinePoolDeploymentStrategy)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureMachinePoolDeploymentStrategy_To_v1beta1_AzureMachinePoolDeploymentStrategy(a.(*AzureMachinePoolDeploymentStrategy), b.(*v1beta1.AzureMachinePoolDeploymentStrategy), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureMachinePoolDeploymentStrategy)(nil), (*AzureMachinePoolDeploymentStrategy)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMachinePoolDeploymentStrategy_To_v1alpha4_AzureMachinePoolDeploymentStrategy(a.(*v1beta1.AzureMachinePoolDeploymentStrategy), b.(*AzureMachinePoolDeploymentStrategy), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureMachinePoolInstanceStatus)(nil), (*v1beta1.AzureMachinePoolInstanceStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureMachinePoolInstanceStatus_To_v1beta1_AzureMachinePoolInstanceStatus(a.(*AzureMachinePoolInstanceStatus), b.(*v1beta1.AzureMachinePoolInstanceStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureMachinePoolInstanceStatus)(nil), (*AzureMachinePoolInstanceStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMachinePoolInstanceStatus_To_v1alpha4_AzureMachinePoolInstanceStatus(a.(*v1beta1.AzureMachinePoolInstanceStatus), b.(*AzureMachinePoolInstanceStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureMachinePoolList)(nil), (*v1beta1.AzureMachinePoolList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureMachinePoolList_To_v1beta1_AzureMachinePoolList(a.(*AzureMachinePoolList), b.(*v1beta1.AzureMachinePoolList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureMachinePoolList)(nil), (*AzureMachinePoolList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMachinePoolList_To_v1alpha4_AzureMachinePoolList(a.(*v1beta1.AzureMachinePoolList), b.(*AzureMachinePoolList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureMachinePoolMachine)(nil), (*v1beta1.AzureMachinePoolMachine)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureMachinePoolMachine_To_v1beta1_AzureMachinePoolMachine(a.(*AzureMachinePoolMachine), b.(*v1beta1.AzureMachinePoolMachine), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureMachinePoolMachine)(nil), (*AzureMachinePoolMachine)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMachinePoolMachine_To_v1alpha4_AzureMachinePoolMachine(a.(*v1beta1.AzureMachinePoolMachine), b.(*AzureMachinePoolMachine), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureMachinePoolMachineList)(nil), (*v1beta1.AzureMachinePoolMachineList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureMachinePoolMachineList_To_v1beta1_AzureMachinePoolMachineList(a.(*AzureMachinePoolMachineList), b.(*v1beta1.AzureMachinePoolMachineList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureMachinePoolMachineList)(nil), (*AzureMachinePoolMachineList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMachinePoolMachineList_To_v1alpha4_AzureMachinePoolMachineList(a.(*v1beta1.AzureMachinePoolMachineList), b.(*AzureMachinePoolMachineList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureMachinePoolMachineSpec)(nil), (*v1beta1.AzureMachinePoolMachineSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureMachinePoolMachineSpec_To_v1beta1_AzureMachinePoolMachineSpec(a.(*AzureMachinePoolMachineSpec), b.(*v1beta1.AzureMachinePoolMachineSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureMachinePoolMachineSpec)(nil), (*AzureMachinePoolMachineSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMachinePoolMachineSpec_To_v1alpha4_AzureMachinePoolMachineSpec(a.(*v1beta1.AzureMachinePoolMachineSpec), b.(*AzureMachinePoolMachineSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureMachinePoolMachineStatus)(nil), (*v1beta1.AzureMachinePoolMachineStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureMachinePoolMachineStatus_To_v1beta1_AzureMachinePoolMachineStatus(a.(*AzureMachinePoolMachineStatus), b.(*v1beta1.AzureMachinePoolMachineStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureMachinePoolMachineStatus)(nil), (*AzureMachinePoolMachineStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMachinePoolMachineStatus_To_v1alpha4_AzureMachinePoolMachineStatus(a.(*v1beta1.AzureMachinePoolMachineStatus), b.(*AzureMachinePoolMachineStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureMachinePoolMachineTemplate)(nil), (*v1beta1.AzureMachinePoolMachineTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureMachinePoolMachineTemplate_To_v1beta1_AzureMachinePoolMachineTemplate(a.(*AzureMachinePoolMachineTemplate), b.(*v1beta1.AzureMachinePoolMachineTemplate), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureMachinePoolSpec)(nil), (*v1beta1.AzureMachinePoolSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureMachinePoolSpec_To_v1beta1_AzureMachinePoolSpec(a.(*AzureMachinePoolSpec), b.(*v1beta1.AzureMachinePoolSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*AzureMachinePoolStatus)(nil), (*v1beta1.AzureMachinePoolStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureMachinePoolStatus_To_v1beta1_AzureMachinePoolStatus(a.(*AzureMachinePoolStatus), b.(*v1beta1.AzureMachinePoolStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.AzureMachinePoolStatus)(nil), (*AzureMachinePoolStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMachinePoolStatus_To_v1alpha4_AzureMachinePoolStatus(a.(*v1beta1.AzureMachinePoolStatus), b.(*AzureMachinePoolStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*MachineRollingUpdateDeployment)(nil), (*v1beta1.MachineRollingUpdateDeployment)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_MachineRollingUpdateDeployment_To_v1beta1_MachineRollingUpdateDeployment(a.(*MachineRollingUpdateDeployment), b.(*v1beta1.MachineRollingUpdateDeployment), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.MachineRollingUpdateDeployment)(nil), (*MachineRollingUpdateDeployment)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_MachineRollingUpdateDeployment_To_v1alpha4_MachineRollingUpdateDeployment(a.(*v1beta1.MachineRollingUpdateDeployment), b.(*MachineRollingUpdateDeployment), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*apiv1alpha4.APIEndpoint)(nil), (*apiv1beta1.APIEndpoint)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_APIEndpoint_To_v1beta1_APIEndpoint(a.(*apiv1alpha4.APIEndpoint), b.(*apiv1beta1.APIEndpoint), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*clusterapiproviderazureapiv1alpha4.Image)(nil), (*clusterapiproviderazureapiv1beta1.Image)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_Image_To_v1beta1_Image(a.(*clusterapiproviderazureapiv1alpha4.Image), b.(*clusterapiproviderazureapiv1beta1.Image), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*clusterapiproviderazureapiv1alpha4.OSDisk)(nil), (*clusterapiproviderazureapiv1beta1.OSDisk)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_OSDisk_To_v1beta1_OSDisk(a.(*clusterapiproviderazureapiv1alpha4.OSDisk), b.(*clusterapiproviderazureapiv1beta1.OSDisk), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*clusterapiproviderazureapiv1alpha4.SpotVMOptions)(nil), (*clusterapiproviderazureapiv1beta1.SpotVMOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_SpotVMOptions_To_v1beta1_SpotVMOptions(a.(*clusterapiproviderazureapiv1alpha4.SpotVMOptions), b.(*clusterapiproviderazureapiv1beta1.SpotVMOptions), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*apiv1beta1.APIEndpoint)(nil), (*apiv1alpha4.APIEndpoint)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_APIEndpoint_To_v1alpha4_APIEndpoint(a.(*apiv1beta1.APIEndpoint), b.(*apiv1alpha4.APIEndpoint), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.AzureMachinePoolMachineTemplate)(nil), (*AzureMachinePoolMachineTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMachinePoolMachineTemplate_To_v1alpha4_AzureMachinePoolMachineTemplate(a.(*v1beta1.AzureMachinePoolMachineTemplate), b.(*AzureMachinePoolMachineTemplate), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1beta1.AzureMachinePoolSpec)(nil), (*AzureMachinePoolSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_AzureMachinePoolSpec_To_v1alpha4_AzureMachinePoolSpec(a.(*v1beta1.AzureMachinePoolSpec), b.(*AzureMachinePoolSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*clusterapiproviderazureapiv1beta1.Image)(nil), (*clusterapiproviderazureapiv1alpha4.Image)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_Image_To_v1alpha4_Image(a.(*clusterapiproviderazureapiv1beta1.Image), b.(*clusterapiproviderazureapiv1alpha4.Image), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*clusterapiproviderazureapiv1beta1.OSDisk)(nil), (*clusterapiproviderazureapiv1alpha4.OSDisk)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_OSDisk_To_v1alpha4_OSDisk(a.(*clusterapiproviderazureapiv1beta1.OSDisk), b.(*clusterapiproviderazureapiv1alpha4.OSDisk), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*clusterapiproviderazureapiv1beta1.SpotVMOptions)(nil), (*clusterapiproviderazureapiv1alpha4.SpotVMOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_SpotVMOptions_To_v1alpha4_SpotVMOptions(a.(*clusterapiproviderazureapiv1beta1.SpotVMOptions), b.(*clusterapiproviderazureapiv1alpha4.SpotVMOptions), scope) - }); err != nil { - return err - } - return nil -} - -func autoConvert_v1alpha4_AzureMachinePool_To_v1beta1_AzureMachinePool(in *AzureMachinePool, out *v1beta1.AzureMachinePool, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha4_AzureMachinePoolSpec_To_v1beta1_AzureMachinePoolSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1alpha4_AzureMachinePoolStatus_To_v1beta1_AzureMachinePoolStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha4_AzureMachinePool_To_v1beta1_AzureMachinePool is an autogenerated conversion function. -func Convert_v1alpha4_AzureMachinePool_To_v1beta1_AzureMachinePool(in *AzureMachinePool, out *v1beta1.AzureMachinePool, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureMachinePool_To_v1beta1_AzureMachinePool(in, out, s) -} - -func autoConvert_v1beta1_AzureMachinePool_To_v1alpha4_AzureMachinePool(in *v1beta1.AzureMachinePool, out *AzureMachinePool, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1beta1_AzureMachinePoolSpec_To_v1alpha4_AzureMachinePoolSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1beta1_AzureMachinePoolStatus_To_v1alpha4_AzureMachinePoolStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta1_AzureMachinePool_To_v1alpha4_AzureMachinePool is an autogenerated conversion function. -func Convert_v1beta1_AzureMachinePool_To_v1alpha4_AzureMachinePool(in *v1beta1.AzureMachinePool, out *AzureMachinePool, s conversion.Scope) error { - return autoConvert_v1beta1_AzureMachinePool_To_v1alpha4_AzureMachinePool(in, out, s) -} - -func autoConvert_v1alpha4_AzureMachinePoolDeploymentStrategy_To_v1beta1_AzureMachinePoolDeploymentStrategy(in *AzureMachinePoolDeploymentStrategy, out *v1beta1.AzureMachinePoolDeploymentStrategy, s conversion.Scope) error { - out.Type = v1beta1.AzureMachinePoolDeploymentStrategyType(in.Type) - out.RollingUpdate = (*v1beta1.MachineRollingUpdateDeployment)(unsafe.Pointer(in.RollingUpdate)) - return nil -} - -// Convert_v1alpha4_AzureMachinePoolDeploymentStrategy_To_v1beta1_AzureMachinePoolDeploymentStrategy is an autogenerated conversion function. -func Convert_v1alpha4_AzureMachinePoolDeploymentStrategy_To_v1beta1_AzureMachinePoolDeploymentStrategy(in *AzureMachinePoolDeploymentStrategy, out *v1beta1.AzureMachinePoolDeploymentStrategy, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureMachinePoolDeploymentStrategy_To_v1beta1_AzureMachinePoolDeploymentStrategy(in, out, s) -} - -func autoConvert_v1beta1_AzureMachinePoolDeploymentStrategy_To_v1alpha4_AzureMachinePoolDeploymentStrategy(in *v1beta1.AzureMachinePoolDeploymentStrategy, out *AzureMachinePoolDeploymentStrategy, s conversion.Scope) error { - out.Type = AzureMachinePoolDeploymentStrategyType(in.Type) - out.RollingUpdate = (*MachineRollingUpdateDeployment)(unsafe.Pointer(in.RollingUpdate)) - return nil -} - -// Convert_v1beta1_AzureMachinePoolDeploymentStrategy_To_v1alpha4_AzureMachinePoolDeploymentStrategy is an autogenerated conversion function. -func Convert_v1beta1_AzureMachinePoolDeploymentStrategy_To_v1alpha4_AzureMachinePoolDeploymentStrategy(in *v1beta1.AzureMachinePoolDeploymentStrategy, out *AzureMachinePoolDeploymentStrategy, s conversion.Scope) error { - return autoConvert_v1beta1_AzureMachinePoolDeploymentStrategy_To_v1alpha4_AzureMachinePoolDeploymentStrategy(in, out, s) -} - -func autoConvert_v1alpha4_AzureMachinePoolInstanceStatus_To_v1beta1_AzureMachinePoolInstanceStatus(in *AzureMachinePoolInstanceStatus, out *v1beta1.AzureMachinePoolInstanceStatus, s conversion.Scope) error { - out.Version = in.Version - out.ProvisioningState = (*clusterapiproviderazureapiv1beta1.ProvisioningState)(unsafe.Pointer(in.ProvisioningState)) - out.ProviderID = in.ProviderID - out.InstanceID = in.InstanceID - out.InstanceName = in.InstanceName - out.LatestModelApplied = in.LatestModelApplied - return nil -} - -// Convert_v1alpha4_AzureMachinePoolInstanceStatus_To_v1beta1_AzureMachinePoolInstanceStatus is an autogenerated conversion function. -func Convert_v1alpha4_AzureMachinePoolInstanceStatus_To_v1beta1_AzureMachinePoolInstanceStatus(in *AzureMachinePoolInstanceStatus, out *v1beta1.AzureMachinePoolInstanceStatus, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureMachinePoolInstanceStatus_To_v1beta1_AzureMachinePoolInstanceStatus(in, out, s) -} - -func autoConvert_v1beta1_AzureMachinePoolInstanceStatus_To_v1alpha4_AzureMachinePoolInstanceStatus(in *v1beta1.AzureMachinePoolInstanceStatus, out *AzureMachinePoolInstanceStatus, s conversion.Scope) error { - out.Version = in.Version - out.ProvisioningState = (*clusterapiproviderazureapiv1alpha4.ProvisioningState)(unsafe.Pointer(in.ProvisioningState)) - out.ProviderID = in.ProviderID - out.InstanceID = in.InstanceID - out.InstanceName = in.InstanceName - out.LatestModelApplied = in.LatestModelApplied - return nil -} - -// Convert_v1beta1_AzureMachinePoolInstanceStatus_To_v1alpha4_AzureMachinePoolInstanceStatus is an autogenerated conversion function. -func Convert_v1beta1_AzureMachinePoolInstanceStatus_To_v1alpha4_AzureMachinePoolInstanceStatus(in *v1beta1.AzureMachinePoolInstanceStatus, out *AzureMachinePoolInstanceStatus, s conversion.Scope) error { - return autoConvert_v1beta1_AzureMachinePoolInstanceStatus_To_v1alpha4_AzureMachinePoolInstanceStatus(in, out, s) -} - -func autoConvert_v1alpha4_AzureMachinePoolList_To_v1beta1_AzureMachinePoolList(in *AzureMachinePoolList, out *v1beta1.AzureMachinePoolList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]v1beta1.AzureMachinePool, len(*in)) - for i := range *in { - if err := Convert_v1alpha4_AzureMachinePool_To_v1beta1_AzureMachinePool(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1alpha4_AzureMachinePoolList_To_v1beta1_AzureMachinePoolList is an autogenerated conversion function. -func Convert_v1alpha4_AzureMachinePoolList_To_v1beta1_AzureMachinePoolList(in *AzureMachinePoolList, out *v1beta1.AzureMachinePoolList, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureMachinePoolList_To_v1beta1_AzureMachinePoolList(in, out, s) -} - -func autoConvert_v1beta1_AzureMachinePoolList_To_v1alpha4_AzureMachinePoolList(in *v1beta1.AzureMachinePoolList, out *AzureMachinePoolList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]AzureMachinePool, len(*in)) - for i := range *in { - if err := Convert_v1beta1_AzureMachinePool_To_v1alpha4_AzureMachinePool(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1beta1_AzureMachinePoolList_To_v1alpha4_AzureMachinePoolList is an autogenerated conversion function. -func Convert_v1beta1_AzureMachinePoolList_To_v1alpha4_AzureMachinePoolList(in *v1beta1.AzureMachinePoolList, out *AzureMachinePoolList, s conversion.Scope) error { - return autoConvert_v1beta1_AzureMachinePoolList_To_v1alpha4_AzureMachinePoolList(in, out, s) -} - -func autoConvert_v1alpha4_AzureMachinePoolMachine_To_v1beta1_AzureMachinePoolMachine(in *AzureMachinePoolMachine, out *v1beta1.AzureMachinePoolMachine, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha4_AzureMachinePoolMachineSpec_To_v1beta1_AzureMachinePoolMachineSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1alpha4_AzureMachinePoolMachineStatus_To_v1beta1_AzureMachinePoolMachineStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha4_AzureMachinePoolMachine_To_v1beta1_AzureMachinePoolMachine is an autogenerated conversion function. -func Convert_v1alpha4_AzureMachinePoolMachine_To_v1beta1_AzureMachinePoolMachine(in *AzureMachinePoolMachine, out *v1beta1.AzureMachinePoolMachine, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureMachinePoolMachine_To_v1beta1_AzureMachinePoolMachine(in, out, s) -} - -func autoConvert_v1beta1_AzureMachinePoolMachine_To_v1alpha4_AzureMachinePoolMachine(in *v1beta1.AzureMachinePoolMachine, out *AzureMachinePoolMachine, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1beta1_AzureMachinePoolMachineSpec_To_v1alpha4_AzureMachinePoolMachineSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1beta1_AzureMachinePoolMachineStatus_To_v1alpha4_AzureMachinePoolMachineStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta1_AzureMachinePoolMachine_To_v1alpha4_AzureMachinePoolMachine is an autogenerated conversion function. -func Convert_v1beta1_AzureMachinePoolMachine_To_v1alpha4_AzureMachinePoolMachine(in *v1beta1.AzureMachinePoolMachine, out *AzureMachinePoolMachine, s conversion.Scope) error { - return autoConvert_v1beta1_AzureMachinePoolMachine_To_v1alpha4_AzureMachinePoolMachine(in, out, s) -} - -func autoConvert_v1alpha4_AzureMachinePoolMachineList_To_v1beta1_AzureMachinePoolMachineList(in *AzureMachinePoolMachineList, out *v1beta1.AzureMachinePoolMachineList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - out.Items = *(*[]v1beta1.AzureMachinePoolMachine)(unsafe.Pointer(&in.Items)) - return nil -} - -// Convert_v1alpha4_AzureMachinePoolMachineList_To_v1beta1_AzureMachinePoolMachineList is an autogenerated conversion function. -func Convert_v1alpha4_AzureMachinePoolMachineList_To_v1beta1_AzureMachinePoolMachineList(in *AzureMachinePoolMachineList, out *v1beta1.AzureMachinePoolMachineList, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureMachinePoolMachineList_To_v1beta1_AzureMachinePoolMachineList(in, out, s) -} - -func autoConvert_v1beta1_AzureMachinePoolMachineList_To_v1alpha4_AzureMachinePoolMachineList(in *v1beta1.AzureMachinePoolMachineList, out *AzureMachinePoolMachineList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - out.Items = *(*[]AzureMachinePoolMachine)(unsafe.Pointer(&in.Items)) - return nil -} - -// Convert_v1beta1_AzureMachinePoolMachineList_To_v1alpha4_AzureMachinePoolMachineList is an autogenerated conversion function. -func Convert_v1beta1_AzureMachinePoolMachineList_To_v1alpha4_AzureMachinePoolMachineList(in *v1beta1.AzureMachinePoolMachineList, out *AzureMachinePoolMachineList, s conversion.Scope) error { - return autoConvert_v1beta1_AzureMachinePoolMachineList_To_v1alpha4_AzureMachinePoolMachineList(in, out, s) -} - -func autoConvert_v1alpha4_AzureMachinePoolMachineSpec_To_v1beta1_AzureMachinePoolMachineSpec(in *AzureMachinePoolMachineSpec, out *v1beta1.AzureMachinePoolMachineSpec, s conversion.Scope) error { - out.ProviderID = in.ProviderID - out.InstanceID = in.InstanceID - return nil -} - -// Convert_v1alpha4_AzureMachinePoolMachineSpec_To_v1beta1_AzureMachinePoolMachineSpec is an autogenerated conversion function. -func Convert_v1alpha4_AzureMachinePoolMachineSpec_To_v1beta1_AzureMachinePoolMachineSpec(in *AzureMachinePoolMachineSpec, out *v1beta1.AzureMachinePoolMachineSpec, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureMachinePoolMachineSpec_To_v1beta1_AzureMachinePoolMachineSpec(in, out, s) -} - -func autoConvert_v1beta1_AzureMachinePoolMachineSpec_To_v1alpha4_AzureMachinePoolMachineSpec(in *v1beta1.AzureMachinePoolMachineSpec, out *AzureMachinePoolMachineSpec, s conversion.Scope) error { - out.ProviderID = in.ProviderID - out.InstanceID = in.InstanceID - return nil -} - -// Convert_v1beta1_AzureMachinePoolMachineSpec_To_v1alpha4_AzureMachinePoolMachineSpec is an autogenerated conversion function. -func Convert_v1beta1_AzureMachinePoolMachineSpec_To_v1alpha4_AzureMachinePoolMachineSpec(in *v1beta1.AzureMachinePoolMachineSpec, out *AzureMachinePoolMachineSpec, s conversion.Scope) error { - return autoConvert_v1beta1_AzureMachinePoolMachineSpec_To_v1alpha4_AzureMachinePoolMachineSpec(in, out, s) -} - -func autoConvert_v1alpha4_AzureMachinePoolMachineStatus_To_v1beta1_AzureMachinePoolMachineStatus(in *AzureMachinePoolMachineStatus, out *v1beta1.AzureMachinePoolMachineStatus, s conversion.Scope) error { - out.NodeRef = (*v1.ObjectReference)(unsafe.Pointer(in.NodeRef)) - out.Version = in.Version - out.ProvisioningState = (*clusterapiproviderazureapiv1beta1.ProvisioningState)(unsafe.Pointer(in.ProvisioningState)) - out.InstanceName = in.InstanceName - out.FailureReason = (*errors.MachineStatusError)(unsafe.Pointer(in.FailureReason)) - out.FailureMessage = (*string)(unsafe.Pointer(in.FailureMessage)) - out.Conditions = *(*apiv1beta1.Conditions)(unsafe.Pointer(&in.Conditions)) - out.LongRunningOperationStates = *(*clusterapiproviderazureapiv1beta1.Futures)(unsafe.Pointer(&in.LongRunningOperationStates)) - out.LatestModelApplied = in.LatestModelApplied - out.Ready = in.Ready - return nil -} - -// Convert_v1alpha4_AzureMachinePoolMachineStatus_To_v1beta1_AzureMachinePoolMachineStatus is an autogenerated conversion function. -func Convert_v1alpha4_AzureMachinePoolMachineStatus_To_v1beta1_AzureMachinePoolMachineStatus(in *AzureMachinePoolMachineStatus, out *v1beta1.AzureMachinePoolMachineStatus, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureMachinePoolMachineStatus_To_v1beta1_AzureMachinePoolMachineStatus(in, out, s) -} - -func autoConvert_v1beta1_AzureMachinePoolMachineStatus_To_v1alpha4_AzureMachinePoolMachineStatus(in *v1beta1.AzureMachinePoolMachineStatus, out *AzureMachinePoolMachineStatus, s conversion.Scope) error { - out.NodeRef = (*v1.ObjectReference)(unsafe.Pointer(in.NodeRef)) - out.Version = in.Version - out.ProvisioningState = (*clusterapiproviderazureapiv1alpha4.ProvisioningState)(unsafe.Pointer(in.ProvisioningState)) - out.InstanceName = in.InstanceName - out.FailureReason = (*errors.MachineStatusError)(unsafe.Pointer(in.FailureReason)) - out.FailureMessage = (*string)(unsafe.Pointer(in.FailureMessage)) - out.Conditions = *(*apiv1alpha4.Conditions)(unsafe.Pointer(&in.Conditions)) - out.LongRunningOperationStates = *(*clusterapiproviderazureapiv1alpha4.Futures)(unsafe.Pointer(&in.LongRunningOperationStates)) - out.LatestModelApplied = in.LatestModelApplied - out.Ready = in.Ready - return nil -} - -// Convert_v1beta1_AzureMachinePoolMachineStatus_To_v1alpha4_AzureMachinePoolMachineStatus is an autogenerated conversion function. -func Convert_v1beta1_AzureMachinePoolMachineStatus_To_v1alpha4_AzureMachinePoolMachineStatus(in *v1beta1.AzureMachinePoolMachineStatus, out *AzureMachinePoolMachineStatus, s conversion.Scope) error { - return autoConvert_v1beta1_AzureMachinePoolMachineStatus_To_v1alpha4_AzureMachinePoolMachineStatus(in, out, s) -} - -func autoConvert_v1alpha4_AzureMachinePoolMachineTemplate_To_v1beta1_AzureMachinePoolMachineTemplate(in *AzureMachinePoolMachineTemplate, out *v1beta1.AzureMachinePoolMachineTemplate, s conversion.Scope) error { - out.VMSize = in.VMSize - if in.Image != nil { - in, out := &in.Image, &out.Image - *out = new(clusterapiproviderazureapiv1beta1.Image) - if err := Convert_v1alpha4_Image_To_v1beta1_Image(*in, *out, s); err != nil { - return err - } - } else { - out.Image = nil - } - if err := Convert_v1alpha4_OSDisk_To_v1beta1_OSDisk(&in.OSDisk, &out.OSDisk, s); err != nil { - return err - } - out.DataDisks = *(*[]clusterapiproviderazureapiv1beta1.DataDisk)(unsafe.Pointer(&in.DataDisks)) - out.SSHPublicKey = in.SSHPublicKey - out.AcceleratedNetworking = (*bool)(unsafe.Pointer(in.AcceleratedNetworking)) - out.TerminateNotificationTimeout = (*int)(unsafe.Pointer(in.TerminateNotificationTimeout)) - out.SecurityProfile = (*clusterapiproviderazureapiv1beta1.SecurityProfile)(unsafe.Pointer(in.SecurityProfile)) - if in.SpotVMOptions != nil { - in, out := &in.SpotVMOptions, &out.SpotVMOptions - *out = new(clusterapiproviderazureapiv1beta1.SpotVMOptions) - if err := Convert_v1alpha4_SpotVMOptions_To_v1beta1_SpotVMOptions(*in, *out, s); err != nil { - return err - } - } else { - out.SpotVMOptions = nil - } - out.SubnetName = in.SubnetName - return nil -} - -// Convert_v1alpha4_AzureMachinePoolMachineTemplate_To_v1beta1_AzureMachinePoolMachineTemplate is an autogenerated conversion function. -func Convert_v1alpha4_AzureMachinePoolMachineTemplate_To_v1beta1_AzureMachinePoolMachineTemplate(in *AzureMachinePoolMachineTemplate, out *v1beta1.AzureMachinePoolMachineTemplate, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureMachinePoolMachineTemplate_To_v1beta1_AzureMachinePoolMachineTemplate(in, out, s) -} - -func autoConvert_v1beta1_AzureMachinePoolMachineTemplate_To_v1alpha4_AzureMachinePoolMachineTemplate(in *v1beta1.AzureMachinePoolMachineTemplate, out *AzureMachinePoolMachineTemplate, s conversion.Scope) error { - out.VMSize = in.VMSize - if in.Image != nil { - in, out := &in.Image, &out.Image - *out = new(clusterapiproviderazureapiv1alpha4.Image) - if err := Convert_v1beta1_Image_To_v1alpha4_Image(*in, *out, s); err != nil { - return err - } - } else { - out.Image = nil - } - if err := Convert_v1beta1_OSDisk_To_v1alpha4_OSDisk(&in.OSDisk, &out.OSDisk, s); err != nil { - return err - } - out.DataDisks = *(*[]clusterapiproviderazureapiv1alpha4.DataDisk)(unsafe.Pointer(&in.DataDisks)) - out.SSHPublicKey = in.SSHPublicKey - out.AcceleratedNetworking = (*bool)(unsafe.Pointer(in.AcceleratedNetworking)) - // WARNING: in.Diagnostics requires manual conversion: does not exist in peer-type - out.TerminateNotificationTimeout = (*int)(unsafe.Pointer(in.TerminateNotificationTimeout)) - out.SecurityProfile = (*clusterapiproviderazureapiv1alpha4.SecurityProfile)(unsafe.Pointer(in.SecurityProfile)) - if in.SpotVMOptions != nil { - in, out := &in.SpotVMOptions, &out.SpotVMOptions - *out = new(clusterapiproviderazureapiv1alpha4.SpotVMOptions) - if err := Convert_v1beta1_SpotVMOptions_To_v1alpha4_SpotVMOptions(*in, *out, s); err != nil { - return err - } - } else { - out.SpotVMOptions = nil - } - out.SubnetName = in.SubnetName - // WARNING: in.VMExtensions requires manual conversion: does not exist in peer-type - // WARNING: in.NetworkInterfaces requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha4_AzureMachinePoolSpec_To_v1beta1_AzureMachinePoolSpec(in *AzureMachinePoolSpec, out *v1beta1.AzureMachinePoolSpec, s conversion.Scope) error { - out.Location = in.Location - if err := Convert_v1alpha4_AzureMachinePoolMachineTemplate_To_v1beta1_AzureMachinePoolMachineTemplate(&in.Template, &out.Template, s); err != nil { - return err - } - out.AdditionalTags = *(*clusterapiproviderazureapiv1beta1.Tags)(unsafe.Pointer(&in.AdditionalTags)) - out.ProviderID = in.ProviderID - out.ProviderIDList = *(*[]string)(unsafe.Pointer(&in.ProviderIDList)) - out.Identity = clusterapiproviderazureapiv1beta1.VMIdentity(in.Identity) - out.UserAssignedIdentities = *(*[]clusterapiproviderazureapiv1beta1.UserAssignedIdentity)(unsafe.Pointer(&in.UserAssignedIdentities)) - out.RoleAssignmentName = in.RoleAssignmentName - if err := Convert_v1alpha4_AzureMachinePoolDeploymentStrategy_To_v1beta1_AzureMachinePoolDeploymentStrategy(&in.Strategy, &out.Strategy, s); err != nil { - return err - } - out.NodeDrainTimeout = (*metav1.Duration)(unsafe.Pointer(in.NodeDrainTimeout)) - return nil -} - -// Convert_v1alpha4_AzureMachinePoolSpec_To_v1beta1_AzureMachinePoolSpec is an autogenerated conversion function. -func Convert_v1alpha4_AzureMachinePoolSpec_To_v1beta1_AzureMachinePoolSpec(in *AzureMachinePoolSpec, out *v1beta1.AzureMachinePoolSpec, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureMachinePoolSpec_To_v1beta1_AzureMachinePoolSpec(in, out, s) -} - -func autoConvert_v1beta1_AzureMachinePoolSpec_To_v1alpha4_AzureMachinePoolSpec(in *v1beta1.AzureMachinePoolSpec, out *AzureMachinePoolSpec, s conversion.Scope) error { - out.Location = in.Location - if err := Convert_v1beta1_AzureMachinePoolMachineTemplate_To_v1alpha4_AzureMachinePoolMachineTemplate(&in.Template, &out.Template, s); err != nil { - return err - } - out.AdditionalTags = *(*clusterapiproviderazureapiv1alpha4.Tags)(unsafe.Pointer(&in.AdditionalTags)) - out.ProviderID = in.ProviderID - out.ProviderIDList = *(*[]string)(unsafe.Pointer(&in.ProviderIDList)) - out.Identity = clusterapiproviderazureapiv1alpha4.VMIdentity(in.Identity) - // WARNING: in.SystemAssignedIdentityRole requires manual conversion: does not exist in peer-type - out.UserAssignedIdentities = *(*[]clusterapiproviderazureapiv1alpha4.UserAssignedIdentity)(unsafe.Pointer(&in.UserAssignedIdentities)) - out.RoleAssignmentName = in.RoleAssignmentName - if err := Convert_v1beta1_AzureMachinePoolDeploymentStrategy_To_v1alpha4_AzureMachinePoolDeploymentStrategy(&in.Strategy, &out.Strategy, s); err != nil { - return err - } - out.NodeDrainTimeout = (*metav1.Duration)(unsafe.Pointer(in.NodeDrainTimeout)) - // WARNING: in.OrchestrationMode requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha4_AzureMachinePoolStatus_To_v1beta1_AzureMachinePoolStatus(in *AzureMachinePoolStatus, out *v1beta1.AzureMachinePoolStatus, s conversion.Scope) error { - out.Ready = in.Ready - out.Replicas = in.Replicas - out.Instances = *(*[]*v1beta1.AzureMachinePoolInstanceStatus)(unsafe.Pointer(&in.Instances)) - if in.Image != nil { - in, out := &in.Image, &out.Image - *out = new(clusterapiproviderazureapiv1beta1.Image) - if err := Convert_v1alpha4_Image_To_v1beta1_Image(*in, *out, s); err != nil { - return err - } - } else { - out.Image = nil - } - out.Version = in.Version - out.ProvisioningState = (*clusterapiproviderazureapiv1beta1.ProvisioningState)(unsafe.Pointer(in.ProvisioningState)) - out.FailureReason = (*errors.MachineStatusError)(unsafe.Pointer(in.FailureReason)) - out.FailureMessage = (*string)(unsafe.Pointer(in.FailureMessage)) - out.Conditions = *(*apiv1beta1.Conditions)(unsafe.Pointer(&in.Conditions)) - out.LongRunningOperationStates = *(*clusterapiproviderazureapiv1beta1.Futures)(unsafe.Pointer(&in.LongRunningOperationStates)) - return nil -} - -// Convert_v1alpha4_AzureMachinePoolStatus_To_v1beta1_AzureMachinePoolStatus is an autogenerated conversion function. -func Convert_v1alpha4_AzureMachinePoolStatus_To_v1beta1_AzureMachinePoolStatus(in *AzureMachinePoolStatus, out *v1beta1.AzureMachinePoolStatus, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureMachinePoolStatus_To_v1beta1_AzureMachinePoolStatus(in, out, s) -} - -func autoConvert_v1beta1_AzureMachinePoolStatus_To_v1alpha4_AzureMachinePoolStatus(in *v1beta1.AzureMachinePoolStatus, out *AzureMachinePoolStatus, s conversion.Scope) error { - out.Ready = in.Ready - out.Replicas = in.Replicas - out.Instances = *(*[]*AzureMachinePoolInstanceStatus)(unsafe.Pointer(&in.Instances)) - if in.Image != nil { - in, out := &in.Image, &out.Image - *out = new(clusterapiproviderazureapiv1alpha4.Image) - if err := Convert_v1beta1_Image_To_v1alpha4_Image(*in, *out, s); err != nil { - return err - } - } else { - out.Image = nil - } - out.Version = in.Version - out.ProvisioningState = (*clusterapiproviderazureapiv1alpha4.ProvisioningState)(unsafe.Pointer(in.ProvisioningState)) - out.FailureReason = (*errors.MachineStatusError)(unsafe.Pointer(in.FailureReason)) - out.FailureMessage = (*string)(unsafe.Pointer(in.FailureMessage)) - out.Conditions = *(*apiv1alpha4.Conditions)(unsafe.Pointer(&in.Conditions)) - out.LongRunningOperationStates = *(*clusterapiproviderazureapiv1alpha4.Futures)(unsafe.Pointer(&in.LongRunningOperationStates)) - return nil -} - -// Convert_v1beta1_AzureMachinePoolStatus_To_v1alpha4_AzureMachinePoolStatus is an autogenerated conversion function. -func Convert_v1beta1_AzureMachinePoolStatus_To_v1alpha4_AzureMachinePoolStatus(in *v1beta1.AzureMachinePoolStatus, out *AzureMachinePoolStatus, s conversion.Scope) error { - return autoConvert_v1beta1_AzureMachinePoolStatus_To_v1alpha4_AzureMachinePoolStatus(in, out, s) -} - -func autoConvert_v1alpha4_MachineRollingUpdateDeployment_To_v1beta1_MachineRollingUpdateDeployment(in *MachineRollingUpdateDeployment, out *v1beta1.MachineRollingUpdateDeployment, s conversion.Scope) error { - out.MaxUnavailable = (*intstr.IntOrString)(unsafe.Pointer(in.MaxUnavailable)) - out.MaxSurge = (*intstr.IntOrString)(unsafe.Pointer(in.MaxSurge)) - out.DeletePolicy = v1beta1.AzureMachinePoolDeletePolicyType(in.DeletePolicy) - return nil -} - -// Convert_v1alpha4_MachineRollingUpdateDeployment_To_v1beta1_MachineRollingUpdateDeployment is an autogenerated conversion function. -func Convert_v1alpha4_MachineRollingUpdateDeployment_To_v1beta1_MachineRollingUpdateDeployment(in *MachineRollingUpdateDeployment, out *v1beta1.MachineRollingUpdateDeployment, s conversion.Scope) error { - return autoConvert_v1alpha4_MachineRollingUpdateDeployment_To_v1beta1_MachineRollingUpdateDeployment(in, out, s) -} - -func autoConvert_v1beta1_MachineRollingUpdateDeployment_To_v1alpha4_MachineRollingUpdateDeployment(in *v1beta1.MachineRollingUpdateDeployment, out *MachineRollingUpdateDeployment, s conversion.Scope) error { - out.MaxUnavailable = (*intstr.IntOrString)(unsafe.Pointer(in.MaxUnavailable)) - out.MaxSurge = (*intstr.IntOrString)(unsafe.Pointer(in.MaxSurge)) - out.DeletePolicy = AzureMachinePoolDeletePolicyType(in.DeletePolicy) - return nil -} - -// Convert_v1beta1_MachineRollingUpdateDeployment_To_v1alpha4_MachineRollingUpdateDeployment is an autogenerated conversion function. -func Convert_v1beta1_MachineRollingUpdateDeployment_To_v1alpha4_MachineRollingUpdateDeployment(in *v1beta1.MachineRollingUpdateDeployment, out *MachineRollingUpdateDeployment, s conversion.Scope) error { - return autoConvert_v1beta1_MachineRollingUpdateDeployment_To_v1alpha4_MachineRollingUpdateDeployment(in, out, s) -} diff --git a/exp/api/v1alpha4/zz_generated.deepcopy.go b/exp/api/v1alpha4/zz_generated.deepcopy.go deleted file mode 100644 index ca62d6534f9..00000000000 --- a/exp/api/v1alpha4/zz_generated.deepcopy.go +++ /dev/null @@ -1,422 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright The Kubernetes Authors. - -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. -*/ - -// Code generated by controller-gen. DO NOT EDIT. - -package v1alpha4 - -import ( - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/util/intstr" - apiv1alpha4 "sigs.k8s.io/cluster-api-provider-azure/api/v1alpha4" - cluster_apiapiv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" - "sigs.k8s.io/cluster-api/errors" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachinePool) DeepCopyInto(out *AzureMachinePool) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachinePool. -func (in *AzureMachinePool) DeepCopy() *AzureMachinePool { - if in == nil { - return nil - } - out := new(AzureMachinePool) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AzureMachinePool) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachinePoolDeploymentStrategy) DeepCopyInto(out *AzureMachinePoolDeploymentStrategy) { - *out = *in - if in.RollingUpdate != nil { - in, out := &in.RollingUpdate, &out.RollingUpdate - *out = new(MachineRollingUpdateDeployment) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachinePoolDeploymentStrategy. -func (in *AzureMachinePoolDeploymentStrategy) DeepCopy() *AzureMachinePoolDeploymentStrategy { - if in == nil { - return nil - } - out := new(AzureMachinePoolDeploymentStrategy) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachinePoolInstanceStatus) DeepCopyInto(out *AzureMachinePoolInstanceStatus) { - *out = *in - if in.ProvisioningState != nil { - in, out := &in.ProvisioningState, &out.ProvisioningState - *out = new(apiv1alpha4.ProvisioningState) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachinePoolInstanceStatus. -func (in *AzureMachinePoolInstanceStatus) DeepCopy() *AzureMachinePoolInstanceStatus { - if in == nil { - return nil - } - out := new(AzureMachinePoolInstanceStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachinePoolList) DeepCopyInto(out *AzureMachinePoolList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]AzureMachinePool, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachinePoolList. -func (in *AzureMachinePoolList) DeepCopy() *AzureMachinePoolList { - if in == nil { - return nil - } - out := new(AzureMachinePoolList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AzureMachinePoolList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachinePoolMachine) DeepCopyInto(out *AzureMachinePoolMachine) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachinePoolMachine. -func (in *AzureMachinePoolMachine) DeepCopy() *AzureMachinePoolMachine { - if in == nil { - return nil - } - out := new(AzureMachinePoolMachine) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AzureMachinePoolMachine) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachinePoolMachineList) DeepCopyInto(out *AzureMachinePoolMachineList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]AzureMachinePoolMachine, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachinePoolMachineList. -func (in *AzureMachinePoolMachineList) DeepCopy() *AzureMachinePoolMachineList { - if in == nil { - return nil - } - out := new(AzureMachinePoolMachineList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AzureMachinePoolMachineList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachinePoolMachineSpec) DeepCopyInto(out *AzureMachinePoolMachineSpec) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachinePoolMachineSpec. -func (in *AzureMachinePoolMachineSpec) DeepCopy() *AzureMachinePoolMachineSpec { - if in == nil { - return nil - } - out := new(AzureMachinePoolMachineSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachinePoolMachineStatus) DeepCopyInto(out *AzureMachinePoolMachineStatus) { - *out = *in - if in.NodeRef != nil { - in, out := &in.NodeRef, &out.NodeRef - *out = new(corev1.ObjectReference) - **out = **in - } - if in.ProvisioningState != nil { - in, out := &in.ProvisioningState, &out.ProvisioningState - *out = new(apiv1alpha4.ProvisioningState) - **out = **in - } - if in.FailureReason != nil { - in, out := &in.FailureReason, &out.FailureReason - *out = new(errors.MachineStatusError) - **out = **in - } - if in.FailureMessage != nil { - in, out := &in.FailureMessage, &out.FailureMessage - *out = new(string) - **out = **in - } - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(cluster_apiapiv1alpha4.Conditions, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.LongRunningOperationStates != nil { - in, out := &in.LongRunningOperationStates, &out.LongRunningOperationStates - *out = make(apiv1alpha4.Futures, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachinePoolMachineStatus. -func (in *AzureMachinePoolMachineStatus) DeepCopy() *AzureMachinePoolMachineStatus { - if in == nil { - return nil - } - out := new(AzureMachinePoolMachineStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachinePoolMachineTemplate) DeepCopyInto(out *AzureMachinePoolMachineTemplate) { - *out = *in - if in.Image != nil { - in, out := &in.Image, &out.Image - *out = new(apiv1alpha4.Image) - (*in).DeepCopyInto(*out) - } - in.OSDisk.DeepCopyInto(&out.OSDisk) - if in.DataDisks != nil { - in, out := &in.DataDisks, &out.DataDisks - *out = make([]apiv1alpha4.DataDisk, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.AcceleratedNetworking != nil { - in, out := &in.AcceleratedNetworking, &out.AcceleratedNetworking - *out = new(bool) - **out = **in - } - if in.TerminateNotificationTimeout != nil { - in, out := &in.TerminateNotificationTimeout, &out.TerminateNotificationTimeout - *out = new(int) - **out = **in - } - if in.SecurityProfile != nil { - in, out := &in.SecurityProfile, &out.SecurityProfile - *out = new(apiv1alpha4.SecurityProfile) - (*in).DeepCopyInto(*out) - } - if in.SpotVMOptions != nil { - in, out := &in.SpotVMOptions, &out.SpotVMOptions - *out = new(apiv1alpha4.SpotVMOptions) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachinePoolMachineTemplate. -func (in *AzureMachinePoolMachineTemplate) DeepCopy() *AzureMachinePoolMachineTemplate { - if in == nil { - return nil - } - out := new(AzureMachinePoolMachineTemplate) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachinePoolSpec) DeepCopyInto(out *AzureMachinePoolSpec) { - *out = *in - in.Template.DeepCopyInto(&out.Template) - if in.AdditionalTags != nil { - in, out := &in.AdditionalTags, &out.AdditionalTags - *out = make(apiv1alpha4.Tags, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.ProviderIDList != nil { - in, out := &in.ProviderIDList, &out.ProviderIDList - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.UserAssignedIdentities != nil { - in, out := &in.UserAssignedIdentities, &out.UserAssignedIdentities - *out = make([]apiv1alpha4.UserAssignedIdentity, len(*in)) - copy(*out, *in) - } - in.Strategy.DeepCopyInto(&out.Strategy) - if in.NodeDrainTimeout != nil { - in, out := &in.NodeDrainTimeout, &out.NodeDrainTimeout - *out = new(v1.Duration) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachinePoolSpec. -func (in *AzureMachinePoolSpec) DeepCopy() *AzureMachinePoolSpec { - if in == nil { - return nil - } - out := new(AzureMachinePoolSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachinePoolStatus) DeepCopyInto(out *AzureMachinePoolStatus) { - *out = *in - if in.Instances != nil { - in, out := &in.Instances, &out.Instances - *out = make([]*AzureMachinePoolInstanceStatus, len(*in)) - for i := range *in { - if (*in)[i] != nil { - in, out := &(*in)[i], &(*out)[i] - *out = new(AzureMachinePoolInstanceStatus) - (*in).DeepCopyInto(*out) - } - } - } - if in.Image != nil { - in, out := &in.Image, &out.Image - *out = new(apiv1alpha4.Image) - (*in).DeepCopyInto(*out) - } - if in.ProvisioningState != nil { - in, out := &in.ProvisioningState, &out.ProvisioningState - *out = new(apiv1alpha4.ProvisioningState) - **out = **in - } - if in.FailureReason != nil { - in, out := &in.FailureReason, &out.FailureReason - *out = new(errors.MachineStatusError) - **out = **in - } - if in.FailureMessage != nil { - in, out := &in.FailureMessage, &out.FailureMessage - *out = new(string) - **out = **in - } - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(cluster_apiapiv1alpha4.Conditions, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.LongRunningOperationStates != nil { - in, out := &in.LongRunningOperationStates, &out.LongRunningOperationStates - *out = make(apiv1alpha4.Futures, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachinePoolStatus. -func (in *AzureMachinePoolStatus) DeepCopy() *AzureMachinePoolStatus { - if in == nil { - return nil - } - out := new(AzureMachinePoolStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MachineRollingUpdateDeployment) DeepCopyInto(out *MachineRollingUpdateDeployment) { - *out = *in - if in.MaxUnavailable != nil { - in, out := &in.MaxUnavailable, &out.MaxUnavailable - *out = new(intstr.IntOrString) - **out = **in - } - if in.MaxSurge != nil { - in, out := &in.MaxSurge, &out.MaxSurge - *out = new(intstr.IntOrString) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineRollingUpdateDeployment. -func (in *MachineRollingUpdateDeployment) DeepCopy() *MachineRollingUpdateDeployment { - if in == nil { - return nil - } - out := new(MachineRollingUpdateDeployment) - in.DeepCopyInto(out) - return out -} diff --git a/exp/api/v1beta1/azuremachinepool_default.go b/exp/api/v1beta1/azuremachinepool_default.go index 06c3b886885..d2baa14b173 100644 --- a/exp/api/v1beta1/azuremachinepool_default.go +++ b/exp/api/v1beta1/azuremachinepool_default.go @@ -42,7 +42,12 @@ func (amp *AzureMachinePool) SetDefaults(client client.Client) error { errs = append(errs, errors.Wrap(err, "failed to find parent machine pool")) } - subscriptionID, err := infrav1.GetSubscriptionID(client, machinePool.Spec.ClusterName, machinePool.Namespace, 5) + ownerAzureClusterName, ownerAzureClusterNamespace, err := infrav1.GetOwnerAzureClusterNameAndNamespace(client, machinePool.Spec.ClusterName, machinePool.Namespace, 5) + if err != nil { + errs = append(errs, errors.Wrap(err, "failed to get owner cluster")) + } + + subscriptionID, err := infrav1.GetSubscriptionID(client, ownerAzureClusterName, ownerAzureClusterNamespace, 5) if err != nil { errs = append(errs, errors.Wrap(err, "failed to get subscription ID")) } diff --git a/exp/api/v1beta1/azuremachinepool_default_test.go b/exp/api/v1beta1/azuremachinepool_default_test.go index 5844c61c17c..d7e57f55ada 100644 --- a/exp/api/v1beta1/azuremachinepool_default_test.go +++ b/exp/api/v1beta1/azuremachinepool_default_test.go @@ -84,6 +84,18 @@ func TestAzureMachinePool_SetIdentityDefaults(t *testing.T) { SystemAssignedIdentityRole: &infrav1.SystemAssignedIdentityRole{}, }}} + bothRoleAssignmentNamesPopulatedTest := test{machinePool: &AzureMachinePool{Spec: AzureMachinePoolSpec{ + Identity: infrav1.VMIdentitySystemAssigned, + RoleAssignmentName: existingRoleAssignmentName, + SystemAssignedIdentityRole: &infrav1.SystemAssignedIdentityRole{ + Name: existingRoleAssignmentName, + }, + }}} + + bothRoleAssignmentNamesPopulatedTest.machinePool.SetIdentityDefaults(fakeSubscriptionID) + g.Expect(bothRoleAssignmentNamesPopulatedTest.machinePool.Spec.RoleAssignmentName).To(Equal(existingRoleAssignmentName)) + g.Expect(bothRoleAssignmentNamesPopulatedTest.machinePool.Spec.SystemAssignedIdentityRole.Name).To(Equal(existingRoleAssignmentName)) + roleAssignmentExistTest.machinePool.SetIdentityDefaults(fakeSubscriptionID) g.Expect(roleAssignmentExistTest.machinePool.Spec.SystemAssignedIdentityRole.Name).To(Equal(existingRoleAssignmentName)) @@ -114,6 +126,10 @@ func TestAzureMachinePool_SetDiagnosticsDefaults(t *testing.T) { machinePool *AzureMachinePool } + bootDiagnosticsDefault := &infrav1.BootDiagnostics{ + StorageAccountType: infrav1.ManagedDiagnosticsStorage, + } + managedStorageDiagnostics := test{machinePool: &AzureMachinePool{ Spec: AzureMachinePoolSpec{ Template: AzureMachinePoolMachineTemplate{ @@ -161,6 +177,18 @@ func TestAzureMachinePool_SetDiagnosticsDefaults(t *testing.T) { }, }} + // Test that when no diagnostics are specified, the defaults are set correctly + nilBootDiagnostics := test{machinePool: &AzureMachinePool{ + Spec: AzureMachinePoolSpec{ + Template: AzureMachinePoolMachineTemplate{ + Diagnostics: &infrav1.Diagnostics{}, + }, + }, + }} + + nilBootDiagnostics.machinePool.SetDiagnosticsDefaults() + g.Expect(nilBootDiagnostics.machinePool.Spec.Template.Diagnostics.Boot).To(Equal(bootDiagnosticsDefault)) + managedStorageDiagnostics.machinePool.SetDiagnosticsDefaults() g.Expect(managedStorageDiagnostics.machinePool.Spec.Template.Diagnostics.Boot.StorageAccountType).To(Equal(infrav1.ManagedDiagnosticsStorage)) @@ -174,6 +202,45 @@ func TestAzureMachinePool_SetDiagnosticsDefaults(t *testing.T) { g.Expect(nilDiagnostics.machinePool.Spec.Template.Diagnostics.Boot.StorageAccountType).To(Equal(infrav1.ManagedDiagnosticsStorage)) } +func TestAzureMachinePool_SetSpotEvictionPolicyDefaults(t *testing.T) { + g := NewWithT(t) + + type test struct { + machinePool *AzureMachinePool + } + + // test to Ensure the the default policy is set to Deallocate if EvictionPolicy is nil + defaultEvictionPolicy := infrav1.SpotEvictionPolicyDeallocate + nilDiffDiskSettingsPolicy := test{machinePool: &AzureMachinePool{ + Spec: AzureMachinePoolSpec{ + Template: AzureMachinePoolMachineTemplate{ + SpotVMOptions: &infrav1.SpotVMOptions{ + EvictionPolicy: nil, + }, + }, + }, + }} + nilDiffDiskSettingsPolicy.machinePool.SetSpotEvictionPolicyDefaults() + g.Expect(nilDiffDiskSettingsPolicy.machinePool.Spec.Template.SpotVMOptions.EvictionPolicy).To(Equal(&defaultEvictionPolicy)) + + // test to Ensure the the default policy is set to Delete if diffDiskSettings option is set to "Local" + expectedEvictionPolicy := infrav1.SpotEvictionPolicyDelete + diffDiskSettingsPolicy := test{machinePool: &AzureMachinePool{ + Spec: AzureMachinePoolSpec{ + Template: AzureMachinePoolMachineTemplate{ + SpotVMOptions: &infrav1.SpotVMOptions{}, + OSDisk: infrav1.OSDisk{ + DiffDiskSettings: &infrav1.DiffDiskSettings{ + Option: "Local", + }, + }, + }, + }, + }} + diffDiskSettingsPolicy.machinePool.SetSpotEvictionPolicyDefaults() + g.Expect(diffDiskSettingsPolicy.machinePool.Spec.Template.SpotVMOptions.EvictionPolicy).To(Equal(&expectedEvictionPolicy)) +} + func TestAzureMachinePool_SetNetworkInterfacesDefaults(t *testing.T) { g := NewWithT(t) diff --git a/exp/api/v1beta1/azuremachinepool_webhook_test.go b/exp/api/v1beta1/azuremachinepool_webhook_test.go index 15b1ad2642c..31661d07cc0 100644 --- a/exp/api/v1beta1/azuremachinepool_webhook_test.go +++ b/exp/api/v1beta1/azuremachinepool_webhook_test.go @@ -264,7 +264,17 @@ type mockDefaultClient struct { } func (m mockDefaultClient) Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error { - obj.(*infrav1.AzureCluster).Spec.SubscriptionID = m.SubscriptionID + switch obj := obj.(type) { + case *infrav1.AzureCluster: + obj.Spec.SubscriptionID = m.SubscriptionID + case *clusterv1.Cluster: + obj.Spec.InfrastructureRef = &corev1.ObjectReference{ + Kind: "AzureCluster", + Name: "test-cluster", + } + default: + return errors.New("invalid object type") + } return nil } diff --git a/exp/api/v1beta1/doc.go b/exp/api/v1beta1/doc.go index d55ab5609a7..90c54a8d675 100644 --- a/exp/api/v1beta1/doc.go +++ b/exp/api/v1beta1/doc.go @@ -14,4 +14,5 @@ See the License for the specific language governing permissions and limitations under the License. */ +// +groupName=infrastructure.cluster.x-k8s.io package v1beta1 diff --git a/exp/api/v1beta1/groupversion_info.go b/exp/api/v1beta1/groupversion_info.go index 10075430ab6..58af7ef5805 100644 --- a/exp/api/v1beta1/groupversion_info.go +++ b/exp/api/v1beta1/groupversion_info.go @@ -16,7 +16,6 @@ limitations under the License. // Package v1beta1 contains API Schema definitions for the exp v1beta1 API group // +kubebuilder:object:generate=true -// +groupName=infrastructure.cluster.x-k8s.io package v1beta1 import ( diff --git a/exp/controllers/azuremachinepool_controller.go b/exp/controllers/azuremachinepool_controller.go index fbb9d9c90a8..e09ba3e3b9d 100644 --- a/exp/controllers/azuremachinepool_controller.go +++ b/exp/controllers/azuremachinepool_controller.go @@ -275,10 +275,11 @@ func (ampr *AzureMachinePoolReconciler) reconcileNormal(ctx context.Context, mac } // If the AzureMachine doesn't have our finalizer, add it. - controllerutil.AddFinalizer(machinePoolScope.AzureMachinePool, expv1.MachinePoolFinalizer) - // Register the finalizer immediately to avoid orphaning Azure resources on delete - if err := machinePoolScope.PatchObject(ctx); err != nil { - return reconcile.Result{}, err + if controllerutil.AddFinalizer(machinePoolScope.AzureMachinePool, expv1.MachinePoolFinalizer) { + // Register the finalizer immediately to avoid orphaning Azure resources on delete + if err := machinePoolScope.PatchObject(ctx); err != nil { + return reconcile.Result{}, err + } } if !clusterScope.Cluster.Status.InfrastructureReady { diff --git a/exp/controllers/azuremachinepool_controller_unit_test.go b/exp/controllers/azuremachinepool_controller_unit_test.go index c4c60f4238f..4498031bffb 100644 --- a/exp/controllers/azuremachinepool_controller_unit_test.go +++ b/exp/controllers/azuremachinepool_controller_unit_test.go @@ -88,7 +88,7 @@ func newMachinePool(clusterName, poolName string) *expv1.MachinePool { return &expv1.MachinePool{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ - clusterv1.ClusterLabelName: clusterName, + clusterv1.ClusterNameLabel: clusterName, }, Name: poolName, Namespace: "default", @@ -103,7 +103,7 @@ func newAzureMachinePool(clusterName, poolName string) *infrav1exp.AzureMachineP return &infrav1exp.AzureMachinePool{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ - clusterv1.ClusterLabelName: clusterName, + clusterv1.ClusterNameLabel: clusterName, }, Name: poolName, Namespace: "default", diff --git a/exp/controllers/helpers.go b/exp/controllers/helpers.go index c1bc74885e9..b7abf04a255 100644 --- a/exp/controllers/helpers.go +++ b/exp/controllers/helpers.go @@ -80,7 +80,7 @@ func AzureClusterToAzureMachinePoolsMapper(ctx context.Context, c client.Client, machineList := &expv1.MachinePoolList{} machineList.SetGroupVersionKind(gvk) // list all of the requested objects within the cluster namespace with the cluster name label - if err := c.List(ctx, machineList, client.InNamespace(azCluster.Namespace), client.MatchingLabels{clusterv1.ClusterLabelName: clusterName}); err != nil { + if err := c.List(ctx, machineList, client.InNamespace(azCluster.Namespace), client.MatchingLabels{clusterv1.ClusterNameLabel: clusterName}); err != nil { log.V(4).Info(fmt.Sprintf("unable to list machine pools in cluster %s", clusterName)) return nil } @@ -194,7 +194,7 @@ func AzureClusterToAzureMachinePoolsFunc(ctx context.Context, c client.Client, l return nil } - labels := map[string]string{clusterv1.ClusterLabelName: cluster.Name} + labels := map[string]string{clusterv1.ClusterNameLabel: cluster.Name} ampl := &infrav1exp.AzureMachinePoolList{} if err := c.List(ctx, ampl, client.InNamespace(ac.Namespace), client.MatchingLabels(labels)); err != nil { logWithValues.Error(err, "failed to list AzureMachinePools") @@ -230,7 +230,7 @@ func AzureMachinePoolToAzureMachinePoolMachines(ctx context.Context, c client.Cl logWithValues := log.WithValues("AzureMachinePool", amp.Name, "Namespace", amp.Namespace) labels := map[string]string{ - clusterv1.ClusterLabelName: amp.Labels[clusterv1.ClusterLabelName], + clusterv1.ClusterNameLabel: amp.Labels[clusterv1.ClusterNameLabel], infrav1exp.MachinePoolNameLabel: amp.Name, } ampml := &infrav1exp.AzureMachinePoolMachineList{} diff --git a/go.mod b/go.mod index d0400d20697..acbaee53893 100644 --- a/go.mod +++ b/go.mod @@ -1,124 +1,127 @@ module sigs.k8s.io/cluster-api-provider-azure -go 1.19 +go 1.20 require ( - github.com/Azure/aad-pod-identity v1.8.14 + github.com/Azure/aad-pod-identity v1.8.16 github.com/Azure/azure-sdk-for-go v68.0.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 - github.com/Azure/go-autorest/autorest v0.11.28 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 + github.com/Azure/azure-service-operator/v2 v2.0.0 + github.com/Azure/go-autorest/autorest v0.11.29 github.com/Azure/go-autorest/autorest/azure/auth v0.5.12 - github.com/Azure/go-autorest/autorest/to v0.4.0 github.com/Azure/go-autorest/tracing v0.6.0 github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d github.com/blang/semver v3.5.1+incompatible - github.com/go-logr/logr v1.2.3 + github.com/go-logr/logr v1.2.4 github.com/golang/mock v1.6.0 github.com/google/go-cmp v0.5.9 - github.com/google/gofuzz v1.2.0 github.com/google/uuid v1.3.0 - github.com/hashicorp/go-retryablehttp v0.7.2 + github.com/hashicorp/go-retryablehttp v0.7.4 github.com/hashicorp/golang-lru v0.5.4 github.com/jongio/azidext/go/azidext v0.4.0 - github.com/onsi/ginkgo/v2 v2.8.4 - github.com/onsi/gomega v1.27.1 + github.com/onsi/ginkgo/v2 v2.9.7 + github.com/onsi/gomega v1.27.8 github.com/pkg/errors v0.9.1 github.com/pkg/sftp v1.13.5 - github.com/prometheus/client_golang v1.14.0 + github.com/prometheus/client_golang v1.15.1 github.com/spf13/pflag v1.0.5 - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.40.0 - go.opentelemetry.io/otel v1.14.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.14.0 - go.opentelemetry.io/otel/exporters/prometheus v0.37.0 - go.opentelemetry.io/otel/metric v0.37.0 - go.opentelemetry.io/otel/sdk v1.14.0 - go.opentelemetry.io/otel/sdk/metric v0.37.0 - go.opentelemetry.io/otel/trace v1.14.0 - golang.org/x/crypto v0.7.0 - golang.org/x/mod v0.9.0 - golang.org/x/text v0.8.0 - helm.sh/helm/v3 v3.10.3 - k8s.io/api v0.25.4 - k8s.io/apimachinery v0.25.4 - k8s.io/client-go v0.25.4 - k8s.io/component-base v0.25.2 - k8s.io/klog/v2 v2.80.1 - k8s.io/kubectl v0.25.2 - k8s.io/utils v0.0.0-20220823124924-e9cbc92d1a73 - sigs.k8s.io/cloud-provider-azure v1.25.5 - sigs.k8s.io/cluster-api v1.3.5 - sigs.k8s.io/cluster-api/test v1.3.5 - sigs.k8s.io/controller-runtime v0.13.1 - sigs.k8s.io/kind v0.17.0 + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.41.0 + go.opentelemetry.io/otel v1.15.1 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.1 + go.opentelemetry.io/otel/exporters/prometheus v0.38.1 + go.opentelemetry.io/otel/metric v0.38.1 + go.opentelemetry.io/otel/sdk v1.15.1 + go.opentelemetry.io/otel/sdk/metric v0.38.1 + go.opentelemetry.io/otel/trace v1.15.1 + golang.org/x/crypto v0.9.0 + golang.org/x/mod v0.10.0 + golang.org/x/text v0.9.0 + helm.sh/helm/v3 v3.11.3 + k8s.io/api v0.26.2 + k8s.io/apimachinery v0.26.2 + k8s.io/client-go v0.26.2 + k8s.io/component-base v0.26.2 + k8s.io/klog/v2 v2.90.1 + k8s.io/kubectl v0.26.1 + k8s.io/utils v0.0.0-20230220204549-a5ecb0141aa5 + sigs.k8s.io/cloud-provider-azure v1.26.7 + sigs.k8s.io/cluster-api v1.4.2 + sigs.k8s.io/cluster-api/test v1.4.2 + sigs.k8s.io/controller-runtime v0.14.5 + sigs.k8s.io/kind v0.19.0 ) require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect + github.com/AdaLogics/go-fuzz-headers v0.0.0-20230106234847-43070de90fa1 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect github.com/Azure/go-autorest v14.2.0+incompatible // indirect - github.com/Azure/go-autorest/autorest/adal v0.9.21 // indirect + github.com/Azure/go-autorest/autorest/adal v0.9.23 // indirect github.com/Azure/go-autorest/autorest/azure/cli v0.4.5 // indirect github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect github.com/Azure/go-autorest/autorest/mocks v0.4.2 // indirect + github.com/Azure/go-autorest/autorest/to v0.4.0 // indirect github.com/Azure/go-autorest/autorest/validation v0.3.1 // indirect github.com/Azure/go-autorest/logger v0.2.1 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect - github.com/BurntSushi/toml v1.1.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 // indirect + github.com/BurntSushi/toml v1.2.1 // indirect github.com/MakeNowJust/heredoc v1.0.0 // indirect github.com/Masterminds/goutils v1.1.1 // indirect github.com/Masterminds/semver/v3 v3.2.0 // indirect github.com/Masterminds/sprig/v3 v3.2.3 // indirect github.com/Masterminds/squirrel v1.5.3 // indirect - github.com/Microsoft/go-winio v0.5.2 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/alessio/shellescape v1.4.1 // indirect - github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20220418222510-f25a4f6275ed // indirect + github.com/antlr/antlr4/runtime/Go/antlr v1.4.10 // indirect + github.com/benbjohnson/clock v1.1.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/blang/semver/v4 v4.0.0 // indirect - github.com/cenkalti/backoff/v4 v4.2.0 // indirect + github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/chai2010/gettext-go v1.0.2 // indirect - github.com/containerd/containerd v1.6.18 // indirect + github.com/containerd/containerd v1.7.0 // indirect github.com/coredns/caddy v1.1.0 // indirect github.com/coredns/corefile-migration v1.0.20 // indirect github.com/cyphar/filepath-securejoin v0.2.3 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dimchansky/utfbom v1.1.1 // indirect - github.com/docker/cli v20.10.17+incompatible // indirect - github.com/docker/distribution v2.8.1+incompatible // indirect - github.com/docker/docker v20.10.21+incompatible // indirect - github.com/docker/docker-credential-helpers v0.6.4 // indirect + github.com/docker/cli v20.10.21+incompatible // indirect + github.com/docker/distribution v2.8.2+incompatible // indirect + github.com/docker/docker v20.10.24+incompatible // indirect + github.com/docker/docker-credential-helpers v0.7.0 // indirect github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-metrics v0.0.1 // indirect - github.com/docker/go-units v0.4.0 // indirect + github.com/docker/go-units v0.5.0 // indirect github.com/drone/envsubst/v2 v2.0.0-20210730161058-179042472c46 // indirect - github.com/emicklei/go-restful/v3 v3.9.0 // indirect + github.com/emicklei/go-restful/v3 v3.10.1 // indirect github.com/evanphx/json-patch v5.6.0+incompatible // indirect github.com/evanphx/json-patch/v5 v5.6.0 // indirect github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect github.com/fatih/camelcase v1.0.0 // indirect - github.com/fatih/color v1.13.0 // indirect + github.com/fatih/color v1.15.0 // indirect github.com/felixge/httpsnoop v1.0.3 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/go-errors/errors v1.0.1 // indirect - github.com/go-gorp/gorp/v3 v3.0.2 // indirect + github.com/go-gorp/gorp/v3 v3.0.5 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-openapi/jsonpointer v0.19.5 // indirect github.com/go-openapi/jsonreference v0.20.0 // indirect github.com/go-openapi/swag v0.22.3 // indirect - github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect - github.com/gobuffalo/flect v0.3.0 // indirect + github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect + github.com/gobuffalo/flect v1.0.2 // indirect github.com/gobwas/glob v0.2.3 // indirect github.com/gofrs/uuid v4.2.0+incompatible // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt/v4 v4.5.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/protobuf v1.5.2 // indirect + github.com/golang/protobuf v1.5.3 // indirect github.com/google/btree v1.0.1 // indirect - github.com/google/cel-go v0.12.5 // indirect + github.com/google/cel-go v0.12.6 // indirect github.com/google/gnostic v0.6.9 // indirect - github.com/google/go-github/v45 v45.2.0 // indirect + github.com/google/go-github/v48 v48.2.0 // indirect github.com/google/go-querystring v1.1.0 // indirect + github.com/google/gofuzz v1.2.0 // indirect github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect github.com/google/safetext v0.0.0-20220905092116-b49f7bc46da2 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect @@ -126,25 +129,27 @@ require ( github.com/gosuri/uitable v0.0.4 // indirect github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect + github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/hcl v1.0.0 // indirect - github.com/huandu/xstrings v1.3.3 // indirect + github.com/huandu/xstrings v1.4.0 // indirect github.com/imdario/mergo v0.3.13 // indirect github.com/inconshreveable/mousetrap v1.0.1 // indirect github.com/jmoiron/sqlx v1.3.5 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/compress v1.13.6 // indirect + github.com/klauspost/compress v1.16.0 // indirect github.com/kr/fs v0.1.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect - github.com/lib/pq v1.10.6 // indirect + github.com/lib/pq v1.10.7 // indirect github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect - github.com/magiconair/properties v1.8.6 // indirect + github.com/magiconair/properties v1.8.7 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.16 // indirect + github.com/mattn/go-isatty v0.0.17 // indirect github.com/mattn/go-runewidth v0.0.14 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect @@ -154,68 +159,67 @@ require ( github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/moby/locker v1.0.1 // indirect github.com/moby/spdystream v0.2.0 // indirect - github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 // indirect + github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect github.com/morikuni/aec v1.0.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect - github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799 // indirect + github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b // indirect github.com/pelletier/go-toml v1.9.5 // indirect - github.com/pelletier/go-toml/v2 v2.0.5 // indirect + github.com/pelletier/go-toml/v2 v2.0.6 // indirect github.com/peterbourgon/diskv v2.0.1+incompatible // indirect github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect github.com/prometheus/client_model v0.3.0 // indirect - github.com/prometheus/common v0.37.0 // indirect - github.com/prometheus/procfs v0.8.0 // indirect + github.com/prometheus/common v0.42.0 // indirect + github.com/prometheus/procfs v0.9.0 // indirect github.com/rivo/uniseg v0.4.2 // indirect - github.com/rubenv/sql-migrate v1.1.2 // indirect - github.com/russross/blackfriday v1.5.2 // indirect + github.com/rubenv/sql-migrate v1.3.1 // indirect + github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/shopspring/decimal v1.3.1 // indirect - github.com/sirupsen/logrus v1.8.1 // indirect - github.com/spf13/afero v1.9.2 // indirect + github.com/sirupsen/logrus v1.9.0 // indirect + github.com/spf13/afero v1.9.3 // indirect github.com/spf13/cast v1.5.0 // indirect github.com/spf13/cobra v1.6.1 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect - github.com/spf13/viper v1.13.0 // indirect + github.com/spf13/viper v1.15.0 // indirect github.com/stoewer/go-strcase v1.2.0 // indirect - github.com/stretchr/objx v0.5.0 // indirect - github.com/subosito/gotenv v1.4.1 // indirect - github.com/valyala/fastjson v1.6.3 // indirect - github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect + github.com/subosito/gotenv v1.4.2 // indirect + github.com/valyala/fastjson v1.6.4 // indirect + github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/xeipuuv/gojsonschema v1.2.0 // indirect github.com/xlab/treeprint v1.1.0 // indirect - go.etcd.io/etcd/api/v3 v3.5.4 // indirect - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.1 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect - golang.org/x/net v0.8.0 // indirect - golang.org/x/oauth2 v0.4.0 // indirect - golang.org/x/sync v0.1.0 // indirect - golang.org/x/sys v0.6.0 // indirect - golang.org/x/term v0.6.0 // indirect - golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9 // indirect - golang.org/x/tools v0.6.0 // indirect + golang.org/x/exp v0.0.0-20220414153411-bcd21879b8fd // indirect + golang.org/x/net v0.10.0 // indirect + golang.org/x/oauth2 v0.6.0 // indirect + golang.org/x/sync v0.2.0 // indirect + golang.org/x/sys v0.8.0 // indirect + golang.org/x/term v0.8.0 // indirect + golang.org/x/time v0.3.0 // indirect + golang.org/x/tools v0.9.1 // indirect gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect - google.golang.org/grpc v1.53.0 // indirect - google.golang.org/protobuf v1.28.1 // indirect + google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect + google.golang.org/grpc v1.54.0 // indirect + google.golang.org/protobuf v1.30.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/apiextensions-apiserver v0.25.2 // indirect - k8s.io/apiserver v0.25.2 // indirect - k8s.io/cli-runtime v0.25.2 // indirect - k8s.io/cloud-provider v0.25.1-rc.0 // indirect + k8s.io/apiextensions-apiserver v0.26.1 // indirect + k8s.io/apiserver v0.26.2 // indirect + k8s.io/cli-runtime v0.26.1 // indirect + k8s.io/cloud-provider v0.26.2 // indirect k8s.io/cluster-bootstrap v0.25.0 // indirect - k8s.io/component-helpers v0.25.2 // indirect - k8s.io/kube-openapi v0.0.0-20220803164354-a70c9af30aea // indirect - oras.land/oras-go v1.2.0 // indirect + k8s.io/component-helpers v0.26.2 // indirect + k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 // indirect + oras.land/oras-go v1.2.2 // indirect sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect sigs.k8s.io/kustomize/api v0.12.1 // indirect sigs.k8s.io/kustomize/kyaml v0.13.9 // indirect @@ -223,4 +227,4 @@ require ( sigs.k8s.io/yaml v1.3.0 // indirect ) -replace sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v1.3.5 +replace sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v1.4.2 diff --git a/go.sum b/go.sum index 86af7d7a095..d64f48630f8 100644 --- a/go.sum +++ b/go.sum @@ -40,26 +40,38 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/Azure/aad-pod-identity v1.8.14 h1:Jx2xJC+CXCEO4ZEOCwH1p3qnDQVIaXJA7S+NOxoN3Ts= -github.com/Azure/aad-pod-identity v1.8.14/go.mod h1:O36iZm20TUZnaFt1DIZxuFpbfY2Kvf2VoJTBA9LPZ4Y= +github.com/AdaLogics/go-fuzz-headers v0.0.0-20230106234847-43070de90fa1 h1:EKPd1INOIyr5hWOWhvpmQpY6tKjeG0hT1s3AMC/9fic= +github.com/AdaLogics/go-fuzz-headers v0.0.0-20230106234847-43070de90fa1/go.mod h1:VzwV+t+dZ9j/H867F1M2ziD+yLHtB46oM35FxxMJ4d0= +github.com/Azure/aad-pod-identity v1.8.16 h1:133IMPNSB6EWc/Ofh66map+aIgX1m1FQrFaG78Xy0pY= +github.com/Azure/aad-pod-identity v1.8.16/go.mod h1:7ud3OsPAmBmebLCcyKO2mQHlJmHbmvgOhv9SFnbXTk8= github.com/Azure/azure-sdk-for-go v68.0.0+incompatible h1:fcYLmCpyNYRnvJbPerq7U0hS+6+I79yEDJBqVNcqUzU= github.com/Azure/azure-sdk-for-go v68.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0 h1:8kDqDngH+DmVBiCtIjCFTGa7MBnsIOkF9IccInFEbjk= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 h1:vcYCAze6p19qBW7MhZybIsqD8sMV8js0NyQM8JDnVtg= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0/go.mod h1:OQeznEEkTZ9OrhHJoDD8ZDq51FHgXjqtP9z6bEwBq9U= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appconfiguration/armappconfiguration v1.0.0 h1:5reBX+9pzc5xp9VrjSUoPrE8Wl/3y7wjfHzGjXzJbNk= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice v1.0.0 h1:figxyQZXzZQIcP3njhC68bYUiTw45J8/SsHaLW8Ax0M= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos v1.0.0 h1:Fv8iibGn1eSw0lt2V3cTsuokBEnOP+M//n8OiMcCgTM= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/machinelearning/armmachinelearning v1.0.0 h1:KWvCVjnOTKCZAlqED5KPNoN9AfcK2BhUeveLdiwy33Q= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redis/armredis v1.0.0 h1:nmpTBgRg1HynngFYICRhceC7s5dmbKN9fJ/XQz/UQ2I= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.0.0 h1:TMEyRFKh1zaSPmoQh3kxK+xRAYVq8guCI/7SMO0F3KY= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/subscription/armsubscription v1.0.0 h1:vsovXlTyKHZXnqzQyt7QMVkwpJBDkHchQL53qXaGBRY= +github.com/Azure/azure-service-operator/v2 v2.0.0 h1:qse4mdpy+X5OXvXs6MRwrqzZJnBLM8AYKOTAIXshnKo= +github.com/Azure/azure-service-operator/v2 v2.0.0/go.mod h1:Y6Gi8gMyCk2JW9kDwJSz81s1BysqcLXeMH3HtsqWD5E= 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.24/go.mod h1:G6kyRlFnTuSbEYkQGawPfsCswgme4iYf6rfSKUDzbCc= -github.com/Azure/go-autorest/autorest v0.11.28 h1:ndAExarwr5Y+GaHE6VCaY1kyS/HwwGGyuimVhWsHOEM= -github.com/Azure/go-autorest/autorest v0.11.28/go.mod h1:MrkzG3Y3AH668QyF9KRk5neJnGgmhQ6krbhR8Q5eMvA= +github.com/Azure/go-autorest/autorest v0.11.29 h1:I4+HL/JDvErx2LjyzaVxllw2lRDB5/BT2Bm4g20iqYw= +github.com/Azure/go-autorest/autorest v0.11.29/go.mod h1:ZtEzC4Jy2JDrZLxvWs8LrBWEBycl1hbT1eknI8MtfAs= github.com/Azure/go-autorest/autorest/adal v0.9.18/go.mod h1:XVVeme+LZwABT8K5Lc3hA4nAe8LDBVle26gTrguhhPQ= -github.com/Azure/go-autorest/autorest/adal v0.9.21 h1:jjQnVFXPfekaqb8vIsv2G1lxshoW+oGv4MDlhRtnYZk= -github.com/Azure/go-autorest/autorest/adal v0.9.21/go.mod h1:zua7mBUaCc5YnSLKYgGJR/w5ePdMDA6H56upLsHzA9U= +github.com/Azure/go-autorest/autorest/adal v0.9.22/go.mod h1:XuAbAEUv2Tta//+voMI038TrJBqjKam0me7qR+L8Cmk= +github.com/Azure/go-autorest/autorest/adal v0.9.23 h1:Yepx8CvFxwNKpH6ja7RZ+sKX+DWYNldbLiALMC3BTz8= +github.com/Azure/go-autorest/autorest/adal v0.9.23/go.mod h1:5pcMqFkdPhviJdlEy3kC/v1ZLnQl0MH6XA5YCcMhy4c= github.com/Azure/go-autorest/autorest/azure/auth v0.5.12 h1:wkAZRgT/pn8HhFyzfe9UnqOjJYqlembgCTi72Bm/xKk= github.com/Azure/go-autorest/autorest/azure/auth v0.5.12/go.mod h1:84w/uV8E37feW2NCJ08uT9VBfjfUHpgLVnG2InYD6cg= github.com/Azure/go-autorest/autorest/azure/cli v0.4.5 h1:0W/yGmFdTIT77fvdlGZ0LMISoLHFJ7Tx4U0yeB+uFs4= @@ -77,48 +89,49 @@ github.com/Azure/go-autorest/logger v0.2.1 h1:IG7i4p/mDa2Ce4TRyAO8IHnVhAVF3RFU+Z github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo= github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 h1:UE9n9rkJF62ArLb1F3DEjRt8O3jLwMWdSoypKV4f3MU= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= +github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 h1:OBhqkivkhkMqLPymWEppkm7vgPQY2XsHoEkaMQ0AdZY= +github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.0.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= -github.com/BurntSushi/toml v1.1.0 h1:ksErzDEI1khOiGPgpwuI7x2ebx/uXQNw7xJpn9Eq1+I= -github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak= +github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60= github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ4pzQ= github.com/MakeNowJust/heredoc v1.0.0/go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6lCpQ4fNJ8LE= -github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= -github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= +github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= github.com/Masterminds/semver/v3 v3.2.0 h1:3MEsd0SM6jqZojhjLWWeBY+Kcjy9i6MQAeY7YgDP83g= github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= -github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= +github.com/Masterminds/sprig/v3 v3.2.1/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk= github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA= github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBaRMhvYXJNkGuM= github.com/Masterminds/squirrel v1.5.3 h1:YPpoceAcxuzIljlr5iWpNKaql7hLeG1KLSrhvdHpkZc= github.com/Masterminds/squirrel v1.5.3/go.mod h1:NNaOrjSoIDfDA40n7sr2tPNZRfjzjA400rg+riTZj10= -github.com/Microsoft/go-winio v0.5.2 h1:a9IhgEQBCUEk6QCdml9CiJGhAws+YwffDHEMp1VMrpA= -github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= -github.com/Microsoft/hcsshim v0.9.6 h1:VwnDOgLeoi2du6dAznfmspNqTiwczvjv4K7NxuY9jsY= +github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg= +github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2BO69KH/soAE= +github.com/Microsoft/hcsshim v0.10.0-rc.7 h1:HBytQPxcv8Oy4244zbQbe6hnOnx544eL5QPUqhJldz8= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d h1:UrqY+r/OJnIp5u0s1SbQ8dVfLCZJsnvazdBP5hS4iRs= +github.com/a8m/expect v1.0.0/go.mod h1:4IwSCMumY49ScypDnjNbYEjgVeqy1/U2cEs3Lat96eA= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/alessio/shellescape v1.4.1 h1:V7yhSDDn8LP4lc4jS8pFkt0zCnzVJlG5JXy9BVKJUX0= github.com/alessio/shellescape v1.4.1/go.mod h1:PZAiSCk0LJaZkiCSkPv8qIobYglO3FPpyFjDCtHLS30= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20220418222510-f25a4f6275ed h1:ue9pVfIcP+QMEjfgo/Ez4ZjNZfonGgR6NgjMaJMu1Cg= -github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20220418222510-f25a4f6275ed/go.mod h1:F7bn7fEU90QkQ3tnmaTx3LTKLEDqnwWODIYppRQ5hnY= +github.com/antlr/antlr4/runtime/Go/antlr v1.4.10 h1:yL7+Jz0jTC6yykIK/Wh74gnTJnrGr5AyrNMXuA0gves= +github.com/antlr/antlr4/runtime/Go/antlr v1.4.10/go.mod h1:F7bn7fEU90QkQ3tnmaTx3LTKLEDqnwWODIYppRQ5hnY= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d h1:Byv0BzEl3/e6D5CLfI0j/7hiIEtvGVFPCZ7Ei2oq8iQ= github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= +github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= +github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -135,12 +148,11 @@ github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx2 github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd h1:rFt+Y/IK1aEZkEHchZRSq9OQbsSzIT/OrI8YFFmRIng= github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b h1:otBG+dV+YK+Soembjv71DPz3uX/V/6MMlSyD9JBQ6kQ= github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0 h1:nvj0OLI3YqYXer/kZD8Ri1aaunCxIEsOst1BVJswV0o= -github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= -github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= +github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chai2010/gettext-go v1.0.2 h1:1Lwwip6Q2QGsAdl/ZKPCwTe9fe0CjlUbqj5bFNSjIRk= @@ -157,15 +169,18 @@ github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/containerd/cgroups v1.0.4 h1:jN/mbWBEaz+T1pi5OFtnkQ+8qnmEbAr1Oo1FRm5B0dA= -github.com/containerd/containerd v1.6.18 h1:qZbsLvmyu+Vlty0/Ex5xc0z2YtKpIsb5n45mAMI+2Ns= -github.com/containerd/containerd v1.6.18/go.mod h1:1RdCUu95+gc2v9t3IL+zIlpClSmew7/0YS8O5eQZrOw= +github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM= +github.com/containerd/containerd v1.7.0 h1:G/ZQr3gMZs6ZT0qPUZ15znx5QSdQdASW11nXTLTM2Pg= +github.com/containerd/containerd v1.7.0/go.mod h1:QfR7Efgb/6X2BDpTPJRvPTYDE9rsF0FsXX9J8sIs/sc= +github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= github.com/coredns/caddy v1.1.0 h1:ezvsPrT/tA/7pYDBZxu0cT0VmWk75AfIaf6GSYCNMf0= github.com/coredns/caddy v1.1.0/go.mod h1:A6ntJQlAWuQfFlsd9hvigKbo2WS0VUs2l1e2F+BawD4= github.com/coredns/corefile-migration v1.0.20 h1:MdOkT6F3ehju/n9tgxlGct8XAajOX2vN+wG7To4BWSI= github.com/coredns/corefile-migration v1.0.20/go.mod h1:XnhgULOEouimnzgn0t4WPuFDN2/PJQcTxdWKC5eXNGE= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= @@ -173,11 +188,10 @@ github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfc github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/creack/pty v1.1.11 h1:07n33Z8lZxZ2qwegKbObQohDhXDQxiMMz1NOUGYlesw= -github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= github.com/cyphar/filepath-securejoin v0.2.3 h1:YX6ebbZCZP7VkM3scTTokDgBL2TY741X51MTk3ycuNI= github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= -github.com/danieljoos/wincred v1.1.0/go.mod h1:XYlo+eRTsVA9aHGp7NGjFkPla4m+DCL7hqDjlFjiygg= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -186,30 +200,30 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dimchansky/utfbom v1.1.1 h1:vV6w1AhK4VMnhBno/TPVCoK9U/LP0PkLCS9tbxHdi/U= github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE= -github.com/distribution/distribution/v3 v3.0.0-20220526142353-ffbd94cbe269 h1:hbCT8ZPPMqefiAWD2ZKjn7ypokIGViTvBBg/ExLSdCk= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/docker/cli v20.10.17+incompatible h1:eO2KS7ZFeov5UJeaDmIs1NFEDRf32PaqRpvoEkKBy5M= -github.com/docker/cli v20.10.17+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= -github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68= -github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v20.10.21+incompatible h1:UTLdBmHk3bEY+w8qeO5KttOhy6OmXWsl/FEet9Uswog= -github.com/docker/docker v20.10.21+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker-credential-helpers v0.6.4 h1:axCks+yV+2MR3/kZhAmy07yC56WZ2Pwu/fKWtKuZB0o= -github.com/docker/docker-credential-helpers v0.6.4/go.mod h1:ofX3UI0Gz1TteYBjtgs07O36Pyasyp66D2uKT7H8W1c= +github.com/distribution/distribution/v3 v3.0.0-20221208165359-362910506bc2 h1:aBfCb7iqHmDEIp6fBvC/hQUddQfg+3qdYjwzaiP9Hnc= +github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= +github.com/docker/cli v20.10.21+incompatible h1:qVkgyYUnOLQ98LtXBrwd/duVqPT2X4SHndOuGsfwyhU= +github.com/docker/cli v20.10.21+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= +github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= +github.com/docker/docker v20.10.24+incompatible h1:Ugvxm7a8+Gz6vqQYQQ2W7GYq5EUPaAiuPgIfVyI3dYE= +github.com/docker/docker v20.10.24+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker-credential-helpers v0.7.0 h1:xtCHsjxogADNZcdv1pKUHXryefjlVRqWqIhk/uXJp0A= +github.com/docker/docker-credential-helpers v0.7.0/go.mod h1:rETQfLdHNT3foU5kuNkFR1R1V12OJRRO5lzt2D1b5X0= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c h1:+pKlWGMw7gf6bQ+oDZB4KHQFypsfjYlq/C4rfL7D3g8= github.com/docker/go-metrics v0.0.1 h1:AgB/0SvBxihN0X8OR4SjsblXkbMvalQ8cjmtKQ2rQV8= github.com/docker/go-metrics v0.0.1/go.mod h1:cG1hvH2utMXtqgqqYE9plW6lDxS3/5ayHzueweSI3Vw= -github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= -github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= +github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1 h1:ZClxb8laGDf5arXfYcAtECDFgAgHklGI8CxgjHnXKJ4= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/drone/envsubst/v2 v2.0.0-20210730161058-179042472c46 h1:7QPwrLT79GlD5sizHf27aoY2RTvw62mO6x7mxkScNk0= github.com/drone/envsubst/v2 v2.0.0-20210730161058-179042472c46/go.mod h1:esf2rsHFNlZlxsqsZDojNBcnNs5REqIvRrWRHqX0vEU= github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153 h1:yUdfgN0XgIJw7foRItutHYUIhlcKzcSf5vDpdhQAKTc= -github.com/emicklei/go-restful/v3 v3.9.0 h1:XwGDlfxEnQZzuopoqxwSEllNcCOM9DhhFyhFIIGKwxE= -github.com/emicklei/go-restful/v3 v3.9.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/emicklei/go-restful/v3 v3.10.1 h1:rc42Y5YTp7Am7CS630D7JmhRjq4UlEUuEKfrDac4bSQ= +github.com/emicklei/go-restful/v3 v3.10.1/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -229,13 +243,16 @@ github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d/go.mod h1:ZZM github.com/fatih/camelcase v1.0.0 h1:hxNvNX/xYBp0ovncs8WyWZrOrpBNub/JfaMvbURyft8= github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwoZc+/fpc= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= +github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= +github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= +github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk= github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/flowstack/go-jsonschema v0.1.1/go.mod h1:yL7fNggx1o8rm9RlgXv7hTBWxdBM0rVwpMwimd3F3N0= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= 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= @@ -246,21 +263,16 @@ github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gorp/gorp/v3 v3.0.2 h1:ULqJXIekoqMx29FI5ekXXFoH1dT2Vc8UhnRzBg+Emz4= -github.com/go-gorp/gorp/v3 v3.0.2/go.mod h1:BJ3q1ejpV8cVALtcXvXaXyTOlMmJhWDxTmncaR6rwBY= +github.com/go-gorp/gorp/v3 v3.0.5 h1:PUjzYdYu3HBOh8LE+UUmRG2P0IRDak9XMeGNvaeq4Ow= +github.com/go-gorp/gorp/v3 v3.0.5/go.mod h1:dLEjIyyRNiXvNZ8PSmzpt1GsWAUK8kjVhEpjH8TixEw= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= -github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-logr/zapr v1.2.3 h1:a9vnzlIBPQBBkeaR9IuMUfmVOrQlkoC4YfPoFkX3T7A= @@ -272,15 +284,13 @@ github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXym github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= -github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I= -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= -github.com/gobuffalo/flect v0.3.0 h1:erfPWM+K1rFNIQeRPdeEXxo8yFr/PO17lhRnS8FUrtk= -github.com/gobuffalo/flect v0.3.0/go.mod h1:5pf3aGnsvqvCj50AVni7mJJF8ICxGZ8HomberC3pXLE= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= +github.com/gobuffalo/flect v1.0.2 h1:eqjPGSo2WmjgY2XlpGwo2NXgL3RucAKo4k4qQMNA5sA= +github.com/gobuffalo/flect v1.0.2/go.mod h1:A5msMlrHtLqh9umBSnvabjsMrCcCpAyzglnDvkbYKHs= github.com/gobuffalo/logger v1.0.6 h1:nnZNpxYo0zx+Aj9RfMPBm+x9zAU2OayFh/xrAWi34HU= github.com/gobuffalo/logger v1.0.6/go.mod h1:J31TBEHR1QLV2683OXTAItYIg8pv2JMHnF/quuAbMjs= github.com/gobuffalo/packd v1.0.1 h1:U2wXfRr4E9DH8IdsDLlRFwTZTK7hLfq9qT/QHXGVe/0= @@ -337,15 +347,16 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/gomodule/redigo v1.8.2 h1:H5XSIre1MB5NbPYFp+i1NBbb5qN1W8Y8YAQoAYbkm8k= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4= github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= -github.com/google/cel-go v0.12.5 h1:DmzaiSgoaqGCjtpPQWl26/gND+yRpim56H1jCVev6d8= -github.com/google/cel-go v0.12.5/go.mod h1:Jk7ljRzLBhkmiAwBoUxB1sZSCVBAzkqPF25olK/iRDw= +github.com/google/cel-go v0.12.6 h1:kjeKudqV0OygrAqA9fX6J55S8gj+Jre2tckIm5RoG4M= +github.com/google/cel-go v0.12.6/go.mod h1:Jk7ljRzLBhkmiAwBoUxB1sZSCVBAzkqPF25olK/iRDw= github.com/google/gnostic v0.6.9 h1:ZK/5VhkoX835RikCHpSUJV9a+S3e1zLh59YnyWeBW+0= github.com/google/gnostic v0.6.9/go.mod h1:Nm8234We1lq6iB9OmlgNv3nH91XLLVZHCDayfA3xq+E= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -360,10 +371,11 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-github/v45 v45.2.0 h1:5oRLszbrkvxDDqBCNj2hjDZMKmvexaZ1xw/FCD+K3FI= -github.com/google/go-github/v45 v45.2.0/go.mod h1:FObaZJEDSTa/WGCzZ2Z3eoCDXWJKMenWWTrd8jrta28= +github.com/google/go-github/v48 v48.2.0 h1:68puzySE6WqUY9KWmpOsDEQfDZsso98rT6pZcz9HqcE= +github.com/google/go-github/v48 v48.2.0/go.mod h1:dDlehKBDo850ZPvCTK0sEqTCVWcrGl2LcDiajkYi89Y= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -402,6 +414,7 @@ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORR github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gosuri/uitable v0.0.4 h1:IG2xLKRvErL3uhY6e1BylFzG+aJiwQviDDTfOKeKTpY= github.com/gosuri/uitable v0.0.4/go.mod h1:tKR86bXuXPZazfOTG1FIzvjIdXzd0mo4Vtn16vt0PJo= @@ -416,6 +429,8 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4Zs github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= +github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= @@ -424,8 +439,10 @@ github.com/hashicorp/go-hclog v1.2.0 h1:La19f8d7WIlm4ogzNHB0JGqs5AUDAZ2UfCY4sJXc github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-retryablehttp v0.7.2 h1:AcYqCvkpalPnPF2pn0KamgwamS42TqUDDYFRKq/RAd0= -github.com/hashicorp/go-retryablehttp v0.7.2/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= +github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= +github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= +github.com/hashicorp/go-retryablehttp v0.7.4 h1:ZQgVdpTdAL7WpMIwLzCfbalOcSUdkDZnpUv3/+BxzFA= +github.com/hashicorp/go-retryablehttp v0.7.4/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= @@ -442,9 +459,11 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= -github.com/huandu/xstrings v1.3.3 h1:/Gcsuc1x8JVbJ9/rlye4xZnVAbEkGauT8lbebqcQws4= github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= +github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU= +github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= @@ -462,10 +481,8 @@ github.com/jongio/azidext/go/azidext v0.4.0 h1:TOYyVFMeWGgXNhURSgrEtUCu7JAAKgsy+ github.com/jongio/azidext/go/azidext v0.4.0/go.mod h1:VrlpGde5B+pPbTUxnThE5UIQQkcebdr3jrC2MmlMVSI= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= -github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= @@ -473,16 +490,14 @@ github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1 github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/karrick/godirwalk v1.16.1 h1:DynhcF+bztK8gooS0+NDJFrdNZjJ3gzVzC545UNA9iw= github.com/karrick/godirwalk v1.16.1/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc= -github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/klauspost/compress v1.16.0 h1:iULayQNOReoYUe+1qtKOqw9CwJv3aNQu8ivo7lw1HU4= +github.com/klauspost/compress v1.16.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kortschak/utter v1.0.1/go.mod h1:vSmSjbyrlKjjsL71193LmzBOKgwePk9DH6uFaWHIInc= github.com/kr/fs v0.1.0 h1:Jskdu9ieNAYnjxsi0LbQp1ulIKZV1LAFgK1tWhpZgl8= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= @@ -490,27 +505,31 @@ github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFB github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 h1:SOEGU9fKiNWd/HOJuq6+3iTQz8KNCLtVX6idSoTLdUw= github.com/lann/builder v0.0.0-20180802200727-47ae307949d0/go.mod h1:dXGbAdH5GtBTC4WfIxhKZfyBF/HBFgRZSWwZ9g/He9o= github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 h1:P6pPBnrTSX3DEVR4fDembhRWSsG5rVo6hYhAB/ADZrk= github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0/go.mod h1:vmVJ0l/dxyfGW6FmdpVm2joNMFikkuWg0EoCKLGUMNw= +github.com/leanovate/gopter v0.2.8 h1:eFPtJ3aa5zLfbxGROSNY75T9Dume60CWBAqoWQ3h/ig= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.10.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lib/pq v1.10.6 h1:jbk+ZieJ0D7EVGJYpL9QTz7/YW6UHbmdnZWYyK5cdBs= -github.com/lib/pq v1.10.6/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= +github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de h1:9TO3cAIGXtEhnIaL+V+BEER86oLrvS+kWobKpbJuye0= github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de/go.mod h1:zAbeS9B/r2mtpb6U+EI2rYA5OAXxsYw6wTamcNW+zcE= github.com/lithammer/dedent v1.1.0/go.mod h1:jrXYCQtgg0nJiN+StA2KgR7w6CiQNv9Fd/Z9BP0jIOc= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= -github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo= -github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= +github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= +github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= @@ -522,27 +541,31 @@ github.com/markbates/oncer v1.0.0/go.mod h1:Z59JA581E9GP6w96jai+TGqafHPW+cPfRxz2 github.com/markbates/safe v1.0.1 h1:yjZkbvRM6IzKj9tlu/zMJLS0n/V351OZWRnF3QfaUxI= github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= -github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= +github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-oci8 v0.1.1/go.mod h1:wjDx6Xm9q7dFtHJvIlrI99JytznLw5wQ4R+9mNXJwGI= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= -github.com/mattn/go-sqlite3 v1.14.6 h1:dNPt6NO46WmLVt2DLNpwczCmdV5boIZ6g/tlDrlRUbg= github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= +github.com/mattn/go-sqlite3 v1.14.15 h1:vfoHhTN1af61xCRSWzFIWzx2YskyMTwHLrExkBOjvxI= +github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= -github.com/mitchellh/cli v1.1.2/go.mod h1:6iaV0fGdElS6dPBx0EApTxHrcWvmJphyh2n8YBLPPZ4= +github.com/mitchellh/cli v1.1.5/go.mod h1:v8+iFts2sPIKUV1ltktPXMCC8fumSKFItNcD2cLtRR4= github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= @@ -566,9 +589,9 @@ github.com/moby/locker v1.0.1 h1:fOXqR41zeveg4fFODix+1Ch4mj/gT0NE1XJbp/epuBg= github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc= github.com/moby/spdystream v0.2.0 h1:cjW1zVyyoiM0T7b6UoySUFqzXMoqRckQtXwGPiBhOM8= github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= -github.com/moby/sys/mountinfo v0.5.0 h1:2Ks8/r6lopsxWi9m58nlwjaeSzUX9iiL1vj5qB/9ObI= -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/moby/sys/mountinfo v0.6.2 h1:BzJjoreD5BMFNmD9Rus6gdd1pLuecOFPt8wC+Vygl78= +github.com/moby/term v0.0.0-20221205130635-1aeaba878587 h1:HfkjXDfhgVaN5rmueG8cL8KKeFNecRCXFhaJ2qZ5SKA= +github.com/moby/term v0.0.0-20221205130635-1aeaba878587/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= 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= @@ -583,28 +606,27 @@ github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7P 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= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nelsam/hel/v2 v2.3.2/go.mod h1:1ZTGfU2PFTOd5mx22i5O0Lc2GY933lQ2wb/ggy+rL3w= +github.com/nelsam/hel/v2 v2.3.3/go.mod h1:1ZTGfU2PFTOd5mx22i5O0Lc2GY933lQ2wb/ggy+rL3w= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= -github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= -github.com/onsi/ginkgo/v2 v2.8.4 h1:gf5mIQ8cLFieruNLAdgijHF1PYfLphKm2dxxcUtcqK0= -github.com/onsi/ginkgo/v2 v2.8.4/go.mod h1:427dEDQZkDKsBvCjc2A/ZPefhKxsTTrsQegMlayL730= -github.com/onsi/gomega v1.27.1 h1:rfztXRbg6nv/5f+Raen9RcGoSecHIFgBBLQK3Wdj754= -github.com/onsi/gomega v1.27.1/go.mod h1:aHX5xOykVYzWOV4WqQy0sy8BQptgukenXpCXfadcIAw= +github.com/onsi/ginkgo/v2 v2.9.7 h1:06xGQy5www2oN160RtEZoTvnP2sPhEfePYmCDc2szss= +github.com/onsi/ginkgo/v2 v2.9.7/go.mod h1:cxrmXWykAwTwhQsJOPfdIDiJ+l2RYq7U8hFU+M/1uw0= +github.com/onsi/gomega v1.27.8 h1:gegWiwZjBsf2DgiSbf5hpokZ98JVDMcWkUiigk6/KXc= +github.com/onsi/gomega v1.27.8/go.mod h1:2J8vzI/s+2shY9XHRApDkdgPo1TKT7P2u6fXeJKFnNQ= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= -github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799 h1:rc3tiVYb5z54aKaDfakKn0dDjIyPpTtszkjuMzyt7ec= -github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b h1:YWuSjZCQAPM8UUBLkYUk1e+rZcvWHJmFb6i6rM44Xs8= +github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b/go.mod h1:3OVijpioIKYWTqjiG0zfF6wvoJ4fAXGbjdZuI2NgsRQ= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/pelletier/go-toml/v2 v2.0.5 h1:ipoSadvV8oGUjnUbMub59IDPPwfxF694nG/jwbMiyQg= -github.com/pelletier/go-toml/v2 v2.0.5/go.mod h1:OMHamSCAODeSsVrwwvcJOaoN0LIUIaFVNZzmWyNfXas= +github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU= +github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5 h1:Ii+DKncOVM8Cu1Hc+ETb5K+23HdAMvESYE3ZJ5b5cMI= @@ -622,41 +644,33 @@ github.com/pkg/sftp v1.13.5/go.mod h1:wHDZ0IZX6JcBYRK1TH9bcVq8G7TLpVHYIGJRFnmPfx github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/poy/onpar v0.0.0-20190519213022-ee068f8ea4d1 h1:oL4IBbcqwhhNWh31bjOX8C/OCy0zs9906d/VUru+bqg= -github.com/poy/onpar v0.0.0-20190519213022-ee068f8ea4d1/go.mod h1:nSbFQvMj97ZyhFRSJYtut+msi4sOY6zJDGCdSc+/rZU= +github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= +github.com/poy/onpar v0.0.0-20200406201722-06f95a1c68e8/go.mod h1:nSbFQvMj97ZyhFRSJYtut+msi4sOY6zJDGCdSc+/rZU= +github.com/poy/onpar v1.1.2 h1:QaNrNiZx0+Nar5dLgTVp5mXkyoVFIbepjyEoGSnhbAY= +github.com/poy/onpar v1.1.2/go.mod h1:6X8FLNoxyr9kkmnlqpK6LSoiOtrO6MICtWwEuWkLjzg= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= -github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= -github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= +github.com/prometheus/client_golang v1.15.1 h1:8tXpTmJbyH5lydzFPoxSIJ0J46jdh3tylbvM1xCv0LI= +github.com/prometheus/client_golang v1.15.1/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= -github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE= -github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= +github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= +github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= -github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo= -github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= +github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= +github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.2 h1:YwD0ulJSJytLpiaWua0sBDusfsCZohxjxzVTYjwxfV8= @@ -664,13 +678,14 @@ github.com/rivo/uniseg v0.4.2/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUc github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= -github.com/rubenv/sql-migrate v1.1.2 h1:9M6oj4e//owVVHYrFISmY9LBRw6gzkCNmD9MV36tZeQ= -github.com/rubenv/sql-migrate v1.1.2/go.mod h1:/7TZymwxN8VWumcIxw1jjHEcR1djpdkMHQPT4FWdnbQ= -github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rubenv/sql-migrate v1.3.1 h1:Vx+n4Du8X8VTYuXbhNxdEUoh6wiJERA0GlWocR5FrbA= +github.com/rubenv/sql-migrate v1.3.1/go.mod h1:YzG/Vh82CwyhTFXy+Mf5ahAiiEOpAlHurg+23VEzcsk= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= @@ -680,24 +695,22 @@ github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5g github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= +github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= -github.com/spf13/afero v1.9.2 h1:j49Hj62F0n+DaZ1dDCvhABaPNSGNkt32oRFxI33IEMw= -github.com/spf13/afero v1.9.2/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= +github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk= +github.com/spf13/afero v1.9.3/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= +github.com/spf13/cobra v0.0.6/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk= github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= @@ -709,10 +722,11 @@ github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0 github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns= -github.com/spf13/viper v1.13.0 h1:BWSJ/M+f+3nmdz9bxB+bWX28kkALN2ok11D0rSo8EJU= -github.com/spf13/viper v1.13.0/go.mod h1:Icm2xNL3/8uyh/wFuB1jI7TiTNKp8632Nwegu+zgdYw= +github.com/spf13/viper v1.15.0 h1:js3yy885G8xwJa6iOISGFwd+qlUo5AvyXb7CiihdtiU= +github.com/spf13/viper v1.15.0/go.mod h1:fFcTBJxvhhzSJiZy8n+PeW6t8l+KeT/uTARa0jHOQLA= github.com/stoewer/go-strcase v1.2.0 h1:Z2iHWqGXH00XYgqDmNgQbIBxf3wrNq0F3feEy0ainaU= github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -728,15 +742,19 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/subosito/gotenv v1.4.1 h1:jyEFiXpy21Wm81FBN71l9VoMMV8H8jG+qIK3GCpY6Qs= -github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= +github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= +github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/valyala/fastjson v1.6.3 h1:tAKFnnwmeMGPbwJ7IwxcTPCNr3uIzoIj3/Fh90ra4xc= -github.com/valyala/fastjson v1.6.3/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY= -github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/valyala/fastjson v1.6.4 h1:uAUNq9Z6ymTgGhcm0UynUAB6tlbakBrz6CQFax3BXVQ= +github.com/valyala/fastjson v1.6.4/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= +github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= @@ -744,6 +762,7 @@ github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQ github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xlab/treeprint v1.1.0 h1:G/1DjNkPpfZCFt9CSh6b5/nY4VimlbHF3Rh4obvtzDk= github.com/xlab/treeprint v1.1.0/go.mod h1:gj5Gd3gPdKtR1ikdDK6fnFLdmIS0X30kTTuNd/WEJu0= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -754,12 +773,8 @@ github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5t github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43 h1:+lm10QQTNSBd8DVTNGHx7o/IKu9HYDvLMffDhbyLccI= github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50 h1:hlE8//ciYMztlGpl/VA+Zm1AcTPHYkHJPbHqE6WJUXE= github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f h1:ERexzlUfuTvpE74urLSbIQW0Z/6hF9t8U4NsJLaioAY= -github.com/ziutek/mymysql v1.5.4 h1:GB0qdRGsTwQSBVYuVShFBKaXSnSnYYC2d9knnE1LHFs= -github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= -go.etcd.io/etcd/api/v3 v3.5.4 h1:OHVyt3TopwtUQ2GKdd5wu3PmmipR4FTwCqoEjSyRdIc= -go.etcd.io/etcd/api/v3 v3.5.4/go.mod h1:5GB2vv4A4AOn3yk7MftYGHkUfGtDHnEraIjym4dYz5A= go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= @@ -768,43 +783,43 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.40.0 h1:lE9EJyw3/JhrjWH/hEy9FptnalDQgj7vpbgC2KCCCxE= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.40.0/go.mod h1:pcQ3MM3SWvrA71U4GDqv9UFDJ3HQsW7y5ZO3tDTlUdI= -go.opentelemetry.io/otel v1.14.0 h1:/79Huy8wbf5DnIPhemGB+zEPVwnN6fuQybr/SRXa6hM= -go.opentelemetry.io/otel v1.14.0/go.mod h1:o4buv+dJzx8rohcUeRmWUZhqupFvzWis188WlggnNeU= -go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 h1:/fXHZHGvro6MVqV34fJzDhi7sHGpX3Ej/Qjmfn003ho= -go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0/go.mod h1:UFG7EBMRdXyFstOwH028U0sVf+AvukSGhF0g8+dmNG8= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0 h1:TKf2uAs2ueguzLaxOCBXNpHxfO/aC7PAdDsSH0IbeRQ= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0/go.mod h1:HrbCVv40OOLTABmOn1ZWty6CHXkU8DK/Urc43tHug70= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.14.0 h1:ap+y8RXX3Mu9apKVtOkM6WSFESLM8K3wNQyOU8sWHcc= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.14.0/go.mod h1:5w41DY6S9gZrbjuq6Y+753e96WfPha5IcsOSZTtullM= -go.opentelemetry.io/otel/exporters/prometheus v0.37.0 h1:NQc0epfL0xItsmGgSXgfbH2C1fq2VLXkZoDFsfRNHpc= -go.opentelemetry.io/otel/exporters/prometheus v0.37.0/go.mod h1:hB8qWjsStK36t50/R0V2ULFb4u95X/Q6zupXLgvjTh8= -go.opentelemetry.io/otel/metric v0.37.0 h1:pHDQuLQOZwYD+Km0eb657A25NaRzy0a+eLyKfDXedEs= -go.opentelemetry.io/otel/metric v0.37.0/go.mod h1:DmdaHfGt54iV6UKxsV9slj2bBRJcKC1B1uvDLIioc1s= -go.opentelemetry.io/otel/sdk v1.14.0 h1:PDCppFRDq8A1jL9v6KMI6dYesaq+DFcDZvjsoGvxGzY= -go.opentelemetry.io/otel/sdk v1.14.0/go.mod h1:bwIC5TjrNG6QDCHNWvW4HLHtUQ4I+VQDsnjhvyZCALM= -go.opentelemetry.io/otel/sdk/metric v0.37.0 h1:haYBBtZZxiI3ROwSmkZnI+d0+AVzBWeviuYQDeBWosU= -go.opentelemetry.io/otel/sdk/metric v0.37.0/go.mod h1:mO2WV1AZKKwhwHTV3AKOoIEb9LbUaENZDuGUQd+j4A0= -go.opentelemetry.io/otel/trace v1.14.0 h1:wp2Mmvj41tDsyAJXiWDWpfNsOiIyd38fy85pyKcFq/M= -go.opentelemetry.io/otel/trace v1.14.0/go.mod h1:8avnQLK+CG77yNLUae4ea2JDQ6iT+gozhnZjy/rw9G8= +go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.41.0 h1:FUSb6tRd389V5GGQVkSkP794h8D0lZqPNoxBjQ0PMWk= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.41.0/go.mod h1:xmv4aGDeCpkNeyGH0iKgaj/E6XPeRqG20QF2IC7UXr0= +go.opentelemetry.io/otel v1.15.1 h1:3Iwq3lfRByPaws0f6bU3naAqOR1n5IeDWd9390kWHa8= +go.opentelemetry.io/otel v1.15.1/go.mod h1:mHHGEHVDLal6YrKMmk9LqC4a3sF5g+fHfrttQIB1NTc= +go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 h1:XYDQtNzdb2T4uM1pku2m76eSMDJgqhJ+6KzkqgQBALc= +go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1/go.mod h1:uOTV75+LOzV+ODmL8ahRLWkFA3eQcSC2aAsbxIu4duk= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.1 h1:tyoeaUh8REKay72DVYsSEBYV18+fGONe+YYPaOxgLoE= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.1/go.mod h1:HUSnrjQQ19KX9ECjpQxufsF+3ioD3zISPMlauTPZu2g= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.1 h1:pIfoG5IAZFzp9EUlJzdSkpUwpaUAAnD+Ru1nBLTACIQ= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.1/go.mod h1:poNKBqF5+nR/6ke2oGTDjHfksrsHDOHXAl2g4+9ONsY= +go.opentelemetry.io/otel/exporters/prometheus v0.38.1 h1:GwalIvFIx91qIA8qyAyqYj9lql5Ba2Oxj/jDG6+3UoU= +go.opentelemetry.io/otel/exporters/prometheus v0.38.1/go.mod h1:6K7aBvWHXRUcNYFSj6Hi5hHwzA1jYflG/T8snrX4dYM= +go.opentelemetry.io/otel/metric v0.38.1 h1:2MM7m6wPw9B8Qv8iHygoAgkbejed59uUR6ezR5T3X2s= +go.opentelemetry.io/otel/metric v0.38.1/go.mod h1:FwqNHD3I/5iX9pfrRGZIlYICrJv0rHEUl2Ln5vdIVnQ= +go.opentelemetry.io/otel/sdk v1.15.1 h1:5FKR+skgpzvhPQHIEfcwMYjCBr14LWzs3uSqKiQzETI= +go.opentelemetry.io/otel/sdk v1.15.1/go.mod h1:8rVtxQfrbmbHKfqzpQkT5EzZMcbMBwTzNAggbEAM0KA= +go.opentelemetry.io/otel/sdk/metric v0.38.1 h1:EkO5wI4NT/fUaoPMGc0fKV28JaWe7q4vfVpEVasGb+8= +go.opentelemetry.io/otel/sdk/metric v0.38.1/go.mod h1:Rn4kSXFF9ZQZ5lL1pxQjCbK4seiO+U7s0ncmIFJaj34= +go.opentelemetry.io/otel/trace v1.15.1 h1:uXLo6iHJEzDfrNC0L0mNjItIp06SyaBQxu5t3xMlngY= +go.opentelemetry.io/otel/trace v1.15.1/go.mod h1:IWdQG/5N1x7f6YUlmdLeJvH9yxtuJAfc4VW5Agv9r/8= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 h1:+FNtrFTmVw0YZGpBGX56XDee331t6JAXeK2bcyhLOOc= go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5/go.mod h1:nmDLcffg48OtT/PSW0Hg7FvpRQsQh5OSqIylirxKC7o= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= 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= +go.uber.org/multierr v1.8.0 h1:dg6GjLku4EH+249NNmoIciG9N/jURbDG+pFlTkhzIC8= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= -go.uber.org/zap v1.21.0 h1:WefMeulhovoZ2sYXz7st6K0sLj7bBhpiFaud4r4zST8= +go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -813,6 +828,7 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= @@ -821,8 +837,10 @@ 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-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= -golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= -golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= +golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU= +golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= +golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= +golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= 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= @@ -833,6 +851,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/exp v0.0.0-20220414153411-bcd21879b8fd h1:zVFyTKZN/Q7mNRWSs1GOYnHM9NiFSJ54YVRsD0rNWT4= +golang.org/x/exp v0.0.0-20220414153411-bcd21879b8fd/go.mod h1:lgLbSvA5ygNOMpwM/9anMpWVlVJ7Z+cHWq/eFuinpGE= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -859,8 +879,8 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs= -golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= +golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -873,6 +893,7 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -901,15 +922,14 @@ golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= 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.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= 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= @@ -922,11 +942,9 @@ golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/oauth2 v0.4.0 h1:NF0gk8LVPg1Ml7SSbGyySuoxdsXitj7TvgvuRxIMc/M= -golang.org/x/oauth2 v0.4.0/go.mod h1:RznEsdpjGAINPTOF0UH/t+xJ75L18YO3Ho6Pyn+uRec= +golang.org/x/oauth2 v0.6.0 h1:Lh8GPgSKBfWSwFvtuWOfeI3aAAnbXTSutYxJiOJFgIw= +golang.org/x/oauth2 v0.6.0/go.mod h1:ycmewcwgD4Rpr3eZJLSB4Kyyljb3qDh40vJ8STE5HKw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -939,8 +957,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= +golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -948,9 +966,9 @@ golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -963,7 +981,6 @@ golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -977,8 +994,6 @@ golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -986,7 +1001,6 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -997,26 +1011,30 @@ golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 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.0.0-20221013171732-95e765b1cc43/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 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.6.0 h1:clScbb1cHjoCkyRbWwBEUZ5H/tIFu5TAXIqaZD0Gcjw= -golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= +golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= 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= @@ -1027,13 +1045,15 @@ 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.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= 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= -golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9 h1:ftMN5LMiBFjbzleLqtoBZk7KdJwhuybIU+FckUHgoyQ= -golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= +golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1047,7 +1067,6 @@ golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -1070,6 +1089,7 @@ golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapK golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200313205530-4303120df7d8/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -1091,8 +1111,8 @@ golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo= +golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1174,10 +1194,11 @@ google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaE google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f h1:BWUVssLB0HVOSY78gIdvk1dTVYtT1y8SBWtPYuTJ/6w= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= +google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 h1:DdoeryqhaXp1LtT/emMP1BRJPHHKFi5akj/nbx/zNTA= +google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= @@ -1198,8 +1219,8 @@ google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc= -google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= +google.golang.org/grpc v1.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag= +google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -1213,8 +1234,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -1230,13 +1251,11 @@ gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= @@ -1247,10 +1266,9 @@ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C 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.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= gotest.tools/v3 v3.0.3 h1:4AuOwCGf4lLR9u3YOe2awrHygurzhO/HeQ6laiA6Sx0= -helm.sh/helm/v3 v3.10.3 h1:wL7IUZ7Zyukm5Kz0OUmIFZgKHuAgByCrUcJBtY0kDyw= -helm.sh/helm/v3 v3.10.3/go.mod h1:CXOcs02AYvrlPMWARNYNRgf2rNP7gLJQsi/Ubd4EDrI= +helm.sh/helm/v3 v3.11.3 h1:n1X5yaQTP5DYywlBOZMl2gX398Gp6YwFp/IAVj6+5D4= +helm.sh/helm/v3 v3.11.3/go.mod h1:S+sOdQc3BLvt09a9rSlKKVs9x0N/yx+No0y3qFw+FQ8= 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= @@ -1258,52 +1276,51 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -k8s.io/api v0.25.4 h1:3YO8J4RtmG7elEgaWMb4HgmpS2CfY1QlaOz9nwB+ZSs= -k8s.io/api v0.25.4/go.mod h1:IG2+RzyPQLllQxnhzD8KQNEu4c4YvyDTpSMztf4A0OQ= -k8s.io/apiextensions-apiserver v0.25.2 h1:8uOQX17RE7XL02ngtnh3TgifY7EhekpK+/piwzQNnBo= -k8s.io/apiextensions-apiserver v0.25.2/go.mod h1:iRwwRDlWPfaHhuBfQ0WMa5skdQfrE18QXJaJvIDLvE8= -k8s.io/apimachinery v0.25.4 h1:CtXsuaitMESSu339tfhVXhQrPET+EiWnIY1rcurKnAc= -k8s.io/apimachinery v0.25.4/go.mod h1:jaF9C/iPNM1FuLl7Zuy5b9v+n35HGSh6AQ4HYRkCqwo= -k8s.io/apiserver v0.25.2 h1:YePimobk187IMIdnmsMxsfIbC5p4eX3WSOrS9x6FEYw= -k8s.io/apiserver v0.25.2/go.mod h1:30r7xyQTREWCkG2uSjgjhQcKVvAAlqoD+YyrqR6Cn+I= -k8s.io/cli-runtime v0.25.2 h1:XOx+SKRjBpYMLY/J292BHTkmyDffl/qOx3YSuFZkTuc= -k8s.io/cli-runtime v0.25.2/go.mod h1:OQx3+/0st6x5YpkkJQlEWLC73V0wHsOFMC1/roxV8Oc= -k8s.io/client-go v0.25.4 h1:3RNRDffAkNU56M/a7gUfXaEzdhZlYhoW8dgViGy5fn8= -k8s.io/client-go v0.25.4/go.mod h1:8trHCAC83XKY0wsBIpbirZU4NTUpbuhc2JnI7OruGZw= -k8s.io/cloud-provider v0.25.1-rc.0 h1:nVwh+pHr6URilEfgwMrFL4XEtNoATr0D/PiLQ61E0Fw= -k8s.io/cloud-provider v0.25.1-rc.0/go.mod h1:SWOaR0SsIRINw+wzO+NhOlU/KasuVJu9eRqX3TMAJ4o= +k8s.io/api v0.26.2 h1:dM3cinp3PGB6asOySalOZxEG4CZ0IAdJsrYZXE/ovGQ= +k8s.io/api v0.26.2/go.mod h1:1kjMQsFE+QHPfskEcVNgL3+Hp88B80uj0QtSOlj8itU= +k8s.io/apiextensions-apiserver v0.26.1 h1:cB8h1SRk6e/+i3NOrQgSFij1B2S0Y0wDoNl66bn8RMI= +k8s.io/apiextensions-apiserver v0.26.1/go.mod h1:AptjOSXDGuE0JICx/Em15PaoO7buLwTs0dGleIHixSM= +k8s.io/apimachinery v0.26.2 h1:da1u3D5wfR5u2RpLhE/ZtZS2P7QvDgLZTi9wrNZl/tQ= +k8s.io/apimachinery v0.26.2/go.mod h1:ats7nN1LExKHvJ9TmwootT00Yz05MuYqPXEXaVeOy5I= +k8s.io/apiserver v0.26.2 h1:Pk8lmX4G14hYqJd1poHGC08G03nIHVqdJMR0SD3IH3o= +k8s.io/apiserver v0.26.2/go.mod h1:GHcozwXgXsPuOJ28EnQ/jXEM9QeG6HT22YxSNmpYNh8= +k8s.io/cli-runtime v0.26.1 h1:f9+bRQ1V3elQsx37KmZy5fRAh56mVLbE9A7EMdlqVdI= +k8s.io/cli-runtime v0.26.1/go.mod h1:+e5Ym/ARySKscUhZ8K3hZ+ZBo/wYPIcg+7b5sFYi6Gg= +k8s.io/client-go v0.26.2 h1:s1WkVujHX3kTp4Zn4yGNFK+dlDXy1bAAkIl+cFAiuYI= +k8s.io/client-go v0.26.2/go.mod h1:u5EjOuSyBa09yqqyY7m3abZeovO/7D/WehVVlZ2qcqU= +k8s.io/cloud-provider v0.26.2 h1:VlLGDayUV5VBpvMSBFqmpz2HHTjBLUw02wuZzNeEsW0= +k8s.io/cloud-provider v0.26.2/go.mod h1:/Am9R0merLIZgVqPTE4Z1JkBcCrp2uXImHCxnvVARxc= k8s.io/cluster-bootstrap v0.25.0 h1:KJ2/r0dV+bLfTK5EBobAVKvjGel3N4Qqh3bvnzh9qPk= k8s.io/cluster-bootstrap v0.25.0/go.mod h1:x/TCtY3EiuR/rODkA3SvVQT3uSssQLf9cXcmSjdDTe0= -k8s.io/component-base v0.25.2 h1:Nve/ZyHLUBHz1rqwkjXm/Re6IniNa5k7KgzxZpTfSQY= -k8s.io/component-base v0.25.2/go.mod h1:90W21YMr+Yjg7MX+DohmZLzjsBtaxQDDwaX4YxDkl60= -k8s.io/component-helpers v0.25.2 h1:A4xQEFq7tbnhB3CTwZTLcQtyEhFFZN2TyQjNgziuSEI= -k8s.io/component-helpers v0.25.2/go.mod h1:iuyfZG2jGWYvR5F/yGFUYNdL/IFz2smcwpNaOqP+YNM= -k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= -k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4= -k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= -k8s.io/kube-openapi v0.0.0-20220803164354-a70c9af30aea h1:3QOH5+2fGsY8e1qf+GIFpg+zw/JGNrgyZRQR7/m6uWg= -k8s.io/kube-openapi v0.0.0-20220803164354-a70c9af30aea/go.mod h1:C/N6wCaBHeBHkHUesQOQy2/MZqGgMAFPqGsGQLdbZBU= -k8s.io/kubectl v0.25.2 h1:2993lTeVimxKSWx/7z2PiJxUILygRa3tmC4QhFaeioA= -k8s.io/kubectl v0.25.2/go.mod h1:eoBGJtKUj7x38KXelz+dqVtbtbKwCqyKzJWmBHU0prg= -k8s.io/utils v0.0.0-20220823124924-e9cbc92d1a73 h1:H9TCJUUx+2VA0ZiD9lvtaX8fthFsMoD+Izn93E/hm8U= -k8s.io/utils v0.0.0-20220823124924-e9cbc92d1a73/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= -oras.land/oras-go v1.2.0 h1:yoKosVIbsPoFMqAIFHTnrmOuafHal+J/r+I5bdbVWu4= -oras.land/oras-go v1.2.0/go.mod h1:pFNs7oHp2dYsYMSS82HaX5l4mpnGO7hbpPN6EWH2ltc= +k8s.io/component-base v0.26.2 h1:IfWgCGUDzrD6wLLgXEstJKYZKAFS2kO+rBRi0p3LqcI= +k8s.io/component-base v0.26.2/go.mod h1:DxbuIe9M3IZPRxPIzhch2m1eT7uFrSBJUBuVCQEBivs= +k8s.io/component-helpers v0.26.2 h1:+JJ1gwyVsqSwZCJVLJotx/IPq2pMpo0kifeAzfo6i3U= +k8s.io/component-helpers v0.26.2/go.mod h1:PRvoduZ5/IeKGGbZRki3J2cTQVwZLD+EUxIEbvvX0W4= +k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw= +k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= +k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 h1:+70TFaan3hfJzs+7VK2o+OGxg8HsuBr/5f6tVAjDu6E= +k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280/go.mod h1:+Axhij7bCpeqhklhUTe3xmOn6bWxolyZEeyaFpjGtl4= +k8s.io/kubectl v0.26.1 h1:K8A0Jjlwg8GqrxOXxAbjY5xtmXYeYjLU96cHp2WMQ7s= +k8s.io/kubectl v0.26.1/go.mod h1:miYFVzldVbdIiXMrHZYmL/EDWwJKM+F0sSsdxsATFPo= +k8s.io/utils v0.0.0-20230220204549-a5ecb0141aa5 h1:kmDqav+P+/5e1i9tFfHq1qcF3sOrDp+YEkVDAHu7Jwk= +k8s.io/utils v0.0.0-20230220204549-a5ecb0141aa5/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +oras.land/oras-go v1.2.2 h1:0E9tOHUfrNH7TCDk5KU0jVBEzCqbfdyuVfGmJ7ZeRPE= +oras.land/oras-go v1.2.2/go.mod h1:Apa81sKoZPpP7CDciE006tSZ0x3Q3+dOoBcMZ/aNxvw= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= -sigs.k8s.io/cloud-provider-azure v1.25.5 h1:YRq/wStyUtxgtMrAuRg+4FS0Gylt6MRatA8z5uag0/s= -sigs.k8s.io/cloud-provider-azure v1.25.5/go.mod h1:estRnm6TL3dWLQTVoej4+0ygXyhIZmpszBXipHrfuZ0= -sigs.k8s.io/cluster-api v1.3.5 h1:Chg56Piv5ip0AFRN83H1I8uIn6qsdk+mr9hdq5Cxkf0= -sigs.k8s.io/cluster-api v1.3.5/go.mod h1:9FNHNItE5c+klfDLNG3+ApSTX0H4yGAumdbFJMnk6Vc= -sigs.k8s.io/cluster-api/test v1.3.5 h1:+uY+oMwIK5NOH1S/VPCl5gl9TuUBRRdr/qiji4r1B7I= -sigs.k8s.io/cluster-api/test v1.3.5/go.mod h1:oRc0fAaj3ZPMuV0GTRQbseZ6IrNyDUB8ReKil5lkAtw= -sigs.k8s.io/controller-runtime v0.13.1 h1:tUsRCSJVM1QQOOeViGeX3GMT3dQF1eePPw6sEE3xSlg= -sigs.k8s.io/controller-runtime v0.13.1/go.mod h1:Zbz+el8Yg31jubvAEyglRZGdLAjplZl+PgtYNI6WNTI= +sigs.k8s.io/cloud-provider-azure v1.26.7 h1:LSVRPyxeTQZPOF7z42zNZGzL1S1N5tg28RBZVy7gea4= +sigs.k8s.io/cloud-provider-azure v1.26.7/go.mod h1:UIwr0Bk4wQb77wNL9cdT4zZw6DP2AtOQ9EKRt9c5g7Q= +sigs.k8s.io/cluster-api v1.4.2 h1:hdIz0Ms2j7YaU1qBK5yF2R8ii0GcGb3jQ7EO6i3tAN8= +sigs.k8s.io/cluster-api v1.4.2/go.mod h1:IIebZTsqyXU8CHbINV2zuMh0/wykqdr+vEXxQNeteEU= +sigs.k8s.io/cluster-api/test v1.4.2 h1:uHFtn0SFOFOxIbdahLoYo4kz84yLqCmhbVLV4vsk1gQ= +sigs.k8s.io/cluster-api/test v1.4.2/go.mod h1:/64ycj3YFMW1BGVtCtfwmlVAXGN0DFTZEkIClh68Svo= +sigs.k8s.io/controller-runtime v0.14.5 h1:6xaWFqzT5KuAQ9ufgUaj1G/+C4Y1GRkhrxl+BJ9i+5s= +sigs.k8s.io/controller-runtime v0.14.5/go.mod h1:WqIdsAY6JBsjfc/CqO0CORmNtoCtE4S6qbPc9s68h+0= sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 h1:iXTIw73aPyC+oRdyqqvVJuloN1p0AC/kzH07hu3NE+k= sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= -sigs.k8s.io/kind v0.17.0 h1:CScmGz/wX66puA06Gj8OZb76Wmk7JIjgWf5JDvY7msM= -sigs.k8s.io/kind v0.17.0/go.mod h1:Qqp8AiwOlMZmJWs37Hgs31xcbiYXjtXlRBSftcnZXQk= +sigs.k8s.io/kind v0.19.0 h1:ZSUh6/kpab6fiowT6EqL4k8xSbedI2NWxyuUOtoPFe4= +sigs.k8s.io/kind v0.19.0/go.mod h1:aBlbxg08cauDgZ612shr017/rZwqd7AS563FvpWKPVs= sigs.k8s.io/kustomize/api v0.12.1 h1:7YM7gW3kYBwtKvoY216ZzY+8hM+lV53LUayghNRJ0vM= sigs.k8s.io/kustomize/api v0.12.1/go.mod h1:y3JUhimkZkR6sbLNwfJHxvo1TCLwuwm14sCYnkH6S1s= sigs.k8s.io/kustomize/kyaml v0.13.9 h1:Qz53EAaFFANyNgyOEJbT/yoIHygK40/ZcvU3rgry2Tk= diff --git a/hack/codecov-ignore.sh b/hack/codecov-ignore.sh new file mode 100755 index 00000000000..64d85b12c3c --- /dev/null +++ b/hack/codecov-ignore.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +# Copyright 2023 The Kubernetes Authors. +# +# 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. + +{ + find api/v1beta1 -regex '.*_conversion\.go' -exec echo sigs.k8s.io/cluster-api-provider-azure/{} \; + find api/v1beta1 -regex '.*zz_generated.*\.go' -exec echo sigs.k8s.io/cluster-api-provider-azure/{} \; + find exp/api/v1beta1 -regex '.*_conversion\.go' -exec echo sigs.k8s.io/cluster-api-provider-azure/{} \; + find exp/api/v1beta1 -regex '.*zz_generated.*\.go' -exec echo sigs.k8s.io/cluster-api-provider-azure/{} \; +} >> codecov-ignore.txt + +while read -r p || [ -n "$p" ] +do +if [[ "${OSTYPE}" == "darwin"* ]]; then + sed -i '' "/${p//\//\\/}/d" ./coverage.out +else + sed -i "/${p//\//\\/}/d" ./coverage.out +fi +done < ./codecov-ignore.txt diff --git a/hack/create-dev-cluster.sh b/hack/create-dev-cluster.sh index ae5e9137eea..eb52a266bc8 100755 --- a/hack/create-dev-cluster.sh +++ b/hack/create-dev-cluster.sh @@ -48,7 +48,7 @@ export CONTROL_PLANE_MACHINE_COUNT=${CONTROL_PLANE_MACHINE_COUNT:-3} export AZURE_CONTROL_PLANE_MACHINE_TYPE="${CONTROL_PLANE_MACHINE_TYPE:-Standard_B2s}" export AZURE_NODE_MACHINE_TYPE="${NODE_MACHINE_TYPE:-Standard_B2s}" export WORKER_MACHINE_COUNT=${WORKER_MACHINE_COUNT:-2} -export KUBERNETES_VERSION="${KUBERNETES_VERSION:-v1.24.6}" +export KUBERNETES_VERSION="${KUBERNETES_VERSION:-v1.25.6}" export CLUSTER_TEMPLATE="${CLUSTER_TEMPLATE:-cluster-template.yaml}" # identity secret settings. diff --git a/hack/ensure-go.sh b/hack/ensure-go.sh index 7d2c6b945d1..5016956610a 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.19.0 + minimum_go_version=go1.20.0 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 < /dev/null az storage container set-permission --name "${JOB_NAME}" --public-access container > /dev/null @@ -85,7 +90,7 @@ main() { if [[ "${KUBE_BUILD_CONFORMANCE:-}" =~ [yY] ]]; then IMAGES+=("conformance") # consume by the conformance test suite - export CONFORMANCE_IMAGE="${REGISTRY}/conformance:${IMAGE_TAG}" + export CONFORMANCE_IMAGE="${REGISTRY}/conformance:${KUBE_IMAGE_TAG}" fi if [[ "$(can_reuse_artifacts)" == "false" ]]; then @@ -102,7 +107,7 @@ main() { for IMAGE_NAME in "${IMAGES[@]}"; do # extract docker image URL form `docker load` output OLD_IMAGE_URL="$(docker load --input "${KUBE_ROOT}/_output/release-images/amd64/${IMAGE_NAME}.tar" | ${GREP_BINARY} -oP '(?<=Loaded image: )[^ ]*' | head -n 1)" - NEW_IMAGE_URL="${REGISTRY}/${IMAGE_NAME}:${IMAGE_TAG}" + NEW_IMAGE_URL="${REGISTRY}/${IMAGE_NAME}:${KUBE_IMAGE_TAG}" # retag and push images to ACR docker tag "${OLD_IMAGE_URL}" "${NEW_IMAGE_URL}" && docker push "${NEW_IMAGE_URL}" done @@ -111,7 +116,7 @@ main() { az storage blob upload --overwrite --container-name "${JOB_NAME}" --file "${KUBE_ROOT}/_output/dockerized/bin/linux/amd64/${BINARY}" --name "${KUBE_GIT_VERSION}/bin/linux/amd64/${BINARY}" done - if [[ "${WINDOWS:-}" == "true" ]]; then + if [[ "${TEST_WINDOWS:-}" == "true" ]]; then echo "Building Kubernetes Windows binaries" for BINARY in "${WINDOWS_BINARIES[@]}"; do @@ -128,20 +133,20 @@ main() { # can_reuse_artifacts returns true if there exists Kubernetes artifacts built from a PR that we can reuse can_reuse_artifacts() { for IMAGE_NAME in "${IMAGES[@]}"; do - if ! docker pull "${REGISTRY}/${IMAGE_NAME}:${IMAGE_TAG}"; then + if ! docker pull "${REGISTRY}/${IMAGE_NAME}:${KUBE_IMAGE_TAG}"; then echo "false" && return fi done for BINARY in "${BINARIES[@]}"; do - if [[ "$(az storage blob exists --container-name "${JOB_NAME}" --name "${KUBE_GIT_VERSION}/bin/linux/amd64/${BINARY}" --query exists)" == "false" ]]; then + if [[ "$(az storage blob exists --container-name "${JOB_NAME}" --name "${KUBE_GIT_VERSION}/bin/linux/amd64/${BINARY}" --query exists --output tsv)" == "false" ]]; then echo "false" && return fi done - if [[ "${WINDOWS:-}" == "true" ]]; then + if [[ "${TEST_WINDOWS:-}" == "true" ]]; then for BINARY in "${WINDOWS_BINARIES[@]}"; do - if [[ "$(az storage blob exists --container-name "${JOB_NAME}" --name "${KUBE_GIT_VERSION}/bin/windows/amd64/${BINARY}.exe" --query exists)" == "false" ]]; then + if [[ "$(az storage blob exists --container-name "${JOB_NAME}" --name "${KUBE_GIT_VERSION}/bin/windows/amd64/${BINARY}.exe" --query exists --output tsv)" == "false" ]]; then echo "false" && return fi done diff --git a/scripts/ci-conformance.sh b/scripts/ci-conformance.sh index f6c32c52029..d60db06512e 100755 --- a/scripts/ci-conformance.sh +++ b/scripts/ci-conformance.sh @@ -59,8 +59,8 @@ else if [[ "$(capz::util::should_build_ccm)" == "true" ]]; then # shellcheck source=scripts/ci-build-azure-ccm.sh source "${REPO_ROOT}/scripts/ci-build-azure-ccm.sh" - echo "Will use the ${IMAGE_REGISTRY}/${CCM_IMAGE_NAME}:${IMAGE_TAG} cloud-controller-manager image for external cloud-provider-cluster" - echo "Will use the ${IMAGE_REGISTRY}/${CNM_IMAGE_NAME}:${IMAGE_TAG} cloud-node-manager image for external cloud-provider-azure cluster" + echo "Will use the ${IMAGE_REGISTRY}/${CCM_IMAGE_NAME}:${IMAGE_TAG_CCM} cloud-controller-manager image for external cloud-provider-cluster" + echo "Will use the ${IMAGE_REGISTRY}/${CNM_IMAGE_NAME}:${IMAGE_TAG_CNM} cloud-node-manager image for external cloud-provider-azure cluster" fi fi diff --git a/scripts/ci-e2e.sh b/scripts/ci-e2e.sh index c35a670dc74..fc04dc8ecd0 100755 --- a/scripts/ci-e2e.sh +++ b/scripts/ci-e2e.sh @@ -57,6 +57,13 @@ if [[ "${BUILD_MANAGER_IMAGE}" == "true" ]]; then export TAG="${defaultTag:-dev}" fi +if [[ "$(capz::util::should_build_ccm)" == "true" ]]; then + # shellcheck source=scripts/ci-build-azure-ccm.sh + source "${REPO_ROOT}/scripts/ci-build-azure-ccm.sh" + echo "Will use the ${IMAGE_REGISTRY}/${CCM_IMAGE_NAME}:${IMAGE_TAG_CCM} cloud-controller-manager image for external cloud-provider-cluster" + echo "Will use the ${IMAGE_REGISTRY}/${CNM_IMAGE_NAME}:${IMAGE_TAG_CNM} cloud-node-manager image for external cloud-provider-azure cluster" +fi + export GINKGO_NODES=10 export AZURE_LOCATION="${AZURE_LOCATION:-$(capz::util::get_random_region)}" @@ -64,7 +71,9 @@ export AZURE_LOCATION_GPU="${AZURE_LOCATION_GPU:-$(capz::util::get_random_region export AZURE_LOCATION_EDGEZONE="${AZURE_LOCATION_EDGEZONE:-$(capz::util::get_random_region_edgezone)}" export AZURE_CONTROL_PLANE_MACHINE_TYPE="${AZURE_CONTROL_PLANE_MACHINE_TYPE:-"Standard_B2s"}" export AZURE_NODE_MACHINE_TYPE="${AZURE_NODE_MACHINE_TYPE:-"Standard_B2s"}" -export KIND_EXPERIMENTAL_DOCKER_NETWORK="bridge" +CALICO_VERSION=$(make get-calico-version) +export CALICO_VERSION + capz::util::generate_ssh_key diff --git a/scripts/ci-entrypoint.sh b/scripts/ci-entrypoint.sh index dcfa0e15781..e9a0314e81b 100755 --- a/scripts/ci-entrypoint.sh +++ b/scripts/ci-entrypoint.sh @@ -55,15 +55,15 @@ setup() { if [[ "$(capz::util::should_build_ccm)" == "true" ]]; then # shellcheck source=scripts/ci-build-azure-ccm.sh source "${REPO_ROOT}/scripts/ci-build-azure-ccm.sh" - echo "Will use the ${IMAGE_REGISTRY}/${CCM_IMAGE_NAME}:${IMAGE_TAG} cloud-controller-manager image for external cloud-provider-cluster" - echo "Will use the ${IMAGE_REGISTRY}/${CNM_IMAGE_NAME}:${IMAGE_TAG} cloud-node-manager image for external cloud-provider-azure cluster" + echo "Will use the ${IMAGE_REGISTRY}/${CCM_IMAGE_NAME}:${IMAGE_TAG_CCM} cloud-controller-manager image for external cloud-provider-cluster" + echo "Will use the ${IMAGE_REGISTRY}/${CNM_IMAGE_NAME}:${IMAGE_TAG_CNM} cloud-node-manager image for external cloud-provider-azure cluster" - export CCM_IMG_ARGS=(--set cloudControllerManager.imageRepository="${IMAGE_REGISTRY}" + CCM_IMG_ARGS=(--set cloudControllerManager.imageRepository="${IMAGE_REGISTRY}" --set cloudNodeManager.imageRepository="${IMAGE_REGISTRY}" --set cloudControllerManager.imageName="${CCM_IMAGE_NAME}" --set cloudNodeManager.imageName="${CNM_IMAGE_NAME}" - --set-string cloudControllerManager.imageTag="${IMAGE_TAG}" - --set-string cloudNodeManager.imageTag="${IMAGE_TAG}") + --set-string cloudControllerManager.imageTag="${IMAGE_TAG_CCM}" + --set-string cloudNodeManager.imageTag="${IMAGE_TAG_CNM}") fi if [[ "$(capz::util::should_build_kubernetes)" == "true" ]]; then @@ -102,12 +102,6 @@ setup() { export CCM_COUNT="${CCM_COUNT:-1}" export WORKER_MACHINE_COUNT="${WORKER_MACHINE_COUNT:-2}" export EXP_CLUSTER_RESOURCE_SET="true" - # this requires k8s 1.22+ - if [[ -n "${K8S_FEATURE_GATES:-}" ]]; then - export K8S_FEATURE_GATES="${K8S_FEATURE_GATES:-},WindowsHostProcessContainers=true" - else - export K8S_FEATURE_GATES="WindowsHostProcessContainers=true" - fi # TODO figure out a better way to account for expected Windows node count if [[ -n "${TEST_WINDOWS:-}" ]]; then @@ -148,11 +142,11 @@ create_cluster() { # and any statement must be idempotent so that subsequent retry attempts can make forward progress. get_cidrs() { # Get cluster CIDRs from Cluster object - CIDR0=$(${KUBECTL} --kubeconfig "${REPO_ROOT}/${KIND_CLUSTER_NAME}.kubeconfig" get cluster "${CLUSTER_NAME}" -o=jsonpath='{.spec.clusterNetwork.pods.cidrBlocks[0]}') + CIDR0=$(${KUBECTL} --kubeconfig "${REPO_ROOT}/${KIND_CLUSTER_NAME}.kubeconfig" get cluster "${CLUSTER_NAME}" -o=jsonpath='{.spec.clusterNetwork.pods.cidrBlocks[0]}') || return 1 export CIDR0 - CIDR_LENGTH=$(${KUBECTL} --kubeconfig "${REPO_ROOT}/${KIND_CLUSTER_NAME}.kubeconfig" get cluster "${CLUSTER_NAME}" -o=jsonpath='{.spec.clusterNetwork.pods.cidrBlocks}' | jq '. | length') + CIDR_LENGTH=$(${KUBECTL} --kubeconfig "${REPO_ROOT}/${KIND_CLUSTER_NAME}.kubeconfig" get cluster "${CLUSTER_NAME}" -o=jsonpath='{.spec.clusterNetwork.pods.cidrBlocks}' | jq '. | length') || return 1 if [[ "${CIDR_LENGTH}" == "2" ]]; then - CIDR1=$(${KUBECTL} get cluster --kubeconfig "${REPO_ROOT}/${KIND_CLUSTER_NAME}.kubeconfig" "${CLUSTER_NAME}" -o=jsonpath='{.spec.clusterNetwork.pods.cidrBlocks[1]}') + CIDR1=$(${KUBECTL} get cluster --kubeconfig "${REPO_ROOT}/${KIND_CLUSTER_NAME}.kubeconfig" "${CLUSTER_NAME}" -o=jsonpath='{.spec.clusterNetwork.pods.cidrBlocks[1]}') || return 1 export CIDR1 fi } @@ -162,7 +156,7 @@ get_cidrs() { # retry it using a `until get_cloud_provider; do sleep 5; done` pattern; # and any statement must be idempotent so that subsequent retry attempts can make forward progress. get_cloud_provider() { - CLOUD_PROVIDER=$("${KUBECTL}" --kubeconfig "${REPO_ROOT}/${KIND_CLUSTER_NAME}.kubeconfig" get kubeadmcontrolplane -l cluster.x-k8s.io/cluster-name="${CLUSTER_NAME}" -o=jsonpath='{.items[0].spec.kubeadmConfigSpec.clusterConfiguration.controllerManager.extraArgs.cloud-provider}') + CLOUD_PROVIDER=$("${KUBECTL}" --kubeconfig "${REPO_ROOT}/${KIND_CLUSTER_NAME}.kubeconfig" get kubeadmcontrolplane -l cluster.x-k8s.io/cluster-name="${CLUSTER_NAME}" -o=jsonpath='{.items[0].spec.kubeadmConfigSpec.clusterConfiguration.controllerManager.extraArgs.cloud-provider}') || return 1 if [[ "${CLOUD_PROVIDER:-}" = "azure" ]]; then IN_TREE="true" export IN_TREE @@ -177,12 +171,15 @@ install_calico() { # Copy the kubeadm configmap to the calico-system namespace. # This is a workaround needed for the calico-node-windows daemonset # to be able to run in the calico-system namespace. - "${KUBECTL}" create namespace calico-system --dry-run=client -o yaml | kubectl apply -f - + # First, validate that the kubeadm-config configmap has been created. + "${KUBECTL}" get configmap kubeadm-config --namespace=kube-system -o yaml || return 1 + "${KUBECTL}" create namespace calico-system --dry-run=client -o yaml | kubectl apply -f - || return 1 if ! "${KUBECTL}" get configmap kubeadm-config --namespace=calico-system; then - "${KUBECTL}" get configmap kubeadm-config --namespace=kube-system -o yaml | sed 's/namespace: kube-system/namespace: calico-system/' | "${KUBECTL}" apply -f - + "${KUBECTL}" get configmap kubeadm-config --namespace=kube-system -o yaml | sed 's/namespace: kube-system/namespace: calico-system/' | "${KUBECTL}" apply -f - || return 1 fi # install Calico CNI - echo "Installing Calico CNI via helm" + CALICO_VERSION=$(make get-calico-version) + echo "Installing Calico CNI ${CALICO_VERSION} via helm" if [[ "${CIDR0:-}" =~ .*:.* ]]; then echo "Cluster CIDR is IPv6" CALICO_VALUES_FILE="${REPO_ROOT}/templates/addons/calico-ipv6/values.yaml" @@ -196,7 +193,7 @@ install_calico() { CALICO_VALUES_FILE="${REPO_ROOT}/templates/addons/calico/values.yaml" CIDR_STRING_VALUES="installation.calicoNetwork.ipPools[0].cidr=${CIDR0}" fi - "${HELM}" upgrade calico --install --repo https://docs.tigera.io/calico/charts tigera-operator -f "${CALICO_VALUES_FILE}" --set-string "${CIDR_STRING_VALUES}" --namespace calico-system + "${HELM}" upgrade calico --install --repo https://docs.tigera.io/calico/charts --version "${CALICO_VERSION}" tigera-operator -f "${CALICO_VALUES_FILE}" --set-string "${CIDR_STRING_VALUES}" --namespace calico-system || return 1 } # install_cloud_provider_azure installs OOT cloud-provider-azure componentry onto the Cluster. @@ -211,7 +208,7 @@ install_cloud_provider_azure() { CLOUD_CONFIG="" CONFIG_SECRET_NAME="azure-cloud-provider" ENABLE_DYNAMIC_RELOADING=true - copy_secret + copy_secret || return 1 fi CCM_CLUSTER_CIDR="${CIDR0}" @@ -229,7 +226,7 @@ install_cloud_provider_azure() { --set cloudControllerManager.cloudConfig="${CLOUD_CONFIG}" \ --set cloudControllerManager.cloudConfigSecretName="${CONFIG_SECRET_NAME}" \ --set cloudControllerManager.logVerbosity="${CCM_LOG_VERBOSITY}" \ - --set-string cloudControllerManager.clusterCIDR="${CCM_CLUSTER_CIDR}" "${CCM_IMG_ARGS[@]}" + --set-string cloudControllerManager.clusterCIDR="${CCM_CLUSTER_CIDR}" "${CCM_IMG_ARGS[@]}" || return 1 } # wait_for_nodes returns when all nodes in the workload cluster are Ready. @@ -297,11 +294,11 @@ install_addons() { copy_secret() { # point at the management cluster - "${KUBECTL}" --kubeconfig "${REPO_ROOT}/${KIND_CLUSTER_NAME}.kubeconfig" get secret "${CLUSTER_NAME}-control-plane-azure-json" -o jsonpath='{.data.control-plane-azure\.json}' | base64 --decode >azure_json + "${KUBECTL}" --kubeconfig "${REPO_ROOT}/${KIND_CLUSTER_NAME}.kubeconfig" get secret "${CLUSTER_NAME}-control-plane-azure-json" -o jsonpath='{.data.control-plane-azure\.json}' | base64 --decode >azure_json || return 1 # create the secret on the workload cluster "${KUBECTL}" create secret generic "${CONFIG_SECRET_NAME}" -n kube-system \ - --from-file=cloud-config=azure_json + --from-file=cloud-config=azure_json || return 1 rm azure_json } diff --git a/templates/addons/calico-dual-stack.yaml b/templates/addons/calico-dual-stack.yaml index 6bbd9850526..201662724fb 100644 --- a/templates/addons/calico-dual-stack.yaml +++ b/templates/addons/calico-dual-stack.yaml @@ -4351,7 +4351,7 @@ spec: value: node - name: DATASTORE_TYPE value: kubernetes - image: docker.io/calico/kube-controllers:v3.25.0 + image: docker.io/calico/kube-controllers:v3.25.1 imagePullPolicy: IfNotPresent livenessProbe: exec: @@ -4428,7 +4428,7 @@ spec: - configMapRef: name: kubernetes-services-endpoint optional: true - image: docker.io/calico/typha:v3.25.0 + image: docker.io/calico/typha:v3.25.1 imagePullPolicy: IfNotPresent livenessProbe: httpGet: @@ -4546,7 +4546,7 @@ spec: - configMapRef: name: kubernetes-services-endpoint optional: true - image: docker.io/calico/node:v3.25.0 + image: docker.io/calico/node:v3.25.1 imagePullPolicy: IfNotPresent lifecycle: preStop: @@ -4621,7 +4621,7 @@ spec: - configMapRef: name: kubernetes-services-endpoint optional: true - image: docker.io/calico/cni:v3.25.0 + image: docker.io/calico/cni:v3.25.1 imagePullPolicy: IfNotPresent name: install-cni securityContext: @@ -4635,7 +4635,7 @@ spec: - calico-node - -init - -best-effort - image: docker.io/calico/node:v3.25.0 + image: docker.io/calico/node:v3.25.1 imagePullPolicy: IfNotPresent name: mount-bpffs securityContext: diff --git a/templates/addons/calico-dual-stack/values.yaml b/templates/addons/calico-dual-stack/values.yaml index 8a786cc77f0..561eefe6b80 100644 --- a/templates/addons/calico-dual-stack/values.yaml +++ b/templates/addons/calico-dual-stack/values.yaml @@ -17,3 +17,10 @@ installation: encapsulation: None natOutgoing: Enabled nodeSelector: all() + registry: mcr.microsoft.com/oss +# Image and registry configuration for the tigera/operator pod. +tigeraOperator: + image: tigera/operator + registry: mcr.microsoft.com/oss +calicoctl: + image: mcr.microsoft.com/oss/calico/ctl diff --git a/templates/addons/calico-ipv6.yaml b/templates/addons/calico-ipv6.yaml index f5fc7075747..1175a404819 100644 --- a/templates/addons/calico-ipv6.yaml +++ b/templates/addons/calico-ipv6.yaml @@ -4340,7 +4340,7 @@ spec: value: node - name: DATASTORE_TYPE value: kubernetes - image: docker.io/calico/kube-controllers:v3.25.0 + image: docker.io/calico/kube-controllers:v3.25.1 imagePullPolicy: IfNotPresent livenessProbe: exec: @@ -4417,7 +4417,7 @@ spec: - configMapRef: name: kubernetes-services-endpoint optional: true - image: docker.io/calico/typha:v3.25.0 + image: docker.io/calico/typha:v3.25.1 imagePullPolicy: IfNotPresent livenessProbe: httpGet: @@ -4535,7 +4535,7 @@ spec: - configMapRef: name: kubernetes-services-endpoint optional: true - image: docker.io/calico/node:v3.25.0 + image: docker.io/calico/node:v3.25.1 imagePullPolicy: IfNotPresent lifecycle: preStop: @@ -4610,7 +4610,7 @@ spec: - configMapRef: name: kubernetes-services-endpoint optional: true - image: docker.io/calico/cni:v3.25.0 + image: docker.io/calico/cni:v3.25.1 imagePullPolicy: IfNotPresent name: install-cni securityContext: @@ -4624,7 +4624,7 @@ spec: - calico-node - -init - -best-effort - image: docker.io/calico/node:v3.25.0 + image: docker.io/calico/node:v3.25.1 imagePullPolicy: IfNotPresent name: mount-bpffs securityContext: diff --git a/templates/addons/calico-ipv6/calico-policy-only.yaml b/templates/addons/calico-ipv6/calico-policy-only.yaml index bc9368dd472..2bc25490b17 100644 --- a/templates/addons/calico-ipv6/calico-policy-only.yaml +++ b/templates/addons/calico-ipv6/calico-policy-only.yaml @@ -4441,7 +4441,7 @@ spec: # This container installs the CNI binaries # and CNI network config file on each node. - name: install-cni - image: docker.io/calico/cni:v3.25.0 + image: docker.io/calico/cni:v3.25.1 imagePullPolicy: IfNotPresent command: ["/opt/cni/bin/install"] envFrom: @@ -4478,7 +4478,7 @@ spec: # i.e. bpf at /sys/fs/bpf and cgroup2 at /run/calico/cgroup. Calico-node initialisation is executed # in best effort fashion, i.e. no failure for errors, to not disrupt pod creation in iptable mode. - name: "mount-bpffs" - image: docker.io/calico/node:v3.25.0 + image: docker.io/calico/node:v3.25.1 imagePullPolicy: IfNotPresent command: ["calico-node", "-init", "-best-effort"] volumeMounts: @@ -4504,7 +4504,7 @@ spec: # container programs network policy and routes on each # host. - name: calico-node - image: docker.io/calico/node:v3.25.0 + image: docker.io/calico/node:v3.25.1 imagePullPolicy: IfNotPresent envFrom: - configMapRef: @@ -4692,7 +4692,7 @@ spec: priorityClassName: system-cluster-critical containers: - name: calico-kube-controllers - image: docker.io/calico/kube-controllers:v3.25.0 + image: docker.io/calico/kube-controllers:v3.25.1 imagePullPolicy: IfNotPresent env: # Choose which controllers to run. @@ -4776,7 +4776,7 @@ spec: securityContext: fsGroup: 65534 containers: - - image: docker.io/calico/typha:v3.25.0 + - image: docker.io/calico/typha:v3.25.1 imagePullPolicy: IfNotPresent name: calico-typha ports: diff --git a/templates/addons/calico-ipv6/values.yaml b/templates/addons/calico-ipv6/values.yaml index 4eea896cef8..1ab79c64929 100644 --- a/templates/addons/calico-ipv6/values.yaml +++ b/templates/addons/calico-ipv6/values.yaml @@ -12,3 +12,10 @@ installation: encapsulation: None natOutgoing: Enabled nodeSelector: all() + registry: mcr.microsoft.com/oss +# Image and registry configuration for the tigera/operator pod. +tigeraOperator: + image: tigera/operator + registry: mcr.microsoft.com/oss +calicoctl: + image: mcr.microsoft.com/oss/calico/ctl diff --git a/templates/addons/calico.yaml b/templates/addons/calico.yaml index f5df6094bce..41680c77bbe 100644 --- a/templates/addons/calico.yaml +++ b/templates/addons/calico.yaml @@ -4355,7 +4355,7 @@ spec: value: node - name: DATASTORE_TYPE value: kubernetes - image: docker.io/calico/kube-controllers:v3.25.0 + image: docker.io/calico/kube-controllers:v3.25.1 imagePullPolicy: IfNotPresent livenessProbe: exec: @@ -4468,7 +4468,7 @@ spec: - configMapRef: name: kubernetes-services-endpoint optional: true - image: docker.io/calico/node:v3.25.0 + image: docker.io/calico/node:v3.25.1 imagePullPolicy: IfNotPresent lifecycle: preStop: @@ -4540,7 +4540,7 @@ spec: - configMapRef: name: kubernetes-services-endpoint optional: true - image: docker.io/calico/cni:v3.25.0 + image: docker.io/calico/cni:v3.25.1 imagePullPolicy: IfNotPresent name: upgrade-ipam securityContext: @@ -4575,7 +4575,7 @@ spec: - configMapRef: name: kubernetes-services-endpoint optional: true - image: docker.io/calico/cni:v3.25.0 + image: docker.io/calico/cni:v3.25.1 imagePullPolicy: IfNotPresent name: install-cni securityContext: @@ -4589,7 +4589,7 @@ spec: - calico-node - -init - -best-effort - image: docker.io/calico/node:v3.25.0 + image: docker.io/calico/node:v3.25.1 imagePullPolicy: IfNotPresent name: mount-bpffs securityContext: diff --git a/templates/addons/calico/calico-vxlan.yaml b/templates/addons/calico/calico-vxlan.yaml index 4876d794f79..fafe27c4c22 100644 --- a/templates/addons/calico/calico-vxlan.yaml +++ b/templates/addons/calico/calico-vxlan.yaml @@ -4440,7 +4440,7 @@ spec: # It can be deleted if this is a fresh installation, or if you have already # upgraded to use calico-ipam. - name: upgrade-ipam - image: docker.io/calico/cni:v3.25.0 + image: docker.io/calico/cni:v3.25.1 imagePullPolicy: IfNotPresent command: ["/opt/cni/bin/calico-ipam", "-upgrade"] envFrom: @@ -4468,7 +4468,7 @@ spec: # This container installs the CNI binaries # and CNI network config file on each node. - name: install-cni - image: docker.io/calico/cni:v3.25.0 + image: docker.io/calico/cni:v3.25.1 imagePullPolicy: IfNotPresent command: ["/opt/cni/bin/install"] envFrom: @@ -4511,7 +4511,7 @@ spec: # i.e. bpf at /sys/fs/bpf and cgroup2 at /run/calico/cgroup. Calico-node initialisation is executed # in best effort fashion, i.e. no failure for errors, to not disrupt pod creation in iptable mode. - name: "mount-bpffs" - image: docker.io/calico/node:v3.25.0 + image: docker.io/calico/node:v3.25.1 imagePullPolicy: IfNotPresent command: ["calico-node", "-init", "-best-effort"] volumeMounts: @@ -4537,7 +4537,7 @@ spec: # container programs network policy and routes on each # host. - name: calico-node - image: docker.io/calico/node:v3.25.0 + image: docker.io/calico/node:v3.25.1 imagePullPolicy: IfNotPresent envFrom: - configMapRef: @@ -4752,7 +4752,7 @@ spec: priorityClassName: system-cluster-critical containers: - name: calico-kube-controllers - image: docker.io/calico/kube-controllers:v3.25.0 + image: docker.io/calico/kube-controllers:v3.25.1 imagePullPolicy: IfNotPresent env: # Choose which controllers to run. diff --git a/templates/addons/calico/values.yaml b/templates/addons/calico/values.yaml index 218504e0349..31defaf1d02 100644 --- a/templates/addons/calico/values.yaml +++ b/templates/addons/calico/values.yaml @@ -7,3 +7,10 @@ installation: ipPools: - cidr: 192.168.0.0/16 encapsulation: VXLAN + registry: mcr.microsoft.com/oss +# Image and registry configuration for the tigera/operator pod. +tigeraOperator: + image: tigera/operator + registry: mcr.microsoft.com/oss +calicoctl: + image: mcr.microsoft.com/oss/calico/ctl diff --git a/templates/addons/metrics-server/kustomization.yaml b/templates/addons/metrics-server/kustomization.yaml index acbadece860..42e51ab36ac 100644 --- a/templates/addons/metrics-server/kustomization.yaml +++ b/templates/addons/metrics-server/kustomization.yaml @@ -2,7 +2,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization namespace: kube-system resources: - - https://github.com/kubernetes-sigs/metrics-server/releases/download/v0.6.2/components.yaml + - https://github.com/kubernetes-sigs/metrics-server/releases/download/v0.6.3/components.yaml patchesStrategicMerge: - patches/control-plane-toleration.yaml patches: diff --git a/templates/addons/metrics-server/metrics-server.yaml b/templates/addons/metrics-server/metrics-server.yaml index 0d8a86b58a8..a0bc4bae9a7 100644 --- a/templates/addons/metrics-server/metrics-server.yaml +++ b/templates/addons/metrics-server/metrics-server.yaml @@ -138,7 +138,7 @@ spec: - --kubelet-use-node-status-port - --metric-resolution=15s - --kubelet-insecure-tls - image: k8s.gcr.io/metrics-server/metrics-server:v0.6.2 + image: registry.k8s.io/metrics-server/metrics-server:v0.6.3 imagePullPolicy: IfNotPresent livenessProbe: failureThreshold: 3 diff --git a/templates/addons/windows/calico/calico.yaml b/templates/addons/windows/calico/calico.yaml index 770af40021b..b28eeffdd63 100644 --- a/templates/addons/windows/calico/calico.yaml +++ b/templates/addons/windows/calico/calico.yaml @@ -163,7 +163,7 @@ spec: # This container installs the CNI binaries # and CNI network config file on each node. - name: install-cni - image: sigwindowstools/calico-install:v3.25.0-hostprocess + image: sigwindowstools/calico-install:v3.25.1-hostprocess args: ["$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/install.ps1"] imagePullPolicy: Always env: @@ -205,7 +205,7 @@ spec: runAsUserName: "NT AUTHORITY\\system" containers: - name: calico-node-startup - image: sigwindowstools/calico-node:v3.25.0-hostprocess + image: sigwindowstools/calico-node:v3.25.1-hostprocess args: ["$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/node-service.ps1"] workingDir: "$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/" imagePullPolicy: Always @@ -232,7 +232,7 @@ spec: - name: VXLAN_VNI value: "4096" - name: calico-node-felix - image: sigwindowstools/calico-node:v3.25.0-hostprocess + image: sigwindowstools/calico-node:v3.25.1-hostprocess args: ["$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/felix-service.ps1"] imagePullPolicy: Always workingDir: "$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/" @@ -274,3 +274,61 @@ spec: - name: kubeadm-config configMap: name: kubeadm-config +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: ipamconfigs.crd.projectcalico.org +spec: + group: crd.projectcalico.org + names: + kind: IPAMConfig + listKind: IPAMConfigList + plural: ipamconfigs + singular: ipamconfig + preserveUnknownFields: false + scope: Cluster + versions: + - name: v1 + schema: + openAPIV3Schema: + 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' + 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' + type: string + metadata: + type: object + spec: + description: IPAMConfigSpec contains the specification for an IPAMConfig + resource. + properties: + autoAllocateBlocks: + type: boolean + maxBlocksPerHost: + description: MaxBlocksPerHost, if non-zero, is the max number of blocks + that can be affine to each host. + maximum: 2147483647 + minimum: 0 + type: integer + strictAffinity: + type: boolean + required: + - autoAllocateBlocks + - strictAffinity + type: object + type: object + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/templates/cluster-template-aad.yaml b/templates/cluster-template-aad.yaml index 2ee92c5a40d..07f530abb2a 100644 --- a/templates/cluster-template-aad.yaml +++ b/templates/cluster-template-aad.yaml @@ -33,8 +33,6 @@ spec: - name: control-plane-subnet role: control-plane - name: node-subnet - natGateway: - name: node-natgateway role: node vnet: name: ${AZURE_VNET_NAME:=${CLUSTER_NAME}-vnet} diff --git a/templates/cluster-template-azure-bastion.yaml b/templates/cluster-template-azure-bastion.yaml index e922f76a8cc..98ffb2f540c 100644 --- a/templates/cluster-template-azure-bastion.yaml +++ b/templates/cluster-template-azure-bastion.yaml @@ -35,8 +35,6 @@ spec: - name: control-plane-subnet role: control-plane - name: node-subnet - natGateway: - name: node-natgateway role: node vnet: name: ${AZURE_VNET_NAME:=${CLUSTER_NAME}-vnet} diff --git a/templates/cluster-template-ephemeral.yaml b/templates/cluster-template-ephemeral.yaml index b815021e241..55ec76cf701 100644 --- a/templates/cluster-template-ephemeral.yaml +++ b/templates/cluster-template-ephemeral.yaml @@ -33,8 +33,6 @@ spec: - name: control-plane-subnet role: control-plane - name: node-subnet - natGateway: - name: node-natgateway role: node vnet: name: ${AZURE_VNET_NAME:=${CLUSTER_NAME}-vnet} diff --git a/templates/cluster-template-flatcar.yaml b/templates/cluster-template-flatcar.yaml index d30d1f04571..2978263dab6 100644 --- a/templates/cluster-template-flatcar.yaml +++ b/templates/cluster-template-flatcar.yaml @@ -33,8 +33,6 @@ spec: - name: control-plane-subnet role: control-plane - name: node-subnet - natGateway: - name: node-natgateway role: node vnet: name: ${AZURE_VNET_NAME:=${CLUSTER_NAME}-vnet} diff --git a/templates/cluster-template-ipv6.yaml b/templates/cluster-template-ipv6.yaml index 11a519105c8..caa7a12f41b 100644 --- a/templates/cluster-template-ipv6.yaml +++ b/templates/cluster-template-ipv6.yaml @@ -62,28 +62,16 @@ spec: apiServer: extraArgs: bind-address: '::' - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure - extraVolumes: - - hostPath: /etc/kubernetes/azure.json - mountPath: /etc/kubernetes/azure.json - name: cloud-config - readOnly: true + cloud-provider: external timeoutForControlPlane: 20m controllerManager: extraArgs: allocate-node-cidrs: "true" bind-address: '::' - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure + cloud-provider: external cluster-cidr: 2001:1234:5678:9a40::/58 cluster-name: ${CLUSTER_NAME} configure-cloud-routes: "true" - extraVolumes: - - hostPath: /etc/kubernetes/azure.json - mountPath: /etc/kubernetes/azure.json - name: cloud-config - readOnly: true etcd: local: dataDir: /var/lib/etcddisk/etcd @@ -124,10 +112,8 @@ spec: nodeRegistration: kubeletExtraArgs: azure-container-registry-config: /etc/kubernetes/azure.json - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure + cloud-provider: external cluster-dns: fd00::10 - node-ip: '::' name: '{{ ds.meta_data["local_hostname"] }}' joinConfiguration: controlPlane: @@ -137,10 +123,8 @@ spec: nodeRegistration: kubeletExtraArgs: azure-container-registry-config: /etc/kubernetes/azure.json - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure + cloud-provider: external cluster-dns: fd00::10 - node-ip: '::' name: '{{ ds.meta_data["local_hostname"] }}' mounts: - - LABEL=etcd_disk @@ -265,10 +249,8 @@ spec: nodeRegistration: kubeletExtraArgs: azure-container-registry-config: /etc/kubernetes/azure.json - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure + cloud-provider: external cluster-dns: '[fd00::10]' - node-ip: '::' name: '{{ ds.meta_data["local_hostname"] }}' postKubeadmCommands: - echo "DNSStubListener=no" >> /etc/systemd/resolved.conf diff --git a/templates/cluster-template-machinepool-windows.yaml b/templates/cluster-template-machinepool-windows.yaml index d8f5207512c..d691f0bdf97 100644 --- a/templates/cluster-template-machinepool-windows.yaml +++ b/templates/cluster-template-machinepool-windows.yaml @@ -37,8 +37,6 @@ spec: - name: control-plane-subnet role: control-plane - name: node-subnet - natGateway: - name: node-natgateway role: node vnet: name: ${AZURE_VNET_NAME:=${CLUSTER_NAME}-vnet} @@ -56,7 +54,6 @@ spec: apiServer: extraArgs: cloud-provider: external - feature-gates: WindowsHostProcessContainers=true timeoutForControlPlane: 20m controllerManager: extraArgs: @@ -281,7 +278,6 @@ spec: kubeletExtraArgs: azure-container-registry-config: c:/k/azure.json cloud-provider: external - feature-gates: WindowsHostProcessContainers=true pod-infra-container-image: mcr.microsoft.com/oss/kubernetes/pause:3.9 name: '{{ ds.meta_data["local_hostname"] }}' postKubeadmCommands: diff --git a/templates/cluster-template-machinepool.yaml b/templates/cluster-template-machinepool.yaml index 5f01ddae9ef..b4f9bd97f1e 100644 --- a/templates/cluster-template-machinepool.yaml +++ b/templates/cluster-template-machinepool.yaml @@ -33,8 +33,6 @@ spec: - name: control-plane-subnet role: control-plane - name: node-subnet - natGateway: - name: node-natgateway role: node vnet: name: ${AZURE_VNET_NAME:=${CLUSTER_NAME}-vnet} diff --git a/templates/cluster-template-nvidia-gpu.yaml b/templates/cluster-template-nvidia-gpu.yaml index 6a74c18657f..bb758313b47 100644 --- a/templates/cluster-template-nvidia-gpu.yaml +++ b/templates/cluster-template-nvidia-gpu.yaml @@ -33,8 +33,6 @@ spec: - name: control-plane-subnet role: control-plane - name: node-subnet - natGateway: - name: node-natgateway role: node vnet: name: ${AZURE_VNET_NAME:=${CLUSTER_NAME}-vnet} diff --git a/templates/cluster-template-private.yaml b/templates/cluster-template-private.yaml index e8a8ba7b51f..252b03eab1a 100644 --- a/templates/cluster-template-private.yaml +++ b/templates/cluster-template-private.yaml @@ -42,8 +42,6 @@ spec: - name: control-plane-subnet role: control-plane - name: node-subnet - natGateway: - name: node-natgateway role: node vnet: name: ${AZURE_VNET_NAME:=${CLUSTER_NAME}-vnet} diff --git a/templates/cluster-template-windows.yaml b/templates/cluster-template-windows.yaml index ac94f38119d..c84d2a1b6af 100644 --- a/templates/cluster-template-windows.yaml +++ b/templates/cluster-template-windows.yaml @@ -37,8 +37,6 @@ spec: - name: control-plane-subnet role: control-plane - name: node-subnet - natGateway: - name: node-natgateway role: node vnet: name: ${AZURE_VNET_NAME:=${CLUSTER_NAME}-vnet} @@ -56,7 +54,6 @@ spec: apiServer: extraArgs: cloud-provider: external - feature-gates: WindowsHostProcessContainers=true timeoutForControlPlane: 20m controllerManager: extraArgs: @@ -286,7 +283,6 @@ spec: kubeletExtraArgs: azure-container-registry-config: c:/k/azure.json cloud-provider: external - feature-gates: WindowsHostProcessContainers=true v: "2" windows-priorityclass: ABOVE_NORMAL_PRIORITY_CLASS name: '{{ ds.meta_data["local_hostname"] }}' diff --git a/templates/cluster-template.yaml b/templates/cluster-template.yaml index 4fc41f16cb9..270dd7b3758 100644 --- a/templates/cluster-template.yaml +++ b/templates/cluster-template.yaml @@ -33,8 +33,6 @@ spec: - name: control-plane-subnet role: control-plane - name: node-subnet - natGateway: - name: node-natgateway role: node vnet: name: ${AZURE_VNET_NAME:=${CLUSTER_NAME}-vnet} diff --git a/templates/flavors/base-windows-containerd/kubeadm-control-plane.yaml b/templates/flavors/base-windows-containerd/kubeadm-control-plane.yaml deleted file mode 100644 index 364d01a3123..00000000000 --- a/templates/flavors/base-windows-containerd/kubeadm-control-plane.yaml +++ /dev/null @@ -1,10 +0,0 @@ -apiVersion: controlplane.cluster.x-k8s.io/v1beta1 -kind: KubeadmControlPlane -metadata: - name: "${CLUSTER_NAME}-control-plane" -spec: - kubeadmConfigSpec: - clusterConfiguration: - apiServer: - extraArgs: - feature-gates: "WindowsHostProcessContainers=true" diff --git a/templates/flavors/base/cluster-template.yaml b/templates/flavors/base/cluster-template.yaml index 679eda71982..95f645b7153 100644 --- a/templates/flavors/base/cluster-template.yaml +++ b/templates/flavors/base/cluster-template.yaml @@ -31,8 +31,6 @@ spec: - name: control-plane-subnet role: control-plane - name: node-subnet - natGateway: - name: node-natgateway role: node --- kind: KubeadmControlPlane diff --git a/templates/flavors/ipv6/kustomization.yaml b/templates/flavors/ipv6/kustomization.yaml index 6a07db80c85..2cf1ca67e7a 100644 --- a/templates/flavors/ipv6/kustomization.yaml +++ b/templates/flavors/ipv6/kustomization.yaml @@ -6,8 +6,6 @@ resources: patchesStrategicMerge: - ../../azure-cluster-identity/azurecluster-identity-ref.yaml - - ../../test/ci/prow-intree-cloud-provider/patches/intree-cp.yaml # TODO: enable CCM for ipv6, see https://github.com/kubernetes-sigs/cloud-provider-azure/issues/3401. - - ../../test/ci/prow-intree-cloud-provider/patches/intree-md-0.yaml # TODO: enable CCM for ipv6, see https://github.com/kubernetes-sigs/cloud-provider-azure/issues/3401. - patches/ipv6.yaml - patches/kubeadm-controlplane.yaml - patches/controlplane-azuremachinetemplate.yaml diff --git a/templates/flavors/ipv6/machine-deployment.yaml b/templates/flavors/ipv6/machine-deployment.yaml index 9d2b1e644ed..617ea8e73f5 100644 --- a/templates/flavors/ipv6/machine-deployment.yaml +++ b/templates/flavors/ipv6/machine-deployment.yaml @@ -55,7 +55,7 @@ spec: name: '{{ ds.meta_data["local_hostname"] }}' kubeletExtraArgs: azure-container-registry-config: /etc/kubernetes/azure.json - node-ip: "::" + cloud-provider: external cluster-dns: "[fd00::10]" clusterConfiguration: apiServer: diff --git a/templates/flavors/ipv6/patches/kubeadm-controlplane.yaml b/templates/flavors/ipv6/patches/kubeadm-controlplane.yaml index 7905e2e79b5..662d3d70acd 100644 --- a/templates/flavors/ipv6/patches/kubeadm-controlplane.yaml +++ b/templates/flavors/ipv6/patches/kubeadm-controlplane.yaml @@ -13,7 +13,6 @@ spec: nodeRegistration: name: '{{ ds.meta_data["local_hostname"] }}' kubeletExtraArgs: - node-ip: "::" cluster-dns: "fd00::10" localAPIEndpoint: advertiseAddress: "::" @@ -22,7 +21,6 @@ spec: nodeRegistration: name: '{{ ds.meta_data["local_hostname"] }}' kubeletExtraArgs: - node-ip: "::" cluster-dns: "fd00::10" controlPlane: localAPIEndpoint: diff --git a/templates/flavors/machinepool-windows/kustomization.yaml b/templates/flavors/machinepool-windows/kustomization.yaml index 83a53584e22..79414abb008 100644 --- a/templates/flavors/machinepool-windows/kustomization.yaml +++ b/templates/flavors/machinepool-windows/kustomization.yaml @@ -4,5 +4,4 @@ resources: - machine-pool-deployment-windows.yaml patchesStrategicMerge: - - ../base-windows-containerd/kubeadm-control-plane.yaml - ../base-windows-containerd/cluster.yaml diff --git a/templates/flavors/machinepool-windows/machine-pool-deployment-windows.yaml b/templates/flavors/machinepool-windows/machine-pool-deployment-windows.yaml index c245a331a86..3213a949346 100644 --- a/templates/flavors/machinepool-windows/machine-pool-deployment-windows.yaml +++ b/templates/flavors/machinepool-windows/machine-pool-deployment-windows.yaml @@ -61,7 +61,6 @@ spec: azure-container-registry-config: 'c:/k/azure.json' cloud-provider: external pod-infra-container-image: "mcr.microsoft.com/oss/kubernetes/pause:3.9" - feature-gates: "WindowsHostProcessContainers=true" files: - contentFrom: secret: diff --git a/templates/flavors/windows/kustomization.yaml b/templates/flavors/windows/kustomization.yaml index f119c9653dc..a4cb648e3a8 100644 --- a/templates/flavors/windows/kustomization.yaml +++ b/templates/flavors/windows/kustomization.yaml @@ -4,6 +4,5 @@ resources: - machine-deployment-windows.yaml patchesStrategicMerge: - - ../base-windows-containerd/kubeadm-control-plane.yaml - ../base-windows-containerd/cluster.yaml diff --git a/templates/flavors/windows/machine-deployment-windows.yaml b/templates/flavors/windows/machine-deployment-windows.yaml index 2deda6c8744..5675239bfa8 100644 --- a/templates/flavors/windows/machine-deployment-windows.yaml +++ b/templates/flavors/windows/machine-deployment-windows.yaml @@ -65,7 +65,6 @@ spec: kubeletExtraArgs: azure-container-registry-config: 'c:/k/azure.json' cloud-provider: external - feature-gates: "WindowsHostProcessContainers=true" v: "2" windows-priorityclass: "ABOVE_NORMAL_PRIORITY_CLASS" files: diff --git a/templates/test/ci/cluster-template-prow-ci-version-windows-containerd-2022.yaml b/templates/test/ci/cluster-template-prow-ci-version-windows-containerd-2022.yaml deleted file mode 100644 index b3a809157dd..00000000000 --- a/templates/test/ci/cluster-template-prow-ci-version-windows-containerd-2022.yaml +++ /dev/null @@ -1,1154 +0,0 @@ -apiVersion: cluster.x-k8s.io/v1beta1 -kind: Cluster -metadata: - labels: - cni-windows: ${CLUSTER_NAME}-calico - containerd-logger: enabled - csi-proxy: enabled - metrics-server: enabled - name: ${CLUSTER_NAME} - namespace: default -spec: - clusterNetwork: - pods: - cidrBlocks: - - 192.168.0.0/16 - controlPlaneRef: - apiVersion: controlplane.cluster.x-k8s.io/v1beta1 - kind: KubeadmControlPlane - name: ${CLUSTER_NAME}-control-plane - infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 - kind: AzureCluster - name: ${CLUSTER_NAME} ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 -kind: AzureCluster -metadata: - name: ${CLUSTER_NAME} - namespace: default -spec: - additionalTags: - buildProvenance: ${BUILD_PROVENANCE} - creationTimestamp: ${TIMESTAMP} - jobName: ${JOB_NAME} - identityRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 - kind: AzureClusterIdentity - name: ${CLUSTER_IDENTITY_NAME} - location: ${AZURE_LOCATION} - networkSpec: - subnets: - - name: control-plane-subnet - role: control-plane - - name: node-subnet - natGateway: - name: node-natgateway - role: node - vnet: - name: ${AZURE_VNET_NAME:=${CLUSTER_NAME}-vnet} - resourceGroup: ${AZURE_RESOURCE_GROUP:=${CLUSTER_NAME}} - subscriptionID: ${AZURE_SUBSCRIPTION_ID} ---- -apiVersion: controlplane.cluster.x-k8s.io/v1beta1 -kind: KubeadmControlPlane -metadata: - name: ${CLUSTER_NAME}-control-plane - namespace: default -spec: - kubeadmConfigSpec: - clusterConfiguration: - apiServer: - extraArgs: - cloud-provider: external - feature-gates: ${K8S_FEATURE_GATES:-""} - timeoutForControlPlane: 20m - controllerManager: - extraArgs: - allocate-node-cidrs: "false" - cloud-provider: external - cluster-name: ${CLUSTER_NAME} - feature-gates: HPAContainerMetrics=true - v: "4" - etcd: - local: - dataDir: /var/lib/etcddisk/etcd - extraArgs: - quota-backend-bytes: "8589934592" - kubernetesVersion: ci/${CI_VERSION} - diskSetup: - filesystems: - - device: /dev/disk/azure/scsi1/lun0 - extraOpts: - - -E - - lazy_itable_init=1,lazy_journal_init=1 - filesystem: ext4 - label: etcd_disk - - device: ephemeral0.1 - filesystem: ext4 - label: ephemeral0 - replaceFS: ntfs - partitions: - - device: /dev/disk/azure/scsi1/lun0 - layout: true - overwrite: false - tableType: gpt - files: - - contentFrom: - secret: - key: control-plane-azure.json - name: ${CLUSTER_NAME}-control-plane-azure-json - owner: root:root - path: /etc/kubernetes/azure.json - permissions: "0644" - - content: | - #!/bin/bash - - set -o nounset - set -o pipefail - set -o errexit - [[ $(id -u) != 0 ]] && SUDO="sudo" || SUDO="" - - # This test installs release packages or binaries that are a result of the CI and release builds. - # It runs '... --version' commands to verify that the binaries are correctly installed - # and finally uninstalls the packages. - # For the release packages it tests all versions in the support skew. - LINE_SEPARATOR="*************************************************" - echo "$$LINE_SEPARATOR" - CI_VERSION=${CI_VERSION} - if [[ "$${CI_VERSION}" != "" ]]; then - CI_DIR=/tmp/k8s-ci - mkdir -p $$CI_DIR - declare -a PACKAGES_TO_TEST=("kubectl" "kubelet" "kubeadm") - declare -a CONTAINERS_TO_TEST=("kube-apiserver" "kube-controller-manager" "kube-proxy" "kube-scheduler") - CONTAINER_EXT="tar" - echo "* testing CI version $$CI_VERSION" - # Check for semver - if [[ "$${CI_VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - VERSION_WITHOUT_PREFIX="${CI_VERSION#v}" - DEBIAN_FRONTEND=noninteractive apt-get install -y apt-transport-https curl - curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - - echo 'deb https://apt.kubernetes.io/ kubernetes-xenial main' > /etc/apt/sources.list.d/kubernetes.list - apt-get update - # replace . with \. - VERSION_REGEX="${VERSION_WITHOUT_PREFIX//./\\.}" - PACKAGE_VERSION="$(apt-cache madison kubelet|grep $${VERSION_REGEX}- | head -n1 | cut -d '|' -f 2 | tr -d '[:space:]')" - for CI_PACKAGE in "$${PACKAGES_TO_TEST[@]}"; do - echo "* installing package: $$CI_PACKAGE $${PACKAGE_VERSION}" - DEBIAN_FRONTEND=noninteractive apt-get install -y $$CI_PACKAGE=$$PACKAGE_VERSION - done - else - CI_URL="https://storage.googleapis.com/k8s-release-dev/ci/$${CI_VERSION}/bin/linux/amd64" - for CI_PACKAGE in "$${PACKAGES_TO_TEST[@]}"; do - echo "* downloading binary: $$CI_URL/$$CI_PACKAGE" - wget "$$CI_URL/$$CI_PACKAGE" -nv -O "$$CI_DIR/$$CI_PACKAGE" - chmod +x "$$CI_DIR/$$CI_PACKAGE" - mv "$$CI_DIR/$$CI_PACKAGE" "/usr/bin/$$CI_PACKAGE" - done - IMAGE_REGISTRY_PREFIX=registry.k8s.io - for CI_CONTAINER in "$${CONTAINERS_TO_TEST[@]}"; do - echo "* downloading package: $$CI_URL/$$CI_CONTAINER.$$CONTAINER_EXT" - wget "$$CI_URL/$$CI_CONTAINER.$$CONTAINER_EXT" -nv -O "$$CI_DIR/$$CI_CONTAINER.$$CONTAINER_EXT" - $${SUDO} ctr -n k8s.io images import "$$CI_DIR/$$CI_CONTAINER.$$CONTAINER_EXT" || echo "* ignoring expected 'ctr images import' result" - $${SUDO} ctr -n k8s.io images tag $$IMAGE_REGISTRY_PREFIX/$$CI_CONTAINER-amd64:"$${CI_VERSION//+/_}" $$IMAGE_REGISTRY_PREFIX/$$CI_CONTAINER:"$${CI_VERSION//+/_}" - $${SUDO} ctr -n k8s.io images tag $$IMAGE_REGISTRY_PREFIX/$$CI_CONTAINER-amd64:"$${CI_VERSION//+/_}" gcr.io/k8s-staging-ci-images/$$CI_CONTAINER:"$${CI_VERSION//+/_}" - done - fi - fi - echo "* checking binary versions" - echo "ctr version: " $(ctr version) - echo "kubeadm version: " $(kubeadm version -o=short) - echo "kubectl version: " $(kubectl version --client=true --short=true) - echo "kubelet version: " $(kubelet --version) - echo "$$LINE_SEPARATOR" - owner: root:root - path: /tmp/kubeadm-bootstrap.sh - permissions: "0744" - initConfiguration: - nodeRegistration: - kubeletExtraArgs: - azure-container-registry-config: /etc/kubernetes/azure.json - cloud-provider: external - name: '{{ ds.meta_data["local_hostname"] }}' - joinConfiguration: - nodeRegistration: - kubeletExtraArgs: - azure-container-registry-config: /etc/kubernetes/azure.json - cloud-provider: external - name: '{{ ds.meta_data["local_hostname"] }}' - mounts: - - - LABEL=etcd_disk - - /var/lib/etcddisk - postKubeadmCommands: [] - preKubeadmCommands: - - bash -c /tmp/kubeadm-bootstrap.sh - verbosity: 5 - machineTemplate: - infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 - kind: AzureMachineTemplate - name: ${CLUSTER_NAME}-control-plane - replicas: ${CONTROL_PLANE_MACHINE_COUNT} - version: ${KUBERNETES_VERSION} ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 -kind: AzureMachineTemplate -metadata: - name: ${CLUSTER_NAME}-control-plane - namespace: default -spec: - template: - spec: - dataDisks: - - diskSizeGB: 256 - lun: 0 - nameSuffix: etcddisk - image: - marketplace: - offer: capi - publisher: cncf-upstream - sku: ubuntu-1804-gen1 - version: latest - osDisk: - diskSizeGB: 128 - osType: Linux - sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""} - vmSize: ${AZURE_CONTROL_PLANE_MACHINE_TYPE} ---- -apiVersion: cluster.x-k8s.io/v1beta1 -kind: MachineDeployment -metadata: - name: ${CLUSTER_NAME}-md-0 - namespace: default -spec: - clusterName: ${CLUSTER_NAME} - replicas: ${WORKER_MACHINE_COUNT} - selector: {} - template: - metadata: - labels: - nodepool: pool1 - spec: - bootstrap: - configRef: - apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 - kind: KubeadmConfigTemplate - name: ${CLUSTER_NAME}-md-0 - clusterName: ${CLUSTER_NAME} - infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 - kind: AzureMachineTemplate - name: ${CLUSTER_NAME}-md-0 - version: ${KUBERNETES_VERSION} ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 -kind: AzureMachineTemplate -metadata: - name: ${CLUSTER_NAME}-md-0 - namespace: default -spec: - template: - spec: - image: - marketplace: - offer: capi - publisher: cncf-upstream - sku: ubuntu-1804-gen1 - version: latest - osDisk: - diskSizeGB: 128 - osType: Linux - sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""} - vmExtensions: - - name: CustomScript - protectedSettings: - commandToExecute: | - #!/bin/sh - echo "This script is a no-op used for extension testing purposes ..." - touch test_file - publisher: Microsoft.Azure.Extensions - version: "2.1" - vmSize: ${AZURE_NODE_MACHINE_TYPE} ---- -apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 -kind: KubeadmConfigTemplate -metadata: - name: ${CLUSTER_NAME}-md-0 - namespace: default -spec: - template: - spec: - files: - - contentFrom: - secret: - key: worker-node-azure.json - name: ${CLUSTER_NAME}-md-0-azure-json - owner: root:root - path: /etc/kubernetes/azure.json - permissions: "0644" - - content: | - #!/bin/bash - - set -o nounset - set -o pipefail - set -o errexit - [[ $(id -u) != 0 ]] && SUDO="sudo" || SUDO="" - - # This test installs release packages or binaries that are a result of the CI and release builds. - # It runs '... --version' commands to verify that the binaries are correctly installed - # and finally uninstalls the packages. - # For the release packages it tests all versions in the support skew. - LINE_SEPARATOR="*************************************************" - echo "$$LINE_SEPARATOR" - CI_VERSION=${CI_VERSION} - if [[ "$${CI_VERSION}" != "" ]]; then - CI_DIR=/tmp/k8s-ci - mkdir -p $$CI_DIR - declare -a PACKAGES_TO_TEST=("kubectl" "kubelet" "kubeadm") - declare -a CONTAINERS_TO_TEST=("kube-apiserver" "kube-controller-manager" "kube-proxy" "kube-scheduler") - CONTAINER_EXT="tar" - echo "* testing CI version $$CI_VERSION" - # Check for semver - if [[ "$${CI_VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - VERSION_WITHOUT_PREFIX="${CI_VERSION#v}" - DEBIAN_FRONTEND=noninteractive apt-get install -y apt-transport-https curl - curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - - echo 'deb https://apt.kubernetes.io/ kubernetes-xenial main' > /etc/apt/sources.list.d/kubernetes.list - apt-get update - # replace . with \. - VERSION_REGEX="${VERSION_WITHOUT_PREFIX//./\\.}" - PACKAGE_VERSION="$(apt-cache madison kubelet|grep $${VERSION_REGEX}- | head -n1 | cut -d '|' -f 2 | tr -d '[:space:]')" - for CI_PACKAGE in "$${PACKAGES_TO_TEST[@]}"; do - echo "* installing package: $$CI_PACKAGE $${PACKAGE_VERSION}" - DEBIAN_FRONTEND=noninteractive apt-get install -y $$CI_PACKAGE=$$PACKAGE_VERSION - done - else - CI_URL="https://storage.googleapis.com/k8s-release-dev/ci/$${CI_VERSION}/bin/linux/amd64" - for CI_PACKAGE in "$${PACKAGES_TO_TEST[@]}"; do - echo "* downloading binary: $$CI_URL/$$CI_PACKAGE" - wget "$$CI_URL/$$CI_PACKAGE" -nv -O "$$CI_DIR/$$CI_PACKAGE" - chmod +x "$$CI_DIR/$$CI_PACKAGE" - mv "$$CI_DIR/$$CI_PACKAGE" "/usr/bin/$$CI_PACKAGE" - done - IMAGE_REGISTRY_PREFIX=registry.k8s.io - for CI_CONTAINER in "$${CONTAINERS_TO_TEST[@]}"; do - echo "* downloading package: $$CI_URL/$$CI_CONTAINER.$$CONTAINER_EXT" - wget "$$CI_URL/$$CI_CONTAINER.$$CONTAINER_EXT" -nv -O "$$CI_DIR/$$CI_CONTAINER.$$CONTAINER_EXT" - $${SUDO} ctr -n k8s.io images import "$$CI_DIR/$$CI_CONTAINER.$$CONTAINER_EXT" || echo "* ignoring expected 'ctr images import' result" - $${SUDO} ctr -n k8s.io images tag $$IMAGE_REGISTRY_PREFIX/$$CI_CONTAINER-amd64:"$${CI_VERSION//+/_}" $$IMAGE_REGISTRY_PREFIX/$$CI_CONTAINER:"$${CI_VERSION//+/_}" - $${SUDO} ctr -n k8s.io images tag $$IMAGE_REGISTRY_PREFIX/$$CI_CONTAINER-amd64:"$${CI_VERSION//+/_}" gcr.io/k8s-staging-ci-images/$$CI_CONTAINER:"$${CI_VERSION//+/_}" - done - fi - fi - echo "* checking binary versions" - echo "ctr version: " $(ctr version) - echo "kubeadm version: " $(kubeadm version -o=short) - echo "kubectl version: " $(kubectl version --client=true --short=true) - echo "kubelet version: " $(kubelet --version) - echo "$$LINE_SEPARATOR" - owner: root:root - path: /tmp/kubeadm-bootstrap.sh - permissions: "0744" - joinConfiguration: - nodeRegistration: - kubeletExtraArgs: - azure-container-registry-config: /etc/kubernetes/azure.json - cloud-provider: external - name: '{{ ds.meta_data["local_hostname"] }}' - preKubeadmCommands: - - bash -c /tmp/kubeadm-bootstrap.sh - verbosity: 5 ---- -apiVersion: cluster.x-k8s.io/v1beta1 -kind: MachineDeployment -metadata: - name: ${CLUSTER_NAME}-md-win - namespace: default -spec: - clusterName: ${CLUSTER_NAME} - replicas: ${WINDOWS_WORKER_MACHINE_COUNT:-0} - selector: {} - template: - spec: - bootstrap: - configRef: - apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 - kind: KubeadmConfigTemplate - name: ${CLUSTER_NAME}-md-win - clusterName: ${CLUSTER_NAME} - infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 - kind: AzureMachineTemplate - name: ${CLUSTER_NAME}-md-win - version: ${KUBERNETES_VERSION} ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 -kind: AzureMachineTemplate -metadata: - annotations: - runtime: containerd - name: ${CLUSTER_NAME}-md-win - namespace: default -spec: - template: - metadata: - annotations: - runtime: containerd - windowsServerVersion: ${WINDOWS_SERVER_VERSION:=""} - spec: - image: - marketplace: - offer: capi-windows - publisher: cncf-upstream - sku: windows-2022-containerd-gen1 - version: latest - osDisk: - diskSizeGB: 128 - managedDisk: - storageAccountType: Premium_LRS - osType: Windows - sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""} - vmSize: ${AZURE_NODE_MACHINE_TYPE} ---- -apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 -kind: KubeadmConfigTemplate -metadata: - name: ${CLUSTER_NAME}-md-win - namespace: default -spec: - template: - spec: - files: - - contentFrom: - secret: - key: worker-node-azure.json - name: ${CLUSTER_NAME}-md-win-azure-json - owner: root:root - path: c:/k/azure.json - permissions: "0644" - - content: |- - Add-MpPreference -ExclusionProcess C:/opt/cni/bin/calico.exe - Add-MpPreference -ExclusionProcess C:/opt/cni/bin/calico-ipam.exe - path: C:/defender-exclude-calico.ps1 - permissions: "0744" - - content: | - # /tmp is assumed created and required for upstream e2e tests to pass - New-Item -ItemType Directory -Force -Path C:\tmp\ - path: C:/create-temp-folder.ps1 - permissions: "0744" - - content: | - $ErrorActionPreference = 'Stop' - - $$CONTAINERD_URL="${WINDOWS_CONTAINERD_URL}" - if($$CONTAINERD_URL -ne ""){ - # Kubelet service depends on contianerd service so make a best effort attempt to stop it - Stop-Service kubelet -Force -ErrorAction SilentlyContinue - Stop-Service containerd -Force - echo "downloading containerd: $$CONTAINERD_URL" - curl.exe --retry 10 --retry-delay 5 -L "$$CONTAINERD_URL" --output "c:/k/containerd.tar.gz" - tar.exe -zxvf c:/k/containerd.tar.gz -C "c:/Program Files/containerd" --strip-components 1 - - Start-Service containerd - } - - containerd.exe --version - containerd-shim-runhcs-v1.exe --version - path: C:/replace-containerd.ps1 - permissions: "0744" - - content: | - mkdir -Force c:/localdumps - reg.exe add "HKLM\Software\Microsoft\Windows\Windows Error Reporting\LocalDumps" /V DumpCount /t REG_DWORD /d 50 /f - reg.exe add "HKLM\Software\Microsoft\Windows\Windows Error Reporting\LocalDumps" /V DumpType /t REG_DWORD /d 2 /f - reg.exe add "HKLM\Software\Microsoft\Windows\Windows Error Reporting\LocalDumps" /V DumpFolder /t REG_EXPAND_SZ /d "c:/LocalDumps" /f - # Enable sftp so we can copy crash dump files during log collection of stfp - $sshd_config = "$env:ProgramData\ssh\sshd_config" - if (-not (Test-Path $sshd_config)) { mkdir -Force $sshd_config } - Add-Content -Path $sshd_config "Subsystem sftp sftp-server.exe" - sc.exe stop sshd - sc.exe start sshd - path: C:/collect-hns-crashes.ps1 - permissions: "0744" - - content: | - $ErrorActionPreference = 'Stop' - - Stop-Service kubelet -Force - - $$CI_VERSION="${CI_VERSION}" - if($$CI_VERSION -ne "") - { - $$binaries=@("kubeadm", "kubectl", "kubelet", "kube-proxy") - $$ci_url="https://storage.googleapis.com/k8s-release-dev/ci/$$CI_VERSION/bin/windows/amd64" - foreach ( $$binary in $$binaries ) - { - echo "downloading binary: $$ci_url/$$binary.exe" - curl.exe --retry 10 --retry-delay 5 "$$ci_url/$$binary.exe" --output "c:/k/$$binary.exe" - } - } - - # Tag it to the ci version. The image knows how to use the copy locally with the configmap - # that is applied at at this stage (windows-kubeproxy-ci.yaml) - ctr.exe -n k8s.io images pull docker.io/sigwindowstools/kube-proxy:v1.23.1-calico-hostprocess - ctr.exe -n k8s.io images tag docker.io/sigwindowstools/kube-proxy:v1.23.1-calico-hostprocess "docker.io/sigwindowstools/kube-proxy:${CI_VERSION/+/_}-calico-hostprocess" - - kubeadm.exe version -o=short - kubectl.exe version --client=true --short=true - kubelet.exe --version - kube-proxy.exe --version - path: C:/replace-ci-binaries.ps1 - permissions: "0744" - joinConfiguration: - nodeRegistration: - criSocket: npipe:////./pipe/containerd-containerd - kubeletExtraArgs: - azure-container-registry-config: c:/k/azure.json - cloud-provider: external - feature-gates: WindowsHostProcessContainers=true - v: "2" - windows-priorityclass: ABOVE_NORMAL_PRIORITY_CLASS - name: '{{ ds.meta_data["local_hostname"] }}' - postKubeadmCommands: - - nssm set kubelet start SERVICE_AUTO_START - - powershell C:/defender-exclude-calico.ps1 - preKubeadmCommands: - - powershell C:/create-temp-folder.ps1 - - powershell C:/replace-containerd.ps1 - - powershell C:/collect-hns-crashes.ps1 - - powershell C:/replace-ci-binaries.ps1 - users: - - groups: Administrators - name: capi - sshAuthorizedKeys: - - ${AZURE_SSH_PUBLIC_KEY:=""} ---- -apiVersion: cluster.x-k8s.io/v1beta1 -kind: MachineHealthCheck -metadata: - name: ${CLUSTER_NAME}-mhc-0 - namespace: default -spec: - clusterName: ${CLUSTER_NAME} - maxUnhealthy: 100% - selector: - matchLabels: - nodepool: pool1 - unhealthyConditions: - - status: "True" - timeout: 30s - type: E2ENodeUnhealthy ---- -apiVersion: addons.cluster.x-k8s.io/v1beta1 -kind: ClusterResourceSet -metadata: - name: ${CLUSTER_NAME}-calico-windows - namespace: default -spec: - clusterSelector: - matchLabels: - cni-windows: ${CLUSTER_NAME}-calico - resources: - - kind: ConfigMap - name: cni-${CLUSTER_NAME}-calico-windows - strategy: ApplyOnce ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 -kind: AzureClusterIdentity -metadata: - labels: - clusterctl.cluster.x-k8s.io/move-hierarchy: "true" - name: ${CLUSTER_IDENTITY_NAME} - namespace: default -spec: - allowedNamespaces: {} - clientID: ${AZURE_CLIENT_ID} - clientSecret: - name: ${AZURE_CLUSTER_IDENTITY_SECRET_NAME} - namespace: ${AZURE_CLUSTER_IDENTITY_SECRET_NAMESPACE} - tenantID: ${AZURE_TENANT_ID} - type: ServicePrincipal ---- -apiVersion: addons.cluster.x-k8s.io/v1beta1 -kind: ClusterResourceSet -metadata: - name: csi-proxy - namespace: default -spec: - clusterSelector: - matchLabels: - csi-proxy: enabled - resources: - - kind: ConfigMap - name: csi-proxy-addon - strategy: ApplyOnce ---- -apiVersion: addons.cluster.x-k8s.io/v1beta1 -kind: ClusterResourceSet -metadata: - name: containerd-logger-${CLUSTER_NAME} - namespace: default -spec: - clusterSelector: - matchLabels: - containerd-logger: enabled - resources: - - kind: ConfigMap - name: containerd-logger-${CLUSTER_NAME} - strategy: ApplyOnce ---- -apiVersion: v1 -data: - kube-proxy-patch: |- - apiVersion: v1 - kind: ConfigMap - metadata: - name: windows-kubeproxy-ci - namespace: kube-system - data: - KUBEPROXY_PATH: "c:/k/kube-proxy.exe" - proxy: | - apiVersion: apps/v1 - kind: DaemonSet - metadata: - labels: - k8s-app: kube-proxy - name: kube-proxy-windows - namespace: kube-system - spec: - selector: - matchLabels: - k8s-app: kube-proxy-windows - template: - metadata: - labels: - k8s-app: kube-proxy-windows - spec: - serviceAccountName: kube-proxy - securityContext: - windowsOptions: - hostProcess: true - runAsUserName: "NT AUTHORITY\\system" - hostNetwork: true - containers: - - image: sigwindowstools/kube-proxy:${KUBERNETES_VERSION/+/_}-calico-hostprocess - args: ["$env:CONTAINER_SANDBOX_MOUNT_POINT/kube-proxy/start.ps1"] - workingDir: "$env:CONTAINER_SANDBOX_MOUNT_POINT/kube-proxy/" - name: kube-proxy - env: - - name: NODE_NAME - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: spec.nodeName - - name: POD_IP - valueFrom: - fieldRef: - fieldPath: status.podIP - - name: KUBEPROXY_PATH - valueFrom: - configMapKeyRef: - name: windows-kubeproxy-ci - key: KUBEPROXY_PATH - optional: true - volumeMounts: - - mountPath: /var/lib/kube-proxy - name: kube-proxy - nodeSelector: - kubernetes.io/os: windows - tolerations: - - key: CriticalAddonsOnly - operator: Exists - - operator: Exists - volumes: - - configMap: - name: kube-proxy - name: kube-proxy - updateStrategy: - type: RollingUpdate - windows-cni: "# strictAffinity required for windows\napiVersion: crd.projectcalico.org/v1\nkind: - IPAMConfig\nmetadata:\n name: default\nspec:\n autoAllocateBlocks: true\n strictAffinity: - true\n---\nkind: ConfigMap\napiVersion: v1\nmetadata:\n name: calico-static-rules\n - \ namespace: calico-system\n labels:\n tier: node\n app: calico\ndata:\n - \ static-rules.json: |\n {\n \"Provider\": \"azure\",\n \"Version\": - \"0.1\",\n \"Rules\": [\n {\n \"Name\": \"EndpointPolicy\",\n - \ \"Rule\": {\n \"Id\": \"wireserver\",\n \"Type\": - \"ACL\",\n \"Protocol\": 6,\n \"Action\": \"Block\",\n - \ \"Direction\": \"Out\",\n \"RemoteAddresses\": \"168.63.129.16/32\",\n - \ \"RemotePorts\": \"80\",\n \"Priority\": 200,\n \"RuleType\": - \"Switch\"\n }\n }\n ]\n } \n---\nkind: ConfigMap\napiVersion: - v1\nmetadata:\n name: calico-config-windows\n namespace: calico-system\n labels:\n - \ tier: node\n app: calico\ndata:\n veth_mtu: \"1350\"\n \n cni_network_config: - |\n {\n \"name\": \"Calico\",\n \"cniVersion\": \"0.3.1\",\n \"plugins\": - [\n {\n \"windows_use_single_network\": true,\n \"type\": - \"calico\",\n \"mode\": \"vxlan\",\n \"nodename\": \"__KUBERNETES_NODE_NAME__\",\n - \ \"nodename_file_optional\": true,\n \"log_file_path\": \"c:/cni.log\",\n - \ \"log_level\": \"debug\",\n\n \"vxlan_mac_prefix\": \"0E-2A\",\n - \ \"vxlan_vni\": 4096,\n \"mtu\": __CNI_MTU__,\n \"policy\": - {\n \"type\": \"k8s\"\n },\n\n \"log_level\": \"info\",\n\n - \ \"capabilities\": {\"dns\": true},\n \"DNS\": {\n \"Search\": - \ [\n \"svc.cluster.local\"\n ]\n },\n\n \"datastore_type\": - \"kubernetes\",\n\n \"kubernetes\": {\n \"kubeconfig\": \"__KUBECONFIG_FILEPATH__\"\n - \ },\n\n \"ipam\": {\n \"type\": \"calico-ipam\",\n - \ \"subnet\": \"usePodCidr\"\n },\n\n \"policies\": - \ [\n {\n \"Name\": \"EndpointPolicy\",\n \"Value\": - \ {\n \"Type\": \"OutBoundNAT\",\n \"ExceptionList\": - \ [\n \"__K8S_SERVICE_CIDR__\"\n ]\n }\n - \ },\n {\n \"Name\": \"EndpointPolicy\",\n - \ \"Value\": {\n \"Type\": \"SDNROUTE\",\n \"DestinationPrefix\": - \ \"__K8S_SERVICE_CIDR__\",\n \"NeedEncap\": true\n }\n - \ }\n ]\n }\n ]\n\n }\n---\napiVersion: apps/v1\nkind: - DaemonSet\nmetadata:\n name: calico-node-windows\n labels:\n tier: node\n - \ app: calico\n namespace: calico-system\nspec:\n selector:\n matchLabels:\n - \ app: calico\n template:\n metadata:\n labels:\n tier: node\n - \ app: calico\n spec:\n affinity:\n nodeAffinity:\n requiredDuringSchedulingIgnoredDuringExecution:\n - \ nodeSelectorTerms:\n - matchExpressions:\n - - key: kubernetes.io/os\n operator: In\n values:\n - \ - windows\n - key: kubernetes.io/arch\n - \ operator: In\n values:\n - - amd64\n securityContext:\n windowsOptions:\n hostProcess: - true\n runAsUserName: \"NT AUTHORITY\\\\system\"\n hostNetwork: - true\n serviceAccountName: calico-node\n tolerations:\n - operator: - Exists\n effect: NoSchedule\n # Mark the pod as a critical add-on - for rescheduling.\n - key: CriticalAddonsOnly\n operator: Exists\n - \ - effect: NoExecute\n operator: Exists\n initContainers:\n # - This container installs the CNI binaries\n # and CNI network config file - on each node.\n - name: install-cni\n image: sigwindowstools/calico-install:v3.25.0-hostprocess\n - \ args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/install.ps1\"]\n - \ imagePullPolicy: Always\n env:\n # Name of the CNI - config file to create.\n - name: CNI_CONF_NAME\n value: - \"10-calico.conflist\"\n # The CNI network config to install on each - node.\n - name: CNI_NETWORK_CONFIG\n valueFrom:\n configMapKeyRef:\n - \ name: calico-config-windows\n key: cni_network_config\n - \ # Set the hostname based on the k8s node name.\n - name: - KUBERNETES_NODE_NAME\n valueFrom:\n fieldRef:\n fieldPath: - spec.nodeName\n # CNI MTU Config variable\n - name: CNI_MTU\n - \ valueFrom:\n configMapKeyRef:\n name: - calico-config-windows\n key: veth_mtu\n # Prevents - the container from sleeping forever.\n - name: SLEEP\n value: - \"false\"\n - name: K8S_SERVICE_CIDR\n value: \"10.96.0.0/12\"\n - \ volumeMounts:\n - mountPath: /host/opt/cni/bin\n name: - cni-bin-dir\n - mountPath: /host/etc/cni/net.d\n name: - cni-net-dir\n - name: kubeadm-config\n mountPath: /etc/kubeadm-config/\n - \ securityContext:\n windowsOptions:\n hostProcess: - true\n runAsUserName: \"NT AUTHORITY\\\\system\"\n containers:\n - \ - name: calico-node-startup\n image: sigwindowstools/calico-node:v3.25.0-hostprocess\n - \ args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/node-service.ps1\"]\n - \ workingDir: \"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/\"\n imagePullPolicy: - Always\n volumeMounts:\n - name: calico-config-windows\n mountPath: - /etc/kube-calico-windows/\n env:\n - name: POD_NAME\n valueFrom:\n - \ fieldRef:\n apiVersion: v1\n fieldPath: - metadata.name\n - name: POD_NAMESPACE\n valueFrom:\n fieldRef:\n - \ apiVersion: v1\n fieldPath: metadata.namespace\n - - name: CNI_IPAM_TYPE\n value: \"calico-ipam\"\n - name: CALICO_NETWORKING_BACKEND\n - \ value: \"vxlan\"\n - name: KUBECONFIG\n value: \"C:/etc/cni/net.d/calico-kubeconfig\"\n - \ - name: VXLAN_VNI\n value: \"4096\"\n - name: calico-node-felix\n - \ image: sigwindowstools/calico-node:v3.25.0-hostprocess\n args: - [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/felix-service.ps1\"]\n imagePullPolicy: - Always\n workingDir: \"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/\"\n volumeMounts:\n - \ - name: calico-config-windows\n mountPath: /etc/kube-calico-windows/\n - \ - name: calico-static-rules\n mountPath: /calico/static-rules.json\n - \ subPath: static-rules.json\n env:\n - name: POD_NAME\n - \ valueFrom:\n fieldRef:\n apiVersion: v1\n fieldPath: - metadata.name\n - name: POD_NAMESPACE\n valueFrom:\n fieldRef:\n - \ apiVersion: v1\n fieldPath: metadata.namespace\n - - name: VXLAN_VNI\n value: \"4096\"\n - name: KUBECONFIG\n value: - \"C:/etc/cni/net.d/calico-kubeconfig\"\n volumes:\n - name: calico-config-windows\n - \ configMap:\n name: calico-config-windows\n - name: calico-static-rules\n - \ configMap:\n name: calico-static-rules\n # Used to install - CNI.\n - name: cni-bin-dir\n hostPath:\n path: /opt/cni/bin\n - \ - name: cni-net-dir\n hostPath:\n path: /etc/cni/net.d\n - \ - name: kubeadm-config\n configMap:\n name: kubeadm-config\n" -kind: ConfigMap -metadata: - annotations: - note: generated - labels: - type: generated - name: cni-${CLUSTER_NAME}-calico-windows - namespace: default ---- -apiVersion: v1 -data: - csi-proxy: | - apiVersion: apps/v1 - kind: DaemonSet - metadata: - labels: - k8s-app: csi-proxy - name: csi-proxy - namespace: kube-system - spec: - selector: - matchLabels: - k8s-app: csi-proxy - template: - metadata: - labels: - k8s-app: csi-proxy - spec: - nodeSelector: - "kubernetes.io/os": windows - securityContext: - windowsOptions: - hostProcess: true - runAsUserName: "NT AUTHORITY\\SYSTEM" - hostNetwork: true - containers: - - name: csi-proxy - image: ghcr.io/kubernetes-sigs/sig-windows/csi-proxy:v1.0.2 -kind: ConfigMap -metadata: - annotations: - note: generated - labels: - type: generated - name: csi-proxy-addon - namespace: default ---- -apiVersion: v1 -data: - containerd-windows-logger: | - apiVersion: apps/v1 - kind: DaemonSet - metadata: - labels: - k8s-app: containerd-logger - name: containerd-logger - namespace: kube-system - spec: - selector: - matchLabels: - k8s-app: containerd-logger - template: - metadata: - labels: - k8s-app: containerd-logger - spec: - securityContext: - windowsOptions: - hostProcess: true - runAsUserName: "NT AUTHORITY\\system" - hostNetwork: true - containers: - - image: ghcr.io/kubernetes-sigs/sig-windows/eventflow-logger:v0.1.0 - args: [ "config.json" ] - name: containerd-logger - imagePullPolicy: Always - volumeMounts: - - name: containerd-logger-config - mountPath: /config.json - subPath: config.json - nodeSelector: - kubernetes.io/os: windows - tolerations: - - key: CriticalAddonsOnly - operator: Exists - - operator: Exists - volumes: - - configMap: - name: containerd-logger-config - name: containerd-logger-config - updateStrategy: - type: RollingUpdate - --- - kind: ConfigMap - apiVersion: v1 - metadata: - name: containerd-logger-config - namespace: kube-system - data: - config.json: | - { - "inputs": [ - { - "type": "ETW", - "sessionNamePrefix": "containerd", - "cleanupOldSessions": true, - "reuseExistingSession": true, - "providers": [ - { - "providerName": "Microsoft.Virtualization.RunHCS", - "providerGuid": "0B52781F-B24D-5685-DDF6-69830ED40EC3", - "level": "Verbose" - }, - { - "providerName": "ContainerD", - "providerGuid": "2acb92c0-eb9b-571a-69cf-8f3410f383ad", - "level": "Verbose" - } - ] - } - ], - "filters": [ - { - "type": "drop", - "include": "ProviderName == Microsoft.Virtualization.RunHCS && name == Stats && hasnoproperty error" - }, - { - "type": "drop", - "include": "ProviderName == Microsoft.Virtualization.RunHCS && name == hcsshim::LayerID && hasnoproperty error" - }, - { - "type": "drop", - "include": "ProviderName == Microsoft.Virtualization.RunHCS && name == hcsshim::NameToGuid && hasnoproperty error" - }, - { - "type": "drop", - "include": "ProviderName == Microsoft.Virtualization.RunHCS && name == containerd.task.v2.Task.Stats && hasnoproperty error" - }, - { - "type": "drop", - "include": "ProviderName == Microsoft.Virtualization.RunHCS && name == containerd.task.v2.Task.State && hasnoproperty error" - }, - { - "type": "drop", - "include": "ProviderName == Microsoft.Virtualization.RunHCS && name == HcsGetProcessProperties && hasnoproperty error" - }, - { - "type": "drop", - "include": "ProviderName == Microsoft.Virtualization.RunHCS && name == HcsGetComputeSystemProperties && hasnoproperty error" - } - ], - "outputs": [ - { - "type": "StdOutput" - } - ], - "schemaVersion": "2016-08-11" - } -kind: ConfigMap -metadata: - annotations: - note: generated - labels: - type: generated - name: containerd-logger-${CLUSTER_NAME} - namespace: default ---- -apiVersion: addons.cluster.x-k8s.io/v1beta1 -kind: ClusterResourceSet -metadata: - name: metrics-server-${CLUSTER_NAME} - namespace: default -spec: - clusterSelector: - matchLabels: - metrics-server: enabled - resources: - - kind: ConfigMap - name: metrics-server-${CLUSTER_NAME} - strategy: ApplyOnce ---- -apiVersion: v1 -data: - metrics-server: | - apiVersion: v1 - kind: ServiceAccount - metadata: - labels: - k8s-app: metrics-server - name: metrics-server - namespace: kube-system - --- - apiVersion: rbac.authorization.k8s.io/v1 - kind: ClusterRole - metadata: - labels: - k8s-app: metrics-server - rbac.authorization.k8s.io/aggregate-to-admin: "true" - rbac.authorization.k8s.io/aggregate-to-edit: "true" - rbac.authorization.k8s.io/aggregate-to-view: "true" - name: system:aggregated-metrics-reader - rules: - - apiGroups: - - metrics.k8s.io - resources: - - pods - - nodes - verbs: - - get - - list - - watch - --- - apiVersion: rbac.authorization.k8s.io/v1 - kind: ClusterRole - metadata: - labels: - k8s-app: metrics-server - name: system:metrics-server - rules: - - apiGroups: - - "" - resources: - - nodes/metrics - verbs: - - get - - apiGroups: - - "" - resources: - - pods - - nodes - verbs: - - get - - list - - watch - --- - apiVersion: rbac.authorization.k8s.io/v1 - kind: RoleBinding - metadata: - labels: - k8s-app: metrics-server - name: metrics-server-auth-reader - namespace: kube-system - roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: extension-apiserver-authentication-reader - subjects: - - kind: ServiceAccount - name: metrics-server - namespace: kube-system - --- - apiVersion: rbac.authorization.k8s.io/v1 - kind: ClusterRoleBinding - metadata: - labels: - k8s-app: metrics-server - name: metrics-server:system:auth-delegator - roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: system:auth-delegator - subjects: - - kind: ServiceAccount - name: metrics-server - namespace: kube-system - --- - apiVersion: rbac.authorization.k8s.io/v1 - kind: ClusterRoleBinding - metadata: - labels: - k8s-app: metrics-server - name: system:metrics-server - roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: system:metrics-server - subjects: - - kind: ServiceAccount - name: metrics-server - namespace: kube-system - --- - apiVersion: v1 - kind: Service - metadata: - labels: - k8s-app: metrics-server - name: metrics-server - namespace: kube-system - spec: - ports: - - name: https - port: 443 - protocol: TCP - targetPort: https - selector: - k8s-app: metrics-server - --- - apiVersion: apps/v1 - kind: Deployment - metadata: - labels: - k8s-app: metrics-server - name: metrics-server - namespace: kube-system - spec: - selector: - matchLabels: - k8s-app: metrics-server - strategy: - rollingUpdate: - maxUnavailable: 0 - template: - metadata: - labels: - k8s-app: metrics-server - spec: - containers: - - args: - - --cert-dir=/tmp - - --secure-port=4443 - - --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname - - --kubelet-use-node-status-port - - --metric-resolution=15s - - --kubelet-insecure-tls - image: k8s.gcr.io/metrics-server/metrics-server:v0.6.2 - imagePullPolicy: IfNotPresent - livenessProbe: - failureThreshold: 3 - httpGet: - path: /livez - port: https - scheme: HTTPS - periodSeconds: 10 - name: metrics-server - ports: - - containerPort: 4443 - name: https - protocol: TCP - readinessProbe: - failureThreshold: 3 - httpGet: - path: /readyz - port: https - scheme: HTTPS - initialDelaySeconds: 20 - periodSeconds: 10 - resources: - requests: - cpu: 100m - memory: 200Mi - securityContext: - allowPrivilegeEscalation: false - readOnlyRootFilesystem: true - runAsNonRoot: true - runAsUser: 1000 - volumeMounts: - - mountPath: /tmp - name: tmp-dir - nodeSelector: - kubernetes.io/os: linux - priorityClassName: system-cluster-critical - serviceAccountName: metrics-server - tolerations: - - effect: NoSchedule - key: node-role.kubernetes.io/master - operator: Exists - - effect: NoSchedule - key: node-role.kubernetes.io/control-plane - operator: Exists - volumes: - - emptyDir: {} - name: tmp-dir - --- - apiVersion: apiregistration.k8s.io/v1 - kind: APIService - metadata: - labels: - k8s-app: metrics-server - name: v1beta1.metrics.k8s.io - spec: - group: metrics.k8s.io - groupPriorityMinimum: 100 - insecureSkipTLSVerify: true - service: - name: metrics-server - namespace: kube-system - version: v1beta1 - versionPriority: 100 -kind: ConfigMap -metadata: - annotations: - note: generated - labels: - type: generated - name: metrics-server-${CLUSTER_NAME} - namespace: default diff --git a/templates/test/ci/cluster-template-prow-ci-version.yaml b/templates/test/ci/cluster-template-prow-ci-version.yaml index e36abe4ee0e..94155eefc3a 100644 --- a/templates/test/ci/cluster-template-prow-ci-version.yaml +++ b/templates/test/ci/cluster-template-prow-ci-version.yaml @@ -42,8 +42,6 @@ spec: - name: control-plane-subnet role: control-plane - name: node-subnet - natGateway: - name: node-natgateway role: node vnet: name: ${AZURE_VNET_NAME:=${CLUSTER_NAME}-vnet} @@ -154,6 +152,7 @@ spec: $${SUDO} ctr -n k8s.io images tag $$IMAGE_REGISTRY_PREFIX/$$CI_CONTAINER-amd64:"$${CI_VERSION//+/_}" gcr.io/k8s-staging-ci-images/$$CI_CONTAINER:"$${CI_VERSION//+/_}" done fi + systemctl restart kubelet fi echo "* checking binary versions" echo "ctr version: " $(ctr version) @@ -207,7 +206,7 @@ spec: marketplace: offer: capi publisher: cncf-upstream - sku: ubuntu-1804-gen1 + sku: ubuntu-2204-gen1 version: latest osDisk: diskSizeGB: 128 @@ -253,7 +252,7 @@ spec: marketplace: offer: capi publisher: cncf-upstream - sku: ubuntu-1804-gen1 + sku: ubuntu-2204-gen1 version: latest osDisk: diskSizeGB: 128 @@ -339,6 +338,7 @@ spec: $${SUDO} ctr -n k8s.io images tag $$IMAGE_REGISTRY_PREFIX/$$CI_CONTAINER-amd64:"$${CI_VERSION//+/_}" gcr.io/k8s-staging-ci-images/$$CI_CONTAINER:"$${CI_VERSION//+/_}" done fi + systemctl restart kubelet fi echo "* checking binary versions" echo "ctr version: " $(ctr version) @@ -502,7 +502,7 @@ spec: kubeletExtraArgs: azure-container-registry-config: c:/k/azure.json cloud-provider: external - feature-gates: WindowsHostProcessContainers=true + feature-gates: ${NODE_FEATURE_GATES:-""} v: "2" windows-priorityclass: ABOVE_NORMAL_PRIORITY_CLASS name: '{{ ds.meta_data["local_hostname"] }}' @@ -710,7 +710,7 @@ data: for rescheduling.\n - key: CriticalAddonsOnly\n operator: Exists\n \ - effect: NoExecute\n operator: Exists\n initContainers:\n # This container installs the CNI binaries\n # and CNI network config file - on each node.\n - name: install-cni\n image: sigwindowstools/calico-install:v3.25.0-hostprocess\n + on each node.\n - name: install-cni\n image: sigwindowstools/calico-install:v3.25.1-hostprocess\n \ args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/install.ps1\"]\n \ imagePullPolicy: Always\n env:\n # Name of the CNI config file to create.\n - name: CNI_CONF_NAME\n value: @@ -729,7 +729,7 @@ data: cni-net-dir\n - name: kubeadm-config\n mountPath: /etc/kubeadm-config/\n \ securityContext:\n windowsOptions:\n hostProcess: true\n runAsUserName: \"NT AUTHORITY\\\\system\"\n containers:\n - \ - name: calico-node-startup\n image: sigwindowstools/calico-node:v3.25.0-hostprocess\n + \ - name: calico-node-startup\n image: sigwindowstools/calico-node:v3.25.1-hostprocess\n \ args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/node-service.ps1\"]\n \ workingDir: \"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/\"\n imagePullPolicy: Always\n volumeMounts:\n - name: calico-config-windows\n mountPath: @@ -740,7 +740,7 @@ data: name: CNI_IPAM_TYPE\n value: \"calico-ipam\"\n - name: CALICO_NETWORKING_BACKEND\n \ value: \"vxlan\"\n - name: KUBECONFIG\n value: \"C:/etc/cni/net.d/calico-kubeconfig\"\n \ - name: VXLAN_VNI\n value: \"4096\"\n - name: calico-node-felix\n - \ image: sigwindowstools/calico-node:v3.25.0-hostprocess\n args: + \ image: sigwindowstools/calico-node:v3.25.1-hostprocess\n args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/felix-service.ps1\"]\n imagePullPolicy: Always\n workingDir: \"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/\"\n volumeMounts:\n \ - name: calico-config-windows\n mountPath: /etc/kube-calico-windows/\n @@ -755,7 +755,30 @@ data: \ configMap:\n name: calico-static-rules\n # Used to install CNI.\n - name: cni-bin-dir\n hostPath:\n path: /opt/cni/bin\n \ - name: cni-net-dir\n hostPath:\n path: /etc/cni/net.d\n - \ - name: kubeadm-config\n configMap:\n name: kubeadm-config\n" + \ - name: kubeadm-config\n configMap:\n name: kubeadm-config\n---\napiVersion: + apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n name: ipamconfigs.crd.projectcalico.org\nspec:\n + \ group: crd.projectcalico.org\n names:\n kind: IPAMConfig\n listKind: + IPAMConfigList\n plural: ipamconfigs\n singular: ipamconfig\n preserveUnknownFields: + false\n scope: Cluster\n versions:\n - name: v1\n schema:\n openAPIV3Schema:\n + \ properties:\n apiVersion:\n description: 'APIVersion + defines the versioned schema of this representation\n of an object. + Servers should convert recognized schemas to the latest\n internal + value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'\n + \ type: string\n kind:\n description: 'Kind is a + string value representing the REST resource this\n object represents. + Servers may infer this from the endpoint the client\n submits requests + to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'\n + \ type: string\n metadata:\n type: object\n spec:\n + \ description: IPAMConfigSpec contains the specification for an IPAMConfig\n + \ resource.\n properties:\n autoAllocateBlocks:\n + \ type: boolean\n maxBlocksPerHost:\n description: + MaxBlocksPerHost, if non-zero, is the max number of blocks\n that + can be affine to each host.\n maximum: 2147483647\n minimum: + 0\n type: integer\n strictAffinity:\n type: + boolean\n required:\n - autoAllocateBlocks\n - + strictAffinity\n type: object\n type: object\n served: true\n + \ storage: true\nstatus:\n acceptedNames:\n kind: \"\"\n plural: \"\"\n + \ conditions: []\n storedVersions: []\n" kind: ConfigMap metadata: annotations: @@ -1080,7 +1103,7 @@ data: - --kubelet-use-node-status-port - --metric-resolution=15s - --kubelet-insecure-tls - image: k8s.gcr.io/metrics-server/metrics-server:v0.6.2 + image: registry.k8s.io/metrics-server/metrics-server:v0.6.3 imagePullPolicy: IfNotPresent livenessProbe: failureThreshold: 3 diff --git a/templates/test/ci/cluster-template-prow-clusterclass-ci-default.yaml b/templates/test/ci/cluster-template-prow-clusterclass-ci-default.yaml index b127b0b40f4..7509d09824b 100644 --- a/templates/test/ci/cluster-template-prow-clusterclass-ci-default.yaml +++ b/templates/test/ci/cluster-template-prow-clusterclass-ci-default.yaml @@ -543,7 +543,6 @@ spec: kubeletExtraArgs: azure-container-registry-config: c:/k/azure.json cloud-provider: external - feature-gates: WindowsHostProcessContainers=true v: "2" windows-priorityclass: ABOVE_NORMAL_PRIORITY_CLASS name: '{{ ds.meta_data["local_hostname"] }}' diff --git a/templates/test/ci/cluster-template-prow-dual-stack.yaml b/templates/test/ci/cluster-template-prow-dual-stack.yaml index 809444c80a3..cd735e156ed 100644 --- a/templates/test/ci/cluster-template-prow-dual-stack.yaml +++ b/templates/test/ci/cluster-template-prow-dual-stack.yaml @@ -252,3 +252,75 @@ spec: - mv /etc/resolv.conf /etc/resolv.conf.OLD && ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf - systemctl restart systemd-resolved +--- +apiVersion: cluster.x-k8s.io/v1beta1 +kind: MachinePool +metadata: + name: ${CLUSTER_NAME}-mp-0 + namespace: default +spec: + clusterName: ${CLUSTER_NAME} + replicas: ${WORKER_MACHINE_COUNT} + template: + spec: + bootstrap: + configRef: + apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 + kind: KubeadmConfig + name: ${CLUSTER_NAME}-mp-0 + clusterName: ${CLUSTER_NAME} + infrastructureRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + kind: AzureMachinePool + name: ${CLUSTER_NAME}-mp-0 + version: ${KUBERNETES_VERSION} +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +kind: AzureMachinePool +metadata: + name: ${CLUSTER_NAME}-mp-0 + namespace: default +spec: + location: ${AZURE_LOCATION} + strategy: + rollingUpdate: + deletePolicy: Oldest + maxSurge: 25% + maxUnavailable: 1 + type: RollingUpdate + template: + osDisk: + diskSizeGB: 30 + managedDisk: + storageAccountType: Premium_LRS + osType: Linux + sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""} + vmSize: ${AZURE_NODE_MACHINE_TYPE} +--- +apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 +kind: KubeadmConfig +metadata: + name: ${CLUSTER_NAME}-mp-0 + namespace: default +spec: + files: + - contentFrom: + secret: + key: worker-node-azure.json + name: ${CLUSTER_NAME}-md-0-azure-json + owner: root:root + path: /etc/kubernetes/azure.json + permissions: "0644" + joinConfiguration: + nodeRegistration: + kubeletExtraArgs: + azure-container-registry-config: /etc/kubernetes/azure.json + cloud-config: /etc/kubernetes/azure.json + cloud-provider: azure + cluster-dns: '[fd00::10]' + name: '{{ ds.meta_data["local_hostname"] }}' + postKubeadmCommands: + - echo "DNSStubListener=no" >> /etc/systemd/resolved.conf + - mv /etc/resolv.conf /etc/resolv.conf.OLD && ln -s /run/systemd/resolve/resolv.conf + /etc/resolv.conf + - systemctl restart systemd-resolved diff --git a/templates/test/ci/cluster-template-prow-flatcar.yaml b/templates/test/ci/cluster-template-prow-flatcar.yaml index d09ea8bec17..38a0c5ddf31 100644 --- a/templates/test/ci/cluster-template-prow-flatcar.yaml +++ b/templates/test/ci/cluster-template-prow-flatcar.yaml @@ -37,8 +37,6 @@ spec: - name: control-plane-subnet role: control-plane - name: node-subnet - natGateway: - name: node-natgateway role: node vnet: name: ${AZURE_VNET_NAME:=${CLUSTER_NAME}-vnet} diff --git a/templates/test/ci/cluster-template-prow-intree-cloud-provider-machine-pool.yaml b/templates/test/ci/cluster-template-prow-intree-cloud-provider-machine-pool.yaml index cee8d196b0b..1edd85bbfe2 100644 --- a/templates/test/ci/cluster-template-prow-intree-cloud-provider-machine-pool.yaml +++ b/templates/test/ci/cluster-template-prow-intree-cloud-provider-machine-pool.yaml @@ -42,8 +42,6 @@ spec: - name: control-plane-subnet role: control-plane - name: node-subnet - natGateway: - name: node-natgateway role: node vnet: name: ${AZURE_VNET_NAME:=${CLUSTER_NAME}-vnet} @@ -62,7 +60,6 @@ spec: extraArgs: cloud-config: /etc/kubernetes/azure.json cloud-provider: azure - feature-gates: ${K8S_FEATURE_GATES:-""} extraVolumes: - hostPath: /etc/kubernetes/azure.json mountPath: /etc/kubernetes/azure.json @@ -312,7 +309,6 @@ spec: azure-container-registry-config: c:/k/azure.json cloud-config: c:/k/azure.json cloud-provider: azure - feature-gates: WindowsHostProcessContainers=true pod-infra-container-image: mcr.microsoft.com/oss/kubernetes/pause:3.4.1 name: '{{ ds.meta_data["local_hostname"] }}' postKubeadmCommands: @@ -476,7 +472,7 @@ data: for rescheduling.\n - key: CriticalAddonsOnly\n operator: Exists\n \ - effect: NoExecute\n operator: Exists\n initContainers:\n # This container installs the CNI binaries\n # and CNI network config file - on each node.\n - name: install-cni\n image: sigwindowstools/calico-install:v3.25.0-hostprocess\n + on each node.\n - name: install-cni\n image: sigwindowstools/calico-install:v3.25.1-hostprocess\n \ args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/install.ps1\"]\n \ imagePullPolicy: Always\n env:\n # Name of the CNI config file to create.\n - name: CNI_CONF_NAME\n value: @@ -495,7 +491,7 @@ data: cni-net-dir\n - name: kubeadm-config\n mountPath: /etc/kubeadm-config/\n \ securityContext:\n windowsOptions:\n hostProcess: true\n runAsUserName: \"NT AUTHORITY\\\\system\"\n containers:\n - \ - name: calico-node-startup\n image: sigwindowstools/calico-node:v3.25.0-hostprocess\n + \ - name: calico-node-startup\n image: sigwindowstools/calico-node:v3.25.1-hostprocess\n \ args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/node-service.ps1\"]\n \ workingDir: \"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/\"\n imagePullPolicy: Always\n volumeMounts:\n - name: calico-config-windows\n mountPath: @@ -506,7 +502,7 @@ data: name: CNI_IPAM_TYPE\n value: \"calico-ipam\"\n - name: CALICO_NETWORKING_BACKEND\n \ value: \"vxlan\"\n - name: KUBECONFIG\n value: \"C:/etc/cni/net.d/calico-kubeconfig\"\n \ - name: VXLAN_VNI\n value: \"4096\"\n - name: calico-node-felix\n - \ image: sigwindowstools/calico-node:v3.25.0-hostprocess\n args: + \ image: sigwindowstools/calico-node:v3.25.1-hostprocess\n args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/felix-service.ps1\"]\n imagePullPolicy: Always\n workingDir: \"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/\"\n volumeMounts:\n \ - name: calico-config-windows\n mountPath: /etc/kube-calico-windows/\n @@ -521,7 +517,30 @@ data: \ configMap:\n name: calico-static-rules\n # Used to install CNI.\n - name: cni-bin-dir\n hostPath:\n path: /opt/cni/bin\n \ - name: cni-net-dir\n hostPath:\n path: /etc/cni/net.d\n - \ - name: kubeadm-config\n configMap:\n name: kubeadm-config\n" + \ - name: kubeadm-config\n configMap:\n name: kubeadm-config\n---\napiVersion: + apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n name: ipamconfigs.crd.projectcalico.org\nspec:\n + \ group: crd.projectcalico.org\n names:\n kind: IPAMConfig\n listKind: + IPAMConfigList\n plural: ipamconfigs\n singular: ipamconfig\n preserveUnknownFields: + false\n scope: Cluster\n versions:\n - name: v1\n schema:\n openAPIV3Schema:\n + \ properties:\n apiVersion:\n description: 'APIVersion + defines the versioned schema of this representation\n of an object. + Servers should convert recognized schemas to the latest\n internal + value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'\n + \ type: string\n kind:\n description: 'Kind is a + string value representing the REST resource this\n object represents. + Servers may infer this from the endpoint the client\n submits requests + to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'\n + \ type: string\n metadata:\n type: object\n spec:\n + \ description: IPAMConfigSpec contains the specification for an IPAMConfig\n + \ resource.\n properties:\n autoAllocateBlocks:\n + \ type: boolean\n maxBlocksPerHost:\n description: + MaxBlocksPerHost, if non-zero, is the max number of blocks\n that + can be affine to each host.\n maximum: 2147483647\n minimum: + 0\n type: integer\n strictAffinity:\n type: + boolean\n required:\n - autoAllocateBlocks\n - + strictAffinity\n type: object\n type: object\n served: true\n + \ storage: true\nstatus:\n acceptedNames:\n kind: \"\"\n plural: \"\"\n + \ conditions: []\n storedVersions: []\n" kind: ConfigMap metadata: annotations: diff --git a/templates/test/ci/cluster-template-prow-intree-cloud-provider.yaml b/templates/test/ci/cluster-template-prow-intree-cloud-provider.yaml index 93d07bc5c46..6cdd549068c 100644 --- a/templates/test/ci/cluster-template-prow-intree-cloud-provider.yaml +++ b/templates/test/ci/cluster-template-prow-intree-cloud-provider.yaml @@ -41,8 +41,6 @@ spec: - name: control-plane-subnet role: control-plane - name: node-subnet - natGateway: - name: node-natgateway role: node vnet: name: ${AZURE_VNET_NAME:=${CLUSTER_NAME}-vnet} @@ -339,7 +337,7 @@ spec: azure-container-registry-config: c:/k/azure.json cloud-config: c:/k/azure.json cloud-provider: azure - feature-gates: WindowsHostProcessContainers=true + feature-gates: ${NODE_FEATURE_GATES:-""} v: "2" windows-priorityclass: ABOVE_NORMAL_PRIORITY_CLASS name: '{{ ds.meta_data["local_hostname"] }}' @@ -538,7 +536,7 @@ data: for rescheduling.\n - key: CriticalAddonsOnly\n operator: Exists\n \ - effect: NoExecute\n operator: Exists\n initContainers:\n # This container installs the CNI binaries\n # and CNI network config file - on each node.\n - name: install-cni\n image: sigwindowstools/calico-install:v3.25.0-hostprocess\n + on each node.\n - name: install-cni\n image: sigwindowstools/calico-install:v3.25.1-hostprocess\n \ args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/install.ps1\"]\n \ imagePullPolicy: Always\n env:\n # Name of the CNI config file to create.\n - name: CNI_CONF_NAME\n value: @@ -557,7 +555,7 @@ data: cni-net-dir\n - name: kubeadm-config\n mountPath: /etc/kubeadm-config/\n \ securityContext:\n windowsOptions:\n hostProcess: true\n runAsUserName: \"NT AUTHORITY\\\\system\"\n containers:\n - \ - name: calico-node-startup\n image: sigwindowstools/calico-node:v3.25.0-hostprocess\n + \ - name: calico-node-startup\n image: sigwindowstools/calico-node:v3.25.1-hostprocess\n \ args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/node-service.ps1\"]\n \ workingDir: \"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/\"\n imagePullPolicy: Always\n volumeMounts:\n - name: calico-config-windows\n mountPath: @@ -568,7 +566,7 @@ data: name: CNI_IPAM_TYPE\n value: \"calico-ipam\"\n - name: CALICO_NETWORKING_BACKEND\n \ value: \"vxlan\"\n - name: KUBECONFIG\n value: \"C:/etc/cni/net.d/calico-kubeconfig\"\n \ - name: VXLAN_VNI\n value: \"4096\"\n - name: calico-node-felix\n - \ image: sigwindowstools/calico-node:v3.25.0-hostprocess\n args: + \ image: sigwindowstools/calico-node:v3.25.1-hostprocess\n args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/felix-service.ps1\"]\n imagePullPolicy: Always\n workingDir: \"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/\"\n volumeMounts:\n \ - name: calico-config-windows\n mountPath: /etc/kube-calico-windows/\n @@ -583,7 +581,30 @@ data: \ configMap:\n name: calico-static-rules\n # Used to install CNI.\n - name: cni-bin-dir\n hostPath:\n path: /opt/cni/bin\n \ - name: cni-net-dir\n hostPath:\n path: /etc/cni/net.d\n - \ - name: kubeadm-config\n configMap:\n name: kubeadm-config\n" + \ - name: kubeadm-config\n configMap:\n name: kubeadm-config\n---\napiVersion: + apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n name: ipamconfigs.crd.projectcalico.org\nspec:\n + \ group: crd.projectcalico.org\n names:\n kind: IPAMConfig\n listKind: + IPAMConfigList\n plural: ipamconfigs\n singular: ipamconfig\n preserveUnknownFields: + false\n scope: Cluster\n versions:\n - name: v1\n schema:\n openAPIV3Schema:\n + \ properties:\n apiVersion:\n description: 'APIVersion + defines the versioned schema of this representation\n of an object. + Servers should convert recognized schemas to the latest\n internal + value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'\n + \ type: string\n kind:\n description: 'Kind is a + string value representing the REST resource this\n object represents. + Servers may infer this from the endpoint the client\n submits requests + to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'\n + \ type: string\n metadata:\n type: object\n spec:\n + \ description: IPAMConfigSpec contains the specification for an IPAMConfig\n + \ resource.\n properties:\n autoAllocateBlocks:\n + \ type: boolean\n maxBlocksPerHost:\n description: + MaxBlocksPerHost, if non-zero, is the max number of blocks\n that + can be affine to each host.\n maximum: 2147483647\n minimum: + 0\n type: integer\n strictAffinity:\n type: + boolean\n required:\n - autoAllocateBlocks\n - + strictAffinity\n type: object\n type: object\n served: true\n + \ storage: true\nstatus:\n acceptedNames:\n kind: \"\"\n plural: \"\"\n + \ conditions: []\n storedVersions: []\n" kind: ConfigMap metadata: annotations: diff --git a/templates/test/ci/cluster-template-prow-ipv6.yaml b/templates/test/ci/cluster-template-prow-ipv6.yaml index b76f78a6712..378c835f9b8 100644 --- a/templates/test/ci/cluster-template-prow-ipv6.yaml +++ b/templates/test/ci/cluster-template-prow-ipv6.yaml @@ -66,29 +66,17 @@ spec: apiServer: extraArgs: bind-address: '::' - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure - extraVolumes: - - hostPath: /etc/kubernetes/azure.json - mountPath: /etc/kubernetes/azure.json - name: cloud-config - readOnly: true + cloud-provider: external timeoutForControlPlane: 20m controllerManager: extraArgs: allocate-node-cidrs: "true" bind-address: '::' - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure + cloud-provider: external cluster-cidr: 2001:1234:5678:9a40::/58 cluster-name: ${CLUSTER_NAME} configure-cloud-routes: "true" v: "4" - extraVolumes: - - hostPath: /etc/kubernetes/azure.json - mountPath: /etc/kubernetes/azure.json - name: cloud-config - readOnly: true etcd: local: dataDir: /var/lib/etcddisk/etcd @@ -129,10 +117,8 @@ spec: nodeRegistration: kubeletExtraArgs: azure-container-registry-config: /etc/kubernetes/azure.json - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure + cloud-provider: external cluster-dns: fd00::10 - node-ip: '::' name: '{{ ds.meta_data["local_hostname"] }}' joinConfiguration: controlPlane: @@ -142,10 +128,8 @@ spec: nodeRegistration: kubeletExtraArgs: azure-container-registry-config: /etc/kubernetes/azure.json - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure + cloud-provider: external cluster-dns: fd00::10 - node-ip: '::' name: '{{ ds.meta_data["local_hostname"] }}' mounts: - - LABEL=etcd_disk @@ -270,13 +254,93 @@ spec: nodeRegistration: kubeletExtraArgs: azure-container-registry-config: /etc/kubernetes/azure.json - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure + cloud-provider: external cluster-dns: '[fd00::10]' - node-ip: '::' name: '{{ ds.meta_data["local_hostname"] }}' postKubeadmCommands: - echo "DNSStubListener=no" >> /etc/systemd/resolved.conf - mv /etc/resolv.conf /etc/resolv.conf.OLD && ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf - systemctl restart systemd-resolved +--- +apiVersion: cluster.x-k8s.io/v1beta1 +kind: MachinePool +metadata: + name: ${CLUSTER_NAME}-mp-0 + namespace: default +spec: + clusterName: ${CLUSTER_NAME} + replicas: ${WORKER_MACHINE_COUNT} + template: + spec: + bootstrap: + configRef: + apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 + kind: KubeadmConfig + name: ${CLUSTER_NAME}-mp-0 + clusterName: ${CLUSTER_NAME} + infrastructureRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + kind: AzureMachinePool + name: ${CLUSTER_NAME}-mp-0 + version: ${KUBERNETES_VERSION} +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +kind: AzureMachinePool +metadata: + name: ${CLUSTER_NAME}-mp-0 + namespace: default +spec: + location: ${AZURE_LOCATION} + strategy: + rollingUpdate: + deletePolicy: Oldest + maxSurge: 25% + maxUnavailable: 1 + type: RollingUpdate + template: + osDisk: + diskSizeGB: 30 + managedDisk: + storageAccountType: Premium_LRS + osType: Linux + sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""} + vmSize: ${AZURE_NODE_MACHINE_TYPE} +--- +apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 +kind: KubeadmConfig +metadata: + name: ${CLUSTER_NAME}-mp-0 + namespace: default +spec: + clusterConfiguration: + apiServer: + extraArgs: + bind-address: '::' + controllerManager: + extraArgs: + bind-address: '::' + scheduler: + extraArgs: + bind-address: '::' + files: + - contentFrom: + secret: + key: worker-node-azure.json + name: ${CLUSTER_NAME}-md-0-azure-json + owner: root:root + path: /etc/kubernetes/azure.json + permissions: "0644" + joinConfiguration: + nodeRegistration: + kubeletExtraArgs: + azure-container-registry-config: /etc/kubernetes/azure.json + cloud-config: /etc/kubernetes/azure.json + cloud-provider: azure + cluster-dns: '[fd00::10]' + name: '{{ ds.meta_data["local_hostname"] }}' + postKubeadmCommands: + - echo "DNSStubListener=no" >> /etc/systemd/resolved.conf + - mv /etc/resolv.conf /etc/resolv.conf.OLD && ln -s /run/systemd/resolve/resolv.conf + /etc/resolv.conf + - systemctl restart systemd-resolved diff --git a/templates/test/ci/cluster-template-prow-machine-pool-ci-version.yaml b/templates/test/ci/cluster-template-prow-machine-pool-ci-version.yaml index 2f6f1a42b54..56bec495e6f 100644 --- a/templates/test/ci/cluster-template-prow-machine-pool-ci-version.yaml +++ b/templates/test/ci/cluster-template-prow-machine-pool-ci-version.yaml @@ -42,8 +42,6 @@ spec: - name: control-plane-subnet role: control-plane - name: node-subnet - natGateway: - name: node-natgateway role: node vnet: name: ${AZURE_VNET_NAME:=${CLUSTER_NAME}-vnet} @@ -61,7 +59,6 @@ spec: apiServer: extraArgs: cloud-provider: external - feature-gates: ${K8S_FEATURE_GATES:-""} timeoutForControlPlane: 20m controllerManager: extraArgs: @@ -153,6 +150,7 @@ spec: $${SUDO} ctr -n k8s.io images tag $$IMAGE_REGISTRY_PREFIX/$$CI_CONTAINER-amd64:"$${CI_VERSION//+/_}" gcr.io/k8s-staging-ci-images/$$CI_CONTAINER:"$${CI_VERSION//+/_}" done fi + systemctl restart kubelet fi echo "* checking binary versions" echo "ctr version: " $(ctr version) @@ -206,7 +204,7 @@ spec: marketplace: offer: capi publisher: cncf-upstream - sku: ubuntu-1804-gen1 + sku: ubuntu-2204-gen1 version: latest osDisk: diskSizeGB: 128 @@ -254,7 +252,7 @@ spec: marketplace: offer: capi publisher: cncf-upstream - sku: ubuntu-1804-gen1 + sku: ubuntu-2204-gen1 version: latest osDisk: diskSizeGB: 30 @@ -334,6 +332,7 @@ spec: $${SUDO} ctr -n k8s.io images tag $$IMAGE_REGISTRY_PREFIX/$$CI_CONTAINER-amd64:"$${CI_VERSION//+/_}" gcr.io/k8s-staging-ci-images/$$CI_CONTAINER:"$${CI_VERSION//+/_}" done fi + systemctl restart kubelet fi echo "* checking binary versions" echo "ctr version: " $(ctr version) @@ -473,7 +472,6 @@ spec: kubeletExtraArgs: azure-container-registry-config: c:/k/azure.json cloud-provider: external - feature-gates: WindowsHostProcessContainers=true pod-infra-container-image: mcr.microsoft.com/oss/kubernetes/pause:3.9 name: '{{ ds.meta_data["local_hostname"] }}' postKubeadmCommands: @@ -646,7 +644,7 @@ data: for rescheduling.\n - key: CriticalAddonsOnly\n operator: Exists\n \ - effect: NoExecute\n operator: Exists\n initContainers:\n # This container installs the CNI binaries\n # and CNI network config file - on each node.\n - name: install-cni\n image: sigwindowstools/calico-install:v3.25.0-hostprocess\n + on each node.\n - name: install-cni\n image: sigwindowstools/calico-install:v3.25.1-hostprocess\n \ args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/install.ps1\"]\n \ imagePullPolicy: Always\n env:\n # Name of the CNI config file to create.\n - name: CNI_CONF_NAME\n value: @@ -665,7 +663,7 @@ data: cni-net-dir\n - name: kubeadm-config\n mountPath: /etc/kubeadm-config/\n \ securityContext:\n windowsOptions:\n hostProcess: true\n runAsUserName: \"NT AUTHORITY\\\\system\"\n containers:\n - \ - name: calico-node-startup\n image: sigwindowstools/calico-node:v3.25.0-hostprocess\n + \ - name: calico-node-startup\n image: sigwindowstools/calico-node:v3.25.1-hostprocess\n \ args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/node-service.ps1\"]\n \ workingDir: \"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/\"\n imagePullPolicy: Always\n volumeMounts:\n - name: calico-config-windows\n mountPath: @@ -676,7 +674,7 @@ data: name: CNI_IPAM_TYPE\n value: \"calico-ipam\"\n - name: CALICO_NETWORKING_BACKEND\n \ value: \"vxlan\"\n - name: KUBECONFIG\n value: \"C:/etc/cni/net.d/calico-kubeconfig\"\n \ - name: VXLAN_VNI\n value: \"4096\"\n - name: calico-node-felix\n - \ image: sigwindowstools/calico-node:v3.25.0-hostprocess\n args: + \ image: sigwindowstools/calico-node:v3.25.1-hostprocess\n args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/felix-service.ps1\"]\n imagePullPolicy: Always\n workingDir: \"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/\"\n volumeMounts:\n \ - name: calico-config-windows\n mountPath: /etc/kube-calico-windows/\n @@ -691,7 +689,30 @@ data: \ configMap:\n name: calico-static-rules\n # Used to install CNI.\n - name: cni-bin-dir\n hostPath:\n path: /opt/cni/bin\n \ - name: cni-net-dir\n hostPath:\n path: /etc/cni/net.d\n - \ - name: kubeadm-config\n configMap:\n name: kubeadm-config\n" + \ - name: kubeadm-config\n configMap:\n name: kubeadm-config\n---\napiVersion: + apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n name: ipamconfigs.crd.projectcalico.org\nspec:\n + \ group: crd.projectcalico.org\n names:\n kind: IPAMConfig\n listKind: + IPAMConfigList\n plural: ipamconfigs\n singular: ipamconfig\n preserveUnknownFields: + false\n scope: Cluster\n versions:\n - name: v1\n schema:\n openAPIV3Schema:\n + \ properties:\n apiVersion:\n description: 'APIVersion + defines the versioned schema of this representation\n of an object. + Servers should convert recognized schemas to the latest\n internal + value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'\n + \ type: string\n kind:\n description: 'Kind is a + string value representing the REST resource this\n object represents. + Servers may infer this from the endpoint the client\n submits requests + to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'\n + \ type: string\n metadata:\n type: object\n spec:\n + \ description: IPAMConfigSpec contains the specification for an IPAMConfig\n + \ resource.\n properties:\n autoAllocateBlocks:\n + \ type: boolean\n maxBlocksPerHost:\n description: + MaxBlocksPerHost, if non-zero, is the max number of blocks\n that + can be affine to each host.\n maximum: 2147483647\n minimum: + 0\n type: integer\n strictAffinity:\n type: + boolean\n required:\n - autoAllocateBlocks\n - + strictAffinity\n type: object\n type: object\n served: true\n + \ storage: true\nstatus:\n acceptedNames:\n kind: \"\"\n plural: \"\"\n + \ conditions: []\n storedVersions: []\n" kind: ConfigMap metadata: annotations: diff --git a/templates/test/ci/cluster-template-prow-machine-pool-flex.yaml b/templates/test/ci/cluster-template-prow-machine-pool-flex.yaml index 3a87480d421..57c7262565d 100644 --- a/templates/test/ci/cluster-template-prow-machine-pool-flex.yaml +++ b/templates/test/ci/cluster-template-prow-machine-pool-flex.yaml @@ -42,8 +42,6 @@ spec: - name: control-plane-subnet role: control-plane - name: node-subnet - natGateway: - name: node-natgateway role: node vnet: name: ${AZURE_VNET_NAME:=${CLUSTER_NAME}-vnet} @@ -61,7 +59,6 @@ spec: apiServer: extraArgs: cloud-provider: external - feature-gates: ${K8S_FEATURE_GATES:-""} timeoutForControlPlane: 20m controllerManager: extraArgs: @@ -302,7 +299,6 @@ spec: kubeletExtraArgs: azure-container-registry-config: c:/k/azure.json cloud-provider: external - feature-gates: WindowsHostProcessContainers=true pod-infra-container-image: mcr.microsoft.com/oss/kubernetes/pause:3.9 name: '{{ ds.meta_data["local_hostname"] }}' postKubeadmCommands: @@ -466,7 +462,7 @@ data: for rescheduling.\n - key: CriticalAddonsOnly\n operator: Exists\n \ - effect: NoExecute\n operator: Exists\n initContainers:\n # This container installs the CNI binaries\n # and CNI network config file - on each node.\n - name: install-cni\n image: sigwindowstools/calico-install:v3.25.0-hostprocess\n + on each node.\n - name: install-cni\n image: sigwindowstools/calico-install:v3.25.1-hostprocess\n \ args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/install.ps1\"]\n \ imagePullPolicy: Always\n env:\n # Name of the CNI config file to create.\n - name: CNI_CONF_NAME\n value: @@ -485,7 +481,7 @@ data: cni-net-dir\n - name: kubeadm-config\n mountPath: /etc/kubeadm-config/\n \ securityContext:\n windowsOptions:\n hostProcess: true\n runAsUserName: \"NT AUTHORITY\\\\system\"\n containers:\n - \ - name: calico-node-startup\n image: sigwindowstools/calico-node:v3.25.0-hostprocess\n + \ - name: calico-node-startup\n image: sigwindowstools/calico-node:v3.25.1-hostprocess\n \ args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/node-service.ps1\"]\n \ workingDir: \"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/\"\n imagePullPolicy: Always\n volumeMounts:\n - name: calico-config-windows\n mountPath: @@ -496,7 +492,7 @@ data: name: CNI_IPAM_TYPE\n value: \"calico-ipam\"\n - name: CALICO_NETWORKING_BACKEND\n \ value: \"vxlan\"\n - name: KUBECONFIG\n value: \"C:/etc/cni/net.d/calico-kubeconfig\"\n \ - name: VXLAN_VNI\n value: \"4096\"\n - name: calico-node-felix\n - \ image: sigwindowstools/calico-node:v3.25.0-hostprocess\n args: + \ image: sigwindowstools/calico-node:v3.25.1-hostprocess\n args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/felix-service.ps1\"]\n imagePullPolicy: Always\n workingDir: \"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/\"\n volumeMounts:\n \ - name: calico-config-windows\n mountPath: /etc/kube-calico-windows/\n @@ -511,7 +507,30 @@ data: \ configMap:\n name: calico-static-rules\n # Used to install CNI.\n - name: cni-bin-dir\n hostPath:\n path: /opt/cni/bin\n \ - name: cni-net-dir\n hostPath:\n path: /etc/cni/net.d\n - \ - name: kubeadm-config\n configMap:\n name: kubeadm-config\n" + \ - name: kubeadm-config\n configMap:\n name: kubeadm-config\n---\napiVersion: + apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n name: ipamconfigs.crd.projectcalico.org\nspec:\n + \ group: crd.projectcalico.org\n names:\n kind: IPAMConfig\n listKind: + IPAMConfigList\n plural: ipamconfigs\n singular: ipamconfig\n preserveUnknownFields: + false\n scope: Cluster\n versions:\n - name: v1\n schema:\n openAPIV3Schema:\n + \ properties:\n apiVersion:\n description: 'APIVersion + defines the versioned schema of this representation\n of an object. + Servers should convert recognized schemas to the latest\n internal + value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'\n + \ type: string\n kind:\n description: 'Kind is a + string value representing the REST resource this\n object represents. + Servers may infer this from the endpoint the client\n submits requests + to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'\n + \ type: string\n metadata:\n type: object\n spec:\n + \ description: IPAMConfigSpec contains the specification for an IPAMConfig\n + \ resource.\n properties:\n autoAllocateBlocks:\n + \ type: boolean\n maxBlocksPerHost:\n description: + MaxBlocksPerHost, if non-zero, is the max number of blocks\n that + can be affine to each host.\n maximum: 2147483647\n minimum: + 0\n type: integer\n strictAffinity:\n type: + boolean\n required:\n - autoAllocateBlocks\n - + strictAffinity\n type: object\n type: object\n served: true\n + \ storage: true\nstatus:\n acceptedNames:\n kind: \"\"\n plural: \"\"\n + \ conditions: []\n storedVersions: []\n" kind: ConfigMap metadata: annotations: diff --git a/templates/test/ci/cluster-template-prow-machine-pool.yaml b/templates/test/ci/cluster-template-prow-machine-pool.yaml index 73a7907ce5f..9d4567de76b 100644 --- a/templates/test/ci/cluster-template-prow-machine-pool.yaml +++ b/templates/test/ci/cluster-template-prow-machine-pool.yaml @@ -42,8 +42,6 @@ spec: - name: control-plane-subnet role: control-plane - name: node-subnet - natGateway: - name: node-natgateway role: node vnet: name: ${AZURE_VNET_NAME:=${CLUSTER_NAME}-vnet} @@ -61,7 +59,6 @@ spec: apiServer: extraArgs: cloud-provider: external - feature-gates: ${K8S_FEATURE_GATES:-""} timeoutForControlPlane: 20m controllerManager: extraArgs: @@ -296,7 +293,6 @@ spec: kubeletExtraArgs: azure-container-registry-config: c:/k/azure.json cloud-provider: external - feature-gates: WindowsHostProcessContainers=true pod-infra-container-image: mcr.microsoft.com/oss/kubernetes/pause:3.9 name: '{{ ds.meta_data["local_hostname"] }}' postKubeadmCommands: @@ -460,7 +456,7 @@ data: for rescheduling.\n - key: CriticalAddonsOnly\n operator: Exists\n \ - effect: NoExecute\n operator: Exists\n initContainers:\n # This container installs the CNI binaries\n # and CNI network config file - on each node.\n - name: install-cni\n image: sigwindowstools/calico-install:v3.25.0-hostprocess\n + on each node.\n - name: install-cni\n image: sigwindowstools/calico-install:v3.25.1-hostprocess\n \ args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/install.ps1\"]\n \ imagePullPolicy: Always\n env:\n # Name of the CNI config file to create.\n - name: CNI_CONF_NAME\n value: @@ -479,7 +475,7 @@ data: cni-net-dir\n - name: kubeadm-config\n mountPath: /etc/kubeadm-config/\n \ securityContext:\n windowsOptions:\n hostProcess: true\n runAsUserName: \"NT AUTHORITY\\\\system\"\n containers:\n - \ - name: calico-node-startup\n image: sigwindowstools/calico-node:v3.25.0-hostprocess\n + \ - name: calico-node-startup\n image: sigwindowstools/calico-node:v3.25.1-hostprocess\n \ args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/node-service.ps1\"]\n \ workingDir: \"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/\"\n imagePullPolicy: Always\n volumeMounts:\n - name: calico-config-windows\n mountPath: @@ -490,7 +486,7 @@ data: name: CNI_IPAM_TYPE\n value: \"calico-ipam\"\n - name: CALICO_NETWORKING_BACKEND\n \ value: \"vxlan\"\n - name: KUBECONFIG\n value: \"C:/etc/cni/net.d/calico-kubeconfig\"\n \ - name: VXLAN_VNI\n value: \"4096\"\n - name: calico-node-felix\n - \ image: sigwindowstools/calico-node:v3.25.0-hostprocess\n args: + \ image: sigwindowstools/calico-node:v3.25.1-hostprocess\n args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/felix-service.ps1\"]\n imagePullPolicy: Always\n workingDir: \"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/\"\n volumeMounts:\n \ - name: calico-config-windows\n mountPath: /etc/kube-calico-windows/\n @@ -505,7 +501,30 @@ data: \ configMap:\n name: calico-static-rules\n # Used to install CNI.\n - name: cni-bin-dir\n hostPath:\n path: /opt/cni/bin\n \ - name: cni-net-dir\n hostPath:\n path: /etc/cni/net.d\n - \ - name: kubeadm-config\n configMap:\n name: kubeadm-config\n" + \ - name: kubeadm-config\n configMap:\n name: kubeadm-config\n---\napiVersion: + apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n name: ipamconfigs.crd.projectcalico.org\nspec:\n + \ group: crd.projectcalico.org\n names:\n kind: IPAMConfig\n listKind: + IPAMConfigList\n plural: ipamconfigs\n singular: ipamconfig\n preserveUnknownFields: + false\n scope: Cluster\n versions:\n - name: v1\n schema:\n openAPIV3Schema:\n + \ properties:\n apiVersion:\n description: 'APIVersion + defines the versioned schema of this representation\n of an object. + Servers should convert recognized schemas to the latest\n internal + value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'\n + \ type: string\n kind:\n description: 'Kind is a + string value representing the REST resource this\n object represents. + Servers may infer this from the endpoint the client\n submits requests + to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'\n + \ type: string\n metadata:\n type: object\n spec:\n + \ description: IPAMConfigSpec contains the specification for an IPAMConfig\n + \ resource.\n properties:\n autoAllocateBlocks:\n + \ type: boolean\n maxBlocksPerHost:\n description: + MaxBlocksPerHost, if non-zero, is the max number of blocks\n that + can be affine to each host.\n maximum: 2147483647\n minimum: + 0\n type: integer\n strictAffinity:\n type: + boolean\n required:\n - autoAllocateBlocks\n - + strictAffinity\n type: object\n type: object\n served: true\n + \ storage: true\nstatus:\n acceptedNames:\n kind: \"\"\n plural: \"\"\n + \ conditions: []\n storedVersions: []\n" kind: ConfigMap metadata: annotations: diff --git a/templates/test/ci/cluster-template-prow-nvidia-gpu.yaml b/templates/test/ci/cluster-template-prow-nvidia-gpu.yaml index 818f39cd8ec..939e2427765 100644 --- a/templates/test/ci/cluster-template-prow-nvidia-gpu.yaml +++ b/templates/test/ci/cluster-template-prow-nvidia-gpu.yaml @@ -37,8 +37,6 @@ spec: - name: control-plane-subnet role: control-plane - name: node-subnet - natGateway: - name: node-natgateway role: node vnet: name: ${AZURE_VNET_NAME:=${CLUSTER_NAME}-vnet} diff --git a/templates/test/ci/cluster-template-prow-private.yaml b/templates/test/ci/cluster-template-prow-private.yaml index 6c443b81688..2aa81dfee95 100644 --- a/templates/test/ci/cluster-template-prow-private.yaml +++ b/templates/test/ci/cluster-template-prow-private.yaml @@ -4643,7 +4643,7 @@ data: value: node - name: DATASTORE_TYPE value: kubernetes - image: docker.io/calico/kube-controllers:v3.25.0 + image: docker.io/calico/kube-controllers:v3.25.1 imagePullPolicy: IfNotPresent livenessProbe: exec: @@ -4756,7 +4756,7 @@ data: - configMapRef: name: kubernetes-services-endpoint optional: true - image: docker.io/calico/node:v3.25.0 + image: docker.io/calico/node:v3.25.1 imagePullPolicy: IfNotPresent lifecycle: preStop: @@ -4828,7 +4828,7 @@ data: - configMapRef: name: kubernetes-services-endpoint optional: true - image: docker.io/calico/cni:v3.25.0 + image: docker.io/calico/cni:v3.25.1 imagePullPolicy: IfNotPresent name: upgrade-ipam securityContext: @@ -4863,7 +4863,7 @@ data: - configMapRef: name: kubernetes-services-endpoint optional: true - image: docker.io/calico/cni:v3.25.0 + image: docker.io/calico/cni:v3.25.1 imagePullPolicy: IfNotPresent name: install-cni securityContext: @@ -4877,7 +4877,7 @@ data: - calico-node - -init - -best-effort - image: docker.io/calico/node:v3.25.0 + image: docker.io/calico/node:v3.25.1 imagePullPolicy: IfNotPresent name: mount-bpffs securityContext: diff --git a/templates/test/ci/cluster-template-prow-topology.yaml b/templates/test/ci/cluster-template-prow-topology.yaml index 961040a18ce..6bc5cc2d41e 100644 --- a/templates/test/ci/cluster-template-prow-topology.yaml +++ b/templates/test/ci/cluster-template-prow-topology.yaml @@ -187,7 +187,7 @@ data: for rescheduling.\n - key: CriticalAddonsOnly\n operator: Exists\n \ - effect: NoExecute\n operator: Exists\n initContainers:\n # This container installs the CNI binaries\n # and CNI network config file - on each node.\n - name: install-cni\n image: sigwindowstools/calico-install:v3.25.0-hostprocess\n + on each node.\n - name: install-cni\n image: sigwindowstools/calico-install:v3.25.1-hostprocess\n \ args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/install.ps1\"]\n \ imagePullPolicy: Always\n env:\n # Name of the CNI config file to create.\n - name: CNI_CONF_NAME\n value: @@ -206,7 +206,7 @@ data: cni-net-dir\n - name: kubeadm-config\n mountPath: /etc/kubeadm-config/\n \ securityContext:\n windowsOptions:\n hostProcess: true\n runAsUserName: \"NT AUTHORITY\\\\system\"\n containers:\n - \ - name: calico-node-startup\n image: sigwindowstools/calico-node:v3.25.0-hostprocess\n + \ - name: calico-node-startup\n image: sigwindowstools/calico-node:v3.25.1-hostprocess\n \ args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/node-service.ps1\"]\n \ workingDir: \"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/\"\n imagePullPolicy: Always\n volumeMounts:\n - name: calico-config-windows\n mountPath: @@ -217,7 +217,7 @@ data: name: CNI_IPAM_TYPE\n value: \"calico-ipam\"\n - name: CALICO_NETWORKING_BACKEND\n \ value: \"vxlan\"\n - name: KUBECONFIG\n value: \"C:/etc/cni/net.d/calico-kubeconfig\"\n \ - name: VXLAN_VNI\n value: \"4096\"\n - name: calico-node-felix\n - \ image: sigwindowstools/calico-node:v3.25.0-hostprocess\n args: + \ image: sigwindowstools/calico-node:v3.25.1-hostprocess\n args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/felix-service.ps1\"]\n imagePullPolicy: Always\n workingDir: \"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/\"\n volumeMounts:\n \ - name: calico-config-windows\n mountPath: /etc/kube-calico-windows/\n @@ -232,7 +232,30 @@ data: \ configMap:\n name: calico-static-rules\n # Used to install CNI.\n - name: cni-bin-dir\n hostPath:\n path: /opt/cni/bin\n \ - name: cni-net-dir\n hostPath:\n path: /etc/cni/net.d\n - \ - name: kubeadm-config\n configMap:\n name: kubeadm-config\n" + \ - name: kubeadm-config\n configMap:\n name: kubeadm-config\n---\napiVersion: + apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n name: ipamconfigs.crd.projectcalico.org\nspec:\n + \ group: crd.projectcalico.org\n names:\n kind: IPAMConfig\n listKind: + IPAMConfigList\n plural: ipamconfigs\n singular: ipamconfig\n preserveUnknownFields: + false\n scope: Cluster\n versions:\n - name: v1\n schema:\n openAPIV3Schema:\n + \ properties:\n apiVersion:\n description: 'APIVersion + defines the versioned schema of this representation\n of an object. + Servers should convert recognized schemas to the latest\n internal + value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'\n + \ type: string\n kind:\n description: 'Kind is a + string value representing the REST resource this\n object represents. + Servers may infer this from the endpoint the client\n submits requests + to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'\n + \ type: string\n metadata:\n type: object\n spec:\n + \ description: IPAMConfigSpec contains the specification for an IPAMConfig\n + \ resource.\n properties:\n autoAllocateBlocks:\n + \ type: boolean\n maxBlocksPerHost:\n description: + MaxBlocksPerHost, if non-zero, is the max number of blocks\n that + can be affine to each host.\n maximum: 2147483647\n minimum: + 0\n type: integer\n strictAffinity:\n type: + boolean\n required:\n - autoAllocateBlocks\n - + strictAffinity\n type: object\n type: object\n served: true\n + \ storage: true\nstatus:\n acceptedNames:\n kind: \"\"\n plural: \"\"\n + \ conditions: []\n storedVersions: []\n" kind: ConfigMap metadata: annotations: diff --git a/templates/test/ci/cluster-template-prow.yaml b/templates/test/ci/cluster-template-prow.yaml index a2615e1831d..e9f64f4c1a9 100644 --- a/templates/test/ci/cluster-template-prow.yaml +++ b/templates/test/ci/cluster-template-prow.yaml @@ -41,8 +41,6 @@ spec: - name: control-plane-subnet role: control-plane - name: node-subnet - natGateway: - name: node-natgateway role: node vnet: name: ${AZURE_VNET_NAME:=${CLUSTER_NAME}-vnet} @@ -323,7 +321,7 @@ spec: kubeletExtraArgs: azure-container-registry-config: c:/k/azure.json cloud-provider: external - feature-gates: WindowsHostProcessContainers=true + feature-gates: ${NODE_FEATURE_GATES:-""} v: "2" windows-priorityclass: ABOVE_NORMAL_PRIORITY_CLASS name: '{{ ds.meta_data["local_hostname"] }}' @@ -522,7 +520,7 @@ data: for rescheduling.\n - key: CriticalAddonsOnly\n operator: Exists\n \ - effect: NoExecute\n operator: Exists\n initContainers:\n # This container installs the CNI binaries\n # and CNI network config file - on each node.\n - name: install-cni\n image: sigwindowstools/calico-install:v3.25.0-hostprocess\n + on each node.\n - name: install-cni\n image: sigwindowstools/calico-install:v3.25.1-hostprocess\n \ args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/install.ps1\"]\n \ imagePullPolicy: Always\n env:\n # Name of the CNI config file to create.\n - name: CNI_CONF_NAME\n value: @@ -541,7 +539,7 @@ data: cni-net-dir\n - name: kubeadm-config\n mountPath: /etc/kubeadm-config/\n \ securityContext:\n windowsOptions:\n hostProcess: true\n runAsUserName: \"NT AUTHORITY\\\\system\"\n containers:\n - \ - name: calico-node-startup\n image: sigwindowstools/calico-node:v3.25.0-hostprocess\n + \ - name: calico-node-startup\n image: sigwindowstools/calico-node:v3.25.1-hostprocess\n \ args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/node-service.ps1\"]\n \ workingDir: \"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/\"\n imagePullPolicy: Always\n volumeMounts:\n - name: calico-config-windows\n mountPath: @@ -552,7 +550,7 @@ data: name: CNI_IPAM_TYPE\n value: \"calico-ipam\"\n - name: CALICO_NETWORKING_BACKEND\n \ value: \"vxlan\"\n - name: KUBECONFIG\n value: \"C:/etc/cni/net.d/calico-kubeconfig\"\n \ - name: VXLAN_VNI\n value: \"4096\"\n - name: calico-node-felix\n - \ image: sigwindowstools/calico-node:v3.25.0-hostprocess\n args: + \ image: sigwindowstools/calico-node:v3.25.1-hostprocess\n args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/felix-service.ps1\"]\n imagePullPolicy: Always\n workingDir: \"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/\"\n volumeMounts:\n \ - name: calico-config-windows\n mountPath: /etc/kube-calico-windows/\n @@ -567,7 +565,30 @@ data: \ configMap:\n name: calico-static-rules\n # Used to install CNI.\n - name: cni-bin-dir\n hostPath:\n path: /opt/cni/bin\n \ - name: cni-net-dir\n hostPath:\n path: /etc/cni/net.d\n - \ - name: kubeadm-config\n configMap:\n name: kubeadm-config\n" + \ - name: kubeadm-config\n configMap:\n name: kubeadm-config\n---\napiVersion: + apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n name: ipamconfigs.crd.projectcalico.org\nspec:\n + \ group: crd.projectcalico.org\n names:\n kind: IPAMConfig\n listKind: + IPAMConfigList\n plural: ipamconfigs\n singular: ipamconfig\n preserveUnknownFields: + false\n scope: Cluster\n versions:\n - name: v1\n schema:\n openAPIV3Schema:\n + \ properties:\n apiVersion:\n description: 'APIVersion + defines the versioned schema of this representation\n of an object. + Servers should convert recognized schemas to the latest\n internal + value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'\n + \ type: string\n kind:\n description: 'Kind is a + string value representing the REST resource this\n object represents. + Servers may infer this from the endpoint the client\n submits requests + to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'\n + \ type: string\n metadata:\n type: object\n spec:\n + \ description: IPAMConfigSpec contains the specification for an IPAMConfig\n + \ resource.\n properties:\n autoAllocateBlocks:\n + \ type: boolean\n maxBlocksPerHost:\n description: + MaxBlocksPerHost, if non-zero, is the max number of blocks\n that + can be affine to each host.\n maximum: 2147483647\n minimum: + 0\n type: integer\n strictAffinity:\n type: + boolean\n required:\n - autoAllocateBlocks\n - + strictAffinity\n type: object\n type: object\n served: true\n + \ storage: true\nstatus:\n acceptedNames:\n kind: \"\"\n plural: \"\"\n + \ conditions: []\n storedVersions: []\n" kind: ConfigMap metadata: annotations: diff --git a/templates/test/ci/patches/control-plane-image-ci-version.yaml b/templates/test/ci/patches/control-plane-image-ci-version.yaml index 7bf707b2bde..f7da40224af 100644 --- a/templates/test/ci/patches/control-plane-image-ci-version.yaml +++ b/templates/test/ci/patches/control-plane-image-ci-version.yaml @@ -11,5 +11,5 @@ spec: marketplace: publisher: cncf-upstream offer: capi - sku: ubuntu-1804-gen1 + sku: ubuntu-2204-gen1 version: latest diff --git a/templates/test/ci/patches/control-plane-kubeadm-boostrap-ci-version.yaml b/templates/test/ci/patches/control-plane-kubeadm-boostrap-ci-version.yaml index ad54d680ff3..8cc68e2db92 100644 --- a/templates/test/ci/patches/control-plane-kubeadm-boostrap-ci-version.yaml +++ b/templates/test/ci/patches/control-plane-kubeadm-boostrap-ci-version.yaml @@ -54,6 +54,7 @@ $${SUDO} ctr -n k8s.io images tag $$IMAGE_REGISTRY_PREFIX/$$CI_CONTAINER-amd64:"$${CI_VERSION//+/_}" gcr.io/k8s-staging-ci-images/$$CI_CONTAINER:"$${CI_VERSION//+/_}" done fi + systemctl restart kubelet fi echo "* checking binary versions" echo "ctr version: " $(ctr version) diff --git a/templates/test/ci/patches/windows-containerd-patch.yaml b/templates/test/ci/patches/windows-containerd-patch.yaml deleted file mode 100644 index c1f56028e22..00000000000 --- a/templates/test/ci/patches/windows-containerd-patch.yaml +++ /dev/null @@ -1,10 +0,0 @@ -apiVersion: controlplane.cluster.x-k8s.io/v1beta1 -kind: KubeadmControlPlane -metadata: - name: "${CLUSTER_NAME}-control-plane" -spec: - kubeadmConfigSpec: - clusterConfiguration: - apiServer: - extraArgs: - feature-gates: ${K8S_FEATURE_GATES:-""} diff --git a/templates/test/ci/patches/windows-feature-gates.yaml b/templates/test/ci/patches/windows-feature-gates.yaml new file mode 100644 index 00000000000..0b7d430170d --- /dev/null +++ b/templates/test/ci/patches/windows-feature-gates.yaml @@ -0,0 +1,22 @@ +apiVersion: controlplane.cluster.x-k8s.io/v1beta1 +kind: KubeadmControlPlane +metadata: + name: "${CLUSTER_NAME}-control-plane" +spec: + kubeadmConfigSpec: + clusterConfiguration: + apiServer: + extraArgs: + feature-gates: ${K8S_FEATURE_GATES:-""} +--- +apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 +kind: KubeadmConfigTemplate +metadata: + name: ${CLUSTER_NAME}-md-win +spec: + template: + spec: + joinConfiguration: + nodeRegistration: + kubeletExtraArgs: + feature-gates: ${NODE_FEATURE_GATES:-""} diff --git a/templates/test/ci/prow-ci-version-windows-containerd-2022/kustomization.yaml b/templates/test/ci/prow-ci-version-windows-containerd-2022/kustomization.yaml deleted file mode 100644 index 5c1b56fdee3..00000000000 --- a/templates/test/ci/prow-ci-version-windows-containerd-2022/kustomization.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -namespace: default -resources: - - ../prow-ci-version -patchesStrategicMerge: - - patches/windows-image-update.yaml diff --git a/templates/test/ci/prow-ci-version-windows-containerd-2022/patches/windows-image-update.yaml b/templates/test/ci/prow-ci-version-windows-containerd-2022/patches/windows-image-update.yaml deleted file mode 100644 index b5103065b0c..00000000000 --- a/templates/test/ci/prow-ci-version-windows-containerd-2022/patches/windows-image-update.yaml +++ /dev/null @@ -1,16 +0,0 @@ ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 -kind: AzureMachineTemplate -metadata: - name: "${CLUSTER_NAME}-md-win" -spec: - template: - spec: - image: - # we use the an older image as a workaround there is no published marketplace image for k8s CI versions. - # the binaries and images will get replaced to the desired version by the pre-kubeadm script. - marketplace: - publisher: cncf-upstream - offer: capi-windows - sku: windows-2022-containerd-gen1 - version: "latest" diff --git a/templates/test/ci/prow-ci-version/kustomization.yaml b/templates/test/ci/prow-ci-version/kustomization.yaml index bdf1844a08e..f18899c8284 100644 --- a/templates/test/ci/prow-ci-version/kustomization.yaml +++ b/templates/test/ci/prow-ci-version/kustomization.yaml @@ -7,7 +7,7 @@ resources: patchesStrategicMerge: - ../patches/control-plane-image-ci-version.yaml - ../patches/controller-manager.yaml - - ../patches/windows-containerd-patch.yaml + - ../patches/windows-feature-gates.yaml - ../patches/windows-containerd-labels.yaml - ../patches/machine-deployment-worker-counts.yaml - patches/machine-deployment-ci-version.yaml diff --git a/templates/test/ci/prow-ci-version/patches/kubeadm-bootstrap.yaml b/templates/test/ci/prow-ci-version/patches/kubeadm-bootstrap.yaml index 1b44745161e..1031e52d763 100644 --- a/templates/test/ci/prow-ci-version/patches/kubeadm-bootstrap.yaml +++ b/templates/test/ci/prow-ci-version/patches/kubeadm-bootstrap.yaml @@ -54,6 +54,7 @@ $${SUDO} ctr -n k8s.io images tag $$IMAGE_REGISTRY_PREFIX/$$CI_CONTAINER-amd64:"$${CI_VERSION//+/_}" gcr.io/k8s-staging-ci-images/$$CI_CONTAINER:"$${CI_VERSION//+/_}" done fi + systemctl restart kubelet fi echo "* checking binary versions" echo "ctr version: " $(ctr version) diff --git a/templates/test/ci/prow-ci-version/patches/machine-deployment-ci-version.yaml b/templates/test/ci/prow-ci-version/patches/machine-deployment-ci-version.yaml index b20943756e6..65eb8a4bb3f 100644 --- a/templates/test/ci/prow-ci-version/patches/machine-deployment-ci-version.yaml +++ b/templates/test/ci/prow-ci-version/patches/machine-deployment-ci-version.yaml @@ -11,5 +11,5 @@ spec: marketplace: publisher: cncf-upstream offer: capi - sku: ubuntu-1804-gen1 + sku: ubuntu-2204-gen1 version: "latest" diff --git a/templates/test/ci/prow-clusterclass-ci-default/windows.yaml b/templates/test/ci/prow-clusterclass-ci-default/windows.yaml index a57dc956ecc..e676ed1e012 100644 --- a/templates/test/ci/prow-clusterclass-ci-default/windows.yaml +++ b/templates/test/ci/prow-clusterclass-ci-default/windows.yaml @@ -29,7 +29,6 @@ spec: kubeletExtraArgs: cloud-provider: external azure-container-registry-config: 'c:/k/azure.json' - feature-gates: "WindowsHostProcessContainers=true" v: "2" windows-priorityclass: "ABOVE_NORMAL_PRIORITY_CLASS" files: diff --git a/templates/test/ci/prow-dual-stack/kustomization.yaml b/templates/test/ci/prow-dual-stack/kustomization.yaml index 508d7d06641..99d6b79f2af 100644 --- a/templates/test/ci/prow-dual-stack/kustomization.yaml +++ b/templates/test/ci/prow-dual-stack/kustomization.yaml @@ -3,6 +3,7 @@ kind: Kustomization namespace: default resources: - ../../../flavors/dual-stack + - machine-pool-dualstack.yaml patchesStrategicMerge: - ../patches/tags.yaml - ../patches/controller-manager.yaml diff --git a/templates/test/ci/prow-dual-stack/machine-pool-dualstack.yaml b/templates/test/ci/prow-dual-stack/machine-pool-dualstack.yaml new file mode 100644 index 00000000000..91c0427a0e7 --- /dev/null +++ b/templates/test/ci/prow-dual-stack/machine-pool-dualstack.yaml @@ -0,0 +1,71 @@ +apiVersion: cluster.x-k8s.io/v1beta1 +kind: MachinePool +metadata: + name: ${CLUSTER_NAME}-mp-0 + namespace: default +spec: + clusterName: ${CLUSTER_NAME} + replicas: ${WORKER_MACHINE_COUNT} + template: + spec: + bootstrap: + configRef: + apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 + kind: KubeadmConfig + name: ${CLUSTER_NAME}-mp-0 + clusterName: ${CLUSTER_NAME} + infrastructureRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + kind: AzureMachinePool + name: ${CLUSTER_NAME}-mp-0 + version: ${KUBERNETES_VERSION} +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +kind: AzureMachinePool +metadata: + name: ${CLUSTER_NAME}-mp-0 + namespace: default +spec: + location: ${AZURE_LOCATION} + strategy: + rollingUpdate: + deletePolicy: Oldest + maxSurge: 25% + maxUnavailable: 1 + type: RollingUpdate + template: + osDisk: + diskSizeGB: 30 + managedDisk: + storageAccountType: Premium_LRS + osType: Linux + sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""} + vmSize: ${AZURE_NODE_MACHINE_TYPE} +--- +apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 +kind: KubeadmConfig +metadata: + name: ${CLUSTER_NAME}-mp-0 + namespace: default +spec: + files: + - contentFrom: + secret: + key: worker-node-azure.json + name: ${CLUSTER_NAME}-md-0-azure-json + owner: root:root + path: /etc/kubernetes/azure.json + permissions: "0644" + joinConfiguration: + nodeRegistration: + kubeletExtraArgs: + azure-container-registry-config: /etc/kubernetes/azure.json + cloud-config: /etc/kubernetes/azure.json + cloud-provider: azure + cluster-dns: '[fd00::10]' + name: '{{ ds.meta_data["local_hostname"] }}' + postKubeadmCommands: + - echo "DNSStubListener=no" >> /etc/systemd/resolved.conf + - mv /etc/resolv.conf /etc/resolv.conf.OLD && ln -s /run/systemd/resolve/resolv.conf + /etc/resolv.conf + - systemctl restart systemd-resolved diff --git a/templates/test/ci/prow-intree-cloud-provider-machine-pool/patches/intree-mp.yaml b/templates/test/ci/prow-intree-cloud-provider-machine-pool/patches/intree-mp.yaml index 2bfc52700b8..92e993895c0 100644 --- a/templates/test/ci/prow-intree-cloud-provider-machine-pool/patches/intree-mp.yaml +++ b/templates/test/ci/prow-intree-cloud-provider-machine-pool/patches/intree-mp.yaml @@ -20,7 +20,6 @@ spec: joinConfiguration: nodeRegistration: kubeletExtraArgs: - feature-gates: WindowsHostProcessContainers=true pod-infra-container-image: mcr.microsoft.com/oss/kubernetes/pause:3.4.1 azure-container-registry-config: c:/k/azure.json cloud-config: c:/k/azure.json diff --git a/templates/test/ci/prow-intree-cloud-provider/patches/intree-md-win.yaml b/templates/test/ci/prow-intree-cloud-provider/patches/intree-md-win.yaml index 9daa69f7214..8514a5bf856 100644 --- a/templates/test/ci/prow-intree-cloud-provider/patches/intree-md-win.yaml +++ b/templates/test/ci/prow-intree-cloud-provider/patches/intree-md-win.yaml @@ -9,7 +9,6 @@ spec: joinConfiguration: nodeRegistration: kubeletExtraArgs: - feature-gates: WindowsHostProcessContainers=true v: "2" windows-priorityclass: ABOVE_NORMAL_PRIORITY_CLASS azure-container-registry-config: c:/k/azure.json diff --git a/templates/test/ci/prow-ipv6/kustomization.yaml b/templates/test/ci/prow-ipv6/kustomization.yaml index aee62be26f0..a430679188b 100644 --- a/templates/test/ci/prow-ipv6/kustomization.yaml +++ b/templates/test/ci/prow-ipv6/kustomization.yaml @@ -3,6 +3,7 @@ kind: Kustomization namespace: default resources: - ../../../flavors/ipv6 + - machine-pool-ipv6.yaml patchesStrategicMerge: - ../patches/tags.yaml - ../patches/controller-manager.yaml diff --git a/templates/test/ci/prow-ipv6/machine-pool-ipv6.yaml b/templates/test/ci/prow-ipv6/machine-pool-ipv6.yaml new file mode 100644 index 00000000000..633ccaac961 --- /dev/null +++ b/templates/test/ci/prow-ipv6/machine-pool-ipv6.yaml @@ -0,0 +1,81 @@ +apiVersion: cluster.x-k8s.io/v1beta1 +kind: MachinePool +metadata: + name: ${CLUSTER_NAME}-mp-0 + namespace: default +spec: + clusterName: ${CLUSTER_NAME} + replicas: ${WORKER_MACHINE_COUNT} + template: + spec: + bootstrap: + configRef: + apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 + kind: KubeadmConfig + name: ${CLUSTER_NAME}-mp-0 + clusterName: ${CLUSTER_NAME} + infrastructureRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + kind: AzureMachinePool + name: ${CLUSTER_NAME}-mp-0 + version: ${KUBERNETES_VERSION} +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +kind: AzureMachinePool +metadata: + name: ${CLUSTER_NAME}-mp-0 + namespace: default +spec: + location: ${AZURE_LOCATION} + strategy: + rollingUpdate: + deletePolicy: Oldest + maxSurge: 25% + maxUnavailable: 1 + type: RollingUpdate + template: + osDisk: + diskSizeGB: 30 + managedDisk: + storageAccountType: Premium_LRS + osType: Linux + sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""} + vmSize: ${AZURE_NODE_MACHINE_TYPE} +--- +apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 +kind: KubeadmConfig +metadata: + name: ${CLUSTER_NAME}-mp-0 + namespace: default +spec: + clusterConfiguration: + apiServer: + extraArgs: + bind-address: '::' + controllerManager: + extraArgs: + bind-address: '::' + scheduler: + extraArgs: + bind-address: '::' + files: + - contentFrom: + secret: + key: worker-node-azure.json + name: ${CLUSTER_NAME}-md-0-azure-json + owner: root:root + path: /etc/kubernetes/azure.json + permissions: "0644" + joinConfiguration: + nodeRegistration: + kubeletExtraArgs: + azure-container-registry-config: /etc/kubernetes/azure.json + cloud-config: /etc/kubernetes/azure.json + cloud-provider: azure + cluster-dns: '[fd00::10]' + name: '{{ ds.meta_data["local_hostname"] }}' + postKubeadmCommands: + - echo "DNSStubListener=no" >> /etc/systemd/resolved.conf + - mv /etc/resolv.conf /etc/resolv.conf.OLD && ln -s /run/systemd/resolve/resolv.conf + /etc/resolv.conf + - systemctl restart systemd-resolved diff --git a/templates/test/ci/prow-machine-pool-ci-version/patches/machine-pool-ci-version.yaml b/templates/test/ci/prow-machine-pool-ci-version/patches/machine-pool-ci-version.yaml index 8f6b7bd638a..da1aa793bbd 100644 --- a/templates/test/ci/prow-machine-pool-ci-version/patches/machine-pool-ci-version.yaml +++ b/templates/test/ci/prow-machine-pool-ci-version/patches/machine-pool-ci-version.yaml @@ -63,6 +63,7 @@ spec: $${SUDO} ctr -n k8s.io images tag $$IMAGE_REGISTRY_PREFIX/$$CI_CONTAINER-amd64:"$${CI_VERSION//+/_}" gcr.io/k8s-staging-ci-images/$$CI_CONTAINER:"$${CI_VERSION//+/_}" done fi + systemctl restart kubelet fi echo "* checking binary versions" echo "ctr version: " $(ctr version) @@ -90,5 +91,5 @@ spec: marketplace: publisher: cncf-upstream offer: capi - sku: ubuntu-1804-gen1 + sku: ubuntu-2204-gen1 version: latest diff --git a/templates/test/ci/prow-machine-pool/kustomization.yaml b/templates/test/ci/prow-machine-pool/kustomization.yaml index d5dd0c5b0bb..5dbd6485993 100644 --- a/templates/test/ci/prow-machine-pool/kustomization.yaml +++ b/templates/test/ci/prow-machine-pool/kustomization.yaml @@ -11,7 +11,6 @@ patchesStrategicMerge: - ../patches/tags.yaml - ../patches/controller-manager.yaml - ../patches/machine-pool-worker-counts.yaml - - ../patches/windows-containerd-patch.yaml - ../patches/windows-containerd-labels.yaml configMapGenerator: - name: cni-${CLUSTER_NAME}-calico-windows diff --git a/templates/test/ci/prow/kustomization.yaml b/templates/test/ci/prow/kustomization.yaml index 02c4d83ed03..e57e63d2682 100644 --- a/templates/test/ci/prow/kustomization.yaml +++ b/templates/test/ci/prow/kustomization.yaml @@ -16,9 +16,8 @@ patchesStrategicMerge: - ../patches/controller-manager.yaml - ../patches/machine-deployment-worker-counts.yaml - ../../../azure-cluster-identity/azurecluster-identity-ref.yaml - - ../../../flavors/base-windows-containerd/kubeadm-control-plane.yaml - ../patches/azuremachinetemplate-vmextension.yaml - - ../patches/windows-containerd-patch.yaml + - ../patches/windows-feature-gates.yaml - ../patches/windows-containerd-labels.yaml - ../patches/windows-server-version.yaml patches: diff --git a/templates/test/dev/cluster-template-custom-builds-machine-pool.yaml b/templates/test/dev/cluster-template-custom-builds-machine-pool.yaml index 92e87943439..e7ac204b306 100644 --- a/templates/test/dev/cluster-template-custom-builds-machine-pool.yaml +++ b/templates/test/dev/cluster-template-custom-builds-machine-pool.yaml @@ -42,8 +42,6 @@ spec: - name: control-plane-subnet role: control-plane - name: node-subnet - natGateway: - name: node-natgateway role: node vnet: name: ${AZURE_VNET_NAME:=${CLUSTER_NAME}-vnet} @@ -62,27 +60,14 @@ spec: clusterConfiguration: apiServer: extraArgs: - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure - feature-gates: ${K8S_FEATURE_GATES:-""} - extraVolumes: - - hostPath: /etc/kubernetes/azure.json - mountPath: /etc/kubernetes/azure.json - name: cloud-config - readOnly: true + cloud-provider: external timeoutForControlPlane: 20m controllerManager: extraArgs: allocate-node-cidrs: "false" - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure + cloud-provider: external cluster-name: ${CLUSTER_NAME} v: "4" - extraVolumes: - - hostPath: /etc/kubernetes/azure.json - mountPath: /etc/kubernetes/azure.json - name: cloud-config - readOnly: true etcd: local: dataDir: /var/lib/etcddisk/etcd @@ -114,11 +99,13 @@ spec: set -o pipefail set -o errexit + systemctl stop kubelet declare -a BINARIES=("kubeadm" "kubectl" "kubelet") for BINARY in "$${BINARIES[@]}"; do echo "* installing package: $${BINARY} ${KUBE_GIT_VERSION}" curl --retry 10 --retry-delay 5 "https://${AZURE_STORAGE_ACCOUNT}.blob.core.windows.net/${JOB_NAME}/${KUBE_GIT_VERSION}/bin/linux/amd64/$${BINARY}" --output "/usr/bin/$${BINARY}" done + systemctl restart kubelet # prepull images from gcr.io/k8s-staging-ci-images and retag it to # registry.k8s.io so kubeadm can fetch correct images no matter what @@ -148,11 +135,11 @@ spec: rm /tmp/yq_linux_amd64.tar.gz export KUBECONFIG=/etc/kubernetes/admin.conf - kubectl -n kube-system set image daemonset/kube-proxy kube-proxy="${REGISTRY}/kube-proxy:${IMAGE_TAG}" + kubectl -n kube-system set image daemonset/kube-proxy kube-proxy="${REGISTRY}/kube-proxy:${KUBE_IMAGE_TAG}" systemctl stop kubelet - yq e '.spec.containers[0].image = "${REGISTRY}/kube-apiserver:${IMAGE_TAG}"' -i /etc/kubernetes/manifests/kube-apiserver.yaml - yq e '.spec.containers[0].image = "${REGISTRY}/kube-controller-manager:${IMAGE_TAG}"' -i /etc/kubernetes/manifests/kube-controller-manager.yaml - yq e '.spec.containers[0].image = "${REGISTRY}/kube-scheduler:${IMAGE_TAG}"' -i /etc/kubernetes/manifests/kube-scheduler.yaml + yq e '.spec.containers[0].image = "${REGISTRY}/kube-apiserver:${KUBE_IMAGE_TAG}"' -i /etc/kubernetes/manifests/kube-apiserver.yaml + yq e '.spec.containers[0].image = "${REGISTRY}/kube-controller-manager:${KUBE_IMAGE_TAG}"' -i /etc/kubernetes/manifests/kube-controller-manager.yaml + yq e '.spec.containers[0].image = "${REGISTRY}/kube-scheduler:${KUBE_IMAGE_TAG}"' -i /etc/kubernetes/manifests/kube-scheduler.yaml systemctl restart kubelet owner: root:root path: /tmp/replace-k8s-components.sh @@ -168,15 +155,13 @@ spec: nodeRegistration: kubeletExtraArgs: azure-container-registry-config: /etc/kubernetes/azure.json - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure + cloud-provider: external name: '{{ ds.meta_data["local_hostname"] }}' joinConfiguration: nodeRegistration: kubeletExtraArgs: azure-container-registry-config: /etc/kubernetes/azure.json - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure + cloud-provider: external name: '{{ ds.meta_data["local_hostname"] }}' mounts: - - LABEL=etcd_disk @@ -210,7 +195,7 @@ spec: marketplace: offer: capi publisher: cncf-upstream - sku: ubuntu-1804-gen1 + sku: ubuntu-2204-gen1 version: latest osDisk: diskSizeGB: 128 @@ -258,7 +243,7 @@ spec: marketplace: offer: capi publisher: cncf-upstream - sku: ubuntu-1804-gen1 + sku: ubuntu-2204-gen1 version: latest osDisk: diskSizeGB: 30 @@ -291,11 +276,13 @@ spec: set -o pipefail set -o errexit + systemctl stop kubelet declare -a BINARIES=("kubeadm" "kubectl" "kubelet") for BINARY in "$${BINARIES[@]}"; do echo "* installing package: $${BINARY} ${KUBE_GIT_VERSION}" curl --retry 10 --retry-delay 5 "https://${AZURE_STORAGE_ACCOUNT}.blob.core.windows.net/${JOB_NAME}/${KUBE_GIT_VERSION}/bin/linux/amd64/$${BINARY}" --output "/usr/bin/$${BINARY}" done + systemctl restart kubelet echo "kubeadm version: $(kubeadm version -o=short)" echo "kubectl version: $(kubectl version --client=true --short=true)" @@ -314,8 +301,7 @@ spec: nodeRegistration: kubeletExtraArgs: azure-container-registry-config: /etc/kubernetes/azure.json - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure + cloud-provider: external name: '{{ ds.meta_data["local_hostname"] }}' preKubeadmCommands: - bash -c /tmp/replace-k8s-binaries.sh @@ -369,6 +355,12 @@ metadata: spec: location: ${AZURE_LOCATION} template: + image: + marketplace: + offer: capi-windows + publisher: cncf-upstream + sku: ${WINDOWS_SERVER_VERSION:=windows-2019}-containerd-gen1 + version: latest osDisk: diskSizeGB: 128 managedDisk: @@ -394,21 +386,48 @@ spec: - content: Add-MpPreference -ExclusionProcess C:/opt/cni/bin/calico.exe path: C:/defender-exclude-calico.ps1 permissions: "0744" + - content: | + $ErrorActionPreference = 'Stop' + + Stop-Service kubelet -Force + + $$KUBE_GIT_VERSION="${KUBE_GIT_VERSION}" + if($$KUBE_GIT_VERSION -ne "") + { + $$binaries=@("kubeadm", "kubectl", "kubelet", "kube-proxy") + $$ci_url="https://${AZURE_STORAGE_ACCOUNT}.blob.core.windows.net/${JOB_NAME}/${KUBE_GIT_VERSION}/bin/windows/amd64" + foreach ( $$binary in $$binaries ) + { + echo "downloading binary: $$ci_url/$$binary.exe" + curl.exe --retry 10 --retry-delay 5 "$$ci_url/$$binary.exe" --output "c:/k/$$binary.exe" + } + } + + # Tag it to the ci version. The image knows how to use the copy locally with the configmap + # that is applied at at this stage (windows-kubeproxy-ci.yaml) + ctr.exe -n k8s.io images pull docker.io/sigwindowstools/kube-proxy:v1.23.1-calico-hostprocess + ctr.exe -n k8s.io images tag docker.io/sigwindowstools/kube-proxy:v1.23.1-calico-hostprocess "docker.io/sigwindowstools/kube-proxy:${CI_VERSION/+/_}-calico-hostprocess" + + kubeadm.exe version -o=short + kubectl.exe version --client=true --short=true + kubelet.exe --version + kube-proxy.exe --version + path: C:/replace-pr-binaries.ps1 + permissions: "0744" joinConfiguration: nodeRegistration: criSocket: npipe:////./pipe/containerd-containerd kubeletExtraArgs: azure-container-registry-config: c:/k/azure.json - cloud-config: c:/k/azure.json - cloud-provider: azure - feature-gates: WindowsHostProcessContainers=true - pod-infra-container-image: mcr.microsoft.com/oss/kubernetes/pause:3.4.1 + cloud-provider: external + pod-infra-container-image: mcr.microsoft.com/oss/kubernetes/pause:3.9 name: '{{ ds.meta_data["local_hostname"] }}' postKubeadmCommands: - nssm set kubelet start SERVICE_AUTO_START - powershell C:/defender-exclude-calico.ps1 preKubeadmCommands: - powershell c:/create-external-network.ps1 + - powershell C:/replace-pr-binaries.ps1 users: - groups: Administrators name: capi @@ -459,6 +478,14 @@ spec: --- apiVersion: v1 data: + kube-proxy-patch: |- + apiVersion: v1 + kind: ConfigMap + metadata: + name: windows-kubeproxy-ci + namespace: kube-system + data: + KUBEPROXY_PATH: "c:/k/kube-proxy.exe" proxy: | apiVersion: apps/v1 kind: DaemonSet @@ -565,7 +592,7 @@ data: for rescheduling.\n - key: CriticalAddonsOnly\n operator: Exists\n \ - effect: NoExecute\n operator: Exists\n initContainers:\n # This container installs the CNI binaries\n # and CNI network config file - on each node.\n - name: install-cni\n image: sigwindowstools/calico-install:v3.25.0-hostprocess\n + on each node.\n - name: install-cni\n image: sigwindowstools/calico-install:v3.25.1-hostprocess\n \ args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/install.ps1\"]\n \ imagePullPolicy: Always\n env:\n # Name of the CNI config file to create.\n - name: CNI_CONF_NAME\n value: @@ -584,7 +611,7 @@ data: cni-net-dir\n - name: kubeadm-config\n mountPath: /etc/kubeadm-config/\n \ securityContext:\n windowsOptions:\n hostProcess: true\n runAsUserName: \"NT AUTHORITY\\\\system\"\n containers:\n - \ - name: calico-node-startup\n image: sigwindowstools/calico-node:v3.25.0-hostprocess\n + \ - name: calico-node-startup\n image: sigwindowstools/calico-node:v3.25.1-hostprocess\n \ args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/node-service.ps1\"]\n \ workingDir: \"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/\"\n imagePullPolicy: Always\n volumeMounts:\n - name: calico-config-windows\n mountPath: @@ -595,7 +622,7 @@ data: name: CNI_IPAM_TYPE\n value: \"calico-ipam\"\n - name: CALICO_NETWORKING_BACKEND\n \ value: \"vxlan\"\n - name: KUBECONFIG\n value: \"C:/etc/cni/net.d/calico-kubeconfig\"\n \ - name: VXLAN_VNI\n value: \"4096\"\n - name: calico-node-felix\n - \ image: sigwindowstools/calico-node:v3.25.0-hostprocess\n args: + \ image: sigwindowstools/calico-node:v3.25.1-hostprocess\n args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/felix-service.ps1\"]\n imagePullPolicy: Always\n workingDir: \"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/\"\n volumeMounts:\n \ - name: calico-config-windows\n mountPath: /etc/kube-calico-windows/\n @@ -610,7 +637,30 @@ data: \ configMap:\n name: calico-static-rules\n # Used to install CNI.\n - name: cni-bin-dir\n hostPath:\n path: /opt/cni/bin\n \ - name: cni-net-dir\n hostPath:\n path: /etc/cni/net.d\n - \ - name: kubeadm-config\n configMap:\n name: kubeadm-config\n" + \ - name: kubeadm-config\n configMap:\n name: kubeadm-config\n---\napiVersion: + apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n name: ipamconfigs.crd.projectcalico.org\nspec:\n + \ group: crd.projectcalico.org\n names:\n kind: IPAMConfig\n listKind: + IPAMConfigList\n plural: ipamconfigs\n singular: ipamconfig\n preserveUnknownFields: + false\n scope: Cluster\n versions:\n - name: v1\n schema:\n openAPIV3Schema:\n + \ properties:\n apiVersion:\n description: 'APIVersion + defines the versioned schema of this representation\n of an object. + Servers should convert recognized schemas to the latest\n internal + value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'\n + \ type: string\n kind:\n description: 'Kind is a + string value representing the REST resource this\n object represents. + Servers may infer this from the endpoint the client\n submits requests + to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'\n + \ type: string\n metadata:\n type: object\n spec:\n + \ description: IPAMConfigSpec contains the specification for an IPAMConfig\n + \ resource.\n properties:\n autoAllocateBlocks:\n + \ type: boolean\n maxBlocksPerHost:\n description: + MaxBlocksPerHost, if non-zero, is the max number of blocks\n that + can be affine to each host.\n maximum: 2147483647\n minimum: + 0\n type: integer\n strictAffinity:\n type: + boolean\n required:\n - autoAllocateBlocks\n - + strictAffinity\n type: object\n type: object\n served: true\n + \ storage: true\nstatus:\n acceptedNames:\n kind: \"\"\n plural: \"\"\n + \ conditions: []\n storedVersions: []\n" kind: ConfigMap metadata: annotations: diff --git a/templates/test/dev/cluster-template-custom-builds.yaml b/templates/test/dev/cluster-template-custom-builds.yaml index f7abd329fca..95942b75ef8 100644 --- a/templates/test/dev/cluster-template-custom-builds.yaml +++ b/templates/test/dev/cluster-template-custom-builds.yaml @@ -42,8 +42,6 @@ spec: - name: control-plane-subnet role: control-plane - name: node-subnet - natGateway: - name: node-natgateway role: node vnet: name: ${AZURE_VNET_NAME:=${CLUSTER_NAME}-vnet} @@ -62,28 +60,16 @@ spec: clusterConfiguration: apiServer: extraArgs: - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure + cloud-provider: external feature-gates: ${K8S_FEATURE_GATES:-""} - extraVolumes: - - hostPath: /etc/kubernetes/azure.json - mountPath: /etc/kubernetes/azure.json - name: cloud-config - readOnly: true timeoutForControlPlane: 20m controllerManager: extraArgs: allocate-node-cidrs: "false" - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure + cloud-provider: external cluster-name: ${CLUSTER_NAME} feature-gates: HPAContainerMetrics=true v: "4" - extraVolumes: - - hostPath: /etc/kubernetes/azure.json - mountPath: /etc/kubernetes/azure.json - name: cloud-config - readOnly: true etcd: local: dataDir: /var/lib/etcddisk/etcd @@ -122,11 +108,13 @@ spec: set -o pipefail set -o errexit + systemctl stop kubelet declare -a BINARIES=("kubeadm" "kubectl" "kubelet") for BINARY in "$${BINARIES[@]}"; do echo "* installing package: $${BINARY} ${KUBE_GIT_VERSION}" curl --retry 10 --retry-delay 5 "https://${AZURE_STORAGE_ACCOUNT}.blob.core.windows.net/${JOB_NAME}/${KUBE_GIT_VERSION}/bin/linux/amd64/$${BINARY}" --output "/usr/bin/$${BINARY}" done + systemctl restart kubelet # prepull images from gcr.io/k8s-staging-ci-images and retag it to # registry.k8s.io so kubeadm can fetch correct images no matter what @@ -156,11 +144,11 @@ spec: rm /tmp/yq_linux_amd64.tar.gz export KUBECONFIG=/etc/kubernetes/admin.conf - kubectl -n kube-system set image daemonset/kube-proxy kube-proxy="${REGISTRY}/kube-proxy:${IMAGE_TAG}" + kubectl -n kube-system set image daemonset/kube-proxy kube-proxy="${REGISTRY}/kube-proxy:${KUBE_IMAGE_TAG}" systemctl stop kubelet - yq e '.spec.containers[0].image = "${REGISTRY}/kube-apiserver:${IMAGE_TAG}"' -i /etc/kubernetes/manifests/kube-apiserver.yaml - yq e '.spec.containers[0].image = "${REGISTRY}/kube-controller-manager:${IMAGE_TAG}"' -i /etc/kubernetes/manifests/kube-controller-manager.yaml - yq e '.spec.containers[0].image = "${REGISTRY}/kube-scheduler:${IMAGE_TAG}"' -i /etc/kubernetes/manifests/kube-scheduler.yaml + yq e '.spec.containers[0].image = "${REGISTRY}/kube-apiserver:${KUBE_IMAGE_TAG}"' -i /etc/kubernetes/manifests/kube-apiserver.yaml + yq e '.spec.containers[0].image = "${REGISTRY}/kube-controller-manager:${KUBE_IMAGE_TAG}"' -i /etc/kubernetes/manifests/kube-controller-manager.yaml + yq e '.spec.containers[0].image = "${REGISTRY}/kube-scheduler:${KUBE_IMAGE_TAG}"' -i /etc/kubernetes/manifests/kube-scheduler.yaml systemctl restart kubelet owner: root:root path: /tmp/replace-k8s-components.sh @@ -169,15 +157,13 @@ spec: nodeRegistration: kubeletExtraArgs: azure-container-registry-config: /etc/kubernetes/azure.json - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure + cloud-provider: external name: '{{ ds.meta_data["local_hostname"] }}' joinConfiguration: nodeRegistration: kubeletExtraArgs: azure-container-registry-config: /etc/kubernetes/azure.json - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure + cloud-provider: external name: '{{ ds.meta_data["local_hostname"] }}' mounts: - - LABEL=etcd_disk @@ -211,7 +197,7 @@ spec: marketplace: offer: capi publisher: cncf-upstream - sku: ubuntu-1804-gen1 + sku: ubuntu-2204-gen1 version: latest osDisk: diskSizeGB: 128 @@ -257,7 +243,7 @@ spec: marketplace: offer: capi publisher: cncf-upstream - sku: ubuntu-1804-gen1 + sku: ubuntu-2204-gen1 version: latest osDisk: diskSizeGB: 128 @@ -297,11 +283,13 @@ spec: set -o pipefail set -o errexit + systemctl stop kubelet declare -a BINARIES=("kubeadm" "kubectl" "kubelet") for BINARY in "$${BINARIES[@]}"; do echo "* installing package: $${BINARY} ${KUBE_GIT_VERSION}" curl --retry 10 --retry-delay 5 "https://${AZURE_STORAGE_ACCOUNT}.blob.core.windows.net/${JOB_NAME}/${KUBE_GIT_VERSION}/bin/linux/amd64/$${BINARY}" --output "/usr/bin/$${BINARY}" done + systemctl restart kubelet echo "kubeadm version: $(kubeadm version -o=short)" echo "kubectl version: $(kubectl version --client=true --short=true)" @@ -313,8 +301,7 @@ spec: nodeRegistration: kubeletExtraArgs: azure-container-registry-config: /etc/kubernetes/azure.json - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure + cloud-provider: external name: '{{ ds.meta_data["local_hostname"] }}' preKubeadmCommands: - bash -c /tmp/replace-k8s-binaries.sh @@ -461,9 +448,8 @@ spec: criSocket: npipe:////./pipe/containerd-containerd kubeletExtraArgs: azure-container-registry-config: c:/k/azure.json - cloud-config: c:/k/azure.json - cloud-provider: azure - feature-gates: WindowsHostProcessContainers=true + cloud-provider: external + feature-gates: ${NODE_FEATURE_GATES:-""} v: "2" windows-priorityclass: ABOVE_NORMAL_PRIORITY_CLASS name: '{{ ds.meta_data["local_hostname"] }}' @@ -671,7 +657,7 @@ data: for rescheduling.\n - key: CriticalAddonsOnly\n operator: Exists\n \ - effect: NoExecute\n operator: Exists\n initContainers:\n # This container installs the CNI binaries\n # and CNI network config file - on each node.\n - name: install-cni\n image: sigwindowstools/calico-install:v3.25.0-hostprocess\n + on each node.\n - name: install-cni\n image: sigwindowstools/calico-install:v3.25.1-hostprocess\n \ args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/install.ps1\"]\n \ imagePullPolicy: Always\n env:\n # Name of the CNI config file to create.\n - name: CNI_CONF_NAME\n value: @@ -690,7 +676,7 @@ data: cni-net-dir\n - name: kubeadm-config\n mountPath: /etc/kubeadm-config/\n \ securityContext:\n windowsOptions:\n hostProcess: true\n runAsUserName: \"NT AUTHORITY\\\\system\"\n containers:\n - \ - name: calico-node-startup\n image: sigwindowstools/calico-node:v3.25.0-hostprocess\n + \ - name: calico-node-startup\n image: sigwindowstools/calico-node:v3.25.1-hostprocess\n \ args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/node-service.ps1\"]\n \ workingDir: \"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/\"\n imagePullPolicy: Always\n volumeMounts:\n - name: calico-config-windows\n mountPath: @@ -701,7 +687,7 @@ data: name: CNI_IPAM_TYPE\n value: \"calico-ipam\"\n - name: CALICO_NETWORKING_BACKEND\n \ value: \"vxlan\"\n - name: KUBECONFIG\n value: \"C:/etc/cni/net.d/calico-kubeconfig\"\n \ - name: VXLAN_VNI\n value: \"4096\"\n - name: calico-node-felix\n - \ image: sigwindowstools/calico-node:v3.25.0-hostprocess\n args: + \ image: sigwindowstools/calico-node:v3.25.1-hostprocess\n args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/felix-service.ps1\"]\n imagePullPolicy: Always\n workingDir: \"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/\"\n volumeMounts:\n \ - name: calico-config-windows\n mountPath: /etc/kube-calico-windows/\n @@ -716,7 +702,30 @@ data: \ configMap:\n name: calico-static-rules\n # Used to install CNI.\n - name: cni-bin-dir\n hostPath:\n path: /opt/cni/bin\n \ - name: cni-net-dir\n hostPath:\n path: /etc/cni/net.d\n - \ - name: kubeadm-config\n configMap:\n name: kubeadm-config\n" + \ - name: kubeadm-config\n configMap:\n name: kubeadm-config\n---\napiVersion: + apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n name: ipamconfigs.crd.projectcalico.org\nspec:\n + \ group: crd.projectcalico.org\n names:\n kind: IPAMConfig\n listKind: + IPAMConfigList\n plural: ipamconfigs\n singular: ipamconfig\n preserveUnknownFields: + false\n scope: Cluster\n versions:\n - name: v1\n schema:\n openAPIV3Schema:\n + \ properties:\n apiVersion:\n description: 'APIVersion + defines the versioned schema of this representation\n of an object. + Servers should convert recognized schemas to the latest\n internal + value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'\n + \ type: string\n kind:\n description: 'Kind is a + string value representing the REST resource this\n object represents. + Servers may infer this from the endpoint the client\n submits requests + to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'\n + \ type: string\n metadata:\n type: object\n spec:\n + \ description: IPAMConfigSpec contains the specification for an IPAMConfig\n + \ resource.\n properties:\n autoAllocateBlocks:\n + \ type: boolean\n maxBlocksPerHost:\n description: + MaxBlocksPerHost, if non-zero, is the max number of blocks\n that + can be affine to each host.\n maximum: 2147483647\n minimum: + 0\n type: integer\n strictAffinity:\n type: + boolean\n required:\n - autoAllocateBlocks\n - + strictAffinity\n type: object\n type: object\n served: true\n + \ storage: true\nstatus:\n acceptedNames:\n kind: \"\"\n plural: \"\"\n + \ conditions: []\n storedVersions: []\n" kind: ConfigMap metadata: annotations: @@ -1041,7 +1050,7 @@ data: - --kubelet-use-node-status-port - --metric-resolution=15s - --kubelet-insecure-tls - image: k8s.gcr.io/metrics-server/metrics-server:v0.6.2 + image: registry.k8s.io/metrics-server/metrics-server:v0.6.3 imagePullPolicy: IfNotPresent livenessProbe: failureThreshold: 3 diff --git a/templates/test/dev/custom-builds-machine-pool/kustomization.yaml b/templates/test/dev/custom-builds-machine-pool/kustomization.yaml index 24b8a07b388..d13059993e6 100644 --- a/templates/test/dev/custom-builds-machine-pool/kustomization.yaml +++ b/templates/test/dev/custom-builds-machine-pool/kustomization.yaml @@ -1,6 +1,26 @@ namespace: default resources: - - ../../../test/ci/prow-intree-cloud-provider-machine-pool + - ../../../test/ci/prow-machine-pool patchesStrategicMerge: - ../patches/control-plane-custom-builds.yaml + - patches/machine-pool-deployment-pr-version-windows.yaml - patches/custom-builds.yaml +patches: + - target: + group: bootstrap.cluster.x-k8s.io + version: v1beta1 + kind: KubeadmConfig + name: .*-mp-win + namespace: default + path: patches/kubeadm-bootstrap-machine-pool-windows-k8s-pr-binaries.yaml +configMapGenerator: + - name: cni-${CLUSTER_NAME}-calico-windows + behavior: merge + files: + - kube-proxy-patch=../../../test/ci/patches/windows-kubeproxy-ci.yaml +generatorOptions: + disableNameSuffixHash: true + labels: + type: generated + annotations: + note: generated diff --git a/templates/test/dev/custom-builds-machine-pool/patches/custom-builds.yaml b/templates/test/dev/custom-builds-machine-pool/patches/custom-builds.yaml index 046a3c93ffa..35ed58af3fd 100644 --- a/templates/test/dev/custom-builds-machine-pool/patches/custom-builds.yaml +++ b/templates/test/dev/custom-builds-machine-pool/patches/custom-builds.yaml @@ -16,11 +16,13 @@ spec: set -o pipefail set -o errexit + systemctl stop kubelet declare -a BINARIES=("kubeadm" "kubectl" "kubelet") for BINARY in "$${BINARIES[@]}"; do echo "* installing package: $${BINARY} ${KUBE_GIT_VERSION}" curl --retry 10 --retry-delay 5 "https://${AZURE_STORAGE_ACCOUNT}.blob.core.windows.net/${JOB_NAME}/${KUBE_GIT_VERSION}/bin/linux/amd64/$${BINARY}" --output "/usr/bin/$${BINARY}" done + systemctl restart kubelet echo "kubeadm version: $(kubeadm version -o=short)" echo "kubectl version: $(kubectl version --client=true --short=true)" @@ -45,5 +47,5 @@ spec: marketplace: publisher: cncf-upstream offer: capi - sku: ubuntu-1804-gen1 + sku: ubuntu-2204-gen1 version: latest diff --git a/templates/test/dev/custom-builds-machine-pool/patches/kubeadm-bootstrap-machine-pool-windows-k8s-pr-binaries.yaml b/templates/test/dev/custom-builds-machine-pool/patches/kubeadm-bootstrap-machine-pool-windows-k8s-pr-binaries.yaml new file mode 100644 index 00000000000..15328d7eff0 --- /dev/null +++ b/templates/test/dev/custom-builds-machine-pool/patches/kubeadm-bootstrap-machine-pool-windows-k8s-pr-binaries.yaml @@ -0,0 +1,35 @@ +- op: add + path: /spec/files/- + value: + content: | + $ErrorActionPreference = 'Stop' + + Stop-Service kubelet -Force + + $$KUBE_GIT_VERSION="${KUBE_GIT_VERSION}" + if($$KUBE_GIT_VERSION -ne "") + { + $$binaries=@("kubeadm", "kubectl", "kubelet", "kube-proxy") + $$ci_url="https://${AZURE_STORAGE_ACCOUNT}.blob.core.windows.net/${JOB_NAME}/${KUBE_GIT_VERSION}/bin/windows/amd64" + foreach ( $$binary in $$binaries ) + { + echo "downloading binary: $$ci_url/$$binary.exe" + curl.exe --retry 10 --retry-delay 5 "$$ci_url/$$binary.exe" --output "c:/k/$$binary.exe" + } + } + + # Tag it to the ci version. The image knows how to use the copy locally with the configmap + # that is applied at at this stage (windows-kubeproxy-ci.yaml) + ctr.exe -n k8s.io images pull docker.io/sigwindowstools/kube-proxy:v1.23.1-calico-hostprocess + ctr.exe -n k8s.io images tag docker.io/sigwindowstools/kube-proxy:v1.23.1-calico-hostprocess "docker.io/sigwindowstools/kube-proxy:${CI_VERSION/+/_}-calico-hostprocess" + + kubeadm.exe version -o=short + kubectl.exe version --client=true --short=true + kubelet.exe --version + kube-proxy.exe --version + path: C:/replace-pr-binaries.ps1 + permissions: "0744" +- op: add + path: /spec/preKubeadmCommands/- + value: + powershell C:/replace-pr-binaries.ps1 diff --git a/templates/test/dev/custom-builds-machine-pool/patches/machine-pool-deployment-pr-version-windows.yaml b/templates/test/dev/custom-builds-machine-pool/patches/machine-pool-deployment-pr-version-windows.yaml new file mode 100644 index 00000000000..a18713bbeb2 --- /dev/null +++ b/templates/test/dev/custom-builds-machine-pool/patches/machine-pool-deployment-pr-version-windows.yaml @@ -0,0 +1,14 @@ +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +kind: AzureMachinePool +metadata: + name: ${CLUSTER_NAME}-mp-win +spec: + template: + image: + # we use the latest image as a workaround there is no published marketplace image for k8s CI versions. + # latest binaries and images will get replaced to the desired version by the script above. + marketplace: + publisher: cncf-upstream + offer: capi-windows + sku: ${WINDOWS_SERVER_VERSION:=windows-2019}-containerd-gen1 + version: latest diff --git a/templates/test/dev/custom-builds/kustomization.yaml b/templates/test/dev/custom-builds/kustomization.yaml index f11ae217124..f45bff7e326 100644 --- a/templates/test/dev/custom-builds/kustomization.yaml +++ b/templates/test/dev/custom-builds/kustomization.yaml @@ -1,11 +1,11 @@ namespace: default resources: - - ../../../test/ci/prow-intree-cloud-provider + - ../../../test/ci/prow - ../../../addons/metrics-server/metrics-server-resource-set.yaml patchesStrategicMerge: - patches/machine-deployment-pr-version.yaml - patches/machine-deployment-pr-version-windows.yaml - - ../../../test/ci/patches/windows-containerd-patch.yaml + - ../../../test/ci/patches/windows-feature-gates.yaml - ../../../test/ci/patches/windows-containerd-labels.yaml - ../../../test/ci/patches/machine-deployment-worker-counts.yaml - ../../../test/ci/patches/metrics-server-enabled-cluster.yaml diff --git a/templates/test/dev/custom-builds/patches/kubeadm-bootstrap.yaml b/templates/test/dev/custom-builds/patches/kubeadm-bootstrap.yaml index 18b5a679f49..42be3a83049 100644 --- a/templates/test/dev/custom-builds/patches/kubeadm-bootstrap.yaml +++ b/templates/test/dev/custom-builds/patches/kubeadm-bootstrap.yaml @@ -8,11 +8,13 @@ set -o pipefail set -o errexit + systemctl stop kubelet declare -a BINARIES=("kubeadm" "kubectl" "kubelet") for BINARY in "$${BINARIES[@]}"; do echo "* installing package: $${BINARY} ${KUBE_GIT_VERSION}" curl --retry 10 --retry-delay 5 "https://${AZURE_STORAGE_ACCOUNT}.blob.core.windows.net/${JOB_NAME}/${KUBE_GIT_VERSION}/bin/linux/amd64/$${BINARY}" --output "/usr/bin/$${BINARY}" done + systemctl restart kubelet echo "kubeadm version: $(kubeadm version -o=short)" echo "kubectl version: $(kubectl version --client=true --short=true)" diff --git a/templates/test/dev/custom-builds/patches/kubeadm-controlplane-bootstrap.yaml b/templates/test/dev/custom-builds/patches/kubeadm-controlplane-bootstrap.yaml index 83afc7cb204..85d67a7f03b 100644 --- a/templates/test/dev/custom-builds/patches/kubeadm-controlplane-bootstrap.yaml +++ b/templates/test/dev/custom-builds/patches/kubeadm-controlplane-bootstrap.yaml @@ -8,11 +8,13 @@ set -o pipefail set -o errexit + systemctl stop kubelet declare -a BINARIES=("kubeadm" "kubectl" "kubelet") for BINARY in "$${BINARIES[@]}"; do echo "* installing package: $${BINARY} ${KUBE_GIT_VERSION}" curl --retry 10 --retry-delay 5 "https://${AZURE_STORAGE_ACCOUNT}.blob.core.windows.net/${JOB_NAME}/${KUBE_GIT_VERSION}/bin/linux/amd64/$${BINARY}" --output "/usr/bin/$${BINARY}" done + systemctl restart kubelet # prepull images from gcr.io/k8s-staging-ci-images and retag it to # registry.k8s.io so kubeadm can fetch correct images no matter what @@ -45,11 +47,11 @@ rm /tmp/yq_linux_amd64.tar.gz export KUBECONFIG=/etc/kubernetes/admin.conf - kubectl -n kube-system set image daemonset/kube-proxy kube-proxy="${REGISTRY}/kube-proxy:${IMAGE_TAG}" + kubectl -n kube-system set image daemonset/kube-proxy kube-proxy="${REGISTRY}/kube-proxy:${KUBE_IMAGE_TAG}" systemctl stop kubelet - yq e '.spec.containers[0].image = "${REGISTRY}/kube-apiserver:${IMAGE_TAG}"' -i /etc/kubernetes/manifests/kube-apiserver.yaml - yq e '.spec.containers[0].image = "${REGISTRY}/kube-controller-manager:${IMAGE_TAG}"' -i /etc/kubernetes/manifests/kube-controller-manager.yaml - yq e '.spec.containers[0].image = "${REGISTRY}/kube-scheduler:${IMAGE_TAG}"' -i /etc/kubernetes/manifests/kube-scheduler.yaml + yq e '.spec.containers[0].image = "${REGISTRY}/kube-apiserver:${KUBE_IMAGE_TAG}"' -i /etc/kubernetes/manifests/kube-apiserver.yaml + yq e '.spec.containers[0].image = "${REGISTRY}/kube-controller-manager:${KUBE_IMAGE_TAG}"' -i /etc/kubernetes/manifests/kube-controller-manager.yaml + yq e '.spec.containers[0].image = "${REGISTRY}/kube-scheduler:${KUBE_IMAGE_TAG}"' -i /etc/kubernetes/manifests/kube-scheduler.yaml systemctl restart kubelet path: /tmp/replace-k8s-components.sh owner: "root:root" diff --git a/templates/test/dev/custom-builds/patches/machine-deployment-pr-version.yaml b/templates/test/dev/custom-builds/patches/machine-deployment-pr-version.yaml index c6ca5b53d5f..8e9b0bc0233 100644 --- a/templates/test/dev/custom-builds/patches/machine-deployment-pr-version.yaml +++ b/templates/test/dev/custom-builds/patches/machine-deployment-pr-version.yaml @@ -11,7 +11,7 @@ spec: marketplace: publisher: cncf-upstream offer: capi - sku: ubuntu-1804-gen1 + sku: ubuntu-2204-gen1 version: latest --- apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 @@ -27,7 +27,7 @@ spec: marketplace: publisher: cncf-upstream offer: capi - sku: ubuntu-1804-gen1 + sku: ubuntu-2204-gen1 version: latest --- apiVersion: controlplane.cluster.x-k8s.io/v1beta1 diff --git a/templates/test/dev/patches/control-plane-custom-builds.yaml b/templates/test/dev/patches/control-plane-custom-builds.yaml index 883c0fadeae..d9bc88d4b94 100644 --- a/templates/test/dev/patches/control-plane-custom-builds.yaml +++ b/templates/test/dev/patches/control-plane-custom-builds.yaml @@ -24,11 +24,13 @@ spec: set -o pipefail set -o errexit + systemctl stop kubelet declare -a BINARIES=("kubeadm" "kubectl" "kubelet") for BINARY in "$${BINARIES[@]}"; do echo "* installing package: $${BINARY} ${KUBE_GIT_VERSION}" curl --retry 10 --retry-delay 5 "https://${AZURE_STORAGE_ACCOUNT}.blob.core.windows.net/${JOB_NAME}/${KUBE_GIT_VERSION}/bin/linux/amd64/$${BINARY}" --output "/usr/bin/$${BINARY}" done + systemctl restart kubelet # prepull images from gcr.io/k8s-staging-ci-images and retag it to # registry.k8s.io so kubeadm can fetch correct images no matter what @@ -58,11 +60,11 @@ spec: rm /tmp/yq_linux_amd64.tar.gz export KUBECONFIG=/etc/kubernetes/admin.conf - kubectl -n kube-system set image daemonset/kube-proxy kube-proxy="${REGISTRY}/kube-proxy:${IMAGE_TAG}" + kubectl -n kube-system set image daemonset/kube-proxy kube-proxy="${REGISTRY}/kube-proxy:${KUBE_IMAGE_TAG}" systemctl stop kubelet - yq e '.spec.containers[0].image = "${REGISTRY}/kube-apiserver:${IMAGE_TAG}"' -i /etc/kubernetes/manifests/kube-apiserver.yaml - yq e '.spec.containers[0].image = "${REGISTRY}/kube-controller-manager:${IMAGE_TAG}"' -i /etc/kubernetes/manifests/kube-controller-manager.yaml - yq e '.spec.containers[0].image = "${REGISTRY}/kube-scheduler:${IMAGE_TAG}"' -i /etc/kubernetes/manifests/kube-scheduler.yaml + yq e '.spec.containers[0].image = "${REGISTRY}/kube-apiserver:${KUBE_IMAGE_TAG}"' -i /etc/kubernetes/manifests/kube-apiserver.yaml + yq e '.spec.containers[0].image = "${REGISTRY}/kube-controller-manager:${KUBE_IMAGE_TAG}"' -i /etc/kubernetes/manifests/kube-controller-manager.yaml + yq e '.spec.containers[0].image = "${REGISTRY}/kube-scheduler:${KUBE_IMAGE_TAG}"' -i /etc/kubernetes/manifests/kube-scheduler.yaml systemctl restart kubelet - path: /etc/kubernetes/azure.json owner: "root:root" @@ -85,5 +87,5 @@ spec: marketplace: publisher: cncf-upstream offer: capi - sku: ubuntu-1804-gen1 + sku: ubuntu-2204-gen1 version: latest diff --git a/test/e2e/aks.go b/test/e2e/aks.go index 1a189a2e476..5ab766e8f4b 100644 --- a/test/e2e/aks.go +++ b/test/e2e/aks.go @@ -176,7 +176,7 @@ func WaitForAKSSystemNodePoolMachinesToExist(ctx context.Context, input WaitForC opt1 := client.InNamespace(input.Namespace) opt2 := client.MatchingLabels(map[string]string{ infrav1.LabelAgentPoolMode: string(infrav1.NodePoolModeSystem), - clusterv1.ClusterLabelName: input.ClusterName, + clusterv1.ClusterNameLabel: input.ClusterName, }) ammpList := &infrav1.AzureManagedMachinePoolList{} diff --git a/test/e2e/aks_versions.go b/test/e2e/aks_versions.go index 1952d220932..141948db61b 100644 --- a/test/e2e/aks_versions.go +++ b/test/e2e/aks_versions.go @@ -64,7 +64,7 @@ func byClusterOptions(name, namespace string) []client.ListOption { return []client.ListOption{ client.InNamespace(namespace), client.MatchingLabels{ - clusterv1.ClusterLabelName: name, + clusterv1.ClusterNameLabel: name, }, } } diff --git a/test/e2e/azure_edgezone.go b/test/e2e/azure_edgezone.go index 71cfe699321..e10d579075e 100644 --- a/test/e2e/azure_edgezone.go +++ b/test/e2e/azure_edgezone.go @@ -23,8 +23,8 @@ import ( "context" "strings" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-11-01/compute" - azureautorest "github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure/auth" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -65,8 +65,8 @@ func AzureEdgeZoneClusterSpec(ctx context.Context, inputGetter func() AzureEdgeZ By("Retrieving all machines from the machine template spec") machineList := &infrav1.AzureMachineList{} // list all of the requested objects within the cluster namespace with the cluster name label - Logf("Listing machines in namespace %s with label %s=%s", input.Namespace.Name, clusterv1.ClusterLabelName, workloadClusterProxy.GetName()) - err := mgmtClient.List(ctx, machineList, client.InNamespace(input.Namespace.Name), client.MatchingLabels{clusterv1.ClusterLabelName: workloadClusterProxy.GetName()}) + Logf("Listing machines in namespace %s with label %s=%s", input.Namespace.Name, clusterv1.ClusterNameLabel, workloadClusterProxy.GetName()) + err := mgmtClient.List(ctx, machineList, client.InNamespace(input.Namespace.Name), client.MatchingLabels{clusterv1.ClusterNameLabel: workloadClusterProxy.GetName()}) Expect(err).NotTo(HaveOccurred()) By("Getting extendedLocation Name and Type from environment variables or e2e config file") @@ -88,10 +88,10 @@ func AzureEdgeZoneClusterSpec(ctx context.Context, inputGetter func() AzureEdgeZ // get the resource group name resourceID := strings.TrimPrefix(*machineList.Items[0].Spec.ProviderID, azure.ProviderIDPrefix) - resource, err := azureautorest.ParseResourceID(resourceID) + resource, err := arm.ParseResourceID(resourceID) Expect(err).NotTo(HaveOccurred()) - vmListResults, err := vmClient.List(ctx, resource.ResourceGroup, "") + vmListResults, err := vmClient.List(ctx, resource.ResourceGroupName, "") Expect(err).NotTo(HaveOccurred()) By("Verifying VMs' extendedLocation property is correct") diff --git a/test/e2e/azure_logcollector.go b/test/e2e/azure_logcollector.go index dd11c506235..89ed9619675 100644 --- a/test/e2e/azure_logcollector.go +++ b/test/e2e/azure_logcollector.go @@ -28,8 +28,8 @@ import ( "strings" "time" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-11-01/compute" - azureautorest "github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure/auth" "github.com/pkg/errors" apierrors "k8s.io/apimachinery/pkg/api/errors" @@ -144,7 +144,7 @@ func collectLogsFromNode(cluster *clusterv1.Cluster, hostname string, isWindows return err } defer f.Close() - return execOnHost(controlPlaneEndpoint, hostname, sshPort, f, command, args...) + return execOnHost(controlPlaneEndpoint, hostname, sshPort, collectLogTimeout, f, command, args...) }) } } @@ -156,7 +156,7 @@ func collectLogsFromNode(cluster *clusterv1.Cluster, hostname string, isWindows errors = append(errors, kinderrors.AggregateConcurrent(windowsK8sLogs(execToPathFn))) errors = append(errors, kinderrors.AggregateConcurrent(windowsNetworkLogs(execToPathFn))) errors = append(errors, kinderrors.AggregateConcurrent(windowsCrashDumpLogs(execToPathFn))) - errors = append(errors, sftpCopyFile(controlPlaneEndpoint, hostname, sshPort, "/c:/crashdumps.tar", filepath.Join(outputPath, "crashdumps.tar"))) + errors = append(errors, sftpCopyFile(controlPlaneEndpoint, hostname, sshPort, collectLogTimeout, "/c:/crashdumps.tar", filepath.Join(outputPath, "crashdumps.tar"))) return kinderrors.NewAggregate(errors) } @@ -402,7 +402,7 @@ func collectVMBootLog(ctx context.Context, am *infrav1.AzureMachine, outputPath } resourceID := strings.TrimPrefix(*am.Spec.ProviderID, azure.ProviderIDPrefix) - resource, err := azureautorest.ParseResourceID(resourceID) + resource, err := arm.ParseResourceID(resourceID) if err != nil { return errors.Wrap(err, "failed to parse resource id") } @@ -418,7 +418,7 @@ func collectVMBootLog(ctx context.Context, am *infrav1.AzureMachine, outputPath return errors.Wrap(err, "failed to get authorizer") } - bootDiagnostics, err := vmClient.RetrieveBootDiagnosticsData(ctx, resource.ResourceGroup, resource.ResourceName, nil) + bootDiagnostics, err := vmClient.RetrieveBootDiagnosticsData(ctx, resource.ResourceGroupName, resource.Name, nil) if err != nil { return errors.Wrap(err, "failed to get boot diagnostics data") } @@ -432,12 +432,12 @@ func collectVMSSBootLog(ctx context.Context, providerID string, outputPath strin v := strings.Split(resourceID, "/") instanceID := v[len(v)-1] resourceID = strings.TrimSuffix(resourceID, "/virtualMachines/"+instanceID) - resource, err := azureautorest.ParseResourceID(resourceID) + resource, err := arm.ParseResourceID(resourceID) if err != nil { return errors.Wrap(err, "failed to parse resource id") } - Logf("Collecting boot logs for VMSS instance %s of scale set %s\n", instanceID, resource.ResourceName) + Logf("Collecting boot logs for VMSS instance %s of scale set %s\n", instanceID, resource.Name) settings, err := auth.GetSettingsFromEnvironment() if err != nil { @@ -450,7 +450,7 @@ func collectVMSSBootLog(ctx context.Context, providerID string, outputPath strin return errors.Wrap(err, "failed to get authorizer") } - bootDiagnostics, err := vmssClient.RetrieveBootDiagnosticsData(ctx, resource.ResourceGroup, resource.ResourceName, instanceID, nil) + bootDiagnostics, err := vmssClient.RetrieveBootDiagnosticsData(ctx, resource.ResourceGroupName, resource.Name, instanceID, nil) if err != nil { return errors.Wrap(err, "failed to get boot diagnostics data") } diff --git a/test/e2e/azure_machinepool_drain.go b/test/e2e/azure_machinepool_drain.go index 5c1a2ad68e1..8c301cc09b4 100644 --- a/test/e2e/azure_machinepool_drain.go +++ b/test/e2e/azure_machinepool_drain.go @@ -41,13 +41,16 @@ import ( expv1 "sigs.k8s.io/cluster-api/exp/api/v1beta1" "sigs.k8s.io/cluster-api/test/framework" "sigs.k8s.io/cluster-api/util" + "sigs.k8s.io/cluster-api/util/conditions" "sigs.k8s.io/cluster-api/util/patch" "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" ) const ( - AzureMachinePoolDrainSpecName = "azure-mp-drain" - waitforResourceOperationTimeout = 30 * time.Second + AzureMachinePoolDrainSpecName = "azure-mp-drain" + waitforResourceOperationTimeout = 30 * time.Second + azureMachinePoolMachineTestFinalizer = "azuremachinepoolmachine.infrastructure.cluster.x-k8s.io/test" ) // AzureMachinePoolDrainSpecInput is the input for AzureMachinePoolDrainSpec. @@ -76,7 +79,7 @@ func AzureMachinePoolDrainSpec(ctx context.Context, inputGetter func() AzureMach bootstrapClusterProxy = input.BootstrapClusterProxy workloadClusterProxy = input.BootstrapClusterProxy.GetWorkloadCluster(ctx, input.Namespace.Name, input.ClusterName) clientset = workloadClusterProxy.GetClientSet() - labels = map[string]string{clusterv1.ClusterLabelName: workloadClusterProxy.GetName()} + labels = map[string]string{clusterv1.ClusterNameLabel: workloadClusterProxy.GetName()} ) Expect(workloadClusterProxy).NotTo(BeNil()) @@ -145,10 +148,16 @@ func testMachinePoolCordonAndDrain(ctx context.Context, mgmtClusterProxy, worklo Expect(err).NotTo(HaveOccurred()) labelNodesWithMachinePoolName(ctx, workloadClusterProxy.GetClient(), amp.Name, ampmls) + By("adding the AzureMachinePoolMachine finalizer to the machine pool machines") + for i := range ampmls { + controllerutil.AddFinalizer(&mls[i], azureMachinePoolMachineTestFinalizer) + } + By(fmt.Sprintf("deploying a publicly exposed HTTP service with pod anti-affinity on machine pool: %s/%s", amp.Namespace, amp.Name)) _, _, _, cleanup := deployHTTPService(ctx, clientset, isWindows, customizers...) defer cleanup() + var decreasedReplicas int32 By(fmt.Sprintf("decreasing the replica count by 1 on the machine pool: %s/%s", amp.Namespace, amp.Name)) Eventually(func() error { helper, err := patch.NewHelper(owningMachinePool, mgmtClusterProxy.GetClient()) @@ -157,13 +166,39 @@ func testMachinePoolCordonAndDrain(ctx context.Context, mgmtClusterProxy, worklo return err } - decreasedReplicas := *owningMachinePool.Spec.Replicas - int32(1) + decreasedReplicas = *owningMachinePool.Spec.Replicas - int32(1) owningMachinePool.Spec.Replicas = &decreasedReplicas return helper.Patch(ctx, owningMachinePool) }, 3*time.Minute, 3*time.Second).Should(Succeed()) - // TODO setup a watcher to validate expected 2nd order drain outcomes - // https://github.com/kubernetes-sigs/cluster-api-provider-azure/issues/2159 + By(fmt.Sprintf("checking for a machine to start draining for machine pool: %s/%s", amp.Namespace, amp.Name)) + Eventually(func() error { + ampmls, err := getAzureMachinePoolMachines(ctx, mgmtClusterProxy, workloadClusterProxy, amp) + if err != nil { + LogWarning(errors.Wrap(err, "failed to list the azure machine pool machines").Error()) + return err + } + + for i := range ampmls { + if conditions.IsTrue(&mls[i], clusterv1.DrainingSucceededCondition) { + controllerutil.RemoveFinalizer(&mls[i], azureMachinePoolMachineTestFinalizer) + return nil // started draining the node prior to delete + } + } + + return errors.New("no machine has started to drain") + }, 10*time.Minute, 3*time.Second).Should(Succeed()) + + By(fmt.Sprintf("waiting for the machine pool to scale down to %d replicas: %s/%s", decreasedReplicas, amp.Namespace, amp.Name)) + Eventually(func() (int32, error) { + mp, err := getOwnerMachinePool(ctx, mgmtClusterProxy.GetClient(), amp.ObjectMeta) + if err != nil { + LogWarning(err.Error()) + return 0, err + } + + return int32(len(mp.Spec.ProviderIDList)), nil + }, 10*time.Minute, 3*time.Second).Should(Equal(decreasedReplicas)) } func labelNodesWithMachinePoolName(ctx context.Context, workloadClient client.Client, mpName string, ampms []infrav1exp.AzureMachinePoolMachine) { @@ -191,7 +226,7 @@ func labelNodesWithMachinePoolName(ctx context.Context, workloadClient client.Cl func getAzureMachinePoolMachines(ctx context.Context, mgmtClusterProxy, workloadClusterProxy framework.ClusterProxy, amp infrav1exp.AzureMachinePool) ([]infrav1exp.AzureMachinePoolMachine, error) { labels := map[string]string{ - clusterv1.ClusterLabelName: workloadClusterProxy.GetName(), + clusterv1.ClusterNameLabel: workloadClusterProxy.GetName(), infrav1exp.MachinePoolNameLabel: amp.Name, } ampml := &infrav1exp.AzureMachinePoolMachineList{} diff --git a/test/e2e/azure_machinepools.go b/test/e2e/azure_machinepools.go index bf588d97f82..5b70b2cc452 100644 --- a/test/e2e/azure_machinepools.go +++ b/test/e2e/azure_machinepools.go @@ -69,7 +69,7 @@ func AzureMachinePoolsSpec(ctx context.Context, inputGetter func() AzureMachineP var ( bootstrapClusterProxy = input.BootstrapClusterProxy workloadClusterProxy = bootstrapClusterProxy.GetWorkloadCluster(ctx, input.Namespace.Name, input.ClusterName) - clusterLabels = map[string]string{clusterv1.ClusterLabelName: workloadClusterProxy.GetName()} + clusterLabels = map[string]string{clusterv1.ClusterNameLabel: workloadClusterProxy.GetName()} ) Expect(workloadClusterProxy).NotTo(BeNil()) diff --git a/test/e2e/azure_privatecluster.go b/test/e2e/azure_privatecluster.go index 953d39c28d0..59eb92acc2b 100644 --- a/test/e2e/azure_privatecluster.go +++ b/test/e2e/azure_privatecluster.go @@ -26,12 +26,12 @@ import ( "path/filepath" "strings" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-11-01/compute" "github.com/Azure/azure-sdk-for-go/services/msi/mgmt/2018-11-30/msi" "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-08-01/network" "github.com/Azure/azure-sdk-for-go/services/privatedns/mgmt/2018-09-01/privatedns" "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-05-01/resources" - azureautorest "github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure/auth" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -421,14 +421,14 @@ func SetupExistingVNet(ctx context.Context, vnetCidr string, cpSubnetCidrs, node } func getAPIVersion(resourceID string) (string, error) { - parsed, err := azureautorest.ParseResourceID(resourceID) + parsed, err := arm.ParseResourceID(resourceID) if err != nil { return "", errors.Wrap(err, fmt.Sprintf("unable to parse resource ID %q", resourceID)) } switch parsed.Provider { case "Microsoft.Network": - if parsed.ResourceType == "privateDnsZones" { + if parsed.ResourceType.String() == "privateDnsZones" { return getAPIVersionFromUserAgent(privatedns.UserAgent()), nil } return getAPIVersionFromUserAgent(network.UserAgent()), nil @@ -455,10 +455,10 @@ func getClientIDforMSI(resourceID string) string { msiClient := msi.NewUserAssignedIdentitiesClient(subscriptionID) msiClient.Authorizer = authorizer - parsed, err := azureautorest.ParseResourceID(resourceID) + parsed, err := arm.ParseResourceID(resourceID) Expect(err).NotTo(HaveOccurred()) - id, err := msiClient.Get(context.TODO(), parsed.ResourceGroup, parsed.ResourceName) + id, err := msiClient.Get(context.TODO(), parsed.ResourceGroupName, parsed.Name) Expect(err).NotTo(HaveOccurred()) return id.ClientID.String() diff --git a/test/e2e/azure_selfhosted.go b/test/e2e/azure_selfhosted.go index f4cf6ef435f..b1bb9c1ca09 100644 --- a/test/e2e/azure_selfhosted.go +++ b/test/e2e/azure_selfhosted.go @@ -84,7 +84,7 @@ func SelfHostedSpec(ctx context.Context, inputGetter func() SelfHostedSpecInput) Name: "cluster-identity-secret", Namespace: namespace.Name, Labels: map[string]string{ - clusterctlv1.ClusterctlMoveHierarchyLabelName: "true", + clusterctlv1.ClusterctlMoveHierarchyLabel: "true", }, }, Type: corev1.SecretTypeOpaque, diff --git a/test/e2e/azure_test.go b/test/e2e/azure_test.go index 3f9b5483581..fcf9920170c 100644 --- a/test/e2e/azure_test.go +++ b/test/e2e/azure_test.go @@ -84,7 +84,7 @@ var _ = Describe("Workload cluster creation", func() { Name: "cluster-identity-secret", Namespace: defaultNamespace, Labels: map[string]string{ - clusterctlv1.ClusterctlMoveHierarchyLabelName: "true", + clusterctlv1.ClusterctlMoveHierarchyLabel: "true", }, }, Type: corev1.SecretTypeOpaque, @@ -213,7 +213,6 @@ var _ = Describe("Workload cluster creation", func() { // Opt into using windows with prow template Expect(os.Setenv("WINDOWS_WORKER_MACHINE_COUNT", "2")).To(Succeed()) - Expect(os.Setenv("K8S_FEATURE_GATES", "WindowsHostProcessContainers=true")).To(Succeed()) clusterctl.ApplyClusterTemplateAndWait(ctx, createApplyClusterTemplateInput( specName, @@ -298,7 +297,6 @@ var _ = Describe("Workload cluster creation", func() { Context("Creating a Flatcar cluster [OPTIONAL]", func() { It("With Flatcar control-plane and worker nodes", func() { clusterName = getClusterName(clusterNamePrefix, "flatcar") - clusterctl.ApplyClusterTemplateAndWait(ctx, createApplyClusterTemplateInput( specName, withFlavor("flatcar"), @@ -310,7 +308,27 @@ var _ = Describe("Workload cluster creation", func() { withControlPlaneWaiters(clusterctl.ControlPlaneWaiters{ WaitForControlPlaneInitialized: EnsureControlPlaneInitialized, }), + withPostMachinesProvisioned(func() { + EnsureDaemonsets(ctx, func() DaemonsetsSpecInput { + return DaemonsetsSpecInput{ + BootstrapClusterProxy: bootstrapClusterProxy, + Namespace: namespace, + ClusterName: clusterName, + } + }) + }), ), result) + + By("can create and access a load balancer", func() { + AzureLBSpec(ctx, func() AzureLBSpecInput { + return AzureLBSpecInput{ + BootstrapClusterProxy: bootstrapClusterProxy, + Namespace: namespace, + ClusterName: clusterName, + SkipCleanup: skipCleanup, + } + }) + }) }) }) @@ -374,7 +392,6 @@ var _ = Describe("Workload cluster creation", func() { // Opt into using windows with prow template Expect(os.Setenv("WINDOWS_WORKER_MACHINE_COUNT", "2")).To(Succeed()) - Expect(os.Setenv("K8S_FEATURE_GATES", "WindowsHostProcessContainers=true")).To(Succeed()) clusterctl.ApplyClusterTemplateAndWait(ctx, createApplyClusterTemplateInput( specName, @@ -433,17 +450,16 @@ var _ = Describe("Workload cluster creation", func() { }) }) - // TODO: Implement more robust cordon and drain test - // By("Cordon and draining a node", func() { - // AzureMachinePoolDrainSpec(ctx, func() AzureMachinePoolDrainSpecInput { - // return AzureMachinePoolDrainSpecInput{ - // BootstrapClusterProxy: bootstrapClusterProxy, - // Namespace: namespace, - // ClusterName: clusterName, - // SkipCleanup: skipCleanup, - // } - // }) - // }) + By("Cordon and draining a node", func() { + AzureMachinePoolDrainSpec(ctx, func() AzureMachinePoolDrainSpecInput { + return AzureMachinePoolDrainSpecInput{ + BootstrapClusterProxy: bootstrapClusterProxy, + Namespace: namespace, + ClusterName: clusterName, + SkipCleanup: skipCleanup, + } + }) + }) By("PASSED!") }) @@ -824,7 +840,6 @@ var _ = Describe("Workload cluster creation", func() { // Opt into using windows with prow template Expect(os.Setenv("WINDOWS_WORKER_MACHINE_COUNT", "1")).To(Succeed()) - Expect(os.Setenv("K8S_FEATURE_GATES", "WindowsHostProcessContainers=true")).To(Succeed()) // Create a cluster using the cluster class created above clusterctl.ApplyClusterTemplateAndWait(ctx, createApplyClusterTemplateInput( diff --git a/test/e2e/azure_vmextensions.go b/test/e2e/azure_vmextensions.go index 3bfabd8ee54..5f7a17ac378 100644 --- a/test/e2e/azure_vmextensions.go +++ b/test/e2e/azure_vmextensions.go @@ -23,8 +23,8 @@ import ( "context" "strings" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-11-01/compute" - azureautorest "github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure/auth" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -68,8 +68,8 @@ func AzureVMExtensionsSpec(ctx context.Context, inputGetter func() AzureVMExtens By("Retrieving all machines from the machine template spec") machineList := &infrav1.AzureMachineList{} // list all of the requested objects within the cluster namespace with the cluster name label - Logf("Listing machines in namespace %s with label %s=%s", input.Namespace.Name, clusterv1.ClusterLabelName, workloadClusterProxy.GetName()) - err := mgmtClient.List(ctx, machineList, client.InNamespace(input.Namespace.Name), client.MatchingLabels{clusterv1.ClusterLabelName: workloadClusterProxy.GetName()}) + Logf("Listing machines in namespace %s with label %s=%s", input.Namespace.Name, clusterv1.ClusterNameLabel, workloadClusterProxy.GetName()) + err := mgmtClient.List(ctx, machineList, client.InNamespace(input.Namespace.Name), client.MatchingLabels{clusterv1.ClusterNameLabel: workloadClusterProxy.GetName()}) Expect(err).NotTo(HaveOccurred()) // get subscription id @@ -99,15 +99,15 @@ func AzureVMExtensionsSpec(ctx context.Context, inputGetter func() AzureVMExtens // get the resource group name resourceID := strings.TrimPrefix(*machineList.Items[0].Spec.ProviderID, azure.ProviderIDPrefix) - resource, err := azureautorest.ParseResourceID(resourceID) + resource, err := arm.ParseResourceID(resourceID) Expect(err).NotTo(HaveOccurred()) - vmListResults, err := vmClient.List(ctx, resource.ResourceGroup, "") + vmListResults, err := vmClient.List(ctx, resource.ResourceGroupName, "") Expect(err).NotTo(HaveOccurred()) By("Verifying specified VM extensions are created on Azure") for _, machine := range vmListResults.Values() { - vmExtensionListResult, err := vmExtensionsClient.List(ctx, resource.ResourceGroup, *machine.Name, "") + vmExtensionListResult, err := vmExtensionsClient.List(ctx, resource.ResourceGroupName, *machine.Name, "") Expect(err).NotTo(HaveOccurred()) vmExtensionList := *vmExtensionListResult.Value var vmExtensionNames []string @@ -123,8 +123,8 @@ func AzureVMExtensionsSpec(ctx context.Context, inputGetter func() AzureVMExtens By("Retrieving all machine pools from the machine template spec") machinePoolList := &infrav1exp.AzureMachinePoolList{} // list all of the requested objects within the cluster namespace with the cluster name label - Logf("Listing machine pools in namespace %s with label %s=%s", input.Namespace.Name, clusterv1.ClusterLabelName, workloadClusterProxy.GetName()) - err = mgmtClient.List(ctx, machinePoolList, client.InNamespace(input.Namespace.Name), client.MatchingLabels{clusterv1.ClusterLabelName: workloadClusterProxy.GetName()}) + Logf("Listing machine pools in namespace %s with label %s=%s", input.Namespace.Name, clusterv1.ClusterNameLabel, workloadClusterProxy.GetName()) + err = mgmtClient.List(ctx, machinePoolList, client.InNamespace(input.Namespace.Name), client.MatchingLabels{clusterv1.ClusterNameLabel: workloadClusterProxy.GetName()}) Expect(err).NotTo(HaveOccurred()) if len(machinePoolList.Items) > 0 { @@ -147,15 +147,15 @@ func AzureVMExtensionsSpec(ctx context.Context, inputGetter func() AzureVMExtens // get the resource group name resourceID := strings.TrimPrefix(machinePoolList.Items[0].Spec.ProviderID, azure.ProviderIDPrefix) - resource, err := azureautorest.ParseResourceID(resourceID) + resource, err := arm.ParseResourceID(resourceID) Expect(err).NotTo(HaveOccurred()) - vmssListResults, err := vmssClient.List(ctx, resource.ResourceGroup) + vmssListResults, err := vmssClient.List(ctx, resource.ResourceGroupName) Expect(err).NotTo(HaveOccurred()) By("Verifying VMSS extensions are created on Azure") for _, machinePool := range vmssListResults.Values() { - vmssExtensionListResult, err := vmssExtensionsClient.List(ctx, resource.ResourceGroup, *machinePool.Name) + vmssExtensionListResult, err := vmssExtensionsClient.List(ctx, resource.ResourceGroupName, *machinePool.Name) Expect(err).NotTo(HaveOccurred()) vmssExtensionList := vmssExtensionListResult.Values() var vmssExtensionNames []string diff --git a/test/e2e/capi_test.go b/test/e2e/capi_test.go index 350a1a842b7..4c33107c020 100644 --- a/test/e2e/capi_test.go +++ b/test/e2e/capi_test.go @@ -25,7 +25,6 @@ import ( "os" "time" - "github.com/blang/semver" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" @@ -48,6 +47,7 @@ var _ = Describe("Running the Cluster API E2E tests", func() { ctx = context.TODO() identityNamespace *corev1.Namespace specTimes = map[string]time.Time{} + err error ) BeforeEach(func() { Expect(e2eConfig.Variables).To(HaveKey(capi_e2e.CNIPath)) @@ -56,13 +56,7 @@ var _ = Describe("Running the Cluster API E2E tests", func() { Expect(os.Setenv(AzureVNetName, fmt.Sprintf("%s-vnet", rgName))).To(Succeed()) Expect(e2eConfig.Variables).To(HaveKey(capi_e2e.KubernetesVersionUpgradeFrom)) - v, err := semver.ParseTolerant(e2eConfig.GetVariable(capi_e2e.KubernetesVersionUpgradeFrom)) - Expect(err).NotTo(HaveOccurred()) - // Opt into Windows for versions greater than or equal to 1.22 - if v.GTE(semver.MustParse("1.22.0")) { - Expect(os.Setenv("WINDOWS_WORKER_MACHINE_COUNT", "2")).To(Succeed()) - Expect(os.Setenv("K8S_FEATURE_GATES", "WindowsHostProcessContainers=true")).To(Succeed()) - } + Expect(os.Setenv("WINDOWS_WORKER_MACHINE_COUNT", "2")).To(Succeed()) clientset := bootstrapClusterProxy.GetClientSet() Expect(clientset).NotTo(BeNil()) @@ -77,7 +71,7 @@ var _ = Describe("Running the Cluster API E2E tests", func() { Name: IdentitySecretName, Namespace: identityNamespace.Name, Labels: map[string]string{ - clusterctlv1.ClusterctlMoveHierarchyLabelName: "true", + clusterctlv1.ClusterctlMoveHierarchyLabel: "true", }, }, Type: corev1.SecretTypeOpaque, @@ -154,9 +148,10 @@ var _ = Describe("Running the Cluster API E2E tests", func() { }) } - Context("Should successfully remediate unhealthy machines with MachineHealthCheck", func() { - capi_e2e.MachineRemediationSpec(context.TODO(), func() capi_e2e.MachineRemediationSpecInput { - return capi_e2e.MachineRemediationSpecInput{ + // TODO: Add test using KCPRemediationSpec + Context("Should successfully remediate unhealthy worker machines with MachineHealthCheck", func() { + capi_e2e.MachineDeploymentRemediationSpec(context.TODO(), func() capi_e2e.MachineDeploymentRemediationSpecInput { + return capi_e2e.MachineDeploymentRemediationSpecInput{ E2EConfig: e2eConfig, ClusterctlConfigPath: clusterctlConfigPath, BootstrapClusterProxy: bootstrapClusterProxy, @@ -217,9 +212,9 @@ var _ = Describe("Running the Cluster API E2E tests", func() { if os.Getenv("USE_LOCAL_KIND_REGISTRY") != "true" { Context("API Version Upgrade", func() { - Context("upgrade from v1alpha4 to v1beta1, and scale workload clusters created in v1alpha4", func() { + Context("upgrade from an old version of v1beta1 to current, and scale workload clusters created in the old version", func() { BeforeEach(func() { - // Unset resource group and vnet env variables, since we capi test creates 2 clusters, + // Unset resource group and vnet env variables, since the upgrade test creates 2 clusters, // and will result in both the clusters using the same vnet and resource group. Expect(os.Unsetenv(AzureResourceGroup)).To(Succeed()) Expect(os.Unsetenv(AzureVNetName)).To(Succeed()) @@ -227,18 +222,25 @@ var _ = Describe("Running the Cluster API E2E tests", func() { // Unset windows specific variables Expect(os.Unsetenv("WINDOWS_WORKER_MACHINE_COUNT")).To(Succeed()) + Expect(os.Setenv("K8S_FEATURE_GATES", "WindowsHostProcessContainers=true")).To(Succeed()) }) capi_e2e.ClusterctlUpgradeSpec(ctx, func() capi_e2e.ClusterctlUpgradeSpecInput { return capi_e2e.ClusterctlUpgradeSpecInput{ - E2EConfig: e2eConfig, - ClusterctlConfigPath: clusterctlConfigPath, - BootstrapClusterProxy: bootstrapClusterProxy, - ArtifactFolder: artifactFolder, - SkipCleanup: skipCleanup, - PreInit: getPreInitFunc(ctx), + E2EConfig: e2eConfig, + ClusterctlConfigPath: clusterctlConfigPath, + BootstrapClusterProxy: bootstrapClusterProxy, + ArtifactFolder: artifactFolder, + SkipCleanup: skipCleanup, + PreInit: getPreInitFunc(ctx), + InitWithProvidersContract: "v1beta1", ControlPlaneWaiters: clusterctl.ControlPlaneWaiters{ WaitForControlPlaneInitialized: EnsureControlPlaneInitialized, }, + InitWithBinary: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.0.5/clusterctl-{OS}-{ARCH}", + InitWithCoreProvider: "cluster-api:v1.0.5", + InitWithBootstrapProviders: []string{"kubeadm:v1.0.5"}, + InitWithControlPlaneProviders: []string{"kubeadm:v1.0.5"}, + InitWithInfrastructureProviders: []string{"azure:v1.0.2"}, } }) }) @@ -307,7 +309,7 @@ func getPreInitFunc(ctx context.Context) func(proxy framework.ClusterProxy) { Name: IdentitySecretName, Namespace: "default", Labels: map[string]string{ - clusterctlv1.ClusterctlMoveHierarchyLabelName: "true", + clusterctlv1.ClusterctlMoveHierarchyLabel: "true", }, }, Type: corev1.SecretTypeOpaque, diff --git a/test/e2e/cloud-provider-azure.go b/test/e2e/cloud-provider-azure.go index 92a1ab554d6..6d4d4224d5f 100644 --- a/test/e2e/cloud-provider-azure.go +++ b/test/e2e/cloud-provider-azure.go @@ -45,21 +45,28 @@ func InstallCalicoAndCloudProviderAzureHelmChart(ctx context.Context, input clus specName := "cloud-provider-azure-install" By("Installing cloud-provider-azure components via helm") options := &helmVals.Options{ - Values: []string{fmt.Sprintf("infra.clusterName=%s", input.ConfigCluster.ClusterName)}, + Values: []string{ + fmt.Sprintf("infra.clusterName=%s", input.ConfigCluster.ClusterName), + "cloudControllerManager.logVerbosity=4", + }, StringValues: []string{fmt.Sprintf("cloudControllerManager.clusterCIDR=%s", strings.Join(cidrBlocks, `\,`))}, } // If testing a CI version of Kubernetes, use CCM and CNM images built from source. - if useCIArtifacts { + if useCIArtifacts || usePRArtifacts { options.Values = append(options.Values, fmt.Sprintf("cloudControllerManager.imageName=%s", os.Getenv("CCM_IMAGE_NAME"))) options.Values = append(options.Values, fmt.Sprintf("cloudNodeManager.imageName=%s", os.Getenv("CNM_IMAGE_NAME"))) options.Values = append(options.Values, fmt.Sprintf("cloudControllerManager.imageRepository=%s", os.Getenv("IMAGE_REGISTRY"))) options.Values = append(options.Values, fmt.Sprintf("cloudNodeManager.imageRepository=%s", os.Getenv("IMAGE_REGISTRY"))) - options.StringValues = append(options.StringValues, fmt.Sprintf("cloudControllerManager.imageTag=%s", os.Getenv("IMAGE_TAG"))) - options.StringValues = append(options.StringValues, fmt.Sprintf("cloudNodeManager.imageTag=%s", os.Getenv("IMAGE_TAG"))) + options.StringValues = append(options.StringValues, fmt.Sprintf("cloudControllerManager.imageTag=%s", os.Getenv("IMAGE_TAG_CCM"))) + options.StringValues = append(options.StringValues, fmt.Sprintf("cloudNodeManager.imageTag=%s", os.Getenv("IMAGE_TAG_CNM"))) + } + + if input.ConfigCluster.Flavor == "flatcar" { + options.StringValues = append(options.StringValues, "cloudControllerManager.caCertDir=/usr/share/ca-certificates") } clusterProxy := input.ClusterProxy.GetWorkloadCluster(ctx, input.ConfigCluster.Namespace, input.ConfigCluster.ClusterName) - InstallHelmChart(ctx, clusterProxy, defaultNamespace, cloudProviderAzureHelmRepoURL, cloudProviderAzureChartName, cloudProviderAzureHelmReleaseName, options) + InstallHelmChart(ctx, clusterProxy, defaultNamespace, cloudProviderAzureHelmRepoURL, cloudProviderAzureChartName, cloudProviderAzureHelmReleaseName, options, "") // Install Calico CNI Helm Chart. We do this before waiting for the pods to be ready because there is a co-dependency between CNI (nodes ready) and cloud-provider being initialized. InstallCalicoHelmChart(ctx, input, cidrBlocks, hasWindows) @@ -83,7 +90,7 @@ func InstallAzureDiskCSIDriverHelmChart(ctx context.Context, input clusterctl.Ap options.Values = append(options.Values, "windows.useHostProcessContainers=true") } clusterProxy := input.ClusterProxy.GetWorkloadCluster(ctx, input.ConfigCluster.Namespace, input.ConfigCluster.ClusterName) - InstallHelmChart(ctx, clusterProxy, kubesystem, azureDiskCSIDriverHelmRepoURL, azureDiskCSIDriverChartName, azureDiskCSIDriverHelmReleaseName, options) + InstallHelmChart(ctx, clusterProxy, kubesystem, azureDiskCSIDriverHelmRepoURL, azureDiskCSIDriverChartName, azureDiskCSIDriverHelmReleaseName, options, "") By("Waiting for Ready csi-azuredisk-controller deployment pods") for _, d := range []string{"csi-azuredisk-controller"} { waitInput := GetWaitForDeploymentsAvailableInput(ctx, clusterProxy, d, kubesystem, specName) diff --git a/test/e2e/cni.go b/test/e2e/cni.go index 4cc41302588..4be3bda5401 100644 --- a/test/e2e/cni.go +++ b/test/e2e/cni.go @@ -22,6 +22,7 @@ package e2e import ( "context" "fmt" + "os" "path/filepath" . "github.com/onsi/ginkgo/v2" @@ -49,7 +50,7 @@ func InstallCalicoHelmChart(ctx context.Context, input clusterctl.ApplyClusterTe By("Installing Calico CNI via helm") values := getCalicoValues(cidrBlocks) clusterProxy := input.ClusterProxy.GetWorkloadCluster(ctx, input.ConfigCluster.Namespace, input.ConfigCluster.ClusterName) - InstallHelmChart(ctx, clusterProxy, calicoOperatorNamespace, calicoHelmChartRepoURL, calicoHelmChartName, calicoHelmReleaseName, values) + InstallHelmChart(ctx, clusterProxy, calicoOperatorNamespace, calicoHelmChartRepoURL, calicoHelmChartName, calicoHelmReleaseName, values, os.Getenv(CalicoVersion)) workloadClusterClient := clusterProxy.GetClient() // Copy the kubeadm configmap to the calico-system namespace. This is a workaround needed for the calico-node-windows daemonset to be able to run in the calico-system namespace. diff --git a/test/e2e/common.go b/test/e2e/common.go index 996e9e0281f..bb60404fd38 100644 --- a/test/e2e/common.go +++ b/test/e2e/common.go @@ -32,6 +32,7 @@ import ( "github.com/Azure/go-autorest/autorest/azure/auth" "github.com/blang/semver" . "github.com/onsi/ginkgo/v2" + "github.com/onsi/ginkgo/v2/types" . "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" @@ -83,6 +84,7 @@ const ( FlatcarVersion = "FLATCAR_VERSION" SecurityScanFailThreshold = "SECURITY_SCAN_FAIL_THRESHOLD" SecurityScanContainer = "SECURITY_SCAN_CONTAINER" + CalicoVersion = "CALICO_VERSION" ManagedClustersResourceType = "managedClusters" capiImagePublisher = "cncf-upstream" capiOfferName = "capi" @@ -294,10 +296,10 @@ func EnsureControlPlaneInitialized(ctx context.Context, input clusterctl.ApplyCl // CheckTestBeforeCleanup checks to see if the current running Ginkgo test failed, and prints // a status message regarding cleanup. func CheckTestBeforeCleanup() { - if CurrentGinkgoTestDescription().Failed { + if CurrentSpecReport().State.Is(types.SpecStateFailureStates) { Logf("FAILED!") } - Logf("Cleaning up after \"%s\" spec", CurrentGinkgoTestDescription().FullTestText) + Logf("Cleaning up after \"%s\" spec", CurrentSpecReport().FullText()) } func discoveryAndWaitForControlPlaneInitialized(ctx context.Context, input clusterctl.ApplyClusterTemplateAndWaitInput, result *clusterctl.ApplyClusterTemplateAndWaitResult) *kubeadmv1.KubeadmControlPlane { @@ -319,8 +321,8 @@ func createApplyClusterTemplateInput(specName string, changes ...func(*clusterct Namespace: "default", ClusterName: "cluster", KubernetesVersion: e2eConfig.GetVariable(capi_e2e.KubernetesVersion), - ControlPlaneMachineCount: pointer.Int64Ptr(1), - WorkerMachineCount: pointer.Int64Ptr(1), + ControlPlaneMachineCount: pointer.Int64(1), + WorkerMachineCount: pointer.Int64(1), }, WaitForClusterIntervals: e2eConfig.GetIntervals(specName, "wait-cluster"), WaitForControlPlaneIntervals: e2eConfig.GetIntervals(specName, "wait-control-plane"), @@ -365,13 +367,13 @@ func withKubernetesVersion(version string) func(*clusterctl.ApplyClusterTemplate func withControlPlaneMachineCount(count int64) func(*clusterctl.ApplyClusterTemplateAndWaitInput) { return func(input *clusterctl.ApplyClusterTemplateAndWaitInput) { - input.ConfigCluster.ControlPlaneMachineCount = pointer.Int64Ptr(count) + input.ConfigCluster.ControlPlaneMachineCount = pointer.Int64(count) } } func withWorkerMachineCount(count int64) func(*clusterctl.ApplyClusterTemplateAndWaitInput) { return func(input *clusterctl.ApplyClusterTemplateAndWaitInput) { - input.ConfigCluster.WorkerMachineCount = pointer.Int64Ptr(count) + input.ConfigCluster.WorkerMachineCount = pointer.Int64(count) } } diff --git a/test/e2e/config/azure-dev.yaml b/test/e2e/config/azure-dev.yaml index 0a2b7256bef..7a44c9efb50 100644 --- a/test/e2e/config/azure-dev.yaml +++ b/test/e2e/config/azure-dev.yaml @@ -3,28 +3,28 @@ managementClusterName: capz-e2e images: - name: ${MANAGER_IMAGE} loadBehavior: mustLoad - - name: registry.k8s.io/cluster-api/cluster-api-controller:v1.3.5 + - name: registry.k8s.io/cluster-api/cluster-api-controller:v1.4.2 loadBehavior: tryLoad - - name: registry.k8s.io/cluster-api/kubeadm-bootstrap-controller:v1.3.5 + - name: registry.k8s.io/cluster-api/kubeadm-bootstrap-controller:v1.4.2 loadBehavior: tryLoad - - name: registry.k8s.io/cluster-api/kubeadm-control-plane-controller:v1.3.5 + - name: registry.k8s.io/cluster-api/kubeadm-control-plane-controller:v1.4.2 loadBehavior: tryLoad providers: - name: cluster-api type: CoreProvider versions: - - name: v0.4.8 # latest published release in the v1alpha4 series; this is used for v1alpha4 --> v1beta1 clusterctl upgrades test only. - value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v0.4.8/core-components.yaml" + - name: v1.0.5 # earliest published release in the v1beta1 series; this is used for v1beta1 old --> v1beta1 latest clusterctl upgrades test only. + value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.0.5/core-components.yaml" type: "url" - contract: v1alpha4 + contract: v1beta1 replacements: - old: --metrics-addr=127.0.0.1:8080 new: --metrics-addr=:8080 files: - - sourcePath: "../data/shared/v1alpha4/metadata.yaml" - - name: v1.3.5 - value: https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.3.5/core-components.yaml + - sourcePath: "../data/shared/v1beta1/metadata.yaml" + - name: v1.4.2 + value: https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.4.2/core-components.yaml type: url contract: v1beta1 files: @@ -37,17 +37,17 @@ providers: - name: kubeadm type: BootstrapProvider versions: - - name: v0.4.8 # latest published release in the v1alpha4 series; this is used for v1alpha4 --> v1beta1 clusterctl upgrades test only. - value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v0.4.8/bootstrap-components.yaml" + - name: v1.0.5 # earliest published release in the v1beta1 series; this is used for v1beta1 old --> v1beta1 latest clusterctl upgrades test only. + value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.0.5/bootstrap-components.yaml" type: "url" - contract: v1alpha4 + contract: v1beta1 replacements: - old: --metrics-addr=127.0.0.1:8080 new: --metrics-addr=:8080 files: - - sourcePath: "../data/shared/v1alpha4/metadata.yaml" - - name: v1.3.5 - value: https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.3.5/bootstrap-components.yaml + - sourcePath: "../data/shared/v1beta1/metadata.yaml" + - name: v1.4.2 + value: https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.4.2/bootstrap-components.yaml type: url contract: v1beta1 files: @@ -59,17 +59,17 @@ providers: - name: kubeadm type: ControlPlaneProvider versions: - - name: v0.4.8 # latest published release in the v1alpha4 series; this is used for v1alpha4 --> v1beta1 clusterctl upgrades test only. - value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v0.4.8/control-plane-components.yaml" + - name: v1.0.5 # earliest published release in the v1beta1 series; this is used for v1beta1 old --> v1beta1 latest clusterctl upgrades test only. + value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.0.5/control-plane-components.yaml" type: "url" - contract: v1alpha4 + contract: v1beta1 replacements: - old: --metrics-addr=127.0.0.1:8080 new: --metrics-addr=:8080 files: - - sourcePath: "../data/shared/v1alpha4/metadata.yaml" - - name: v1.3.5 - value: https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.3.5/control-plane-components.yaml + - sourcePath: "../data/shared/v1beta1/metadata.yaml" + - name: v1.4.2 + value: https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.4.2/control-plane-components.yaml type: url contract: v1beta1 files: @@ -81,18 +81,18 @@ providers: - name: azure type: InfrastructureProvider versions: - - name: v0.5.3 # latest published release in the v1alpha4 series; this is used for v1alpha4 --> v1beta1 clusterctl upgrades test only. - value: https://github.com/kubernetes-sigs/cluster-api-provider-azure/releases/download/v0.5.3/infrastructure-components.yaml + - name: v1.0.2 # earliest published release in the v1beta1 series; this is used for v1beta1 old --> v1beta1 latest clusterctl upgrades test only. + value: https://github.com/kubernetes-sigs/cluster-api-provider-azure/releases/download/v1.0.2/infrastructure-components.yaml type: url - contract: v1alpha4 + contract: v1beta1 files: - - sourcePath: "../data/shared/v1alpha4_provider/metadata.yaml" - - sourcePath: "../data/infrastructure-azure/v1alpha4/cluster-template-prow.yaml" + - sourcePath: "../data/shared/v1beta1_provider/metadata.yaml" + - sourcePath: "../data/infrastructure-azure/v1.0.2/cluster-template-prow.yaml" targetName: "cluster-template.yaml" replacements: - old: "imagePullPolicy: Always" new: "imagePullPolicy: IfNotPresent" - - name: v1.9.99 # "vNext"; use manifests from local source files + - name: v1.10.99 # "vNext"; use manifests from local source files value: "${PWD}/config/default" contract: v1beta1 files: @@ -116,14 +116,8 @@ providers: targetName: "cluster-template-private.yaml" - sourcePath: "${PWD}/templates/test/ci/cluster-template-prow-ci-version.yaml" targetName: "cluster-template-conformance-ci-artifacts.yaml" - - sourcePath: "${PWD}/templates/test/ci/cluster-template-prow-ci-version-windows-containerd-2022.yaml" - targetName: "cluster-template-conformance-ci-artifacts-windows-containerd-2022.yaml" - - sourcePath: "${PWD}/templates/test/ci/cluster-template-prow-ci-version.yaml" - targetName: "cluster-template-conformance-ci-artifacts-windows-containerd.yaml" - sourcePath: "${PWD}/templates/test/dev/cluster-template-custom-builds.yaml" targetName: "cluster-template-conformance-presubmit-artifacts.yaml" - - sourcePath: "${PWD}/templates/test/dev/cluster-template-custom-builds.yaml" - targetName: "cluster-template-conformance-presubmit-artifacts-windows-containerd.yaml" - sourcePath: "${PWD}/templates/test/ci/cluster-template-prow-intree-cloud-provider.yaml" targetName: "cluster-template-intree-cloud-provider.yaml" - sourcePath: "${PWD}/templates/test/ci/cluster-template-prow-machine-pool-flex.yaml" @@ -178,9 +172,9 @@ variables: CI_VERSION: "" # NOTE: INIT_WITH_BINARY and INIT_WITH_KUBERNETES_VERSION are only used by the clusterctl upgrade test to initialize # the management cluster to be upgraded. - INIT_WITH_BINARY: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v0.4.8/clusterctl-{OS}-{ARCH}" - INIT_WITH_PROVIDERS_CONTRACT: "v1alpha4" - INIT_WITH_KUBERNETES_VERSION: "v1.22.9" + INIT_WITH_BINARY: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.0.5/clusterctl-{OS}-{ARCH}" + INIT_WITH_PROVIDERS_CONTRACT: "v1beta1" + INIT_WITH_KUBERNETES_VERSION: "v1.23.13" KUBETEST_CONFIGURATION: "./data/kubetest/conformance.yaml" WINDOWS_CONTAINERD_URL: "${WINDOWS_CONTAINERD_URL:-}" SECURITY_SCAN_FAIL_THRESHOLD: "${SECURITY_SCAN_FAIL_THRESHOLD:-100}" diff --git a/test/e2e/conformance_test.go b/test/e2e/conformance_test.go index 4ff10e67df6..f1427583009 100644 --- a/test/e2e/conformance_test.go +++ b/test/e2e/conformance_test.go @@ -103,9 +103,6 @@ var _ = Describe("Conformance Tests", func() { kubernetesVersion := e2eConfig.GetVariable(capi_e2e.KubernetesVersion) flavor := e2eConfig.GetVariable("CONFORMANCE_FLAVOR") - if isWindows(kubetestConfigFilePath) { - flavor = getWindowsFlavor() - } // clusters with CI artifacts or PR artifacts are based on a known CI version // PR artifacts will replace the CI artifacts during kubeadm init @@ -119,10 +116,6 @@ var _ = Describe("Conformance Tests", func() { } else if usePRArtifacts { flavor = "conformance-presubmit-artifacts" } - - if isWindows(kubetestConfigFilePath) { - flavor = flavor + "-" + getWindowsFlavor() - } } // Starting with Kubernetes v1.25, the kubetest config file needs to be compatible with Ginkgo V2. @@ -147,15 +140,6 @@ var _ = Describe("Conformance Tests", func() { // Conformance for windows doesn't require any linux worker machines. // The templates use WORKER_MACHINE_COUNT for linux machines for backwards compatibility so clear it linuxWorkerMachineCount = 0 - - // Can only enable HostProcessContainers Feature gate in versions that know about it. - v122 := semver.MustParse("1.22.0") - v, err := semver.ParseTolerant(kubernetesVersion) - Expect(err).NotTo(HaveOccurred()) - if v.GTE(v122) { - // Opt into using WindowsHostProcessContainers - Expect(os.Setenv("K8S_FEATURE_GATES", "WindowsHostProcessContainers=true,HPAContainerMetrics=true")).To(Succeed()) - } } controlPlaneMachineCount, err := strconv.ParseInt(e2eConfig.GetVariable("CONFORMANCE_CONTROL_PLANE_MACHINE_COUNT"), 10, 64) @@ -256,17 +240,6 @@ var _ = Describe("Conformance Tests", func() { }) -// getWindowsFlavor helps choose the correct deployment files. Windows has multiple OS and runtime options that need -// to be run for conformance. Current valid options are blank (dockershim) and containerd. In future will have options -// for OS version -func getWindowsFlavor() string { - additionalWindowsFlavor := os.Getenv("WINDOWS_FLAVOR") - if additionalWindowsFlavor != "" { - return "windows" + "-" + additionalWindowsFlavor - } - return "windows" -} - func isWindows(kubetestConfigFilePath string) bool { return strings.Contains(kubetestConfigFilePath, "windows") } diff --git a/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-prow.yaml b/test/e2e/data/infrastructure-azure/v1.0.2/cluster-template-prow.yaml similarity index 93% rename from test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-prow.yaml rename to test/e2e/data/infrastructure-azure/v1.0.2/cluster-template-prow.yaml index 5509ffe2fa3..635a29b2880 100644 --- a/test/e2e/data/infrastructure-azure/v1alpha4/cluster-template-prow.yaml +++ b/test/e2e/data/infrastructure-azure/v1.0.2/cluster-template-prow.yaml @@ -1,4 +1,4 @@ -apiVersion: cluster.x-k8s.io/v1alpha4 +apiVersion: cluster.x-k8s.io/v1beta1 kind: Cluster metadata: labels: @@ -9,17 +9,17 @@ spec: clusterNetwork: pods: cidrBlocks: - - 192.168.0.0/16 + - 192.168.0.0/16 controlPlaneRef: - apiVersion: controlplane.cluster.x-k8s.io/v1alpha4 + apiVersion: controlplane.cluster.x-k8s.io/v1beta1 kind: KubeadmControlPlane name: ${CLUSTER_NAME}-control-plane infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 kind: AzureCluster name: ${CLUSTER_NAME} --- -apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 kind: AzureCluster metadata: name: ${CLUSTER_NAME} @@ -30,24 +30,24 @@ spec: creationTimestamp: ${TIMESTAMP} jobName: ${JOB_NAME} identityRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 kind: AzureClusterIdentity name: ${CLUSTER_IDENTITY_NAME} location: ${AZURE_LOCATION} networkSpec: subnets: - - name: control-plane-subnet - role: control-plane - - name: node-subnet - natGateway: - name: node-natgateway - role: node + - name: control-plane-subnet + role: control-plane + - name: node-subnet + natGateway: + name: node-natgateway + role: node vnet: name: ${AZURE_VNET_NAME:=${CLUSTER_NAME}-vnet} resourceGroup: ${AZURE_RESOURCE_GROUP:=${CLUSTER_NAME}} subscriptionID: ${AZURE_SUBSCRIPTION_ID} --- -apiVersion: controlplane.cluster.x-k8s.io/v1alpha4 +apiVersion: controlplane.cluster.x-k8s.io/v1beta1 kind: KubeadmControlPlane metadata: name: ${CLUSTER_NAME}-control-plane @@ -59,11 +59,12 @@ spec: extraArgs: cloud-config: /etc/kubernetes/azure.json cloud-provider: azure + feature-gates: ${K8S_FEATURE_GATES:-""} extraVolumes: - - hostPath: /etc/kubernetes/azure.json - mountPath: /etc/kubernetes/azure.json - name: cloud-config - readOnly: true + - hostPath: /etc/kubernetes/azure.json + mountPath: /etc/kubernetes/azure.json + name: cloud-config + readOnly: true timeoutForControlPlane: 20m controllerManager: extraArgs: @@ -73,10 +74,10 @@ spec: cluster-name: ${CLUSTER_NAME} v: "4" extraVolumes: - - hostPath: /etc/kubernetes/azure.json - mountPath: /etc/kubernetes/azure.json - name: cloud-config - readOnly: true + - hostPath: /etc/kubernetes/azure.json + mountPath: /etc/kubernetes/azure.json + name: cloud-config + readOnly: true etcd: local: dataDir: /var/lib/etcddisk/etcd @@ -84,29 +85,29 @@ spec: quota-backend-bytes: "8589934592" diskSetup: filesystems: - - device: /dev/disk/azure/scsi1/lun0 - extraOpts: - - -E - - lazy_itable_init=1,lazy_journal_init=1 - filesystem: ext4 - label: etcd_disk - - device: ephemeral0.1 - filesystem: ext4 - label: ephemeral0 - replaceFS: ntfs + - device: /dev/disk/azure/scsi1/lun0 + extraOpts: + - -E + - lazy_itable_init=1,lazy_journal_init=1 + filesystem: ext4 + label: etcd_disk + - device: ephemeral0.1 + filesystem: ext4 + label: ephemeral0 + replaceFS: ntfs partitions: - - device: /dev/disk/azure/scsi1/lun0 - layout: true - overwrite: false - tableType: gpt + - device: /dev/disk/azure/scsi1/lun0 + layout: true + overwrite: false + tableType: gpt files: - - contentFrom: - secret: - key: control-plane-azure.json - name: ${CLUSTER_NAME}-control-plane-azure-json - owner: root:root - path: /etc/kubernetes/azure.json - permissions: "0644" + - contentFrom: + secret: + key: control-plane-azure.json + name: ${CLUSTER_NAME}-control-plane-azure-json + owner: root:root + path: /etc/kubernetes/azure.json + permissions: "0644" initConfiguration: nodeRegistration: kubeletExtraArgs: @@ -122,19 +123,19 @@ spec: cloud-provider: azure name: '{{ ds.meta_data["local_hostname"] }}' mounts: - - - LABEL=etcd_disk - - /var/lib/etcddisk + - - LABEL=etcd_disk + - /var/lib/etcddisk postKubeadmCommands: [] preKubeadmCommands: [] machineTemplate: infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 kind: AzureMachineTemplate name: ${CLUSTER_NAME}-control-plane replicas: ${CONTROL_PLANE_MACHINE_COUNT} version: ${KUBERNETES_VERSION} --- -apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 kind: AzureMachineTemplate metadata: name: ${CLUSTER_NAME}-control-plane @@ -143,16 +144,16 @@ spec: template: spec: dataDisks: - - diskSizeGB: 256 - lun: 0 - nameSuffix: etcddisk + - diskSizeGB: 256 + lun: 0 + nameSuffix: etcddisk osDisk: diskSizeGB: 128 osType: Linux sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""} vmSize: ${AZURE_CONTROL_PLANE_MACHINE_TYPE} --- -apiVersion: cluster.x-k8s.io/v1alpha4 +apiVersion: cluster.x-k8s.io/v1beta1 kind: MachineDeployment metadata: name: ${CLUSTER_NAME}-md-0 @@ -168,17 +169,17 @@ spec: spec: bootstrap: configRef: - apiVersion: bootstrap.cluster.x-k8s.io/v1alpha4 + apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 kind: KubeadmConfigTemplate name: ${CLUSTER_NAME}-md-0 clusterName: ${CLUSTER_NAME} infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 kind: AzureMachineTemplate name: ${CLUSTER_NAME}-md-0 version: ${KUBERNETES_VERSION} --- -apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 kind: AzureMachineTemplate metadata: name: ${CLUSTER_NAME}-md-0 @@ -192,7 +193,7 @@ spec: sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""} vmSize: ${AZURE_NODE_MACHINE_TYPE} --- -apiVersion: bootstrap.cluster.x-k8s.io/v1alpha4 +apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 kind: KubeadmConfigTemplate metadata: name: ${CLUSTER_NAME}-md-0 @@ -201,13 +202,13 @@ spec: template: spec: files: - - contentFrom: - secret: - key: worker-node-azure.json - name: ${CLUSTER_NAME}-md-0-azure-json - owner: root:root - path: /etc/kubernetes/azure.json - permissions: "0644" + - contentFrom: + secret: + key: worker-node-azure.json + name: ${CLUSTER_NAME}-md-0-azure-json + owner: root:root + path: /etc/kubernetes/azure.json + permissions: "0644" joinConfiguration: nodeRegistration: kubeletExtraArgs: @@ -217,7 +218,92 @@ spec: name: '{{ ds.meta_data["local_hostname"] }}' preKubeadmCommands: [] --- -apiVersion: cluster.x-k8s.io/v1alpha4 +apiVersion: cluster.x-k8s.io/v1beta1 +kind: MachineDeployment +metadata: + name: ${CLUSTER_NAME}-md-win + namespace: default +spec: + clusterName: ${CLUSTER_NAME} + replicas: ${WINDOWS_WORKER_MACHINE_COUNT:-0} + selector: {} + template: + spec: + bootstrap: + configRef: + apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 + kind: KubeadmConfigTemplate + name: ${CLUSTER_NAME}-md-win + clusterName: ${CLUSTER_NAME} + infrastructureRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + kind: AzureMachineTemplate + name: ${CLUSTER_NAME}-md-win + version: ${KUBERNETES_VERSION} +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +kind: AzureMachineTemplate +metadata: + annotations: + runtime: containerd + name: ${CLUSTER_NAME}-md-win + namespace: default +spec: + template: + spec: + osDisk: + diskSizeGB: 128 + managedDisk: + storageAccountType: Premium_LRS + osType: Windows + sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""} + vmSize: ${AZURE_NODE_MACHINE_TYPE} +--- +apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 +kind: KubeadmConfigTemplate +metadata: + name: ${CLUSTER_NAME}-md-win + namespace: default +spec: + template: + spec: + files: + - contentFrom: + secret: + key: worker-node-azure.json + name: ${CLUSTER_NAME}-md-win-azure-json + owner: root:root + path: c:/k/azure.json + permissions: "0644" + - content: Add-MpPreference -ExclusionProcess C:/opt/cni/bin/calico.exe + path: C:/defender-exclude-calico.ps1 + permissions: "0744" + - content: | + # /tmp is assumed created and required for upstream e2e tests to pass + New-Item -ItemType Directory -Force -Path C:\tmp\ + path: C:/create-temp-folder.ps1 + permissions: "0744" + joinConfiguration: + nodeRegistration: + criSocket: npipe:////./pipe/containerd-containerd + kubeletExtraArgs: + azure-container-registry-config: c:/k/azure.json + cloud-config: c:/k/azure.json + cloud-provider: azure + feature-gates: WindowsHostProcessContainers=true + name: '{{ ds.meta_data["local_hostname"] }}' + postKubeadmCommands: + - nssm set kubelet start SERVICE_AUTO_START + - powershell C:/defender-exclude-calico.ps1 + preKubeadmCommands: + - powershell C:/create-temp-folder.ps1 + users: + - groups: Administrators + name: capi + sshAuthorizedKeys: + - ${AZURE_SSH_PUBLIC_KEY:=""} +--- +apiVersion: cluster.x-k8s.io/v1beta1 kind: MachineHealthCheck metadata: name: ${CLUSTER_NAME}-mhc-0 @@ -229,11 +315,11 @@ spec: matchLabels: nodepool: pool1 unhealthyConditions: - - status: "True" - timeout: 30s - type: E2ENodeUnhealthy + - status: "True" + timeout: 30s + type: E2ENodeUnhealthy --- -apiVersion: addons.cluster.x-k8s.io/v1alpha4 +apiVersion: addons.cluster.x-k8s.io/v1beta1 kind: ClusterResourceSet metadata: name: ${CLUSTER_NAME}-calico @@ -243,11 +329,11 @@ spec: matchLabels: cni: ${CLUSTER_NAME}-calico resources: - - kind: ConfigMap - name: cni-${CLUSTER_NAME}-calico + - kind: ConfigMap + name: cni-${CLUSTER_NAME}-calico strategy: ApplyOnce --- -apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 kind: AzureClusterIdentity metadata: labels: @@ -265,6 +351,26 @@ spec: --- apiVersion: v1 data: + proxy: "apiVersion: apps/v1\nkind: DaemonSet\nmetadata:\n labels:\n k8s-app: + kube-proxy\n name: kube-proxy-windows\n namespace: kube-system\nspec:\n selector:\n + \ matchLabels:\n k8s-app: kube-proxy-windows\n template:\n metadata:\n + \ labels:\n k8s-app: kube-proxy-windows\n spec:\n serviceAccountName: + kube-proxy\n securityContext:\n windowsOptions:\n hostProcess: + true\n runAsUserName: \"NT AUTHORITY\\\\system\"\n hostNetwork: + true\n containers:\n - image: sigwindowstools/kube-proxy:${KUBERNETES_VERSION/+/_}-calico-hostprocess\n + \ args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/kube-proxy/start.ps1\"]\n + \ workingDir: \"$env:CONTAINER_SANDBOX_MOUNT_POINT/kube-proxy/\"\n name: + kube-proxy\n env:\n - name: NODE_NAME\n valueFrom:\n fieldRef:\n + \ apiVersion: v1\n fieldPath: spec.nodeName\n - + name: POD_IP\n valueFrom:\n fieldRef:\n fieldPath: + status.podIP\n - name: KUBEPROXY_PATH\n valueFrom:\n configMapKeyRef:\n + \ name: windows-kubeproxy-ci\n key: KUBEPROXY_PATH\n + \ optional: true\n volumeMounts:\n - mountPath: /var/lib/kube-proxy\n + \ name: kube-proxy\n nodeSelector:\n kubernetes.io/os: windows\n + \ tolerations:\n - key: CriticalAddonsOnly\n operator: Exists\n + \ - operator: Exists\n volumes:\n - configMap:\n name: + kube-proxy\n item: \n name: kube-proxy\n updateStrategy:\n + \ type: RollingUpdate\n" resources: "---\n# Source: calico/templates/calico-config.yaml\n# This ConfigMap is used to configure a self-hosted Calico installation.\nkind: ConfigMap\napiVersion: v1\nmetadata:\n name: calico-config\n namespace: kube-system\ndata:\n # Typha @@ -2699,6 +2805,99 @@ data: calico-kube-controllers\nspec:\n maxUnavailable: 1\n selector:\n matchLabels:\n \ k8s-app: calico-kube-controllers\n---\n# Source: calico/templates/calico-etcd-secrets.yaml\n\n---\n# Source: calico/templates/calico-typha.yaml\n\n---\n# Source: calico/templates/configure-canal.yaml\n" + windows-cni: "# strictAffinity required for windows\napiVersion: crd.projectcalico.org/v1\nkind: + IPAMConfig\nmetadata:\n name: default\nspec:\n autoAllocateBlocks: true\n strictAffinity: + true\n---\nkind: ConfigMap\napiVersion: v1\nmetadata:\n name: calico-static-rules\n + \ namespace: kube-system\n labels:\n tier: node\n app: calico\ndata:\n + \ static-rules.json: |\n {\n \"Provider\": \"azure\",\n \"Version\": + \"0.1\",\n \"Rules\": [\n {\n \"Name\": \"EndpointPolicy\",\n + \ \"Rule\": {\n \"Id\": \"wireserver\",\n \"Type\": + \"ACL\",\n \"Protocol\": 6,\n \"Action\": \"Block\",\n + \ \"Direction\": \"Out\",\n \"RemoteAddresses\": \"168.63.129.16/32\",\n + \ \"RemotePorts\": \"80\",\n \"Priority\": 200,\n \"RuleType\": + \"Switch\"\n }\n }\n ]\n } \n---\nkind: ConfigMap\napiVersion: + v1\nmetadata:\n name: calico-config-windows\n namespace: kube-system\n labels:\n + \ tier: node\n app: calico\ndata:\n veth_mtu: \"1350\"\n \n cni_network_config: + |\n {\n \"name\": \"Calico\",\n \"cniVersion\": \"0.3.1\",\n \"plugins\": + [\n {\n \"windows_use_single_network\": true,\n \"type\": + \"calico\",\n \"mode\": \"vxlan\",\n \"nodename\": \"__KUBERNETES_NODE_NAME__\",\n + \ \"nodename_file_optional\": true,\n \"log_file_path\": \"c:/cni.log\",\n + \ \"log_level\": \"debug\",\n\n \"vxlan_mac_prefix\": \"0E-2A\",\n + \ \"vxlan_vni\": 4096,\n \"mtu\": __CNI_MTU__,\n \"policy\": + {\n \"type\": \"k8s\"\n },\n\n \"log_level\": \"info\",\n\n + \ \"capabilities\": {\"dns\": true},\n \"DNS\": {\n \"Search\": + \ [\n \"svc.cluster.local\"\n ]\n },\n\n \"datastore_type\": + \"kubernetes\",\n\n \"kubernetes\": {\n \"kubeconfig\": \"__KUBECONFIG_FILEPATH__\"\n + \ },\n\n \"ipam\": {\n \"type\": \"calico-ipam\",\n + \ \"subnet\": \"usePodCidr\"\n },\n\n \"policies\": + \ [\n {\n \"Name\": \"EndpointPolicy\",\n \"Value\": + \ {\n \"Type\": \"OutBoundNAT\",\n \"ExceptionList\": + \ [\n \"__K8S_SERVICE_CIDR__\"\n ]\n }\n + \ },\n {\n \"Name\": \"EndpointPolicy\",\n + \ \"Value\": {\n \"Type\": \"SDNROUTE\",\n \"DestinationPrefix\": + \ \"__K8S_SERVICE_CIDR__\",\n \"NeedEncap\": true\n }\n + \ }\n ]\n }\n ]\n\n }\n---\napiVersion: apps/v1\nkind: + DaemonSet\nmetadata:\n name: calico-node-windows\n labels:\n tier: node\n + \ app: calico\n namespace: kube-system\nspec:\n selector:\n matchLabels:\n + \ app: calico\n template:\n metadata:\n labels:\n tier: node\n + \ app: calico\n spec:\n affinity:\n nodeAffinity:\n requiredDuringSchedulingIgnoredDuringExecution:\n + \ nodeSelectorTerms:\n - matchExpressions:\n - + key: kubernetes.io/os\n operator: In\n values:\n + \ - windows\n - key: kubernetes.io/arch\n + \ operator: In\n values:\n - + amd64\n securityContext:\n windowsOptions:\n hostProcess: + true\n runAsUserName: \"NT AUTHORITY\\\\system\"\n hostNetwork: + true\n serviceAccountName: calico-node\n tolerations:\n - operator: + Exists\n effect: NoSchedule\n # Mark the pod as a critical add-on + for rescheduling.\n - key: CriticalAddonsOnly\n operator: Exists\n + \ - effect: NoExecute\n operator: Exists\n initContainers:\n # + This container installs the CNI binaries\n # and CNI network config file + on each node.\n - name: install-cni\n image: sigwindowstools/calico-install:v3.20.0-hostprocess\n + \ args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/install.ps1\"]\n + \ imagePullPolicy: Always\n env:\n # Name of the CNI + config file to create.\n - name: CNI_CONF_NAME\n value: + \"10-calico.conflist\"\n # The CNI network config to install on each + node.\n - name: CNI_NETWORK_CONFIG\n valueFrom:\n configMapKeyRef:\n + \ name: calico-config-windows\n key: cni_network_config\n + \ # Set the hostname based on the k8s node name.\n - name: + KUBERNETES_NODE_NAME\n valueFrom:\n fieldRef:\n fieldPath: + spec.nodeName\n # CNI MTU Config variable\n - name: CNI_MTU\n + \ valueFrom:\n configMapKeyRef:\n name: + calico-config-windows\n key: veth_mtu\n # Prevents + the container from sleeping forever.\n - name: SLEEP\n value: + \"false\"\n - name: K8S_SERVICE_CIDR\n value: \"10.96.0.0/12\"\n + \ volumeMounts:\n - mountPath: /host/opt/cni/bin\n name: + cni-bin-dir\n - mountPath: /host/etc/cni/net.d\n name: + cni-net-dir\n - name: kubeadm-config\n mountPath: /etc/kubeadm-config/\n + \ securityContext:\n windowsOptions:\n hostProcess: + true\n runAsUserName: \"NT AUTHORITY\\\\system\"\n containers:\n + \ - name: calico-node-startup\n image: sigwindowstools/calico-node:v3.20.0-hostprocess\n + \ args: [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/node-service.ps1\"]\n + \ workingDir: \"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/\"\n imagePullPolicy: + Always\n volumeMounts:\n - name: calico-config-windows\n mountPath: + /etc/kube-calico-windows/\n env:\n - name: POD_NAME\n valueFrom:\n + \ fieldRef:\n apiVersion: v1\n fieldPath: + metadata.name\n - name: POD_NAMESPACE\n valueFrom:\n fieldRef:\n + \ apiVersion: v1\n fieldPath: metadata.namespace\n - + name: CNI_IPAM_TYPE\n value: \"calico-ipam\"\n - name: CALICO_NETWORKING_BACKEND\n + \ value: \"vxlan\"\n - name: KUBECONFIG\n value: \"C:/etc/cni/net.d/calico-kubeconfig\"\n + \ - name: VXLAN_VNI\n value: \"4096\"\n - name: calico-node-felix\n + \ image: sigwindowstools/calico-node:v3.20.0-hostprocess\n args: + [\"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/felix-service.ps1\"]\n imagePullPolicy: + Always\n workingDir: \"$env:CONTAINER_SANDBOX_MOUNT_POINT/calico/\"\n volumeMounts:\n + \ - name: calico-config-windows\n mountPath: /etc/kube-calico-windows/\n + \ - name: calico-static-rules\n mountPath: /calico/static-rules.json\n + \ subPath: static-rules.json\n env:\n - name: POD_NAME\n + \ valueFrom:\n fieldRef:\n apiVersion: v1\n fieldPath: + metadata.name\n - name: POD_NAMESPACE\n valueFrom:\n fieldRef:\n + \ apiVersion: v1\n fieldPath: metadata.namespace\n - + name: VXLAN_VNI\n value: \"4096\"\n - name: KUBECONFIG\n value: + \"C:/etc/cni/net.d/calico-kubeconfig\"\n volumes:\n - name: calico-config-windows\n + \ configMap:\n name: calico-config-windows\n - name: calico-static-rules\n + \ configMap:\n name: calico-static-rules\n # Used to install + CNI.\n - name: cni-bin-dir\n hostPath:\n path: /opt/cni/bin\n + \ - name: cni-net-dir\n hostPath:\n path: /etc/cni/net.d\n + \ - name: kubeadm-config\n configMap:\n name: kubeadm-config\n" kind: ConfigMap metadata: annotations: @@ -2706,4 +2905,4 @@ metadata: labels: type: generated name: cni-${CLUSTER_NAME}-calico - namespace: default \ No newline at end of file + namespace: default diff --git a/test/e2e/data/infrastructure-azure/v1alpha3/cluster-template-prow.yaml b/test/e2e/data/infrastructure-azure/v1alpha3/cluster-template-prow.yaml deleted file mode 100644 index fe24fe5857a..00000000000 --- a/test/e2e/data/infrastructure-azure/v1alpha3/cluster-template-prow.yaml +++ /dev/null @@ -1,241 +0,0 @@ -apiVersion: cluster.x-k8s.io/v1alpha3 -kind: Cluster -metadata: - labels: - cni: ${CLUSTER_NAME}-crs-0 - name: ${CLUSTER_NAME} - namespace: default -spec: - clusterNetwork: - pods: - cidrBlocks: - - 192.168.0.0/16 - controlPlaneRef: - apiVersion: controlplane.cluster.x-k8s.io/v1alpha3 - kind: KubeadmControlPlane - name: ${CLUSTER_NAME}-control-plane - infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 - kind: AzureCluster - name: ${CLUSTER_NAME} ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 -kind: AzureCluster -metadata: - name: ${CLUSTER_NAME} - namespace: default -spec: - additionalTags: - creationTimestamp: ${TIMESTAMP} - jobName: ${JOB_NAME} - location: ${AZURE_LOCATION} - networkSpec: - vnet: - name: ${AZURE_VNET_NAME:=${CLUSTER_NAME}-vnet} - resourceGroup: ${AZURE_RESOURCE_GROUP:=${CLUSTER_NAME}} - subscriptionID: ${AZURE_SUBSCRIPTION_ID} ---- -apiVersion: controlplane.cluster.x-k8s.io/v1alpha3 -kind: KubeadmControlPlane -metadata: - name: ${CLUSTER_NAME}-control-plane - namespace: default -spec: - infrastructureTemplate: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 - kind: AzureMachineTemplate - name: ${CLUSTER_NAME}-control-plane - kubeadmConfigSpec: - clusterConfiguration: - apiServer: - extraArgs: - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure - extraVolumes: - - hostPath: /etc/kubernetes/azure.json - mountPath: /etc/kubernetes/azure.json - name: cloud-config - readOnly: true - timeoutForControlPlane: 20m - controllerManager: - extraArgs: - allocate-node-cidrs: "false" - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure - cluster-name: ${CLUSTER_NAME} - v: "4" - extraVolumes: - - hostPath: /etc/kubernetes/azure.json - mountPath: /etc/kubernetes/azure.json - name: cloud-config - readOnly: true - etcd: - local: - dataDir: /var/lib/etcddisk/etcd - diskSetup: - filesystems: - - device: /dev/disk/azure/scsi1/lun0 - extraOpts: - - -E - - lazy_itable_init=1,lazy_journal_init=1 - filesystem: ext4 - label: etcd_disk - - device: ephemeral0.1 - filesystem: ext4 - label: ephemeral0 - replaceFS: ntfs - partitions: - - device: /dev/disk/azure/scsi1/lun0 - layout: true - overwrite: false - tableType: gpt - files: - - contentFrom: - secret: - key: control-plane-azure.json - name: ${CLUSTER_NAME}-control-plane-azure-json - owner: root:root - path: /etc/kubernetes/azure.json - permissions: "0644" - initConfiguration: - nodeRegistration: - kubeletExtraArgs: - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure - name: '{{ ds.meta_data["local_hostname"] }}' - joinConfiguration: - nodeRegistration: - kubeletExtraArgs: - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure - name: '{{ ds.meta_data["local_hostname"] }}' - mounts: - - - LABEL=etcd_disk - - /var/lib/etcddisk - replicas: ${CONTROL_PLANE_MACHINE_COUNT} - version: ${KUBERNETES_VERSION} ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 -kind: AzureMachineTemplate -metadata: - name: ${CLUSTER_NAME}-control-plane - namespace: default -spec: - template: - spec: - dataDisks: - - diskSizeGB: 256 - lun: 0 - nameSuffix: etcddisk - location: ${AZURE_LOCATION} - osDisk: - diskSizeGB: 128 - managedDisk: - storageAccountType: Premium_LRS - osType: Linux - sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""} - vmSize: ${AZURE_CONTROL_PLANE_MACHINE_TYPE} ---- -apiVersion: cluster.x-k8s.io/v1alpha3 -kind: MachineDeployment -metadata: - name: ${CLUSTER_NAME}-md-0 - namespace: default -spec: - clusterName: ${CLUSTER_NAME} - replicas: ${WORKER_MACHINE_COUNT} - selector: - matchLabels: null - template: - metadata: - labels: - nodepool: pool1 - spec: - bootstrap: - configRef: - apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 - kind: KubeadmConfigTemplate - name: ${CLUSTER_NAME}-md-0 - clusterName: ${CLUSTER_NAME} - infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 - kind: AzureMachineTemplate - name: ${CLUSTER_NAME}-md-0 - version: ${KUBERNETES_VERSION} ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 -kind: AzureMachineTemplate -metadata: - name: ${CLUSTER_NAME}-md-0 - namespace: default -spec: - template: - spec: - location: ${AZURE_LOCATION} - osDisk: - diskSizeGB: 128 - managedDisk: - storageAccountType: Premium_LRS - osType: Linux - sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""} - vmSize: ${AZURE_NODE_MACHINE_TYPE} ---- -apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 -kind: KubeadmConfigTemplate -metadata: - name: ${CLUSTER_NAME}-md-0 - namespace: default -spec: - template: - spec: - files: - - contentFrom: - secret: - key: worker-node-azure.json - name: ${CLUSTER_NAME}-md-0-azure-json - owner: root:root - path: /etc/kubernetes/azure.json - permissions: "0644" - joinConfiguration: - nodeRegistration: - kubeletExtraArgs: - cloud-config: /etc/kubernetes/azure.json - cloud-provider: azure - name: '{{ ds.meta_data["local_hostname"] }}' ---- -apiVersion: cluster.x-k8s.io/v1alpha3 -kind: MachineHealthCheck -metadata: - name: ${CLUSTER_NAME}-mhc-0 - namespace: default -spec: - clusterName: ${CLUSTER_NAME} - maxUnhealthy: 100% - selector: - matchLabels: - nodepool: pool1 - unhealthyConditions: - - status: "True" - timeout: 30s - type: E2ENodeUnhealthy ---- -apiVersion: v1 -data: ${CNI_RESOURCES} -kind: ConfigMap -metadata: - name: cni-${CLUSTER_NAME}-crs-0 - namespace: default ---- -apiVersion: addons.cluster.x-k8s.io/v1alpha3 -kind: ClusterResourceSet -metadata: - name: ${CLUSTER_NAME}-crs-0 - namespace: default -spec: - clusterSelector: - matchLabels: - cni: ${CLUSTER_NAME}-crs-0 - resources: - - kind: ConfigMap - name: cni-${CLUSTER_NAME}-crs-0 - strategy: ApplyOnce diff --git a/test/e2e/data/shared/v1beta1/metadata.yaml b/test/e2e/data/shared/v1beta1/metadata.yaml index ff9cdc10131..a270758c7e0 100644 --- a/test/e2e/data/shared/v1beta1/metadata.yaml +++ b/test/e2e/data/shared/v1beta1/metadata.yaml @@ -1,6 +1,9 @@ apiVersion: clusterctl.cluster.x-k8s.io/v1alpha3 kind: Metadata releaseSeries: + - major: 1 + minor: 4 + contract: v1beta1 - major: 1 minor: 3 contract: v1beta1 @@ -13,12 +16,3 @@ releaseSeries: - major: 1 minor: 0 contract: v1beta1 - - major: 0 - minor: 4 - contract: v1alpha4 - - major: 0 - minor: 3 - contract: v1alpha3 - - major: 0 - minor: 2 - contract: v1alpha2 diff --git a/test/e2e/data/shared/v1beta1_provider/metadata.yaml b/test/e2e/data/shared/v1beta1_provider/metadata.yaml index f9bc96a9043..63f74ed6c69 100644 --- a/test/e2e/data/shared/v1beta1_provider/metadata.yaml +++ b/test/e2e/data/shared/v1beta1_provider/metadata.yaml @@ -7,9 +7,9 @@ # one capz version at a time against one API version apiVersion: clusterctl.cluster.x-k8s.io/v1alpha3 releaseSeries: - - major: 0 - minor: 5 - contract: v1alpha4 - major: 1 - minor: 9 + minor: 0 + contract: v1beta1 + - major: 1 + minor: 10 contract: v1beta1 diff --git a/test/e2e/e2e_suite_test.go b/test/e2e/e2e_suite_test.go index 51e61ed48ba..5e4b00c6087 100644 --- a/test/e2e/e2e_suite_test.go +++ b/test/e2e/e2e_suite_test.go @@ -22,6 +22,7 @@ package e2e import ( "bytes" "context" + "encoding/base64" "encoding/gob" "flag" "os" @@ -78,12 +79,13 @@ var _ = SynchronizedBeforeSuite(func() []byte { var configBuf bytes.Buffer enc := gob.NewEncoder(&configBuf) Expect(enc.Encode(e2eConfig)).To(Succeed()) + configStr := base64.StdEncoding.EncodeToString(configBuf.Bytes()) return []byte( strings.Join([]string{ artifactFolder, clusterctlConfigPath, - configBuf.String(), + configStr, bootstrapClusterProxy.GetKubeconfigPath(), }, ","), ) @@ -97,7 +99,9 @@ var _ = SynchronizedBeforeSuite(func() []byte { clusterctlConfigPath = parts[1] // Decode the e2e config - buf := bytes.NewBuffer([]byte(parts[2])) + configBytes, err := base64.StdEncoding.DecodeString(parts[2]) + Expect(err).NotTo(HaveOccurred()) + buf := bytes.NewBuffer(configBytes) dec := gob.NewDecoder(buf) Expect(dec.Decode(&e2eConfig)).To(Succeed()) diff --git a/test/e2e/gpu_operator.go b/test/e2e/gpu_operator.go index 19af5a2726b..7abd27f4829 100644 --- a/test/e2e/gpu_operator.go +++ b/test/e2e/gpu_operator.go @@ -64,5 +64,5 @@ func InstallGPUOperator(ctx context.Context, inputGetter func() GPUOperatorSpecI func InstallNvidiaGPUOperatorChart(ctx context.Context, clusterProxy framework.ClusterProxy) { By("Installing nvidia/gpu-operator via helm") values := &helmVals.Options{} - InstallHelmChart(ctx, clusterProxy, nvidiaGPUOperatorNamespace, nvidiaHelmChartRepoURL, nvidiaGPUOperatorHelmChartName, nvidiaGPUOperatorHelmReleaseName, values) + InstallHelmChart(ctx, clusterProxy, nvidiaGPUOperatorNamespace, nvidiaHelmChartRepoURL, nvidiaGPUOperatorHelmChartName, nvidiaGPUOperatorHelmReleaseName, values, "") } diff --git a/test/e2e/helpers.go b/test/e2e/helpers.go index 8650fd17a6d..c94942d9507 100644 --- a/test/e2e/helpers.go +++ b/test/e2e/helpers.go @@ -425,7 +425,7 @@ func getAvailabilityZonesForRegion(location string, size string) ([]string, erro // INFO: "With 1 worker node" started at Tue, 22 Sep 2020 13:19:08 PDT on Ginkgo node 2 of 3 // INFO: "With 1 worker node" ran for 18m34s on Ginkgo node 2 of 3 func logCheckpoint(specTimes map[string]time.Time) { - text := CurrentGinkgoTestDescription().TestText + text := CurrentSpecReport().LeafNodeText start, started := specTimes[text] suiteConfig, reporterConfig := GinkgoConfiguration() if !started { @@ -464,26 +464,35 @@ func isAzureMachinePoolWindows(amp *infrav1exp.AzureMachinePool) bool { // getProxiedSSHClient creates a SSH client object that connects to a target node // proxied through a control plane node. -func getProxiedSSHClient(controlPlaneEndpoint, hostname, port string) (*ssh.Client, error) { +func getProxiedSSHClient(controlPlaneEndpoint, hostname, port string, ioTimeout time.Duration) (*ssh.Client, error) { config, err := newSSHConfig() if err != nil { return nil, err } // Init a client connection to a control plane node via the public load balancer - lbClient, err := ssh.Dial("tcp", fmt.Sprintf("%s:%s", controlPlaneEndpoint, port), config) + c, err := net.DialTimeout("tcp", fmt.Sprintf("%s:%s", controlPlaneEndpoint, port), config.Timeout) if err != nil { return nil, errors.Wrapf(err, "dialing public load balancer at %s", controlPlaneEndpoint) } + err = c.SetDeadline(time.Now().Add(ioTimeout)) + if err != nil { + return nil, errors.Wrapf(err, "setting timeout for connection to public load balancer at %s", controlPlaneEndpoint) + } + conn, chans, reqs, err := ssh.NewClientConn(c, fmt.Sprintf("%s:%s", controlPlaneEndpoint, port), config) + if err != nil { + return nil, errors.Wrapf(err, "connecting to public load balancer at %s", controlPlaneEndpoint) + } + lbClient := ssh.NewClient(conn, chans, reqs) // Init a connection from the control plane to the target node - c, err := lbClient.Dial("tcp", fmt.Sprintf("%s:%s", hostname, port)) + c, err = lbClient.Dial("tcp", fmt.Sprintf("%s:%s", hostname, port)) if err != nil { return nil, errors.Wrapf(err, "dialing from control plane to target node at %s", hostname) } // Establish an authenticated SSH conn over the client -> control plane -> target transport - conn, chans, reqs, err := ssh.NewClientConn(c, hostname, config) + conn, chans, reqs, err = ssh.NewClientConn(c, hostname, config) if err != nil { return nil, errors.Wrap(err, "getting a new SSH client connection") } @@ -493,9 +502,9 @@ func getProxiedSSHClient(controlPlaneEndpoint, hostname, port string) (*ssh.Clie // execOnHost runs the specified command directly on a node's host, using a SSH connection // proxied through a control plane host and copies the output to a file. -func execOnHost(controlPlaneEndpoint, hostname, port string, f io.StringWriter, command string, +func execOnHost(controlPlaneEndpoint, hostname, port string, ioTimeout time.Duration, f io.StringWriter, command string, args ...string) error { - client, err := getProxiedSSHClient(controlPlaneEndpoint, hostname, port) + client, err := getProxiedSSHClient(controlPlaneEndpoint, hostname, port, ioTimeout) if err != nil { return err } @@ -524,10 +533,10 @@ func execOnHost(controlPlaneEndpoint, hostname, port string, f io.StringWriter, // sftpCopyFile copies a file from a node to the specified destination, using a SSH connection // proxied through a control plane node. -func sftpCopyFile(controlPlaneEndpoint, hostname, port, sourcePath, destPath string) error { +func sftpCopyFile(controlPlaneEndpoint, hostname, port string, ioTimeout time.Duration, sourcePath, destPath string) error { Logf("Attempting to copy file %s on node %s to %s", sourcePath, hostname, destPath) - client, err := getProxiedSSHClient(controlPlaneEndpoint, hostname, port) + client, err := getProxiedSSHClient(controlPlaneEndpoint, hostname, port, ioTimeout) if err != nil { return err } @@ -927,7 +936,7 @@ func getPodLogs(ctx context.Context, clientset *kubernetes.Clientset, pod corev1 } // InstallHelmChart takes a helm repo URL, a chart name, and release name, and installs a helm release onto the E2E workload cluster. -func InstallHelmChart(ctx context.Context, clusterProxy framework.ClusterProxy, namespace, repoURL, chartName, releaseName string, options *helmVals.Options) { +func InstallHelmChart(ctx context.Context, clusterProxy framework.ClusterProxy, namespace, repoURL, chartName, releaseName string, options *helmVals.Options, version string) { kubeConfigPath := clusterProxy.GetKubeconfigPath() settings := helmCli.New() settings.KubeConfig = kubeConfigPath @@ -959,6 +968,7 @@ func InstallHelmChart(ctx context.Context, clusterProxy framework.ClusterProxy, } i.ReleaseName = releaseName i.Namespace = namespace + i.Version = version i.CreateNamespace = true Eventually(func(g Gomega) { cp, err := i.ChartPathOptions.LocateChart(chartName, helmCli.New()) diff --git a/test/e2e/kubernetes/pod/pod.go b/test/e2e/kubernetes/pod/pod.go index ab84b32653a..65cca78740b 100644 --- a/test/e2e/kubernetes/pod/pod.go +++ b/test/e2e/kubernetes/pod/pod.go @@ -20,6 +20,7 @@ limitations under the License. package pod import ( + "context" "os" "time" @@ -58,7 +59,7 @@ func Exec(clientset *kubernetes.Clientset, config *restclient.Config, pod corev1 return err } Eventually(func(g Gomega) { - err = exec.Stream(remotecommand.StreamOptions{ + err = exec.StreamWithContext(context.Background(), remotecommand.StreamOptions{ Stdout: os.Stdout, Stderr: os.Stderr, }) diff --git a/test/logger.go b/test/logger.go index e7ffe1bb75b..7d558ff3099 100644 --- a/test/logger.go +++ b/test/logger.go @@ -79,8 +79,9 @@ func collectManagementClusterLogs(bootstrapClusterProxy *e2e.AzureClusterProxy, Lister: bootstrapClusterProxy.GetClient(), }) for _, deployment := range controllersDeployments { - framework.WatchDeploymentLogs(context.TODO(), framework.WatchDeploymentLogsInput{ + framework.WatchDeploymentLogsByName(context.TODO(), framework.WatchDeploymentLogsByNameInput{ GetLister: bootstrapClusterProxy.GetClient(), + Cache: bootstrapClusterProxy.GetCache(context.TODO()), ClientSet: bootstrapClusterProxy.GetClientSet(), Deployment: deployment, LogPath: managementClusterLogPath, diff --git a/util/webhook/validator.go b/util/webhook/validator.go index 00b099cc1c4..cfb3228e792 100644 --- a/util/webhook/validator.go +++ b/util/webhook/validator.go @@ -52,6 +52,16 @@ func ValidateImmutable(path *field.Path, oldVal, newVal any) *field.Error { return nil } +// ValidateZeroTransition validates equality across two values, with only exception to allow +// the value to transition of a zero value. +func ValidateZeroTransition(path *field.Path, oldVal, newVal any) *field.Error { + if reflect.ValueOf(newVal).IsZero() { + // unsetting the field is allowed + return nil + } + return ValidateImmutable(path, oldVal, newVal) +} + // EnsureStringSlicesAreEquivalent returns if two string slices have equal lengths, // and that they have the exact same items; it does not enforce strict ordering of items. func EnsureStringSlicesAreEquivalent(a []string, b []string) bool { diff --git a/util/webhook/validator_test.go b/util/webhook/validator_test.go index 7657fbbbd27..39f77dab520 100644 --- a/util/webhook/validator_test.go +++ b/util/webhook/validator_test.go @@ -299,3 +299,215 @@ func TestEnsureStringSlicesAreEquivalent(t *testing.T) { }) } } + +func TestValidateZeroTransitionPtr(t *testing.T) { + testPath := field.NewPath("Spec", "Foo") + + tests := []struct { + name string + input1 *bool + input2 *bool + expectedOutput *field.Error + }{ + { + name: "nil", + input1: nil, + input2: nil, + }, + { + name: "no change", + input1: pointer.Bool(true), + input2: pointer.Bool(true), + }, + { + name: "can unset", + input1: pointer.Bool(true), + input2: nil, + }, + { + name: "can't set from empty", + input1: nil, + input2: pointer.Bool(true), + expectedOutput: field.Invalid(testPath, nil, setMessage), + }, + { + name: "can't change", + input1: pointer.Bool(true), + input2: pointer.Bool(false), + expectedOutput: field.Invalid(testPath, nil, immutableMessage), + }, + } + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + g := NewWithT(t) + err := ValidateZeroTransition(testPath, tc.input1, tc.input2) + if tc.expectedOutput != nil { + g.Expect(err).To(HaveOccurred()) + g.Expect(err.Detail).To(Equal(tc.expectedOutput.Detail)) + g.Expect(err.Type).To(Equal(tc.expectedOutput.Type)) + g.Expect(err.Field).To(Equal(tc.expectedOutput.Field)) + } else { + g.Expect(err).NotTo(HaveOccurred()) + } + }) + } +} + +func TestValidateZeroTransitionString(t *testing.T) { + testPath := field.NewPath("Spec", "Foo") + + tests := []struct { + name string + input1 string + input2 string + expectedOutput *field.Error + }{ + { + name: "empty string", + input1: "", + input2: "", + }, + { + name: "no change", + input1: "foo", + input2: "foo", + }, + { + name: "can unset", + input1: "foo", + input2: "", + }, + { + name: "can't set from empty", + input1: "", + input2: "foo", + expectedOutput: field.Invalid(testPath, nil, setMessage), + }, + { + name: "can't change", + input1: "foo", + input2: "bar", + expectedOutput: field.Invalid(testPath, nil, immutableMessage), + }, + } + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + g := NewWithT(t) + err := ValidateZeroTransition(testPath, tc.input1, tc.input2) + if tc.expectedOutput != nil { + g.Expect(err).To(HaveOccurred()) + g.Expect(err.Detail).To(Equal(tc.expectedOutput.Detail)) + g.Expect(err.Type).To(Equal(tc.expectedOutput.Type)) + g.Expect(err.Field).To(Equal(tc.expectedOutput.Field)) + } else { + g.Expect(err).NotTo(HaveOccurred()) + } + }) + } +} + +func TestValidateZeroTransitionStringPtr(t *testing.T) { + testPath := field.NewPath("Spec", "Foo") + + tests := []struct { + name string + input1 *string + input2 *string + expectedOutput *field.Error + }{ + { + name: "nil", + input1: nil, + input2: nil, + }, + { + name: "no change", + input1: pointer.String("foo"), + input2: pointer.String("foo"), + }, + { + name: "can unset", + input1: pointer.String("foo"), + input2: nil, + }, + { + name: "can't set from empty", + input1: nil, + input2: pointer.String("foo"), + expectedOutput: field.Invalid(testPath, nil, setMessage), + }, + { + name: "can't change", + input1: pointer.String("foo"), + input2: pointer.String("bar"), + expectedOutput: field.Invalid(testPath, nil, immutableMessage), + }, + } + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + g := NewWithT(t) + err := ValidateZeroTransition(testPath, tc.input1, tc.input2) + if tc.expectedOutput != nil { + g.Expect(err).To(HaveOccurred()) + g.Expect(err.Detail).To(Equal(tc.expectedOutput.Detail)) + g.Expect(err.Type).To(Equal(tc.expectedOutput.Type)) + g.Expect(err.Field).To(Equal(tc.expectedOutput.Field)) + } else { + g.Expect(err).NotTo(HaveOccurred()) + } + }) + } +} + +func TestValidateZeroTransitionInt32(t *testing.T) { + testPath := field.NewPath("Spec", "Foo") + + tests := []struct { + name string + input1 int32 + input2 int32 + expectedOutput *field.Error + }{ + { + name: "unset", + input1: 0, + input2: 0, + }, + { + name: "no change", + input1: 5, + input2: 5, + }, + { + name: "can unset", + input1: 5, + input2: 0, + }, + { + name: "can't set from empty", + input1: 0, + input2: 5, + expectedOutput: field.Invalid(testPath, nil, setMessage), + }, + { + name: "can't change", + input1: 5, + input2: 6, + expectedOutput: field.Invalid(testPath, nil, immutableMessage), + }, + } + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + g := NewWithT(t) + err := ValidateZeroTransition(testPath, tc.input1, tc.input2) + if tc.expectedOutput != nil { + g.Expect(err).To(HaveOccurred()) + g.Expect(err.Detail).To(Equal(tc.expectedOutput.Detail)) + g.Expect(err.Type).To(Equal(tc.expectedOutput.Type)) + g.Expect(err.Field).To(Equal(tc.expectedOutput.Field)) + } else { + g.Expect(err).NotTo(HaveOccurred()) + } + }) + } +}