2021-08-24 21:46:00 +03:00
|
|
|
REGISTRY ?= mcr.microsoft.com/oss/azure/workload-identity
|
2021-05-25 22:12:45 +03:00
|
|
|
PROXY_IMAGE_NAME := proxy
|
2021-05-01 00:51:28 +03:00
|
|
|
INIT_IMAGE_NAME := proxy-init
|
2021-05-22 00:17:04 +03:00
|
|
|
WEBHOOK_IMAGE_NAME := webhook
|
2021-09-28 22:46:36 +03:00
|
|
|
IMAGE_VERSION ?= v0.5.0
|
2021-05-01 00:51:28 +03:00
|
|
|
|
2021-07-16 00:52:25 +03:00
|
|
|
ORG_PATH := github.com/Azure
|
2021-08-24 21:46:00 +03:00
|
|
|
PROJECT_NAME := azure-workload-identity
|
2021-07-16 00:52:25 +03:00
|
|
|
BUILD_COMMIT := $(shell git rev-parse --short HEAD)
|
|
|
|
REPO_PATH := "$(ORG_PATH)/$(PROJECT_NAME)"
|
|
|
|
|
|
|
|
# build variables
|
|
|
|
BUILD_TIMESTAMP := $$(date +%Y-%m-%d-%H:%M)
|
|
|
|
BUILD_TIME_VAR := $(REPO_PATH)/pkg/version.BuildTime
|
|
|
|
BUILD_VERSION_VAR := $(REPO_PATH)/pkg/version.BuildVersion
|
|
|
|
VCS_VAR := $(REPO_PATH)/pkg/version.Vcs
|
|
|
|
LDFLAGS ?= "-X $(BUILD_TIME_VAR)=$(BUILD_TIMESTAMP) -X $(BUILD_VERSION_VAR)=$(IMAGE_VERSION) -X $(VCS_VAR)=$(BUILD_COMMIT)"
|
|
|
|
|
2021-05-13 23:06:27 +03:00
|
|
|
PROXY_IMAGE := $(REGISTRY)/$(PROXY_IMAGE_NAME):$(IMAGE_VERSION)
|
|
|
|
INIT_IMAGE := $(REGISTRY)/$(INIT_IMAGE_NAME):$(IMAGE_VERSION)
|
2021-05-22 00:17:04 +03:00
|
|
|
WEBHOOK_IMAGE := $(REGISTRY)/$(WEBHOOK_IMAGE_NAME):$(IMAGE_VERSION)
|
2021-05-01 00:51:28 +03:00
|
|
|
|
2021-07-13 22:02:30 +03:00
|
|
|
GOOS := $(shell go env GOOS)
|
|
|
|
GOARCH :=$(shell go env GOARCH)
|
|
|
|
|
2021-05-05 03:06:06 +03:00
|
|
|
# Directories
|
|
|
|
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
|
|
|
BIN_DIR := $(abspath $(ROOT_DIR)/bin)
|
|
|
|
TOOLS_DIR := hack/tools
|
|
|
|
TOOLS_BIN_DIR := $(abspath $(TOOLS_DIR)/bin)
|
|
|
|
|
|
|
|
# Binaries
|
2021-05-11 00:28:14 +03:00
|
|
|
CONTROLLER_GEN_VER := v0.5.0
|
|
|
|
CONTROLLER_GEN_BIN := controller-gen
|
|
|
|
CONTROLLER_GEN := $(TOOLS_BIN_DIR)/$(CONTROLLER_GEN_BIN)-$(CONTROLLER_GEN_VER)
|
|
|
|
|
2021-05-05 03:06:06 +03:00
|
|
|
E2E_TEST_BIN := e2e.test
|
|
|
|
E2E_TEST := $(BIN_DIR)/$(E2E_TEST_BIN)
|
|
|
|
|
|
|
|
GINKGO_VER := v1.16.2
|
|
|
|
GINKGO_BIN := ginkgo
|
|
|
|
GINKGO := $(TOOLS_BIN_DIR)/$(GINKGO_BIN)-$(GINKGO_VER)
|
|
|
|
|
2021-05-20 19:44:56 +03:00
|
|
|
KIND_VER := v0.11.0
|
2021-05-12 01:34:15 +03:00
|
|
|
KIND_BIN := kind
|
|
|
|
KIND := $(TOOLS_BIN_DIR)/$(KIND_BIN)-$(KIND_VER)
|
|
|
|
|
2021-07-12 22:19:29 +03:00
|
|
|
KUBECTL_VER := v1.21.2
|
2021-05-11 00:28:14 +03:00
|
|
|
KUBECTL_BIN := kubectl
|
|
|
|
KUBECTL := $(TOOLS_BIN_DIR)/$(KUBECTL_BIN)-$(KUBECTL_VER)
|
2021-05-05 03:06:06 +03:00
|
|
|
|
2021-05-11 00:28:14 +03:00
|
|
|
KUSTOMIZE_VER := v4.1.2
|
|
|
|
KUSTOMIZE_BIN := kustomize
|
|
|
|
KUSTOMIZE := $(TOOLS_BIN_DIR)/$(KUSTOMIZE_BIN)-$(KUSTOMIZE_VER)
|
2021-05-05 03:06:06 +03:00
|
|
|
|
2021-07-08 22:34:20 +03:00
|
|
|
GOLANGCI_LINT_VER := v1.41.1
|
2021-05-11 02:21:01 +03:00
|
|
|
GOLANGCI_LINT_BIN := golangci-lint
|
|
|
|
GOLANGCI_LINT := $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER)
|
|
|
|
|
2021-05-12 01:34:15 +03:00
|
|
|
SHELLCHECK_VER := v0.7.2
|
|
|
|
SHELLCHECK_BIN := shellcheck
|
|
|
|
SHELLCHECK := $(TOOLS_BIN_DIR)/$(SHELLCHECK_BIN)-$(SHELLCHECK_VER)
|
|
|
|
|
2021-05-13 22:04:35 +03:00
|
|
|
ENVSUBST_VER := v1.2.0
|
|
|
|
ENVSUBST_BIN := envsubst
|
2021-09-06 23:53:47 +03:00
|
|
|
ENVSUBST := $(TOOLS_BIN_DIR)/$(ENVSUBST_BIN)-$(ENVSUBST_VER)
|
2021-05-13 22:04:35 +03:00
|
|
|
|
2021-07-13 22:02:30 +03:00
|
|
|
HELM_VER := v3.6.2
|
|
|
|
HELM_BIN := helm
|
|
|
|
HELM := $(TOOLS_BIN_DIR)/$(HELM_BIN)-$(HELM_VER)
|
|
|
|
|
2021-05-11 00:28:14 +03:00
|
|
|
# Scripts
|
|
|
|
GO_INSTALL := ./hack/go-install.sh
|
|
|
|
|
|
|
|
## --------------------------------------
|
2021-05-13 23:06:27 +03:00
|
|
|
## Images
|
2021-05-11 00:28:14 +03:00
|
|
|
## --------------------------------------
|
|
|
|
|
|
|
|
OUTPUT_TYPE ?= type=registry
|
2021-05-01 00:51:28 +03:00
|
|
|
|
2021-05-13 23:06:27 +03:00
|
|
|
.PHONY: docker-build
|
2021-05-22 00:17:04 +03:00
|
|
|
docker-build: docker-build-init docker-build-proxy docker-build-webhook
|
2021-05-13 23:06:27 +03:00
|
|
|
|
|
|
|
.PHONY: docker-build-init
|
|
|
|
docker-build-init:
|
|
|
|
docker buildx build --no-cache -t $(INIT_IMAGE) -f docker/init.Dockerfile --platform="linux/amd64" --output=$(OUTPUT_TYPE) .
|
|
|
|
|
|
|
|
.PHONY: docker-build-proxy
|
|
|
|
docker-build-proxy:
|
|
|
|
docker buildx build --no-cache -t $(PROXY_IMAGE) -f docker/proxy.Dockerfile --platform="linux/amd64" --output=$(OUTPUT_TYPE) .
|
|
|
|
|
2021-05-22 00:17:04 +03:00
|
|
|
.PHONY: docker-build-webhook
|
|
|
|
docker-build-webhook:
|
2021-07-16 00:52:25 +03:00
|
|
|
docker buildx build --no-cache --build-arg LDFLAGS=${LDFLAGS} -t $(WEBHOOK_IMAGE) -f docker/webhook.Dockerfile --platform="linux/amd64" --output=$(OUTPUT_TYPE) .
|
2021-05-22 00:17:04 +03:00
|
|
|
|
2021-05-13 23:06:27 +03:00
|
|
|
.PHONY: docker-push
|
2021-05-22 00:17:04 +03:00
|
|
|
docker-push: docker-push-init docker-push-proxy docker-push-webhook
|
2021-05-13 23:06:27 +03:00
|
|
|
|
|
|
|
.PHONY: docker-push-init
|
|
|
|
docker-push-init:
|
|
|
|
docker push $(INIT_IMAGE)
|
2021-05-01 00:51:28 +03:00
|
|
|
|
2021-05-13 23:06:27 +03:00
|
|
|
.PHONY: docker-push-proxy
|
|
|
|
docker-push-proxy:
|
|
|
|
docker push $(PROXY_IMAGE)
|
2021-05-04 22:30:57 +03:00
|
|
|
|
2021-05-22 00:17:04 +03:00
|
|
|
.PHONY: docker-push-webhook
|
|
|
|
docker-push-webhook:
|
|
|
|
docker push $(WEBHOOK_IMAGE)
|
|
|
|
|
2021-05-04 22:30:57 +03:00
|
|
|
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
|
|
|
|
CRD_OPTIONS ?= "crd:trivialVersions=true"
|
|
|
|
|
2021-05-11 00:28:14 +03:00
|
|
|
.PHONY: all
|
2021-05-04 22:30:57 +03:00
|
|
|
all: manager
|
|
|
|
|
|
|
|
# Build manager binary
|
2021-05-11 00:28:14 +03:00
|
|
|
.PHONY: manager
|
2021-05-04 22:30:57 +03:00
|
|
|
manager: generate fmt vet
|
2021-07-16 00:52:25 +03:00
|
|
|
go build -a -ldflags $(LDFLAGS) -o bin/manager cmd/webhook/main.go
|
2021-05-04 22:30:57 +03:00
|
|
|
|
2021-08-12 23:43:14 +03:00
|
|
|
# Build proxy binary
|
|
|
|
.PHONY: proxy
|
|
|
|
proxy: fmt vet
|
|
|
|
go build -a -ldflags $(LDFLAGS) -o bin/proxy cmd/proxy/main.go
|
|
|
|
|
2021-05-04 22:30:57 +03:00
|
|
|
# Run against the configured Kubernetes cluster in ~/.kube/config
|
2021-05-11 00:28:14 +03:00
|
|
|
.PHONY: run
|
2021-05-04 22:30:57 +03:00
|
|
|
run: generate fmt vet manifests
|
|
|
|
go run .cmd/webhook/main.go
|
|
|
|
|
|
|
|
# Deploy controller in the configured Kubernetes cluster in ~/.kube/config
|
2021-05-18 21:44:00 +03:00
|
|
|
ARC_CLUSTER ?= false
|
2021-06-29 15:59:38 +03:00
|
|
|
AZURE_ENVIRONMENT ?=
|
2021-05-18 21:44:00 +03:00
|
|
|
AZURE_TENANT_ID ?=
|
|
|
|
|
2021-05-11 00:28:14 +03:00
|
|
|
.PHONY: deploy
|
2021-05-13 22:04:35 +03:00
|
|
|
deploy: $(KUBECTL) $(KUSTOMIZE) $(ENVSUBST)
|
2021-07-20 01:32:46 +03:00
|
|
|
$(MAKE) manifests
|
2021-05-22 00:17:04 +03:00
|
|
|
cd config/manager && $(KUSTOMIZE) edit set image manager=$(WEBHOOK_IMAGE)
|
2021-05-13 22:04:35 +03:00
|
|
|
$(KUSTOMIZE) build config/default | $(ENVSUBST) | $(KUBECTL) apply -f -
|
2021-08-24 21:46:00 +03:00
|
|
|
$(KUBECTL) wait --for=condition=Available --timeout=5m -n azure-workload-identity-system deployment/azure-wi-webhook-controller-manager
|
2021-05-11 00:28:14 +03:00
|
|
|
|
2021-07-13 22:02:30 +03:00
|
|
|
.PHONY: uninstall-deploy
|
|
|
|
uninstall-deploy: $(KUBECTL) $(KUSTOMIZE) $(ENVSUBST)
|
|
|
|
$(KUSTOMIZE) build config/default | $(ENVSUBST) | $(KUBECTL) delete -f -
|
|
|
|
|
2021-05-11 00:28:14 +03:00
|
|
|
## --------------------------------------
|
|
|
|
## Code Generation
|
|
|
|
## --------------------------------------
|
2021-05-04 22:30:57 +03:00
|
|
|
|
|
|
|
# Generate manifests e.g. CRD, RBAC etc.
|
2021-05-11 00:28:14 +03:00
|
|
|
.PHONY: manifests
|
2021-05-25 03:35:13 +03:00
|
|
|
manifests: $(CONTROLLER_GEN) $(KUSTOMIZE)
|
2021-05-04 22:30:57 +03:00
|
|
|
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..."
|
|
|
|
|
2021-07-08 05:37:42 +03:00
|
|
|
rm -rf manifest_staging
|
|
|
|
mkdir -p manifest_staging/deploy
|
2021-08-24 21:46:00 +03:00
|
|
|
mkdir -p manifest_staging/charts/workload-identity-webhook
|
2021-07-08 05:37:42 +03:00
|
|
|
|
2021-08-24 21:46:00 +03:00
|
|
|
$(KUSTOMIZE) build config/default -o manifest_staging/deploy/azure-wi-webhook.yaml
|
2021-07-08 05:37:42 +03:00
|
|
|
$(KUSTOMIZE) build third_party/open-policy-agent/gatekeeper/helmify | go run third_party/open-policy-agent/gatekeeper/helmify/*.go
|
|
|
|
|
2021-08-24 21:46:00 +03:00
|
|
|
@sed -i -e "s/AZURE_TENANT_ID: .*/AZURE_TENANT_ID: <replace with Azure Tenant ID>/" manifest_staging/deploy/azure-wi-webhook.yaml
|
|
|
|
@sed -i -e "s/AZURE_ENVIRONMENT: .*/AZURE_ENVIRONMENT: <replace with Azure Environment Name>/" manifest_staging/deploy/azure-wi-webhook.yaml
|
|
|
|
@sed -i -e "s/-arc-cluster=.*/-arc-cluster=false/" manifest_staging/deploy/azure-wi-webhook.yaml
|
2021-05-25 03:35:13 +03:00
|
|
|
|
2021-05-11 00:28:14 +03:00
|
|
|
# Generate code
|
|
|
|
.PHONY: generate
|
|
|
|
generate: $(CONTROLLER_GEN)
|
|
|
|
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
|
|
|
|
|
|
|
|
## --------------------------------------
|
|
|
|
## Tooling Binaries and Manifests
|
|
|
|
## --------------------------------------
|
|
|
|
|
|
|
|
$(CONTROLLER_GEN):
|
|
|
|
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) sigs.k8s.io/controller-tools/cmd/controller-gen $(CONTROLLER_GEN_BIN) $(CONTROLLER_GEN_VER)
|
|
|
|
|
|
|
|
$(GINKGO):
|
|
|
|
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) github.com/onsi/ginkgo/ginkgo $(GINKGO_BIN) $(GINKGO_VER)
|
|
|
|
|
2021-05-12 01:34:15 +03:00
|
|
|
$(KIND):
|
|
|
|
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) sigs.k8s.io/kind $(KIND_BIN) $(KIND_VER)
|
|
|
|
|
2021-05-11 00:28:14 +03:00
|
|
|
$(KUSTOMIZE):
|
2021-09-06 23:53:47 +03:00
|
|
|
mkdir -p $(TOOLS_BIN_DIR)
|
|
|
|
rm -rf "$(SHELLCHECK)*"
|
|
|
|
curl -sfOL "https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2F$(KUSTOMIZE_VER)/kustomize_$(KUSTOMIZE_VER)_$(GOOS)_$(GOARCH).tar.gz"
|
|
|
|
tar xf kustomize_${KUSTOMIZE_VER}_$(GOOS)_$(GOARCH).tar.gz
|
|
|
|
cp "kustomize" "$(KUSTOMIZE)"
|
|
|
|
ln -sf "$(KUSTOMIZE)" "$(TOOLS_BIN_DIR)/$(KUSTOMIZE_BIN)"
|
|
|
|
chmod +x "$(TOOLS_BIN_DIR)/$(KUSTOMIZE_BIN)" "$(KUSTOMIZE)"
|
|
|
|
rm -rf kustomize*
|
2021-05-11 00:28:14 +03:00
|
|
|
|
|
|
|
$(KUBECTL):
|
|
|
|
mkdir -p $(TOOLS_BIN_DIR)
|
|
|
|
rm -f "$(KUBECTL)*"
|
2021-07-13 22:02:30 +03:00
|
|
|
curl -sfL https://storage.googleapis.com/kubernetes-release/release/$(KUBECTL_VER)/bin/$(GOOS)/$(GOARCH)/kubectl -o $(KUBECTL)
|
2021-05-11 00:28:14 +03:00
|
|
|
ln -sf "$(KUBECTL)" "$(TOOLS_BIN_DIR)/$(KUBECTL_BIN)"
|
|
|
|
chmod +x "$(TOOLS_BIN_DIR)/$(KUBECTL_BIN)" "$(KUBECTL)"
|
|
|
|
|
2021-05-11 02:21:01 +03:00
|
|
|
$(GOLANGCI_LINT):
|
|
|
|
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) github.com/golangci/golangci-lint/cmd/golangci-lint $(GOLANGCI_LINT_BIN) $(GOLANGCI_LINT_VER)
|
|
|
|
|
2021-05-12 01:34:15 +03:00
|
|
|
OS := $(shell uname | tr '[:upper:]' '[:lower:]')
|
|
|
|
ARCH := $(shell uname -m)
|
|
|
|
$(SHELLCHECK):
|
|
|
|
mkdir -p $(TOOLS_BIN_DIR)
|
|
|
|
rm -rf "$(SHELLCHECK)*"
|
|
|
|
curl -sfOL "https://github.com/koalaman/shellcheck/releases/download/$(SHELLCHECK_VER)/shellcheck-$(SHELLCHECK_VER).$(OS).$(ARCH).tar.xz"
|
|
|
|
tar xf shellcheck-$(SHELLCHECK_VER).$(OS).$(ARCH).tar.xz
|
|
|
|
cp "shellcheck-$(SHELLCHECK_VER)/$(SHELLCHECK_BIN)" "$(SHELLCHECK)"
|
|
|
|
ln -sf "$(SHELLCHECK)" "$(TOOLS_BIN_DIR)/$(SHELLCHECK_BIN)"
|
|
|
|
chmod +x "$(TOOLS_BIN_DIR)/$(SHELLCHECK_BIN)" "$(SHELLCHECK)"
|
|
|
|
rm -rf shellcheck*
|
|
|
|
|
2021-05-13 22:04:35 +03:00
|
|
|
$(ENVSUBST):
|
|
|
|
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) github.com/a8m/envsubst/cmd/envsubst $(ENVSUBST_BIN) $(ENVSUBST_VER)
|
|
|
|
|
2021-07-13 22:02:30 +03:00
|
|
|
$(HELM):
|
|
|
|
curl -sfOL "https://get.helm.sh/helm-$(HELM_VER)-$(GOOS)-$(GOARCH).tar.gz"
|
|
|
|
tar -zxvf helm-$(HELM_VER)-$(GOOS)-$(GOARCH).tar.gz
|
|
|
|
cp "$(OS)-$(GOARCH)/$(HELM_BIN)" "$(HELM)"
|
|
|
|
ln -sf "$(HELM)" "$(TOOLS_BIN_DIR)/$(HELM_BIN)"
|
|
|
|
chmod +x "$(TOOLS_BIN_DIR)/$(HELM_BIN)" "$(HELM)"
|
|
|
|
rm -rf helm* $(OS)-$(GOARCH)
|
|
|
|
|
2021-08-06 21:23:05 +03:00
|
|
|
## --------------------------------------
|
|
|
|
## E2E images
|
|
|
|
## --------------------------------------
|
|
|
|
MSAL_GO_E2E_IMAGE := $(REGISTRY)/msal-go-e2e:$(IMAGE_VERSION)
|
|
|
|
|
|
|
|
.PHONY: docker-build-e2e-msal-go
|
|
|
|
docker-build-e2e-msal-go:
|
|
|
|
docker buildx build --no-cache -t $(MSAL_GO_E2E_IMAGE) -f examples/msal-go/Dockerfile --platform="linux/amd64" --output=$(OUTPUT_TYPE) examples/msal-go
|
|
|
|
|
2021-05-11 00:28:14 +03:00
|
|
|
## --------------------------------------
|
|
|
|
## Testing
|
|
|
|
## --------------------------------------
|
|
|
|
|
2021-05-04 22:30:57 +03:00
|
|
|
# Run go fmt against code
|
2021-05-11 00:28:14 +03:00
|
|
|
.PHONY: fmt
|
2021-05-04 22:30:57 +03:00
|
|
|
fmt:
|
|
|
|
go fmt ./...
|
|
|
|
|
|
|
|
# Run go vet against code
|
2021-05-11 00:28:14 +03:00
|
|
|
.PHONY: vet
|
2021-05-04 22:30:57 +03:00
|
|
|
vet:
|
|
|
|
go vet ./...
|
|
|
|
|
2021-05-11 00:28:14 +03:00
|
|
|
# Run tests
|
|
|
|
.PHONY: test
|
|
|
|
test: generate fmt vet manifests
|
|
|
|
go test ./... -coverprofile cover.out
|
2021-05-05 03:06:06 +03:00
|
|
|
|
|
|
|
$(E2E_TEST):
|
2021-05-11 00:28:14 +03:00
|
|
|
go test -tags=e2e -c ./test/e2e -o $(E2E_TEST)
|
2021-05-05 03:06:06 +03:00
|
|
|
|
2021-05-11 00:28:14 +03:00
|
|
|
# Ginkgo configurations
|
|
|
|
GINKGO_FOCUS ?=
|
|
|
|
GINKGO_SKIP ?=
|
2021-08-13 03:29:57 +03:00
|
|
|
GINKGO_NODES ?= 3
|
2021-05-11 00:28:14 +03:00
|
|
|
GINKGO_NO_COLOR ?= false
|
2021-07-23 20:12:09 +03:00
|
|
|
GINKGO_TIMEOUT ?= 5m
|
|
|
|
GINKGO_ARGS ?= -focus="$(GINKGO_FOCUS)" -skip="$(GINKGO_SKIP)" -nodes=$(GINKGO_NODES) -noColor=$(GINKGO_NO_COLOR) -timeout=$(GINKGO_TIMEOUT)
|
2021-05-11 00:28:14 +03:00
|
|
|
|
|
|
|
# E2E configurations
|
|
|
|
KUBECONFIG ?= $(HOME)/.kube/config
|
2021-08-12 23:43:14 +03:00
|
|
|
E2E_ARGS := -kubeconfig=$(KUBECONFIG) -report-dir=$(PWD)/_artifacts \
|
|
|
|
-e2e.arc-cluster=$(ARC_CLUSTER) \
|
|
|
|
-e2e.token-exchange-image=$(MSAL_GO_E2E_IMAGE) \
|
|
|
|
-e2e.proxy-image=$(PROXY_IMAGE) \
|
|
|
|
-e2e.proxy-init-image=$(INIT_IMAGE)
|
2021-07-17 00:36:59 +03:00
|
|
|
E2E_EXTRA_ARGS ?=
|
2021-05-05 03:06:06 +03:00
|
|
|
|
|
|
|
.PHONY: test-e2e-run
|
|
|
|
test-e2e-run: $(E2E_TEST) $(GINKGO)
|
2021-05-18 21:44:00 +03:00
|
|
|
$(GINKGO) -v -trace $(GINKGO_ARGS) \
|
2021-07-17 00:36:59 +03:00
|
|
|
$(E2E_TEST) -- $(E2E_ARGS) $(E2E_EXTRA_ARGS)
|
2021-05-05 03:06:06 +03:00
|
|
|
|
|
|
|
.PHONY: test-e2e
|
2021-07-13 22:02:30 +03:00
|
|
|
test-e2e: $(KUBECTL) $(HELM)
|
2021-05-11 00:28:14 +03:00
|
|
|
./scripts/ci-e2e.sh
|
|
|
|
|
|
|
|
## --------------------------------------
|
|
|
|
## Kind
|
|
|
|
## --------------------------------------
|
|
|
|
|
2021-08-24 21:46:00 +03:00
|
|
|
KIND_CLUSTER_NAME ?= azure-workload-identity
|
2021-05-12 01:34:15 +03:00
|
|
|
|
2021-05-11 00:28:14 +03:00
|
|
|
.PHONY: kind-create
|
2021-05-12 01:34:15 +03:00
|
|
|
kind-create: $(KIND) $(KUBECTL)
|
|
|
|
./scripts/create-kind-cluster.sh
|
2021-06-18 20:03:27 +03:00
|
|
|
|
|
|
|
.PHONY: kind-load-image
|
|
|
|
kind-load-image:
|
2021-05-22 00:17:04 +03:00
|
|
|
$(KIND) load docker-image $(WEBHOOK_IMAGE) --name $(KIND_CLUSTER_NAME)
|
2021-08-06 21:23:05 +03:00
|
|
|
$(KIND) load docker-image $(MSAL_GO_E2E_IMAGE) --name $(KIND_CLUSTER_NAME)
|
2021-08-12 23:43:14 +03:00
|
|
|
$(KIND) load docker-image $(PROXY_IMAGE) --name $(KIND_CLUSTER_NAME)
|
|
|
|
$(KIND) load docker-image $(INIT_IMAGE) --name $(KIND_CLUSTER_NAME)
|
2021-05-11 00:28:14 +03:00
|
|
|
|
|
|
|
.PHONY: kind-delete
|
2021-05-12 01:34:15 +03:00
|
|
|
kind-delete: $(KIND)
|
|
|
|
$(KIND) delete cluster --name=$(KIND_CLUSTER_NAME) || true
|
2021-05-11 00:28:14 +03:00
|
|
|
|
|
|
|
## --------------------------------------
|
|
|
|
## Cleanup
|
|
|
|
## --------------------------------------
|
2021-05-05 03:06:06 +03:00
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
2021-05-11 00:28:14 +03:00
|
|
|
@rm -rf $(BIN_DIR)
|
2021-05-11 02:21:01 +03:00
|
|
|
|
|
|
|
## --------------------------------------
|
|
|
|
## Linting
|
|
|
|
## --------------------------------------
|
|
|
|
|
|
|
|
.PHONY: lint
|
|
|
|
lint: $(GOLANGCI_LINT)
|
|
|
|
$(GOLANGCI_LINT) run -v
|
|
|
|
|
2021-07-13 22:02:30 +03:00
|
|
|
.PHONY: helm-lint
|
|
|
|
helm-lint: $(HELM)
|
2021-08-24 21:46:00 +03:00
|
|
|
$(HELM) lint manifest_staging/charts/workload-identity-webhook
|
2021-07-13 22:02:30 +03:00
|
|
|
|
2021-05-12 01:34:15 +03:00
|
|
|
.PHONY: lint-full
|
2021-05-11 02:21:01 +03:00
|
|
|
lint-full: $(GOLANGCI_LINT) ## Run slower linters to detect possible issues
|
|
|
|
$(GOLANGCI_LINT) run -v --fast=false
|
2021-05-12 01:34:15 +03:00
|
|
|
|
|
|
|
.PHONY: shellcheck
|
|
|
|
shellcheck: $(SHELLCHECK)
|
|
|
|
$(SHELLCHECK) */*.sh
|
2021-05-25 03:35:13 +03:00
|
|
|
|
|
|
|
## --------------------------------------
|
|
|
|
## Release
|
|
|
|
## --------------------------------------
|
2021-07-08 05:37:42 +03:00
|
|
|
|
2021-08-07 01:11:23 +03:00
|
|
|
release-manifest: $(KUSTOMIZE)
|
2021-08-05 02:00:48 +03:00
|
|
|
@sed -i -e 's/^IMAGE_VERSION ?= .*/IMAGE_VERSION ?= ${NEW_VERSION}/' ./Makefile
|
|
|
|
cd config/manager && $(KUSTOMIZE) edit set image manager=$(REGISTRY)/$(WEBHOOK_IMAGE_NAME):$(NEW_VERSION)
|
2021-07-08 05:37:42 +03:00
|
|
|
@sed -i -e "s/appVersion: .*/appVersion: ${NEW_VERSION}/" ./third_party/open-policy-agent/gatekeeper/helmify/static/Chart.yaml
|
|
|
|
@sed -i -e "s/version: .*/version: $$(echo ${NEW_VERSION} | cut -c2-)/" ./third_party/open-policy-agent/gatekeeper/helmify/static/Chart.yaml
|
|
|
|
@sed -i -e "s/release: .*/release: ${NEW_VERSION}/" ./third_party/open-policy-agent/gatekeeper/helmify/static/values.yaml
|
|
|
|
@sed -i -e 's/Current release version: `.*`/Current release version: `'"${NEW_VERSION}"'`/' ./third_party/open-policy-agent/gatekeeper/helmify/static/README.md
|
|
|
|
export
|
|
|
|
$(MAKE) manifests
|
|
|
|
|
2021-05-25 03:35:13 +03:00
|
|
|
.PHONY: promote-staging-manifest
|
2021-07-28 23:41:28 +03:00
|
|
|
promote-staging-manifest: #promote staging manifests to release dir
|
2021-05-25 03:35:13 +03:00
|
|
|
@rm -rf deploy
|
|
|
|
@cp -r manifest_staging/deploy .
|
2021-08-24 21:46:00 +03:00
|
|
|
@rm -rf charts/workload-identity-webhook
|
2021-07-08 05:37:42 +03:00
|
|
|
@cp -r manifest_staging/charts .
|