Skip to content

Commit 006a40e

Browse files
committed
reconcile rosamachinepool fields
- add Taints field - add TuningConfigs field
1 parent 25a0086 commit 006a40e

File tree

4 files changed

+216
-47
lines changed

4 files changed

+216
-47
lines changed

config/crd/bases/infrastructure.cluster.x-k8s.io_rosamachinepools.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,41 @@ spec:
9494
type: array
9595
subnet:
9696
type: string
97+
x-kubernetes-validations:
98+
- message: subnet is immutable
99+
rule: self == oldSelf
100+
taints:
101+
description: Taints specifies the taints to apply to the nodes of
102+
the machine pool
103+
items:
104+
properties:
105+
effect:
106+
description: The effect of the taint on pods that do not tolerate
107+
the taint. Valid effects are NoSchedule, PreferNoSchedule
108+
and NoExecute.
109+
enum:
110+
- NoSchedule
111+
- PreferNoSchedule
112+
- NoExecute
113+
type: string
114+
key:
115+
description: The taint key to be applied to a node.
116+
type: string
117+
value:
118+
description: The taint value corresponding to the taint key.
119+
pattern: ^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$
120+
type: string
121+
required:
122+
- effect
123+
- key
124+
type: object
125+
type: array
126+
tuningConfigs:
127+
description: TuningConfigs specifies the names of the tuning configs
128+
to be applied to this MachinePool. Tuning configs must already exist.
129+
items:
130+
type: string
131+
type: array
97132
version:
98133
description: Version specifies the penshift version of the nodes associated
99134
with this machinepool. ROSAControlPlane version is used if not set.
@@ -102,6 +137,7 @@ spec:
102137
- message: version must be a valid semantic version
103138
rule: self.matches('^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)$')
104139
required:
140+
- instanceType
105141
- nodePoolName
106142
type: object
107143
status:

exp/api/v1beta2/rosamachinepool_types.go

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package v1beta2
1818

1919
import (
20+
corev1 "k8s.io/api/core/v1"
2021
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2122

2223
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
@@ -45,37 +46,64 @@ type RosaMachinePoolSpec struct {
4546
// +optional
4647
AvailabilityZone string `json:"availabilityZone,omitempty"`
4748

49+
// +kubebuilder:validation:XValidation:rule="self == oldSelf", message="subnet is immutable"
50+
//
51+
// +immutable
4852
// +optional
4953
Subnet string `json:"subnet,omitempty"`
5054

5155
// Labels specifies labels for the Kubernetes node objects
5256
// +optional
5357
Labels map[string]string `json:"labels,omitempty"`
5458

59+
// Taints specifies the taints to apply to the nodes of the machine pool
60+
// +optional
61+
Taints []RosaTaint `json:"taints,omitempty"`
62+
5563
// AutoRepair specifies whether health checks should be enabled for machines
5664
// in the NodePool. The default is false.
5765
// +optional
5866
// +kubebuilder:default=false
5967
AutoRepair bool `json:"autoRepair,omitempty"`
6068

69+
// +kubebuilder:validation:Required
70+
//
6171
// InstanceType specifies the AWS instance type
62-
InstanceType string `json:"instanceType,omitempty"`
72+
InstanceType string `json:"instanceType"`
6373

6474
// Autoscaling specifies auto scaling behaviour for this MachinePool.
6575
// required if Replicas is not configured
6676
// +optional
6777
Autoscaling *RosaMachinePoolAutoScaling `json:"autoscaling,omitempty"`
6878

69-
// TODO(alberto): Enable and propagate this API input.
70-
// Taints []*Taint `json:"taints,omitempty"`
71-
// TuningConfigs []string `json:"tuningConfigs,omitempty"`
72-
// Version *Version `json:"version,omitempty"`
79+
// TuningConfigs specifies the names of the tuning configs to be applied to this MachinePool.
80+
// Tuning configs must already exist.
81+
// +optional
82+
TuningConfigs []string `json:"tuningConfigs,omitempty"`
7383

7484
// ProviderIDList contain a ProviderID for each machine instance that's currently managed by this machine pool.
7585
// +optional
7686
ProviderIDList []string `json:"providerIDList,omitempty"`
7787
}
7888

89+
type RosaTaint struct {
90+
// +kubebuilder:validation:Required
91+
//
92+
// The taint key to be applied to a node.
93+
Key string `json:"key"`
94+
// +kubebuilder:validation:Pattern:=`^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$`
95+
//
96+
// The taint value corresponding to the taint key.
97+
// +optional
98+
Value string `json:"value,omitempty"`
99+
// +kubebuilder:validation:Required
100+
// +kubebuilder:validation:Enum=NoSchedule;PreferNoSchedule;NoExecute
101+
//
102+
// The effect of the taint on pods that do not tolerate the taint.
103+
// Valid effects are NoSchedule, PreferNoSchedule and NoExecute.
104+
Effect corev1.TaintEffect `json:"effect"`
105+
}
106+
79107
// RosaMachinePoolAutoScaling specifies scaling options.
80108
type RosaMachinePoolAutoScaling struct {
81109
// +kubebuilder:validation:Minimum=1

exp/api/v1beta2/zz_generated.deepcopy.go

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)