-
Notifications
You must be signed in to change notification settings - Fork 101
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
Fix deployCrds template rewrite in generated CRD #832
Merged
Merged
Changes from all commits
Commits
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
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -52,6 +52,7 @@ DNS_ZONE ?= cloud.example.com | |
DEMO_URL ?= http://failover.cloud.example.com | ||
DEMO_DEBUG ?=0 | ||
DEMO_DELAY ?=5 | ||
GSLB_CRD_YAML ?= chart/k8gb/templates/crds/k8gb.absa.oss_gslbs.yaml | ||
|
||
ifndef NO_COLOR | ||
YELLOW=\033[0;33m | ||
|
@@ -340,6 +341,7 @@ gokart: | |
# updates source code with license headers | ||
.PHONY: license | ||
license: | ||
@echo -e "\n$(YELLOW)Injecting the license$(NC)" | ||
$(call golic,-t apache2) | ||
|
||
# creates ns1 secret in current cluster | ||
|
@@ -352,6 +354,7 @@ ns1-secret: | |
# runs golangci-lint aggregated linter; see .golangci.yaml for linter list | ||
.PHONY: lint | ||
lint: | ||
@echo -e "\n$(YELLOW)Running the linters$(NC)" | ||
@go install github.com/golangci/golangci-lint/cmd/[email protected] | ||
$(GOBIN)/golangci-lint run | ||
|
||
|
@@ -383,7 +386,8 @@ reset: destroy-full-local-setup deploy-full-local-setup | |
.PHONY: run | ||
run: lint | ||
$(call generate) | ||
$(call manifest) | ||
$(call crd-manifest) | ||
@echo -e "\n$(YELLOW)Running k8gb locally against the current k8s cluster$(NC)" | ||
LOG_FORMAT=$(LOG_FORMAT) \ | ||
LOG_LEVEL=$(LOG_LEVEL) \ | ||
POD_NAMESPACE=$(POD_NAMESPACE) \ | ||
|
@@ -406,7 +410,8 @@ start-test-app: | |
.PHONY: test | ||
test: | ||
$(call generate) | ||
$(call manifest) | ||
$(call crd-manifest) | ||
@echo -e "\n$(YELLOW)Running the unit tests$(NC)" | ||
go test ./... -coverprofile cover.out | ||
|
||
.PHONY: test-round-robin | ||
|
@@ -506,16 +511,21 @@ define wait-for-ingress | |
endef | ||
|
||
define generate | ||
$(call controller-gen,object:headerFile="hack/boilerplate.go.txt" paths="./...") | ||
$(call install-controller-gen) | ||
@echo -e "\n$(YELLOW)Generating the API code$(NC)" | ||
$(GOBIN)/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..." | ||
endef | ||
|
||
define manifest | ||
$(call controller-gen,crd:crdVersions=v1 paths="./..." output:crd:artifacts:config=chart/k8gb/templates/crds) | ||
define crd-manifest | ||
$(call install-controller-gen) | ||
@echo -e "\n$(YELLOW)Generating the CRD manifests$(NC)" | ||
@echo -n "{{- if .Values.k8gb.deployCrds }}" > $(GSLB_CRD_YAML) | ||
$(GOBIN)/controller-gen crd:crdVersions=v1 paths="./..." output:crd:stdout >> $(GSLB_CRD_YAML) | ||
@echo "{{- end }}" >> $(GSLB_CRD_YAML) | ||
endef | ||
|
||
define controller-gen | ||
define install-controller-gen | ||
@go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_GEN_VERSION) | ||
$(GOBIN)/controller-gen $1 | ||
endef | ||
|
||
define gokart | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like it will tamper the git status?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ytsarev not sure I'm following
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@somaritane i've meant from the PoV that it will affect
git status
after regeneration but it is actually valid in case of API changes. And if there are no API changes in the working tree the GSLB_CRD_YAML file will stay intact. So all good, approving