# Produce CRDs that work back to Kubernetes 1.11 (no version conversion) CRD_OPTIONS ?= "crd:trivialVersions=true" # Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) ifeq (,$(shell go env GOBIN)) GOBIN=$(shell go env GOPATH)/bin else GOBIN=$(shell go env GOBIN) endif all: build # Run tests test: generate fmt vet manifests go test ./... -coverprofile cover.out # Build binary build: fmt vet go build -o bin/eks-distro-release main.go # Run against the configured Kubernetes cluster in ~/.kube/config run: generate fmt vet manifests go run ./main.go # Install CRDs into a cluster install: manifests kubectl apply -f ./config/crds/releasechannels.distro.eks.amazonaws.com-v1alpha1.yaml kubectl apply -f ./config/crds/releases.distro.eks.amazonaws.com-v1alpha1.yaml # Uninstall CRDs from a cluster uninstall: manifests kubectl delete -f ./config/crds/releasechannels.distro.eks.amazonaws.com-v1alpha1.yaml kubectl delete -f ./config/crds/releases.distro.eks.amazonaws.com-v1alpha1.yaml # Generate manifests e.g. CRD, RBAC etc. manifests: controller-gen $(CONTROLLER_GEN) $(CRD_OPTIONS) paths="./..." output:crd:artifacts:config=config/crds output:none # Run go fmt against code fmt: go fmt ./... # Run go vet against code vet: go vet ./... # Generate code generate: controller-gen $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." # find or download controller-gen # download controller-gen if necessary controller-gen: ifeq (, $(shell which controller-gen)) @{ \ set -e ;\ 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.2.5 ;\ rm -rf $$CONTROLLER_GEN_TMP_DIR ;\ } CONTROLLER_GEN=$(GOBIN)/controller-gen else CONTROLLER_GEN=$(shell which controller-gen) endif