mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-09-30 06:02:29 +02:00
Generate postgresql CRD from go structs (#3007)
* Sort postgresql.crd.yaml * Generate postgresql CRD from go structs * Expand sidecars, env and initcontainers * Embed CRD to be submitted by the operator Signed-off-by: Mikkel Oscar Lyderik Larsen <mikkel.larsen@zalando.de> --------- Signed-off-by: Mikkel Oscar Lyderik Larsen <mikkel.larsen@zalando.de>
This commit is contained in:
@@ -21,7 +21,7 @@ GITSTATUS = $(shell git status --porcelain || echo "no changes")
|
||||
SOURCES = cmd/main.go
|
||||
VERSION ?= $(shell git describe --tags --always --dirty)
|
||||
CRD_SOURCES = $(shell find pkg/apis/zalando.org pkg/apis/acid.zalan.do -name '*.go' -not -name '*.deepcopy.go')
|
||||
GENERATED_CRDS = manifests/postgresteam.crd.yaml
|
||||
GENERATED_CRDS = manifests/postgresteam.crd.yaml manifests/postgresql.crd.yaml
|
||||
GENERATED = pkg/apis/zalando.org/v1/zz_generated.deepcopy.go pkg/apis/acid.zalan.do/v1/zz_generated.deepcopy.go
|
||||
DIRS := cmd pkg
|
||||
PKG := `go list ./... | grep -v /vendor/`
|
||||
@@ -54,6 +54,8 @@ default: local
|
||||
|
||||
clean:
|
||||
rm -rf build
|
||||
rm $(GENERATED)
|
||||
rm pkg/apis/acid.zalan.do/v1/postgresql.crd.yaml
|
||||
|
||||
verify:
|
||||
hack/verify-codegen.sh
|
||||
@@ -63,10 +65,15 @@ $(GENERATED): go.mod $(CRD_SOURCES)
|
||||
|
||||
$(GENERATED_CRDS): $(GENERATED)
|
||||
go tool controller-gen crd:crdVersions=v1,allowDangerousTypes=true paths=./pkg/apis/acid.zalan.do/... output:crd:dir=manifests
|
||||
# only generate postgresteam.crd.yaml for now
|
||||
# only generate postgresteam.crd.yaml and postgresql.crd.yaml for now
|
||||
@rm manifests/acid.zalan.do_operatorconfigurations.yaml
|
||||
@rm manifests/acid.zalan.do_postgresqls.yaml
|
||||
@mv manifests/acid.zalan.do_postgresqls.yaml manifests/postgresql.crd.yaml
|
||||
@# hack to use lowercase kind and listKind
|
||||
@sed -i -e 's/kind: Postgresql/kind: postgresql/' manifests/postgresql.crd.yaml
|
||||
@sed -i -e 's/listKind: PostgresqlList/listKind: postgresqlList/' manifests/postgresql.crd.yaml
|
||||
@hack/adjust_postgresql_crd.sh
|
||||
@mv manifests/acid.zalan.do_postgresteams.yaml manifests/postgresteam.crd.yaml
|
||||
@cp manifests/postgresql.crd.yaml pkg/apis/acid.zalan.do/v1/postgresql.crd.yaml
|
||||
|
||||
local: ${SOURCES} $(GENERATED_CRDS)
|
||||
CGO_ENABLED=${CGO_ENABLED} go build -o build/${BINARY} $(LOCAL_BUILD_FLAGS) -ldflags "$(LDFLAGS)" $(SOURCES)
|
||||
@@ -98,7 +105,7 @@ vet:
|
||||
@go vet $(PKG)
|
||||
@staticcheck $(PKG)
|
||||
|
||||
test: mocks $(GENERATED)
|
||||
test: mocks $(GENERATED) $(GENERATED_CRDS)
|
||||
GO111MODULE=on go test ./...
|
||||
|
||||
codegen: $(GENERATED)
|
||||
|
||||
Reference in New Issue
Block a user