Skip to content

Commit

Permalink
make: re-add targets since they are used in the "sample"
Browse files Browse the repository at this point in the history
Signed-off-by: Maël Valais <[email protected]>
  • Loading branch information
maelvls authored Oct 9, 2023
1 parent 06af6a3 commit bb1a7db
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,74 @@ test: test-unit-deps | $(NEEDS_GO) $(NEEDS_GOTESTSUM) ## Run unit tests.
test-e2e: test-e2e-deps | $(NEEDS_GOTESTSUM) ## Run e2e tests. This creates a Kind cluster, installs dependencies, deploys the issuer-lib and runs the E2E tests.
$(GOTESTSUM) ./internal/testsetups/simple/e2e/... -coverprofile cover.out -timeout 1m

##@ Build

.PHONY: build
build: generate | $(NEEDS_GO) ## Build manager binary.
$(GOBUILD) -o bin/manager main.go

.PHONY: run
ARGS ?= # default empty
run: generate | $(NEEDS_GO) ## Run a controller from your host.
$(GO) run ./main.go $(ARGS)

# Defaults to false to prevent ko from pushing the Docker image to DOCKER_REGISTRY.
# Overridden to true by docker-push.
ko_push = false

# docker-build can both build the Docker image and push it to a DOCKER_REGISTRY
# depending on the value of ko_push.
# It can also create a local tar archive of the Docker image, but not when
# building multi-arch images.
# ko will automatically upload the Docker image to a Kind cluster when
# DOCKER_REGISTRY=kind.local, as set in test-e2e.
.PHONY: docker-build
docker-build: ## Build the docker image.
docker-build: | $(NEEDS_KO)
KIND_CLUSTER_NAME=$(KIND_CLUSTER_NAME) \
KO_DOCKER_REPO=$(DOCKER_REGISTRY) \
KOCACHE=$(KOCACHE) \
$(KO) build github.com/cert-manager/issuer-lib/internal/testsetups/simple/cmd/ \
--platform=$(DOCKER_IMAGE_PLATFORMS) \
$(if $(DOCKER_IMAGE_PLATFORMS),,--tarball=$(DOCKER_IMAGE_TAR)) \
--tags=$(DOCKER_TAG) \
--push=$(ko_push) \
--base-import-paths

.PHONY: docker-push
docker-push: ## Push docker image with the manager.
docker-push: ko_push = true
docker-push: docker-build

##@ Deployment

ifndef ignore-not-found
ignore-not-found = false
endif

$(BINDIR)/scratch/yaml/kustomization.yaml: FORCE | $(NEEDS_KUSTOMIZE)
rm -rf $(BINDIR)/scratch/yaml
mkdir -p $(BINDIR)/scratch/yaml

cd $(BINDIR)/scratch/yaml; \
$(KUSTOMIZE) create \
--namespace "my-namespace" \
--nameprefix "simple-issuer-" \
--resources ../../../internal/testsetups/simple/deploy/static/

cd $(BINDIR)/scratch/yaml; \
$(KUSTOMIZE) edit set image "controller:latest=$(DOCKER_REGISTRY)/cmd:$(DOCKER_TAG)"

.PHONY: install
install: generate-manifests $(BINDIR)/scratch/yaml/kustomization.yaml | $(NEEDS_KUBECTL) $(NEEDS_YQ) ## Install CRDs into the K8s cluster specified in ~/.kube/config.
$(KUBECTL) apply -f internal/testsetups/simple/deploy/crds
$(KUBECTL) apply -f internal/testsetups/simple/deploy/rbac
$(KUBECTL) apply -k $(BINDIR)/scratch/yaml/

.PHONY: uninstall
uninstall: generate-manifests | $(NEEDS_KUBECTL) ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
$(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f internal/testsetups/simple/deploy/crds

TEMP_DIR := _tmp
.PHONY: clean
clean:
Expand Down

0 comments on commit bb1a7db

Please sign in to comment.