Allow configuring pod priority globally and per cluster.

Allow to specify pod priority class for all pods managed by the operator,
as well as for those belonging to individual clusters.

Controlled by the pod_priority_class_name operator configuration
parameter and the podPriorityClassName manifest option.

See https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/#priorityclass
for the explanation on how to define priority classes since Kubernetes 1.8.

Some import order changes are due to go fmt.
Removal of OrphanDependents deprecated field.
This commit is contained in:
Oleksii Kliukin
2018-07-31 15:38:46 +02:00
parent 130f06cea0
commit b4fcd24c2a
21 changed files with 110 additions and 79 deletions
+1
View File
@@ -25,6 +25,7 @@ type Resources struct {
PodLabelWaitTimeout time.Duration `name:"pod_label_wait_timeout" default:"10m"`
PodDeletionWaitTimeout time.Duration `name:"pod_deletion_wait_timeout" default:"10m"`
PodTerminateGracePeriod time.Duration `name:"pod_terminate_grace_period" default:"5m"`
PodPriorityClassName string `name:"pod_priority_class_name"`
ClusterLabels map[string]string `name:"cluster_labels" default:"application:spilo"`
ClusterNameLabel string `name:"cluster_name_label" default:"cluster-name"`
PodRoleLabel string `name:"pod_role_label" default:"spilo-role"`
+8 -4
View File
@@ -5,8 +5,8 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/zalando-incubator/postgres-operator/pkg/spec"
"github.com/mohae/deepcopy"
"github.com/zalando-incubator/postgres-operator/pkg/spec"
"k8s.io/apimachinery/pkg/runtime"
)
@@ -49,6 +49,7 @@ type KubernetesMetaConfiguration struct {
PodToleration map[string]string `json:"toleration,omitempty"`
// TODO: use namespacedname
PodEnvironmentConfigMap string `json:"pod_environment_configmap,omitempty"`
PodPriorityClassName string `json:"pod_priority_class_name,omitempty"`
}
type PostgresPodResourcesDefaults struct {
@@ -171,7 +172,9 @@ func (in *OperatorConfiguration) DeepCopyInto(out *OperatorConfiguration) {
}
func (in *OperatorConfiguration) DeepCopy() *OperatorConfiguration {
if in == nil { return nil }
if in == nil {
return nil
}
out := new(OperatorConfiguration)
in.DeepCopyInto(out)
return out
@@ -192,7 +195,9 @@ func (in *OperatorConfigurationList) DeepCopyInto(out *OperatorConfigurationList
}
func (in *OperatorConfigurationList) DeepCopy() *OperatorConfigurationList {
if in == nil { return nil }
if in == nil {
return nil
}
out := new(OperatorConfigurationList)
in.DeepCopyInto(out)
return out
@@ -204,4 +209,3 @@ func (in *OperatorConfigurationList) DeepCopyObject() runtime.Object {
}
return nil
}