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

feat: add spec.template.spec.securityContext #1109

Merged
merged 7 commits into from
Jun 14, 2024

Conversation

ChristianBieri1995
Copy link
Contributor

📑 Description

Adding spec.template.spec.securityContext in order to solve issues when working with Policy Management Tools such as Open Policy Agent and Gatekeeper (as in my case psp-pods-allowed-user-ranges). User and group were taken from https://github.com/k8sgpt-ai/k8sgpt/blob/main/container/Dockerfile#L37. One could also think about adding runAsNonRoot: true and fsGroup: 65532.

✅ Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

ℹ Additional Information

Even though being more dynamic, other prominent project such as Grafana handle the securityContext in a similar way, see https://github.com/grafana/helm-charts/blob/main/charts/grafana/values.yaml#L142-L146 & https://github.com/grafana/grafana/blob/main/Dockerfile#L106 & https://github.com/grafana/helm-charts/blob/main/charts/grafana/templates/_pod.tpl#L9-L12

Signed-off-by: ChristianBieri1995 <122007149+ChristianBieri1995@users.noreply.github.com>
@ChristianBieri1995 ChristianBieri1995 requested review from a team as code owners May 10, 2024 13:59
Copy link
Member

@AlexsJones AlexsJones left a comment

Choose a reason for hiding this comment

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

How about making this configurable in the values.yaml?

Signed-off-by: ChristianBieri1995 <122007149+ChristianBieri1995@users.noreply.github.com>
Signed-off-by: ChristianBieri1995 <122007149+ChristianBieri1995@users.noreply.github.com>
@ChristianBieri1995
Copy link
Contributor Author

How about making this configurable in the values.yaml?

Done, see above.

@ChristianBieri1995
Copy link
Contributor Author

How about making this configurable in the values.yaml?

Done, see above.

Any news on that? Ready to merge?

Signed-off-by: ChristianBieri1995 <122007149+ChristianBieri1995@users.noreply.github.com>
@AlexsJones
Copy link
Member

@k8sgpt-ai/k8sgpt-maintainers

@arbreezy
Copy link
Member

arbreezy commented Jun 9, 2024

Should'nt we have the same logic in the operator too?

@ChristianBieri1995
Copy link
Contributor Author

Should'nt we have the same logic in the operator too?

Would most probably make sense ....

@AlexsJones
Copy link
Member

Thanks for your contribution, if you have time please add to the operator @ChristianBieri1995 !

@AlexsJones AlexsJones enabled auto-merge (squash) June 14, 2024 07:52
@AlexsJones AlexsJones merged commit 92dd1bd into k8sgpt-ai:main Jun 14, 2024
7 checks passed
AlexsJones added a commit to yankay/k8sgpt that referenced this pull request Jul 1, 2024
* feat: add spec.template.spec.securityContext

Signed-off-by: ChristianBieri1995 <122007149+ChristianBieri1995@users.noreply.github.com>

* make securityContext adjustable

Signed-off-by: ChristianBieri1995 <122007149+ChristianBieri1995@users.noreply.github.com>

* adjust values.yaml accordingly to enable adjustable securityContext

Signed-off-by: ChristianBieri1995 <122007149+ChristianBieri1995@users.noreply.github.com>

* Remove default values from securityContext

Signed-off-by: ChristianBieri1995 <122007149+ChristianBieri1995@users.noreply.github.com>

---------

Signed-off-by: ChristianBieri1995 <122007149+ChristianBieri1995@users.noreply.github.com>
Co-authored-by: Aris Boutselis <arisboutselis08@gmail.com>
Co-authored-by: Alex Jones <alexsimonjones@gmail.com>
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants