Skip to content

Commit 98b8cdc

Browse files
authored
K8SPXC-1143 add ignore annotations test (#1384)
* K8SPXC-1143 add ignore annotations test
1 parent 04ed1b0 commit 98b8cdc

22 files changed

+855
-3
lines changed

e2e-tests/functions

+8-3
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ wait_pod() {
160160
local ns=$3
161161
local container=$(echo "$pod" | $sed -E 's/.*-(pxc|proxysql)-[0-9]/\1/' | egrep "^(pxc|proxysql)$")
162162

163+
set +o xtrace
163164
retry=0
164165
echo -n $pod
165166
until kubectl_bin get ${ns:+-n $ns} pod/$pod -o jsonpath='{.status.conditions[?(@.type == "Ready")].status}' 2>/dev/null | grep -q -i 'True' \
@@ -186,6 +187,7 @@ wait_crash_pod() {
186187
local ns=$3
187188
local container=$(echo "$pod" | $sed -E 's/.*-(pxc|proxysql)-[0-9]/\1/' | egrep "^(pxc|proxysql)$")
188189

190+
set +o xtrace
189191
retry=0
190192
echo -n $pod
191193
until kubectl_bin get ${ns:+-n $ns} pod/$pod -o jsonpath='{.status.conditions[?(@.type == "Ready")].status}' 2>/dev/null | grep -q -i 'True' \
@@ -210,6 +212,7 @@ wait_backup() {
210212
local backup=$1
211213
local status=${2:-'Succeeded'}
212214

215+
set +o xtrace
213216
retry=0
214217
echo -n $backup
215218
until kubectl_bin get pxc-backup/$backup -o jsonpath='{.status.state}' 2>/dev/null | grep $status; do
@@ -229,7 +232,7 @@ wait_backup_restore() {
229232
local backup_name=$1
230233
local status=${2:-'Succeeded'}
231234
desc "wait backup restore"
232-
235+
set +o xtrace
233236
retry=0
234237
echo -n $backup_name
235238
until kubectl_bin get pxc-restore/$backup_name -o jsonpath='{.status.state}' 2>/dev/null | grep $status; do
@@ -325,6 +328,7 @@ wait_for_delete() {
325328
local res="$1"
326329

327330
echo -n "$res - "
331+
set +o xtrace
328332
retry=0
329333
until (kubectl_bin get $res || :) 2>&1 | grep NotFound; do
330334
sleep 1
@@ -443,11 +447,12 @@ run_mysql() {
443447

444448
client_pod=$(get_client_pod)
445449
wait_pod $client_pod 1>&2
446-
450+
set +o xtrace
447451
kubectl_bin exec $client_pod -- \
448452
bash -c "printf '%s\n' \"${command}\" | mysql -sN $uri" 2>&1 \
449453
| sed -e 's/mysql: //' \
450454
| (grep -v 'Using a password on the command line interface can be insecure.' || :)
455+
451456
set_debug
452457
}
453458

@@ -456,7 +461,7 @@ run_mysql_local() {
456461
local uri="$2"
457462
local pod="$3"
458463
local container_name="$4"
459-
464+
set +o xtrace
460465
kubectl_bin exec $pod ${container_name:+-c $container_name} -- \
461466
bash -c "printf '$command\n' | mysql -sN $uri" 2>&1 \
462467
| sed -e 's/mysql: //' \
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
100500
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
annotations:
5+
crAnnotation: "true"
6+
ignoredAnnotation: "true"
7+
labels:
8+
app.kubernetes.io/component: haproxy
9+
app.kubernetes.io/instance: ignore-annotations
10+
app.kubernetes.io/managed-by: percona-xtradb-cluster-operator
11+
app.kubernetes.io/name: percona-xtradb-cluster
12+
app.kubernetes.io/part-of: percona-xtradb-cluster
13+
crLabel: "true"
14+
ignoredLabel: "true"
15+
name: ignore-annotations-haproxy
16+
ownerReferences:
17+
- controller: true
18+
kind: PerconaXtraDBCluster
19+
name: ignore-annotations
20+
spec:
21+
internalTrafficPolicy: Cluster
22+
ports:
23+
- name: mysql
24+
port: 3306
25+
protocol: TCP
26+
targetPort: 3306
27+
- name: proxy-protocol
28+
port: 3309
29+
protocol: TCP
30+
targetPort: 3309
31+
- name: mysql-admin
32+
port: 33062
33+
protocol: TCP
34+
targetPort: 33062
35+
- name: mysqlx
36+
port: 33060
37+
protocol: TCP
38+
targetPort: 33060
39+
selector:
40+
app.kubernetes.io/component: haproxy
41+
app.kubernetes.io/instance: ignore-annotations
42+
app.kubernetes.io/name: percona-xtradb-cluster
43+
sessionAffinity: None
44+
type: ClusterIP
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
annotations:
5+
ignoredAnnotation: "true"
6+
notIgnoredAnnotation: "true"
7+
labels:
8+
app.kubernetes.io/component: haproxy
9+
app.kubernetes.io/instance: ignore-annotations
10+
app.kubernetes.io/managed-by: percona-xtradb-cluster-operator
11+
app.kubernetes.io/name: percona-xtradb-cluster
12+
app.kubernetes.io/part-of: percona-xtradb-cluster
13+
ignoredLabel: "true"
14+
notIgnoredLabel: "true"
15+
name: ignore-annotations-haproxy
16+
ownerReferences:
17+
- controller: true
18+
kind: PerconaXtraDBCluster
19+
name: ignore-annotations
20+
spec:
21+
internalTrafficPolicy: Cluster
22+
ports:
23+
- name: mysql
24+
port: 3306
25+
protocol: TCP
26+
targetPort: 3306
27+
- name: proxy-protocol
28+
port: 3309
29+
protocol: TCP
30+
targetPort: 3309
31+
- name: mysql-admin
32+
port: 33062
33+
protocol: TCP
34+
targetPort: 33062
35+
- name: mysqlx
36+
port: 33060
37+
protocol: TCP
38+
targetPort: 33060
39+
selector:
40+
app.kubernetes.io/component: haproxy
41+
app.kubernetes.io/instance: ignore-annotations
42+
app.kubernetes.io/name: percona-xtradb-cluster
43+
sessionAffinity: None
44+
type: ClusterIP
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
annotations:
5+
otherCrAnnotation: "true"
6+
labels:
7+
app.kubernetes.io/component: haproxy
8+
app.kubernetes.io/instance: ignore-annotations
9+
app.kubernetes.io/managed-by: percona-xtradb-cluster-operator
10+
app.kubernetes.io/name: percona-xtradb-cluster
11+
app.kubernetes.io/part-of: percona-xtradb-cluster
12+
otherCrLabel: "true"
13+
name: ignore-annotations-haproxy
14+
ownerReferences:
15+
- controller: true
16+
kind: PerconaXtraDBCluster
17+
name: ignore-annotations
18+
spec:
19+
internalTrafficPolicy: Cluster
20+
ports:
21+
- name: mysql
22+
port: 3306
23+
protocol: TCP
24+
targetPort: 3306
25+
- name: proxy-protocol
26+
port: 3309
27+
protocol: TCP
28+
targetPort: 3309
29+
- name: mysql-admin
30+
port: 33062
31+
protocol: TCP
32+
targetPort: 33062
33+
- name: mysqlx
34+
port: 33060
35+
protocol: TCP
36+
targetPort: 33060
37+
selector:
38+
app.kubernetes.io/component: haproxy
39+
app.kubernetes.io/instance: ignore-annotations
40+
app.kubernetes.io/name: percona-xtradb-cluster
41+
sessionAffinity: None
42+
type: ClusterIP
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
annotations:
5+
ignoredAnnotation: "true"
6+
otherCrAnnotation: "true"
7+
labels:
8+
app.kubernetes.io/component: haproxy
9+
app.kubernetes.io/instance: ignore-annotations
10+
app.kubernetes.io/managed-by: percona-xtradb-cluster-operator
11+
app.kubernetes.io/name: percona-xtradb-cluster
12+
app.kubernetes.io/part-of: percona-xtradb-cluster
13+
ignoredLabel: "true"
14+
otherCrLabel: "true"
15+
name: ignore-annotations-haproxy
16+
ownerReferences:
17+
- controller: true
18+
kind: PerconaXtraDBCluster
19+
name: ignore-annotations
20+
spec:
21+
internalTrafficPolicy: Cluster
22+
ports:
23+
- name: mysql
24+
port: 3306
25+
protocol: TCP
26+
targetPort: 3306
27+
- name: proxy-protocol
28+
port: 3309
29+
protocol: TCP
30+
targetPort: 3309
31+
- name: mysql-admin
32+
port: 33062
33+
protocol: TCP
34+
targetPort: 33062
35+
- name: mysqlx
36+
port: 33060
37+
protocol: TCP
38+
targetPort: 33060
39+
selector:
40+
app.kubernetes.io/component: haproxy
41+
app.kubernetes.io/instance: ignore-annotations
42+
app.kubernetes.io/name: percona-xtradb-cluster
43+
sessionAffinity: None
44+
type: ClusterIP
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
annotations:
5+
ignoredAnnotation: "true"
6+
otherCrAnnotation: "true"
7+
secondCrAnnotation: "true"
8+
labels:
9+
app.kubernetes.io/component: haproxy
10+
app.kubernetes.io/instance: ignore-annotations
11+
app.kubernetes.io/managed-by: percona-xtradb-cluster-operator
12+
app.kubernetes.io/name: percona-xtradb-cluster
13+
app.kubernetes.io/part-of: percona-xtradb-cluster
14+
ignoredLabel: "true"
15+
otherCrLabel: "true"
16+
secondCrLabel: "true"
17+
name: ignore-annotations-haproxy
18+
ownerReferences:
19+
- controller: true
20+
kind: PerconaXtraDBCluster
21+
name: ignore-annotations
22+
spec:
23+
internalTrafficPolicy: Cluster
24+
ports:
25+
- name: mysql
26+
port: 3306
27+
protocol: TCP
28+
targetPort: 3306
29+
- name: proxy-protocol
30+
port: 3309
31+
protocol: TCP
32+
targetPort: 3309
33+
- name: mysql-admin
34+
port: 33062
35+
protocol: TCP
36+
targetPort: 33062
37+
- name: mysqlx
38+
port: 33060
39+
protocol: TCP
40+
targetPort: 33060
41+
selector:
42+
app.kubernetes.io/component: haproxy
43+
app.kubernetes.io/instance: ignore-annotations
44+
app.kubernetes.io/name: percona-xtradb-cluster
45+
sessionAffinity: None
46+
type: ClusterIP
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
annotations:
5+
crAnnotation: "true"
6+
ignoredAnnotation: "true"
7+
labels:
8+
app.kubernetes.io/component: proxysql
9+
app.kubernetes.io/instance: ignore-annotations
10+
app.kubernetes.io/managed-by: percona-xtradb-cluster-operator
11+
app.kubernetes.io/name: percona-xtradb-cluster
12+
app.kubernetes.io/part-of: percona-xtradb-cluster
13+
crLabel: "true"
14+
ignoredLabel: "true"
15+
name: ignore-annotations-proxysql
16+
ownerReferences:
17+
- controller: true
18+
kind: PerconaXtraDBCluster
19+
name: ignore-annotations
20+
spec:
21+
internalTrafficPolicy: Cluster
22+
ports:
23+
- name: mysql
24+
port: 3306
25+
protocol: TCP
26+
targetPort: 3306
27+
- name: mysql-admin
28+
port: 33062
29+
protocol: TCP
30+
targetPort: 33062
31+
selector:
32+
app.kubernetes.io/component: proxysql
33+
app.kubernetes.io/instance: ignore-annotations
34+
app.kubernetes.io/name: percona-xtradb-cluster
35+
sessionAffinity: None
36+
type: ClusterIP
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
annotations:
5+
ignoredAnnotation: "true"
6+
notIgnoredAnnotation: "true"
7+
labels:
8+
app.kubernetes.io/component: proxysql
9+
app.kubernetes.io/instance: ignore-annotations
10+
app.kubernetes.io/managed-by: percona-xtradb-cluster-operator
11+
app.kubernetes.io/name: percona-xtradb-cluster
12+
app.kubernetes.io/part-of: percona-xtradb-cluster
13+
ignoredLabel: "true"
14+
notIgnoredLabel: "true"
15+
name: ignore-annotations-proxysql
16+
ownerReferences:
17+
- controller: true
18+
kind: PerconaXtraDBCluster
19+
name: ignore-annotations
20+
spec:
21+
internalTrafficPolicy: Cluster
22+
ports:
23+
- name: mysql
24+
port: 3306
25+
protocol: TCP
26+
targetPort: 3306
27+
- name: mysql-admin
28+
port: 33062
29+
protocol: TCP
30+
targetPort: 33062
31+
selector:
32+
app.kubernetes.io/component: proxysql
33+
app.kubernetes.io/instance: ignore-annotations
34+
app.kubernetes.io/name: percona-xtradb-cluster
35+
sessionAffinity: None
36+
type: ClusterIP
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
annotations:
5+
otherCrAnnotation: "true"
6+
labels:
7+
app.kubernetes.io/component: proxysql
8+
app.kubernetes.io/instance: ignore-annotations
9+
app.kubernetes.io/managed-by: percona-xtradb-cluster-operator
10+
app.kubernetes.io/name: percona-xtradb-cluster
11+
app.kubernetes.io/part-of: percona-xtradb-cluster
12+
otherCrLabel: "true"
13+
name: ignore-annotations-proxysql
14+
ownerReferences:
15+
- controller: true
16+
kind: PerconaXtraDBCluster
17+
name: ignore-annotations
18+
spec:
19+
internalTrafficPolicy: Cluster
20+
ports:
21+
- name: mysql
22+
port: 3306
23+
protocol: TCP
24+
targetPort: 3306
25+
- name: mysql-admin
26+
port: 33062
27+
protocol: TCP
28+
targetPort: 33062
29+
selector:
30+
app.kubernetes.io/component: proxysql
31+
app.kubernetes.io/instance: ignore-annotations
32+
app.kubernetes.io/name: percona-xtradb-cluster
33+
sessionAffinity: None
34+
type: ClusterIP

0 commit comments

Comments
 (0)