-
Notifications
You must be signed in to change notification settings - Fork 257
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
Support restricted PSA for worker pods #2410
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
35b069e
remove root worker pods
mhenriks b63cf43
remove selinux requirement for worker pods
mhenriks af99d02
run tests in restricted namespace and required changes
mhenriks 150f40a
handle empty tar
mhenriks 363ec7d
add PSA label when running functional tests in OpenShift
mhenriks 0338798
cannot use restricted PSA with istio (for now)
mhenriks fb8a29d
fix clean script
mhenriks File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,5 +52,6 @@ container_image( | |
":cdi-cloner", | ||
":cloner_startup.sh", | ||
], | ||
user = "1001", | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,6 @@ import ( | |
"k8s.io/apimachinery/pkg/util/sets" | ||
"k8s.io/client-go/tools/cache" | ||
"k8s.io/client-go/tools/record" | ||
"k8s.io/utils/pointer" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
"sigs.k8s.io/controller-runtime/pkg/controller" | ||
"sigs.k8s.io/controller-runtime/pkg/handler" | ||
|
@@ -573,7 +572,7 @@ func MakeCloneSourcePodSpec(sourceVolumeMode corev1.PersistentVolumeMode, image, | |
} | ||
} | ||
|
||
preallocationRequested, _ := targetPvc.Annotations[AnnPreallocationRequested] | ||
preallocationRequested := targetPvc.Annotations[AnnPreallocationRequested] | ||
|
||
pod := &corev1.Pod{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
|
@@ -592,15 +591,6 @@ func MakeCloneSourcePodSpec(sourceVolumeMode corev1.PersistentVolumeMode, image, | |
}, | ||
}, | ||
Spec: corev1.PodSpec{ | ||
SecurityContext: &corev1.PodSecurityContext{ | ||
RunAsUser: &[]int64{0}[0], | ||
SELinuxOptions: &corev1.SELinuxOptions{ | ||
User: "system_u", | ||
Role: "system_r", | ||
Type: "spc_t", | ||
Level: "s0", | ||
}, | ||
}, | ||
Containers: []corev1.Container{ | ||
{ | ||
Name: common.ClonerSourcePodName, | ||
|
@@ -653,14 +643,6 @@ func MakeCloneSourcePodSpec(sourceVolumeMode corev1.PersistentVolumeMode, image, | |
Protocol: corev1.ProtocolTCP, | ||
}, | ||
}, | ||
SecurityContext: &corev1.SecurityContext{ | ||
Capabilities: &corev1.Capabilities{ | ||
Drop: []corev1.Capability{ | ||
"ALL", | ||
}, | ||
}, | ||
AllowPrivilegeEscalation: pointer.BoolPtr(false), | ||
}, | ||
}, | ||
}, | ||
RestartPolicy: corev1.RestartPolicyOnFailure, | ||
|
@@ -670,7 +652,6 @@ func MakeCloneSourcePodSpec(sourceVolumeMode corev1.PersistentVolumeMode, image, | |
VolumeSource: corev1.VolumeSource{ | ||
PersistentVolumeClaim: &corev1.PersistentVolumeClaimVolumeSource{ | ||
ClaimName: sourcePvcName, | ||
ReadOnly: true, | ||
}, | ||
}, | ||
}, | ||
|
@@ -733,6 +714,7 @@ func MakeCloneSourcePodSpec(sourceVolumeMode corev1.PersistentVolumeMode, image, | |
{ | ||
Name: DataVolName, | ||
MountPath: common.ClonerMountPath, | ||
ReadOnly: true, | ||
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. Nice, is there a real impact for this? IIUC the other ReadOnly is just about enforcing this one |
||
}, | ||
} | ||
addVars = []corev1.EnvVar{ | ||
|
@@ -749,6 +731,7 @@ func MakeCloneSourcePodSpec(sourceVolumeMode corev1.PersistentVolumeMode, image, | |
|
||
pod.Spec.Containers[0].Env = append(pod.Spec.Containers[0].Env, addVars...) | ||
SetPodPvcAnnotations(pod, targetPvc) | ||
SetRestrictedSecurityContext(&pod.Spec) | ||
return pod | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Nice! this will fix an issue someone was seeing on OpenShift 4.12 with kubevirt tekton tasks https://github.com/kubevirt/tekton-tasks-operator/blob/main/data/tekton-pipelines/okd/windows10-customize.yaml#L126
I can try to find the chats if needed