22.SUFFIXES :
33
44CONTAINER ?= docker
5- OPENSHIFT_VERSIONS ?= v4.10 -v4.12
5+ OPENSHIFT_VERSIONS ?= v4.17 -v4.21
66PACKAGE_CHANNEL ?= preview
77MIN_KUBE_VERSION ?= 1.23.0
88DOCKER_DEFAULT_PLATFORM ?= linux/amd64
99SHELL := /bin/bash
1010
1111IMAGE_TAG_BASE ?= perconalab/percona-postgresql-operator
1212BUNDLE_REPO ?= $(IMAGE_TAG_BASE )
13+ REDHAT_OPERATOR_IMAGE ?= registry.connect.redhat.com/percona/percona-postgresql-operator:$(VERSION )
1314
1415IMAGE ?= $(IMAGE_TAG_BASE ) :$(VERSION )
1516
16- ifeq ($(shell bash -c 'echo $$BASH_VERSION | cut -d "." -f1') , 5)
17- else
18- $(error You need to use bash 5.x+ for this Makefile)
17+ ifneq ($(shell bash -c 'test "$${BASH_VERSINFO[0]}" -ge 5 && echo yes') ,yes)
18+ $(error You need to use bash 5.x+ for this Makefile)
1919endif
2020
2121OS_KERNEL ?= $(shell bash -c 'echo $${1,,}' - `uname -s`)
@@ -33,53 +33,39 @@ export DOCKER_DEFAULT_PLATFORM
3333
3434REPO_ROOT = $(shell git rev-parse --show-toplevel)
3535
36- distros = community redhat marketplace
36+ distros = community redhat
3737
3838check-version :
3939ifndef VERSION
4040 $(error VERSION is not set)
4141endif
4242
4343KUSTOMIZE = $(REPO_ROOT ) /bin/kustomize
44- kustomize : # # Download kustomize locally if necessary.
45- $(call go-get-tool,$(KUSTOMIZE ) ,sigs.k8s.io/kustomize/kustomize/v4@v4.5.3)
44+
45+ $(KUSTOMIZE ) :
46+ $(MAKE ) -C ' $(REPO_ROOT)' kustomize
4647
4748.PHONY : bundles
4849bundles : # # Build OLM bundles
49- bundles : check-version $(distros:%=bundles/% )
50+ bundles : check-version tools $( KUSTOMIZE ) $(distros:%=bundles/% )
5051
5152# https://olm.operatorframework.io/docs/tasks/creating-operator-bundle/#validating-your-bundle
52- # https://github.com/operator-framework/community-operators/blob/8a36a33/docs/packaging-required-criteria-ocp.md
5353.PHONY : bundles/community
5454bundles/community :
55- cd ../../config/manager/default/ && $(KUSTOMIZE ) edit set image postgres-operator=$(IMAGE )
55+ cd ../../config/manager/default/ && $(KUSTOMIZE ) edit set image ' postgres-operator=$(IMAGE)'
5656 ./generate.sh community
5757 env operator-sdk bundle validate $@ --select-optional=' suite=operatorframework'
58- env operator-sdk bundle validate $@ --select-optional=' name=community' --optional-values=' index-path=$@/Dockerfile'
5958
6059# https://redhat-connect.gitbook.io/certified-operator-guide/ocp-deployment/operator-metadata/reviewing-your-metadata-bundle
6160.PHONY : bundles/redhat
6261bundles/redhat :
63- cd ../../config/manager/default/ && $(KUSTOMIZE ) edit set image postgres-operator=$(IMAGE )
62+ cd ../../config/manager/default/ && $(KUSTOMIZE ) edit set image ' postgres-operator=$(REDHAT_OPERATOR_IMAGE) '
6463 ./generate.sh redhat
6564 env operator-sdk bundle validate $@ --select-optional=' suite=operatorframework'
6665
67- # The 'marketplace' configuration is currently identical to the 'redhat', so we just copy it here.
68- .PHONY : bundles/marketplace
69- bundles/marketplace :
70- cd ../../config/manager/default/ && $(KUSTOMIZE ) edit set image postgres-operator=$(IMAGE )
71- cp -r ./config/redhat/ ./config/marketplace
72- ./generate.sh marketplace
73- env operator-sdk bundle validate $@ --select-optional=' suite=operatorframework'
74-
7566.PHONY : clean
76- clean : clean-deprecated
7767clean : # # Remove generated files and downloaded tools
78- rm -rf ./bundles ./projects ./tools ./config/marketplace
79-
80- .PHONY : clean-deprecated
81- clean-deprecated :
82- rm -rf ./package
68+ rm -rf ./bundles ./projects ./tools
8369
8470.PHONY : help
8571help : ALIGN=18
@@ -105,20 +91,20 @@ tools/$(SYSTEM)/jq:
10591tools : tools/$(SYSTEM ) /kubectl
10692tools/$(SYSTEM ) /kubectl :
10793 install -d ' $(dir $@)'
108- curl -fSL -o ' $@' ' https://dl.k8s.io/release/$(shell curl -Ls https://dl.k8s.io/release/stable-1.21 .txt)/bin/$(OS_KERNEL)/$(OS_MACHINE)/kubectl'
94+ curl -fSL -o ' $@' ' https://dl.k8s.io/release/$(shell curl -Ls https://dl.k8s.io/release/stable.txt)/bin/$(OS_KERNEL)/$(OS_MACHINE)/kubectl'
10995 chmod u+x ' $@'
11096
11197# quay.io/operator-framework/operator-sdk
11298tools : tools/$(SYSTEM ) /operator-sdk
11399tools/$(SYSTEM ) /operator-sdk :
114100 install -d ' $(dir $@)'
115- curl -fSL -o ' $@' ' https://github.com/operator-framework/operator-sdk/releases/download/v1.19.1 /operator-sdk_$(OS_KERNEL)_$(OS_MACHINE)'
101+ curl -fSL -o ' $@' ' https://github.com/operator-framework/operator-sdk/releases/download/v1.42.2 /operator-sdk_$(OS_KERNEL)_$(OS_MACHINE)'
116102 chmod u+x ' $@'
117103
118104tools : tools/$(SYSTEM ) /opm
119105tools/$(SYSTEM ) /opm :
120106 install -d ' $(dir $@)'
121- curl -fSL -o ' $@' ' https://github.com/operator-framework/operator-registry/releases/download/v1.33 .0/$(OS_KERNEL)-$(OS_MACHINE)-opm'
107+ curl -fSL -o ' $@' ' https://github.com/operator-framework/operator-registry/releases/download/v1.66 .0/$(OS_KERNEL)-$(OS_MACHINE)-opm'
122108 chmod u+x ' $@'
123109
124110tools/$(SYSTEM ) /venv :
@@ -132,6 +118,7 @@ tools/$(SYSTEM)/yq: | tools/$(SYSTEM)/venv
132118
133119.PHONY : validate-bundles
134120validate-bundles : # # Build temporary bundle images and run scorecard tests in Kubernetes
121+ validate-bundles : tools
135122validate-bundles : $(distros:%=validate-%-image )
136123validate-bundles : $(distros:%=validate-%-directory )
137124
0 commit comments