Skip to content

STOR-2370: Add enhancement for fsgroupChangePolicy defaulting #1804

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

gnufied
Copy link
Member

@gnufied gnufied commented May 22, 2025

@gnufied gnufied changed the title Add enhancement for fsgroupChangePolicy defaulting STOR-2370: Add enhancement for fsgroupChangePolicy defaulting May 22, 2025
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label May 22, 2025
@openshift-ci-robot
Copy link

openshift-ci-robot commented May 22, 2025

@gnufied: This pull request references STOR-2370 which is a valid jira issue.

In response to this:

https://issues.redhat.com/browse/STOR-2370

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot requested review from flavianmissi and rphillips May 22, 2025 19:28
Copy link
Contributor

openshift-ci bot commented May 22, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign miciah for approval. For more information see the Code Review Process.

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

Comment on lines 98 to 99
Since this feature requires explicit action by the admin, I am not *yet* proposing a feature-gate for this (although I am not opposed to the idea).
If required during TP phase, we can name the annotation in such a way that, it is clear to the user that this is a tech-preview feature. For example - `preview.openshift.io/fsgroup-change-policy`.
Copy link
Contributor

Choose a reason for hiding this comment

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

I am afraid we will need a feature gate.

Since this feature requires explicit action by the admin,

If I am reading the current conditions right, this IMO falls under "Accessible-by-default", even though the annotation would have a weird prefix. Such cluster must be fully upgradeable with the feature (i.e. the prefix needs to stay forever)

If you want to put it into Inaccessible-by-default, upgrades of the cluster are not supported and it should be declared so (Upgradeable: false).

Still, adding a feature gate should be cheap and we can flip it to GA withing the same release as when it's introduced, if we prove it's stable enough.

Copy link
Member Author

Choose a reason for hiding this comment

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

Still, adding a feature gate should be cheap and we can flip it to GA.

I was unsure about OCP feature gates being accessible in basically what is a patched version of core k8s component. I have pinged @deads2k @bertinatto offline.


```go
func getPodFsGroupChangePolicy(ns *corev1.Namespace) *api.PodFSGroupChangePolicy {
fsGroupPolicy, ok := ns.Annotations[securityv1.OnRootMismatchFSGroupPolicy]
Copy link
Contributor

Choose a reason for hiding this comment

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

securityv1.OnRootMismatchFSGroupPolicy -> securityv1.FSGroupChangePolicy,
since the constant will have value openshift.io/fsgroup-change-policy.


## Proposal

### Allow admins to opt-in to `FSGroupChangePolicy` via namespace annotation
Copy link
Contributor

Choose a reason for hiding this comment

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

Have you considered a way to have this as a structured API, rather than an annotation?

Perhaps we could have a namespace LabelSelector somewhere in the API and allow admins to define their own rules for which namespaces should/shouldn't be included?

Copy link
Member Author

Choose a reason for hiding this comment

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

Can you explain this bit more? We are discussing this mechanism to be supported via MAP - https://docs.google.com/document/d/1N7jU2ZG2hRz3MvMZlRrdmPK98jB3N9GYedjVEooeMkQ/edit?usp=sharing , which would I guess require having the namespace label selector.

Copy link
Contributor

Choose a reason for hiding this comment

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

Are you expecting this MAP to always be present? Or is this something we are documenting that users would create if they desire it?

You mention a specific annotation that would allow users to opt into this feature.

What if instead, there was an exposed namespace selector that users could configure their own rules for namespace selection.

Your operator could then build the MAP and apply it with the user supplied namespace selector, and we wouldn't have to have a specific annotation or anything to opt folks it, it would be entirely up to the end user as to how the namespaces are selected

Copy link
Contributor

Choose a reason for hiding this comment

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

Our plan is that the MAP will be created during cluster installation / upgrade. We're discussing if it should be part of the Storage capability or present in all clusters.
In both cases, the MAP would be very static. All pods in a namespace with a dedicated (and fixed) label will get the default from the MAP.

A new field somewhere would mean a code that would translate it into MAP in the runtime, which we're trying to avoid.

}
```

### Set default `FSGroupChangePolicy`in pods during admission:
Copy link
Contributor

Choose a reason for hiding this comment

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

Generally when I've seen guidance changes like this in the past, we've effected that change throughout operators in OpenShift as well. Is there any plan for forcing this value on OpenShift operators/operands?

Copy link
Member Author

Choose a reason for hiding this comment

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

It could be useful for operators that use persistent volumes, such as - alertmanager, prometheus and image-registry etc. Having said that, it is relatively easier to modify pod spec of OCP operators to have this field, but the idea is - a typical web developer may not be even aware of existance of this option, so having an OCP admin set this defaulting for developer namespaces will speed up their workloads even if workload author's aren't aware of the option.

Copy link
Contributor

openshift-ci bot commented Jun 11, 2025

@gnufied: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/markdownlint 6274967 link true /test markdownlint

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants