@@ -25,6 +25,19 @@ type LinodeMachineTemplateSpec struct {
2525 Template LinodeMachineTemplateResource `json:"template"`
2626}
2727
28+ // LinodeMachineTemplateStatus defines the observed state of LinodeMachineTemplate
29+ // It is used to store the status of the LinodeMachineTemplate, such as tags.
30+ type LinodeMachineTemplateStatus struct {
31+
32+ // tags that are currently applied to the LinodeMachineTemplate.
33+ // +optional
34+ Tags []string `json:"tags,omitempty"`
35+
36+ // Conditions represent the latest available observations of a LinodeMachineTemplate's current state.
37+ // +optional
38+ Conditions []metav1.Condition `json:"conditions,omitempty"`
39+ }
40+
2841// LinodeMachineTemplateResource describes the data needed to create a LinodeMachine from a template.
2942type LinodeMachineTemplateResource struct {
3043 Spec LinodeMachineSpec `json:"spec"`
@@ -33,6 +46,7 @@ type LinodeMachineTemplateResource struct {
3346// +kubebuilder:object:root=true
3447// +kubebuilder:storageversion
3548// +kubebuilder:resource:path=linodemachinetemplates,scope=Namespaced,categories=cluster-api,shortName=lmt
49+ // +kubebuilder:subresource:status
3650// +kubebuilder:metadata:labels="clusterctl.cluster.x-k8s.io/move-hierarchy=true"
3751
3852// LinodeMachineTemplate is the Schema for the linodemachinetemplates API
@@ -41,6 +55,29 @@ type LinodeMachineTemplate struct {
4155 metav1.ObjectMeta `json:"metadata,omitempty"`
4256
4357 Spec LinodeMachineTemplateSpec `json:"spec,omitempty"`
58+
59+ Status LinodeMachineTemplateStatus `json:"status,omitempty"`
60+ }
61+
62+ func (lmt * LinodeMachineTemplate ) GetConditions () []metav1.Condition {
63+ for i := range lmt .Status .Conditions {
64+ if lmt .Status .Conditions [i ].Reason == "" {
65+ lmt .Status .Conditions [i ].Reason = DefaultConditionReason
66+ }
67+ }
68+ return lmt .Status .Conditions
69+ }
70+
71+ func (lmt * LinodeMachineTemplate ) SetConditions (conditions []metav1.Condition ) {
72+ lmt .Status .Conditions = conditions
73+ }
74+
75+ func (lmt * LinodeMachineTemplate ) GetV1Beta2Conditions () []metav1.Condition {
76+ return lmt .GetConditions ()
77+ }
78+
79+ func (lmt * LinodeMachineTemplate ) SetV1Beta2Conditions (conditions []metav1.Condition ) {
80+ lmt .SetConditions (conditions )
4481}
4582
4683// +kubebuilder:object:root=true
0 commit comments