mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-07 01:51:59 +02:00
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:
+19
-15
@@ -8,8 +8,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
@@ -127,14 +127,15 @@ type PostgresSpec struct {
|
||||
// load balancers' source ranges are the same for master and replica services
|
||||
AllowedSourceRanges []string `json:"allowedSourceRanges"`
|
||||
|
||||
NumberOfInstances int32 `json:"numberOfInstances"`
|
||||
Users map[string]UserFlags `json:"users"`
|
||||
MaintenanceWindows []MaintenanceWindow `json:"maintenanceWindows,omitempty"`
|
||||
Clone CloneDescription `json:"clone"`
|
||||
ClusterName string `json:"-"`
|
||||
Databases map[string]string `json:"databases,omitempty"`
|
||||
Tolerations []v1.Toleration `json:"tolerations,omitempty"`
|
||||
Sidecars []Sidecar `json:"sidecars,omitempty"`
|
||||
NumberOfInstances int32 `json:"numberOfInstances"`
|
||||
Users map[string]UserFlags `json:"users"`
|
||||
MaintenanceWindows []MaintenanceWindow `json:"maintenanceWindows,omitempty"`
|
||||
Clone CloneDescription `json:"clone"`
|
||||
ClusterName string `json:"-"`
|
||||
Databases map[string]string `json:"databases,omitempty"`
|
||||
Tolerations []v1.Toleration `json:"tolerations,omitempty"`
|
||||
Sidecars []Sidecar `json:"sidecars,omitempty"`
|
||||
PodPriorityClassName string `json:"pod_priority_class_name,omitempty"`
|
||||
}
|
||||
|
||||
// PostgresqlList defines a list of PostgreSQL clusters.
|
||||
@@ -155,7 +156,9 @@ var (
|
||||
// will not contain any private fields not-reachable to deepcopy. This should be ok,
|
||||
// since Error is never read from a Kubernetes object.
|
||||
func (p *Postgresql) Clone() *Postgresql {
|
||||
if p == nil {return nil}
|
||||
if p == nil {
|
||||
return nil
|
||||
}
|
||||
c := deepcopy.Copy(p).(*Postgresql)
|
||||
c.Error = nil
|
||||
return c
|
||||
@@ -169,7 +172,9 @@ func (in *Postgresql) DeepCopyInto(out *Postgresql) {
|
||||
}
|
||||
|
||||
func (in *Postgresql) DeepCopy() *Postgresql {
|
||||
if in == nil { return nil }
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Postgresql)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
@@ -182,7 +187,6 @@ func (in *Postgresql) DeepCopyObject() runtime.Object {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
func parseTime(s string) (time.Time, error) {
|
||||
parts := strings.Split(s, ":")
|
||||
if len(parts) != 2 {
|
||||
@@ -308,9 +312,10 @@ func validateCloneClusterDescription(clone *CloneDescription) error {
|
||||
type postgresqlListCopy PostgresqlList
|
||||
type postgresqlCopy Postgresql
|
||||
|
||||
|
||||
func (in *PostgresqlList) DeepCopy() *PostgresqlList {
|
||||
if in == nil { return nil }
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(PostgresqlList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
@@ -330,7 +335,6 @@ func (in *PostgresqlList) DeepCopyObject() runtime.Object {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
// UnmarshalJSON converts a JSON into the PostgreSQL object.
|
||||
func (p *Postgresql) UnmarshalJSON(data []byte) error {
|
||||
var tmp postgresqlCopy
|
||||
|
||||
+2
-2
@@ -11,10 +11,10 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/api/core/v1"
|
||||
"k8s.io/api/apps/v1beta1"
|
||||
"k8s.io/api/core/v1"
|
||||
policyv1beta1 "k8s.io/api/policy/v1beta1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user