Skip to content

Commit c01795a

Browse files
authored
Merge branch 'main' into dependabot/go_modules/google.golang.org/grpc-1.76.0
2 parents 8f7f028 + 959c43b commit c01795a

23 files changed

+238
-50
lines changed

Jenkinsfile

Lines changed: 65 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,41 @@
1-
region="us-central1-a"
2-
testUrlPrefix="https://percona-jenkins-artifactory-public.s3.amazonaws.com/cloud-psmdb-operator"
3-
tests=[]
1+
region = 'us-central1-a'
2+
testUrlPrefix = 'https://percona-jenkins-artifactory-public.s3.amazonaws.com/cloud-psmdb-operator'
3+
tests = []
44

55
void createCluster(String CLUSTER_SUFFIX) {
66
withCredentials([string(credentialsId: 'GCP_PROJECT_ID', variable: 'GCP_PROJECT'), file(credentialsId: 'gcloud-key-file', variable: 'CLIENT_SECRET_FILE')]) {
77
sh """
8-
NODES_NUM=3
9-
export KUBECONFIG=/tmp/$CLUSTER_NAME-${CLUSTER_SUFFIX}
8+
export KUBECONFIG=/tmp/${CLUSTER_NAME}-${CLUSTER_SUFFIX}
9+
gcloud auth activate-service-account --key-file $CLIENT_SECRET_FILE
10+
gcloud config set project $GCP_PROJECT
1011
ret_num=0
1112
while [ \${ret_num} -lt 15 ]; do
1213
ret_val=0
13-
gcloud auth activate-service-account --key-file $CLIENT_SECRET_FILE
14-
gcloud config set project $GCP_PROJECT
15-
gcloud container clusters list --filter $CLUSTER_NAME-${CLUSTER_SUFFIX} --zone $region --format='csv[no-heading](name)' | xargs gcloud container clusters delete --zone $region --quiet || true
16-
gcloud container clusters create --zone $region $CLUSTER_NAME-${CLUSTER_SUFFIX} --cluster-version=1.31 --machine-type=n1-standard-4 --preemptible --disk-size 30 --num-nodes=\$NODES_NUM --network=jenkins-vpc --subnetwork=jenkins-${CLUSTER_SUFFIX} --no-enable-autoupgrade --cluster-ipv4-cidr=/21 --labels delete-cluster-after-hours=6 --enable-ip-alias --workload-pool=cloud-dev-112233.svc.id.goog && \
14+
gcloud container clusters list --filter ${CLUSTER_NAME}-${CLUSTER_SUFFIX} --zone ${region} --format='csv[no-heading](name)' | xargs gcloud container clusters delete --zone ${region} --quiet || true
15+
gcloud container clusters create ${CLUSTER_NAME}-${CLUSTER_SUFFIX} \
16+
--preemptible \
17+
--zone=${region} \
18+
--machine-type='n1-standard-4' \
19+
--cluster-version='1.31' \
20+
--num-nodes=3 \
21+
--labels='delete-cluster-after-hours=6' \
22+
--disk-size=30 \
23+
--network=jenkins-vpc \
24+
--subnetwork=jenkins-${CLUSTER_SUFFIX} \
25+
--cluster-ipv4-cidr=/21 \
26+
--enable-ip-alias \
27+
--no-enable-autoupgrade \
28+
--monitoring=NONE \
29+
--logging=NONE \
30+
--no-enable-managed-prometheus \
31+
--workload-pool=cloud-dev-112233.svc.id.goog \
32+
--quiet && \
1733
kubectl create clusterrolebinding cluster-admin-binding --clusterrole cluster-admin --user jenkins@"$GCP_PROJECT".iam.gserviceaccount.com || ret_val=\$?
1834
if [ \${ret_val} -eq 0 ]; then break; fi
1935
ret_num=\$((ret_num + 1))
2036
done
2137
if [ \${ret_num} -eq 15 ]; then
22-
gcloud container clusters list --filter $CLUSTER_NAME-${CLUSTER_SUFFIX} --zone $region --format='csv[no-heading](name)' | xargs gcloud container clusters delete --zone $region --quiet || true
38+
gcloud container clusters list --filter ${CLUSTER_NAME}-${CLUSTER_SUFFIX} --zone ${region} --format='csv[no-heading](name)' | xargs gcloud container clusters delete --zone ${region} --quiet || true
2339
exit 1
2440
fi
2541
"""
@@ -29,7 +45,7 @@ void createCluster(String CLUSTER_SUFFIX) {
2945
void shutdownCluster(String CLUSTER_SUFFIX) {
3046
withCredentials([string(credentialsId: 'GCP_PROJECT_ID', variable: 'GCP_PROJECT'), file(credentialsId: 'gcloud-key-file', variable: 'CLIENT_SECRET_FILE')]) {
3147
sh """
32-
export KUBECONFIG=/tmp/$CLUSTER_NAME-${CLUSTER_SUFFIX}
48+
export KUBECONFIG=/tmp/${CLUSTER_NAME}-${CLUSTER_SUFFIX}
3349
gcloud auth activate-service-account --key-file $CLIENT_SECRET_FILE
3450
gcloud config set project $GCP_PROJECT
3551
for namespace in \$(kubectl get namespaces --no-headers | awk '{print \$1}' | grep -vE "^kube-|^openshift" | sed '/-operator/ s/^/1-/' | sort | sed 's/^1-//'); do
@@ -41,7 +57,7 @@ void shutdownCluster(String CLUSTER_SUFFIX) {
4157
kubectl delete pods --all -n \$namespace --force --grace-period=0 || true
4258
done
4359
kubectl get svc --all-namespaces || true
44-
gcloud container clusters delete --zone $region $CLUSTER_NAME-${CLUSTER_SUFFIX}
60+
gcloud container clusters delete --zone ${region} ${CLUSTER_NAME}-${CLUSTER_SUFFIX}
4561
"""
4662
}
4763
}
@@ -65,7 +81,7 @@ void deleteOldClusters(String FILTER) {
6581
break
6682
fi
6783
done
68-
gcloud container clusters delete --async --zone $region --quiet \$GKE_CLUSTER || true
84+
gcloud container clusters delete --async --zone ${region} --quiet \$GKE_CLUSTER || true
6985
done
7086
fi
7187
"""
@@ -132,9 +148,9 @@ void markPassedTests() {
132148

133149
void printKubernetesStatus(String LOCATION, String CLUSTER_SUFFIX) {
134150
sh """
135-
export KUBECONFIG=/tmp/$CLUSTER_NAME-$CLUSTER_SUFFIX
151+
export KUBECONFIG=/tmp/${CLUSTER_NAME}-${CLUSTER_SUFFIX}
136152
echo "========== KUBERNETES STATUS $LOCATION TEST =========="
137-
gcloud container clusters list|grep -E "NAME|$CLUSTER_NAME-$CLUSTER_SUFFIX "
153+
gcloud container clusters list|grep -E "NAME|${CLUSTER_NAME}-${CLUSTER_SUFFIX} "
138154
echo
139155
kubectl get nodes
140156
echo
@@ -149,26 +165,51 @@ void printKubernetesStatus(String LOCATION, String CLUSTER_SUFFIX) {
149165
"""
150166
}
151167

152-
TestsReport = '| Test name | Status |\r\n| ------------- | ------------- |'
168+
String formatTime(def time) {
169+
if (!time || time == "N/A") return "N/A"
170+
171+
try {
172+
def totalSeconds = time as Double
173+
def hours = (totalSeconds / 3600) as Integer
174+
def minutes = ((totalSeconds % 3600) / 60) as Integer
175+
def seconds = (totalSeconds % 60) as Integer
176+
177+
return String.format("%02d:%02d:%02d", hours, minutes, seconds)
178+
179+
} catch (Exception e) {
180+
println("Error converting time: ${e.message}")
181+
return time.toString()
182+
}
183+
}
184+
185+
TestsReport = '| Test Name | Result | Time |\r\n| ----------- | -------- | ------ |'
153186
TestsReportXML = '<testsuite name=\\"PSMDB\\">\n'
154187

155188
void makeReport() {
156-
def wholeTestAmount=tests.size()
189+
def wholeTestAmount = tests.size()
157190
def startedTestAmount = 0
191+
def totalTestTime = 0
158192

159193
for (int i=0; i<tests.size(); i++) {
160194
def testName = tests[i]["name"]
161195
def testResult = tests[i]["result"]
162196
def testTime = tests[i]["time"]
163197
def testUrl = "${testUrlPrefix}/${env.GIT_BRANCH}/${env.GIT_SHORT_COMMIT}/${testName}.log"
164198

199+
if (testTime instanceof Number) {
200+
totalTestTime += testTime
201+
}
202+
165203
if (tests[i]["result"] != "skipped") {
166204
startedTestAmount++
167205
}
168-
TestsReport = TestsReport + "\r\n| "+ testName +" | ["+ testResult +"]("+ testUrl +") |"
206+
TestsReport = TestsReport + "\r\n| " + testName + " | [" + testResult + "](" + testUrl + ") | " + formatTime(testTime) + " |"
169207
TestsReportXML = TestsReportXML + '<testcase name=\\"' + testName + '\\" time=\\"' + testTime + '\\"><'+ testResult +'/></testcase>\n'
170208
}
171-
TestsReport = TestsReport + "\r\n| We run $startedTestAmount out of $wholeTestAmount|"
209+
TestsReport = TestsReport + "\r\n\r\n| Summary | Value |\r\n| ------- | ----- |"
210+
TestsReport = TestsReport + "\r\n| Tests Run | $startedTestAmount/$wholeTestAmount |"
211+
TestsReport = TestsReport + "\r\n| Job Duration | " + formatTime(currentBuild.duration / 1000) + " |"
212+
TestsReport = TestsReport + "\r\n| Total Test Time | " + formatTime(totalTestTime) + " |"
172213
TestsReportXML = TestsReportXML + '</testsuite>\n'
173214

174215
sh """
@@ -204,7 +245,7 @@ void runTest(Integer TEST_ID) {
204245
waitUntil {
205246
def timeStart = new Date().getTime()
206247
try {
207-
echo "The $testName test was started on cluster $CLUSTER_NAME-$clusterSuffix !"
248+
echo "The $testName test was started on cluster ${CLUSTER_NAME}-${clusterSuffix} !"
208249
tests[TEST_ID]["result"] = "failure"
209250

210251
timeout(time: 90, unit: 'MINUTES') {
@@ -214,7 +255,7 @@ void runTest(Integer TEST_ID) {
214255
else
215256
export DEBUG_TESTS=1
216257
fi
217-
export KUBECONFIG=/tmp/$CLUSTER_NAME-$clusterSuffix
258+
export KUBECONFIG=/tmp/${CLUSTER_NAME}-${clusterSuffix}
218259
time ./e2e-tests/$testName/run
219260
"""
220261
}
@@ -244,10 +285,10 @@ void runTest(Integer TEST_ID) {
244285

245286
void prepareNode() {
246287
sh """
247-
sudo curl -s -L -o /usr/local/bin/kubectl https://dl.k8s.io/release/\$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl && sudo chmod +x /usr/local/bin/kubectl
288+
sudo curl -sLo /usr/local/bin/kubectl https://dl.k8s.io/release/\$(curl -Ls https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl && sudo chmod +x /usr/local/bin/kubectl
248289
kubectl version --client --output=yaml
249290
250-
curl -fsSL https://get.helm.sh/helm-v3.12.3-linux-amd64.tar.gz | sudo tar -C /usr/local/bin --strip-components 1 -xzf - linux-amd64/helm
291+
curl -fsSL https://get.helm.sh/helm-v3.18.3-linux-amd64.tar.gz | sudo tar -C /usr/local/bin --strip-components 1 -xzf - linux-amd64/helm
251292
252293
sudo curl -fsSL https://github.com/mikefarah/yq/releases/download/v4.44.1/yq_linux_amd64 -o /usr/local/bin/yq && sudo chmod +x /usr/local/bin/yq
253294
sudo curl -fsSL https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-linux64 -o /usr/local/bin/jq && sudo chmod +x /usr/local/bin/jq
@@ -499,7 +540,7 @@ pipeline {
499540
}
500541
}
501542
options {
502-
timeout(time: 3, unit: 'HOURS')
543+
timeout(time: 4, unit: 'HOURS')
503544
}
504545
parallel {
505546
stage('cluster1') {

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ release: manifests
127127
-e "s|perconalab/fluentbit:main-logcollector|$(IMAGE_LOGCOLLECTOR)|g" \
128128
pkg/controller/perconaservermongodb/testdata/reconcile-statefulset/*.yaml
129129
$(SED) -i "s|cr.Spec.InitImage = \".*\"|cr.Spec.InitImage = \"${IMAGE_OPERATOR}\"|g" pkg/controller/perconaservermongodb/suite_test.go
130-
131130

132131
# Prepare main branch after release
133132
MAJOR_VER := $(shell grep -oE "crVersion: .*" deploy/cr.yaml|grep -oE "[0-9]+\.[0-9]+\.[0-9]+"|cut -d'.' -f1)

e2e-tests/functions

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ 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:-$'
1010
perconalab/percona-server-mongodb-operator:main-mongod6.0
1111
perconalab/percona-server-mongodb-operator:main-mongod7.0
@@ -15,9 +15,9 @@ SKIP_BACKUPS_TO_AWS_GCP_AZURE=${SKIP_BACKUPS_TO_AWS_GCP_AZURE:-1}
1515
PMM_SERVER_VER=${PMM_SERVER_VER:-"9.9.9"}
1616
IMAGE_PMM_CLIENT=${IMAGE_PMM_CLIENT:-"percona/pmm-client:2.44.1-1"}
1717
IMAGE_PMM_SERVER=${IMAGE_PMM_SERVER:-"perconalab/pmm-server:dev-latest"}
18-
IMAGE_PMM3_CLIENT=${IMAGE_PMM3_CLIENT:-"perconalab/pmm-client:3.4.1"}
19-
IMAGE_PMM3_SERVER=${IMAGE_PMM3_SERVER:-"perconalab/pmm-server:3.4.1"}
20-
CERT_MANAGER_VER="1.18.2"
18+
IMAGE_PMM3_CLIENT=${IMAGE_PMM3_CLIENT:-"perconalab/pmm-client:3-dev-latest"}
19+
IMAGE_PMM3_SERVER=${IMAGE_PMM3_SERVER:-"perconalab/pmm-server:3-dev-latest"}
20+
CERT_MANAGER_VER="1.19.1"
2121
MINIO_VER="5.4.0"
2222
CHAOS_MESH_VER="2.7.1"
2323
UPDATE_COMPARE_FILES=${UPDATE_COMPARE_FILES:-0}

e2e-tests/init-deploy/compare/statefulset_another-name-rs0.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,57 @@ spec:
161161
resources: {}
162162
terminationMessagePath: /dev/termination-log
163163
terminationMessagePolicy: File
164+
- args:
165+
- pbm-agent-entrypoint
166+
command:
167+
- /opt/percona/pbm-entry.sh
168+
env:
169+
- name: PBM_AGENT_MONGODB_USERNAME
170+
valueFrom:
171+
secretKeyRef:
172+
key: MONGODB_BACKUP_USER_ESCAPED
173+
name: internal-another-name-users
174+
optional: false
175+
- name: PBM_AGENT_MONGODB_PASSWORD
176+
valueFrom:
177+
secretKeyRef:
178+
key: MONGODB_BACKUP_PASSWORD_ESCAPED
179+
name: internal-another-name-users
180+
optional: false
181+
- name: PBM_MONGODB_REPLSET
182+
value: rs0
183+
- name: PBM_MONGODB_PORT
184+
value: "27017"
185+
- name: PBM_AGENT_SIDECAR
186+
value: "true"
187+
- name: PBM_AGENT_SIDECAR_SLEEP
188+
value: "5"
189+
- name: POD_NAME
190+
valueFrom:
191+
fieldRef:
192+
apiVersion: v1
193+
fieldPath: metadata.name
194+
- name: PBM_MONGODB_URI
195+
value: mongodb://$(PBM_AGENT_MONGODB_USERNAME):$(PBM_AGENT_MONGODB_PASSWORD)@localhost:$(PBM_MONGODB_PORT)
196+
- name: PBM_AGENT_TLS_ENABLED
197+
value: "false"
198+
imagePullPolicy: Always
199+
name: backup-agent
200+
resources: {}
201+
securityContext:
202+
runAsNonRoot: true
203+
runAsUser: 1001
204+
terminationMessagePath: /dev/termination-log
205+
terminationMessagePolicy: File
206+
volumeMounts:
207+
- mountPath: /etc/mongodb-ssl
208+
name: ssl
209+
readOnly: true
210+
- mountPath: /opt/percona
211+
name: bin
212+
readOnly: true
213+
- mountPath: /data/db
214+
name: mongod-data
164215
- args:
165216
- fluent-bit
166217
command:

e2e-tests/init-deploy/conf/another-name-rs0.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,18 @@ spec:
1111
tls:
1212
mode: disabled
1313
backup:
14-
enabled: false
15-
image: perconalab/percona-server-mongodb-operator:0.4.0-backup
16-
# storages:
17-
# tasks:
14+
enabled: true
15+
image: perconalab/percona-server-mongodb-operator:1.1.0-backup
16+
storages:
17+
gcp-cs-s3:
18+
type: s3
19+
s3:
20+
credentialsSecret: gcp-cs-secret
21+
region: us-east-1
22+
bucket: operator-testing
23+
prefix: psmdb-demand-backup-physical
24+
endpointUrl: https://storage.googleapis.com
25+
insecureSkipTLSVerify: false
1826
replsets:
1927
- name: rs0
2028
terminationGracePeriodSeconds: 300
@@ -70,4 +78,4 @@ spec:
7078
users: some-users
7179
logcollector:
7280
enabled: true
73-
image: perconalab/fluentbit:main-logcollector
81+
image: perconalab/fluentbit:main-logcollector

e2e-tests/init-deploy/run

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ compare_mongo_cmd "find" "myApp:myPass@$cluster-2.$cluster.$namespace"
7676
desc 'check number of connections'
7777
conn_count=$(run_mongo 'db.serverStatus().connections.current' "clusterAdmin:clusterAdmin123456@$cluster.$namespace" | egrep -v 'I NETWORK|W NETWORK|Error saving history file|Percona Server for MongoDB|connecting to:|Unable to reach primary for set|Implicit session:|versions do not match|bye')
7878
if [ ${conn_count} -gt ${max_conn} ]; then
79+
echo "error: connection count (${conn_count}) exceeds maximum allowed (${max_conn})"
7980
exit 1
8081
fi
8182

@@ -94,6 +95,7 @@ compare_mongo_cmd "find" "myApp:myPass@$cluster-2.$cluster.$namespace" "-2nd"
9495

9596
desc 'check if possible to create second cluster'
9697
cluster2="another-name-rs0"
98+
apply_s3_storage_secrets
9799
apply_cluster $test_dir/conf/$cluster2.yml
98100
desc 'check if all 3 Pods started'
99101
wait_for_running $cluster2 3
@@ -112,6 +114,15 @@ compare_mongo_cmd "find" "myApp:myPass@$cluster2-0.$cluster2.$namespace" "-3rd"
112114
compare_mongo_cmd "find" "myApp:myPass@$cluster2-1.$cluster2.$namespace" "-3rd"
113115
compare_mongo_cmd "find" "myApp:myPass@$cluster2-2.$cluster2.$namespace" "-3rd"
114116

117+
desc 'check number of connections with backup'
118+
max_conn=50
119+
sleep 300
120+
conn_count=$(run_mongo 'db.serverStatus().connections.current' "clusterAdmin:clusterAdmin123456@$cluster2.$namespace" | egrep -v 'I NETWORK|W NETWORK|Error saving history file|Percona Server for MongoDB|connecting to:|Unable to reach primary for set|Implicit session:|versions do not match|bye')
121+
if [ ${conn_count} -gt ${max_conn} ]; then
122+
echo "error: connection count (${conn_count}) exceeds maximum allowed (${max_conn}) with backup enabled"
123+
exit 1
124+
fi
125+
115126
desc 'check if mongod log files exist in pod'
116127
log_files=$(kubectl exec "${cluster2}-0" -c "mongod" -- ls "/data/db/logs" 2>/dev/null)
117128
if ! echo "$log_files" | grep -q 'mongod.log' || ! echo "$log_files" | grep -q 'mongod.full.log'; then

e2e-tests/release_versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
IMAGE_OPERATOR=percona/percona-server-mongodb-operator:1.21.0
1+
IMAGE_OPERATOR=percona/percona-server-mongodb-operator:1.21.1
22
IMAGE_MONGOD80=percona/percona-server-mongodb:8.0.12-4
33
IMAGE_MONGOD70=percona/percona-server-mongodb:7.0.24-13
44
IMAGE_MONGOD60=percona/percona-server-mongodb:6.0.25-20

0 commit comments

Comments
 (0)