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

Add feature flag set-security-context-read-only-root-filesystem to set readOnlyRootFilesystem for containers #8186

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kristofferchr
Copy link
Contributor

@kristofferchr kristofferchr commented Aug 7, 2024

Solves: #8183

Changes

Add a flag to enable setting the readOnlyRootFilesystem field in the securityContext for containers used in pipelinerun, taskrun and affinity assistants

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Has Docs if any changes are user facing, including updates to minimum requirements e.g. Kubernetes version bumps
  • Has Tests included if any functionality added or changed
  • pre-commit Passed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings). See some examples of good release notes.
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

New feature flag `set-security-context-read-only-root-filesystem` in ConfigMap `feature-flags`. The new feature sets readOnlyRootFilesystem in securityContext for taskrun and affinity assistant containers.

@tekton-robot tekton-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesnt merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 7, 2024
@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign pritidesai after the PR has been reviewed.
You can assign the PR to them by writing /assign @pritidesai in a comment when ready.

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

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

@tekton-robot
Copy link
Collaborator

Hi @kristofferchr. Thanks for your PR.

I'm waiting for a tektoncd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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/test-infra repository.

@kristofferchr
Copy link
Contributor Author

/kind feature

@tekton-robot tekton-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Aug 7, 2024
@kristofferchr
Copy link
Contributor Author

/test pull-tekton-pipeline-go-coverage-df

@tekton-robot
Copy link
Collaborator

@kristofferchr: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/test pull-tekton-pipeline-go-coverage-df

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/test-infra repository.

@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesnt merit a release note. labels Aug 7, 2024
@kristofferchr kristofferchr changed the title Enable read only root filesystem Add feature flag set-security-context-read-only-root-filesystem to add readOnlyRootFilesystem to containers Aug 7, 2024
@kristofferchr kristofferchr changed the title Add feature flag set-security-context-read-only-root-filesystem to add readOnlyRootFilesystem to containers Add feature flag set-security-context-read-only-root-filesystem to set readOnlyRootFilesystem to containers Aug 7, 2024
@kristofferchr kristofferchr changed the title Add feature flag set-security-context-read-only-root-filesystem to set readOnlyRootFilesystem to containers Add feature flag set-security-context-read-only-root-filesystem to set readOnlyRootFilesystem for containers Aug 7, 2024
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/feature_flags.go 95.1% 94.4% -0.7
pkg/pod/SecurityContext.go Do not exist 85.7%
pkg/pod/pod.go 93.9% 94.2% 0.3
pkg/pod/script.go 99.0% 99.0% -0.0
pkg/pod/workingdir_init.go 95.0% 94.1% -0.9
pkg/reconciler/pipelinerun/affinity_assistant.go 96.9% 97.0% 0.1

@kristofferchr kristofferchr force-pushed the enable-read-only-root-filesystem branch from acd8516 to f0fecb9 Compare August 7, 2024 10:54
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/feature_flags.go 95.1% 94.4% -0.7
pkg/pod/pod.go 93.9% 94.2% 0.3
pkg/pod/script.go 99.0% 99.0% -0.0
pkg/pod/security_context_config.go Do not exist 85.7%
pkg/pod/workingdir_init.go 95.0% 94.1% -0.9
pkg/reconciler/pipelinerun/affinity_assistant.go 96.9% 97.0% 0.1

@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 22, 2024
@kristofferchr kristofferchr force-pushed the enable-read-only-root-filesystem branch from f0fecb9 to 46cb332 Compare February 6, 2025 12:04
@tekton-robot tekton-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 6, 2025
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/feature_flags.go 95.1% 94.4% -0.7
pkg/pod/pod.go 93.0% 93.3% 0.3
pkg/pod/script.go 99.1% 99.1% -0.0
pkg/pod/security_context_config.go Do not exist 85.7%
pkg/pod/workingdir_init.go 95.0% 94.1% -0.9

@kristofferchr
Copy link
Contributor Author

/retest

@tekton-robot
Copy link
Collaborator

@kristofferchr: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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/test-infra repository.

@kristofferchr kristofferchr force-pushed the enable-read-only-root-filesystem branch from 46cb332 to 68f73c6 Compare February 6, 2025 13:39
@tekton-robot tekton-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Feb 6, 2025
@kristofferchr kristofferchr force-pushed the enable-read-only-root-filesystem branch from 68f73c6 to 1c3c312 Compare February 6, 2025 13:46
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/feature_flags.go 95.1% 94.4% -0.7
pkg/pod/pod.go 93.0% 93.3% 0.3
pkg/pod/script.go 99.1% 99.1% -0.0
pkg/pod/security_context_config.go Do not exist 85.7%
pkg/pod/workingdir_init.go 95.0% 94.1% -0.9

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/feature_flags.go 95.1% 94.4% -0.7
pkg/pod/pod.go 93.0% 93.3% 0.3
pkg/pod/script.go 99.1% 99.1% -0.0
pkg/pod/security_context_config.go Do not exist 85.7%
pkg/pod/workingdir_init.go 95.0% 94.1% -0.9

@kristofferchr kristofferchr marked this pull request as ready for review February 6, 2025 14:29
@tekton-robot tekton-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 6, 2025
@kristofferchr kristofferchr force-pushed the enable-read-only-root-filesystem branch from 1c3c312 to 1bbd67c Compare February 7, 2025 07:57
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/feature_flags.go 95.1% 94.4% -0.7
pkg/pod/pod.go 93.0% 93.3% 0.3
pkg/pod/script.go 99.1% 99.1% -0.0
pkg/pod/security_context_config.go Do not exist 85.7%
pkg/pod/workingdir_init.go 95.0% 94.1% -0.9

@kristofferchr kristofferchr force-pushed the enable-read-only-root-filesystem branch from 1bbd67c to 5516ec0 Compare February 7, 2025 10:00
@tekton-robot tekton-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 7, 2025
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/feature_flags.go 95.1% 94.4% -0.7
pkg/pod/pod.go 93.0% 93.3% 0.3
pkg/pod/script.go 99.1% 99.1% -0.0
pkg/pod/security_context_config.go Do not exist 100.0%
pkg/pod/workingdir_init.go 95.0% 94.1% -0.9

Prior to this change it was not possible to set readOnlyRootFilesystem for tekton pipeline containers.

This change allows users to set readOnlyRootFilesystem in container securityContext for all containers.
Aligns tekton with industry best practices for kuberenetes security, such as Azure Kubernetes Services deployment safeguards.
@kristofferchr kristofferchr force-pushed the enable-read-only-root-filesystem branch from 5516ec0 to 1fe2500 Compare February 7, 2025 10:52
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/config/feature_flags.go 95.1% 95.2% 0.1
pkg/pod/pod.go 93.0% 93.3% 0.3
pkg/pod/script.go 99.1% 99.1% -0.0
pkg/pod/security_context_config.go Do not exist 100.0%
pkg/pod/workingdir_init.go 95.0% 94.1% -0.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

2 participants