Skip to content

Conversation

@egegunes
Copy link
Contributor

@egegunes egegunes commented Oct 15, 2025

K8SPSMDB-1496 Powered by Pull Request Badge

CHANGE DESCRIPTION

When a physical restore is performed in Openshift, we get the following Warning due to lack of permissions to write in /.mongod folder. This causes Operator to malfunction and don’t get the true result from db.hello().isWritablePrimary

2025-10-14T13:47:35.095Z        DEBUG   Cmd succeeded   {"controller": "psmdbrestore-controller", "controllerGroup": "psmdb.percona.com", "controllerKind": "PerconaServerMongoDBRestore", "PerconaServerMongoDBRestore": {"name":"restore-backup-minio-physical","namespace":"pitr-to-new-cluster-26102"}, "namespace": "pitr-to-new-cluster-26102", "name": "restore-backup-minio-physical", "reconcileID": "f996ab44-1719-4567-b188-edad9fb8ff2e", "stdout": "Warning: Could not access file: EACCES: permission denied, mkdir '/.mongodb'\ntrue\n", "stderr": "", "pod": "some-name-target-rs0-2", "eval": "db.hello().isWritablePrimary"}

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 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 MongoDB version?
  • Does the change support oldest and newest supported Kubernetes version?

Copilot AI review requested due to automatic review settings October 15, 2025 09:26
@github-actions github-actions bot added the tests label Oct 15, 2025
@pull-request-size pull-request-size bot added the size/XL 500-999 lines label Oct 15, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a volume mount for the mongosh home directory to resolve permission issues when performing physical restores in OpenShift. The change addresses warnings that occur when mongosh attempts to create directories in /.mongodb without proper write permissions.

  • Adds a new emptyDir volume named "mongosh" mounted at /.mongodb for operator version 1.21.0+
  • Updates container configuration to include the new mongosh home directory mount
  • Updates all E2E test comparison files to include the new volume mount

Reviewed Changes

Copilot reviewed 182 out of 182 changed files in this pull request and generated 2 comments.

File Description
pkg/psmdb/config/const.go Defines constants for mongosh volume name and mount path
pkg/psmdb/statefulset.go Adds mongosh volume to StatefulSet volumes for version 1.21.0+
pkg/psmdb/container.go Adds mongosh volume mount to container configuration for version 1.21.0+
e2e-tests//compare/.yml Updates test comparison files to include new mongosh volume configuration

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

name: config
- mountPath: /opt/percona
name: bin
- mountPath: /.mongod
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

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

The mount path should be /.mongodb to match the constant MongoshHomeMountPath, not /.mongod.

Suggested change
- mountPath: /.mongod
- mountPath: /.mongodb

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

what an useful bot you are

name: config
- mountPath: /opt/percona
name: bin
- mountPath: /.mongod
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

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

The mount path should be /.mongodb to match the constant MongoshHomeMountPath, not /.mongod.

Suggested change
- mountPath: /.mongod
- mountPath: /.mongodb

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings October 15, 2025 11:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 191 out of 191 changed files in this pull request and generated no new comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

})
}

if cr.CompareVersion("1.14.0") >= 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

why dont we remove this compare statement for 1.14? I think we dont support it anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's a last minute fix for the release, let's not make changes other than what's absolutely necessary

Copilot AI review requested due to automatic review settings October 15, 2025 15:37
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 220 out of 220 changed files in this pull request and generated no new comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

gkech
gkech previously approved these changes Oct 16, 2025
Copilot AI review requested due to automatic review settings October 16, 2025 13:15
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@hors hors merged commit 84e29e7 into main Oct 16, 2025
17 of 18 checks passed
@hors hors deleted the K8SPSMDB-1496 branch October 16, 2025 13:17
jvpasinatto pushed a commit that referenced this pull request Oct 16, 2025
* K8SPSMDB-1496: Add volume for mongosh homedir

* fix unit tests

* update compare files

* bump k8s version

* fix upgrade-consistency

* fix more compare files

* fix upgrade tests

* fix upgrade-consistency-sharded-tls

---------

Co-authored-by: Viacheslav Sarzhan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XL 500-999 lines tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants