Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

K8SPG-708 replace ready/live probe http check with custom command, change pg entrypoint #1099

Open
wants to merge 44 commits into
base: K8SPG-613
Choose a base branch
from

Conversation

gkech
Copy link
Contributor

@gkech gkech commented Mar 21, 2025

K8SPG-708 Powered by Pull Request Badge

CHANGE DESCRIPTION

Problem:
We are changing the probes from direct requests to patroni's restful api to a custom command so that we can get more flexibility on what can be executed for the live/ready checks of the pg container. For now this is needed so that we can introduce a sleep forever feature.

Deleted related PR: percona/percona-docker#1148

We are also introducing a new entrypoint for the database container which is defined in the percona-docker repo for now.

Testing sleep forever

Screenshot 2025-03-28 at 5 52 53 PM

Checking the creation of the /tmp/postgres file and verifying that pg_ctl -D /pgdata/pg17 start starts as expected

Screenshot 2025-04-03 at 2 24 08 PM

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?

Comment on lines 151 to 152
container.LivenessProbe.Exec = &corev1.ExecAction{
Command: []string{"/usr/local/bin/postgres-liveness-check.sh"},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe we want to do this change only for >2.7.0 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done here: c377050

@gkech gkech marked this pull request as ready for review March 24, 2025 11:25
@gkech gkech requested a review from egegunes March 26, 2025 08:02
egegunes
egegunes previously approved these changes Mar 26, 2025
@gkech gkech requested a review from nmarukovich March 26, 2025 18:04
@gkech gkech requested a review from egegunes March 28, 2025 15:58
@egegunes egegunes added this to the 2.7.0 milestone Mar 31, 2025
@gkech gkech changed the title K8SPG-708 replace ready/live probe http check with custom command K8SPG-708 replace ready/live probe http check with custom command, change pg entrypoint Apr 1, 2025
egegunes
egegunes previously approved these changes Apr 1, 2025
@gkech
Copy link
Contributor Author

gkech commented Apr 4, 2025

The e2e tests are failing because the init image used is the operator's main image, and it does not contain the related .sh files that need to be installed to the instance pod volume. Changing the following:

get_cr() {
	local cr_name=$1
	if [ -z ${cr_name} ]; then
		cr_name=${test_name}
	fi
	local repo_path=$2

	yq eval '
		.metadata.name = "'${cr_name}'" |
		.metadata.labels = {"e2e":"'${cr_name}'"} |
		.spec.postgresVersion = '$PG_VER' |
		.spec.users += [{"name":"postgres","password":{"type":"AlphaNumeric"}}] |
		.spec.users += [{"name":"'${cr_name}'","password":{"type":"AlphaNumeric"}}] |
		.spec.image = "'$IMAGE_POSTGRESQL'" |
		.spec.initImage = "perconalab/percona-postgresql-operator:K8SPG-708-11" |
		.spec.backups.pgbackrest.image = "'$IMAGE_BACKREST'" |
		.spec.proxy.pgBouncer.image = "'$IMAGE_PGBOUNCER'" |
		.spec.pmm.image = "'$IMAGE_PMM_CLIENT'" |
		.spec.pmm.secret = "'${cr_name}'-pmm-secret" |
		.spec.pmm.customClusterName = "'${cr_name}'-pmm-custom-name" |
		.spec.pmm.postgresParams = "--environment=dev-postgres"
		' $DEPLOY_DIR/cr.yaml >$TEMP_DIR/cr.yaml

	if [[ $OPENSHIFT ]]; then
		yq eval -i '.spec.openshift = true' $TEMP_DIR/cr.yaml
	fi

Notice the .spec.initImage = "perconalab/percona-postgresql-operator:K8SPG-708-11" | line.

With this addition tests should pass.

Screenshot 2025-04-04 at 9 07 37 AM

@gkech gkech changed the base branch from main to K8SPG-613 April 6, 2025 23:36
@gkech
Copy link
Contributor Author

gkech commented Apr 6, 2025

Note that this PR has base branch K8SPG-613 in order to utilize the init container spec and not be blocked

@JNKPercona
Copy link
Collaborator

Test name Status
custom-extensions failure
custom-tls passed
demand-backup passed
finalizers passed
init-deploy passed
monitoring passed
monitoring-pmm3 passed
one-pod passed
operator-self-healing passed
pitr passed
scaling passed
scheduled-backup passed
self-healing failure
sidecars passed
start-from-backup passed
tablespaces passed
telemetry-transfer passed
upgrade-consistency failure
upgrade-minor passed
users passed
We run 20 out of 20

commit: 8481dfc
image: perconalab/percona-postgresql-operator:PR-1099-8481dfc44

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.

5 participants