K8SPG-949: rancher support - #1737
Conversation
There was a problem hiding this comment.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
shfmt
[shfmt] reported by reviewdog 🐶
percona-postgresql-operator/e2e-tests/functions
Lines 2210 to 2211 in 51ab90d
[shfmt] reported by reviewdog 🐶
percona-postgresql-operator/e2e-tests/functions
Line 2213 in 51ab90d
[shfmt] reported by reviewdog 🐶
percona-postgresql-operator/e2e-tests/functions
Line 2216 in 51ab90d
[shfmt] reported by reviewdog 🐶
percona-postgresql-operator/e2e-tests/functions
Line 2224 in 51ab90d
[shfmt] reported by reviewdog 🐶
percona-postgresql-operator/e2e-tests/functions
Line 2241 in 51ab90d
[shfmt] reported by reviewdog 🐶
percona-postgresql-operator/e2e-tests/functions
Line 2254 in 51ab90d
[shfmt] reported by reviewdog 🐶
percona-postgresql-operator/e2e-tests/functions
Line 2270 in 51ab90d
[shfmt] reported by reviewdog 🐶
[shfmt] reported by reviewdog 🐶
[shfmt] reported by reviewdog 🐶
There was a problem hiding this comment.
Pull request overview
This PR updates the E2E test harness to better support Rancher (RKE2) and other platforms by centralizing platform detection, shifting monitoring checks to use LoadBalancer access, and replacing OS-dependent iptables test logic with NetworkPolicy/Chaos Mesh based approaches.
Changes:
- Centralized Kubernetes platform detection via
PLATFORMand updated tests/scripts to use it consistently. - Improved Rancher/OpenShift compatibility by replacing
iptables-based network manipulation with NetworkPolicy and Chaos Mesh bandwidth chaos, plus runtime-aware Chaos Mesh deployment. - Added reusable config/templates (Vault Helm values, CSR templates, monitoring QAN payload, hugepages manifests, snapshot/storage classes) and removed
vars.shdependency from the image build script.
Reviewed changes
Copilot reviewed 41 out of 42 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| e2e-tests/vars.sh | Adds detect_k8s_platform() and exports PLATFORM for consistent platform detection. |
| e2e-tests/tests/upgrade-minor/01-create-cluster.yaml | Switches OpenShift detection to PLATFORM == openshift. |
| e2e-tests/tests/standby-streaming/99-cleanup.yaml | Ensures Chaos Mesh is torn down during cleanup. |
| e2e-tests/tests/standby-streaming/05-standby-remove-lockdown.yaml | Removes iptables cleanup; deletes Chaos Mesh resources instead. |
| e2e-tests/tests/standby-streaming/05-assert.yaml | Reworks standby lag assertions to poll status via kubectl get ... -o json + jq. |
| e2e-tests/tests/standby-streaming/04-assert.yaml | Reworks lag-detected assertions to polling via jq. |
| e2e-tests/tests/standby-streaming/03-standby-lockdown.yaml | Replaces iptables-based throttling with Chaos Mesh network chaos helper. |
| e2e-tests/tests/standby-streaming/03-assert.yaml | Adds an assert step to wait for Chaos Mesh injection. |
| e2e-tests/tests/standby-streaming/02-create-standby-cluster.yaml | Removes the netshoot sidecar previously used for iptables. |
| e2e-tests/tests/standby-streaming/00-deploy-operator.yaml | Increases timeout and deploys Chaos Mesh for the test. |
| e2e-tests/tests/standby-pgbackrest/12-read-from-each-pod-standby.yaml | Minor formatting/line update in loop termination. |
| e2e-tests/tests/standby-pgbackrest/05-standby-remove-lockdown.yaml | Removes iptables cleanup; deletes NetworkPolicies. |
| e2e-tests/tests/standby-pgbackrest/05-assert.yaml | Reworks standby-ready assertions to polling via jq. |
| e2e-tests/tests/standby-pgbackrest/04-assert.yaml | Reworks lag-detected assertions to polling via jq. |
| e2e-tests/tests/standby-pgbackrest/03-standby-lockdown.yaml | Replaces iptables S3 blocking with a NetworkPolicy helper. |
| e2e-tests/tests/standby-pgbackrest/02-create-standby-cluster.yaml | Removes the netshoot sidecar previously used for iptables. |
| e2e-tests/tests/monitoring/conf/qan20-payload.json | Adds a static base QAN payload template used by monitoring tests. |
| e2e-tests/tests/monitoring/08-check-mountpoint-expose.yaml | Uses execute_curl (in-cluster curl) to query via LoadBalancer address. |
| e2e-tests/tests/monitoring/04-update-pmm-server-token.yaml | Increases timeout to reduce flakiness. |
| e2e-tests/tests/monitoring/01-assert.yaml | Adds a command to wait for LoadBalancer ingress before resource assertions. |
| e2e-tests/tests/k8s-upgrade/00-create-k8s-cluster.yaml | Updates supported upgrade platforms naming and validates current platform. |
| e2e-tests/tests/init-deploy/05-assert.yaml | Reworks secret assertions to tolerate operator-owned secrets via ownerReferences. |
| e2e-tests/tests/huge-pages/conf/huge-pages-rancher.yaml | Adds Rancher-specific hugepages cluster manifest. |
| e2e-tests/tests/huge-pages/conf/huge-pages-openshift-machine-config.yaml | Adds OpenShift MachineConfig template for hugepages sysctl. |
| e2e-tests/tests/huge-pages/conf/huge-pages-doks.yaml | Adds DOKS-specific hugepages cluster manifest. |
| e2e-tests/tests/huge-pages/conf/huge-pages-daemonset.yaml | Adds a generic privileged DaemonSet to configure hugepages on labeled nodes. |
| e2e-tests/tests/huge-pages/01-create-cluster.yaml | Uses PLATFORM and updated hugepages enablement flow. |
| e2e-tests/tests/huge-pages/00-deploy-operator.yaml | Increases timeout for operator deploy step. |
| e2e-tests/tests/demand-backup-offline-snapshot/conf/volume-snapshot-class-rancher.yaml | Adds Rancher/Longhorn VolumeSnapshotClass manifest. |
| e2e-tests/tests/demand-backup-offline-snapshot/conf/storage-class-ebs-gp3.yaml | Adds reusable EBS gp3 StorageClass manifest. |
| e2e-tests/tests/demand-backup-offline-snapshot/11-create-cluster-from-snapshot.yaml | Switches to using PLATFORM for templating. |
| e2e-tests/tests/demand-backup-offline-snapshot/01-create-cluster.yaml | Uses a helper to select snapshot class based on platform. |
| e2e-tests/tests/demand-backup-offline-snapshot/00-deploy-operator.yaml | Uses PLATFORM and deploys snapshot class via helper. |
| e2e-tests/release_versions | Adds Rancher/RKE2 version pins. |
| e2e-tests/functions | Centralizes platform usage, adds in-cluster curl helper, runtime-aware Chaos Mesh deploy, NetworkPolicy/Chaos helpers, refactors hugepages + vault templating. |
| e2e-tests/conf/vault-values-tls.yaml | Adds Helm values template for TLS-enabled Vault installs. |
| e2e-tests/conf/vault-values-no-tls.yaml | Adds Helm values template for non-TLS Vault installs. |
| e2e-tests/conf/vault-csr.yaml | Adds CSR manifest template for Vault TLS bootstrap. |
| e2e-tests/conf/vault-csr.conf | Adds OpenSSL CSR config template with placeholders. |
| e2e-tests/conf/network-policy-block-external.yml | Adds a NetworkPolicy template used to block external egress in tests. |
| e2e-tests/conf/chaos-network-delay.yml | Adds a Chaos Mesh NetworkChaos template for bandwidth limitation. |
| e2e-tests/build | Removes sourcing vars.sh and derives IMAGE tag from the git branch name. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
dbc8a78 to
08a040f
Compare
d807f78 to
a191099
Compare
580a7e8 to
594972e
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 42 out of 43 changed files in this pull request and generated no new comments.
Suppressed comments (7)
e2e-tests/tests/standby-streaming/05-assert.yaml:10
- Problem: The script defines
timeout/elapsedbut never updates or enforces them, so the loop can run until KUTTL kills the step.
Why it matters: This can turn real failures into long timeouts and makes the failure mode less deterministic.
Fix: Incrementelapsedand fail explicitly once the timeout is reached.
e2e-tests/tests/standby-streaming/04-assert.yaml:9 - Problem: This
untilloop has no explicit timeout, so it can run until the overall KUTTL step timeout rather than failing at the intended ~420s bound.
Why it matters: When the condition can’t be met, this increases runtime and makes failures harder to interpret.
Fix: Add anelapsed/timeoutguard (or wrap the loop intimeout 420s ...) and exit non-zero when exceeded.
e2e-tests/tests/standby-pgbackrest/04-assert.yaml:10 - Problem: This
untilloop has no explicit timeout, so it can run until the overall KUTTL step timeout rather than failing at the intended ~420s bound.
Why it matters: When the condition can’t be met, this increases runtime and makes failures harder to interpret.
Fix: Add anelapsed/timeoutguard (or wrap the loop intimeout 420s ...) and exit non-zero when exceeded.
set -o errexit
interval=5
until
json=$(kubectl get pg standby-cluster -n "${NAMESPACE}" -o json) &&
e2e-tests/tests/standby-pgbackrest/05-assert.yaml:11
- Problem: This
untilloop has no explicit timeout, so it can run until the overall KUTTL step timeout.
Why it matters: When the condition can’t be met, the test will fail as a long timeout instead of a controlled assertion failure.
Fix: Add anelapsed/timeoutguard and exit non-zero when exceeded.
set -o errexit
interval=5
until
json=$(kubectl get pg standby-cluster -n "${NAMESPACE}" -o json) &&
state=$(printf '%s' "$json" | jq -r '.status.state // empty') &&
e2e-tests/functions:684
- Problem:
execute_curlonly waits up to 60s for the curl pod to complete and doesn’t handlekubectl runfailures without aborting underset -e.
Why it matters: Image pulls or scheduling can easily exceed 60s in CI, making monitoring tests flaky even when the endpoint works.
Fix: Make the wait duration configurable/increase it, and wrapkubectl runin anif ! ...; thenblock so failures are handled predictably.
kubectl run "$name" \
-n "$NAMESPACE" \
--restart=Never \
--image="$image" \
--command -- curl -sS "$@" >/dev/null
e2e-tests/functions:528
- Problem:
get_psql_user_hostis defined twice in the same file.
Why it matters: Duplicate function definitions make the script harder to maintain and can hide accidental differences (the later definition silently overrides the earlier one).
Fix: Remove the duplicate definition and keep a singleget_psql_user_hostimplementation.
function get_psql_user_host() {
local secret_name=${1}
kubectl -n ${NAMESPACE} get "secret/${secret_name}" --template='{{.data.host | base64decode }}'
}
e2e-tests/functions:1046
- Problem: This function calls
seddirectly instead of using the repository’s portable$sedwrapper.
Why it matters:vars.shdefinessed=$(which gsed || which sed)to handle environments where GNU sed is required; bypassing it can break the script.
Fix: Use$sedhere, consistent with other usages in this file (e.g.,e2e-tests/functions:106).
sed \
-e "s#test-cluster#${cluster}#g" \
"$file" | kubectl apply --namespace "${ns}" -f -
112f988 to
a7881dc
Compare
a7881dc to
b178539
Compare
There was a problem hiding this comment.
should we rename this file to huge-pages-rancher?
There was a problem hiding this comment.
Not really, it's used for doks and aks
There was a problem hiding this comment.
hmm, then should we change NODE_SERVICE env or is that not used on doks and aks?
commit: 2952ed0 |
CHANGE DESCRIPTION
Description:
Rancher and Monitoring Improvements
curlcommands through theLoadBalancer, since cluster IPs in Rancher are not externally accessible.DaemonSet(made it generic), updated DOKS to only update additional node.standby-streamingtest, whilestandby-backrestis using Chaos Mesh iptables commands in order to block access to S3 (this is to avoid to use sidecar containers cause in Openshift operator would require privileged service account - K8SPG-1013)Additional Improvements
vars.shduring the image build process. This improves build performance and avoids delays caused by timing outkubectlcommands.confdirectory at both the test-specific and generic levels, providing a more consistent configuration structure.functionkeyword.CHECKLIST
Jira
Needs Doc) and QA (Needs QA)?Tests
Config/Logging/Testability