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

K8SPSMDB-1018: fix incorrect Bash quoting in ps-entry.sh script #1382

Merged
merged 4 commits into from
Jan 12, 2024

Conversation

wpt1313
Copy link
Contributor

@wpt1313 wpt1313 commented Nov 24, 2023

K8SPSMDB-1018 Powered by Pull Request Badge

CHANGE DESCRIPTION

Problem:
When a MongoDB image that contains numactl package is used, the pod fails with the error message: 'numactl --interleave=all': not found

Cause:
The entrypoint script for MongoDB container runs mongod command preceded with numactl --interleave=all if the previous test for numactl returns a success code. Since the variable containing this command is incorrectly quoted when added to the list of positional parameters, the script tries to execute the following command:

exec 'numactl --interleave=all' mongod (...rest of parameters)

which fails with the error message:

'numactl --interleave=all': not found

The error never happens if current Percona MongoDB images are used — as they are missing numactl package providing the mentioned command, so the script conditional check for that command always silently fails.

Solution:
The variable is changed to an array and then properly quoted — so that the command is correctly executed and the code does not trigger Shellcheck SC-2086 warning.

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?
  • Are OpenShift compare files changed for E2E tests (compare/*-oc.yml)?

Config/Logging/Testability

  • Are all needed new/changed options added to default YAML files?
  • Are the manifests (crd/bundle) regenerated if needed?
  • 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 MongoDB version?
  • Does the change support oldest and newest supported Kubernetes version?

@CLAassistant
Copy link

CLAassistant commented Nov 24, 2023

CLA assistant check
All committers have signed the CLA.

The variable with `numactl` command was quoted, so it was
added to the list of positional parameters as a quoted string,
therefore causing `exec "$@"` call to fail. This commit changes
the variable to an array, so that it can be properly quoted
and does not trigger Shellcheck SC-2086 warning.
@wpt1313 wpt1313 force-pushed the K8SPSMDB-1018-fix-ps-entry branch from 5ecc1ec to df36868 Compare November 24, 2023 19:07
@pull-request-size pull-request-size bot added size/S 10-29 lines and removed size/XS 0-9 lines labels Nov 24, 2023
@egegunes egegunes added this to the v1.16.0 milestone Jan 12, 2024
@JNKPercona
Copy link
Collaborator

Test name Status
arbiter passed
balancer passed
custom-replset-name passed
cross-site-sharded passed
data-at-rest-encryption passed
data-sharded passed
demand-backup passed
demand-backup-eks-credentials passed
demand-backup-physical passed
demand-backup-physical-sharded passed
demand-backup-sharded passed
expose-sharded passed
ignore-labels-annotations passed
init-deploy passed
finalizer passed
limits passed
liveness passed
mongod-major-upgrade passed
mongod-major-upgrade-sharded passed
monitoring-2-0 passed
multi-cluster-service passed
non-voting passed
one-pod passed
operator-self-healing-chaos passed
pitr passed
pitr-sharded passed
pitr-physical passed
recover-no-primary passed
rs-shard-migration passed
scaling passed
scheduled-backup passed
security-context passed
self-healing-chaos passed
service-per-pod passed
serviceless-external-nodes passed
smart-update passed
split-horizon passed
storage passed
tls-issue-cert-manager passed
upgrade passed
upgrade-consistency failure
upgrade-consistency-sharded failure
upgrade-sharded passed
users passed
version-service passed
We run 45 out of 45

commit: 7de05aa
image: perconalab/percona-server-mongodb-operator:PR-1382-7de05aae

@hors hors merged commit ca70e0c into percona:main Jan 12, 2024
9 of 10 checks passed
@hors
Copy link
Collaborator

hors commented Jan 12, 2024

@wpt1313 thank you for contribution

@wpt1313 wpt1313 deleted the K8SPSMDB-1018-fix-ps-entry branch February 5, 2024 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants