pbacsko commented on code in PR #438:
URL: https://github.com/apache/yunikorn-k8shim/pull/438#discussion_r911844896
##########
test/e2e/framework/helpers/k8s/pod_conf.go:
##########
@@ -58,21 +63,60 @@ func InitSleepPod(conf SleepPodConfig) (*v1.Pod, error) {
conf.Mem = 50
}
+ var owners []metav1.OwnerReference
+ affinity := &v1.Affinity{}
+ if conf.RequiredNode != "" {
+ owner := metav1.OwnerReference{APIVersion: "v1", Kind:
constants.DaemonSetType, Name: "daemonset job", UID: "daemonset"}
+ owners = []metav1.OwnerReference{owner}
+
+ requirement := v1.NodeSelectorRequirement{
+ Key: "metadata.name",
+ Operator: v1.NodeSelectorOpIn,
+ Values: []string{conf.RequiredNode},
+ }
+ fields := []v1.NodeSelectorRequirement{requirement}
+ terms := []v1.NodeSelectorTerm{
+ {
+ MatchFields: fields,
+ },
+ }
+ affinity = &v1.Affinity{
+ NodeAffinity: &v1.NodeAffinity{
+ RequiredDuringSchedulingIgnoredDuringExecution:
&v1.NodeSelector{
+ NodeSelectorTerms: terms,
+ },
+ },
+ }
+ }
+
+ if conf.UID != "" {
+ owner := metav1.OwnerReference{APIVersion: "v1", Kind:
"ReplicaSet", Name: "ReplicaSetJob", UID: conf.UID}
Review Comment:
Nit: isn't there a constant for the kind "ReplicaSet"?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]