-
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.
fix script to generate client, listers, informets (#30)
* fix script to generate client, listers, informets Signed-off-by: DavidSpek <[email protected]> * generate client when running make generate Signed-off-by: DavidSpek <[email protected]> * fix running command for first time Signed-off-by: DavidSpek <[email protected]> * don't run client generate at when running regular generate Signed-off-by: DavidSpek <[email protected]> * fix generate command Signed-off-by: DavidSpek <[email protected]> Signed-off-by: DavidSpek <[email protected]>
- Loading branch information
Showing
102 changed files
with
6,115 additions
and
219 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 |
---|---|---|
|
@@ -32,10 +32,10 @@ help: ## Display this help. | |
##@ Development | ||
|
||
manifests: controller-gen ## 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="./apis/..." output:crd:artifacts:config=config/crd/bases | ||
|
||
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. | ||
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." | ||
generate: controller-gen generate-client ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations and the clientset, informers and listers. | ||
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./apis/..." | ||
|
||
fmt: ## Run go fmt against code. | ||
go fmt ./... | ||
|
@@ -81,6 +81,19 @@ deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in | |
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. | ||
$(KUSTOMIZE) build config/default | kubectl delete -f - | ||
|
||
run-client-gen: client-gen | ||
$(CLIENT_GEN) --clientset-name versioned --input-base github.com/pluralsh/plural-operator/apis --input platform/v1alpha1,vpn/v1alpha1 --output-package github.com/pluralsh/plural-operator/generated/client/clientset --go-header-file hack/boilerplate.go.txt | ||
|
||
run-lister-gen: lister-gen | ||
$(LISTER_GEN) --input-dirs github.com/pluralsh/plural-operator/apis/platform/v1alpha1,github.com/pluralsh/plural-operator/apis/vpn/v1alpha1 --output-package github.com/pluralsh/plural-operator/generated/client/listers --go-header-file hack/boilerplate.go.txt | ||
|
||
run-informer-gen: informer-gen | ||
$(INFORMER_GEN) --input-dirs github.com/pluralsh/plural-operator/apis/platform/v1alpha1,github.com/pluralsh/plural-operator/apis/vpn/v1alpha1 --versioned-clientset-package github.com/pluralsh/plural-operator/generated/client/clientset/versioned --listers-package github.com/pluralsh/plural-operator/generated/client/listers --output-package github.com/pluralsh/plural-operator/generated/client/informers --go-header-file hack/boilerplate.go.txt | ||
|
||
generate-client: run-client-gen run-lister-gen run-informer-gen | ||
rm -rf generated | ||
mv github.com/pluralsh/plural-operator/generated generated | ||
rm -rf github.com | ||
|
||
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen | ||
controller-gen: ## Download controller-gen locally if necessary. | ||
|
@@ -90,10 +103,25 @@ KUSTOMIZE = $(shell pwd)/bin/kustomize | |
kustomize: ## Download kustomize locally if necessary. | ||
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/[email protected]) | ||
|
||
client-gen: | ||
./hack/update-codegen.sh | ||
mv github.com/pluralsh/plural-operator/generated generated | ||
rm -rf github.com | ||
CLIENT_GEN = $(shell pwd)/bin/client-gen | ||
client-gen: ## Download client-gen locally if necessary. | ||
$(call go-get-tool,$(CLIENT_GEN),k8s.io/code-generator/cmd/[email protected]) | ||
|
||
LISTER_GEN = $(shell pwd)/bin/lister-gen | ||
lister-gen: ## Download lister-gen locally if necessary. | ||
$(call go-get-tool,$(LISTER_GEN),k8s.io/code-generator/cmd/[email protected]) | ||
|
||
INFORMER_GEN = $(shell pwd)/bin/informer-gen | ||
informer-gen: ## Download informer-gen locally if necessary. | ||
$(call go-get-tool,$(INFORMER_GEN),k8s.io/code-generator/cmd/[email protected]) | ||
|
||
DEFFAULTER_GEN = $(shell pwd)/bin/defaulter-gen | ||
defaulter-gen: ## Download defaulter-gen locally if necessary. | ||
$(call go-get-tool,$(DEFFAULTER_GEN),k8s.io/code-generator/cmd/[email protected]) | ||
|
||
DEEPCOPY_GEN = $(shell pwd)/bin/deepcopy-gen | ||
deepcopy-gen: ## Download deepcopy-gen locally if necessary. | ||
$(call go-get-tool,$(DEEPCOPY_GEN),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)))) | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// +groupName=vpn.plural.sh | ||
|
||
package v1alpha1 |
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,12 @@ | ||
package v1alpha1 | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
) | ||
|
||
// SchemeGroupVersion is group version used to register these objects. | ||
var SchemeGroupVersion = GroupVersion | ||
|
||
func Resource(resource string) schema.GroupResource { | ||
return SchemeGroupVersion.WithResource(resource).GroupResource() | ||
} |
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
53 changes: 45 additions & 8 deletions
53
...platform/clientset/versioned/clientset.go → ...d/client/clientset/versioned/clientset.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
File renamed without changes.
18 changes: 14 additions & 4 deletions
18
...set/versioned/fake/clientset_generated.go → ...set/versioned/fake/clientset_generated.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
...form/clientset/versioned/fake/register.go → ...ient/clientset/versioned/fake/register.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
...rm/clientset/versioned/scheme/register.go → ...nt/clientset/versioned/scheme/register.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.