← Back to Pull requests

K8SPSMDB-1595: set container security context for `pbm-init` container #2283

Closed
unknown closed this pull request without merging on Apr 24, 2026 13:33 UTC
View on GitHub
unknown unknown commented on Mar 13, 2026 04:49 UTC
Author

CHANGE DESCRIPTION
---
Problem:
The pbm-init init container added during physical/PITR restore is missing a SecurityContext, causing pod admission failures in namespaces which has PSA in restricted mode. More details in https://github.com/percona/percona-server-mongodb-operator/issues/2250

Cause:
updateStatefulSetForPhysicalRestore() calls EntrypointInitContainer() to create the pbm-init container but never assigns SecurityContext after creation - unlike the other caller, InitContainers() in init.go, which does apply it.

Solution:
Assign cluster.Spec.InitContainerSecurityContext to the pbm-init container after creation (for CR version ≥ 1.23.0 - idk if the version guard that I have here is the right version but per the discussion in the issue, the idea was to allow this for >= 1.23.0 versions? Please feel free to correct me here.), mirroring the existing pattern.

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?
  • Diff: 291 lines (+218 / -73) across 3 files Reviewer: shajia-deshaw Review duration: 61004m
    All Vouch review confidence checks passed
    Residual risk 0.27 = Change Risk (0.63) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.63 · 291 lines diff across 3 files
    0.63
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.340
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.063
    Real PR Conversation Timeline
    1 comments
    "Review active on #2283"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 63.1% (MEDIUM) · Higher = larger blast radius
    63.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 27.3% · Safe to merge
    27.3%