diff --git a/config/crd/bases/pxc.percona.com_perconaxtradbclusters.yaml b/config/crd/bases/pxc.percona.com_perconaxtradbclusters.yaml index 27296db3a..f79927e7e 100644 --- a/config/crd/bases/pxc.percona.com_perconaxtradbclusters.yaml +++ b/config/crd/bases/pxc.percona.com_perconaxtradbclusters.yaml @@ -4338,10 +4338,172 @@ spec: type: string imagePullPolicy: type: string + livenessProbes: + properties: + exec: + properties: + command: + items: + type: string + type: array + x-kubernetes-list-type: atomic + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + default: "" + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + x-kubernetes-list-type: atomic + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object proxysqlParams: type: string pxcParams: type: string + readinessProbes: + properties: + exec: + properties: + command: + items: + type: string + type: array + x-kubernetes-list-type: atomic + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + default: "" + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + x-kubernetes-list-type: atomic + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object resources: properties: claims: diff --git a/deploy/bundle.yaml b/deploy/bundle.yaml index 433a815c7..4604da4fa 100644 --- a/deploy/bundle.yaml +++ b/deploy/bundle.yaml @@ -5243,10 +5243,172 @@ spec: type: string imagePullPolicy: type: string + livenessProbes: + properties: + exec: + properties: + command: + items: + type: string + type: array + x-kubernetes-list-type: atomic + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + default: "" + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + x-kubernetes-list-type: atomic + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object proxysqlParams: type: string pxcParams: type: string + readinessProbes: + properties: + exec: + properties: + command: + items: + type: string + type: array + x-kubernetes-list-type: atomic + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + default: "" + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + x-kubernetes-list-type: atomic + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object resources: properties: claims: diff --git a/deploy/cr.yaml b/deploy/cr.yaml index 625023462..152620d81 100644 --- a/deploy/cr.yaml +++ b/deploy/cr.yaml @@ -584,6 +584,18 @@ spec: # proxysqlParams: "--custom-labels=CUSTOM-LABELS" # containerSecurityContext: # privileged: false +# readinessProbes: +# initialDelaySeconds: 15 +# timeoutSeconds: 15 +# periodSeconds: 30 +# successThreshold: 1 +# failureThreshold: 5 +# livenessProbes: +# initialDelaySeconds: 300 +# timeoutSeconds: 5 +# periodSeconds: 10 +# successThreshold: 1 +# failureThreshold: 3 resources: requests: memory: 150M diff --git a/deploy/crd.yaml b/deploy/crd.yaml index 98e6861e7..63c7dcd41 100644 --- a/deploy/crd.yaml +++ b/deploy/crd.yaml @@ -5243,10 +5243,172 @@ spec: type: string imagePullPolicy: type: string + livenessProbes: + properties: + exec: + properties: + command: + items: + type: string + type: array + x-kubernetes-list-type: atomic + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + default: "" + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + x-kubernetes-list-type: atomic + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object proxysqlParams: type: string pxcParams: type: string + readinessProbes: + properties: + exec: + properties: + command: + items: + type: string + type: array + x-kubernetes-list-type: atomic + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + default: "" + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + x-kubernetes-list-type: atomic + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object resources: properties: claims: diff --git a/deploy/cw-bundle.yaml b/deploy/cw-bundle.yaml index 588c3c63c..f536667bd 100644 --- a/deploy/cw-bundle.yaml +++ b/deploy/cw-bundle.yaml @@ -5243,10 +5243,172 @@ spec: type: string imagePullPolicy: type: string + livenessProbes: + properties: + exec: + properties: + command: + items: + type: string + type: array + x-kubernetes-list-type: atomic + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + default: "" + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + x-kubernetes-list-type: atomic + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object proxysqlParams: type: string pxcParams: type: string + readinessProbes: + properties: + exec: + properties: + command: + items: + type: string + type: array + x-kubernetes-list-type: atomic + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + default: "" + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + x-kubernetes-list-type: atomic + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object resources: properties: claims: diff --git a/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-haproxy-k127.yml b/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-haproxy-k127.yml index c7cb0f448..7a45f22c3 100644 --- a/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-haproxy-k127.yml +++ b/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-haproxy-k127.yml @@ -141,7 +141,7 @@ spec: path: /local/Status port: 7777 scheme: HTTP - initialDelaySeconds: 60 + initialDelaySeconds: 300 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 5 @@ -161,6 +161,16 @@ spec: protocol: TCP - containerPort: 30105 protocol: TCP + readinessProbe: + failureThreshold: 5 + httpGet: + path: /local/Status + port: 7777 + scheme: HTTP + initialDelaySeconds: 15 + periodSeconds: 30 + successThreshold: 1 + timeoutSeconds: 15 resources: limits: cpu: "1" 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 index 525d5f0da..62c9b80a1 100644 --- 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 @@ -141,7 +141,7 @@ spec: path: /local/Status port: 7777 scheme: HTTP - initialDelaySeconds: 60 + initialDelaySeconds: 300 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 5 @@ -161,6 +161,16 @@ spec: protocol: TCP - containerPort: 30105 protocol: TCP + readinessProbe: + failureThreshold: 5 + httpGet: + path: /local/Status + port: 7777 + scheme: HTTP + initialDelaySeconds: 15 + periodSeconds: 30 + successThreshold: 1 + timeoutSeconds: 15 resources: limits: cpu: "1" diff --git a/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-haproxy-no-prefix-oc.yml b/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-haproxy-no-prefix-oc.yml index fb4991322..55ef6190c 100644 --- a/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-haproxy-no-prefix-oc.yml +++ b/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-haproxy-no-prefix-oc.yml @@ -138,7 +138,7 @@ spec: path: /local/Status port: 7777 scheme: HTTP - initialDelaySeconds: 60 + initialDelaySeconds: 300 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 5 @@ -158,6 +158,16 @@ spec: protocol: TCP - containerPort: 30105 protocol: TCP + readinessProbe: + failureThreshold: 5 + httpGet: + path: /local/Status + port: 7777 + scheme: HTTP + initialDelaySeconds: 15 + periodSeconds: 30 + successThreshold: 1 + timeoutSeconds: 15 resources: limits: cpu: "1" 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 index 938d4e949..929080838 100644 --- 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 @@ -138,7 +138,7 @@ spec: path: /local/Status port: 7777 scheme: HTTP - initialDelaySeconds: 60 + initialDelaySeconds: 300 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 5 @@ -158,6 +158,16 @@ spec: protocol: TCP - containerPort: 30105 protocol: TCP + readinessProbe: + failureThreshold: 5 + httpGet: + path: /local/Status + port: 7777 + scheme: HTTP + initialDelaySeconds: 15 + periodSeconds: 30 + successThreshold: 1 + timeoutSeconds: 15 resources: limits: cpu: "1" diff --git a/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-haproxy-oc.yml b/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-haproxy-oc.yml index f3954008d..20fd677b4 100644 --- a/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-haproxy-oc.yml +++ b/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-haproxy-oc.yml @@ -138,7 +138,7 @@ spec: path: /local/Status port: 7777 scheme: HTTP - initialDelaySeconds: 60 + initialDelaySeconds: 300 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 5 @@ -158,6 +158,16 @@ spec: protocol: TCP - containerPort: 30105 protocol: TCP + readinessProbe: + failureThreshold: 5 + httpGet: + path: /local/Status + port: 7777 + scheme: HTTP + initialDelaySeconds: 15 + periodSeconds: 30 + successThreshold: 1 + timeoutSeconds: 15 resources: limits: cpu: "1" diff --git a/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-haproxy.yml b/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-haproxy.yml index 95cc07e85..ef1023afa 100644 --- a/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-haproxy.yml +++ b/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-haproxy.yml @@ -138,7 +138,7 @@ spec: path: /local/Status port: 7777 scheme: HTTP - initialDelaySeconds: 60 + initialDelaySeconds: 300 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 5 @@ -158,6 +158,16 @@ spec: protocol: TCP - containerPort: 30105 protocol: TCP + readinessProbe: + failureThreshold: 5 + httpGet: + path: /local/Status + port: 7777 + scheme: HTTP + initialDelaySeconds: 15 + periodSeconds: 30 + successThreshold: 1 + timeoutSeconds: 15 resources: limits: cpu: "1" 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 index c6fe65dd4..b539466ee 100644 --- 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 @@ -136,7 +136,7 @@ spec: path: /local/Status port: 7777 scheme: HTTP - initialDelaySeconds: 60 + initialDelaySeconds: 300 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 5 @@ -156,6 +156,16 @@ spec: protocol: TCP - containerPort: 30105 protocol: TCP + readinessProbe: + failureThreshold: 5 + httpGet: + path: /local/Status + port: 7777 + scheme: HTTP + initialDelaySeconds: 15 + periodSeconds: 30 + successThreshold: 1 + timeoutSeconds: 15 resources: limits: cpu: "1" diff --git a/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc-k127-oc.yml b/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc-k127-oc.yml index 25bbe7949..cf1236e81 100644 --- a/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc-k127-oc.yml +++ b/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc-k127-oc.yml @@ -136,7 +136,7 @@ spec: path: /local/Status port: 7777 scheme: HTTP - initialDelaySeconds: 60 + initialDelaySeconds: 300 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 5 @@ -156,6 +156,16 @@ spec: protocol: TCP - containerPort: 30105 protocol: TCP + readinessProbe: + failureThreshold: 5 + httpGet: + path: /local/Status + port: 7777 + scheme: HTTP + initialDelaySeconds: 15 + periodSeconds: 30 + successThreshold: 1 + timeoutSeconds: 15 resources: limits: cpu: "1" diff --git a/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc-k127.yml b/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc-k127.yml index 967f865e9..be4b3f0d2 100644 --- a/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc-k127.yml +++ b/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc-k127.yml @@ -136,7 +136,7 @@ spec: path: /local/Status port: 7777 scheme: HTTP - initialDelaySeconds: 60 + initialDelaySeconds: 300 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 5 @@ -156,6 +156,16 @@ spec: protocol: TCP - containerPort: 30105 protocol: TCP + readinessProbe: + failureThreshold: 5 + httpGet: + path: /local/Status + port: 7777 + scheme: HTTP + initialDelaySeconds: 15 + periodSeconds: 30 + successThreshold: 1 + timeoutSeconds: 15 resources: limits: cpu: "1" diff --git a/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc-no-prefix-k127-oc.yml b/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc-no-prefix-k127-oc.yml index c6fe65dd4..b539466ee 100644 --- a/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc-no-prefix-k127-oc.yml +++ b/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc-no-prefix-k127-oc.yml @@ -136,7 +136,7 @@ spec: path: /local/Status port: 7777 scheme: HTTP - initialDelaySeconds: 60 + initialDelaySeconds: 300 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 5 @@ -156,6 +156,16 @@ spec: protocol: TCP - containerPort: 30105 protocol: TCP + readinessProbe: + failureThreshold: 5 + httpGet: + path: /local/Status + port: 7777 + scheme: HTTP + initialDelaySeconds: 15 + periodSeconds: 30 + successThreshold: 1 + timeoutSeconds: 15 resources: limits: cpu: "1" 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 index 020c50bd7..74cf56964 100644 --- 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 @@ -136,7 +136,7 @@ spec: path: /local/Status port: 7777 scheme: HTTP - initialDelaySeconds: 60 + initialDelaySeconds: 300 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 5 @@ -156,6 +156,16 @@ spec: protocol: TCP - containerPort: 30105 protocol: TCP + readinessProbe: + failureThreshold: 5 + httpGet: + path: /local/Status + port: 7777 + scheme: HTTP + initialDelaySeconds: 15 + periodSeconds: 30 + successThreshold: 1 + timeoutSeconds: 15 resources: limits: cpu: "1" 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 index 08bb15647..a6a17ba1d 100644 --- 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 @@ -133,7 +133,7 @@ spec: path: /local/Status port: 7777 scheme: HTTP - initialDelaySeconds: 60 + initialDelaySeconds: 300 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 5 @@ -153,6 +153,16 @@ spec: protocol: TCP - containerPort: 30105 protocol: TCP + readinessProbe: + failureThreshold: 5 + httpGet: + path: /local/Status + port: 7777 + scheme: HTTP + initialDelaySeconds: 15 + periodSeconds: 30 + successThreshold: 1 + timeoutSeconds: 15 resources: limits: cpu: "1" 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 index 1090678c4..0d8d9bd07 100644 --- 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 @@ -133,7 +133,7 @@ spec: path: /local/Status port: 7777 scheme: HTTP - initialDelaySeconds: 60 + initialDelaySeconds: 300 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 5 @@ -153,6 +153,16 @@ spec: protocol: TCP - containerPort: 30105 protocol: TCP + readinessProbe: + failureThreshold: 5 + httpGet: + path: /local/Status + port: 7777 + scheme: HTTP + initialDelaySeconds: 15 + periodSeconds: 30 + successThreshold: 1 + timeoutSeconds: 15 resources: limits: cpu: "1" diff --git a/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc-oc.yml b/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc-oc.yml index b6b8accb5..ed6d3f10b 100644 --- a/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc-oc.yml +++ b/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc-oc.yml @@ -133,7 +133,7 @@ spec: path: /local/Status port: 7777 scheme: HTTP - initialDelaySeconds: 60 + initialDelaySeconds: 300 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 5 @@ -153,6 +153,16 @@ spec: protocol: TCP - containerPort: 30105 protocol: TCP + readinessProbe: + failureThreshold: 5 + httpGet: + path: /local/Status + port: 7777 + scheme: HTTP + initialDelaySeconds: 15 + periodSeconds: 30 + successThreshold: 1 + timeoutSeconds: 15 resources: limits: cpu: "1" diff --git a/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc.yml b/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc.yml index ea1cabc2d..c95d713fd 100644 --- a/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc.yml +++ b/e2e-tests/monitoring-2-0/compare/statefulset_monitoring-pxc.yml @@ -133,7 +133,7 @@ spec: path: /local/Status port: 7777 scheme: HTTP - initialDelaySeconds: 60 + initialDelaySeconds: 300 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 5 @@ -153,6 +153,16 @@ spec: protocol: TCP - containerPort: 30105 protocol: TCP + readinessProbe: + failureThreshold: 5 + httpGet: + path: /local/Status + port: 7777 + scheme: HTTP + initialDelaySeconds: 15 + periodSeconds: 30 + successThreshold: 1 + timeoutSeconds: 15 resources: limits: cpu: "1" diff --git a/e2e-tests/monitoring-2-0/conf/monitoring.yml b/e2e-tests/monitoring-2-0/conf/monitoring.yml index 281308599..503379e7e 100644 --- a/e2e-tests/monitoring-2-0/conf/monitoring.yml +++ b/e2e-tests/monitoring-2-0/conf/monitoring.yml @@ -44,3 +44,15 @@ spec: requests: cpu: 308m memory: 508M + readinessProbes: + initialDelaySeconds: 15 + timeoutSeconds: 15 + periodSeconds: 30 + successThreshold: 1 + failureThreshold: 5 + livenessProbes: + initialDelaySeconds: 300 + timeoutSeconds: 5 + periodSeconds: 10 + successThreshold: 1 + failureThreshold: 3 diff --git a/pkg/apis/pxc/v1/pxc_types.go b/pkg/apis/pxc/v1/pxc_types.go index 5f36b75b5..df91b7c84 100644 --- a/pkg/apis/pxc/v1/pxc_types.go +++ b/pkg/apis/pxc/v1/pxc_types.go @@ -593,6 +593,8 @@ type PMMSpec struct { ContainerSecurityContext *corev1.SecurityContext `json:"containerSecurityContext,omitempty"` ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"` RuntimeClassName *string `json:"runtimeClassName,omitempty"` + LivenessProbes *corev1.Probe `json:"livenessProbes,omitempty"` + ReadinessProbes *corev1.Probe `json:"readinessProbes,omitempty"` } func (spec *PMMSpec) IsEnabled(secret *corev1.Secret) bool { diff --git a/pkg/apis/pxc/v1/zz_generated.deepcopy.go b/pkg/apis/pxc/v1/zz_generated.deepcopy.go index d5bac9b67..cbd0004d2 100644 --- a/pkg/apis/pxc/v1/zz_generated.deepcopy.go +++ b/pkg/apis/pxc/v1/zz_generated.deepcopy.go @@ -371,6 +371,16 @@ func (in *PMMSpec) DeepCopyInto(out *PMMSpec) { *out = new(string) **out = **in } + if in.LivenessProbes != nil { + in, out := &in.LivenessProbes, &out.LivenessProbes + *out = new(corev1.Probe) + (*in).DeepCopyInto(*out) + } + if in.ReadinessProbes != nil { + in, out := &in.ReadinessProbes, &out.ReadinessProbes + *out = new(corev1.Probe) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PMMSpec. diff --git a/pkg/pxc/app/pmm.go b/pkg/pxc/app/pmm.go index f01f4ae9c..cc9c41cee 100644 --- a/pkg/pxc/app/pmm.go +++ b/pkg/pxc/app/pmm.go @@ -1,6 +1,8 @@ package app import ( + "reflect" + corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/util/intstr" @@ -40,6 +42,26 @@ func PMMClient(cr *api.PerconaXtraDBCluster, spec *api.PMMSpec, secret *corev1.S if spec.ServerUser != "" { pmmEnvs = append(pmmEnvs, pmmEnvServerUser(spec.ServerUser, secret.Name, spec.UseAPI(secret))...) } + pmmEnvs = append(pmmEnvs, clientEnvs...) + + 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: val, + }) + } else { + pmmAgentEnvs = append(pmmAgentEnvs, corev1.EnvVar{ + Name: "PMM_AGENT_SETUP_NODE_NAME", + Value: "$(POD_NAMESPASE)-$(POD_NAME)", + }) + } + + pmmEnvs = append(pmmEnvs, pmmAgentEnvs...) container := corev1.Container{ Name: "pmm-client", @@ -47,15 +69,19 @@ func PMMClient(cr *api.PerconaXtraDBCluster, spec *api.PMMSpec, secret *corev1.S ImagePullPolicy: spec.ImagePullPolicy, Env: pmmEnvs, SecurityContext: spec.ContainerSecurityContext, - } - - if cr.CompareVersionWith("1.2.0") >= 0 { - container.Env = append(container.Env, clientEnvs...) - container.Ports = ports - } - - if cr.CompareVersionWith("1.7.0") >= 0 { - container.LivenessProbe = &corev1.Probe{ + Ports: ports, + Lifecycle: &corev1.Lifecycle{ + PreStop: &corev1.LifecycleHandler{ + Exec: &corev1.ExecAction{ + Command: []string{ + "bash", + "-c", + "pmm-admin unregister --force", + }, + }, + }, + }, + LivenessProbe: &corev1.Probe{ InitialDelaySeconds: 60, TimeoutSeconds: 5, PeriodSeconds: 10, @@ -65,54 +91,35 @@ func PMMClient(cr *api.PerconaXtraDBCluster, spec *api.PMMSpec, secret *corev1.S Path: "/local/Status", }, }, - } - - 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: val, - }) - } else { - pmmAgentEnvs = append(pmmAgentEnvs, corev1.EnvVar{ - Name: "PMM_AGENT_SETUP_NODE_NAME", - Value: "$(POD_NAMESPASE)-$(POD_NAME)", - }) - } - - container.Env = append(container.Env, pmmAgentEnvs...) - container.Lifecycle = &corev1.Lifecycle{ - PreStop: &corev1.LifecycleHandler{ - Exec: &corev1.ExecAction{ - // TODO https://jira.percona.com/browse/PMM-7010 - Command: []string{"bash", "-c", "pmm-admin inventory remove node --force $(pmm-admin status --json | python -c \"import sys, json; print(json.load(sys.stdin)['pmm_agent_status']['node_id'])\")"}, - }, - }, - } - } - - if cr.CompareVersionWith("1.13.0") >= 0 { - container.VolumeMounts = []corev1.VolumeMount{ + }, + VolumeMounts: []corev1.VolumeMount{ { Name: BinVolumeName, MountPath: "/var/lib/mysql", }, + }, + } + + if cr.CompareVersionWith("1.17.0") >= 0 { + if spec.LivenessProbes != nil { + container.LivenessProbe = spec.LivenessProbes + + if reflect.DeepEqual(container.LivenessProbe.ProbeHandler, corev1.ProbeHandler{}) { + container.LivenessProbe.ProbeHandler.HTTPGet = &corev1.HTTPGetAction{ + Port: intstr.FromInt(7777), + Path: "/local/Status", + } + } } + if spec.ReadinessProbes != nil { + container.ReadinessProbe = spec.ReadinessProbes - container.Lifecycle = &corev1.Lifecycle{ - PreStop: &corev1.LifecycleHandler{ - Exec: &corev1.ExecAction{ - Command: []string{ - "bash", - "-c", - "pmm-admin unregister --force", - }, - }, - }, + if reflect.DeepEqual(container.ReadinessProbe.ProbeHandler, corev1.ProbeHandler{}) { + container.ReadinessProbe.ProbeHandler.HTTPGet = &corev1.HTTPGetAction{ + Port: intstr.FromInt(7777), + Path: "/local/Status", + } + } } }