mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-21 01:50:55 +00:00
EvenPodsSpread: integration test
This commit is contained in:
@@ -17,10 +17,14 @@ limitations under the License.
|
||||
package testing
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
var zero int64
|
||||
|
||||
// NodeSelectorWrapper wraps a NodeSelector inside.
|
||||
type NodeSelectorWrapper struct{ v1.NodeSelector }
|
||||
|
||||
@@ -152,6 +156,27 @@ func (p *PodWrapper) Namespace(s string) *PodWrapper {
|
||||
return p
|
||||
}
|
||||
|
||||
// Container appends a container into PodSpec of the inner pod.
|
||||
func (p *PodWrapper) Container(s string) *PodWrapper {
|
||||
p.Spec.Containers = append(p.Spec.Containers, v1.Container{
|
||||
Name: fmt.Sprintf("con%d", len(p.Spec.Containers)),
|
||||
Image: s,
|
||||
})
|
||||
return p
|
||||
}
|
||||
|
||||
// Priority sets a priority value into PodSpec of the inner pod.
|
||||
func (p *PodWrapper) Priority(val int32) *PodWrapper {
|
||||
p.Spec.Priority = &val
|
||||
return p
|
||||
}
|
||||
|
||||
// ZeroTerminationGracePeriod sets the TerminationGracePeriodSeconds of the inner pod to zero.
|
||||
func (p *PodWrapper) ZeroTerminationGracePeriod() *PodWrapper {
|
||||
p.Spec.TerminationGracePeriodSeconds = &zero
|
||||
return p
|
||||
}
|
||||
|
||||
// Node sets `s` as the nodeName of the inner pod.
|
||||
func (p *PodWrapper) Node(s string) *PodWrapper {
|
||||
p.Spec.NodeName = s
|
||||
|
Reference in New Issue
Block a user