forked from flyteorg/flyte
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CRD validation on flytepropeller project structure (flyteorg#328)
* CRD validation Signed-off-by: Kevin Su <[email protected]> * CRD validation Signed-off-by: Kevin Su <[email protected]> * Revert json tag name Signed-off-by: Kevin Su <[email protected]> * Address comment Signed-off-by: Kevin Su <[email protected]> * Address comment Signed-off-by: Kevin Su <[email protected]> * Fixed test Signed-off-by: Kevin Su <[email protected]> * Rebase Signed-off-by: Kevin Su <[email protected]> * Updated CRD Signed-off-by: Kevin Su <[email protected]> * test Signed-off-by: Kevin Su <[email protected]>
- Loading branch information
Showing
16 changed files
with
6,824 additions
and
61 deletions.
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
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 |
---|---|---|
|
@@ -4,3 +4,4 @@ bin | |
.DS_Store | ||
_test | ||
boilerplate/lyft/end2end/tmp | ||
github.com |
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 |
---|---|---|
|
@@ -3,6 +3,24 @@ include boilerplate/flyte/docker_build/Makefile | |
include boilerplate/flyte/golang_test_targets/Makefile | ||
include boilerplate/flyte/end2end/Makefile | ||
|
||
CRD_OPTIONS ?= "crd:generateEmbeddedObjectMeta=true" | ||
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen | ||
OPENAPI_GEN = $(shell pwd)/bin/openapi-gen | ||
CRD_FILE = $(shell pwd)/manifests/base/crds/flyteworkflow.flyte.net_flyteworkflows.yaml | ||
|
||
controller-gen: ## Download controller-gen locally if necessary. | ||
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/[email protected]) | ||
|
||
openapi-gen: | ||
$(call go-get-tool,$(OPENAPI_GEN),k8s.io/kube-openapi/cmd/[email protected]) | ||
|
||
manifests: controller-gen ## Generate CustomResourceDefinition objects. | ||
$(CONTROLLER_GEN) $(CRD_OPTIONS) paths="./pkg/apis/flyteworkflow/..." output:crd:artifacts:config=manifests/base/crds || true | ||
# Kubernetes cannot allow additionalProperties value to be empty. | ||
# More detail: https://github.com/kubernetes/kubernetes/issues/90504 | ||
perl -p -i -e 's/additionalProperties: {}/additionalProperties: true/g' $(CRD_FILE) | ||
perl -p -i -e 's/flyteworkflows.flyteworkflow.flyte.net/flyteworkflows.flyte.lyft.com/g' $(CRD_FILE) | ||
perl -p -i -e 's/flyteworkflow.flyte.net/flyte.lyft.com/g' $(CRD_FILE) | ||
|
||
.PHONY: update_boilerplate | ||
update_boilerplate: | ||
|
@@ -26,7 +44,12 @@ cross_compile: | |
GOOS=linux GOARCH=amd64 go build -o bin/cross/flytepropeller ./cmd/controller/main.go | ||
GOOS=linux GOARCH=amd64 go build -o bin/cross/kubectl-flyte ./cmd/kubectl-flyte/main.go | ||
|
||
op_code_generate: | ||
openapi_generate: openapi-gen | ||
$(OPENAPI_GEN) -i github.com/flyteorg/flytepropeller/pkg/apis/flyteworkflow/v1alpha1 \ | ||
-p github.com/flyteorg/flytepropeller/pkg/apis/flyteworkflow/v1alpha1 \ | ||
--go-header-file hack/boilerplate.go.txt 2>&1 > /dev/null | ||
|
||
op_code_generate: openapi_generate manifests | ||
@RESOURCE_NAME=flyteworkflow OPERATOR_PKG=github.com/flyteorg/flytepropeller ./hack/update-codegen.sh | ||
|
||
benchmark: | ||
|
@@ -49,3 +72,17 @@ golden: | |
.PHONY: generate | ||
generate: download_tooling | ||
@go generate ./... | ||
|
||
# go-get-tool will 'go get' any package $2 and install it to $1. | ||
PROJECT_DIR := $(shell dirname $(abspath $(firstword $(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 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 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
Oops, something went wrong.