diff --git a/class/defaults.yml b/class/defaults.yml index e498793..6969b14 100644 --- a/class/defaults.yml +++ b/class/defaults.yml @@ -4,6 +4,7 @@ parameters: projectName: none infrastructureID: none defaultSpecs: + vsphere: {} aws: {} azure: {} gcp: @@ -42,6 +43,42 @@ parameters: tags: [] userDataSecret: name: worker-user-data + cpDefaultSpecs: + 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 diff --git a/component/machine-sets.jsonnet b/component/machine-sets.jsonnet index 06084fc..bc8f700 100644 --- a/component/machine-sets.jsonnet +++ b/component/machine-sets.jsonnet @@ -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.cpDefaultSpecs[inv.parameters.facts.cloud], } + { metadata+: { annotations+: std.get(set, 'annotations', {}), diff --git a/docs/modules/ROOT/pages/references/parameters.adoc b/docs/modules/ROOT/pages/references/parameters.adoc index 5662932..22c73c4 100644 --- a/docs/modules/ROOT/pages/references/parameters.adoc +++ b/docs/modules/ROOT/pages/references/parameters.adoc @@ -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. +== `cpDefaultSpecs` + +[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]