Skip to content

Commit ad41057

Browse files
authored
Merge branch 'main' into K8SPSMDB-1183_bundle_generation
2 parents b624e8c + 7149757 commit ad41057

File tree

68 files changed

+635
-349
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+635
-349
lines changed

.e2eignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
docs/**
2+
code-of-conduct.md
3+
CONTRIBUTING.md
4+
README.md
5+
.gitattributes
6+
.gitignore
7+
LICENSE
8+
operator.png
9+
kubernetes.svg
10+
release_versions
11+
.github/**

.github/CODEOWNERS

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
* @hors @egegunes @inelpandzic @pooknull @nmarukovich
2-
/e2e-tests/ @nmarukovich @ptankov @jvpasinatto @eleo007
3-
Jenkinsfile @nmarukovich @ptankov @jvpasinatto @eleo007
1+
* @hors @egegunes @pooknull @nmarukovich @gkech
2+
/e2e-tests/ @ptankov @jvpasinatto @eleo007
3+
Jenkinsfile @ptankov @jvpasinatto @eleo007
4+

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ anaconda-mode/
9292
# Output of the go coverage tool, specifically when used with LiteIDE
9393
*.out
9494

95+
# vendor
96+
/vendor/
97+
9598
### Vim ###
9699
# swap
97100
.sw[a-p]

Jenkinsfile

+171-76
Large diffs are not rendered by default.

Makefile

+21-6
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ uninstall: manifests ## Uninstall CRDs, rbac
6060
deploy: ## Deploy operator
6161
yq eval '(.spec.template.spec.containers[] | select(.name=="percona-server-mongodb-operator")).image = "$(IMAGE)"' $(DEPLOYDIR)/operator.yaml \
6262
| yq eval '(.spec.template.spec.containers[] | select(.name=="percona-server-mongodb-operator").env[] | select(.name=="LOG_LEVEL")).value="DEBUG"' - \
63+
| yq eval '(.spec.template.spec.containers[] | select(.name=="percona-server-mongodb-operator").env[] | select(.name=="DISABLE_TELEMETRY")).value="true"' - \
6364
| kubectl apply -f -
6465

6566
undeploy: ## Undeploy operator
@@ -99,19 +100,27 @@ swagger: ## Download swagger locally if necessary.
99100
$(call go-get-tool,$(SWAGGER),github.com/go-swagger/go-swagger/cmd/swagger@latest)
100101

101102
# Prepare release
103+
include e2e-tests/release_versions
102104
CERT_MANAGER_VER := $(shell grep -Eo "cert-manager v.*" go.mod|grep -Eo "[0-9]+\.[0-9]+\.[0-9]+")
103105
release: manifests
104106
$(SED) -i "/CERT_MANAGER_VER/s/CERT_MANAGER_VER=\".*/CERT_MANAGER_VER=\"$(CERT_MANAGER_VER)\"/" e2e-tests/functions
105107
$(SED) -i "/Version = \"/s/Version = \".*/Version = \"$(VERSION)\"/" version/version.go
106108
$(SED) -i \
107109
-e "s/crVersion: .*/crVersion: $(VERSION)/" \
108-
-e "/^spec:/,/^ image:/{s#image: .*#image: percona/percona-server-mongodb:@@SET_TAG@@#}" deploy/cr-minimal.yaml
110+
-e "/^spec:/,/^ image:/{s#image: .*#image: $(IMAGE_MONGOD80)#}" deploy/cr-minimal.yaml
109111
$(SED) -i \
110112
-e "s/crVersion: .*/crVersion: $(VERSION)/" \
111-
-e "/^spec:/,/^ image:/{s#image: .*#image: percona/percona-server-mongodb:@@SET_TAG@@#}" \
112-
-e "/^ backup:/,/^ image:/{s#image: .*#image: percona/percona-backup-mongodb:@@SET_TAG@@#}" \
113+
-e "/^spec:/,/^ image:/{s#image: .*#image: $(IMAGE_MONGOD80)#}" \
114+
-e "/^ backup:/,/^ image:/{s#image: .*#image: $(IMAGE_BACKUP)#}" \
113115
-e "s#initImage: .*#initImage: percona/percona-server-mongodb-operator:$(VERSION)#g" \
114-
-e "/^ pmm:/,/^ image:/{s#image: .*#image: percona/pmm-client:@@SET_TAG@@#}" deploy/cr.yaml
116+
-e "/^ pmm:/,/^ image:/{s#image: .*#image: $(IMAGE_PMM_CLIENT)#}" deploy/cr.yaml
117+
$(SED) -i \
118+
-e "s|perconalab/percona-server-mongodb-operator:main-mongod8.0|$(IMAGE_MONGOD80)|g" \
119+
-e "s|perconalab/percona-server-mongodb-operator:main-backup|$(IMAGE_BACKUP)|g" \
120+
-e "s|perconalab/percona-server-mongodb-operator:main|$(IMAGE_OPERATOR)|g" \
121+
pkg/controller/perconaservermongodb/testdata/reconcile-statefulset/*.yaml
122+
$(SED) -i "s|cr.Spec.InitImage = \".*\"|cr.Spec.InitImage = \"${IMAGE_OPERATOR}\"|g" pkg/controller/perconaservermongodb/suite_test.go
123+
115124

116125
# Prepare main branch after release
117126
MAJOR_VER := $(shell grep -oE "crVersion: .*" deploy/cr.yaml|grep -oE "[0-9]+\.[0-9]+\.[0-9]+"|cut -d'.' -f1)
@@ -121,13 +130,19 @@ after-release: manifests
121130
$(SED) -i "/Version = \"/s/Version = \".*/Version = \"$(NEXT_VER)\"/" version/version.go
122131
$(SED) -i \
123132
-e "s/crVersion: .*/crVersion: $(NEXT_VER)/" \
124-
-e "/^spec:/,/^ image:/{s#image: .*#image: perconalab/percona-server-mongodb-operator:main-mongod7.0#}" deploy/cr-minimal.yaml
133+
-e "/^spec:/,/^ image:/{s#image: .*#image: perconalab/percona-server-mongodb-operator:main-mongod8.0#}" deploy/cr-minimal.yaml
125134
$(SED) -i \
126135
-e "s/crVersion: .*/crVersion: $(NEXT_VER)/" \
127-
-e "/^spec:/,/^ image:/{s#image: .*#image: perconalab/percona-server-mongodb-operator:main-mongod7.0#}" \
136+
-e "/^spec:/,/^ image:/{s#image: .*#image: perconalab/percona-server-mongodb-operator:main-mongod8.0#}" \
128137
-e "/^ backup:/,/^ image:/{s#image: .*#image: perconalab/percona-server-mongodb-operator:main-backup#}" \
129138
-e "s#initImage: .*#initImage: perconalab/percona-server-mongodb-operator:main#g" \
130139
-e "/^ pmm:/,/^ image:/{s#image: .*#image: perconalab/pmm-client:dev-latest#}" deploy/cr.yaml
140+
$(SED) -i \
141+
-e "s|$(IMAGE_MONGOD80)|perconalab/percona-server-mongodb-operator:main-mongod8.0|g" \
142+
-e "s|$(IMAGE_BACKUP)|perconalab/percona-server-mongodb-operator:main-backup|g" \
143+
-e "s|$(IMAGE_OPERATOR)|perconalab/percona-server-mongodb-operator:main|g" \
144+
pkg/controller/perconaservermongodb/testdata/reconcile-statefulset/*.yaml
145+
$(SED) -i "s|cr.Spec.InitImage = \".*\"|cr.Spec.InitImage = \"perconalab/percona-server-mongodb-operator:main\"|g" pkg/controller/perconaservermongodb/suite_test.go
131146

132147
version-service-client: swagger
133148
curl https://raw.githubusercontent.com/Percona-Lab/percona-version-service/$(VS_BRANCH)/api/version.swagger.yaml \

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Below is one of the ways to deploy the Operator using `kubectl`.
4444
kubectl apply --server-side -f https://raw.githubusercontent.com/percona/percona-server-mongodb-operator/main/deploy/bundle.yaml
4545
```
4646

47-
2. Deploy the database cluster itself from `deploy/cr.yaml
47+
2. Deploy the database cluster itself from `deploy/cr.yaml`
4848

4949
```sh
5050
kubectl apply -f https://raw.githubusercontent.com/percona/percona-server-mongodb-operator/main/deploy/cr-minimal.yaml

config/crd/bases/psmdb.percona.com_perconaservermongodbs.yaml

+5-3
Original file line numberDiff line numberDiff line change
@@ -18849,14 +18849,16 @@ spec:
1884918849
initialized:
1885018850
type: boolean
1885118851
members:
18852-
items:
18852+
additionalProperties:
1885318853
properties:
1885418854
name:
1885518855
type: string
18856-
version:
18856+
state:
18857+
type: integer
18858+
stateStr:
1885718859
type: string
1885818860
type: object
18859-
type: array
18861+
type: object
1886018862
message:
1886118863
type: string
1886218864
ready:

deploy/bundle.yaml

+5-3
Original file line numberDiff line numberDiff line change
@@ -19545,14 +19545,16 @@ spec:
1954519545
initialized:
1954619546
type: boolean
1954719547
members:
19548-
items:
19548+
additionalProperties:
1954919549
properties:
1955019550
name:
1955119551
type: string
19552-
version:
19552+
state:
19553+
type: integer
19554+
stateStr:
1955319555
type: string
1955419556
type: object
19555-
type: array
19557+
type: object
1955619558
message:
1955719559
type: string
1955819560
ready:

deploy/cr-minimal.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ kind: PerconaServerMongoDB
33
metadata:
44
name: minimal-cluster
55
spec:
6-
crVersion: 1.18.0
7-
image: perconalab/percona-server-mongodb-operator:main-mongod7.0
6+
crVersion: 1.20.0
7+
image: perconalab/percona-server-mongodb-operator:main-mongod8.0
88
unsafeFlags:
99
replsetSize: true
1010
mongosSize: true

deploy/cr.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ spec:
1313
# pause: true
1414
# unmanaged: false
1515
# enableVolumeExpansion: false
16-
crVersion: 1.19.0
17-
image: perconalab/percona-server-mongodb-operator:main-mongod7.0
16+
crVersion: 1.20.0
17+
image: perconalab/percona-server-mongodb-operator:main-mongod8.0
1818
imagePullPolicy: Always
1919
# tls:
2020
# mode: preferTLS

deploy/crd.yaml

+5-3
Original file line numberDiff line numberDiff line change
@@ -19545,14 +19545,16 @@ spec:
1954519545
initialized:
1954619546
type: boolean
1954719547
members:
19548-
items:
19548+
additionalProperties:
1954919549
properties:
1955019550
name:
1955119551
type: string
19552-
version:
19552+
state:
19553+
type: integer
19554+
stateStr:
1955319555
type: string
1955419556
type: object
19555-
type: array
19557+
type: object
1955619558
message:
1955719559
type: string
1955819560
ready:

deploy/cw-bundle.yaml

+5-3
Original file line numberDiff line numberDiff line change
@@ -19545,14 +19545,16 @@ spec:
1954519545
initialized:
1954619546
type: boolean
1954719547
members:
19548-
items:
19548+
additionalProperties:
1954919549
properties:
1955019550
name:
1955119551
type: string
19552-
version:
19552+
state:
19553+
type: integer
19554+
stateStr:
1955319555
type: string
1955419556
type: object
19555-
type: array
19557+
type: object
1955619558
message:
1955719559
type: string
1955819560
ready:

e2e-tests/default-cr/run

+20-10
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,34 @@ function start_cluster() {
4343
}
4444

4545
function main() {
46-
create_infra "$namespace"
47-
cluster="my-cluster-name"
48-
49-
desc 'create secrets and start client'
50-
kubectl_bin apply -f $deploy_dir/secrets.yaml
51-
kubectl_bin apply -f $conf_dir/client.yml
52-
53-
desc "create first PSMDB cluster $cluster"
46+
delete_crd
47+
check_crd_for_deletion "${GIT_BRANCH}"
5448
kubectl_bin apply ${OPERATOR_NS:+-n $OPERATOR_NS} --server-side --force-conflicts -f $deploy_dir/crd.yaml
49+
5550
if [ -n "$OPERATOR_NS" ]; then
51+
create_namespace $OPERATOR_NS
52+
create_namespace ${namespace}
5653
apply_rbac cw-rbac
57-
kubectl_bin apply -n ${OPERATOR_NS} -f $deploy_dir/cw-operator.yaml
54+
yq eval '
55+
((.. | select(.[] == "DISABLE_TELEMETRY")) |= .value="true") |
56+
((.. | select(.[] == "LOG_LEVEL")) |= .value="DEBUG")' ${src_dir}/deploy/cw-operator.yaml \
57+
| kubectl_bin apply -n ${OPERATOR_NS} -f -
5858
else
59+
create_namespace ${namespace}
5960
apply_rbac rbac
60-
yq eval '((.. | select(.[] == "DISABLE_TELEMETRY")) |= .value="true")' "$deploy_dir/operator.yaml" \
61+
yq eval '
62+
((.. | select(.[] == "DISABLE_TELEMETRY")) |= .value="true") |
63+
((.. | select(.[] == "LOG_LEVEL")) |= .value="DEBUG")' ${src_dir}/deploy/operator.yaml \
6164
| kubectl_bin apply -f -
6265
fi
6366

67+
cluster="my-cluster-name"
68+
69+
desc 'create secrets and start client'
70+
kubectl_bin apply -f $deploy_dir/secrets.yaml
71+
kubectl_bin apply -f $conf_dir/client.yml
72+
73+
desc "create first PSMDB cluster $cluster"
6474
yq eval '.spec.upgradeOptions.versionServiceEndpoint = "https://check-dev.percona.com" |
6575
.spec.replsets[].affinity.antiAffinityTopologyKey = "none" |
6676
.spec.replsets[].nonvoting.affinity.antiAffinityTopologyKey = "none" |

e2e-tests/demand-backup-eks-credentials-irsa/compare/statefulset_some-name-rs0.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,13 @@ spec:
150150
- name: PBM_AGENT_MONGODB_USERNAME
151151
valueFrom:
152152
secretKeyRef:
153-
key: MONGODB_BACKUP_USER
153+
key: MONGODB_BACKUP_USER_ESCAPED
154154
name: internal-some-name-users
155155
optional: false
156156
- name: PBM_AGENT_MONGODB_PASSWORD
157157
valueFrom:
158158
secretKeyRef:
159-
key: MONGODB_BACKUP_PASSWORD
159+
key: MONGODB_BACKUP_PASSWORD_ESCAPED
160160
name: internal-some-name-users
161161
optional: false
162162
- name: PBM_MONGODB_REPLSET

e2e-tests/demand-backup-eks-credentials-irsa/run

+3-3
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,17 @@ compare_kubectl statefulset/$cluster-rs0
6666

6767
desc "update service accounts for operator and default (our cluster uses this one)"
6868

69-
kubectl_bin annotate serviceaccount default \
69+
kubectl_bin annotate serviceaccount default \
7070
eks.amazonaws.com/role-arn="$role_arn" \
7171
--overwrite
7272

73-
kubectl_bin annotate serviceaccount percona-server-mongodb-operator \
73+
kubectl_bin ${OPERATOR_NS:+-n $OPERATOR_NS} annotate serviceaccount percona-server-mongodb-operator \
7474
eks.amazonaws.com/role-arn="$role_arn" \
7575
--overwrite
7676

7777
desc "restart operator and cluster"
7878
operator_pod=$(get_operator_pod)
79-
kubectl_bin delete pod $operator_pod
79+
kubectl_bin ${OPERATOR_NS:+-n $OPERATOR_NS} delete pod $operator_pod
8080

8181
kubectl_bin delete pod "$cluster-rs0-0"
8282
kubectl_bin delete pod "$cluster-rs0-1"

e2e-tests/demand-backup-fs/conf/some-name.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ spec:
2222
volumeMounts:
2323
- mountPath: /mnt/nfs/
2424
name: backup-nfs
25-
image: perconalab/percona-server-mongodb-operator:main-mongod7.0
25+
image: perconalab/percona-server-mongodb-operator:main-mongod8.0
2626
imagePullPolicy: Always
2727
pmm:
2828
enabled: false

e2e-tests/demand-backup-fs/run

+22-4
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,17 @@ test_dir=$(realpath $(dirname $0))
66
. ${test_dir}/../functions
77
set_debug
88

9+
if [[ "${OPENSHIFT}" ]]; then
10+
echo "This test is not supported on OpenShift due to nfs privileged. See K8SPSMDB-1262"
11+
exit 0
12+
fi
13+
914
deploy_nfs_server() {
1015
kubectl_bin create namespace storage
1116
kubectl_bin apply -n storage -f ${test_dir}/conf/nfs-server.yaml
1217
sleep 5 # wait for NFS server pod to be created
13-
local nfsPod=$(kubectl_bin get pod -n storage -l app=nfs-server -o jsonpath={.items[].metadata.name})
1418

19+
local nfsPod=$(kubectl_bin get pod -n storage -l app=nfs-server -o jsonpath={.items[].metadata.name})
1520
until [[ "$(kubectl_bin get pod ${nfsPod} -n storage -o jsonpath={.status.phase})" == "Running" ]]; do
1621
log "Waiting for ${nfsPod} to start Running"
1722
sleep 1
@@ -50,6 +55,11 @@ create_infra ${namespace}
5055

5156
kubectl_bin delete ns storage || :
5257

58+
if [[ $GKE != 1 ]]; then
59+
sc=$(kubectl_bin get storageclass | tail -1 | awk '{print $1}')
60+
kubectl_bin annotate storageclass ${sc} storageclass.kubernetes.io/is-default-class=true
61+
fi
62+
5363
log "deploying NFS server"
5464
deploy_nfs_server
5565

@@ -59,13 +69,21 @@ kubectl_bin apply \
5969
-f "${conf_dir}/client.yml"
6070

6171
log "creating PSMDB cluster ${cluster}"
62-
apply_cluster ${test_dir}/conf/${cluster}.yaml
72+
if [[ $GKE != 1 ]]; then
73+
nfs_ip=$(kubectl_bin -n storage get svc nfs-service -o jsonpath={.spec.clusterIP})
74+
sed "s/nfs-service.storage.svc.cluster.local/${nfs_ip}/g" ${test_dir}/conf/${cluster}.yaml \
75+
| kubectl_bin apply -f -
76+
else
77+
apply_cluster ${test_dir}/conf/${cluster}.yaml
78+
fi
6379

6480
log 'wait for all 3 pods to start'
6581
wait_for_running ${cluster}-rs0 3
6682

67-
log 'checking if statefulset created with expected config'
68-
compare_kubectl statefulset/${cluster}-rs0
83+
if [[ $GKE == 1 ]]; then
84+
log 'checking if statefulset created with expected config'
85+
compare_kubectl statefulset/${cluster}-rs0
86+
fi
6987

7088
log 'creating user'
7189
run_mongo \

e2e-tests/expose-sharded/compare/statefulset_some-name-rs0-oc.yml

+1
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ spec:
225225
- mountPath: /opt/percona
226226
name: bin
227227
restartPolicy: Always
228+
runtimeClassName: container-rc
228229
schedulerName: default-scheduler
229230
securityContext: {}
230231
serviceAccount: default

e2e-tests/expose-sharded/compare/statefulset_some-name-rs0-sharding-disabled-oc.yml

+1
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ spec:
222222
- mountPath: /opt/percona
223223
name: bin
224224
restartPolicy: Always
225+
runtimeClassName: container-rc
225226
schedulerName: default-scheduler
226227
securityContext: {}
227228
serviceAccount: default

e2e-tests/expose-sharded/compare/statefulset_some-name-rs0-sharding-enabled-oc.yml

+1
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ spec:
225225
- mountPath: /opt/percona
226226
name: bin
227227
restartPolicy: Always
228+
runtimeClassName: container-rc
228229
schedulerName: default-scheduler
229230
securityContext: {}
230231
serviceAccount: default

e2e-tests/functions

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ GIT_BRANCH=${VERSION:-$(git rev-parse --abbrev-ref HEAD | sed -e 's^/^-^g; s^[.]
55
API="psmdb.percona.com/v1"
66
OPERATOR_VERSION="$(grep 'crVersion' $(realpath $(dirname ${BASH_SOURCE[0]})/../deploy/cr.yaml) | awk '{print $2}')"
77
IMAGE=${IMAGE:-"perconalab/percona-server-mongodb-operator:${GIT_BRANCH}"}
8-
IMAGE_MONGOD=${IMAGE_MONGOD:-"perconalab/percona-server-mongodb-operator:main-mongod7.0"}
8+
IMAGE_MONGOD=${IMAGE_MONGOD:-"perconalab/percona-server-mongodb-operator:main-mongod8.0"}
99
IMAGE_MONGOD_CHAIN=${IMAGE_MONGOD_CHAIN:-$'
10-
perconalab/percona-server-mongodb-operator:main-mongod5.0
1110
perconalab/percona-server-mongodb-operator:main-mongod6.0
1211
perconalab/percona-server-mongodb-operator:main-mongod7.0
1312
perconalab/percona-server-mongodb-operator:main-mongod8.0'}
@@ -16,7 +15,7 @@ SKIP_BACKUPS_TO_AWS_GCP_AZURE=${SKIP_BACKUPS_TO_AWS_GCP_AZURE:-1}
1615
PMM_SERVER_VER=${PMM_SERVER_VER:-"9.9.9"}
1716
IMAGE_PMM_CLIENT=${IMAGE_PMM_CLIENT:-"perconalab/pmm-client:dev-latest"}
1817
IMAGE_PMM_SERVER=${IMAGE_PMM_SERVER:-"perconalab/pmm-server:dev-latest"}
19-
CERT_MANAGER_VER="1.16.1"
18+
CERT_MANAGER_VER="1.16.2"
2019
tmp_dir=$(mktemp -d)
2120
sed=$(which gsed || which sed)
2221
date=$(which gdate || which date)

0 commit comments

Comments
 (0)