From 697e8a624b07eef5f57d8054aa5e27bdb7493f41 Mon Sep 17 00:00:00 2001 From: Tomislav Plavcic Date: Tue, 6 Feb 2024 09:32:38 +0100 Subject: [PATCH 1/4] K8SPXC-99 - Small improvements in TLS tests (#1616) * K8SPXC-99 - Small improvements in TLS tests * Fix shfmt * Fix wait_cluster_consistency in tls-issue-self test --- .../conf/some-name-tls-issueref.yml | 2 +- e2e-tests/tls-issue-cert-manager-ref/run | 1 + .../conf/some-name-tls-issue-haproxy.yml | 2 +- .../conf/some-name-tls-issue.yml | 2 +- e2e-tests/tls-issue-cert-manager/run | 2 + e2e-tests/tls-issue-self/run | 37 ++++++++++--------- 6 files changed, 25 insertions(+), 21 deletions(-) diff --git a/e2e-tests/tls-issue-cert-manager-ref/conf/some-name-tls-issueref.yml b/e2e-tests/tls-issue-cert-manager-ref/conf/some-name-tls-issueref.yml index fed6cf6d56..2ec01b2d2f 100644 --- a/e2e-tests/tls-issue-cert-manager-ref/conf/some-name-tls-issueref.yml +++ b/e2e-tests/tls-issue-cert-manager-ref/conf/some-name-tls-issueref.yml @@ -33,7 +33,7 @@ spec: antiAffinityTopologyKey: "kubernetes.io/hostname" proxysql: enabled: true - size: 1 + size: 2 image: -proxysql resources: requests: diff --git a/e2e-tests/tls-issue-cert-manager-ref/run b/e2e-tests/tls-issue-cert-manager-ref/run index e9df86eb06..ae6744d652 100755 --- a/e2e-tests/tls-issue-cert-manager-ref/run +++ b/e2e-tests/tls-issue-cert-manager-ref/run @@ -21,6 +21,7 @@ main() { desc 'create pxc cluster' spinup_pxc "$cluster" "$test_dir/conf/$cluster.yml" 3 10 "$conf_dir/secrets_without_tls.yml" "$test_dir/conf/client.yml" + wait_cluster_consistency "$cluster" 3 2 desc 'check if certificates issued with certmanager' tlsSecretsShouldExist "$cluster-ssl" diff --git a/e2e-tests/tls-issue-cert-manager/conf/some-name-tls-issue-haproxy.yml b/e2e-tests/tls-issue-cert-manager/conf/some-name-tls-issue-haproxy.yml index 8bce104995..e40a1c6b15 100644 --- a/e2e-tests/tls-issue-cert-manager/conf/some-name-tls-issue-haproxy.yml +++ b/e2e-tests/tls-issue-cert-manager/conf/some-name-tls-issue-haproxy.yml @@ -48,7 +48,7 @@ spec: storage: 2Gi haproxy: enabled: true - size: 1 + size: 2 image: -haproxy resources: requests: diff --git a/e2e-tests/tls-issue-cert-manager/conf/some-name-tls-issue.yml b/e2e-tests/tls-issue-cert-manager/conf/some-name-tls-issue.yml index 3f639c1135..0c1dbb7213 100644 --- a/e2e-tests/tls-issue-cert-manager/conf/some-name-tls-issue.yml +++ b/e2e-tests/tls-issue-cert-manager/conf/some-name-tls-issue.yml @@ -30,7 +30,7 @@ spec: antiAffinityTopologyKey: "kubernetes.io/hostname" proxysql: enabled: true - size: 1 + size: 2 image: -proxysql resources: requests: diff --git a/e2e-tests/tls-issue-cert-manager/run b/e2e-tests/tls-issue-cert-manager/run index dbe0cc6ba0..d21c4591c4 100755 --- a/e2e-tests/tls-issue-cert-manager/run +++ b/e2e-tests/tls-issue-cert-manager/run @@ -26,6 +26,7 @@ main() { desc 'create pxc cluster' spinup_pxc "$cluster" "$test_dir/conf/$cluster.yml" 3 10 "$conf_dir/secrets_without_tls.yml" "$test_dir/conf/client.yml" + wait_cluster_consistency "$cluster" 3 2 desc 'check if certificates issued with certmanager' tlsSecretsShouldExist "$cluster-ssl" @@ -41,6 +42,7 @@ main() { apply_config "$test_dir/conf/$cluster-haproxy.yml" wait_for_running "$cluster-haproxy" 1 + wait_cluster_consistency "$cluster" 3 2 desc 'check ssl-internal certificate using PXC' check_verify_identity "$cluster-pxc" diff --git a/e2e-tests/tls-issue-self/run b/e2e-tests/tls-issue-self/run index 4a35504202..af72619873 100755 --- a/e2e-tests/tls-issue-self/run +++ b/e2e-tests/tls-issue-self/run @@ -8,24 +8,25 @@ test_dir=$(realpath $(dirname $0)) set_debug main() { - create_infra $namespace - kubectl_bin delete -f https://github.com/jetstack/cert-manager/releases/download/v1.5.4/cert-manager.yaml 2>/dev/null || : - sleep 10 - - desc 'create PXC cluster without cert manager' - cluster="some-name" - spinup_pxc "$cluster" "$conf_dir/$cluster.yml" 3 10 "$conf_dir/secrets_without_tls.yml" - - desc 'check if certificate issued manually' - tlsSecretsShouldExist "$cluster-ssl" - - local ownerName=$(kubectl_bin get secrets/$cluster-ssl -o json | jq '.metadata.ownerReferences[0].name') - if [ $ownerName != '"'$cluster'"' ]; then - desc 'invalid owner of secret' - exit 1 - fi - destroy $namespace - desc "test passed" + create_infra $namespace + kubectl_bin delete -f https://github.com/jetstack/cert-manager/releases/download/v1.5.4/cert-manager.yaml 2>/dev/null || : + sleep 10 + + desc 'create PXC cluster without cert manager' + cluster="some-name" + spinup_pxc "$cluster" "$conf_dir/$cluster.yml" 3 10 "$conf_dir/secrets_without_tls.yml" + wait_cluster_consistency "$cluster" 3 2 + + desc 'check if certificate issued manually' + tlsSecretsShouldExist "$cluster-ssl" + + local ownerName=$(kubectl_bin get secrets/$cluster-ssl -o json | jq '.metadata.ownerReferences[0].name') + if [ $ownerName != '"'$cluster'"' ]; then + desc 'invalid owner of secret' + exit 1 + fi + destroy $namespace + desc "test passed" } main From ac3b51b3dc4b34bea017f287563399824d217cac Mon Sep 17 00:00:00 2001 From: Tomislav Plavcic Date: Tue, 6 Feb 2024 10:06:11 +0100 Subject: [PATCH 2/4] K8SPXC-1341 - Add pvc-resize test into release tests (#1618) --- e2e-tests/run-pr.csv | 4 ++-- e2e-tests/run-release.csv | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/e2e-tests/run-pr.csv b/e2e-tests/run-pr.csv index c7125bac0c..e5e9ccd409 100644 --- a/e2e-tests/run-pr.csv +++ b/e2e-tests/run-pr.csv @@ -16,6 +16,8 @@ pitr,8.0 pitr-gap-errors,8.0 proxy-protocol,8.0 proxysql-sidecar-res-limits,8.0 +pvc-resize,5.7 +pvc-resize,8.0 recreate,8.0 restore-to-encrypted-cluster,8.0 scaling-proxysql,8.0 @@ -35,5 +37,3 @@ upgrade-proxysql,8.0 users,5.7 users,8.0 validation-hook,8.0 -pvc-resize,5.7 -pvc-resize,8.0 \ No newline at end of file diff --git a/e2e-tests/run-release.csv b/e2e-tests/run-release.csv index aaa1f5de83..95b44cb69c 100644 --- a/e2e-tests/run-release.csv +++ b/e2e-tests/run-release.csv @@ -16,6 +16,7 @@ pitr pitr-gap-errors proxy-protocol proxysql-sidecar-res-limits +pvc-resize recreate restore-to-encrypted-cluster scaling From 91f4843294308873f7896f1f5dd5c0887d34060c Mon Sep 17 00:00:00 2001 From: Andrii Dema Date: Tue, 6 Feb 2024 13:17:18 +0200 Subject: [PATCH 3/4] K8SPXC-1298: don't add `PMM_PREFIX` when `envVarsSercret` doesn't have it (#1617) * K8SPXC-1298: don't add `PMM_PREFIX` when `envVarsSercret` doesn't have it https://perconadev.atlassian.net/browse/K8SPXC-1298 * fix limits test --------- Co-authored-by: Viacheslav Sarzhan --- ...t_no-limits-proxysql-increased-k127-oc.yml | 2 +- ...lset_no-limits-proxysql-increased-k127.yml | 2 +- ...fulset_no-limits-proxysql-increased-oc.yml | 2 +- ...atefulset_no-limits-proxysql-increased.yml | 2 +- ...statefulset_no-limits-proxysql-k127-oc.yml | 2 +- .../statefulset_no-limits-proxysql-k127.yml | 2 +- .../statefulset_no-limits-proxysql-oc.yml | 2 +- .../statefulset_no-limits-proxysql.yml | 2 +- ...fulset_no-limits-pxc-increased-k127-oc.yml | 2 +- ...atefulset_no-limits-pxc-increased-k127.yml | 2 +- ...statefulset_no-limits-pxc-increased-oc.yml | 2 +- .../statefulset_no-limits-pxc-increased.yml | 2 +- .../statefulset_no-limits-pxc-k127-oc.yml | 2 +- .../statefulset_no-limits-pxc-k127.yml | 2 +- .../compare/statefulset_no-limits-pxc-oc.yml | 2 +- .../compare/statefulset_no-limits-pxc.yml | 2 +- .../monitoring-2-0/compare/agents-list.json | 68 ++++ ...lset_monitoring-haproxy-no-prefix-k127.yml | 307 +++++++++++++++ ...atefulset_monitoring-haproxy-no-prefix.yml | 304 +++++++++++++++ ...ulset_monitoring-pxc-k127-no-prefix-oc.yml | 349 +++++++++++++++++ ...tefulset_monitoring-pxc-no-prefix-k127.yml | 350 ++++++++++++++++++ ...tatefulset_monitoring-pxc-no-prefix-oc.yml | 346 +++++++++++++++++ .../statefulset_monitoring-pxc-no-prefix.yml | 347 +++++++++++++++++ e2e-tests/monitoring-2-0/run | 9 +- pkg/apis/pxc/v1/pxc_types.go | 4 +- pkg/controller/pxc/controller.go | 13 +- pkg/controller/pxc/upgrade.go | 14 +- pkg/pxc/app/pmm.go | 8 +- pkg/pxc/app/statefulset/haproxy.go | 13 +- pkg/pxc/app/statefulset/node.go | 14 +- pkg/pxc/app/statefulset/proxysql.go | 15 +- pkg/pxc/statefulset.go | 6 +- 32 files changed, 2159 insertions(+), 40 deletions(-) create mode 100644 e2e-tests/monitoring-2-0/compare/statefulset_monitoring-haproxy-no-prefix-k127.yml create mode 100644 e2e-tests/monitoring-2-0/compare/statefulset_monitoring-haproxy-no-prefix.yml create mode 100644 e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc-k127-no-prefix-oc.yml create mode 100644 e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc-no-prefix-k127.yml create mode 100644 e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc-no-prefix-oc.yml create mode 100644 e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc-no-prefix.yml diff --git a/e2e-tests/limits/compare/statefulset_no-limits-proxysql-increased-k127-oc.yml b/e2e-tests/limits/compare/statefulset_no-limits-proxysql-increased-k127-oc.yml index 6c2ba22afa..d58f057339 100644 --- a/e2e-tests/limits/compare/statefulset_no-limits-proxysql-increased-k127-oc.yml +++ b/e2e-tests/limits/compare/statefulset_no-limits-proxysql-increased-k127-oc.yml @@ -88,7 +88,7 @@ spec: - name: PMM_AGENT_SETUP_NODE_TYPE value: container - name: PMM_AGENT_SETUP_NODE_NAME - value: $(PMM_PREFIX)$(POD_NAMESPASE)-$(POD_NAME) + value: $(POD_NAMESPASE)-$(POD_NAME) - name: DB_TYPE value: proxysql - name: MONITOR_USER diff --git a/e2e-tests/limits/compare/statefulset_no-limits-proxysql-increased-k127.yml b/e2e-tests/limits/compare/statefulset_no-limits-proxysql-increased-k127.yml index 2738f14012..046e43f2e5 100644 --- a/e2e-tests/limits/compare/statefulset_no-limits-proxysql-increased-k127.yml +++ b/e2e-tests/limits/compare/statefulset_no-limits-proxysql-increased-k127.yml @@ -88,7 +88,7 @@ spec: - name: PMM_AGENT_SETUP_NODE_TYPE value: container - name: PMM_AGENT_SETUP_NODE_NAME - value: $(PMM_PREFIX)$(POD_NAMESPASE)-$(POD_NAME) + value: $(POD_NAMESPASE)-$(POD_NAME) - name: DB_TYPE value: proxysql - name: MONITOR_USER 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 0cfa7a0591..7979f43429 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 @@ -85,7 +85,7 @@ spec: - name: PMM_AGENT_SETUP_NODE_TYPE value: container - name: PMM_AGENT_SETUP_NODE_NAME - value: $(PMM_PREFIX)$(POD_NAMESPASE)-$(POD_NAME) + value: $(POD_NAMESPASE)-$(POD_NAME) - name: DB_TYPE value: proxysql - name: MONITOR_USER 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 277289ee0d..02748fc39f 100644 --- a/e2e-tests/limits/compare/statefulset_no-limits-proxysql-increased.yml +++ b/e2e-tests/limits/compare/statefulset_no-limits-proxysql-increased.yml @@ -85,7 +85,7 @@ spec: - name: PMM_AGENT_SETUP_NODE_TYPE value: container - name: PMM_AGENT_SETUP_NODE_NAME - value: $(PMM_PREFIX)$(POD_NAMESPASE)-$(POD_NAME) + value: $(POD_NAMESPASE)-$(POD_NAME) - name: DB_TYPE value: proxysql - name: MONITOR_USER diff --git a/e2e-tests/limits/compare/statefulset_no-limits-proxysql-k127-oc.yml b/e2e-tests/limits/compare/statefulset_no-limits-proxysql-k127-oc.yml index 2843201dee..639dbf3a13 100644 --- a/e2e-tests/limits/compare/statefulset_no-limits-proxysql-k127-oc.yml +++ b/e2e-tests/limits/compare/statefulset_no-limits-proxysql-k127-oc.yml @@ -88,7 +88,7 @@ spec: - name: PMM_AGENT_SETUP_NODE_TYPE value: container - name: PMM_AGENT_SETUP_NODE_NAME - value: $(PMM_PREFIX)$(POD_NAMESPASE)-$(POD_NAME) + value: $(POD_NAMESPASE)-$(POD_NAME) - name: DB_TYPE value: proxysql - name: MONITOR_USER diff --git a/e2e-tests/limits/compare/statefulset_no-limits-proxysql-k127.yml b/e2e-tests/limits/compare/statefulset_no-limits-proxysql-k127.yml index c6438cf885..2c0ef4a5c0 100644 --- a/e2e-tests/limits/compare/statefulset_no-limits-proxysql-k127.yml +++ b/e2e-tests/limits/compare/statefulset_no-limits-proxysql-k127.yml @@ -88,7 +88,7 @@ spec: - name: PMM_AGENT_SETUP_NODE_TYPE value: container - name: PMM_AGENT_SETUP_NODE_NAME - value: $(PMM_PREFIX)$(POD_NAMESPASE)-$(POD_NAME) + value: $(POD_NAMESPASE)-$(POD_NAME) - name: DB_TYPE value: proxysql - name: MONITOR_USER 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 b94897fec2..ac6df8b389 100644 --- a/e2e-tests/limits/compare/statefulset_no-limits-proxysql-oc.yml +++ b/e2e-tests/limits/compare/statefulset_no-limits-proxysql-oc.yml @@ -85,7 +85,7 @@ spec: - name: PMM_AGENT_SETUP_NODE_TYPE value: container - name: PMM_AGENT_SETUP_NODE_NAME - value: $(PMM_PREFIX)$(POD_NAMESPASE)-$(POD_NAME) + value: $(POD_NAMESPASE)-$(POD_NAME) - name: DB_TYPE value: proxysql - name: MONITOR_USER diff --git a/e2e-tests/limits/compare/statefulset_no-limits-proxysql.yml b/e2e-tests/limits/compare/statefulset_no-limits-proxysql.yml index 68130a42b9..68b4993ac5 100644 --- a/e2e-tests/limits/compare/statefulset_no-limits-proxysql.yml +++ b/e2e-tests/limits/compare/statefulset_no-limits-proxysql.yml @@ -85,7 +85,7 @@ spec: - name: PMM_AGENT_SETUP_NODE_TYPE value: container - name: PMM_AGENT_SETUP_NODE_NAME - value: $(PMM_PREFIX)$(POD_NAMESPASE)-$(POD_NAME) + value: $(POD_NAMESPASE)-$(POD_NAME) - name: DB_TYPE value: proxysql - name: MONITOR_USER diff --git a/e2e-tests/limits/compare/statefulset_no-limits-pxc-increased-k127-oc.yml b/e2e-tests/limits/compare/statefulset_no-limits-pxc-increased-k127-oc.yml index f5f4b3b716..c096b3037e 100644 --- a/e2e-tests/limits/compare/statefulset_no-limits-pxc-increased-k127-oc.yml +++ b/e2e-tests/limits/compare/statefulset_no-limits-pxc-increased-k127-oc.yml @@ -88,7 +88,7 @@ spec: - name: PMM_AGENT_SETUP_NODE_TYPE value: container - name: PMM_AGENT_SETUP_NODE_NAME - value: $(PMM_PREFIX)$(POD_NAMESPASE)-$(POD_NAME) + value: $(POD_NAMESPASE)-$(POD_NAME) - name: DB_TYPE value: mysql - name: DB_USER diff --git a/e2e-tests/limits/compare/statefulset_no-limits-pxc-increased-k127.yml b/e2e-tests/limits/compare/statefulset_no-limits-pxc-increased-k127.yml index 262fc90a02..df52f8ecb3 100644 --- a/e2e-tests/limits/compare/statefulset_no-limits-pxc-increased-k127.yml +++ b/e2e-tests/limits/compare/statefulset_no-limits-pxc-increased-k127.yml @@ -88,7 +88,7 @@ spec: - name: PMM_AGENT_SETUP_NODE_TYPE value: container - name: PMM_AGENT_SETUP_NODE_NAME - value: $(PMM_PREFIX)$(POD_NAMESPASE)-$(POD_NAME) + value: $(POD_NAMESPASE)-$(POD_NAME) - name: DB_TYPE value: mysql - name: DB_USER diff --git a/e2e-tests/limits/compare/statefulset_no-limits-pxc-increased-oc.yml b/e2e-tests/limits/compare/statefulset_no-limits-pxc-increased-oc.yml index 6c8ecfea69..ed5b963b25 100644 --- a/e2e-tests/limits/compare/statefulset_no-limits-pxc-increased-oc.yml +++ b/e2e-tests/limits/compare/statefulset_no-limits-pxc-increased-oc.yml @@ -85,7 +85,7 @@ spec: - name: PMM_AGENT_SETUP_NODE_TYPE value: container - name: PMM_AGENT_SETUP_NODE_NAME - value: $(PMM_PREFIX)$(POD_NAMESPASE)-$(POD_NAME) + value: $(POD_NAMESPASE)-$(POD_NAME) - name: DB_TYPE value: mysql - name: DB_USER diff --git a/e2e-tests/limits/compare/statefulset_no-limits-pxc-increased.yml b/e2e-tests/limits/compare/statefulset_no-limits-pxc-increased.yml index 91198088cb..901bd4136c 100644 --- a/e2e-tests/limits/compare/statefulset_no-limits-pxc-increased.yml +++ b/e2e-tests/limits/compare/statefulset_no-limits-pxc-increased.yml @@ -85,7 +85,7 @@ spec: - name: PMM_AGENT_SETUP_NODE_TYPE value: container - name: PMM_AGENT_SETUP_NODE_NAME - value: $(PMM_PREFIX)$(POD_NAMESPASE)-$(POD_NAME) + value: $(POD_NAMESPASE)-$(POD_NAME) - name: DB_TYPE value: mysql - name: DB_USER diff --git a/e2e-tests/limits/compare/statefulset_no-limits-pxc-k127-oc.yml b/e2e-tests/limits/compare/statefulset_no-limits-pxc-k127-oc.yml index 0d99e2f7b8..5203a165df 100644 --- a/e2e-tests/limits/compare/statefulset_no-limits-pxc-k127-oc.yml +++ b/e2e-tests/limits/compare/statefulset_no-limits-pxc-k127-oc.yml @@ -88,7 +88,7 @@ spec: - name: PMM_AGENT_SETUP_NODE_TYPE value: container - name: PMM_AGENT_SETUP_NODE_NAME - value: $(PMM_PREFIX)$(POD_NAMESPASE)-$(POD_NAME) + value: $(POD_NAMESPASE)-$(POD_NAME) - name: DB_TYPE value: mysql - name: DB_USER diff --git a/e2e-tests/limits/compare/statefulset_no-limits-pxc-k127.yml b/e2e-tests/limits/compare/statefulset_no-limits-pxc-k127.yml index 37bc2ce036..e21c08250e 100644 --- a/e2e-tests/limits/compare/statefulset_no-limits-pxc-k127.yml +++ b/e2e-tests/limits/compare/statefulset_no-limits-pxc-k127.yml @@ -88,7 +88,7 @@ spec: - name: PMM_AGENT_SETUP_NODE_TYPE value: container - name: PMM_AGENT_SETUP_NODE_NAME - value: $(PMM_PREFIX)$(POD_NAMESPASE)-$(POD_NAME) + value: $(POD_NAMESPASE)-$(POD_NAME) - name: DB_TYPE value: mysql - name: DB_USER diff --git a/e2e-tests/limits/compare/statefulset_no-limits-pxc-oc.yml b/e2e-tests/limits/compare/statefulset_no-limits-pxc-oc.yml index 6706ffb485..0a6fa5f1b1 100644 --- a/e2e-tests/limits/compare/statefulset_no-limits-pxc-oc.yml +++ b/e2e-tests/limits/compare/statefulset_no-limits-pxc-oc.yml @@ -85,7 +85,7 @@ spec: - name: PMM_AGENT_SETUP_NODE_TYPE value: container - name: PMM_AGENT_SETUP_NODE_NAME - value: $(PMM_PREFIX)$(POD_NAMESPASE)-$(POD_NAME) + value: $(POD_NAMESPASE)-$(POD_NAME) - name: DB_TYPE value: mysql - name: DB_USER diff --git a/e2e-tests/limits/compare/statefulset_no-limits-pxc.yml b/e2e-tests/limits/compare/statefulset_no-limits-pxc.yml index 4343961ba8..8936e8407b 100644 --- a/e2e-tests/limits/compare/statefulset_no-limits-pxc.yml +++ b/e2e-tests/limits/compare/statefulset_no-limits-pxc.yml @@ -85,7 +85,7 @@ spec: - name: PMM_AGENT_SETUP_NODE_TYPE value: container - name: PMM_AGENT_SETUP_NODE_NAME - value: $(PMM_PREFIX)$(POD_NAMESPASE)-$(POD_NAME) + value: $(POD_NAMESPASE)-$(POD_NAME) - name: DB_TYPE value: mysql - name: DB_USER diff --git a/e2e-tests/monitoring-2-0/compare/agents-list.json b/e2e-tests/monitoring-2-0/compare/agents-list.json index a8a65d95c5..0f7283aac6 100644 --- a/e2e-tests/monitoring-2-0/compare/agents-list.json +++ b/e2e-tests/monitoring-2-0/compare/agents-list.json @@ -1,4 +1,72 @@ [ + { + "service_type": "haproxy", + "service_name": "monitoring-haproxy-0", + "node_name": "monitoring-haproxy-0", + "cluster": "monitoring", + "agents": [ + { + "agent_type": "external-exporter" + }, + { + "agent_type": "pmm-agent" + }, + { + "agent_type": "vmagent", + "status": "RUNNING" + } + ] + }, + { + "service_type": "mysql", + "service_name": "monitoring-pxc-0", + "node_name": "monitoring-pxc-0", + "cluster": "monitoring", + "address": "monitoring-pxc-0", + "port": 33062, + "agents": [ + { + "agent_type": "mysqld_exporter", + "status": "RUNNING" + }, + { + "agent_type": "pmm-agent" + }, + { + "agent_type": "qan-mysql-perfschema-agent", + "status": "RUNNING" + }, + { + "agent_type": "vmagent", + "status": "RUNNING" + } + ] + }, + { + "service_type": "mysql", + "service_name": "monitoring-pxc-1", + "node_name": "monitoring-pxc-1", + "cluster": "monitoring", + "address": "monitoring-pxc-1", + "port": 33062, + "agents": [ + { + "agent_type": "mysqld_exporter", + "status": "RUNNING" + }, + { + "agent_type": "pmm-agent" + }, + { + "agent_type": "qan-mysql-perfschema-agent", + "status": "RUNNING" + }, + { + "agent_type": "vmagent", + "status": "RUNNING" + } + ] + }, { "service_type": "postgresql", "service_name": "pmm-server-postgresql", diff --git a/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-haproxy-no-prefix-k127.yml b/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-haproxy-no-prefix-k127.yml new file mode 100644 index 0000000000..9272c3d5a9 --- /dev/null +++ b/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-haproxy-no-prefix-k127.yml @@ -0,0 +1,307 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + generation: 2 + name: monitoring-haproxy + ownerReferences: + - controller: true + kind: PerconaXtraDBCluster + name: monitoring +spec: + persistentVolumeClaimRetentionPolicy: + whenDeleted: Retain + whenScaled: Retain + podManagementPolicy: OrderedReady + replicas: 2 + revisionHistoryLimit: 10 + selector: + matchLabels: + app.kubernetes.io/component: haproxy + app.kubernetes.io/instance: monitoring + app.kubernetes.io/managed-by: percona-xtradb-cluster-operator + app.kubernetes.io/name: percona-xtradb-cluster + app.kubernetes.io/part-of: percona-xtradb-cluster + serviceName: monitoring-haproxy + template: + metadata: + labels: + app.kubernetes.io/component: haproxy + app.kubernetes.io/instance: monitoring + app.kubernetes.io/managed-by: percona-xtradb-cluster-operator + app.kubernetes.io/name: percona-xtradb-cluster + app.kubernetes.io/part-of: percona-xtradb-cluster + spec: + containers: + - env: + - name: PMM_SERVER + value: monitoring-service + - name: PMM_USER + value: api_key + - name: PMM_PASSWORD + valueFrom: + secretKeyRef: + key: pmmserverkey + name: internal-monitoring + - name: CLIENT_PORT_LISTEN + value: "7777" + - name: CLIENT_PORT_MIN + value: "30100" + - name: CLIENT_PORT_MAX + value: "30105" + - name: POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + - name: POD_NAMESPASE + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + - name: PMM_AGENT_SERVER_ADDRESS + value: monitoring-service + - name: PMM_AGENT_SERVER_USERNAME + value: api_key + - name: PMM_AGENT_SERVER_PASSWORD + valueFrom: + secretKeyRef: + key: pmmserverkey + name: internal-monitoring + - name: PMM_AGENT_LISTEN_PORT + value: "7777" + - name: PMM_AGENT_PORTS_MIN + value: "30100" + - name: PMM_AGENT_PORTS_MAX + value: "30105" + - name: PMM_AGENT_CONFIG_FILE + value: /usr/local/percona/pmm2/config/pmm-agent.yaml + - name: PMM_AGENT_SERVER_INSECURE_TLS + value: "1" + - name: PMM_AGENT_LISTEN_ADDRESS + value: 0.0.0.0 + - name: PMM_AGENT_SETUP_METRICS_MODE + value: push + - name: PMM_AGENT_SETUP + value: "1" + - name: PMM_AGENT_SETUP_FORCE + value: "1" + - name: PMM_AGENT_SETUP_NODE_TYPE + value: container + - name: PMM_AGENT_SETUP_NODE_NAME + value: $(POD_NAMESPASE)-$(POD_NAME) + - name: DB_TYPE + value: haproxy + - name: MONITOR_USER + value: monitor + - name: MONITOR_PASSWORD + valueFrom: + secretKeyRef: + key: monitor + name: internal-monitoring + - name: DB_USER + value: monitor + - name: DB_PASSWORD + valueFrom: + secretKeyRef: + key: monitor + name: internal-monitoring + - name: DB_CLUSTER + value: pxc + - name: DB_HOST + value: localhost + - name: DB_PORT + value: "3306" + - name: CLUSTER_NAME + value: monitoring + - name: PMM_ADMIN_CUSTOM_PARAMS + value: --listen-port=8404 + - name: PMM_AGENT_PRERUN_SCRIPT + value: /var/lib/mysql/pmm-prerun.sh + - name: PMM_AGENT_SIDECAR + value: "true" + - name: PMM_AGENT_SIDECAR_SLEEP + value: "5" + - name: PMM_AGENT_PATHS_TEMPDIR + value: /tmp + envFrom: + - secretRef: + name: my-env-var-secrets + optional: true + imagePullPolicy: Always + lifecycle: + preStop: + exec: + command: + - bash + - -c + - pmm-admin unregister --force + livenessProbe: + failureThreshold: 3 + httpGet: + path: /local/Status + port: 7777 + scheme: HTTP + initialDelaySeconds: 60 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + name: pmm-client + ports: + - containerPort: 7777 + protocol: TCP + - containerPort: 30100 + protocol: TCP + - containerPort: 30101 + protocol: TCP + - containerPort: 30102 + protocol: TCP + - containerPort: 30103 + protocol: TCP + - containerPort: 30104 + protocol: TCP + - containerPort: 30105 + protocol: TCP + resources: + limits: + cpu: "1" + memory: 1G + requests: + cpu: 308m + memory: 508M + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /var/lib/mysql + name: bin + - env: + - name: PXC_SERVICE + value: monitoring-pxc + - name: LIVENESS_CHECK_TIMEOUT + value: "5" + - name: READINESS_CHECK_TIMEOUT + value: "1" + envFrom: + - secretRef: + name: my-env-var-secrets + optional: true + imagePullPolicy: Always + livenessProbe: + exec: + command: + - /usr/local/bin/liveness-check.sh + failureThreshold: 4 + initialDelaySeconds: 60 + periodSeconds: 30 + successThreshold: 1 + timeoutSeconds: 5 + name: haproxy + ports: + - containerPort: 3306 + name: mysql + protocol: TCP + - containerPort: 3307 + name: mysql-replicas + protocol: TCP + - containerPort: 3309 + name: proxy-protocol + protocol: TCP + - containerPort: 33062 + name: mysql-admin + protocol: TCP + - containerPort: 33060 + name: mysqlx + protocol: TCP + readinessProbe: + exec: + command: + - /usr/local/bin/readiness-check.sh + failureThreshold: 3 + initialDelaySeconds: 15 + periodSeconds: 5 + successThreshold: 1 + timeoutSeconds: 1 + resources: + requests: + cpu: 300m + memory: 500M + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /etc/haproxy-custom/ + name: haproxy-custom + - mountPath: /etc/haproxy/pxc + name: haproxy-auto + - mountPath: /etc/mysql/mysql-users-secret + name: mysql-users-secret-file + - mountPath: /etc/mysql/haproxy-env-secret + name: my-env-var-secrets + - args: + - /usr/bin/peer-list + - -on-change=/usr/bin/add_pxc_nodes.sh + - -service=$(PXC_SERVICE) + env: + - name: PXC_SERVICE + value: monitoring-pxc + envFrom: + - secretRef: + name: my-env-var-secrets + optional: true + imagePullPolicy: Always + name: pxc-monit + resources: {} + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /etc/haproxy-custom/ + name: haproxy-custom + - mountPath: /etc/haproxy/pxc + name: haproxy-auto + - mountPath: /etc/mysql/mysql-users-secret + name: mysql-users-secret-file + - mountPath: /etc/mysql/haproxy-env-secret + name: my-env-var-secrets + dnsPolicy: ClusterFirst + initContainers: + - command: + - /pxc-init-entrypoint.sh + imagePullPolicy: Always + name: pxc-init + resources: + limits: + cpu: 50m + memory: 50M + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /var/lib/mysql + name: bin + restartPolicy: Always + schedulerName: default-scheduler + securityContext: {} + serviceAccount: default + serviceAccountName: default + terminationGracePeriodSeconds: 30 + volumes: + - configMap: + defaultMode: 420 + name: monitoring-haproxy + optional: true + name: haproxy-custom + - emptyDir: {} + name: haproxy-auto + - name: mysql-users-secret-file + secret: + defaultMode: 420 + optional: false + secretName: internal-monitoring + - name: my-env-var-secrets + secret: + defaultMode: 420 + optional: true + secretName: my-env-var-secrets + - emptyDir: {} + name: bin + updateStrategy: + rollingUpdate: + partition: 0 + type: RollingUpdate diff --git a/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-haproxy-no-prefix.yml b/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-haproxy-no-prefix.yml new file mode 100644 index 0000000000..629d1d7f07 --- /dev/null +++ b/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-haproxy-no-prefix.yml @@ -0,0 +1,304 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + generation: 2 + name: monitoring-haproxy + ownerReferences: + - controller: true + kind: PerconaXtraDBCluster + name: monitoring +spec: + podManagementPolicy: OrderedReady + replicas: 2 + revisionHistoryLimit: 10 + selector: + matchLabels: + app.kubernetes.io/component: haproxy + app.kubernetes.io/instance: monitoring + app.kubernetes.io/managed-by: percona-xtradb-cluster-operator + app.kubernetes.io/name: percona-xtradb-cluster + app.kubernetes.io/part-of: percona-xtradb-cluster + serviceName: monitoring-haproxy + template: + metadata: + labels: + app.kubernetes.io/component: haproxy + app.kubernetes.io/instance: monitoring + app.kubernetes.io/managed-by: percona-xtradb-cluster-operator + app.kubernetes.io/name: percona-xtradb-cluster + app.kubernetes.io/part-of: percona-xtradb-cluster + spec: + containers: + - env: + - name: PMM_SERVER + value: monitoring-service + - name: PMM_USER + value: api_key + - name: PMM_PASSWORD + valueFrom: + secretKeyRef: + key: pmmserverkey + name: internal-monitoring + - name: CLIENT_PORT_LISTEN + value: "7777" + - name: CLIENT_PORT_MIN + value: "30100" + - name: CLIENT_PORT_MAX + value: "30105" + - name: POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + - name: POD_NAMESPASE + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + - name: PMM_AGENT_SERVER_ADDRESS + value: monitoring-service + - name: PMM_AGENT_SERVER_USERNAME + value: api_key + - name: PMM_AGENT_SERVER_PASSWORD + valueFrom: + secretKeyRef: + key: pmmserverkey + name: internal-monitoring + - name: PMM_AGENT_LISTEN_PORT + value: "7777" + - name: PMM_AGENT_PORTS_MIN + value: "30100" + - name: PMM_AGENT_PORTS_MAX + value: "30105" + - name: PMM_AGENT_CONFIG_FILE + value: /usr/local/percona/pmm2/config/pmm-agent.yaml + - name: PMM_AGENT_SERVER_INSECURE_TLS + value: "1" + - name: PMM_AGENT_LISTEN_ADDRESS + value: 0.0.0.0 + - name: PMM_AGENT_SETUP_METRICS_MODE + value: push + - name: PMM_AGENT_SETUP + value: "1" + - name: PMM_AGENT_SETUP_FORCE + value: "1" + - name: PMM_AGENT_SETUP_NODE_TYPE + value: container + - name: PMM_AGENT_SETUP_NODE_NAME + value: $(POD_NAMESPASE)-$(POD_NAME) + - name: DB_TYPE + value: haproxy + - name: MONITOR_USER + value: monitor + - name: MONITOR_PASSWORD + valueFrom: + secretKeyRef: + key: monitor + name: internal-monitoring + - name: DB_USER + value: monitor + - name: DB_PASSWORD + valueFrom: + secretKeyRef: + key: monitor + name: internal-monitoring + - name: DB_CLUSTER + value: pxc + - name: DB_HOST + value: localhost + - name: DB_PORT + value: "3306" + - name: CLUSTER_NAME + value: monitoring + - name: PMM_ADMIN_CUSTOM_PARAMS + value: --listen-port=8404 + - name: PMM_AGENT_PRERUN_SCRIPT + value: /var/lib/mysql/pmm-prerun.sh + - name: PMM_AGENT_SIDECAR + value: "true" + - name: PMM_AGENT_SIDECAR_SLEEP + value: "5" + - name: PMM_AGENT_PATHS_TEMPDIR + value: /tmp + envFrom: + - secretRef: + name: my-env-var-secrets + optional: true + imagePullPolicy: Always + lifecycle: + preStop: + exec: + command: + - bash + - -c + - pmm-admin unregister --force + livenessProbe: + failureThreshold: 3 + httpGet: + path: /local/Status + port: 7777 + scheme: HTTP + initialDelaySeconds: 60 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + name: pmm-client + ports: + - containerPort: 7777 + protocol: TCP + - containerPort: 30100 + protocol: TCP + - containerPort: 30101 + protocol: TCP + - containerPort: 30102 + protocol: TCP + - containerPort: 30103 + protocol: TCP + - containerPort: 30104 + protocol: TCP + - containerPort: 30105 + protocol: TCP + resources: + limits: + cpu: "1" + memory: 1G + requests: + cpu: 308m + memory: 508M + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /var/lib/mysql + name: bin + - env: + - name: PXC_SERVICE + value: monitoring-pxc + - name: LIVENESS_CHECK_TIMEOUT + value: "5" + - name: READINESS_CHECK_TIMEOUT + value: "1" + envFrom: + - secretRef: + name: my-env-var-secrets + optional: true + imagePullPolicy: Always + livenessProbe: + exec: + command: + - /usr/local/bin/liveness-check.sh + failureThreshold: 4 + initialDelaySeconds: 60 + periodSeconds: 30 + successThreshold: 1 + timeoutSeconds: 5 + name: haproxy + ports: + - containerPort: 3306 + name: mysql + protocol: TCP + - containerPort: 3307 + name: mysql-replicas + protocol: TCP + - containerPort: 3309 + name: proxy-protocol + protocol: TCP + - containerPort: 33062 + name: mysql-admin + protocol: TCP + - containerPort: 33060 + name: mysqlx + protocol: TCP + readinessProbe: + exec: + command: + - /usr/local/bin/readiness-check.sh + failureThreshold: 3 + initialDelaySeconds: 15 + periodSeconds: 5 + successThreshold: 1 + timeoutSeconds: 1 + resources: + requests: + cpu: 300m + memory: 500M + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /etc/haproxy-custom/ + name: haproxy-custom + - mountPath: /etc/haproxy/pxc + name: haproxy-auto + - mountPath: /etc/mysql/mysql-users-secret + name: mysql-users-secret-file + - mountPath: /etc/mysql/haproxy-env-secret + name: my-env-var-secrets + - args: + - /usr/bin/peer-list + - -on-change=/usr/bin/add_pxc_nodes.sh + - -service=$(PXC_SERVICE) + env: + - name: PXC_SERVICE + value: monitoring-pxc + envFrom: + - secretRef: + name: my-env-var-secrets + optional: true + imagePullPolicy: Always + name: pxc-monit + resources: {} + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /etc/haproxy-custom/ + name: haproxy-custom + - mountPath: /etc/haproxy/pxc + name: haproxy-auto + - mountPath: /etc/mysql/mysql-users-secret + name: mysql-users-secret-file + - mountPath: /etc/mysql/haproxy-env-secret + name: my-env-var-secrets + dnsPolicy: ClusterFirst + initContainers: + - command: + - /pxc-init-entrypoint.sh + imagePullPolicy: Always + name: pxc-init + resources: + limits: + cpu: 50m + memory: 50M + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /var/lib/mysql + name: bin + restartPolicy: Always + schedulerName: default-scheduler + securityContext: {} + serviceAccount: default + serviceAccountName: default + terminationGracePeriodSeconds: 30 + volumes: + - configMap: + defaultMode: 420 + name: monitoring-haproxy + optional: true + name: haproxy-custom + - emptyDir: {} + name: haproxy-auto + - name: mysql-users-secret-file + secret: + defaultMode: 420 + optional: false + secretName: internal-monitoring + - name: my-env-var-secrets + secret: + defaultMode: 420 + optional: true + secretName: my-env-var-secrets + - emptyDir: {} + name: bin + updateStrategy: + rollingUpdate: + partition: 0 + type: RollingUpdate diff --git a/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc-k127-no-prefix-oc.yml b/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc-k127-no-prefix-oc.yml new file mode 100644 index 0000000000..88927ea524 --- /dev/null +++ b/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc-k127-no-prefix-oc.yml @@ -0,0 +1,349 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + generation: 2 + name: monitoring-pxc + ownerReferences: + - controller: true + kind: PerconaXtraDBCluster + name: monitoring +spec: + persistentVolumeClaimRetentionPolicy: + whenDeleted: Retain + whenScaled: Retain + podManagementPolicy: OrderedReady + replicas: 3 + revisionHistoryLimit: 10 + selector: + matchLabels: + app.kubernetes.io/component: pxc + app.kubernetes.io/instance: monitoring + app.kubernetes.io/managed-by: percona-xtradb-cluster-operator + app.kubernetes.io/name: percona-xtradb-cluster + app.kubernetes.io/part-of: percona-xtradb-cluster + serviceName: monitoring-pxc + template: + metadata: + labels: + app.kubernetes.io/component: pxc + app.kubernetes.io/instance: monitoring + app.kubernetes.io/managed-by: percona-xtradb-cluster-operator + app.kubernetes.io/name: percona-xtradb-cluster + app.kubernetes.io/part-of: percona-xtradb-cluster + spec: + containers: + - env: + - name: PMM_SERVER + value: monitoring-service + - name: PMM_USER + value: api_key + - name: PMM_PASSWORD + valueFrom: + secretKeyRef: + key: pmmserverkey + name: internal-monitoring + - name: CLIENT_PORT_LISTEN + value: "7777" + - name: CLIENT_PORT_MIN + value: "30100" + - name: CLIENT_PORT_MAX + value: "30105" + - name: POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + - name: POD_NAMESPASE + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + - name: PMM_AGENT_SERVER_ADDRESS + value: monitoring-service + - name: PMM_AGENT_SERVER_USERNAME + value: api_key + - name: PMM_AGENT_SERVER_PASSWORD + valueFrom: + secretKeyRef: + key: pmmserverkey + name: internal-monitoring + - name: PMM_AGENT_LISTEN_PORT + value: "7777" + - name: PMM_AGENT_PORTS_MIN + value: "30100" + - name: PMM_AGENT_PORTS_MAX + value: "30105" + - name: PMM_AGENT_CONFIG_FILE + value: /usr/local/percona/pmm2/config/pmm-agent.yaml + - name: PMM_AGENT_SERVER_INSECURE_TLS + value: "1" + - name: PMM_AGENT_LISTEN_ADDRESS + value: 0.0.0.0 + - name: PMM_AGENT_SETUP_METRICS_MODE + value: push + - name: PMM_AGENT_SETUP + value: "1" + - name: PMM_AGENT_SETUP_FORCE + value: "1" + - name: PMM_AGENT_SETUP_NODE_TYPE + value: container + - name: PMM_AGENT_SETUP_NODE_NAME + value: $(POD_NAMESPASE)-$(POD_NAME) + - name: DB_TYPE + value: mysql + - name: DB_USER + value: monitor + - name: DB_PASSWORD + valueFrom: + secretKeyRef: + key: monitor + name: internal-monitoring + - name: DB_ARGS + value: --query-source=perfschema + - name: DB_CLUSTER + value: pxc + - name: DB_HOST + value: localhost + - name: DB_PORT + value: "33062" + - name: CLUSTER_NAME + value: monitoring + - name: PMM_ADMIN_CUSTOM_PARAMS + value: --disable-tablestats-limit=2000 + - name: PMM_AGENT_PRERUN_SCRIPT + value: /var/lib/mysql/pmm-prerun.sh + - name: PMM_AGENT_SIDECAR + value: "true" + - name: PMM_AGENT_SIDECAR_SLEEP + value: "5" + - name: PMM_AGENT_PATHS_TEMPDIR + value: /tmp + envFrom: + - secretRef: + name: my-env-var-secrets + optional: true + imagePullPolicy: Always + lifecycle: + preStop: + exec: + command: + - bash + - -c + - pmm-admin unregister --force + livenessProbe: + failureThreshold: 3 + httpGet: + path: /local/Status + port: 7777 + scheme: HTTP + initialDelaySeconds: 60 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + name: pmm-client + ports: + - containerPort: 7777 + protocol: TCP + - containerPort: 30100 + protocol: TCP + - containerPort: 30101 + protocol: TCP + - containerPort: 30102 + protocol: TCP + - containerPort: 30103 + protocol: TCP + - containerPort: 30104 + protocol: TCP + - containerPort: 30105 + protocol: TCP + resources: + limits: + cpu: "1" + memory: 1G + requests: + cpu: 308m + memory: 508M + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /var/lib/mysql + name: datadir + - args: + - mysqld + command: + - /var/lib/mysql/pxc-entrypoint.sh + env: + - name: PXC_SERVICE + value: monitoring-pxc-unready + - name: MONITOR_HOST + value: '%' + - name: MYSQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + key: root + name: internal-monitoring + - name: XTRABACKUP_PASSWORD + valueFrom: + secretKeyRef: + key: xtrabackup + name: internal-monitoring + - name: MONITOR_PASSWORD + valueFrom: + secretKeyRef: + key: monitor + name: internal-monitoring + - name: OPERATOR_ADMIN_PASSWORD + valueFrom: + secretKeyRef: + key: operator + name: internal-monitoring + - name: LIVENESS_CHECK_TIMEOUT + value: "5" + - name: READINESS_CHECK_TIMEOUT + value: "15" + - name: DEFAULT_AUTHENTICATION_PLUGIN + value: caching_sha2_password + envFrom: + - secretRef: + name: my-env-var-secrets + optional: true + imagePullPolicy: Always + livenessProbe: + exec: + command: + - /var/lib/mysql/liveness-check.sh + failureThreshold: 3 + initialDelaySeconds: 300 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + name: pxc + ports: + - containerPort: 3306 + name: mysql + protocol: TCP + - containerPort: 4444 + name: sst + protocol: TCP + - containerPort: 4567 + name: write-set + protocol: TCP + - containerPort: 4568 + name: ist + protocol: TCP + - containerPort: 33062 + name: mysql-admin + protocol: TCP + - containerPort: 33060 + name: mysqlx + protocol: TCP + readinessProbe: + exec: + command: + - /var/lib/mysql/readiness-check.sh + failureThreshold: 5 + initialDelaySeconds: 15 + periodSeconds: 30 + successThreshold: 1 + timeoutSeconds: 15 + resources: + requests: + cpu: 300m + memory: 500M + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /var/lib/mysql + name: datadir + - mountPath: /etc/percona-xtradb-cluster.conf.d + name: config + - mountPath: /tmp + name: tmp + - mountPath: /etc/mysql/ssl + name: ssl + - mountPath: /etc/mysql/ssl-internal + name: ssl-internal + - mountPath: /etc/mysql/mysql-users-secret + name: mysql-users-secret-file + - mountPath: /etc/my.cnf.d + name: auto-config + - mountPath: /etc/mysql/vault-keyring-secret + name: vault-keyring-secret + - mountPath: /etc/mysql/init-file + name: mysql-init-file + dnsPolicy: ClusterFirst + initContainers: + - command: + - /pxc-init-entrypoint.sh + imagePullPolicy: Always + name: pxc-init + resources: + limits: + cpu: 50m + memory: 50M + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /var/lib/mysql + name: datadir + restartPolicy: Always + schedulerName: default-scheduler + securityContext: + supplementalGroups: + - 1001 + serviceAccount: default + serviceAccountName: default + terminationGracePeriodSeconds: 600 + volumes: + - emptyDir: {} + name: tmp + - configMap: + defaultMode: 420 + name: monitoring-pxc + optional: true + name: config + - name: ssl-internal + secret: + defaultMode: 420 + optional: true + secretName: monitoring-ssl-internal + - name: ssl + secret: + defaultMode: 420 + optional: false + secretName: some-name-ssl + - configMap: + defaultMode: 420 + name: auto-monitoring-pxc + optional: true + name: auto-config + - name: vault-keyring-secret + secret: + defaultMode: 420 + optional: true + secretName: monitoring-vault + - name: mysql-users-secret-file + secret: + defaultMode: 420 + optional: false + secretName: internal-monitoring + - name: mysql-init-file + secret: + defaultMode: 420 + optional: true + secretName: monitoring-mysql-init + updateStrategy: + rollingUpdate: + partition: 0 + type: RollingUpdate + volumeClaimTemplates: + - metadata: + name: datadir + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 2Gi + status: + phase: Pending diff --git a/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc-no-prefix-k127.yml b/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc-no-prefix-k127.yml new file mode 100644 index 0000000000..83e7740b2e --- /dev/null +++ b/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc-no-prefix-k127.yml @@ -0,0 +1,350 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + generation: 2 + name: monitoring-pxc + ownerReferences: + - controller: true + kind: PerconaXtraDBCluster + name: monitoring +spec: + persistentVolumeClaimRetentionPolicy: + whenDeleted: Retain + whenScaled: Retain + podManagementPolicy: OrderedReady + replicas: 3 + revisionHistoryLimit: 10 + selector: + matchLabels: + app.kubernetes.io/component: pxc + app.kubernetes.io/instance: monitoring + app.kubernetes.io/managed-by: percona-xtradb-cluster-operator + app.kubernetes.io/name: percona-xtradb-cluster + app.kubernetes.io/part-of: percona-xtradb-cluster + serviceName: monitoring-pxc + template: + metadata: + labels: + app.kubernetes.io/component: pxc + app.kubernetes.io/instance: monitoring + app.kubernetes.io/managed-by: percona-xtradb-cluster-operator + app.kubernetes.io/name: percona-xtradb-cluster + app.kubernetes.io/part-of: percona-xtradb-cluster + spec: + containers: + - env: + - name: PMM_SERVER + value: monitoring-service + - name: PMM_USER + value: api_key + - name: PMM_PASSWORD + valueFrom: + secretKeyRef: + key: pmmserverkey + name: internal-monitoring + - name: CLIENT_PORT_LISTEN + value: "7777" + - name: CLIENT_PORT_MIN + value: "30100" + - name: CLIENT_PORT_MAX + value: "30105" + - name: POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + - name: POD_NAMESPASE + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + - name: PMM_AGENT_SERVER_ADDRESS + value: monitoring-service + - name: PMM_AGENT_SERVER_USERNAME + value: api_key + - name: PMM_AGENT_SERVER_PASSWORD + valueFrom: + secretKeyRef: + key: pmmserverkey + name: internal-monitoring + - name: PMM_AGENT_LISTEN_PORT + value: "7777" + - name: PMM_AGENT_PORTS_MIN + value: "30100" + - name: PMM_AGENT_PORTS_MAX + value: "30105" + - name: PMM_AGENT_CONFIG_FILE + value: /usr/local/percona/pmm2/config/pmm-agent.yaml + - name: PMM_AGENT_SERVER_INSECURE_TLS + value: "1" + - name: PMM_AGENT_LISTEN_ADDRESS + value: 0.0.0.0 + - name: PMM_AGENT_SETUP_METRICS_MODE + value: push + - name: PMM_AGENT_SETUP + value: "1" + - name: PMM_AGENT_SETUP_FORCE + value: "1" + - name: PMM_AGENT_SETUP_NODE_TYPE + value: container + - name: PMM_AGENT_SETUP_NODE_NAME + value: $(POD_NAMESPASE)-$(POD_NAME) + - name: DB_TYPE + value: mysql + - name: DB_USER + value: monitor + - name: DB_PASSWORD + valueFrom: + secretKeyRef: + key: monitor + name: internal-monitoring + - name: DB_ARGS + value: --query-source=perfschema + - name: DB_CLUSTER + value: pxc + - name: DB_HOST + value: localhost + - name: DB_PORT + value: "33062" + - name: CLUSTER_NAME + value: monitoring + - name: PMM_ADMIN_CUSTOM_PARAMS + value: --disable-tablestats-limit=2000 + - name: PMM_AGENT_PRERUN_SCRIPT + value: /var/lib/mysql/pmm-prerun.sh + - name: PMM_AGENT_SIDECAR + value: "true" + - name: PMM_AGENT_SIDECAR_SLEEP + value: "5" + - name: PMM_AGENT_PATHS_TEMPDIR + value: /tmp + envFrom: + - secretRef: + name: my-env-var-secrets + optional: true + imagePullPolicy: Always + lifecycle: + preStop: + exec: + command: + - bash + - -c + - pmm-admin unregister --force + livenessProbe: + failureThreshold: 3 + httpGet: + path: /local/Status + port: 7777 + scheme: HTTP + initialDelaySeconds: 60 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + name: pmm-client + ports: + - containerPort: 7777 + protocol: TCP + - containerPort: 30100 + protocol: TCP + - containerPort: 30101 + protocol: TCP + - containerPort: 30102 + protocol: TCP + - containerPort: 30103 + protocol: TCP + - containerPort: 30104 + protocol: TCP + - containerPort: 30105 + protocol: TCP + resources: + limits: + cpu: "1" + memory: 1G + requests: + cpu: 308m + memory: 508M + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /var/lib/mysql + name: datadir + - args: + - mysqld + command: + - /var/lib/mysql/pxc-entrypoint.sh + env: + - name: PXC_SERVICE + value: monitoring-pxc-unready + - name: MONITOR_HOST + value: '%' + - name: MYSQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + key: root + name: internal-monitoring + - name: XTRABACKUP_PASSWORD + valueFrom: + secretKeyRef: + key: xtrabackup + name: internal-monitoring + - name: MONITOR_PASSWORD + valueFrom: + secretKeyRef: + key: monitor + name: internal-monitoring + - name: OPERATOR_ADMIN_PASSWORD + valueFrom: + secretKeyRef: + key: operator + name: internal-monitoring + - name: LIVENESS_CHECK_TIMEOUT + value: "5" + - name: READINESS_CHECK_TIMEOUT + value: "15" + - name: DEFAULT_AUTHENTICATION_PLUGIN + value: caching_sha2_password + envFrom: + - secretRef: + name: my-env-var-secrets + optional: true + imagePullPolicy: Always + livenessProbe: + exec: + command: + - /var/lib/mysql/liveness-check.sh + failureThreshold: 3 + initialDelaySeconds: 300 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + name: pxc + ports: + - containerPort: 3306 + name: mysql + protocol: TCP + - containerPort: 4444 + name: sst + protocol: TCP + - containerPort: 4567 + name: write-set + protocol: TCP + - containerPort: 4568 + name: ist + protocol: TCP + - containerPort: 33062 + name: mysql-admin + protocol: TCP + - containerPort: 33060 + name: mysqlx + protocol: TCP + readinessProbe: + exec: + command: + - /var/lib/mysql/readiness-check.sh + failureThreshold: 5 + initialDelaySeconds: 15 + periodSeconds: 30 + successThreshold: 1 + timeoutSeconds: 15 + resources: + requests: + cpu: 300m + memory: 500M + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /var/lib/mysql + name: datadir + - mountPath: /etc/percona-xtradb-cluster.conf.d + name: config + - mountPath: /tmp + name: tmp + - mountPath: /etc/mysql/ssl + name: ssl + - mountPath: /etc/mysql/ssl-internal + name: ssl-internal + - mountPath: /etc/mysql/mysql-users-secret + name: mysql-users-secret-file + - mountPath: /etc/my.cnf.d + name: auto-config + - mountPath: /etc/mysql/vault-keyring-secret + name: vault-keyring-secret + - mountPath: /etc/mysql/init-file + name: mysql-init-file + dnsPolicy: ClusterFirst + initContainers: + - command: + - /pxc-init-entrypoint.sh + imagePullPolicy: Always + name: pxc-init + resources: + limits: + cpu: 50m + memory: 50M + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /var/lib/mysql + name: datadir + restartPolicy: Always + schedulerName: default-scheduler + securityContext: + fsGroup: 1001 + supplementalGroups: + - 1001 + serviceAccount: default + serviceAccountName: default + terminationGracePeriodSeconds: 600 + volumes: + - emptyDir: {} + name: tmp + - configMap: + defaultMode: 420 + name: monitoring-pxc + optional: true + name: config + - name: ssl-internal + secret: + defaultMode: 420 + optional: true + secretName: monitoring-ssl-internal + - name: ssl + secret: + defaultMode: 420 + optional: false + secretName: some-name-ssl + - configMap: + defaultMode: 420 + name: auto-monitoring-pxc + optional: true + name: auto-config + - name: vault-keyring-secret + secret: + defaultMode: 420 + optional: true + secretName: monitoring-vault + - name: mysql-users-secret-file + secret: + defaultMode: 420 + optional: false + secretName: internal-monitoring + - name: mysql-init-file + secret: + defaultMode: 420 + optional: true + secretName: monitoring-mysql-init + updateStrategy: + rollingUpdate: + partition: 0 + type: RollingUpdate + volumeClaimTemplates: + - metadata: + name: datadir + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 2Gi + status: + phase: Pending diff --git a/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc-no-prefix-oc.yml b/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc-no-prefix-oc.yml new file mode 100644 index 0000000000..919b5f6578 --- /dev/null +++ b/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc-no-prefix-oc.yml @@ -0,0 +1,346 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + generation: 2 + name: monitoring-pxc + ownerReferences: + - controller: true + kind: PerconaXtraDBCluster + name: monitoring +spec: + podManagementPolicy: OrderedReady + replicas: 3 + revisionHistoryLimit: 10 + selector: + matchLabels: + app.kubernetes.io/component: pxc + app.kubernetes.io/instance: monitoring + app.kubernetes.io/managed-by: percona-xtradb-cluster-operator + app.kubernetes.io/name: percona-xtradb-cluster + app.kubernetes.io/part-of: percona-xtradb-cluster + serviceName: monitoring-pxc + template: + metadata: + labels: + app.kubernetes.io/component: pxc + app.kubernetes.io/instance: monitoring + app.kubernetes.io/managed-by: percona-xtradb-cluster-operator + app.kubernetes.io/name: percona-xtradb-cluster + app.kubernetes.io/part-of: percona-xtradb-cluster + spec: + containers: + - env: + - name: PMM_SERVER + value: monitoring-service + - name: PMM_USER + value: api_key + - name: PMM_PASSWORD + valueFrom: + secretKeyRef: + key: pmmserverkey + name: internal-monitoring + - name: CLIENT_PORT_LISTEN + value: "7777" + - name: CLIENT_PORT_MIN + value: "30100" + - name: CLIENT_PORT_MAX + value: "30105" + - name: POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + - name: POD_NAMESPASE + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + - name: PMM_AGENT_SERVER_ADDRESS + value: monitoring-service + - name: PMM_AGENT_SERVER_USERNAME + value: api_key + - name: PMM_AGENT_SERVER_PASSWORD + valueFrom: + secretKeyRef: + key: pmmserverkey + name: internal-monitoring + - name: PMM_AGENT_LISTEN_PORT + value: "7777" + - name: PMM_AGENT_PORTS_MIN + value: "30100" + - name: PMM_AGENT_PORTS_MAX + value: "30105" + - name: PMM_AGENT_CONFIG_FILE + value: /usr/local/percona/pmm2/config/pmm-agent.yaml + - name: PMM_AGENT_SERVER_INSECURE_TLS + value: "1" + - name: PMM_AGENT_LISTEN_ADDRESS + value: 0.0.0.0 + - name: PMM_AGENT_SETUP_METRICS_MODE + value: push + - name: PMM_AGENT_SETUP + value: "1" + - name: PMM_AGENT_SETUP_FORCE + value: "1" + - name: PMM_AGENT_SETUP_NODE_TYPE + value: container + - name: PMM_AGENT_SETUP_NODE_NAME + value: $(POD_NAMESPASE)-$(POD_NAME) + - name: DB_TYPE + value: mysql + - name: DB_USER + value: monitor + - name: DB_PASSWORD + valueFrom: + secretKeyRef: + key: monitor + name: internal-monitoring + - name: DB_ARGS + value: --query-source=perfschema + - name: DB_CLUSTER + value: pxc + - name: DB_HOST + value: localhost + - name: DB_PORT + value: "33062" + - name: CLUSTER_NAME + value: monitoring + - name: PMM_ADMIN_CUSTOM_PARAMS + value: --disable-tablestats-limit=2000 + - name: PMM_AGENT_PRERUN_SCRIPT + value: /var/lib/mysql/pmm-prerun.sh + - name: PMM_AGENT_SIDECAR + value: "true" + - name: PMM_AGENT_SIDECAR_SLEEP + value: "5" + - name: PMM_AGENT_PATHS_TEMPDIR + value: /tmp + envFrom: + - secretRef: + name: my-env-var-secrets + optional: true + imagePullPolicy: Always + lifecycle: + preStop: + exec: + command: + - bash + - -c + - pmm-admin unregister --force + livenessProbe: + failureThreshold: 3 + httpGet: + path: /local/Status + port: 7777 + scheme: HTTP + initialDelaySeconds: 60 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + name: pmm-client + ports: + - containerPort: 7777 + protocol: TCP + - containerPort: 30100 + protocol: TCP + - containerPort: 30101 + protocol: TCP + - containerPort: 30102 + protocol: TCP + - containerPort: 30103 + protocol: TCP + - containerPort: 30104 + protocol: TCP + - containerPort: 30105 + protocol: TCP + resources: + limits: + cpu: "1" + memory: 1G + requests: + cpu: 308m + memory: 508M + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /var/lib/mysql + name: datadir + - args: + - mysqld + command: + - /var/lib/mysql/pxc-entrypoint.sh + env: + - name: PXC_SERVICE + value: monitoring-pxc-unready + - name: MONITOR_HOST + value: '%' + - name: MYSQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + key: root + name: internal-monitoring + - name: XTRABACKUP_PASSWORD + valueFrom: + secretKeyRef: + key: xtrabackup + name: internal-monitoring + - name: MONITOR_PASSWORD + valueFrom: + secretKeyRef: + key: monitor + name: internal-monitoring + - name: OPERATOR_ADMIN_PASSWORD + valueFrom: + secretKeyRef: + key: operator + name: internal-monitoring + - name: LIVENESS_CHECK_TIMEOUT + value: "5" + - name: READINESS_CHECK_TIMEOUT + value: "15" + - name: DEFAULT_AUTHENTICATION_PLUGIN + value: caching_sha2_password + envFrom: + - secretRef: + name: my-env-var-secrets + optional: true + imagePullPolicy: Always + livenessProbe: + exec: + command: + - /var/lib/mysql/liveness-check.sh + failureThreshold: 3 + initialDelaySeconds: 300 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + name: pxc + ports: + - containerPort: 3306 + name: mysql + protocol: TCP + - containerPort: 4444 + name: sst + protocol: TCP + - containerPort: 4567 + name: write-set + protocol: TCP + - containerPort: 4568 + name: ist + protocol: TCP + - containerPort: 33062 + name: mysql-admin + protocol: TCP + - containerPort: 33060 + name: mysqlx + protocol: TCP + readinessProbe: + exec: + command: + - /var/lib/mysql/readiness-check.sh + failureThreshold: 5 + initialDelaySeconds: 15 + periodSeconds: 30 + successThreshold: 1 + timeoutSeconds: 15 + resources: + requests: + cpu: 300m + memory: 500M + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /var/lib/mysql + name: datadir + - mountPath: /etc/percona-xtradb-cluster.conf.d + name: config + - mountPath: /tmp + name: tmp + - mountPath: /etc/mysql/ssl + name: ssl + - mountPath: /etc/mysql/ssl-internal + name: ssl-internal + - mountPath: /etc/mysql/mysql-users-secret + name: mysql-users-secret-file + - mountPath: /etc/my.cnf.d + name: auto-config + - mountPath: /etc/mysql/vault-keyring-secret + name: vault-keyring-secret + - mountPath: /etc/mysql/init-file + name: mysql-init-file + dnsPolicy: ClusterFirst + initContainers: + - command: + - /pxc-init-entrypoint.sh + imagePullPolicy: Always + name: pxc-init + resources: + limits: + cpu: 50m + memory: 50M + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /var/lib/mysql + name: datadir + restartPolicy: Always + schedulerName: default-scheduler + securityContext: + supplementalGroups: + - 1001 + serviceAccount: default + serviceAccountName: default + terminationGracePeriodSeconds: 600 + volumes: + - emptyDir: {} + name: tmp + - configMap: + defaultMode: 420 + name: monitoring-pxc + optional: true + name: config + - name: ssl-internal + secret: + defaultMode: 420 + optional: true + secretName: monitoring-ssl-internal + - name: ssl + secret: + defaultMode: 420 + optional: false + secretName: some-name-ssl + - configMap: + defaultMode: 420 + name: auto-monitoring-pxc + optional: true + name: auto-config + - name: vault-keyring-secret + secret: + defaultMode: 420 + optional: true + secretName: monitoring-vault + - name: mysql-users-secret-file + secret: + defaultMode: 420 + optional: false + secretName: internal-monitoring + - name: mysql-init-file + secret: + defaultMode: 420 + optional: true + secretName: monitoring-mysql-init + updateStrategy: + rollingUpdate: + partition: 0 + type: RollingUpdate + volumeClaimTemplates: + - metadata: + name: datadir + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 2Gi + status: + phase: Pending diff --git a/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc-no-prefix.yml b/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc-no-prefix.yml new file mode 100644 index 0000000000..6cd12ab3f4 --- /dev/null +++ b/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc-no-prefix.yml @@ -0,0 +1,347 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + generation: 2 + name: monitoring-pxc + ownerReferences: + - controller: true + kind: PerconaXtraDBCluster + name: monitoring +spec: + podManagementPolicy: OrderedReady + replicas: 3 + revisionHistoryLimit: 10 + selector: + matchLabels: + app.kubernetes.io/component: pxc + app.kubernetes.io/instance: monitoring + app.kubernetes.io/managed-by: percona-xtradb-cluster-operator + app.kubernetes.io/name: percona-xtradb-cluster + app.kubernetes.io/part-of: percona-xtradb-cluster + serviceName: monitoring-pxc + template: + metadata: + labels: + app.kubernetes.io/component: pxc + app.kubernetes.io/instance: monitoring + app.kubernetes.io/managed-by: percona-xtradb-cluster-operator + app.kubernetes.io/name: percona-xtradb-cluster + app.kubernetes.io/part-of: percona-xtradb-cluster + spec: + containers: + - env: + - name: PMM_SERVER + value: monitoring-service + - name: PMM_USER + value: api_key + - name: PMM_PASSWORD + valueFrom: + secretKeyRef: + key: pmmserverkey + name: internal-monitoring + - name: CLIENT_PORT_LISTEN + value: "7777" + - name: CLIENT_PORT_MIN + value: "30100" + - name: CLIENT_PORT_MAX + value: "30105" + - name: POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + - name: POD_NAMESPASE + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + - name: PMM_AGENT_SERVER_ADDRESS + value: monitoring-service + - name: PMM_AGENT_SERVER_USERNAME + value: api_key + - name: PMM_AGENT_SERVER_PASSWORD + valueFrom: + secretKeyRef: + key: pmmserverkey + name: internal-monitoring + - name: PMM_AGENT_LISTEN_PORT + value: "7777" + - name: PMM_AGENT_PORTS_MIN + value: "30100" + - name: PMM_AGENT_PORTS_MAX + value: "30105" + - name: PMM_AGENT_CONFIG_FILE + value: /usr/local/percona/pmm2/config/pmm-agent.yaml + - name: PMM_AGENT_SERVER_INSECURE_TLS + value: "1" + - name: PMM_AGENT_LISTEN_ADDRESS + value: 0.0.0.0 + - name: PMM_AGENT_SETUP_METRICS_MODE + value: push + - name: PMM_AGENT_SETUP + value: "1" + - name: PMM_AGENT_SETUP_FORCE + value: "1" + - name: PMM_AGENT_SETUP_NODE_TYPE + value: container + - name: PMM_AGENT_SETUP_NODE_NAME + value: $(POD_NAMESPASE)-$(POD_NAME) + - name: DB_TYPE + value: mysql + - name: DB_USER + value: monitor + - name: DB_PASSWORD + valueFrom: + secretKeyRef: + key: monitor + name: internal-monitoring + - name: DB_ARGS + value: --query-source=perfschema + - name: DB_CLUSTER + value: pxc + - name: DB_HOST + value: localhost + - name: DB_PORT + value: "33062" + - name: CLUSTER_NAME + value: monitoring + - name: PMM_ADMIN_CUSTOM_PARAMS + value: --disable-tablestats-limit=2000 + - name: PMM_AGENT_PRERUN_SCRIPT + value: /var/lib/mysql/pmm-prerun.sh + - name: PMM_AGENT_SIDECAR + value: "true" + - name: PMM_AGENT_SIDECAR_SLEEP + value: "5" + - name: PMM_AGENT_PATHS_TEMPDIR + value: /tmp + envFrom: + - secretRef: + name: my-env-var-secrets + optional: true + imagePullPolicy: Always + lifecycle: + preStop: + exec: + command: + - bash + - -c + - pmm-admin unregister --force + livenessProbe: + failureThreshold: 3 + httpGet: + path: /local/Status + port: 7777 + scheme: HTTP + initialDelaySeconds: 60 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + name: pmm-client + ports: + - containerPort: 7777 + protocol: TCP + - containerPort: 30100 + protocol: TCP + - containerPort: 30101 + protocol: TCP + - containerPort: 30102 + protocol: TCP + - containerPort: 30103 + protocol: TCP + - containerPort: 30104 + protocol: TCP + - containerPort: 30105 + protocol: TCP + resources: + limits: + cpu: "1" + memory: 1G + requests: + cpu: 308m + memory: 508M + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /var/lib/mysql + name: datadir + - args: + - mysqld + command: + - /var/lib/mysql/pxc-entrypoint.sh + env: + - name: PXC_SERVICE + value: monitoring-pxc-unready + - name: MONITOR_HOST + value: '%' + - name: MYSQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + key: root + name: internal-monitoring + - name: XTRABACKUP_PASSWORD + valueFrom: + secretKeyRef: + key: xtrabackup + name: internal-monitoring + - name: MONITOR_PASSWORD + valueFrom: + secretKeyRef: + key: monitor + name: internal-monitoring + - name: OPERATOR_ADMIN_PASSWORD + valueFrom: + secretKeyRef: + key: operator + name: internal-monitoring + - name: LIVENESS_CHECK_TIMEOUT + value: "5" + - name: READINESS_CHECK_TIMEOUT + value: "15" + - name: DEFAULT_AUTHENTICATION_PLUGIN + value: caching_sha2_password + envFrom: + - secretRef: + name: my-env-var-secrets + optional: true + imagePullPolicy: Always + livenessProbe: + exec: + command: + - /var/lib/mysql/liveness-check.sh + failureThreshold: 3 + initialDelaySeconds: 300 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + name: pxc + ports: + - containerPort: 3306 + name: mysql + protocol: TCP + - containerPort: 4444 + name: sst + protocol: TCP + - containerPort: 4567 + name: write-set + protocol: TCP + - containerPort: 4568 + name: ist + protocol: TCP + - containerPort: 33062 + name: mysql-admin + protocol: TCP + - containerPort: 33060 + name: mysqlx + protocol: TCP + readinessProbe: + exec: + command: + - /var/lib/mysql/readiness-check.sh + failureThreshold: 5 + initialDelaySeconds: 15 + periodSeconds: 30 + successThreshold: 1 + timeoutSeconds: 15 + resources: + requests: + cpu: 300m + memory: 500M + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /var/lib/mysql + name: datadir + - mountPath: /etc/percona-xtradb-cluster.conf.d + name: config + - mountPath: /tmp + name: tmp + - mountPath: /etc/mysql/ssl + name: ssl + - mountPath: /etc/mysql/ssl-internal + name: ssl-internal + - mountPath: /etc/mysql/mysql-users-secret + name: mysql-users-secret-file + - mountPath: /etc/my.cnf.d + name: auto-config + - mountPath: /etc/mysql/vault-keyring-secret + name: vault-keyring-secret + - mountPath: /etc/mysql/init-file + name: mysql-init-file + dnsPolicy: ClusterFirst + initContainers: + - command: + - /pxc-init-entrypoint.sh + imagePullPolicy: Always + name: pxc-init + resources: + limits: + cpu: 50m + memory: 50M + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /var/lib/mysql + name: datadir + restartPolicy: Always + schedulerName: default-scheduler + securityContext: + fsGroup: 1001 + supplementalGroups: + - 1001 + serviceAccount: default + serviceAccountName: default + terminationGracePeriodSeconds: 600 + volumes: + - emptyDir: {} + name: tmp + - configMap: + defaultMode: 420 + name: monitoring-pxc + optional: true + name: config + - name: ssl-internal + secret: + defaultMode: 420 + optional: true + secretName: monitoring-ssl-internal + - name: ssl + secret: + defaultMode: 420 + optional: false + secretName: some-name-ssl + - configMap: + defaultMode: 420 + name: auto-monitoring-pxc + optional: true + name: auto-config + - name: vault-keyring-secret + secret: + defaultMode: 420 + optional: true + secretName: monitoring-vault + - name: mysql-users-secret-file + secret: + defaultMode: 420 + optional: false + secretName: internal-monitoring + - name: mysql-init-file + secret: + defaultMode: 420 + optional: true + secretName: monitoring-mysql-init + updateStrategy: + rollingUpdate: + partition: 0 + type: RollingUpdate + volumeClaimTemplates: + - metadata: + name: datadir + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 2Gi + status: + phase: Pending diff --git a/e2e-tests/monitoring-2-0/run b/e2e-tests/monitoring-2-0/run index b9d8c90bcc..f04d0790ed 100755 --- a/e2e-tests/monitoring-2-0/run +++ b/e2e-tests/monitoring-2-0/run @@ -65,7 +65,6 @@ sleep 5 kubectl_bin exec monitoring-0 -- bash -c "grafana-cli --homepath=/usr/share/grafana --config=/etc/grafana/grafana.ini admin reset-admin-password $ADMIN_PASSWORD" desc 'create PXC cluster' -kubectl_bin apply -f "$test_dir/conf/envsecrets.yaml" spinup_pxc "$cluster" "$test_dir/conf/$cluster.yml" 3 120 "$test_dir/conf/secrets.yaml" desc 'add PMM API key to secret' @@ -78,6 +77,12 @@ sleep 10 kubectl wait pod -l 'app.kubernetes.io/managed-by=percona-xtradb-cluster-operator' --for=condition=ready --timeout=600s wait_cluster_consistency ${cluster} 3 2 +compare_kubectl statefulset/$cluster-pxc "-no-prefix" +compare_kubectl statefulset/$cluster-haproxy "-no-prefix" + +desc 'apply my-env-var-secrets to add PMM_PREFIX' +kubectl_bin apply -f "$test_dir/conf/envsecrets.yaml" + desc 'add new PMM API key to secret' API_KEY_NEW=$(curl --insecure -X POST -H "Content-Type: application/json" -d '{"name":"operator-new", "role": "Admin"}' "https://admin:$ADMIN_PASSWORD@$(get_service_endpoint monitoring-service)/graph/api/auth/keys" | jq .key) kubectl_bin patch secret my-cluster-secrets --type merge --patch '{"stringData": {"pmmserverkey": '"$API_KEY_NEW"'}}' @@ -97,7 +102,7 @@ compare_kubectl statefulset/$cluster-haproxy desc 'verify clients agents statuses' # wait for proper agents statuses -sleep 240 +sleep 300 API_KEY=$(getSecretData "my-cluster-secrets" "pmmserverkey") diff -u ${test_dir}/compare/agents-list.json $(get_mgmnt_service_list ${API_KEY} $(get_service_endpoint monitoring-service) ${namespace}) diff --git a/pkg/apis/pxc/v1/pxc_types.go b/pkg/apis/pxc/v1/pxc_types.go index 0dee265f76..fe4a97b726 100644 --- a/pkg/apis/pxc/v1/pxc_types.go +++ b/pkg/apis/pxc/v1/pxc_types.go @@ -3,6 +3,7 @@ package v1 import ( + "context" "os" "strings" @@ -18,6 +19,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/intstr" + "sigs.k8s.io/controller-runtime/pkg/client" "github.com/percona/percona-xtradb-cluster-operator/pkg/pxc/users" "github.com/percona/percona-xtradb-cluster-operator/pkg/util" @@ -720,7 +722,7 @@ var NoCustomVolumeErr = errors.New("no custom volume found") type App interface { AppContainer(spec *PodSpec, secrets string, cr *PerconaXtraDBCluster, availableVolumes []corev1.Volume) (corev1.Container, error) SidecarContainers(spec *PodSpec, secrets string, cr *PerconaXtraDBCluster) ([]corev1.Container, error) - PMMContainer(spec *PMMSpec, secret *corev1.Secret, cr *PerconaXtraDBCluster) (*corev1.Container, error) + PMMContainer(ctx context.Context, cl client.Client, spec *PMMSpec, secret *corev1.Secret, cr *PerconaXtraDBCluster) (*corev1.Container, error) LogCollectorContainer(spec *LogCollectorSpec, logPsecrets string, logRsecrets string, cr *PerconaXtraDBCluster) ([]corev1.Container, error) Volumes(podSpec *PodSpec, cr *PerconaXtraDBCluster, vg CustomVolumeGetter) (*Volume, error) Labels() map[string]string diff --git a/pkg/controller/pxc/controller.go b/pkg/controller/pxc/controller.go index cced298f16..2883c51d79 100644 --- a/pkg/controller/pxc/controller.go +++ b/pkg/controller/pxc/controller.go @@ -471,6 +471,13 @@ func (r *ReconcilePerconaXtraDBCluster) reconcileHAProxy(ctx context.Context, cr return nil } + envVarsSecret := new(corev1.Secret) + if err := r.client.Get(ctx, types.NamespacedName{ + Name: cr.Spec.HAProxy.EnvVarsSecretName, + Namespace: cr.Namespace, + }, envVarsSecret); client.IgnoreNotFound(err) != nil { + return errors.Wrap(err, "get haproxy env vars secret") + } sts := statefulset.NewHAProxy(cr) pxc.MergeTemplateAnnotations(sts.StatefulSet(), annotations) @@ -558,7 +565,7 @@ func (r *ReconcilePerconaXtraDBCluster) deploy(ctx context.Context, cr *api.Perc if client.IgnoreNotFound(err) != nil { return errors.Wrap(err, "get internal secret") } - nodeSet, err := pxc.StatefulSet(stsApp, cr.Spec.PXC.PodSpec, cr, secrets, inits, log, r.getConfigVolume) + nodeSet, err := pxc.StatefulSet(ctx, r.client, stsApp, cr.Spec.PXC.PodSpec, cr, secrets, inits, log, r.getConfigVolume) if err != nil { return errors.Wrap(err, "get pxc statefulset") } @@ -661,7 +668,7 @@ func (r *ReconcilePerconaXtraDBCluster) deploy(ctx context.Context, cr *api.Perc // HAProxy StatefulSet if cr.HAProxyEnabled() { sfsHAProxy := statefulset.NewHAProxy(cr) - haProxySet, err := pxc.StatefulSet(sfsHAProxy, &cr.Spec.HAProxy.PodSpec, cr, secrets, proxyInits, log, r.getConfigVolume) + haProxySet, err := pxc.StatefulSet(ctx, r.client, sfsHAProxy, &cr.Spec.HAProxy.PodSpec, cr, secrets, proxyInits, log, r.getConfigVolume) if err != nil { return errors.Wrap(err, "create HAProxy StatefulSet") } @@ -715,7 +722,7 @@ func (r *ReconcilePerconaXtraDBCluster) deploy(ctx context.Context, cr *api.Perc if cr.Spec.ProxySQLEnabled() { sfsProxy := statefulset.NewProxy(cr) - proxySet, err := pxc.StatefulSet(sfsProxy, &cr.Spec.ProxySQL.PodSpec, cr, secrets, proxyInits, log, r.getConfigVolume) + proxySet, err := pxc.StatefulSet(ctx, r.client, sfsProxy, &cr.Spec.ProxySQL.PodSpec, cr, secrets, proxyInits, log, r.getConfigVolume) if err != nil { return errors.Wrap(err, "create ProxySQL Service") } diff --git a/pkg/controller/pxc/upgrade.go b/pkg/controller/pxc/upgrade.go index 8f7c369f2f..3ba7094c5a 100644 --- a/pkg/controller/pxc/upgrade.go +++ b/pkg/controller/pxc/upgrade.go @@ -31,7 +31,7 @@ func (r *ReconcilePerconaXtraDBCluster) updatePod(ctx context.Context, sfs api.S currentSet := sfs.StatefulSet() newAnnotations := currentSet.Spec.Template.Annotations // need this step to save all new annotations that was set to currentSet in this reconcile loop - err := r.client.Get(context.TODO(), types.NamespacedName{Name: currentSet.Name, Namespace: currentSet.Namespace}, currentSet) + err := r.client.Get(ctx, types.NamespacedName{Name: currentSet.Name, Namespace: currentSet.Namespace}, currentSet) if err != nil { return errors.Wrap(err, "failed to get sate") } @@ -133,7 +133,7 @@ func (r *ReconcilePerconaXtraDBCluster) updatePod(ctx context.Context, sfs api.S } secret := new(corev1.Secret) - err = r.client.Get(context.TODO(), types.NamespacedName{ + err = r.client.Get(ctx, types.NamespacedName{ Name: secretsName, Namespace: cr.Namespace, }, secret) if client.IgnoreNotFound(err) != nil { @@ -141,7 +141,7 @@ func (r *ReconcilePerconaXtraDBCluster) updatePod(ctx context.Context, sfs api.S } // pmm container if cr.Spec.PMM != nil && cr.Spec.PMM.IsEnabled(secret) { - pmmC, err := sfs.PMMContainer(cr.Spec.PMM, secret, cr) + pmmC, err := sfs.PMMContainer(ctx, r.client, cr.Spec.PMM, secret, cr) if err != nil { return errors.Wrap(err, "pmm container error") } @@ -248,7 +248,7 @@ func (r *ReconcilePerconaXtraDBCluster) smartUpdate(ctx context.Context, sfs api time.Sleep(time.Second) currentSet := sfs.StatefulSet() - err := r.client.Get(context.TODO(), types.NamespacedName{ + err := r.client.Get(ctx, types.NamespacedName{ Name: currentSet.Name, Namespace: currentSet.Namespace, }, currentSet) @@ -257,7 +257,7 @@ func (r *ReconcilePerconaXtraDBCluster) smartUpdate(ctx context.Context, sfs api } list := corev1.PodList{} - if err := r.client.List(context.TODO(), + if err := r.client.List(ctx, &list, &client.ListOptions{ Namespace: currentSet.Namespace, @@ -345,7 +345,7 @@ func (r *ReconcilePerconaXtraDBCluster) applyNWait(ctx context.Context, cr *api. if pod.ObjectMeta.Labels["controller-revision-hash"] == sfs.Status.UpdateRevision { log.Info("pod already updated", "pod name", pod.Name) } else { - if err := r.client.Delete(context.TODO(), pod); err != nil { + if err := r.client.Delete(ctx, pod); err != nil { return errors.Wrap(err, "failed to delete pod") } } @@ -577,7 +577,7 @@ func (r *ReconcilePerconaXtraDBCluster) waitPXCSynced(cr *api.PerconaXtraDBClust func (r *ReconcilePerconaXtraDBCluster) waitPodRestart(ctx context.Context, cr *api.PerconaXtraDBCluster, updateRevision string, pod *corev1.Pod, waitLimit int) error { return retry(time.Second*10, time.Duration(waitLimit)*time.Second, func() (bool, error) { - err := r.client.Get(context.TODO(), types.NamespacedName{Name: pod.Name, Namespace: pod.Namespace}, pod) + err := r.client.Get(ctx, types.NamespacedName{Name: pod.Name, Namespace: pod.Namespace}, pod) if err != nil && !k8serrors.IsNotFound(err) { return false, errors.Wrap(err, "fetch pod") } diff --git a/pkg/pxc/app/pmm.go b/pkg/pxc/app/pmm.go index f61905cca7..f01f4ae9c2 100644 --- a/pkg/pxc/app/pmm.go +++ b/pkg/pxc/app/pmm.go @@ -8,7 +8,7 @@ import ( "github.com/percona/percona-xtradb-cluster-operator/pkg/pxc/users" ) -func PMMClient(cr *api.PerconaXtraDBCluster, spec *api.PMMSpec, secret *corev1.Secret) corev1.Container { +func PMMClient(cr *api.PerconaXtraDBCluster, spec *api.PMMSpec, secret *corev1.Secret, envVarsSecret *corev1.Secret) corev1.Container { ports := []corev1.ContainerPort{{ContainerPort: 7777}} for i := 30100; i <= 30105; i++ { @@ -69,9 +69,13 @@ func PMMClient(cr *api.PerconaXtraDBCluster, spec *api.PMMSpec, secret *corev1.S pmmAgentEnvs := pmmAgentEnvs(spec.ServerHost, spec.ServerUser, secret.Name, spec.UseAPI(secret)) if cr.CompareVersionWith("1.14.0") >= 0 { + val := "$(POD_NAMESPASE)-$(POD_NAME)" + if len(envVarsSecret.Data["PMM_PREFIX"]) > 0 { + val = "$(PMM_PREFIX)$(POD_NAMESPASE)-$(POD_NAME)" + } pmmAgentEnvs = append(pmmAgentEnvs, corev1.EnvVar{ Name: "PMM_AGENT_SETUP_NODE_NAME", - Value: "$(PMM_PREFIX)$(POD_NAMESPASE)-$(POD_NAME)", + Value: val, }) } else { pmmAgentEnvs = append(pmmAgentEnvs, corev1.EnvVar{ diff --git a/pkg/pxc/app/statefulset/haproxy.go b/pkg/pxc/app/statefulset/haproxy.go index 664ce203a1..6f317d6f6e 100644 --- a/pkg/pxc/app/statefulset/haproxy.go +++ b/pkg/pxc/app/statefulset/haproxy.go @@ -1,12 +1,15 @@ package statefulset import ( + "context" "fmt" "github.com/pkg/errors" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + "sigs.k8s.io/controller-runtime/pkg/client" api "github.com/percona/percona-xtradb-cluster-operator/pkg/apis/pxc/v1" app "github.com/percona/percona-xtradb-cluster-operator/pkg/pxc/app" @@ -294,12 +297,18 @@ func (c *HAProxy) LogCollectorContainer(_ *api.LogCollectorSpec, _ string, _ str return nil, nil } -func (c *HAProxy) PMMContainer(spec *api.PMMSpec, secret *corev1.Secret, cr *api.PerconaXtraDBCluster) (*corev1.Container, error) { +func (c *HAProxy) PMMContainer(ctx context.Context, cl client.Client, spec *api.PMMSpec, secret *corev1.Secret, cr *api.PerconaXtraDBCluster) (*corev1.Container, error) { if cr.CompareVersionWith("1.9.0") < 0 { return nil, nil } - ct := app.PMMClient(cr, spec, secret) + envVarsSecret := &corev1.Secret{} + err := cl.Get(ctx, types.NamespacedName{Name: cr.Spec.HAProxy.EnvVarsSecretName, Namespace: cr.Namespace}, envVarsSecret) + if client.IgnoreNotFound(err) != nil { + return nil, errors.Wrap(err, "get env vars secret") + } + + ct := app.PMMClient(cr, spec, secret, envVarsSecret) pmmEnvs := []corev1.EnvVar{ { diff --git a/pkg/pxc/app/statefulset/node.go b/pkg/pxc/app/statefulset/node.go index 37c4d461e7..298b02b0a8 100644 --- a/pkg/pxc/app/statefulset/node.go +++ b/pkg/pxc/app/statefulset/node.go @@ -1,17 +1,21 @@ package statefulset import ( + "context" "fmt" "hash/fnv" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + "sigs.k8s.io/controller-runtime/pkg/client" api "github.com/percona/percona-xtradb-cluster-operator/pkg/apis/pxc/v1" app "github.com/percona/percona-xtradb-cluster-operator/pkg/pxc/app" "github.com/percona/percona-xtradb-cluster-operator/pkg/pxc/app/config" "github.com/percona/percona-xtradb-cluster-operator/pkg/pxc/users" + "github.com/pkg/errors" ) const ( @@ -370,8 +374,14 @@ func (c *Node) LogCollectorContainer(spec *api.LogCollectorSpec, logPsecrets str return []corev1.Container{logProcContainer, logRotContainer}, nil } -func (c *Node) PMMContainer(spec *api.PMMSpec, secret *corev1.Secret, cr *api.PerconaXtraDBCluster) (*corev1.Container, error) { - ct := app.PMMClient(cr, spec, secret) +func (c *Node) PMMContainer(ctx context.Context, cl client.Client, spec *api.PMMSpec, secret *corev1.Secret, cr *api.PerconaXtraDBCluster) (*corev1.Container, error) { + envVarsSecret := &corev1.Secret{} + err := cl.Get(ctx, types.NamespacedName{Name: cr.Spec.PXC.EnvVarsSecretName, Namespace: cr.Namespace}, envVarsSecret) + if client.IgnoreNotFound(err) != nil { + return nil, errors.Wrap(err, "get env vars secret") + } + + ct := app.PMMClient(cr, spec, secret, envVarsSecret) pmmEnvs := []corev1.EnvVar{ { diff --git a/pkg/pxc/app/statefulset/proxysql.go b/pkg/pxc/app/statefulset/proxysql.go index 7e3f7f68f5..276dbb73c2 100644 --- a/pkg/pxc/app/statefulset/proxysql.go +++ b/pkg/pxc/app/statefulset/proxysql.go @@ -1,15 +1,18 @@ package statefulset import ( - "errors" + "context" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + "sigs.k8s.io/controller-runtime/pkg/client" api "github.com/percona/percona-xtradb-cluster-operator/pkg/apis/pxc/v1" app "github.com/percona/percona-xtradb-cluster-operator/pkg/pxc/app" "github.com/percona/percona-xtradb-cluster-operator/pkg/pxc/users" + "github.com/pkg/errors" ) const ( @@ -283,8 +286,14 @@ func (c *Proxy) LogCollectorContainer(_ *api.LogCollectorSpec, _ string, _ strin return nil, nil } -func (c *Proxy) PMMContainer(spec *api.PMMSpec, secret *corev1.Secret, cr *api.PerconaXtraDBCluster) (*corev1.Container, error) { - ct := app.PMMClient(cr, spec, secret) +func (c *Proxy) PMMContainer(ctx context.Context, cl client.Client, spec *api.PMMSpec, secret *corev1.Secret, cr *api.PerconaXtraDBCluster) (*corev1.Container, error) { + envVarsSecret := &corev1.Secret{} + err := cl.Get(ctx, types.NamespacedName{Name: cr.Spec.PXC.EnvVarsSecretName, Namespace: cr.Namespace}, envVarsSecret) + if client.IgnoreNotFound(err) != nil { + return nil, errors.Wrap(err, "get env vars secret") + } + + ct := app.PMMClient(cr, spec, secret, envVarsSecret) pmmEnvs := []corev1.EnvVar{ { diff --git a/pkg/pxc/statefulset.go b/pkg/pxc/statefulset.go index ea2852b75f..f7aee99e00 100644 --- a/pkg/pxc/statefulset.go +++ b/pkg/pxc/statefulset.go @@ -1,6 +1,7 @@ package pxc import ( + "context" "fmt" "strings" @@ -9,12 +10,13 @@ import ( appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "sigs.k8s.io/controller-runtime/pkg/client" api "github.com/percona/percona-xtradb-cluster-operator/pkg/apis/pxc/v1" ) // StatefulSet returns StatefulSet according for app to podSpec -func StatefulSet(sfs api.StatefulApp, podSpec *api.PodSpec, cr *api.PerconaXtraDBCluster, secret *corev1.Secret, +func StatefulSet(ctx context.Context, cl client.Client, sfs api.StatefulApp, podSpec *api.PodSpec, cr *api.PerconaXtraDBCluster, secret *corev1.Secret, initContainers []corev1.Container, log logr.Logger, vg api.CustomVolumeGetter, ) (*appsv1.StatefulSet, error) { pod := corev1.PodSpec{ @@ -58,7 +60,7 @@ func StatefulSet(sfs api.StatefulApp, podSpec *api.PodSpec, cr *api.PerconaXtraD log.Info(`Can't enable PMM: either "pmmserverkey" key doesn't exist in the secrets, or secrets and internal secrets are out of sync`, "secrets", cr.Spec.SecretsName, "internalSecrets", "internal-"+cr.Name) } else { - pmmC, err := sfs.PMMContainer(cr.Spec.PMM, secret, cr) + pmmC, err := sfs.PMMContainer(ctx, cl, cr.Spec.PMM, secret, cr) if err != nil { return nil, errors.Wrap(err, "pmm container error") } From 58baa81d4a391e3816759f27c82690b75780f800 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ege=20G=C3=BCne=C5=9F?= Date: Wed, 7 Feb 2024 11:25:57 +0300 Subject: [PATCH 4/4] Fix leader election ID (#1619) --- cmd/manager/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/manager/main.go b/cmd/manager/main.go index c3af90e9a6..8e80f5418c 100644 --- a/cmd/manager/main.go +++ b/cmd/manager/main.go @@ -92,7 +92,7 @@ func main() { }, HealthProbeBindAddress: probeAddr, LeaderElection: enableLeaderElection, - LeaderElectionID: "08db0feb.percona.com", + LeaderElectionID: "08db1feb.percona.com", WebhookServer: ctrlWebhook.NewServer(ctrlWebhook.Options{ Port: 9443, }),