generated from cybozu-go/neco-template
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: generate applyconfigurations for APIs (SSA)
- Loading branch information
Showing
41 changed files
with
1,028 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,13 +44,27 @@ help: ## Display this help. | |
|
||
.PHONY: manifests | ||
manifests: setup ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects. | ||
controller-gen $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases | ||
controller-gen $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="{./api/..., ./controllers/...}" output:crd:artifacts:config=config/crd/bases | ||
kustomize build config/kustomize-to-helm/overlays/crds | yq e "." -p yaml - > charts/accurate/crds/accurate.cybozu.com_subnamespaces.yaml | ||
kustomize build config/kustomize-to-helm/overlays/templates | yq e "." -p yaml - > charts/accurate/templates/generated/generated.yaml | ||
|
||
.PHONY: generate | ||
generate: setup ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. | ||
controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..." | ||
generate: setup generate-applyconfigurations ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. | ||
controller-gen object:headerFile="hack/boilerplate.go.txt" paths="{./api/...}" | ||
|
||
GO_MODULE = $(shell go list -m) | ||
API_DIRS = $(shell find api -mindepth 2 -type d | sed "s|^|$(shell go list -m)/|" | paste -sd ",") | ||
AC_PKG = internal/applyconfigurations | ||
.PHONY: generate-applyconfigurations | ||
generate-applyconfigurations: applyconfiguration-gen ## Generate applyconfigurations to support typesafe SSA. | ||
rm -rf $(AC_PKG) | ||
@echo ">> generating $(AC_PKG)..." | ||
$(APPLYCONFIGURATION_GEN) \ | ||
--go-header-file hack/boilerplate.go.txt \ | ||
--input-dirs "$(API_DIRS)" \ | ||
--output-package "$(GO_MODULE)/$(AC_PKG)" \ | ||
--trim-path-prefix "$(GO_MODULE)" \ | ||
--output-base "." | ||
|
||
.PHONY: apidoc | ||
apidoc: setup $(wildcard api/*/*_types.go) | ||
|
@@ -106,6 +120,13 @@ $(SETUP_ENVTEST): | |
# see https://github.com/kubernetes-sigs/controller-runtime/tree/master/tools/setup-envtest | ||
GOBIN=$(shell pwd)/bin go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest | ||
|
||
APPLYCONFIGURATION_GEN := $(shell pwd)/bin/applyconfiguration-gen | ||
.PHONY: applyconfiguration-gen | ||
applyconfiguration-gen: $(APPLYCONFIGURATION_GEN) ## Download applyconfiguration-gen locally if necessary | ||
$(APPLYCONFIGURATION_GEN): | ||
# see https://github.com/kubernetes/code-generator/tree/master/cmd/applyconfiguration-gen | ||
GOBIN=$(shell pwd)/bin go install k8s.io/code-generator/cmd/[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 | ||
|
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// +kubebuilder:object:generate=true | ||
// +groupName=accurate.cybozu.com | ||
package v1 |
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
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
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// +kubebuilder:object:generate=true | ||
// +groupName=accurate.cybozu.com | ||
package v2alpha1 |
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
File renamed without changes.
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
File renamed without changes.
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
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
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
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
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
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
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.