Skip to content

Conversation

@eleo007
Copy link
Contributor

@eleo007 eleo007 commented Dec 16, 2025

Added a comment to clarify the purpose of the script.

CHANGE DESCRIPTION

Problem:
Short explanation of the problem.

Cause:
Short explanation of the root cause of the issue if applicable.

Solution:
Short explanation of the solution we are providing with this PR.

CHECKLIST

Jira

  • Is the Jira ticket created and referenced properly?
  • Does the Jira ticket have the proper statuses for documentation (Needs Doc) and QA (Needs QA)?
  • Does the Jira ticket link to the proper milestone (Fix Version field)?

Tests

  • Is an E2E test/test case added for the new feature/change?
  • Are unit tests added where appropriate?

Config/Logging/Testability

  • Are all needed new/changed options added to default YAML files?
  • Are all needed new/changed options added to the Helm Chart?
  • Did we add proper logging messages for operator actions?
  • Did we ensure compatibility with the previous version or cluster upgrade process?
  • Does the change support oldest and newest supported PG version?
  • Does the change support oldest and newest supported Kubernetes version?

Added a comment to clarify the purpose of the script.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[shfmt] reported by reviewdog 🐶

local check_type=$1 # add | delete
local component=$2 # instance | pgbouncer | repohost
local vars=("${@:3}") # everything after the 2nd argument
case "$component" in
instance)
POD=$(kubectl get -n "${NAMESPACE}" pod -l postgres-operator.crunchydata.com/instance-set=instance1 -o 'jsonpath={.items[0].metadata.name}')
CONTAINER=""
;;
pgbouncer)
POD=$(kubectl get -n "${NAMESPACE}" pod -l postgres-operator.crunchydata.com/role=pgbouncer -o 'jsonpath={.items[0].metadata.name}')
CONTAINER="pgbouncer"
;;
repohost)
POD=$(kubectl get -n "${NAMESPACE}" pod -l postgres-operator.crunchydata.com/data=pgbackrest -o 'jsonpath={.items[0].metadata.name}')
CONTAINER="pgbackrest"
;;
*)
echo "ERROR: unknown component '$component'"
return 1
;;
esac
echo "Fetching environment variables for $component pod $POD..."
local env_content
env_content=$(get_envs_from_pod "${NAMESPACE}" "$POD" "$CONTAINER")
local errors=0
for var_entry in "${vars[@]}"; do
if [[ "$check_type" == "add" ]]; then
local var_name="${var_entry%%=*}"
local var_expected="${var_entry#*=}"
check_env_in_pod add "$POD" "$var_name" "$var_expected" "$env_content" || errors=$((errors+1))
else
check_env_in_pod delete "$POD" "$var_entry" "" "$env_content" || errors=$((errors+1))
fi
done
if (( errors > 0 )); then
echo "$errors environment check(s) failed for component '$component'"
return 1
else
echo "All environment checks passed for component '$component'"
fi

@JNKPercona
Copy link
Collaborator

Test Name Result Time
backup-enable-disable passed 00:06:23
custom-envs passed 00:18:52
custom-extensions passed 00:14:16
custom-tls passed 00:06:28
database-init-sql passed 00:02:42
demand-backup passed 00:24:06
finalizers passed 00:03:44
init-deploy passed 00:02:50
monitoring passed 00:08:44
monitoring-pmm3 passed 00:08:48
one-pod passed 00:05:42
operator-self-healing passed 00:08:19
pgvector-extension passed 00:02:45
pitr passed 00:11:47
scaling passed 00:04:47
scheduled-backup passed 00:28:55
self-healing passed 00:09:03
sidecars passed 00:02:38
start-from-backup passed 00:10:50
tablespaces passed 00:07:00
telemetry-transfer passed 00:03:18
upgrade-consistency failure 00:05:57
upgrade-minor passed 00:05:12
users passed 00:04:44
Summary Value
Tests Run 24/24
Job Duration 01:28:42
Total Test Time 03:28:00

commit: d25fe5c
image: perconalab/percona-postgresql-operator:PR-1385-d25fe5ce5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants