diff --git a/config/crd/bases/pxc.percona.com_perconaxtradbclusters.yaml b/config/crd/bases/pxc.percona.com_perconaxtradbclusters.yaml index ab8c89b798..0530f58d30 100644 --- a/config/crd/bases/pxc.percona.com_perconaxtradbclusters.yaml +++ b/config/crd/bases/pxc.percona.com_perconaxtradbclusters.yaml @@ -3938,6 +3938,11 @@ spec: type: object priorityClassName: type: string + pxchandler: + enum: + - internal + - scheduler + type: string readinessDelaySec: format: int32 type: integer diff --git a/deploy/bundle.yaml b/deploy/bundle.yaml index 1cebf3dd41..df93e490e4 100644 --- a/deploy/bundle.yaml +++ b/deploy/bundle.yaml @@ -4638,6 +4638,11 @@ spec: type: object priorityClassName: type: string + pxchandler: + enum: + - internal + - scheduler + type: string readinessDelaySec: format: int32 type: integer diff --git a/deploy/cr.yaml b/deploy/cr.yaml index dbf8e482a2..d1213e942c 100644 --- a/deploy/cr.yaml +++ b/deploy/cr.yaml @@ -318,6 +318,7 @@ spec: gracePeriod: 30 proxysql: enabled: false + pxchandler: internal size: 3 image: perconalab/percona-xtradb-cluster-operator:main-proxysql # imagePullPolicy: Always diff --git a/deploy/crd.yaml b/deploy/crd.yaml index b3f0a5a12d..c5cde57913 100644 --- a/deploy/crd.yaml +++ b/deploy/crd.yaml @@ -4638,6 +4638,11 @@ spec: type: object priorityClassName: type: string + pxchandler: + enum: + - internal + - scheduler + type: string readinessDelaySec: format: int32 type: integer diff --git a/deploy/cw-bundle.yaml b/deploy/cw-bundle.yaml index 837917dcb6..a6461fc181 100644 --- a/deploy/cw-bundle.yaml +++ b/deploy/cw-bundle.yaml @@ -4638,6 +4638,11 @@ spec: type: object priorityClassName: type: string + pxchandler: + enum: + - internal + - scheduler + type: string readinessDelaySec: format: int32 type: integer diff --git a/e2e-tests/affinity/compare/statefulset_custom-proxysql-oc.yml b/e2e-tests/affinity/compare/statefulset_custom-proxysql-oc.yml index 38be117d8d..2989acc467 100644 --- a/e2e-tests/affinity/compare/statefulset_custom-proxysql-oc.yml +++ b/e2e-tests/affinity/compare/statefulset_custom-proxysql-oc.yml @@ -89,6 +89,8 @@ spec: secretKeyRef: key: monitor name: internal-custom + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: custom-env-vars-proxysql @@ -142,6 +144,8 @@ spec: secretKeyRef: key: monitor name: internal-custom + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: custom-env-vars-proxysql @@ -175,6 +179,8 @@ spec: secretKeyRef: key: monitor name: internal-custom + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: custom-env-vars-proxysql diff --git a/e2e-tests/affinity/compare/statefulset_custom-proxysql.yml b/e2e-tests/affinity/compare/statefulset_custom-proxysql.yml index 2ca65d47cd..ff2eb1d094 100644 --- a/e2e-tests/affinity/compare/statefulset_custom-proxysql.yml +++ b/e2e-tests/affinity/compare/statefulset_custom-proxysql.yml @@ -89,6 +89,8 @@ spec: secretKeyRef: key: monitor name: internal-custom + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: custom-env-vars-proxysql @@ -142,6 +144,8 @@ spec: secretKeyRef: key: monitor name: internal-custom + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: custom-env-vars-proxysql @@ -175,6 +179,8 @@ spec: secretKeyRef: key: monitor name: internal-custom + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: custom-env-vars-proxysql diff --git a/e2e-tests/affinity/compare/statefulset_hostname-proxysql-oc.yml b/e2e-tests/affinity/compare/statefulset_hostname-proxysql-oc.yml index e439c17850..a817783dcb 100644 --- a/e2e-tests/affinity/compare/statefulset_hostname-proxysql-oc.yml +++ b/e2e-tests/affinity/compare/statefulset_hostname-proxysql-oc.yml @@ -62,6 +62,8 @@ spec: secretKeyRef: key: monitor name: internal-hostname + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: hostname-env-vars-proxysql @@ -115,6 +117,8 @@ spec: secretKeyRef: key: monitor name: internal-hostname + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: hostname-env-vars-proxysql @@ -148,6 +152,8 @@ spec: secretKeyRef: key: monitor name: internal-hostname + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: hostname-env-vars-proxysql diff --git a/e2e-tests/affinity/compare/statefulset_hostname-proxysql.yml b/e2e-tests/affinity/compare/statefulset_hostname-proxysql.yml index 1f8ecb256c..260e666e3a 100644 --- a/e2e-tests/affinity/compare/statefulset_hostname-proxysql.yml +++ b/e2e-tests/affinity/compare/statefulset_hostname-proxysql.yml @@ -62,6 +62,8 @@ spec: secretKeyRef: key: monitor name: internal-hostname + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: hostname-env-vars-proxysql @@ -115,6 +117,8 @@ spec: secretKeyRef: key: monitor name: internal-hostname + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: hostname-env-vars-proxysql @@ -148,6 +152,8 @@ spec: secretKeyRef: key: monitor name: internal-hostname + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: hostname-env-vars-proxysql diff --git a/e2e-tests/affinity/compare/statefulset_region-proxysql-oc.yml b/e2e-tests/affinity/compare/statefulset_region-proxysql-oc.yml index dc0cf0409a..8a58f0f183 100644 --- a/e2e-tests/affinity/compare/statefulset_region-proxysql-oc.yml +++ b/e2e-tests/affinity/compare/statefulset_region-proxysql-oc.yml @@ -62,6 +62,8 @@ spec: secretKeyRef: key: monitor name: internal-region + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: region-env-vars-proxysql @@ -115,6 +117,8 @@ spec: secretKeyRef: key: monitor name: internal-region + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: region-env-vars-proxysql @@ -148,6 +152,8 @@ spec: secretKeyRef: key: monitor name: internal-region + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: region-env-vars-proxysql diff --git a/e2e-tests/affinity/compare/statefulset_region-proxysql.yml b/e2e-tests/affinity/compare/statefulset_region-proxysql.yml index 974b4644a7..1d92b9037e 100644 --- a/e2e-tests/affinity/compare/statefulset_region-proxysql.yml +++ b/e2e-tests/affinity/compare/statefulset_region-proxysql.yml @@ -62,6 +62,8 @@ spec: secretKeyRef: key: monitor name: internal-region + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: region-env-vars-proxysql @@ -115,6 +117,8 @@ spec: secretKeyRef: key: monitor name: internal-region + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: region-env-vars-proxysql @@ -148,6 +152,8 @@ spec: secretKeyRef: key: monitor name: internal-region + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: region-env-vars-proxysql diff --git a/e2e-tests/affinity/compare/statefulset_zone-proxysql-oc.yml b/e2e-tests/affinity/compare/statefulset_zone-proxysql-oc.yml index a9f930457e..8d2858b929 100644 --- a/e2e-tests/affinity/compare/statefulset_zone-proxysql-oc.yml +++ b/e2e-tests/affinity/compare/statefulset_zone-proxysql-oc.yml @@ -62,6 +62,8 @@ spec: secretKeyRef: key: monitor name: internal-zone + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: zone-env-vars-proxysql @@ -115,6 +117,8 @@ spec: secretKeyRef: key: monitor name: internal-zone + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: zone-env-vars-proxysql @@ -148,6 +152,8 @@ spec: secretKeyRef: key: monitor name: internal-zone + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: zone-env-vars-proxysql diff --git a/e2e-tests/affinity/compare/statefulset_zone-proxysql.yml b/e2e-tests/affinity/compare/statefulset_zone-proxysql.yml index d78ea83cae..1f76b033d5 100644 --- a/e2e-tests/affinity/compare/statefulset_zone-proxysql.yml +++ b/e2e-tests/affinity/compare/statefulset_zone-proxysql.yml @@ -62,6 +62,8 @@ spec: secretKeyRef: key: monitor name: internal-zone + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: zone-env-vars-proxysql @@ -115,6 +117,8 @@ spec: secretKeyRef: key: monitor name: internal-zone + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: zone-env-vars-proxysql @@ -148,6 +152,8 @@ spec: secretKeyRef: key: monitor name: internal-zone + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: zone-env-vars-proxysql diff --git a/e2e-tests/functions b/e2e-tests/functions index 084fee8430..f403123e22 100755 --- a/e2e-tests/functions +++ b/e2e-tests/functions @@ -500,12 +500,14 @@ compare_mysql_cmd_local() { get_proxy_primary() { local uri="$1" - local pod="$2" - local ip=$(run_mysql_local 'SELECT hostname FROM runtime_mysql_servers WHERE hostgroup_id=11 AND status="ONLINE";' "$uri" "$pod" 'proxysql') + local cluster_name="$2" + local hostgroup=11 + + local ip=$(run_mysql_local 'SELECT hostname FROM runtime_mysql_servers WHERE hostgroup_id='$hostgroup' AND status="ONLINE";' "$uri" "$cluster_name-proxysql-0" 'proxysql') while [ $(echo "$ip" | wc -l) != 1 ]; do sleep 1 - ip=$(run_mysql_local 'SELECT hostname FROM runtime_mysql_servers WHERE hostgroup_id=11 AND status="ONLINE";' "$uri" "$pod" 'proxysql') + ip=$(run_mysql_local 'SELECT hostname FROM runtime_mysql_servers WHERE hostgroup_id='$hostgroup' AND status="ONLINE";' "$uri" "$cluster_name-proxysql-0" 'proxysql') done echo $ip | cut -d'.' -f1 diff --git a/e2e-tests/haproxy/compare/statefulset_haproxy-proxysql-oc.yml b/e2e-tests/haproxy/compare/statefulset_haproxy-proxysql-oc.yml index 375322130d..c03f5f0bac 100644 --- a/e2e-tests/haproxy/compare/statefulset_haproxy-proxysql-oc.yml +++ b/e2e-tests/haproxy/compare/statefulset_haproxy-proxysql-oc.yml @@ -62,6 +62,8 @@ spec: secretKeyRef: key: monitor name: internal-haproxy + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: haproxy-env-vars-proxysql @@ -117,6 +119,8 @@ spec: secretKeyRef: key: monitor name: internal-haproxy + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: haproxy-env-vars-proxysql @@ -150,6 +154,8 @@ spec: secretKeyRef: key: monitor name: internal-haproxy + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: haproxy-env-vars-proxysql diff --git a/e2e-tests/haproxy/compare/statefulset_haproxy-proxysql-secret-oc.yml b/e2e-tests/haproxy/compare/statefulset_haproxy-proxysql-secret-oc.yml index 177841a5a7..7163edc751 100644 --- a/e2e-tests/haproxy/compare/statefulset_haproxy-proxysql-secret-oc.yml +++ b/e2e-tests/haproxy/compare/statefulset_haproxy-proxysql-secret-oc.yml @@ -62,6 +62,8 @@ spec: secretKeyRef: key: monitor name: internal-haproxy + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: haproxy-env-vars-proxysql @@ -117,6 +119,8 @@ spec: secretKeyRef: key: monitor name: internal-haproxy + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: haproxy-env-vars-proxysql @@ -150,6 +154,8 @@ spec: secretKeyRef: key: monitor name: internal-haproxy + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: haproxy-env-vars-proxysql diff --git a/e2e-tests/haproxy/compare/statefulset_haproxy-proxysql-secret.yml b/e2e-tests/haproxy/compare/statefulset_haproxy-proxysql-secret.yml index f097270d71..f879abf135 100644 --- a/e2e-tests/haproxy/compare/statefulset_haproxy-proxysql-secret.yml +++ b/e2e-tests/haproxy/compare/statefulset_haproxy-proxysql-secret.yml @@ -62,6 +62,8 @@ spec: secretKeyRef: key: monitor name: internal-haproxy + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: haproxy-env-vars-proxysql @@ -117,6 +119,8 @@ spec: secretKeyRef: key: monitor name: internal-haproxy + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: haproxy-env-vars-proxysql @@ -150,6 +154,8 @@ spec: secretKeyRef: key: monitor name: internal-haproxy + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: haproxy-env-vars-proxysql diff --git a/e2e-tests/haproxy/compare/statefulset_haproxy-proxysql.yml b/e2e-tests/haproxy/compare/statefulset_haproxy-proxysql.yml index 403ab7e05b..89229accbf 100644 --- a/e2e-tests/haproxy/compare/statefulset_haproxy-proxysql.yml +++ b/e2e-tests/haproxy/compare/statefulset_haproxy-proxysql.yml @@ -62,6 +62,8 @@ spec: secretKeyRef: key: monitor name: internal-haproxy + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: haproxy-env-vars-proxysql @@ -117,6 +119,8 @@ spec: secretKeyRef: key: monitor name: internal-haproxy + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: haproxy-env-vars-proxysql @@ -150,6 +154,8 @@ spec: secretKeyRef: key: monitor name: internal-haproxy + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: haproxy-env-vars-proxysql diff --git a/e2e-tests/init-deploy/compare/statefulset_some-name-proxysql-oc.yml b/e2e-tests/init-deploy/compare/statefulset_some-name-proxysql-oc.yml index abb246871e..edfeee687e 100644 --- a/e2e-tests/init-deploy/compare/statefulset_some-name-proxysql-oc.yml +++ b/e2e-tests/init-deploy/compare/statefulset_some-name-proxysql-oc.yml @@ -62,6 +62,8 @@ spec: secretKeyRef: key: monitor name: internal-some-name + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: some-name-env-vars-proxysql @@ -115,6 +117,8 @@ spec: secretKeyRef: key: monitor name: internal-some-name + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: some-name-env-vars-proxysql @@ -148,6 +152,8 @@ spec: secretKeyRef: key: monitor name: internal-some-name + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: some-name-env-vars-proxysql diff --git a/e2e-tests/init-deploy/compare/statefulset_some-name-proxysql.yml b/e2e-tests/init-deploy/compare/statefulset_some-name-proxysql.yml index 3570d87677..84187fb6c4 100644 --- a/e2e-tests/init-deploy/compare/statefulset_some-name-proxysql.yml +++ b/e2e-tests/init-deploy/compare/statefulset_some-name-proxysql.yml @@ -62,6 +62,8 @@ spec: secretKeyRef: key: monitor name: internal-some-name + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: some-name-env-vars-proxysql @@ -115,6 +117,8 @@ spec: secretKeyRef: key: monitor name: internal-some-name + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: some-name-env-vars-proxysql @@ -148,6 +152,8 @@ spec: secretKeyRef: key: monitor name: internal-some-name + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: some-name-env-vars-proxysql diff --git a/e2e-tests/init-deploy/run b/e2e-tests/init-deploy/run index 43962c065b..5b9cdbe863 100755 --- a/e2e-tests/init-deploy/run +++ b/e2e-tests/init-deploy/run @@ -55,10 +55,10 @@ compare_mysql_cmd "select-2" "SELECT * from myApp.myApp;" "-h $cluster-pxc-1.$cl compare_mysql_cmd "select-2" "SELECT * from myApp.myApp;" "-h $cluster-pxc-2.$cluster-pxc -uroot -proot_password" desc 'kill Primary Pod, check reelection, check data' -initial_primary=$(get_proxy_primary "-h127.0.0.1 -P6032 -uproxyadmin -padmin_password" "$cluster-proxysql-0") +initial_primary=$(get_proxy_primary "-h127.0.0.1 -P6032 -uproxyadmin -padmin_password" "$cluster") kubectl_bin delete pods --grace-period=0 --force $initial_primary sleep 10 -changed_primary=$(get_proxy_primary "-h127.0.0.1 -P6032 -uproxyadmin -padmin_password" "$cluster-proxysql-0") +changed_primary=$(get_proxy_primary "-h127.0.0.1 -P6032 -uproxyadmin -padmin_password" "$cluster") [ -n "$changed_primary" ] && [ "$initial_primary" != "$changed_primary" ] run_mysql \ 'INSERT myApp.myApp (id) VALUES (100502)' \ diff --git a/e2e-tests/limits/compare/statefulset_no-limits-proxysql-increased-oc.yml b/e2e-tests/limits/compare/statefulset_no-limits-proxysql-increased-oc.yml index 79fe1f148b..08da9f0f8f 100644 --- a/e2e-tests/limits/compare/statefulset_no-limits-proxysql-increased-oc.yml +++ b/e2e-tests/limits/compare/statefulset_no-limits-proxysql-increased-oc.yml @@ -183,6 +183,8 @@ spec: secretKeyRef: key: monitor name: internal-no-limits + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-limits-env-vars-proxysql @@ -233,6 +235,8 @@ spec: secretKeyRef: key: monitor name: internal-no-limits + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-limits-env-vars-proxysql @@ -266,6 +270,8 @@ spec: secretKeyRef: key: monitor name: internal-no-limits + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-limits-env-vars-proxysql diff --git a/e2e-tests/limits/compare/statefulset_no-limits-proxysql-increased.yml b/e2e-tests/limits/compare/statefulset_no-limits-proxysql-increased.yml index 14e99c0cbd..da898728cd 100644 --- a/e2e-tests/limits/compare/statefulset_no-limits-proxysql-increased.yml +++ b/e2e-tests/limits/compare/statefulset_no-limits-proxysql-increased.yml @@ -183,6 +183,8 @@ spec: secretKeyRef: key: monitor name: internal-no-limits + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-limits-env-vars-proxysql @@ -233,6 +235,8 @@ spec: secretKeyRef: key: monitor name: internal-no-limits + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-limits-env-vars-proxysql @@ -266,6 +270,8 @@ spec: secretKeyRef: key: monitor name: internal-no-limits + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-limits-env-vars-proxysql diff --git a/e2e-tests/limits/compare/statefulset_no-limits-proxysql-oc.yml b/e2e-tests/limits/compare/statefulset_no-limits-proxysql-oc.yml index 3db90be9f2..ad605d9854 100644 --- a/e2e-tests/limits/compare/statefulset_no-limits-proxysql-oc.yml +++ b/e2e-tests/limits/compare/statefulset_no-limits-proxysql-oc.yml @@ -183,6 +183,8 @@ spec: secretKeyRef: key: monitor name: internal-no-limits + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-limits-env-vars-proxysql @@ -233,6 +235,8 @@ spec: secretKeyRef: key: monitor name: internal-no-limits + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-limits-env-vars-proxysql @@ -266,6 +270,8 @@ spec: secretKeyRef: key: monitor name: internal-no-limits + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-limits-env-vars-proxysql diff --git a/e2e-tests/limits/compare/statefulset_no-limits-proxysql.yml b/e2e-tests/limits/compare/statefulset_no-limits-proxysql.yml index a59107eafc..b3fb7a3ef5 100644 --- a/e2e-tests/limits/compare/statefulset_no-limits-proxysql.yml +++ b/e2e-tests/limits/compare/statefulset_no-limits-proxysql.yml @@ -183,6 +183,8 @@ spec: secretKeyRef: key: monitor name: internal-no-limits + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-limits-env-vars-proxysql @@ -233,6 +235,8 @@ spec: secretKeyRef: key: monitor name: internal-no-limits + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-limits-env-vars-proxysql @@ -266,6 +270,8 @@ spec: secretKeyRef: key: monitor name: internal-no-limits + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-limits-env-vars-proxysql diff --git a/e2e-tests/limits/compare/statefulset_no-requests-no-limits-proxysql-increased-oc.yml b/e2e-tests/limits/compare/statefulset_no-requests-no-limits-proxysql-increased-oc.yml index 9460b0730e..5b067c1682 100644 --- a/e2e-tests/limits/compare/statefulset_no-requests-no-limits-proxysql-increased-oc.yml +++ b/e2e-tests/limits/compare/statefulset_no-requests-no-limits-proxysql-increased-oc.yml @@ -51,6 +51,8 @@ spec: secretKeyRef: key: monitor name: internal-no-requests-no-limits + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-requests-no-limits-env-vars-proxysql @@ -98,6 +100,8 @@ spec: secretKeyRef: key: monitor name: internal-no-requests-no-limits + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-requests-no-limits-env-vars-proxysql @@ -131,6 +135,8 @@ spec: secretKeyRef: key: monitor name: internal-no-requests-no-limits + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-requests-no-limits-env-vars-proxysql diff --git a/e2e-tests/limits/compare/statefulset_no-requests-no-limits-proxysql-increased.yml b/e2e-tests/limits/compare/statefulset_no-requests-no-limits-proxysql-increased.yml index aba49a6e56..cf654ed294 100644 --- a/e2e-tests/limits/compare/statefulset_no-requests-no-limits-proxysql-increased.yml +++ b/e2e-tests/limits/compare/statefulset_no-requests-no-limits-proxysql-increased.yml @@ -51,6 +51,8 @@ spec: secretKeyRef: key: monitor name: internal-no-requests-no-limits + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-requests-no-limits-env-vars-proxysql @@ -98,6 +100,8 @@ spec: secretKeyRef: key: monitor name: internal-no-requests-no-limits + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-requests-no-limits-env-vars-proxysql @@ -131,6 +135,8 @@ spec: secretKeyRef: key: monitor name: internal-no-requests-no-limits + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-requests-no-limits-env-vars-proxysql diff --git a/e2e-tests/limits/compare/statefulset_no-requests-no-limits-proxysql-oc.yml b/e2e-tests/limits/compare/statefulset_no-requests-no-limits-proxysql-oc.yml index 9460b0730e..5b067c1682 100644 --- a/e2e-tests/limits/compare/statefulset_no-requests-no-limits-proxysql-oc.yml +++ b/e2e-tests/limits/compare/statefulset_no-requests-no-limits-proxysql-oc.yml @@ -51,6 +51,8 @@ spec: secretKeyRef: key: monitor name: internal-no-requests-no-limits + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-requests-no-limits-env-vars-proxysql @@ -98,6 +100,8 @@ spec: secretKeyRef: key: monitor name: internal-no-requests-no-limits + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-requests-no-limits-env-vars-proxysql @@ -131,6 +135,8 @@ spec: secretKeyRef: key: monitor name: internal-no-requests-no-limits + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-requests-no-limits-env-vars-proxysql diff --git a/e2e-tests/limits/compare/statefulset_no-requests-no-limits-proxysql.yml b/e2e-tests/limits/compare/statefulset_no-requests-no-limits-proxysql.yml index aba49a6e56..cf654ed294 100644 --- a/e2e-tests/limits/compare/statefulset_no-requests-no-limits-proxysql.yml +++ b/e2e-tests/limits/compare/statefulset_no-requests-no-limits-proxysql.yml @@ -51,6 +51,8 @@ spec: secretKeyRef: key: monitor name: internal-no-requests-no-limits + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-requests-no-limits-env-vars-proxysql @@ -98,6 +100,8 @@ spec: secretKeyRef: key: monitor name: internal-no-requests-no-limits + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-requests-no-limits-env-vars-proxysql @@ -131,6 +135,8 @@ spec: secretKeyRef: key: monitor name: internal-no-requests-no-limits + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-requests-no-limits-env-vars-proxysql diff --git a/e2e-tests/limits/compare/statefulset_no-requests-proxysql-increased-oc.yml b/e2e-tests/limits/compare/statefulset_no-requests-proxysql-increased-oc.yml index 79f8da6cc3..21c47dd3be 100644 --- a/e2e-tests/limits/compare/statefulset_no-requests-proxysql-increased-oc.yml +++ b/e2e-tests/limits/compare/statefulset_no-requests-proxysql-increased-oc.yml @@ -51,6 +51,8 @@ spec: secretKeyRef: key: monitor name: internal-no-requests + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-requests-env-vars-proxysql @@ -101,6 +103,8 @@ spec: secretKeyRef: key: monitor name: internal-no-requests + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-requests-env-vars-proxysql @@ -134,6 +138,8 @@ spec: secretKeyRef: key: monitor name: internal-no-requests + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-requests-env-vars-proxysql diff --git a/e2e-tests/limits/compare/statefulset_no-requests-proxysql-increased.yml b/e2e-tests/limits/compare/statefulset_no-requests-proxysql-increased.yml index 8f21f0c992..8b6677ac29 100644 --- a/e2e-tests/limits/compare/statefulset_no-requests-proxysql-increased.yml +++ b/e2e-tests/limits/compare/statefulset_no-requests-proxysql-increased.yml @@ -51,6 +51,8 @@ spec: secretKeyRef: key: monitor name: internal-no-requests + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-requests-env-vars-proxysql @@ -101,6 +103,8 @@ spec: secretKeyRef: key: monitor name: internal-no-requests + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-requests-env-vars-proxysql @@ -134,6 +138,8 @@ spec: secretKeyRef: key: monitor name: internal-no-requests + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-requests-env-vars-proxysql diff --git a/e2e-tests/limits/compare/statefulset_no-requests-proxysql-oc.yml b/e2e-tests/limits/compare/statefulset_no-requests-proxysql-oc.yml index 82299423ac..f701e9ff47 100644 --- a/e2e-tests/limits/compare/statefulset_no-requests-proxysql-oc.yml +++ b/e2e-tests/limits/compare/statefulset_no-requests-proxysql-oc.yml @@ -51,6 +51,8 @@ spec: secretKeyRef: key: monitor name: internal-no-requests + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-requests-env-vars-proxysql @@ -101,6 +103,8 @@ spec: secretKeyRef: key: monitor name: internal-no-requests + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-requests-env-vars-proxysql @@ -134,6 +138,8 @@ spec: secretKeyRef: key: monitor name: internal-no-requests + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-requests-env-vars-proxysql diff --git a/e2e-tests/limits/compare/statefulset_no-requests-proxysql.yml b/e2e-tests/limits/compare/statefulset_no-requests-proxysql.yml index f9f363fe7b..a10dfd0e20 100644 --- a/e2e-tests/limits/compare/statefulset_no-requests-proxysql.yml +++ b/e2e-tests/limits/compare/statefulset_no-requests-proxysql.yml @@ -51,6 +51,8 @@ spec: secretKeyRef: key: monitor name: internal-no-requests + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-requests-env-vars-proxysql @@ -101,6 +103,8 @@ spec: secretKeyRef: key: monitor name: internal-no-requests + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-requests-env-vars-proxysql @@ -134,6 +138,8 @@ spec: secretKeyRef: key: monitor name: internal-no-requests + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: no-requests-env-vars-proxysql diff --git a/e2e-tests/proxysql-sidecar-res-limits/compare/statefulset_side-car-proxysql-oc.yml b/e2e-tests/proxysql-sidecar-res-limits/compare/statefulset_side-car-proxysql-oc.yml index 7695d49f55..ad8b016ac7 100644 --- a/e2e-tests/proxysql-sidecar-res-limits/compare/statefulset_side-car-proxysql-oc.yml +++ b/e2e-tests/proxysql-sidecar-res-limits/compare/statefulset_side-car-proxysql-oc.yml @@ -51,6 +51,8 @@ spec: secretKeyRef: key: monitor name: internal-side-car + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: side-car-env-vars-proxysql @@ -101,6 +103,8 @@ spec: secretKeyRef: key: monitor name: internal-side-car + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: side-car-env-vars-proxysql @@ -140,6 +144,8 @@ spec: secretKeyRef: key: monitor name: internal-side-car + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: side-car-env-vars-proxysql diff --git a/e2e-tests/proxysql-sidecar-res-limits/compare/statefulset_side-car-proxysql.yml b/e2e-tests/proxysql-sidecar-res-limits/compare/statefulset_side-car-proxysql.yml index e6cd7ffc54..52eaeb40d9 100644 --- a/e2e-tests/proxysql-sidecar-res-limits/compare/statefulset_side-car-proxysql.yml +++ b/e2e-tests/proxysql-sidecar-res-limits/compare/statefulset_side-car-proxysql.yml @@ -51,6 +51,8 @@ spec: secretKeyRef: key: monitor name: internal-side-car + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: side-car-env-vars-proxysql @@ -101,6 +103,8 @@ spec: secretKeyRef: key: monitor name: internal-side-car + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: side-car-env-vars-proxysql @@ -140,6 +144,8 @@ spec: secretKeyRef: key: monitor name: internal-side-car + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: side-car-env-vars-proxysql diff --git a/e2e-tests/security-context/compare/statefulset_sec-context-proxysql-changes-4-oc.yml b/e2e-tests/security-context/compare/statefulset_sec-context-proxysql-changes-4-oc.yml index b624081667..d1435bfbc7 100644 --- a/e2e-tests/security-context/compare/statefulset_sec-context-proxysql-changes-4-oc.yml +++ b/e2e-tests/security-context/compare/statefulset_sec-context-proxysql-changes-4-oc.yml @@ -51,6 +51,8 @@ spec: secretKeyRef: key: monitor name: internal-sec-context + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: sec-context-env-vars-proxysql @@ -103,6 +105,8 @@ spec: secretKeyRef: key: monitor name: internal-sec-context + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: sec-context-env-vars-proxysql @@ -136,6 +140,8 @@ spec: secretKeyRef: key: monitor name: internal-sec-context + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: sec-context-env-vars-proxysql diff --git a/e2e-tests/security-context/compare/statefulset_sec-context-proxysql-changes-oc.yml b/e2e-tests/security-context/compare/statefulset_sec-context-proxysql-changes-oc.yml index fac71f5452..fb6a6a8139 100644 --- a/e2e-tests/security-context/compare/statefulset_sec-context-proxysql-changes-oc.yml +++ b/e2e-tests/security-context/compare/statefulset_sec-context-proxysql-changes-oc.yml @@ -51,6 +51,8 @@ spec: secretKeyRef: key: monitor name: internal-sec-context + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: sec-context-env-vars-proxysql @@ -103,6 +105,8 @@ spec: secretKeyRef: key: monitor name: internal-sec-context + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: sec-context-env-vars-proxysql @@ -136,6 +140,8 @@ spec: secretKeyRef: key: monitor name: internal-sec-context + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: sec-context-env-vars-proxysql diff --git a/e2e-tests/security-context/compare/statefulset_sec-context-proxysql-changes.yml b/e2e-tests/security-context/compare/statefulset_sec-context-proxysql-changes.yml index b624081667..d1435bfbc7 100644 --- a/e2e-tests/security-context/compare/statefulset_sec-context-proxysql-changes.yml +++ b/e2e-tests/security-context/compare/statefulset_sec-context-proxysql-changes.yml @@ -51,6 +51,8 @@ spec: secretKeyRef: key: monitor name: internal-sec-context + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: sec-context-env-vars-proxysql @@ -103,6 +105,8 @@ spec: secretKeyRef: key: monitor name: internal-sec-context + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: sec-context-env-vars-proxysql @@ -136,6 +140,8 @@ spec: secretKeyRef: key: monitor name: internal-sec-context + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: sec-context-env-vars-proxysql diff --git a/e2e-tests/security-context/compare/statefulset_sec-context-proxysql.yml b/e2e-tests/security-context/compare/statefulset_sec-context-proxysql.yml index 33bc9b66d1..48e624c157 100644 --- a/e2e-tests/security-context/compare/statefulset_sec-context-proxysql.yml +++ b/e2e-tests/security-context/compare/statefulset_sec-context-proxysql.yml @@ -51,6 +51,8 @@ spec: secretKeyRef: key: monitor name: internal-sec-context + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: sec-context-env-vars-proxysql @@ -103,6 +105,8 @@ spec: secretKeyRef: key: monitor name: internal-sec-context + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: sec-context-env-vars-proxysql @@ -136,6 +140,8 @@ spec: secretKeyRef: key: monitor name: internal-sec-context + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: sec-context-env-vars-proxysql diff --git a/e2e-tests/smart-update1/run b/e2e-tests/smart-update1/run index 435bbec1cf..3f3d481300 100755 --- a/e2e-tests/smart-update1/run +++ b/e2e-tests/smart-update1/run @@ -89,7 +89,7 @@ function main() { yq -i eval ".spec.initImage = \"${IMAGE}\"" "${tmp_dir}/${CLUSTER}.yml" spinup_pxc "${CLUSTER}" "${tmp_dir}/${CLUSTER}.yml" - initial_primary=$(get_proxy_primary "-h127.0.0.1 -P6032 -uproxyadmin -padmin_password" "$(get_proxy ${CLUSTER})-0") + initial_primary=$(get_proxy_primary "-h127.0.0.1 -P6032 -uproxyadmin -padmin_password" "${CLUSTER}") kubectl_bin patch pxc/"${CLUSTER}" --type=merge -p '{"spec":{"pxc":{"image":"'"${TARGET_IMAGE_PXC}"'"}}}' sleep 7 # wait for two reconcile loops ;) 3 sec x 2 times + 1 sec = 7 seconds diff --git a/e2e-tests/storage/compare/statefulset_emptydir-proxysql-oc.yml b/e2e-tests/storage/compare/statefulset_emptydir-proxysql-oc.yml index 0d047f87b3..d0c60a6248 100644 --- a/e2e-tests/storage/compare/statefulset_emptydir-proxysql-oc.yml +++ b/e2e-tests/storage/compare/statefulset_emptydir-proxysql-oc.yml @@ -62,6 +62,8 @@ spec: secretKeyRef: key: monitor name: internal-emptydir + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: emptydir-env-vars-proxysql @@ -111,6 +113,8 @@ spec: secretKeyRef: key: monitor name: internal-emptydir + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: emptydir-env-vars-proxysql @@ -144,6 +148,8 @@ spec: secretKeyRef: key: monitor name: internal-emptydir + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: emptydir-env-vars-proxysql diff --git a/e2e-tests/storage/compare/statefulset_emptydir-proxysql.yml b/e2e-tests/storage/compare/statefulset_emptydir-proxysql.yml index 0deeadd1ec..a3d832f3f6 100644 --- a/e2e-tests/storage/compare/statefulset_emptydir-proxysql.yml +++ b/e2e-tests/storage/compare/statefulset_emptydir-proxysql.yml @@ -62,6 +62,8 @@ spec: secretKeyRef: key: monitor name: internal-emptydir + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: emptydir-env-vars-proxysql @@ -111,6 +113,8 @@ spec: secretKeyRef: key: monitor name: internal-emptydir + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: emptydir-env-vars-proxysql @@ -144,6 +148,8 @@ spec: secretKeyRef: key: monitor name: internal-emptydir + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: emptydir-env-vars-proxysql diff --git a/e2e-tests/storage/compare/statefulset_hostpath-proxysql-oc.yml b/e2e-tests/storage/compare/statefulset_hostpath-proxysql-oc.yml index 258c4e430e..fbf2cb7afa 100644 --- a/e2e-tests/storage/compare/statefulset_hostpath-proxysql-oc.yml +++ b/e2e-tests/storage/compare/statefulset_hostpath-proxysql-oc.yml @@ -62,6 +62,8 @@ spec: secretKeyRef: key: monitor name: internal-hostpath + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: hostpath-env-vars-proxysql @@ -109,6 +111,8 @@ spec: secretKeyRef: key: monitor name: internal-hostpath + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: hostpath-env-vars-proxysql @@ -142,6 +146,8 @@ spec: secretKeyRef: key: monitor name: internal-hostpath + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: hostpath-env-vars-proxysql diff --git a/e2e-tests/storage/compare/statefulset_hostpath-proxysql.yml b/e2e-tests/storage/compare/statefulset_hostpath-proxysql.yml index b15c439df0..ea0b20eeb9 100644 --- a/e2e-tests/storage/compare/statefulset_hostpath-proxysql.yml +++ b/e2e-tests/storage/compare/statefulset_hostpath-proxysql.yml @@ -62,6 +62,8 @@ spec: secretKeyRef: key: monitor name: internal-hostpath + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: hostpath-env-vars-proxysql @@ -109,6 +111,8 @@ spec: secretKeyRef: key: monitor name: internal-hostpath + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: hostpath-env-vars-proxysql @@ -142,6 +146,8 @@ spec: secretKeyRef: key: monitor name: internal-hostpath + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: hostpath-env-vars-proxysql diff --git a/e2e-tests/upgrade-consistency/compare/statefulset_some-name-proxysql-1120-oc.yml b/e2e-tests/upgrade-consistency/compare/statefulset_some-name-proxysql-1120-oc.yml index abb246871e..edfeee687e 100644 --- a/e2e-tests/upgrade-consistency/compare/statefulset_some-name-proxysql-1120-oc.yml +++ b/e2e-tests/upgrade-consistency/compare/statefulset_some-name-proxysql-1120-oc.yml @@ -62,6 +62,8 @@ spec: secretKeyRef: key: monitor name: internal-some-name + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: some-name-env-vars-proxysql @@ -115,6 +117,8 @@ spec: secretKeyRef: key: monitor name: internal-some-name + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: some-name-env-vars-proxysql @@ -148,6 +152,8 @@ spec: secretKeyRef: key: monitor name: internal-some-name + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: some-name-env-vars-proxysql diff --git a/e2e-tests/upgrade-consistency/compare/statefulset_some-name-proxysql-1120.yml b/e2e-tests/upgrade-consistency/compare/statefulset_some-name-proxysql-1120.yml index 3570d87677..e5f224f6e7 100644 --- a/e2e-tests/upgrade-consistency/compare/statefulset_some-name-proxysql-1120.yml +++ b/e2e-tests/upgrade-consistency/compare/statefulset_some-name-proxysql-1120.yml @@ -2,7 +2,7 @@ apiVersion: apps/v1 kind: StatefulSet metadata: annotations: {} - generation: 1 + generation: 2 name: some-name-proxysql ownerReferences: - controller: true @@ -62,6 +62,8 @@ spec: secretKeyRef: key: monitor name: internal-some-name + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: some-name-env-vars-proxysql @@ -115,6 +117,8 @@ spec: secretKeyRef: key: monitor name: internal-some-name + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: some-name-env-vars-proxysql @@ -148,6 +152,8 @@ spec: secretKeyRef: key: monitor name: internal-some-name + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: some-name-env-vars-proxysql diff --git a/e2e-tests/upgrade-proxysql/compare/statefulset_upgrade-proxysql-proxysql-oc.yml b/e2e-tests/upgrade-proxysql/compare/statefulset_upgrade-proxysql-proxysql-oc.yml index 211c8d2f34..ad8a27a345 100644 --- a/e2e-tests/upgrade-proxysql/compare/statefulset_upgrade-proxysql-proxysql-oc.yml +++ b/e2e-tests/upgrade-proxysql/compare/statefulset_upgrade-proxysql-proxysql-oc.yml @@ -62,6 +62,8 @@ spec: secretKeyRef: key: monitor name: internal-upgrade-proxysql + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: upgrade-proxysql-env-vars-proxysql @@ -112,6 +114,8 @@ spec: secretKeyRef: key: monitor name: internal-upgrade-proxysql + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: upgrade-proxysql-env-vars-proxysql @@ -145,6 +149,8 @@ spec: secretKeyRef: key: monitor name: internal-upgrade-proxysql + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: upgrade-proxysql-env-vars-proxysql diff --git a/e2e-tests/upgrade-proxysql/compare/statefulset_upgrade-proxysql-proxysql.yml b/e2e-tests/upgrade-proxysql/compare/statefulset_upgrade-proxysql-proxysql.yml index 0c05b2d209..1d76ebc2c2 100644 --- a/e2e-tests/upgrade-proxysql/compare/statefulset_upgrade-proxysql-proxysql.yml +++ b/e2e-tests/upgrade-proxysql/compare/statefulset_upgrade-proxysql-proxysql.yml @@ -62,6 +62,8 @@ spec: secretKeyRef: key: monitor name: internal-upgrade-proxysql + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: upgrade-proxysql-env-vars-proxysql @@ -112,6 +114,8 @@ spec: secretKeyRef: key: monitor name: internal-upgrade-proxysql + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: upgrade-proxysql-env-vars-proxysql @@ -145,6 +149,8 @@ spec: secretKeyRef: key: monitor name: internal-upgrade-proxysql + - name: PXC_HANDLER + value: internal envFrom: - secretRef: name: upgrade-proxysql-env-vars-proxysql diff --git a/pkg/apis/pxc/v1/pxc_types.go b/pkg/apis/pxc/v1/pxc_types.go index 5171ee38e5..05e862f0f9 100644 --- a/pkg/apis/pxc/v1/pxc_types.go +++ b/pkg/apis/pxc/v1/pxc_types.go @@ -34,7 +34,7 @@ type PerconaXtraDBClusterSpec struct { LogCollectorSecretName string `json:"logCollectorSecretName,omitempty"` TLS *TLSSpec `json:"tls,omitempty"` PXC *PXCSpec `json:"pxc,omitempty"` - ProxySQL *PodSpec `json:"proxysql,omitempty"` + ProxySQL *ProxySQLSpec `json:"proxysql,omitempty"` HAProxy *HAProxySpec `json:"haproxy,omitempty"` PMM *PMMSpec `json:"pmm,omitempty"` LogCollector *LogCollectorSpec `json:"logcollector,omitempty"` @@ -435,6 +435,12 @@ type HAProxySpec struct { ReplicasLoadBalancerIP string `json:"replicasLoadBalancerIP,omitempty"` } +type ProxySQLSpec struct { + PodSpec `json:",inline"` + // +kubebuilder:validation:Enum={internal,scheduler} + PXCHandler string `json:"pxchandler,omitempty"` +} + type PodDisruptionBudgetSpec struct { MinAvailable *intstr.IntOrString `json:"minAvailable,omitempty"` MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"` @@ -800,6 +806,10 @@ func (cr *PerconaXtraDBCluster) CheckNSetDefaults(serverVersion *version.ServerV c.ProxySQL.ImagePullPolicy = corev1.PullAlways } + if cr.CompareVersionWith("1.12.0") >= 0 && len(c.ProxySQL.PXCHandler) == 0 { + c.ProxySQL.PXCHandler = "internal" + } + c.ProxySQL.VolumeSpec.reconcileOpts() if len(c.SSLSecretName) > 0 { diff --git a/pkg/apis/pxc/v1/zz_generated.deepcopy.go b/pkg/apis/pxc/v1/zz_generated.deepcopy.go index fed43106c0..98f7bca568 100644 --- a/pkg/apis/pxc/v1/zz_generated.deepcopy.go +++ b/pkg/apis/pxc/v1/zz_generated.deepcopy.go @@ -684,7 +684,7 @@ func (in *PerconaXtraDBClusterSpec) DeepCopyInto(out *PerconaXtraDBClusterSpec) } if in.ProxySQL != nil { in, out := &in.ProxySQL, &out.ProxySQL - *out = new(PodSpec) + *out = new(ProxySQLSpec) (*in).DeepCopyInto(*out) } if in.HAProxy != nil { @@ -974,6 +974,22 @@ func (in *PodSpec) DeepCopy() *PodSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProxySQLSpec) DeepCopyInto(out *ProxySQLSpec) { + *out = *in + in.PodSpec.DeepCopyInto(&out.PodSpec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProxySQLSpec. +func (in *ProxySQLSpec) DeepCopy() *ProxySQLSpec { + if in == nil { + return nil + } + out := new(ProxySQLSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ReplicationChannel) DeepCopyInto(out *ReplicationChannel) { *out = *in diff --git a/pkg/controller/pxc/controller.go b/pkg/controller/pxc/controller.go index 49d328b414..9c8946b19b 100644 --- a/pkg/controller/pxc/controller.go +++ b/pkg/controller/pxc/controller.go @@ -380,7 +380,7 @@ func (r *ReconcilePerconaXtraDBCluster) Reconcile(ctx context.Context, request r pxc.MergeTemplateAnnotations(proxysqlSet.StatefulSet(), userReconcileResult.proxysqlAnnotations) if o.Spec.ProxySQL != nil && o.Spec.ProxySQL.Enabled { - err = r.updatePod(proxysqlSet, o.Spec.ProxySQL, o, nil) + err = r.updatePod(proxysqlSet, &o.Spec.ProxySQL.PodSpec, o, nil) if err != nil { return reconcile.Result{}, errors.Wrap(err, "ProxySQL upgrade error") } @@ -693,7 +693,7 @@ func (r *ReconcilePerconaXtraDBCluster) deploy(cr *api.PerconaXtraDBCluster) err if cr.Spec.ProxySQL != nil && cr.Spec.ProxySQL.Enabled { sfsProxy := statefulset.NewProxy(cr) - proxySet, err := pxc.StatefulSet(sfsProxy, cr.Spec.ProxySQL, cr, secrets, nil, logger, r.getConfigVolume) + proxySet, err := pxc.StatefulSet(sfsProxy, &cr.Spec.ProxySQL.PodSpec, cr, secrets, nil, logger, r.getConfigVolume) if err != nil { return errors.Wrap(err, "create ProxySQL Service") } diff --git a/pkg/controller/pxc/status.go b/pkg/controller/pxc/status.go index d49fb311b1..9a96578173 100644 --- a/pkg/controller/pxc/status.go +++ b/pkg/controller/pxc/status.go @@ -83,7 +83,7 @@ func (r *ReconcilePerconaXtraDBCluster) updateStatus(cr *api.PerconaXtraDBCluste apps = append(apps, sfsstatus{ app: statefulset.NewProxy(cr), status: &cr.Status.ProxySQL, - spec: cr.Spec.ProxySQL, + spec: &cr.Spec.ProxySQL.PodSpec, }) } diff --git a/pkg/controller/pxc/status_test.go b/pkg/controller/pxc/status_test.go index 89272f4d5f..e4a8a39714 100644 --- a/pkg/controller/pxc/status_test.go +++ b/pkg/controller/pxc/status_test.go @@ -49,8 +49,10 @@ func newCR(name, namespace string) *api.PerconaXtraDBCluster { Size: 3, }, }, - ProxySQL: &api.PodSpec{ - Enabled: false, + ProxySQL: &api.ProxySQLSpec{ + PodSpec: api.PodSpec{ + Enabled: false, + }, }, }, Status: api.PerconaXtraDBClusterStatus{}, diff --git a/pkg/controller/pxc/upgrade.go b/pkg/controller/pxc/upgrade.go index 36ecc755cd..c52f600b26 100644 --- a/pkg/controller/pxc/upgrade.go +++ b/pkg/controller/pxc/upgrade.go @@ -354,8 +354,10 @@ func (r *ReconcilePerconaXtraDBCluster) applyNWait(cr *api.PerconaXtraDBCluster, return errors.Wrap(err, "failed to wait pxc sync") } - if err := r.waitHostgroups(cr, sfs.Name, pod, waitLimit, logger); err != nil { - return errors.Wrap(err, "failed to wait hostgroups status") + if cr.Spec.ProxySQL.PXCHandler == "internal" { + if err := r.waitHostgroups(cr, sfs.Name, pod, waitLimit, logger); err != nil { + return errors.Wrap(err, "failed to wait hostgroups status") + } } if err := r.waitUntilOnline(cr, sfs.Name, pod, waitLimit, logger); err != nil { diff --git a/pkg/controller/pxc/users.go b/pkg/controller/pxc/users.go index 1c29c35d28..7c1c6571d9 100644 --- a/pkg/controller/pxc/users.go +++ b/pkg/controller/pxc/users.go @@ -964,7 +964,11 @@ func (r *ReconcilePerconaXtraDBCluster) syncPXCUsersWithProxySQL(cr *api.Percona return errors.Wrap(err, "get proxysql pod") } var errb, outb bytes.Buffer - err = r.clientcmd.Exec(&pod, "proxysql", []string{"proxysql-admin", "--syncusers", "--add-query-rule"}, nil, &outb, &errb, false) + if cr.Spec.ProxySQL.PXCHandler == "scheduler" { + err = r.clientcmd.Exec(&pod, "proxysql", []string{"percona-scheduler-admin", "--config-file=/etc/config.toml", "--syncusers", "--add-query-rule"}, nil, &outb, &errb, false) + } else { + err = r.clientcmd.Exec(&pod, "proxysql", []string{"proxysql-admin", "--syncusers", "--add-query-rule"}, nil, &outb, &errb, false) + } if err != nil { return errors.Errorf("exec syncusers: %v / %s / %s", err, outb.String(), errb.String()) } diff --git a/pkg/pxc/app/statefulset/proxysql.go b/pkg/pxc/app/statefulset/proxysql.go index d473bb0fad..dc32319bda 100644 --- a/pkg/pxc/app/statefulset/proxysql.go +++ b/pkg/pxc/app/statefulset/proxysql.go @@ -145,6 +145,13 @@ func (c *Proxy) AppContainer(spec *api.PodSpec, secrets string, cr *api.PerconaX } } + if cr.CompareVersionWith("1.12.0") >= 0 { + appc.Env = append(appc.Env, corev1.EnvVar{ + Name: "PXC_HANDLER", + Value: cr.Spec.ProxySQL.PXCHandler, + }) + } + if cr.CompareVersionWith("1.11.0") >= 0 && cr.Spec.ProxySQL != nil && cr.Spec.ProxySQL.HookScript != "" { appc.VolumeMounts = append(appc.VolumeMounts, corev1.VolumeMount{ Name: "hookscript", @@ -234,6 +241,30 @@ func (c *Proxy) SidecarContainers(spec *api.PodSpec, secrets string, cr *api.Per }, }, } + + if cr.CompareVersionWith("1.12.0") >= 0 { + pxcMonit.Env = append(pxcMonit.Env, corev1.EnvVar{ + Name: "PXC_HANDLER", + Value: cr.Spec.ProxySQL.PXCHandler, + }) + proxysqlMonit.Env = append(proxysqlMonit.Env, corev1.EnvVar{ + Name: "PXC_HANDLER", + Value: cr.Spec.ProxySQL.PXCHandler, + }) + if cr.Spec.ProxySQL.PXCHandler == "scheduler" { + volMounts := []corev1.VolumeMount{ + { + Name: "ssl", + MountPath: "/etc/proxysql/ssl", + }, + { + Name: "ssl-internal", + MountPath: "/etc/proxysql/ssl-internal", + }, + } + pxcMonit.VolumeMounts = volMounts + } + } if cr.Spec.AllowUnsafeConfig && (cr.Spec.TLS == nil || cr.Spec.TLS.IssuerConf == nil) { pxcMonit.Env = append(pxcMonit.Env, corev1.EnvVar{ Name: "SSL_DIR",