Skip to content

Commit

Permalink
Remove Kustomize from CRD generation
Browse files Browse the repository at this point in the history
Recent versions of controller-gen are able to describe our CRDs!

Issue: PGO-1748
  • Loading branch information
cbandy committed Oct 25, 2024
1 parent f20a032 commit 446c9c7
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 55 deletions.
27 changes: 4 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ clean: clean-deprecated
rm -rf licenses/*/
[ ! -d testing/kuttl/e2e-generated ] || rm -r testing/kuttl/e2e-generated
[ ! -d testing/kuttl/e2e-generated-other ] || rm -r testing/kuttl/e2e-generated-other
rm -rf build/crd/generated build/crd/*/generated
[ ! -f hack/tools/setup-envtest ] || rm hack/tools/setup-envtest
[ ! -d hack/tools/envtest ] || { chmod -R u+w hack/tools/envtest && rm -r hack/tools/envtest; }
[ ! -d hack/tools/pgmonitor ] || rm -rf hack/tools/pgmonitor
Expand All @@ -93,6 +92,8 @@ clean-deprecated: ## Clean deprecated resources
@# crunchy-postgres-exporter used to live in this repo
[ ! -d bin/crunchy-postgres-exporter ] || rm -r bin/crunchy-postgres-exporter
[ ! -d build/crunchy-postgres-exporter ] || rm -r build/crunchy-postgres-exporter
@# CRDs used to require patching
[ ! -d build/crd ] || rm -r build/crd


##@ Deployment
Expand Down Expand Up @@ -278,27 +279,7 @@ generate-crd: tools/controller-gen
$(CONTROLLER) \
crd:crdVersions='v1' \
paths='./pkg/apis/...' \
output:dir='build/crd/postgresclusters/generated' # build/crd/{plural}/generated/{group}_{plural}.yaml
@
$(CONTROLLER) \
crd:crdVersions='v1' \
paths='./pkg/apis/...' \
output:dir='build/crd/pgupgrades/generated' # build/crd/{plural}/generated/{group}_{plural}.yaml
@
$(CONTROLLER) \
crd:crdVersions='v1' \
paths='./pkg/apis/...' \
output:dir='build/crd/pgadmins/generated' # build/crd/{plural}/generated/{group}_{plural}.yaml
@
$(CONTROLLER) \
crd:crdVersions='v1' \
paths='./pkg/apis/...' \
output:dir='build/crd/crunchybridgeclusters/generated' # build/crd/{plural}/generated/{group}_{plural}.yaml
@
kubectl kustomize ./build/crd/postgresclusters > ./config/crd/bases/postgres-operator.crunchydata.com_postgresclusters.yaml
kubectl kustomize ./build/crd/pgupgrades > ./config/crd/bases/postgres-operator.crunchydata.com_pgupgrades.yaml
kubectl kustomize ./build/crd/pgadmins > ./config/crd/bases/postgres-operator.crunchydata.com_pgadmins.yaml
kubectl kustomize ./build/crd/crunchybridgeclusters > ./config/crd/bases/postgres-operator.crunchydata.com_crunchybridgeclusters.yaml
output:dir='config/crd/bases' # {directory}/{group}_{plural}.yaml

.PHONY: generate-deepcopy
generate-deepcopy: ## Generate DeepCopy functions
Expand All @@ -313,7 +294,7 @@ generate-rbac: tools/controller-gen
$(CONTROLLER) \
rbac:roleName='postgres-operator' \
paths='./cmd/...' paths='./internal/...' \
output:dir='config/rbac' # ${directory}/role.yaml
output:dir='config/rbac' # {directory}/role.yaml

##@ Tools

Expand Down
4 changes: 0 additions & 4 deletions build/crd/.gitignore

This file was deleted.

7 changes: 0 additions & 7 deletions build/crd/crunchybridgeclusters/kustomization.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions build/crd/pgadmins/kustomization.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions build/crd/pgupgrades/kustomization.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions build/crd/postgresclusters/kustomization.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
Expand Down

0 comments on commit 446c9c7

Please sign in to comment.