-
Notifications
You must be signed in to change notification settings - Fork 317
feat: Allow Fileownership change through FSGroup and VOLUME_MOUNT_GROUP #1841
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
cbac857
50f04b9
598c51c
e8e905e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Revert changes to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package constants | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to add boilerplate to the top of the file. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
|
||
const ( | ||
NoGID = int64(-1) // Use the default gid -1 to indicate no change in FSGroup | ||
) |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -21,12 +21,14 @@ import ( | |||||
"encoding/json" | ||||||
"fmt" | ||||||
"os" | ||||||
"strconv" | ||||||
"strings" | ||||||
"time" | ||||||
|
||||||
secretsstorev1 "sigs.k8s.io/secrets-store-csi-driver/apis/v1" | ||||||
"sigs.k8s.io/secrets-store-csi-driver/controllers" | ||||||
secretsStoreClient "sigs.k8s.io/secrets-store-csi-driver/pkg/client/clientset/versioned" | ||||||
"sigs.k8s.io/secrets-store-csi-driver/pkg/constants" | ||||||
internalerrors "sigs.k8s.io/secrets-store-csi-driver/pkg/errors" | ||||||
"sigs.k8s.io/secrets-store-csi-driver/pkg/k8s" | ||||||
secretsstore "sigs.k8s.io/secrets-store-csi-driver/pkg/secrets-store" | ||||||
|
@@ -398,7 +400,18 @@ func (r *Reconciler) reconcile(ctx context.Context, spcps *secretsstorev1.Secret | |||||
r.generateEvent(pod, corev1.EventTypeWarning, mountRotationFailedReason, fmt.Sprintf("failed to lookup provider client: %q", providerName)) | ||||||
return fmt.Errorf("failed to lookup provider client: %q", providerName) | ||||||
} | ||||||
newObjectVersions, errorReason, err := secretsstore.MountContent(ctx, providerClient, string(paramsJSON), string(secretsJSON), spcps.Status.TargetPath, string(permissionJSON), oldObjectVersions) | ||||||
gid := constants.NoGID | ||||||
if spcps.Status.FSGroup != "" { | ||||||
|
if spcps.Status.FSGroup != "" { | |
if len(spcps.Status.FSGroup) > 0 { |
this is the code style we follow in Kubernetes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
errStr := fmt.Sprintf("failed to rotate objects for pod %s/%s, err: %v, invalid FSGroup:%s", spcps.Namespace, spcps.Status.PodName, err, spcps.Status.FSGroup) | |
errStr := fmt.Sprintf("failed to rotate objects for pod %s/%s, invalid FSGroup:%s, err: %w", spcps.Namespace, spcps.Status.PodName, spcps.Status.FSGroup, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thanks for the catch. This makes more sense to read as a log.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
however, %w (wrap) format seems to be specific only to fmt.Errorf. Thus, restructured the code to use %v in the Sprintf and %w in the Errorf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert changes to
charts
directory. Chart changes should only be made in themanifest_staging
directory.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done