Skip to content

Commit aa86a99

Browse files
committed
CLOUD-938 Fix bundle generation automation
1 parent 2b9a623 commit aa86a99

5 files changed

Lines changed: 248 additions & 86 deletions

File tree

installers/olm/Makefile

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
.SUFFIXES:
33

44
CONTAINER ?= docker
5-
OPENSHIFT_VERSIONS ?= v4.10-v4.12
5+
OPENSHIFT_VERSIONS ?= v4.17-v4.21
66
PACKAGE_CHANNEL ?= preview
77
MIN_KUBE_VERSION ?= 1.23.0
88
DOCKER_DEFAULT_PLATFORM ?= linux/amd64
99
SHELL := /bin/bash
1010

1111
IMAGE_TAG_BASE ?= perconalab/percona-postgresql-operator
1212
BUNDLE_REPO ?= $(IMAGE_TAG_BASE)
13+
REDHAT_OPERATOR_IMAGE ?= registry.connect.redhat.com/percona/percona-postgresql-operator:$(VERSION)
1314

1415
IMAGE ?= $(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)
1919
endif
2020

2121
OS_KERNEL ?= $(shell bash -c 'echo $${1,,}' - `uname -s`)
@@ -33,53 +33,39 @@ export DOCKER_DEFAULT_PLATFORM
3333

3434
REPO_ROOT = $(shell git rev-parse --show-toplevel)
3535

36-
distros = community redhat marketplace
36+
distros = community redhat
3737

3838
check-version:
3939
ifndef VERSION
4040
$(error VERSION is not set)
4141
endif
4242

4343
KUSTOMIZE = $(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
4849
bundles: ## 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
5454
bundles/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
6261
bundles/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
7767
clean: ## 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
8571
help: ALIGN=18
@@ -105,20 +91,20 @@ tools/$(SYSTEM)/jq:
10591
tools: tools/$(SYSTEM)/kubectl
10692
tools/$(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
11298
tools: tools/$(SYSTEM)/operator-sdk
11399
tools/$(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

118104
tools: tools/$(SYSTEM)/opm
119105
tools/$(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

124110
tools/$(SYSTEM)/venv:
@@ -132,6 +118,7 @@ tools/$(SYSTEM)/yq: | tools/$(SYSTEM)/venv
132118

133119
.PHONY: validate-bundles
134120
validate-bundles: ## Build temporary bundle images and run scorecard tests in Kubernetes
121+
validate-bundles: tools
135122
validate-bundles: $(distros:%=validate-%-image)
136123
validate-bundles: $(distros:%=validate-%-directory)
137124

installers/olm/bundle.annotations.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ annotations:
2929
operators.operatorframework.io.bundle.channels.v1: v5
3030
operators.operatorframework.io.bundle.channel.default.v1: v5
3131

32-
# OpenShift v4.9 is the lowest version supported for v5.3.0+.
32+
# This default is overwritten by generate.sh from OPENSHIFT_VERSIONS.
3333
# https://github.com/operator-framework/community-operators/blob/8a36a33/docs/packaging-required-criteria-ocp.md
3434
# https://redhat-connect.gitbook.io/certified-operator-guide/ocp-deployment/operator-metadata/bundle-directory
3535
com.redhat.delivery.operator.bundle: true
36-
com.redhat.openshift.versions: 'v4.10'
36+
com.redhat.openshift.versions: 'v4.17-v4.21'
3737

3838
...

installers/olm/bundle.csv.yaml

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,16 @@
66
apiVersion: operators.coreos.com/v1alpha1
77
kind: ClusterServiceVersion
88
metadata:
9-
name: '' # generate.sh
9+
name: "" # generate.sh
1010
annotations:
11+
features.operators.openshift.io/disconnected: "true"
12+
features.operators.openshift.io/fips-compliant: "false"
13+
features.operators.openshift.io/proxy-aware: "false"
14+
features.operators.openshift.io/tls-profiles: "false"
15+
features.operators.openshift.io/token-auth-aws: "false"
16+
features.operators.openshift.io/token-auth-azure: "false"
17+
features.operators.openshift.io/token-auth-gcp: "false"
1118
support: percona.com
12-
olm.properties: '[]'
1319

1420
# The following affect how the package is indexed at OperatorHub.io:
1521
# https://operatorhub.io/?category=Database
@@ -24,7 +30,7 @@ metadata:
2430
createdAt: 2019-12-31 19:40Z
2531
repository: https://github.com/percona/percona-postgresql-operator
2632
containerImage: # kustomize config/operator
27-
alm-examples: |- # kustomize config/examples
33+
alm-examples: |- # generate.sh
2834
2935
spec:
3036
# The following affect how the package is indexed at OperatorHub.io:
@@ -33,7 +39,7 @@ spec:
3339
provider:
3440
# These values become labels on the PackageManifest.
3541
name: Percona
36-
url: https://www.percona.com/
42+
url: "https://www.percona.com/"
3743
keywords:
3844
- postgres
3945
- postgresql
@@ -45,12 +51,16 @@ spec:
4551
# The following appear on the details page at OperatorHub.io:
4652
# https://operatorhub.io/operator/postgresql
4753
description: |- # description.md
48-
version: '' # generate.sh
54+
version: "" # generate.sh
4955
links:
5056
- name: Percona
51-
url: https://www.percona.com/
57+
url: "https://www.percona.com/"
5258
- name: Documentation
53-
url: https://docs.percona.com/percona-operator-for-postgresql/index.html
59+
url: "https://docs.percona.com/percona-operator-for-postgresql/index.html"
60+
- name: Cloud Native Landing Page
61+
url: "https://www.percona.com/cloud-native/"
62+
- name: Github
63+
url: "https://github.com/percona/percona-postgresql-operator"
5464
maintainers:
5565
- name: Percona
5666
email: info@percona.com
@@ -59,8 +69,6 @@ spec:
5969
# Note: The minKubeVersion must correspond to the lowest supported OCP version
6070
minKubeVersion: 1.23.0
6171
maturity: stable
62-
# https://github.com/operator-framework/operator-lifecycle-manager/blob/v0.18.2/doc/design/how-to-update-operators.md#replaces--channels
63-
replaces: '' # generate.sh
6472

6573
# https://github.com/operator-framework/operator-lifecycle-manager/blob/v0.18.2/doc/design/building-your-csv.md#your-custom-resource-definitions
6674
customresourcedefinitions:
@@ -73,10 +81,14 @@ spec:
7381

7482
# https://olm.operatorframework.io/docs/advanced-tasks/operator-scoping-with-operatorgroups/
7583
installModes:
76-
- { type: OwnNamespace, supported: true }
77-
- { type: SingleNamespace, supported: true }
78-
- { type: MultiNamespace, supported: false }
79-
- { type: AllNamespaces, supported: true }
84+
- supported: true
85+
type: OwnNamespace
86+
- supported: true
87+
type: SingleNamespace
88+
- supported: false
89+
type: MultiNamespace
90+
- supported: true
91+
type: AllNamespaces
8092

8193
install:
8294
strategy: deployment

installers/olm/description.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ fault tolerant cluster in production, or are running your own database-as-a-serv
99
features you need to keep your clusters healthy.
1010

1111
Consult the
12-
[documentation](https://www.percona.com/doc/kubernetes-operator-for-postgresql/index.html)
12+
[documentation](https://docs.percona.com/percona-operator-for-postgresql/index.html)
1313
on the Percona Operator for PostgreSQL for complete details on capabilities
1414
and options.
1515

@@ -58,7 +58,7 @@ Create, Scale, & Delete PostgreSQL clusters with ease, while fully customizing y
5858

5959
* **Connection Pooling**
6060

61-
Use [pgBouncer](https://access.crunchydata.com/documentation/postgres-operator/latest/tutorial/pgbouncer/) for connection pooling
61+
Use pgBouncer for connection pooling.
6262

6363
* **Affinity and Tolerations**
6464

0 commit comments

Comments
 (0)