Skip to content

Commit

Permalink
[release/1.1.x] config entry: add validate_clusters to mesh config en…
Browse files Browse the repository at this point in the history
…try (#4262)

* config entry: add validate_clusters to mesh config entry
* go modules for 1.15.x/1.1.x line
* update api
* fix lint by updating to k8s.io/utils/ptr from k8s.io/utils/pointer
* update api everywhere
* 0.28.13 supports psp's, so need to keep that in acceptance for now
* sync Makefile and hack/copy-crds-to-chart from 1.3.x while only removing unsupported parts
* add the labels 8 lines below, so it doesn't move lines around when it shouldn't
* remove some unused files and make targets as a result of makefile updates
  • Loading branch information
ndhanushkodi authored Aug 28, 2024
1 parent 99991ab commit 5b2215a
Show file tree
Hide file tree
Showing 54 changed files with 2,218 additions and 2,033 deletions.
3 changes: 3 additions & 0 deletions .changelog/4256.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
config-entry: add validate_clusters to mesh config entry
```
63 changes: 53 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ control-plane-dev-docker: ## Build consul-k8s-control-plane dev Docker image.
.PHONY: control-plane-dev-skaffold
# DANGER: this target is experimental and could be modified/removed at any time.
control-plane-dev-skaffold: ## Build consul-k8s-control-plane dev Docker image for use with skaffold or local development.
@$(SHELL) $(CURDIR)/control-plane/build-support/scripts/build-local.sh --os linux --arch $(GOARCH)
@$(SHELL) $(CURDIR)/control-plane/build-support/scripts/build-local.sh -o linux -a $(GOARCH)
@docker build -t '$(DEV_IMAGE)' \
--build-arg 'GOLANG_VERSION=$(GOLANG_VERSION)' \
--build-arg 'TARGETARCH=$(GOARCH)' \
Expand Down Expand Up @@ -101,7 +101,8 @@ cni-plugin-lint:

.PHONY: ctrl-generate
ctrl-generate: get-controller-gen ## Run CRD code generation.
cd control-plane; $(CONTROLLER_GEN) object:headerFile="build-support/controller/boilerplate.go.txt" paths="./..."
make ensure-controller-gen-version
cd control-plane; $(CONTROLLER_GEN) object paths="./..."

.PHONY: terraform-fmt-check
terraform-fmt-check: ## Perform a terraform fmt check but don't change anything
Expand Down Expand Up @@ -143,22 +144,30 @@ kind-cni-calico: ## install cni plugin on kind
kubectl create -f $(CURDIR)/acceptance/framework/environment/cni-kind/custom-resources.yaml
@sleep 20

.PHONY: kind-cni
kind-cni: kind-delete ## Helper target for doing local cni acceptance testing
.PHONY: kind-delete
kind-delete:
kind delete cluster --name dc1
kind delete cluster --name dc2
kind delete cluster --name dc3
kind delete cluster --name dc4

.PHONY: kind-cni
kind-cni: kind-delete ## Helper target for doing local cni acceptance testing
kind create cluster --config=$(CURDIR)/acceptance/framework/environment/cni-kind/kind.config --name dc1 --image $(KIND_NODE_IMAGE)
make kind-cni-calico
kind create cluster --config=$(CURDIR)/acceptance/framework/environment/cni-kind/kind.config --name dc2 --image $(KIND_NODE_IMAGE)
make kind-cni-calico
kind create cluster --config=$(CURDIR)/acceptance/framework/environment/cni-kind/kind.config --name dc3 --image $(KIND_NODE_IMAGE)
make kind-cni-calico
kind create cluster --config=$(CURDIR)/acceptance/framework/environment/cni-kind/kind.config --name dc4 --image $(KIND_NODE_IMAGE)
make kind-cni-calico

.PHONY: kind
kind: kind-delete ## Helper target for doing local acceptance testing
kind delete cluster --name dc1
kind delete cluster --name dc2
kind create cluster --name dc1 --image $(KIND_NODE_IMAGE)
kind create cluster --name dc2 --image $(KIND_NODE_IMAGE)

kind create cluster --name dc3 --image $(KIND_NODE_IMAGE)
kind create cluster --name dc4 --image $(KIND_NODE_IMAGE)

.PHONY: kind-load
kind-load: ## Helper target for loading local dev images (run with `DEV_IMAGE=...` to load non-k8s images)
Expand All @@ -175,6 +184,7 @@ lint: cni-plugin-lint ## Run linter in the control-plane, cli, and acceptance di

.PHONY: ctrl-manifests
ctrl-manifests: get-controller-gen ## Generate CRD manifests.
make ensure-controller-gen-version
cd control-plane; $(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
make copy-crds-to-chart
make add-copyright-header
Expand All @@ -187,14 +197,28 @@ ifeq (, $(shell which controller-gen))
CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\
cd $$CONTROLLER_GEN_TMP_DIR ;\
go mod init tmp ;\
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.8.0 ;\
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.14.0 ;\
rm -rf $$CONTROLLER_GEN_TMP_DIR ;\
}
CONTROLLER_GEN=$(shell go env GOPATH)/bin/controller-gen
else
CONTROLLER_GEN=$(shell which controller-gen)
endif

.PHONY: ensure-controller-gen-version
ensure-controller-gen-version: ## Ensure controller-gen version is v0.14.0.
ifeq (, $(shell which $(CONTROLLER_GEN)))
@echo "You don't have $(CONTROLLER_GEN), please install it first."
else
ifeq (, $(shell $(CONTROLLER_GEN) --version | grep v0.14.0))
@echo "controller-gen version is not v0.14.0, uninstall the binary and install the correct version with 'make get-controller-gen'."
@echo "Found version: $(shell $(CONTROLLER_GEN) --version)"
@exit 1
else
@echo "Found correct version: $(shell $(CONTROLLER_GEN) --version)"
endif
endif

.PHONY: add-copyright-header
add-copyright-header: ## Add copyright header to all files in the project
ifeq (, $(shell which copywrite))
Expand Down Expand Up @@ -299,6 +323,25 @@ endif
.PHONY: prepare-release
prepare-release: prepare-release-script check-preview-containers

.PHONY: prepare-rc-script
prepare-rc-script: ## Sets the versions, updates changelog to prepare this repository to release
ifndef CONSUL_K8S_RELEASE_VERSION
$(error CONSUL_K8S_RELEASE_VERSION is required)
endif
ifndef CONSUL_K8S_RELEASE_DATE
$(error CONSUL_K8S_RELEASE_DATE is required, use format <Month> <Day>, <Year> (ex. October 4, 2022))
endif
ifndef CONSUL_K8S_LAST_RELEASE_GIT_TAG
$(error CONSUL_K8S_LAST_RELEASE_GIT_TAG is required)
endif
ifndef CONSUL_K8S_CONSUL_VERSION
$(error CONSUL_K8S_CONSUL_VERSION is required)
endif
@source $(CURDIR)/control-plane/build-support/scripts/functions.sh; prepare_rc_branch $(CURDIR) $(CONSUL_K8S_RELEASE_VERSION) "$(CONSUL_K8S_RELEASE_DATE)" $(CONSUL_K8S_LAST_RELEASE_GIT_TAG) $(CONSUL_K8S_CONSUL_VERSION) $(CONSUL_K8S_CONSUL_DATAPLANE_VERSION) $(CONSUL_K8S_PRERELEASE_VERSION); \

.PHONY: prepare-rc-branch
prepare-rc-branch: prepare-rc-script

.PHONY: prepare-main-dev
prepare-main-dev: ## prepare main dev
ifndef CONSUL_K8S_RELEASE_VERSION
Expand Down Expand Up @@ -327,7 +370,7 @@ ifndef CONSUL_K8S_RELEASE_DATE
$(error CONSUL_K8S_RELEASE_DATE is required, use format <Month> <Day>, <Year> (ex. October 4, 2022))
endif
ifndef CONSUL_K8S_NEXT_RELEASE_VERSION
$(error CONSUL_K8S_RELEASE_VERSION is required)
$(error CONSUL_K8S_NEXT_RELEASE_VERSION is required)
endif
ifndef CONSUL_K8S_CONSUL_VERSION
$(error CONSUL_K8S_CONSUL_VERSION is required)
Expand Down Expand Up @@ -363,4 +406,4 @@ CRD_OPTIONS ?= "crd:ignoreUnexportedFields=true,allowDangerousTypes=true"
# http://linuxcommand.org/lc3_adv_awk.php
.PHONY: help
help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
31 changes: 16 additions & 15 deletions acceptance/go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
module github.com/hashicorp/consul-k8s/acceptance

go 1.20
go 1.21

toolchain go1.22.5

require (
github.com/google/uuid v1.3.0
github.com/gruntwork-io/terratest v0.31.2
github.com/hashicorp/consul-k8s/control-plane v0.0.0-20221117191905-0b1cc2b631e3
github.com/hashicorp/consul/api v1.21.1
github.com/hashicorp/consul/api v1.21.3
github.com/hashicorp/consul/sdk v0.16.0
github.com/hashicorp/go-uuid v1.0.3
github.com/hashicorp/go-version v1.6.0
Expand All @@ -17,9 +19,9 @@ require (
go.opentelemetry.io/proto/otlp v1.0.0
google.golang.org/protobuf v1.33.0
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.28.9
k8s.io/apimachinery v0.28.9
k8s.io/client-go v0.28.9
k8s.io/api v0.28.13
k8s.io/apimachinery v0.28.13
k8s.io/client-go v0.28.13
)

require (
Expand All @@ -30,9 +32,9 @@ require (
github.com/cenkalti/backoff/v3 v3.0.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.10.1 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/fatih/color v1.17.0 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-errors/errors v1.0.2-0.20180813162953-d98b870cc4e0 // indirect
github.com/go-jose/go-jose/v3 v3.0.3 // indirect
Expand All @@ -53,21 +55,20 @@ require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
github.com/gruntwork-io/gruntwork-cli v0.7.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-hclog v1.6.3 // indirect
github.com/hashicorp/go-immutable-radix v1.3.0 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6 // indirect
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
github.com/hashicorp/go-sockaddr v1.0.2 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/jmespath/go-jmespath v0.3.0 // indirect
Expand Down Expand Up @@ -100,10 +101,10 @@ require (
go.opentelemetry.io/otel/sdk v1.19.0 // indirect
go.opentelemetry.io/otel/trace v1.19.0 // indirect
golang.org/x/crypto v0.22.0 // indirect
golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect
golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 // indirect
golang.org/x/net v0.24.0 // indirect
golang.org/x/oauth2 v0.14.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/term v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
Expand All @@ -114,9 +115,9 @@ require (
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/klog/v2 v2.110.1 // indirect
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 // indirect
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)
Loading

0 comments on commit 5b2215a

Please sign in to comment.