Skip to content

Commit

Permalink
Use seperate defaultSpecs for ControlPlaneMachineSet (#85)
Browse files Browse the repository at this point in the history
* Use seperate defaultSpecs for ControlPlaneMachineSet

* Apply suggestions from code review

Co-authored-by: Simon Gerber <[email protected]>

---------

Co-authored-by: Simon Gerber <[email protected]>
  • Loading branch information
DebakelOrakel and simu authored Jun 19, 2024
1 parent af08510 commit 487ea6f
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 12 deletions.
37 changes: 37 additions & 0 deletions class/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ parameters:
projectName: none
infrastructureID: none
defaultSpecs:
vsphere: {}
aws: {}
azure: {}
gcp:
Expand Down Expand Up @@ -42,6 +43,42 @@ parameters:
tags: []
userDataSecret:
name: worker-user-data
controlPlaneDefaultSpecs:
vsphere: {}
aws: {}
azure: {}
gcp:
template:
machines_v1beta1_machine_openshift_io:
spec:
providerSpec:
value:
apiVersion: gcpprovider.openshift.io/v1beta1
canIPForward: false
credentialsSecret:
name: gcp-cloud-credentials
deletionProtection: false
disks:
- autoDelete: true
boot: true
image: ${openshift4_nodes:infrastructureID}-rhcos-image
labels: null
sizeGb: 128
type: pd-ssd
kind: GCPMachineProviderSpec
metadata:
creationTimestamp: null
networkInterfaces:
- network: ${openshift4_nodes:infrastructureID}-network
subnetwork: ${openshift4_nodes:infrastructureID}-worker-subnet
projectID: ${openshift4_nodes:projectName}
region: ${facts:region}
serviceAccounts:
- email: ${openshift4_nodes:infrastructureID}-w@${openshift4_nodes:projectName}.iam.gserviceaccount.com
scopes:
- https://www.googleapis.com/auth/cloud-platform
userDataSecret:
name: master-user-data
nodeConfig:
cgroupMode: v1

Expand Down
12 changes: 1 addition & 11 deletions component/machine-sets.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,7 @@ local machineSetSpecs = function(name, set, role)

local cpMachineSetSpecs = function(set)
kube._Object('machine.openshift.io/v1', 'ControlPlaneMachineSet', 'cluster') {
spec+: {
template+: {
machines_v1beta1_machine_openshift_io: {
spec+: {
providerSpec+: {
value+: params.defaultSpecs[inv.parameters.facts.cloud].template.spec.providerSpec.value,
},
},
},
},
},
spec+: params.controlPlaneDefaultSpecs[inv.parameters.facts.cloud],
} + {
metadata+: {
annotations+: std.get(set, 'annotations', {}),
Expand Down
11 changes: 11 additions & 0 deletions docs/modules/ROOT/pages/references/parameters.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ A dictionary holding the default values applied to each `machinesets.machine.ope
The top level keys are the names of cloud providers as reported by the cluster fact `${facts:cloud}`.
The values can be everything that's accepted in the `spec` field of a `machinesets.machine.openshift.io` object.

== `controlPlaneDefaultSpecs`

[horizontal]
type:: dictionary
default:: Sensible defaults for a growing number of cloud providers.

A dictionary holding the default values applied to each `controlplanemachinesets.machine.openshift.io` object created by this component.

The top level keys are the names of cloud providers as reported by the cluster fact `${facts:cloud}`.
The values can be everything that's accepted in the `spec` field of a `controlplanemachinesets.machine.openshift.io` object.

== `infrastructureID`

[horizontal]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ spec:
tags:
- infra-id-master
userDataSecret:
name: worker-user-data
name: master-user-data
zone: europe-west6-a

0 comments on commit 487ea6f

Please sign in to comment.