generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 278
replace kustomize with helm #587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
578271c
replace kustomize with helm
cjerad e0e0628
move tool download to script
cjerad 81088e3
restore # markers
cjerad 5ce2399
merge fmt and vet targets into verify
cjerad fde73f4
add kubebuilder setup with setup-envtest
cjerad 61c4799
do not use temp module
cjerad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
move tool download to script
- Loading branch information
commit e0e0628d1a65faf18e1835bcad67a2462edbba86
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,8 @@ | ||
| PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST)))) | ||
| CONTROLLER_GEN = $(PROJECT_DIR)/bin/controller-gen | ||
| KO = $(PROJECT_DIR)/bin/ko | ||
| ENVTEST = $(PROJECT_DIR)/bin/setup-envtest | ||
|
|
||
|
|
||
| # Image URL to use all building/pushing image targets | ||
| IMG ?= controller:latest | ||
|
|
@@ -34,22 +39,26 @@ SHELL = /usr/bin/env bash -o pipefail | |
| 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) | ||
|
|
||
| .PHONY: toolchain | ||
| toolchain: # Download additional tools. | ||
| @./scripts/toolchain.sh -d "$(PROJECT_DIR)/bin" | ||
|
|
||
| ##@ Development | ||
|
|
||
| .PHONY: manifests | ||
| manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects. | ||
| manifests: # Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects. | ||
| $(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases | ||
|
|
||
| .PHONY: generate | ||
| generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. | ||
| generate: # Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. | ||
| $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." | ||
|
|
||
| .PHONY: fmt | ||
| fmt: ## Run go fmt against code. | ||
| fmt: # Run go fmt against code. | ||
cjerad marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| go fmt ./... | ||
|
|
||
| .PHONY: vet | ||
| vet: ## Run go vet against code. | ||
| vet: # Run go vet against code. | ||
| go vet ./... | ||
|
|
||
| .PHONY: test | ||
cjerad marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
@@ -74,32 +83,3 @@ apply: # Deploy the controller into the current kubernetes cluster. | |
| .PHONY: delete | ||
| delete: # Delete controller from current kubernetes cluster. | ||
| helm uninstall dev --namespace nthv2 | ||
|
|
||
| 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/[email protected]) | ||
|
|
||
| KO = $(shell pwd)/bin/ko | ||
| .PHONY: ko | ||
| ko: ## Download ko locally if necessary. | ||
| $(call go-get-tool,$(KO),github.com/google/[email protected]) | ||
|
|
||
| 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/[email protected]) | ||
|
|
||
| # 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| usage=$(cat << EOM | ||
| usage: $(basename "$0") -h | -d PATH | ||
| Download tools to PATH. | ||
| Arguments: | ||
| -h Print usage message then exit. | ||
| -d PATH Destination directory for downloaded tools. | ||
| EOM | ||
| ) | ||
|
|
||
| tools=( | ||
| "github.com/google/[email protected]" | ||
| "sigs.k8s.io/controller-tools/cmd/[email protected]" | ||
| # setup-envtest version specifiers: | ||
| # https://pkg.go.dev/sigs.k8s.io/controller-runtime/tools/setup-envtest/versions?tab=versions | ||
| "sigs.k8s.io/controller-runtime/tools/[email protected]" | ||
| ) | ||
|
|
||
| bin_dir="" | ||
|
|
||
| while getopts "d:h" opt; do | ||
| case $opt in | ||
| d ) bin_dir="$OPTARG" | ||
| ;; | ||
| * ) echo "$usage" 1>&2 | ||
| exit 1 | ||
| ;; | ||
| esac | ||
| done | ||
|
|
||
| if [[ -z "$bin_dir" ]]; then | ||
| echo "error: missing destination path" | ||
| echo "$usage" 1>&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| tmp_dir="$(mktemp -d)" | ||
| trap "rm -rf \"$tmp_dir\"" EXIT | ||
|
|
||
| cd "$tmp_dir" | ||
| go mod init tmp >/dev/null 2>&1 | ||
cjerad marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| for tool in ${tools[@]}; do | ||
| echo "Downloading $tool" | ||
| GOBIN="$bin_dir" go install "$tool" | ||
| done | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.