Skip to content

Commit 351ee0d

Browse files
Fix review comments 4
1 parent c0657c7 commit 351ee0d

File tree

6 files changed

+76
-1
lines changed

6 files changed

+76
-1
lines changed

api/v1beta1/awsmachine_conversion.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ func (r *AWSMachineTemplate) ConvertTo(dstRaw conversion.Hub) error {
138138

139139
// Restore Status fields that don't exist in v1beta1.
140140
dst.Status.NodeInfo = restored.Status.NodeInfo
141+
dst.Status.Conditions = restored.Status.Conditions
141142

142143
return nil
143144
}

api/v1beta1/conversion.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,6 @@ func Convert_v1beta2_AWSMachineStatus_To_v1beta1_AWSMachineStatus(in *v1beta2.AW
110110
}
111111

112112
func Convert_v1beta2_AWSMachineTemplateStatus_To_v1beta1_AWSMachineTemplateStatus(in *v1beta2.AWSMachineTemplateStatus, out *AWSMachineTemplateStatus, s conversion.Scope) error {
113-
// NodeInfo field is ignored (dropped) as it doesn't exist in v1beta1
113+
// NodeInfo and Conditions fields are ignored (dropped) as they don't exist in v1beta1
114114
return autoConvert_v1beta2_AWSMachineTemplateStatus_To_v1beta1_AWSMachineTemplateStatus(in, out, s)
115115
}

api/v1beta1/zz_generated.conversion.go

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

api/v1beta2/awsmachinetemplate_types.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ type AWSMachineTemplateStatus struct {
7272
// https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20210310-opt-in-autoscaling-from-zero.md
7373
// +optional
7474
NodeInfo *NodeInfo `json:"nodeInfo,omitempty"`
75+
76+
// Conditions defines current service state of the AWSMachineTemplate.
77+
// +optional
78+
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
7579
}
7680

7781
// AWSMachineTemplateSpec defines the desired state of AWSMachineTemplate.
@@ -114,6 +118,16 @@ type AWSMachineTemplateResource struct {
114118
Spec AWSMachineSpec `json:"spec"`
115119
}
116120

121+
// GetConditions returns the observations of the operational state of the AWSMachineTemplate resource.
122+
func (r *AWSMachineTemplate) GetConditions() clusterv1.Conditions {
123+
return r.Status.Conditions
124+
}
125+
126+
// SetConditions sets the underlying service state of the AWSMachineTemplate to the predescribed clusterv1.Conditions.
127+
func (r *AWSMachineTemplate) SetConditions(conditions clusterv1.Conditions) {
128+
r.Status.Conditions = conditions
129+
}
130+
117131
func init() {
118132
SchemeBuilder.Register(&AWSMachineTemplate{}, &AWSMachineTemplateList{})
119133
}

api/v1beta2/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.

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

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,6 +1156,58 @@ spec:
11561156
This value is used for autoscaling from zero operations as defined in:
11571157
https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20210310-opt-in-autoscaling-from-zero.md
11581158
type: object
1159+
conditions:
1160+
description: Conditions defines current service state of the AWSMachineTemplate.
1161+
items:
1162+
description: Condition defines an observation of a Cluster API resource
1163+
operational state.
1164+
properties:
1165+
lastTransitionTime:
1166+
description: |-
1167+
lastTransitionTime is the last time the condition transitioned from one status to another.
1168+
This should be when the underlying condition changed. If that is not known, then using the time when
1169+
the API field changed is acceptable.
1170+
format: date-time
1171+
type: string
1172+
message:
1173+
description: |-
1174+
message is a human readable message indicating details about the transition.
1175+
This field may be empty.
1176+
maxLength: 10240
1177+
minLength: 1
1178+
type: string
1179+
reason:
1180+
description: |-
1181+
reason is the reason for the condition's last transition in CamelCase.
1182+
The specific API may choose whether or not this field is considered a guaranteed API.
1183+
This field may be empty.
1184+
maxLength: 256
1185+
minLength: 1
1186+
type: string
1187+
severity:
1188+
description: |-
1189+
severity provides an explicit classification of Reason code, so the users or machines can immediately
1190+
understand the current situation and act accordingly.
1191+
The Severity field MUST be set only when Status=False.
1192+
maxLength: 32
1193+
type: string
1194+
status:
1195+
description: status of the condition, one of True, False, Unknown.
1196+
type: string
1197+
type:
1198+
description: |-
1199+
type of condition in CamelCase or in foo.example.com/CamelCase.
1200+
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions
1201+
can be useful (see .node.status.conditions), the ability to deconflict is important.
1202+
maxLength: 256
1203+
minLength: 1
1204+
type: string
1205+
required:
1206+
- lastTransitionTime
1207+
- status
1208+
- type
1209+
type: object
1210+
type: array
11591211
nodeInfo:
11601212
description: |-
11611213
NodeInfo contains information about the node's architecture and operating system.

0 commit comments

Comments
 (0)