Skip to content

Commit 2d1ad4c

Browse files
hardikdrk8s-ci-robot
authored andcommitted
Add node-conditions to the MachineStatus (#483)
* Add node-conditions to the MachineStatus * Improve comments for node-conditions api
1 parent 3603557 commit 2d1ad4c

6 files changed

+126
-88
lines changed

pkg/apis/cluster/v1alpha1/machine_types.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,14 @@ type MachineStatus struct {
141141
// Addresses is a list of addresses assigned to the machine. Queried from cloud provider, if available.
142142
// +optional
143143
Addresses []corev1.NodeAddress `json:"addresses,omitempty"`
144+
145+
// List of conditions synced from the node conditions of the corresponding node-object.
146+
// Machine-controller is responsible for keeping conditions up-to-date.
147+
// MachineSet controller will be taking these conditions as a signal to decide if
148+
// machine is healthy or needs to be replaced.
149+
// Refer: https://kubernetes.io/docs/concepts/architecture/nodes/#condition
150+
// +optional
151+
Conditions []corev1.NodeCondition `json:"conditions,omitempty"`
144152
}
145153

146154
type MachineVersionInfo struct {

pkg/apis/cluster/v1alpha1/zz_generated.conversion.go

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

pkg/apis/cluster/v1alpha1/zz_generated.deepcopy.go

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

pkg/apis/cluster/zz_generated.api.register.go

Lines changed: 88 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -118,66 +118,42 @@ func Resource(resource string) schema.GroupResource {
118118
// +genclient
119119
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
120120

121-
type Cluster struct {
121+
type MachineDeployment struct {
122122
metav1.TypeMeta
123123
metav1.ObjectMeta
124-
Spec ClusterSpec
125-
Status ClusterStatus
124+
Spec MachineDeploymentSpec
125+
Status MachineDeploymentStatus
126126
}
127127

128128
// +genclient
129129
// +genclient
130130
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
131131

132-
type MachineSet struct {
132+
type Machine struct {
133133
metav1.TypeMeta
134134
metav1.ObjectMeta
135-
Spec MachineSetSpec
136-
Status MachineSetStatus
137-
}
138-
139-
type ClusterStatus struct {
140-
APIEndpoints []APIEndpoint
141-
ErrorReason clustercommon.ClusterStatusError
142-
ErrorMessage string
143-
ProviderStatus *pkgruntime.RawExtension
144-
}
145-
146-
type MachineSetStatus struct {
147-
Replicas int32
148-
FullyLabeledReplicas int32
149-
ReadyReplicas int32
150-
AvailableReplicas int32
151-
ObservedGeneration int64
152-
ErrorReason *clustercommon.MachineSetStatusError
153-
ErrorMessage *string
154-
}
155-
156-
type APIEndpoint struct {
157-
Host string
158-
Port int
159-
}
160-
161-
type MachineSetSpec struct {
162-
Replicas *int32
163-
MinReadySeconds int32
164-
Selector metav1.LabelSelector
165-
Template MachineTemplateSpec
166-
}
167-
168-
type ClusterSpec struct {
169-
ClusterNetwork ClusterNetworkingConfig
170-
ProviderConfig ProviderConfig
135+
Spec MachineSpec
136+
Status MachineStatus
171137
}
172138

173-
type MachineTemplateSpec struct {
174-
metav1.ObjectMeta
175-
Spec MachineSpec
139+
type MachineDeploymentStatus struct {
140+
ObservedGeneration int64
141+
Replicas int32
142+
UpdatedReplicas int32
143+
ReadyReplicas int32
144+
AvailableReplicas int32
145+
UnavailableReplicas int32
176146
}
177147

178-
type ProviderConfig struct {
179-
Value *pkgruntime.RawExtension
180-
ValueFrom *ProviderConfigSource
148+
type MachineStatus struct {
149+
NodeRef *corev1.ObjectReference
150+
LastUpdated metav1.Time
151+
Versions *MachineVersionInfo
152+
ErrorReason *clustercommon.MachineStatusError
153+
ErrorMessage *string
154+
ProviderStatus *pkgruntime.RawExtension
155+
Addresses []corev1.NodeAddress
156+
Conditions []corev1.NodeCondition
181157
}
182158

183159
type MachineSpec struct {
@@ -188,42 +164,14 @@ type MachineSpec struct {
188164
ConfigSource *corev1.NodeConfigSource
189165
}
190166

191-
type ProviderConfigSource struct {
192-
}
193-
194167
type MachineVersionInfo struct {
195168
Kubelet string
196169
ControlPlane string
197170
}
198171

199-
type ClusterNetworkingConfig struct {
200-
Services NetworkRanges
201-
Pods NetworkRanges
202-
ServiceDomain string
203-
}
204-
205-
// +genclient
206-
// +genclient
207-
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
208-
209-
type MachineDeployment struct {
210-
metav1.TypeMeta
211-
metav1.ObjectMeta
212-
Spec MachineDeploymentSpec
213-
Status MachineDeploymentStatus
214-
}
215-
216-
type NetworkRanges struct {
217-
CIDRBlocks []string
218-
}
219-
220-
type MachineDeploymentStatus struct {
221-
ObservedGeneration int64
222-
Replicas int32
223-
UpdatedReplicas int32
224-
ReadyReplicas int32
225-
AvailableReplicas int32
226-
UnavailableReplicas int32
172+
type ProviderConfig struct {
173+
Value *pkgruntime.RawExtension
174+
ValueFrom *ProviderConfigSource
227175
}
228176

229177
type MachineDeploymentSpec struct {
@@ -237,11 +185,19 @@ type MachineDeploymentSpec struct {
237185
ProgressDeadlineSeconds *int32
238186
}
239187

188+
type ProviderConfigSource struct {
189+
}
190+
240191
type MachineDeploymentStrategy struct {
241192
Type clustercommon.MachineDeploymentStrategyType
242193
RollingUpdate *MachineRollingUpdateDeployment
243194
}
244195

196+
type MachineTemplateSpec struct {
197+
metav1.ObjectMeta
198+
Spec MachineSpec
199+
}
200+
245201
type MachineRollingUpdateDeployment struct {
246202
MaxUnavailable *utilintstr.IntOrString
247203
MaxSurge *utilintstr.IntOrString
@@ -251,21 +207,66 @@ type MachineRollingUpdateDeployment struct {
251207
// +genclient
252208
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
253209

254-
type Machine struct {
210+
type Cluster struct {
255211
metav1.TypeMeta
256212
metav1.ObjectMeta
257-
Spec MachineSpec
258-
Status MachineStatus
213+
Spec ClusterSpec
214+
Status ClusterStatus
259215
}
260216

261-
type MachineStatus struct {
262-
NodeRef *corev1.ObjectReference
263-
LastUpdated metav1.Time
264-
Versions *MachineVersionInfo
265-
ErrorReason *clustercommon.MachineStatusError
266-
ErrorMessage *string
217+
// +genclient
218+
// +genclient
219+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
220+
221+
type MachineSet struct {
222+
metav1.TypeMeta
223+
metav1.ObjectMeta
224+
Spec MachineSetSpec
225+
Status MachineSetStatus
226+
}
227+
228+
type ClusterStatus struct {
229+
APIEndpoints []APIEndpoint
230+
ErrorReason clustercommon.ClusterStatusError
231+
ErrorMessage string
267232
ProviderStatus *pkgruntime.RawExtension
268-
Addresses []corev1.NodeAddress
233+
}
234+
235+
type MachineSetStatus struct {
236+
Replicas int32
237+
FullyLabeledReplicas int32
238+
ReadyReplicas int32
239+
AvailableReplicas int32
240+
ObservedGeneration int64
241+
ErrorReason *clustercommon.MachineSetStatusError
242+
ErrorMessage *string
243+
}
244+
245+
type APIEndpoint struct {
246+
Host string
247+
Port int
248+
}
249+
250+
type MachineSetSpec struct {
251+
Replicas *int32
252+
MinReadySeconds int32
253+
Selector metav1.LabelSelector
254+
Template MachineTemplateSpec
255+
}
256+
257+
type ClusterSpec struct {
258+
ClusterNetwork ClusterNetworkingConfig
259+
ProviderConfig ProviderConfig
260+
}
261+
262+
type ClusterNetworkingConfig struct {
263+
Services NetworkRanges
264+
Pods NetworkRanges
265+
ServiceDomain string
266+
}
267+
268+
type NetworkRanges struct {
269+
CIDRBlocks []string
269270
}
270271

271272
//

pkg/apis/cluster/zz_generated.deepcopy.go

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

pkg/openapi/openapi_generated.go

Lines changed: 14 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)