Skip to content

fix issue https://github.com/kubernetes/kompose/issues/2054#2065

Merged
k8s-ci-robot merged 2 commits intokubernetes:mainfrom
hurzelpurzel:bugfix/#2054
Jan 8, 2026
Merged

fix issue https://github.com/kubernetes/kompose/issues/2054#2065
k8s-ci-robot merged 2 commits intokubernetes:mainfrom
hurzelpurzel:bugfix/#2054

Conversation

@hurzelpurzel
Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind bug

What this PR does / why we need it:

Set SecurityContext to the Container by its name

Which issue(s) this PR fixes:

Fixes #2054

Special notes for your reviewer:

Please be kind. I'm a frequent contributor

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Nov 3, 2025
@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Nov 3, 2025
cdrage
cdrage previously requested changes Nov 17, 2025
Copy link
Copy Markdown
Member

@cdrage cdrage left a comment

Choose a reason for hiding this comment

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

Just need a simple test added to test the functionality, and this LGTM!

if *securityContext != (api.SecurityContext{}) {
podSpec.Containers[0].SecurityContext = securityContext
//podSpec.Containers[0].SecurityContext = securityContext
for i := range podSpec.Containers {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are you able to instead add a comment above saying something like...

"Search through all the containers, find the one that matches the container name and set the security context appropriately"?

And remove the commented out code.

This implementation LGTM (sucks we have to loop through all the containers... but that's a nitpick), but otherwise this is good!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Changed as requested.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Nov 18, 2025
@cdrage cdrage dismissed their stale review January 8, 2026 21:57

old review

Copy link
Copy Markdown
Member

@cdrage cdrage left a comment

Choose a reason for hiding this comment

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

SO SORRY for the late review!

But this works, looks good and I want this merged in!

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 8, 2026
@cdrage
Copy link
Copy Markdown
Member

cdrage commented Jan 8, 2026

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 8, 2026
@cdrage
Copy link
Copy Markdown
Member

cdrage commented Jan 8, 2026

/approve

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cdrage, hurzelpurzel

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit 1397928 into kubernetes:main Jan 8, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Multi-container Pod settings gets applied to the first container

3 participants