From 629dc007767e33dec2918e184a0b43b21f90f123 Mon Sep 17 00:00:00 2001 From: Hidde Beydals Date: Tue, 22 Mar 2022 15:23:27 +0100 Subject: [PATCH] Implement `meta.ObjectWithConditions` interfaces Follow up on #325 to fully implement new tooling requirements. By implementing the interfaces, the `conditions` package can now be used. Signed-off-by: Hidde Beydals --- api/v1beta1/imageupdateautomation_types.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/api/v1beta1/imageupdateautomation_types.go b/api/v1beta1/imageupdateautomation_types.go index a3e685a4..2e10a974 100644 --- a/api/v1beta1/imageupdateautomation_types.go +++ b/api/v1beta1/imageupdateautomation_types.go @@ -17,6 +17,8 @@ limitations under the License. package v1beta1 import ( + "time" + apimeta "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -141,6 +143,24 @@ type ImageUpdateAutomation struct { Status ImageUpdateAutomationStatus `json:"status,omitempty"` } +// GetRequeueAfter returns the duration after which the ImageUpdateAutomation +// must be reconciled again. +func (auto ImageUpdateAutomation) GetRequeueAfter() time.Duration { + return auto.Spec.Interval.Duration +} + +// GetConditions returns the status conditions of the object. +func (auto ImageUpdateAutomation) GetConditions() []metav1.Condition { + return auto.Status.Conditions +} + +// SetConditions sets the status conditions on the object. +func (auto *ImageUpdateAutomation) SetConditions(conditions []metav1.Condition) { + auto.Status.Conditions = conditions +} + +// GetStatusConditions returns a pointer to the Status.Conditions slice. +// Deprecated: use GetConditions instead. func (auto *ImageUpdateAutomation) GetStatusConditions() *[]metav1.Condition { return &auto.Status.Conditions }