Skip to content

Commit

Permalink
Merge pull request #96 from vshn/feature/psql_node_selector
Browse files Browse the repository at this point in the history
Add feature to specify a nodeSelector for the postgreSQL instance
  • Loading branch information
TheBigLee authored Feb 16, 2023
2 parents b385d24 + a78e1b7 commit 45c5a9d
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 0 deletions.
9 changes: 9 additions & 0 deletions apis/vshn/v1/dbaas_vshn_postgresql.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ type VSHNPostgreSQLParameters struct {
// Size contains settings to control the sizing of a service.
Size VSHNDBaaSSizeSpec `json:"size,omitempty"`

// Scheduling contains settings to control the scheduling of an instance.
Scheduling VSHNDBaaSSchedulingSpec `json:"scheduling,omitempty"`

// Network contains any network related settings.
Network VSHNDBaaSNetworkSpec `json:"network,omitempty"`

Expand All @@ -64,6 +67,12 @@ type VSHNPostgreSQLServiceSpec struct {
PostgreSQLSettings runtime.RawExtension `json:"pgSettings,omitempty"`
}

// VSHNDBaaSSchedulingSpec contains settings to control the scheduling of an instance.
type VSHNDBaaSSchedulingSpec struct {
// NodeSelector is a selector which must match a node’s labels for the pod to be scheduled on that node
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
}

// VSHNDBaaSMaintenanceScheduleSpec contains settings to control the maintenance of an instance.
type VSHNDBaaSMaintenanceScheduleSpec struct {
// +kubebuilder:validation:Enum=monday;tuesday;wednesday;thursday;friday;saturday;sunday;never
Expand Down
1 change: 1 addition & 0 deletions component/vshn_postgres.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ local composition =
comp.FromCompositeFieldPath('metadata.labels[crossplane.io/composite]', 'spec.forProvider.manifest.metadata.name'),

comp.FromCompositeFieldPath('spec.parameters.size.disk', 'spec.forProvider.manifest.spec.pods.persistentVolume.size'),
comp.FromCompositeFieldPath('spec.parameters.scheduling.nodeSelector', 'spec.forProvider.manifest.spec.pods.scheduling.nodeSelector'),
comp.FromCompositeFieldPath('spec.parameters.service.majorVersion', 'spec.forProvider.manifest.spec.postgres.version'),
comp.FromCompositeFieldPath('metadata.labels[crossplane.io/composite]', 'spec.forProvider.manifest.spec.sgInstanceProfile'),
comp.FromCompositeFieldPath('metadata.labels[crossplane.io/composite]', 'spec.forProvider.manifest.spec.configurations.sgPostgresConfig'),
Expand Down
9 changes: 9 additions & 0 deletions crds/vshn.appcat.vshn.io_vshnpostgresqls.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ spec:
type: string
type: array
type: object
scheduling:
description: Scheduling contains settings to control the scheduling of an instance.
properties:
nodeSelector:
additionalProperties:
type: string
description: NodeSelector is a selector which must match a node’s labels for the pod to be scheduled on that node
type: object
type: object
service:
description: Service contains PostgreSQL DBaaS specific properties
properties:
Expand Down
12 changes: 12 additions & 0 deletions tests/golden/vshn/appcat/appcat/20_xrd_vshn_postgres.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,18 @@ spec:
type: string
type: array
type: object
scheduling:
description: Scheduling contains settings to control the scheduling
of an instance.
properties:
nodeSelector:
additionalProperties:
type: string
description: "NodeSelector is a selector which must match\
\ a node\u2019s labels for the pod to be scheduled on\
\ that node"
type: object
type: object
service:
default: {}
description: Service contains PostgreSQL DBaaS specific properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,9 @@ spec:
- fromFieldPath: spec.parameters.size.disk
toFieldPath: spec.forProvider.manifest.spec.pods.persistentVolume.size
type: FromCompositeFieldPath
- fromFieldPath: spec.parameters.scheduling.nodeSelector
toFieldPath: spec.forProvider.manifest.spec.pods.scheduling.nodeSelector
type: FromCompositeFieldPath
- fromFieldPath: spec.parameters.service.majorVersion
toFieldPath: spec.forProvider.manifest.spec.postgres.version
type: FromCompositeFieldPath
Expand Down

0 comments on commit 45c5a9d

Please sign in to comment.