@@ -93,42 +93,25 @@ func HelmRepositoryProgressing(repository HelmRepository) HelmRepository {
9393 repository .Status .ObservedGeneration = repository .Generation
9494 repository .Status .URL = ""
9595 repository .Status .Conditions = []metav1.Condition {}
96- SetHelmRepositoryCondition (& repository , meta .ReadyCondition , metav1 .ConditionUnknown , meta .ProgressingReason , "reconciliation in progress" )
96+ meta . SetResourceCondition (& repository , meta .ReadyCondition , metav1 .ConditionUnknown , meta .ProgressingReason , "reconciliation in progress" )
9797 return repository
9898}
9999
100- // SetHelmRepositoryCondition sets the given condition with the given status,
101- // reason and message on the HelmRepository.
102- func SetHelmRepositoryCondition (repository * HelmRepository , condition string , status metav1.ConditionStatus , reason , message string ) {
103- conditions := & repository .Status .Conditions
104- generation := repository .GetGeneration ()
105- newCondition := metav1.Condition {
106- Type : condition ,
107- Status : status ,
108- LastTransitionTime : metav1 .Now (),
109- Reason : reason ,
110- Message : message ,
111- ObservedGeneration : generation ,
112- }
113-
114- apimeta .SetStatusCondition (conditions , newCondition )
115- }
116-
117100// HelmRepositoryReady sets the given Artifact and URL on the HelmRepository and
118101// sets the meta.ReadyCondition to 'True', with the given reason and message. It
119102// returns the modified HelmRepository.
120103func HelmRepositoryReady (repository HelmRepository , artifact Artifact , url , reason , message string ) HelmRepository {
121104 repository .Status .Artifact = & artifact
122105 repository .Status .URL = url
123- SetHelmRepositoryCondition (& repository , meta .ReadyCondition , metav1 .ConditionTrue , reason , message )
106+ meta . SetResourceCondition (& repository , meta .ReadyCondition , metav1 .ConditionTrue , reason , message )
124107 return repository
125108}
126109
127110// HelmRepositoryNotReady sets the meta.ReadyCondition on the given
128111// HelmRepository to 'False', with the given reason and message. It returns the
129112// modified HelmRepository.
130113func HelmRepositoryNotReady (repository HelmRepository , reason , message string ) HelmRepository {
131- SetHelmRepositoryCondition (& repository , meta .ReadyCondition , metav1 .ConditionFalse , reason , message )
114+ meta . SetResourceCondition (& repository , meta .ReadyCondition , metav1 .ConditionFalse , reason , message )
132115 return repository
133116}
134117
@@ -149,6 +132,11 @@ func (in *HelmRepository) GetArtifact() *Artifact {
149132 return in .Status .Artifact
150133}
151134
135+ // GetStatusConditions returns a pointer to the Status.Conditions slice
136+ func (in * HelmRepository ) GetStatusConditions () * []metav1.Condition {
137+ return & in .Status .Conditions
138+ }
139+
152140// GetInterval returns the interval at which the source is updated.
153141func (in * HelmRepository ) GetInterval () metav1.Duration {
154142 return in .Spec .Interval
0 commit comments