Allow setting tolerations in test framework

This commit is contained in:
Maciej Pytel
2018-08-07 19:04:55 +02:00
parent 6bea053ee7
commit 29a32307a7
2 changed files with 13 additions and 5 deletions

View File

@@ -139,6 +139,9 @@ type RCConfig struct {
// Node selector for pods in the RC.
NodeSelector map[string]string
// Tolerations for pods in the RC.
Tolerations []v1.Toleration
// Ports to declare in the container (map of name to containerPort).
Ports map[string]int
// Ports to declare in the container as host and container ports.
@@ -563,6 +566,7 @@ func (config *RCConfig) create() error {
},
DNSPolicy: *config.DNSPolicy,
NodeSelector: config.NodeSelector,
Tolerations: config.Tolerations,
TerminationGracePeriodSeconds: &one,
PriorityClassName: config.PriorityClassName,
},
@@ -604,6 +608,9 @@ func (config *RCConfig) applyTo(template *v1.PodTemplateSpec) {
template.Spec.NodeSelector[k] = v
}
}
if config.Tolerations != nil {
template.Spec.Tolerations = append([]v1.Toleration{}, config.Tolerations...)
}
if config.Ports != nil {
for k, v := range config.Ports {
c := &template.Spec.Containers[0]