Skip to content

FBC registry pod init container missing SecurityContext when using --security-context-config=restricted #7039

Closed as not planned

Description

@kaovilai

Bug Report

What did you do?

Ran operator-sdk run bundle with --security-context-config=restricted to deploy a bundle on a cluster with PodSecurity set to restricted.

operator-sdk run bundle ttl.sh/oadp-operator-bundle-f509f50a:1h --security-context-config=restricted

What did you expect to see?

The registry pod should be created successfully with proper security context settings on all containers.

What did you see instead?

INFO[0012] Creating a File-Based Catalog of the bundle "ttl.sh/oadp-operator-bundle-f509f50a:1h" 
INFO[0014] Generated a valid File-Based Catalog         
FATA[0015] Failed to run bundle: create catalog: error creating registry pod: error creating pod: pods "ttl-sh-oadp-operator-bundle-f509f50a-1h" is forbidden: violates PodSecurity "restricted:latest": allowPrivilegeEscalation != false (container "registry-grpc-init" must set securityContext.allowPrivilegeEscalation=false), unrestricted capabilities (container "registry-grpc-init" must set securityContext.capabilities.drop=["ALL"])

Root Cause

In internal/olm/operator/registry/fbcindex/fbc_registry_pod.go, when SecurityContext == "restricted", the security context is only applied to:

  • Pod level (f.pod.Spec.SecurityContext)
  • Main container (f.pod.Spec.Containers[0].SecurityContext)

The init container registry-grpc-init (added via addGZIPInitContainer()) is never given a SecurityContext.

https://github.com/operator-framework/operator-sdk/blob/f6829d45dce8f41f39b76b7cac2040bf23b4f81e/internal/olm/operator/registry/fbcindex/fbc_registry_pod.go#L143-L160

Proposed Fix

After setting the security context on the main container, also apply it to all init containers:

// Update all init containers with the same restrictive security context
for i := range f.pod.Spec.InitContainers {
    f.pod.Spec.InitContainers[i].SecurityContext = restrictedSecurityContext
}

Environment

  • operator-sdk version: v1.38.0 / master
  • Kubernetes cluster with PodSecurity restricted:latest

Related Issues

This is a continuation of #6430, which was auto-closed due to inactivity but the bug was never fixed. That issue covered multiple security context problems; this issue is specifically scoped to the init container (registry-grpc-init) missing security context settings.

Activity

  1. added 2 commits that reference this issue on Jan 16, 2026
    632eb84
    7af34db
  2. kaovilai commented on Jan 16, 2026

    @kaovilai
    ContributorAuthor
  3. added a commit that references this issue on Mar 12, 2026
    5daef89
  4. openshift-bot commented on Apr 17, 2026

    @openshift-bot

    Issues go stale after 90d of inactivity.

    Mark the issue as fresh by commenting /remove-lifecycle stale.
    Stale issues rot after an additional 30d of inactivity and eventually close.
    Exclude this issue from closing by commenting /lifecycle frozen.

    If this issue is safe to close now please do so with /close.

    /lifecycle stale

  5. added
    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.
    on Apr 17, 2026
  6. openshift-ci commented on May 17, 2026

    @openshift-ci

    Stale issues rot after 30d of inactivity.

    Mark the issue as fresh by commenting /remove-lifecycle rotten.
    Rotten issues close after an additional 30d of inactivity.
    Exclude this issue from closing by commenting /lifecycle frozen.

    If this issue is safe to close now please do so with /close.

    /lifecycle rotten
    /remove-lifecycle stale

  7. added
    lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.
    and removed
    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.
    on May 17, 2026
  8. kaovilai commented on May 17, 2026

    @kaovilai
    ContributorAuthor

    Unstale

  9. openshift-ci commented on Jun 17, 2026

    @openshift-ci

    Rotten issues close after 30d of inactivity.

    Reopen the issue by commenting /reopen.
    Mark the issue as fresh by commenting /remove-lifecycle rotten.
    Exclude this issue from closing again by commenting /lifecycle frozen.

    /close not-planned

  10. openshift-ci commented on Jun 17, 2026

    @openshift-ci

    @openshift-ci[bot]: Closing this issue, marking it as "Not Planned".

    Details

    In response to this:

    Rotten issues close after 30d of inactivity.

    Reopen the issue by commenting /reopen.
    Mark the issue as fresh by commenting /remove-lifecycle rotten.
    Exclude this issue from closing again by commenting /lifecycle frozen.

    /close not-planned

    Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions