-
Notifications
You must be signed in to change notification settings - Fork 6
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
Pb-6681 : added support for PSA for kdmp jobs #377
Conversation
- added make target called vendor to eliminate compilation issue Signed-off-by: Lalatendu Das <[email protected]>
OSS Scan Results:
Total issues: 191 |
License Evaluation Results:
Total License Issues: 17 |
567add1
to
391d365
Compare
OSS Scan Results:
Total issues: 191 |
License Evaluation Results:
Total License Issues: 17 |
} | ||
|
||
// WithpsaIsEnabled is job parameter. | ||
func WithPodUserId(podUserId string) JobOption { |
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.
typo in the function name in comment.
} | ||
|
||
// WithpsaIsEnabled is job parameter. | ||
func WithPodGroupId(PodGroupId string) JobOption { |
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.
typo in the function name in comment.
PsaEnabledKey = "portworx.io/psa-enabled" | ||
PsaUIDKey = "portworx.io/psa-uid" | ||
PsaGIDKey = "portworx.io/psa-gid" | ||
KdmpJobUid = "1013" |
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.
Please add comment for the purpose of the hardcoded UID/GUID
pkg/drivers/utils/utils.go
Outdated
if podUserId != "" { | ||
uid, err := strconv.ParseInt(podUserId, 10, 64) | ||
if err != nil { | ||
logrus.Errorf("failed to convert the UID to int: %v", 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.
It is better to add some reference in the error message to associate for which dataexport of job, this covert error happen?
pkg/drivers/utils/utils.go
Outdated
}, | ||
} | ||
} else { | ||
return job, fmt.Errorf("recieved a nil job object to add security context") |
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.
recieved : typo
// Add security Context only if the PSA is enabled. | ||
if jobOption.PsaIsEnabled == "true" { | ||
// The Job is intended to backup resources to NFS backuplocation | ||
// and it doesn't need a specific JOB uid/gid since it will be sqaushed at NFS server |
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.
typo: sqaushed
pkg/drivers/utils/utils.go
Outdated
"ALL", | ||
}, | ||
} | ||
} else { |
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.
nit:We could avoid if and else and indentation if the code is
if job == nil {
return fmt.Errorf(...)
}
Rest of the code here..
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.
looks good to me.
- Added check and collected psa info from the namespace - if psa enabled then extracted the uid and gid used by the POD. here the pod is choosen based on whichever PVC is used by that pod - applied those uid and GID to all relevant job pod spec - this is done only if the PSA mode enforced with "restricted" value - for baseline and privilege mode no restriction on UID/GID and default setting of SElinux and secomp is adopted in the POD spec Signed-off-by: Lalatendu Das <[email protected]>
391d365
to
337122f
Compare
OSS Scan Results:
Total issues: 191 |
License Evaluation Results:
Total License Issues: 17 |
closing the PR since the same PR with some more modification is raised against 2.7.2 now |
What this PR does / why we need it: This enables the KDMP job pods to be added with SecurityContext setting required for it to run in a restricted PSA environment.
Which issue(s) this PR fixes (optional)
Closes # pb-6681
Special notes for your reviewer:
Cluster Wide PSA setting related code is not added yet.
Will update unit test result before EOD tomorrow