Skip to content

Commit 26906b5

Browse files
tsuzuJoelSpeed
andcommitted
Add missing comments with serialized names
Apply suggestions from code review Co-authored-by: Joel Speed <[email protected]>
1 parent c3ed535 commit 26906b5

16 files changed

+76
-14
lines changed

api/v1beta1/cluster_types.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ type ClusterSpec struct {
484484
// +optional
485485
InfrastructureRef *corev1.ObjectReference `json:"infrastructureRef,omitempty"`
486486

487-
// This encapsulates the topology for the cluster.
487+
// topology encapsulates the topology for the cluster.
488488
// NOTE: It is required to enable the ClusterTopology
489489
// feature gate flag to activate managed topologies support;
490490
// this feature is highly experimental, and parts of it might still be not implemented.
@@ -844,6 +844,7 @@ type ClusterNetwork struct {
844844

845845
// NetworkRanges represents ranges of network addresses.
846846
type NetworkRanges struct {
847+
// cidrBlocks is a list of CIDR blocks.
847848
CIDRBlocks []string `json:"cidrBlocks"`
848849
}
849850

api/v1beta1/clusterclass_types.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -296,13 +296,15 @@ type MachineHealthCheckClass struct {
296296
// +optional
297297
UnhealthyConditions []UnhealthyCondition `json:"unhealthyConditions,omitempty"`
298298

299-
// Any further remediation is only allowed if at most "MaxUnhealthy" machines selected by
299+
// maxUnhealthy specifies the maximum number of unhealthy machines allowed.
300+
// Any further remediation is only allowed if at most "maxUnhealthy" machines selected by
300301
// "selector" are not healthy.
301302
// +optional
302303
MaxUnhealthy *intstr.IntOrString `json:"maxUnhealthy,omitempty"`
303304

305+
// unhealthyRange specifies the range of unhealthy machines allowed.
304306
// Any further remediation is only allowed if the number of machines selected by "selector" as not healthy
305-
// is within the range of "UnhealthyRange". Takes precedence over MaxUnhealthy.
307+
// is within the range of "unhealthyRange". Takes precedence over maxUnhealthy.
306308
// Eg. "[3-5]" - This means that remediation will be allowed only when:
307309
// (a) there are at least 3 unhealthy machines (and)
308310
// (b) there are at most 5 unhealthy machines

api/v1beta1/machinehealthcheck_types.go

+10-2
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,18 @@ type MachineHealthCheckSpec struct {
6565
// +optional
6666
UnhealthyConditions []UnhealthyCondition `json:"unhealthyConditions,omitempty"`
6767

68-
// Any further remediation is only allowed if at most "MaxUnhealthy" machines selected by
68+
// maxUnhealthy specifies the maximum number of unhealthy machines allowed.
69+
// Any further remediation is only allowed if at most "maxUnhealthy" machines selected by
6970
// "selector" are not healthy.
7071
//
7172
// Deprecated: This field is deprecated and is going to be removed in the next apiVersion. Please see https://github.com/kubernetes-sigs/cluster-api/issues/10722 for more details.
7273
//
7374
// +optional
7475
MaxUnhealthy *intstr.IntOrString `json:"maxUnhealthy,omitempty"`
7576

77+
// unhealthyRange specifies the range of unhealthy machines allowed.
7678
// Any further remediation is only allowed if the number of machines selected by "selector" as not healthy
77-
// is within the range of "UnhealthyRange". Takes precedence over MaxUnhealthy.
79+
// is within the range of "unhealthyRange". Takes precedence over maxUnhealthy.
7880
// Eg. "[3-5]" - This means that remediation will be allowed only when:
7981
// (a) there are at least 3 unhealthy machines (and)
8082
// (b) there are at most 5 unhealthy machines
@@ -118,14 +120,20 @@ type MachineHealthCheckSpec struct {
118120
// specified as a duration. When the named condition has been in the given
119121
// status for at least the timeout value, a node is considered unhealthy.
120122
type UnhealthyCondition struct {
123+
// type of Node condition
121124
// +kubebuilder:validation:Type=string
122125
// +kubebuilder:validation:MinLength=1
123126
Type corev1.NodeConditionType `json:"type"`
124127

128+
// status of the condition, one of True, False, Unknown.
125129
// +kubebuilder:validation:Type=string
126130
// +kubebuilder:validation:MinLength=1
127131
Status corev1.ConditionStatus `json:"status"`
128132

133+
// timeout is the duration that a node must be in a given status for,
134+
// after which the node is considered unhealthy.
135+
// For example, with a value of "1h", the node must match the status
136+
// for at least 1 hour before being considered unhealthy.
129137
Timeout metav1.Duration `json:"timeout"`
130138
}
131139

api/v1beta1/machineset_types.go

+10
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,10 @@ type MachineSetStatus struct {
309309
// +optional
310310
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
311311

312+
// failureReason will be set in the event that there is a terminal problem
313+
// reconciling the Machine and will contain a succinct value suitable
314+
// for machine interpretation.
315+
//
312316
// In the event that there is a terminal problem reconciling the
313317
// replicas, both FailureReason and FailureMessage will be set. FailureReason
314318
// will be populated with a succinct value suitable for machine
@@ -332,10 +336,16 @@ type MachineSetStatus struct {
332336
//
333337
// +optional
334338
FailureReason *capierrors.MachineSetStatusError `json:"failureReason,omitempty"`
339+
340+
// failureMessage will be set in the event that there is a terminal problem
341+
// reconciling the Machine and will contain a more verbose string suitable
342+
// for logging and human consumption.
343+
//
335344
// Deprecated: This field is deprecated and is going to be removed in the next apiVersion. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details.
336345
//
337346
// +optional
338347
FailureMessage *string `json:"failureMessage,omitempty"`
348+
339349
// conditions defines current service state of the MachineSet.
340350
// +optional
341351
Conditions Conditions `json:"conditions,omitempty"`

bootstrap/kubeadm/api/v1beta1/kubeadm_types.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,9 @@ type KubeConfigAuthExec struct {
662662
// KubeConfigAuthExecEnv is used for setting environment variables when executing an exec-based
663663
// credential plugin.
664664
type KubeConfigAuthExecEnv struct {
665-
Name string `json:"name"`
665+
// name of the environment variable
666+
Name string `json:"name"`
667+
// value of the environment variable
666668
Value string `json:"value"`
667669
}
668670

bootstrap/kubeadm/api/v1beta1/kubeadmconfigtemplate_types.go

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424

2525
// KubeadmConfigTemplateSpec defines the desired state of KubeadmConfigTemplate.
2626
type KubeadmConfigTemplateSpec struct {
27+
// template defines the desired state of KubeadmConfigTemplate.
2728
Template KubeadmConfigTemplateResource `json:"template"`
2829
}
2930

controlplane/kubeadm/api/v1beta1/kubeadmcontrolplanetemplate_types.go

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525

2626
// KubeadmControlPlaneTemplateSpec defines the desired state of KubeadmControlPlaneTemplate.
2727
type KubeadmControlPlaneTemplateSpec struct {
28+
// template defines the desired state of KubeadmControlPlaneTemplate.
2829
Template KubeadmControlPlaneTemplateResource `json:"template"`
2930
}
3031

internal/apis/bootstrap/kubeadm/v1alpha3/kubeadmconfigtemplate_types.go

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222

2323
// KubeadmConfigTemplateSpec defines the desired state of KubeadmConfigTemplate.
2424
type KubeadmConfigTemplateSpec struct {
25+
// template defines the desired state of KubeadmConfigTemplate.
2526
Template KubeadmConfigTemplateResource `json:"template"`
2627
}
2728

internal/apis/bootstrap/kubeadm/v1alpha4/kubeadmconfigtemplate_types.go

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222

2323
// KubeadmConfigTemplateSpec defines the desired state of KubeadmConfigTemplate.
2424
type KubeadmConfigTemplateSpec struct {
25+
// template defines the desired state of KubeadmConfigTemplate.
2526
Template KubeadmConfigTemplateResource `json:"template"`
2627
}
2728

internal/apis/controlplane/kubeadm/v1alpha4/kubeadmcontrolplanetemplate_types.go

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222

2323
// KubeadmControlPlaneTemplateSpec defines the desired state of KubeadmControlPlaneTemplate.
2424
type KubeadmControlPlaneTemplateSpec struct {
25+
// template defines the desired state of KubeadmControlPlaneTemplate.
2526
Template KubeadmControlPlaneTemplateResource `json:"template"`
2627
}
2728

internal/apis/core/v1alpha3/cluster_types.go

+1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ type ClusterNetwork struct {
9292

9393
// NetworkRanges represents ranges of network addresses.
9494
type NetworkRanges struct {
95+
// cidrBlocks is a list of CIDR blocks.
9596
CIDRBlocks []string `json:"cidrBlocks"`
9697
}
9798

internal/apis/core/v1alpha3/machinehealthcheck_types.go

+10-3
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,14 @@ type MachineHealthCheckSpec struct {
4040
// +kubebuilder:validation:MinItems=1
4141
UnhealthyConditions []UnhealthyCondition `json:"unhealthyConditions"`
4242

43-
// Any further remediation is only allowed if at most "MaxUnhealthy" machines selected by
43+
// maxUnhealthy specifies the maximum number of unhealthy machines allowed.
44+
// Any further remediation is only allowed if at most "maxUnhealthy" machines selected by
4445
// "selector" are not healthy.
4546
// +optional
4647
MaxUnhealthy *intstr.IntOrString `json:"maxUnhealthy,omitempty"`
4748

48-
// Machines older than this duration without a node will be considered to have
49-
// failed and will be remediated.
49+
// nodeStartupTimeout is the duration after which machines without a node will be considered to
50+
// have failed and will be remediated.
5051
// +optional
5152
NodeStartupTimeout *metav1.Duration `json:"nodeStartupTimeout,omitempty"`
5253

@@ -68,14 +69,20 @@ type MachineHealthCheckSpec struct {
6869
// specified as a duration. When the named condition has been in the given
6970
// status for at least the timeout value, a node is considered unhealthy.
7071
type UnhealthyCondition struct {
72+
// type of Node condition
7173
// +kubebuilder:validation:Type=string
7274
// +kubebuilder:validation:MinLength=1
7375
Type corev1.NodeConditionType `json:"type"`
7476

77+
// status of the condition, one of True, False, Unknown.
7578
// +kubebuilder:validation:Type=string
7679
// +kubebuilder:validation:MinLength=1
7780
Status corev1.ConditionStatus `json:"status"`
7881

82+
// timeout is the duration that a node must be in a given status for,
83+
// after which the node is considered unhealthy.
84+
// For example, with a value of "1h", the node must match the status
85+
// for at least 1 hour before being considered unhealthy.
7986
Timeout metav1.Duration `json:"timeout"`
8087
}
8188

internal/apis/core/v1alpha3/machineset_types.go

+8
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@ type MachineSetStatus struct {
135135
// +optional
136136
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
137137

138+
// failureReason will be set in the event that there is a terminal problem
139+
// reconciling the Machine and will contain a succinct value suitable
140+
// for machine interpretation.
141+
//
138142
// In the event that there is a terminal problem reconciling the
139143
// replicas, both FailureReason and FailureMessage will be set. FailureReason
140144
// will be populated with a succinct value suitable for machine
@@ -155,6 +159,10 @@ type MachineSetStatus struct {
155159
// controller's output.
156160
// +optional
157161
FailureReason *capierrors.MachineSetStatusError `json:"failureReason,omitempty"`
162+
163+
// failureMessage will be set in the event that there is a terminal problem
164+
// reconciling the Machine and will contain a more verbose string suitable
165+
// for logging and human consumption.
158166
// +optional
159167
FailureMessage *string `json:"failureMessage,omitempty"`
160168
}

internal/apis/core/v1alpha4/cluster_types.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ type ClusterSpec struct {
6161
// +optional
6262
InfrastructureRef *corev1.ObjectReference `json:"infrastructureRef,omitempty"`
6363

64-
// This encapsulates the topology for the cluster.
64+
// topology encapsulates the topology for the cluster.
6565
// NOTE: It is required to enable the ClusterTopology
6666
// feature gate flag to activate managed topologies support;
6767
// this feature is highly experimental, and parts of it might still be not implemented.
@@ -172,6 +172,7 @@ type ClusterNetwork struct {
172172

173173
// NetworkRanges represents ranges of network addresses.
174174
type NetworkRanges struct {
175+
// cidrBlocks is a list of CIDR blocks.
175176
CIDRBlocks []string `json:"cidrBlocks"`
176177
}
177178

internal/apis/core/v1alpha4/machinehealthcheck_types.go

+12-4
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,24 @@ type MachineHealthCheckSpec struct {
4040
// +kubebuilder:validation:MinItems=1
4141
UnhealthyConditions []UnhealthyCondition `json:"unhealthyConditions"`
4242

43-
// Any further remediation is only allowed if at most "MaxUnhealthy" machines selected by
43+
// maxUnhealthy specifies the maximum number of unhealthy machines allowed.
44+
// Any further remediation is only allowed if at most "maxUnhealthy" machines selected by
4445
// "selector" are not healthy.
4546
// +optional
4647
MaxUnhealthy *intstr.IntOrString `json:"maxUnhealthy,omitempty"`
4748

49+
// unhealthyRange specifies the range of unhealthy machines allowed.
4850
// Any further remediation is only allowed if the number of machines selected by "selector" as not healthy
49-
// is within the range of "UnhealthyRange". Takes precedence over MaxUnhealthy.
51+
// is within the range of "unhealthyRange". Takes precedence over maxUnhealthy.
5052
// Eg. "[3-5]" - This means that remediation will be allowed only when:
5153
// (a) there are at least 3 unhealthy machines (and)
5254
// (b) there are at most 5 unhealthy machines
5355
// +optional
5456
// +kubebuilder:validation:Pattern=^\[[0-9]+-[0-9]+\]$
5557
UnhealthyRange *string `json:"unhealthyRange,omitempty"`
5658

57-
// Machines older than this duration without a node will be considered to have
58-
// failed and will be remediated.
59+
// nodeStartupTimeout is the duration after which machines without a node will be considered to
60+
// have failed and will be remediated.
5961
// If not set, this value is defaulted to 10 minutes.
6062
// If you wish to disable this feature, set the value explicitly to 0.
6163
// +optional
@@ -79,14 +81,20 @@ type MachineHealthCheckSpec struct {
7981
// specified as a duration. When the named condition has been in the given
8082
// status for at least the timeout value, a node is considered unhealthy.
8183
type UnhealthyCondition struct {
84+
// type of Node condition
8285
// +kubebuilder:validation:Type=string
8386
// +kubebuilder:validation:MinLength=1
8487
Type corev1.NodeConditionType `json:"type"`
8588

89+
// status of the condition, one of True, False, Unknown.
8690
// +kubebuilder:validation:Type=string
8791
// +kubebuilder:validation:MinLength=1
8892
Status corev1.ConditionStatus `json:"status"`
8993

94+
// timeout is the duration that a node must be in a given status for,
95+
// after which the node is considered unhealthy.
96+
// For example, with a value of "1h", the node must match the status
97+
// for at least 1 hour before being considered unhealthy.
9098
Timeout metav1.Duration `json:"timeout"`
9199
}
92100

internal/apis/core/v1alpha4/machineset_types.go

+9
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ type MachineSetStatus struct {
142142
// +optional
143143
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
144144

145+
// failureReason will be set in the event that there is a terminal problem
146+
// reconciling the Machine and will contain a succinct value suitable
147+
// for machine interpretation.
148+
//
145149
// In the event that there is a terminal problem reconciling the
146150
// replicas, both FailureReason and FailureMessage will be set. FailureReason
147151
// will be populated with a succinct value suitable for machine
@@ -162,8 +166,13 @@ type MachineSetStatus struct {
162166
// controller's output.
163167
// +optional
164168
FailureReason *capierrors.MachineSetStatusError `json:"failureReason,omitempty"`
169+
170+
// failureMessage will be set in the event that there is a terminal problem
171+
// reconciling the Machine and will contain a more verbose string suitable
172+
// for logging and human consumption.
165173
// +optional
166174
FailureMessage *string `json:"failureMessage,omitempty"`
175+
167176
// conditions defines current service state of the MachineSet.
168177
// +optional
169178
Conditions Conditions `json:"conditions,omitempty"`

0 commit comments

Comments
 (0)