Skip to content

Commit 85d1a72

Browse files
bbsbbmcoletti
andauthored
Add scheduler name support - [Update zalando#990] (zalando#1226)
* Add ability to specify alternative schedulers via schedulerName. Co-authored-by: [email protected] <[email protected]>
1 parent cfd83e3 commit 85d1a72

File tree

7 files changed

+24
-0
lines changed

7 files changed

+24
-0
lines changed

Diff for: charts/postgres-operator/crds/postgresqls.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,8 @@ spec:
354354
memory:
355355
type: string
356356
pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$'
357+
schedulerName:
358+
type: string
357359
serviceAnnotations:
358360
type: object
359361
additionalProperties:

Diff for: docs/reference/cluster_manifest.md

+4
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ These parameters are grouped directly under the `spec` key in the manifest.
6565
custom Docker image that overrides the **docker_image** operator parameter.
6666
It should be a [Spilo](https://github.com/zalando/spilo) image. Optional.
6767

68+
* **schedulerName**
69+
specifies the scheduling profile for database pods. If no value is provided
70+
K8s' `default-scheduler` will be used. Optional.
71+
6872
* **spiloRunAsUser**
6973
sets the user ID which should be used in the container to run the process.
7074
This must be set to run the container without root. By default the container

Diff for: manifests/postgresql.crd.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,8 @@ spec:
350350
memory:
351351
type: string
352352
pattern: '^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$'
353+
schedulerName:
354+
type: string
353355
serviceAnnotations:
354356
type: object
355357
additionalProperties:

Diff for: pkg/apis/acid.zalan.do/v1/crds.go

+3
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,9 @@ var PostgresCRDResourceValidation = apiextv1.CustomResourceValidation{
535535
},
536536
},
537537
},
538+
"schedulerName": {
539+
Type: "string",
540+
},
538541
"serviceAnnotations": {
539542
Type: "object",
540543
AdditionalProperties: &apiextv1.JSONSchemaPropsOrBool{

Diff for: pkg/apis/acid.zalan.do/v1/postgresql_type.go

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ type PostgresSpec struct {
6060
ClusterName string `json:"-"`
6161
Databases map[string]string `json:"databases,omitempty"`
6262
PreparedDatabases map[string]PreparedDatabase `json:"preparedDatabases,omitempty"`
63+
SchedulerName *string `json:"schedulerName,omitempty"`
6364
Tolerations []v1.Toleration `json:"tolerations,omitempty"`
6465
Sidecars []Sidecar `json:"sidecars,omitempty"`
6566
InitContainers []v1.Container `json:"initContainers,omitempty"`

Diff for: pkg/apis/acid.zalan.do/v1/zz_generated.deepcopy.go

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: pkg/cluster/k8sres.go

+7
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,7 @@ func (c *Cluster) generatePodTemplate(
537537
spiloRunAsGroup *int64,
538538
spiloFSGroup *int64,
539539
nodeAffinity *v1.Affinity,
540+
schedulerName *string,
540541
terminateGracePeriod int64,
541542
podServiceAccountName string,
542543
kubeIAMRole string,
@@ -575,6 +576,10 @@ func (c *Cluster) generatePodTemplate(
575576
SecurityContext: &securityContext,
576577
}
577578

579+
if schedulerName != nil {
580+
podSpec.SchedulerName = *schedulerName
581+
}
582+
578583
if shmVolume != nil && *shmVolume {
579584
addShmVolume(&podSpec)
580585
}
@@ -1184,6 +1189,7 @@ func (c *Cluster) generateStatefulSet(spec *acidv1.PostgresSpec) (*appsv1.Statef
11841189
effectiveRunAsGroup,
11851190
effectiveFSGroup,
11861191
nodeAffinity(c.OpConfig.NodeReadinessLabel),
1192+
spec.SchedulerName,
11871193
int64(c.OpConfig.PodTerminateGracePeriod.Seconds()),
11881194
c.OpConfig.PodServiceAccountName,
11891195
c.OpConfig.KubeIAMRole,
@@ -1885,6 +1891,7 @@ func (c *Cluster) generateLogicalBackupJob() (*batchv1beta1.CronJob, error) {
18851891
nil,
18861892
nil,
18871893
nodeAffinity(c.OpConfig.NodeReadinessLabel),
1894+
nil,
18881895
int64(c.OpConfig.PodTerminateGracePeriod.Seconds()),
18891896
c.OpConfig.PodServiceAccountName,
18901897
c.OpConfig.KubeIAMRole,

0 commit comments

Comments
 (0)