From 7f13b8216797176ed0c347bc286dc53597765a3a Mon Sep 17 00:00:00 2001 From: Jiri Tyr Date: Fri, 8 Apr 2022 15:16:43 +0200 Subject: [PATCH 1/6] Updating CRD to latest version --- .../bases/app.terraform.io_workspaces.yaml | 560 +++++++++--------- 1 file changed, 294 insertions(+), 266 deletions(-) diff --git a/config/crd/bases/app.terraform.io_workspaces.yaml b/config/crd/bases/app.terraform.io_workspaces.yaml index 770ec825..0160e055 100644 --- a/config/crd/bases/app.terraform.io_workspaces.yaml +++ b/config/crd/bases/app.terraform.io_workspaces.yaml @@ -1,6 +1,6 @@ --- -apiVersion: apiextensions.k8s.io/v1beta1 +apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: @@ -15,285 +15,313 @@ spec: plural: workspaces singular: workspace scope: Namespaced - subresources: - status: {} - validation: - openAPIV3Schema: - description: Workspace is the Schema for the workspaces API - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: WorkspaceSpec defines the desired state of Workspace - properties: - agentPoolID: - description: Specifies the agent pool ID we wish to use. - type: string - agentPoolName: - description: Specifies the agent pool name we wish to use. - type: string - module: - description: Module source and version to use - nullable: true - properties: - source: - description: Any remote module source (version control, registry) - type: string - version: - description: Module version for registry modules - type: string - required: - - source - type: object - notifications: - description: Notification configuration - items: - description: Notification notification holds all the necessary information - required to configure any workspace notification + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: Workspace is the Schema for the workspaces API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: WorkspaceSpec defines the desired state of Workspace + properties: + agentPoolID: + description: Specifies the agent pool ID we wish to use. + type: string + agentPoolName: + description: Specifies the agent pool name we wish to use. + type: string + module: + description: Module source and version to use + nullable: true properties: - enabled: - description: Control if the notification is enabled or not - type: boolean - name: - description: Name of the hook + source: + description: Any remote module source (version control, registry) type: string - recipients: - description: List of recipients' email addresses. Only applicable - for TFE endpoints. - items: - type: string - type: array - token: - description: Token used to generate an HMAC on the verificatio0n - request + version: + description: Module version for registry modules type: string - triggers: - description: When the web hook gets triggered. Acceptable values - are run:created, run:planning, run:needs_attention, run:applying, - run:completed, run:errored. - items: - type: string - type: array - type: - description: Notification type. Can be one of email, generic, - or slack - type: string - url: - description: URL of the hook - type: string - users: - description: List of users to receive the notificaiton email. - items: - type: string - type: array required: - - enabled - - name - - type + - source type: object - type: array - omitNamespacePrefix: - description: Omit namespace prefix in workspace name - type: boolean - organization: - description: Terraform Cloud organization - type: string - outputs: - description: Outputs denote outputs wanted - items: - description: OutputSpec specifies which values need to be output - properties: - key: - description: Output name - type: string - moduleOutputName: - description: Attribute name in module - type: string - type: object - type: array - runTriggers: - description: Run Triggers from source workspaces to trigger this workspace - items: - description: Run Trigger from a source workspace + notifications: + description: Notification configuration + items: + description: Notification notification holds all the necessary information + required to configure any workspace notification + properties: + enabled: + description: Control if the notification is enabled or not + type: boolean + name: + description: Name of the hook + type: string + recipients: + description: List of recipients' email addresses. Only applicable + for TFE endpoints. + items: + type: string + type: array + token: + description: Token used to generate an HMAC on the verificatio0n + request + type: string + triggers: + description: When the web hook gets triggered. Acceptable values + are run:created, run:planning, run:needs_attention, run:applying, + run:completed, run:errored. + items: + type: string + type: array + type: + description: Notification type. Can be one of email, generic, + or slack + type: string + url: + description: URL of the hook + type: string + users: + description: List of users to receive the notificaiton email. + items: + type: string + type: array + required: + - enabled + - name + - type + type: object + type: array + omitNamespacePrefix: + description: Omit namespace prefix in workspace name + type: boolean + organization: + description: Terraform Cloud organization + type: string + outputs: + description: Outputs denote outputs wanted + items: + description: OutputSpec specifies which values need to be output + properties: + key: + description: Output name + type: string + moduleOutputName: + description: Attribute name in module + type: string + type: object + type: array + runTriggers: + description: Run Triggers from source workspaces to trigger this workspace + items: + description: Run Trigger from a source workspace + properties: + sourceableName: + description: Name of source workspace that triggers the current + workspace + type: string + required: + - sourceableName + type: object + type: array + secretsMountPath: + description: File path within operator pod to load workspace secrets + type: string + sshKeyID: + description: SSH Key ID. This key must already exist in the TF Cloud + organization. This can either be the user assigned name of the + SSH Key, or the system assigned ID. + type: string + terraformVersion: + description: Terraform version used for this workspace. The default + is `latest`. + type: string + variables: + description: Variables as inputs to module + items: + description: Variable denotes an input to the module + properties: + environmentVariable: + description: EnvironmentVariable denotes if this variable should + be created as environment variable + type: boolean + hcl: + description: String input should be an HCL-formatted variable + type: boolean + key: + description: Variable name + type: string + sensitive: + description: Variable is a secret and should be retrieved from + file + type: boolean + value: + description: Variable value + type: string + valueFrom: + description: Source for the variable's value. Cannot be used + if value is not empty. + properties: + configMapKeyRef: + description: Selects a key of a ConfigMap. + properties: + key: + description: The key to select. + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + optional: + description: Specify whether the ConfigMap or its key + must be defined + type: boolean + required: + - key + type: object + fieldRef: + description: 'Selects a field of the pod: supports metadata.name, + metadata.namespace, `metadata.labels['''']`, `metadata.annotations['''']`, + spec.nodeName, spec.serviceAccountName, status.hostIP, + status.podIP, status.podIPs.' + properties: + apiVersion: + description: Version of the schema the FieldPath is + written in terms of, defaults to "v1". + type: string + fieldPath: + description: Path of the field to select in the specified + API version. + type: string + required: + - fieldPath + type: object + resourceFieldRef: + description: 'Selects a resource of the container: only + resources limits and requests (limits.cpu, limits.memory, + limits.ephemeral-storage, requests.cpu, requests.memory + and requests.ephemeral-storage) are currently supported.' + properties: + containerName: + description: 'Container name: required for volumes, + optional for env vars' + type: string + divisor: + anyOf: + - type: integer + - type: string + description: Specifies the output format of the exposed + resources, defaults to "1" + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + resource: + description: 'Required: resource to select' + type: string + required: + - resource + type: object + secretKeyRef: + description: Selects a key of a secret in the pod's namespace + properties: + key: + description: The key of the secret to select from. Must + be a valid secret key. + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + optional: + description: Specify whether the Secret or its key must + be defined + type: boolean + required: + - key + type: object + type: object + required: + - environmentVariable + - key + - sensitive + type: object + type: array + vcs: + description: Details of the VCS repository we want to connect to the + workspace + nullable: true properties: - sourceableName: - description: Name of source workspace that triggers the current - workspace + branch: + description: The repository branch to use type: string - required: - - sourceableName - type: object - type: array - secretsMountPath: - description: File path within operator pod to load workspace secrets - type: string - sshKeyID: - description: SSH Key ID. This key must already exist in the TF Cloud organization. This can either be the user assigned name of the SSH Key, or the system assigned ID. - type: string - terraformVersion: - description: Terraform version used for this workspace. The default is `latest`. - type: string - variables: - description: Variables as inputs to module - items: - description: Variable denotes an input to the module - properties: - environmentVariable: - description: EnvironmentVariable denotes if this variable should be created as environment variable + ingress_submodules: + description: Whether submodules should be fetched when cloning + the VCS repository (Defaults to false) type: boolean - hcl: - description: String input should be an HCL-formatted variable - type: boolean - key: - description: Variable name + repo_identifier: + description: A reference to your VCS repository in the format + org/repo type: string - sensitive: - description: Variable is a secret and should be retrieved from file - type: boolean - value: - description: Variable value + token_id: + description: Token ID of the VCS Connection (OAuth Connection + Token) to use https://www.terraform.io/docs/cloud/vcs type: string - valueFrom: - description: Source for the variable's value. Cannot be used if value is not empty. - properties: - configMapKeyRef: - description: Selects a key of a ConfigMap. - properties: - key: - description: The key to select. - type: string - name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?' - type: string - optional: - description: Specify whether the ConfigMap or its key must be defined - type: boolean - required: - - key - type: object - fieldRef: - description: 'Selects a field of the pod: supports metadata.name, metadata.namespace, metadata.labels, metadata.annotations, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs.' - properties: - apiVersion: - description: Version of the schema the FieldPath is written in terms of, defaults to "v1". - type: string - fieldPath: - description: Path of the field to select in the specified API version. - type: string - required: - - fieldPath - type: object - resourceFieldRef: - description: 'Selects a resource of the container: only resources limits and requests (limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported.' - properties: - containerName: - description: 'Container name: required for volumes, optional for env vars' - type: string - divisor: - anyOf: - - type: integer - - type: string - description: Specifies the output format of the exposed resources, defaults to "1" - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - description: 'Required: resource to select' - type: string - required: - - resource - type: object - secretKeyRef: - description: Selects a key of a secret in the pod's namespace - properties: - key: - description: The key of the secret to select from. Must be a valid secret key. - type: string - name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?' - type: string - optional: - description: Specify whether the Secret or its key must be defined - type: boolean - required: - - key - type: object - type: object required: - - environmentVariable - - key - - sensitive + - repo_identifier + - token_id type: object - type: array - vcs: - description: Details of the VCS repository we want to connect to the workspace - nullable: true - properties: - branch: - description: The repository branch to use - type: string - ingress_submodules: - description: Whether submodules should be fetched when cloning the VCS repository (Defaults to false) - type: boolean - repo_identifier: - description: A reference to your VCS repository in the format org/repo - type: string - token_id: - description: Token ID of the VCS Connection (OAuth Connection Token) to use https://www.terraform.io/docs/cloud/vcs - type: string - required: - - repo_identifier - - token_id - type: object - required: - - organization - - secretsMountPath - type: object - status: - description: WorkspaceStatus defines the observed state of Workspace - properties: - configVersionID: - description: Configuration Version ID - type: string - outputs: - description: Outputs from state file - items: - description: OutputStatus outputs the values of Terraform output - properties: - key: - description: Attribute name in module - type: string - value: - description: Value - type: string - type: object - type: array - runID: - description: Run ID - type: string - runStatus: - description: Run Status gets the run status - type: string - workspaceID: - description: Workspace ID - type: string - required: - - configVersionID - - runID - - runStatus - - workspaceID - type: object - type: object - version: v1alpha1 - versions: - - name: v1alpha1 + required: + - organization + - secretsMountPath + type: object + status: + description: WorkspaceStatus defines the observed state of Workspace + properties: + configVersionID: + description: Configuration Version ID + type: string + outputs: + description: Outputs from state file + items: + description: OutputStatus outputs the values of Terraform output + properties: + key: + description: Attribute name in module + type: string + value: + description: Value + type: string + type: object + type: array + runID: + description: Run ID + type: string + runStatus: + description: Run Status gets the run status + type: string + workspaceID: + description: Workspace ID + type: string + required: + - configVersionID + - runID + - runStatus + - workspaceID + type: object + type: object served: true storage: true + subresources: + status: {} status: acceptedNames: kind: "" From 007f27ad0b4255029c226785ccbff471ff5321cc Mon Sep 17 00:00:00 2001 From: Jiri Tyr Date: Mon, 18 Apr 2022 15:52:33 +0100 Subject: [PATCH 2/6] Updating Makefine to use latest kubebuilder and controller-gen --- Makefile | 159 ++++++++++++------ .../bases/app.terraform.io_workspaces.yaml | 3 +- 2 files changed, 106 insertions(+), 56 deletions(-) diff --git a/Makefile b/Makefile index ea86d089..5592f2c9 100644 --- a/Makefile +++ b/Makefile @@ -1,25 +1,9 @@ # Image URL to use all building/pushing image targets -IMG ?= terraform-k8s:latest -# Produce CRDs that work back to Kubernetes 1.11 (no version conversion) -CRD_OPTIONS ?= "crd:trivialVersions=true" +IMG ?= controller:latest +# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. +ENVTEST_K8S_VERSION = 1.23 -KUSTOMIZE=$(shell which kustomize) -ifeq ($(.SHELLSTATUS),1) - $(error "kustomize not found. Please follow the instructions here to install it: https://kubectl.docs.kubernetes.io/installation/kustomize/") -endif -CONTROLLER_GEN=$(shell which controller-gen) -ifeq ($(.SHELLSTATUS),1) - $(error "controller-gen not found. Please install by running: go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.3.0") -endif -KUBEBUILDER=$(shell which kubebuilder) -ifeq ($(.SHELLSTATUS),1) - $(error "Kubebuilder and related assets such as the etcd binary could not be found in PATH. Please install kubebuilder as explained here: https://book.kubebuilder.io/quick-start.html#installation") -endif -export KUBEBUILDER_ASSETS ?= $(dir $(KUBEBUILDER)) - -GOOS=$(shell go env GOOS) -GOARCH=$(shell go env GOARCH) # 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 @@ -27,53 +11,120 @@ else GOBIN=$(shell go env GOBIN) endif -all: test deploy +# Setting SHELL to bash allows bash commands to be executed by recipes. +# This is a requirement for 'setup-envtest.sh' in the test target. +# Options are set to exit when a recipe line exits non-zero or a piped command fails. +SHELL = /usr/bin/env bash -o pipefail +.SHELLFLAGS = -ec -# Run tests -test: generate fmt vet manifests - go test ./... -coverprofile cover.out +.PHONY: all +all: build -# Build manager binary -manager: generate fmt vet - go build -o bin/terraform-k8s main.go +##@ General -# Run against the configured Kubernetes cluster in ~/.kube/config -run: generate fmt vet manifests - go run ./main.go +# The help target prints out all targets with their descriptions organized +# beneath their categories. The categories are represented by '##@' and the +# target descriptions by '##'. The awk commands is responsible for reading the +# entire set of makefiles included in this invocation, looking for lines of the +# file as xyz: ## something, and then pretty-format the target and help. Then, +# if there's a line with ##@ something, that gets pretty-printed as a category. +# More info on the usage of ANSI control characters for terminal formatting: +# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters +# More info on the awk command: +# http://linuxcommand.org/lc3_adv_awk.php -# Install CRDs into a cluster -install: manifests - $(KUSTOMIZE) build config/crd | kubectl apply -f - +.PHONY: help +help: ## Display this help. + @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\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) -# Uninstall CRDs from a cluster -uninstall: manifests - $(KUSTOMIZE) build config/crd | kubectl delete -f - +##@ Development -# Deploy controller in the configured Kubernetes cluster in ~/.kube/config -deploy: manifests - cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG} - $(KUSTOMIZE) build config/default | kubectl apply -f - +.PHONY: manifests +manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects. + $(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases -# Generate manifests e.g. CRD, RBAC etc. -manifests: - $(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=terraform-k8s webhook paths="./..." output:crd:artifacts:config=config/crd/bases +.PHONY: generate +generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. + $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." -# Run go fmt against code -fmt: +.PHONY: fmt +fmt: ## Run go fmt against code. go fmt ./... -# Run go vet against code -vet: +.PHONY: vet +vet: ## Run go vet against code. go vet ./... -# Generate code -generate: - $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." +.PHONY: test +test: manifests generate fmt vet envtest ## Run tests. + KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./... -coverprofile cover.out + +##@ Build + +.PHONY: build +build: generate fmt vet ## Build manager binary. + go build -o bin/manager main.go -# Build the docker image -docker-build: test - docker build . -t ${IMG} +.PHONY: run +run: manifests generate fmt vet ## Run a controller from your host. + go run ./main.go + +.PHONY: docker-build +docker-build: test ## Build docker image with the manager. + docker build -t ${IMG} . -# Push the docker image -docker-push: +.PHONY: docker-push +docker-push: ## Push docker image with the manager. docker push ${IMG} + +##@ Deployment + +ifndef ignore-not-found + ignore-not-found = false +endif + +.PHONY: install +install: manifests kustomize ## 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 - + +.PHONY: deploy +deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config. + 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 - + +CONTROLLER_GEN = $(shell pwd)/bin/controller-gen +.PHONY: controller-gen +controller-gen: ## Download controller-gen locally if necessary. + $(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.8.0) + +KUSTOMIZE = $(shell pwd)/bin/kustomize +.PHONY: kustomize +kustomize: ## Download kustomize locally if necessary. + $(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v3@v3.8.7) + +ENVTEST = $(shell pwd)/bin/setup-envtest +.PHONY: envtest +envtest: ## Download envtest-setup locally if necessary. + $(call go-get-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest@latest) + +# go-get-tool will 'go get' any package $2 and install it to $1. +PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST)))) +define go-get-tool +@[ -f $(1) ] || { \ +set -e ;\ +TMP_DIR=$$(mktemp -d) ;\ +cd $$TMP_DIR ;\ +go mod init tmp ;\ +echo "Downloading $(2)" ;\ +GOBIN=$(PROJECT_DIR)/bin go get $(2) ;\ +rm -rf $$TMP_DIR ;\ +} +endef diff --git a/config/crd/bases/app.terraform.io_workspaces.yaml b/config/crd/bases/app.terraform.io_workspaces.yaml index 0160e055..6334a7d7 100644 --- a/config/crd/bases/app.terraform.io_workspaces.yaml +++ b/config/crd/bases/app.terraform.io_workspaces.yaml @@ -1,10 +1,9 @@ - --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.3.0 + controller-gen.kubebuilder.io/version: v0.8.0 creationTimestamp: null name: workspaces.app.terraform.io spec: From 56ae64d09fc7417165d88216719e65692cf4abea Mon Sep 17 00:00:00 2001 From: Jiri Tyr Date: Wed, 27 Apr 2022 23:47:11 +0100 Subject: [PATCH 3/6] Fixing default Docker image name --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5592f2c9..8b60d35c 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # Image URL to use all building/pushing image targets -IMG ?= controller:latest +IMG ?= terraform-k8s:latest # ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. ENVTEST_K8S_VERSION = 1.23 From 7d0eb97237c018eccb04d74deeac1525152e5a58 Mon Sep 17 00:00:00 2001 From: Alex Somesan Date: Tue, 10 May 2022 12:37:56 +0200 Subject: [PATCH 4/6] Update Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8b60d35c..ab692438 100644 --- a/Makefile +++ b/Makefile @@ -124,7 +124,7 @@ TMP_DIR=$$(mktemp -d) ;\ cd $$TMP_DIR ;\ go mod init tmp ;\ echo "Downloading $(2)" ;\ -GOBIN=$(PROJECT_DIR)/bin go get $(2) ;\ +GOBIN=$(PROJECT_DIR)/bin go install $(2) ;\ rm -rf $$TMP_DIR ;\ } endef From ca922a555976d092bc79e383f0d7e9ea87461bff Mon Sep 17 00:00:00 2001 From: Alex Somesan Date: Tue, 10 May 2022 12:38:02 +0200 Subject: [PATCH 5/6] Update Makefile --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index ab692438..0965a897 100644 --- a/Makefile +++ b/Makefile @@ -122,7 +122,6 @@ define go-get-tool set -e ;\ TMP_DIR=$$(mktemp -d) ;\ cd $$TMP_DIR ;\ -go mod init tmp ;\ echo "Downloading $(2)" ;\ GOBIN=$(PROJECT_DIR)/bin go install $(2) ;\ rm -rf $$TMP_DIR ;\ From 6b3d42c5c40f879a6fb65066108d49d5f71a9636 Mon Sep 17 00:00:00 2001 From: Alex Somesan Date: Tue, 10 May 2022 12:38:08 +0200 Subject: [PATCH 6/6] Update Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0965a897..c85ec437 100644 --- a/Makefile +++ b/Makefile @@ -108,7 +108,7 @@ controller-gen: ## Download controller-gen locally if necessary. KUSTOMIZE = $(shell pwd)/bin/kustomize .PHONY: kustomize kustomize: ## Download kustomize locally if necessary. - $(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v3@v3.8.7) + $(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v4@v4.5.4) ENVTEST = $(shell pwd)/bin/setup-envtest .PHONY: envtest