Use SetStatusCondition vs FilterOutCondition
Change to rely on the upstream k8s api/meta SetStatusCondition to set/update the resources status conditions rather than FilterOutCondition from apis/meta which is due to be removed. Signed-off-by: Aurel Canciu <aurelcanciu@gmail.com>
This commit is contained in:
parent
00bb853d0e
commit
69f9bbdaa6
|
|
@ -120,15 +120,19 @@ func BucketProgressing(bucket Bucket) Bucket {
|
|||
|
||||
// SetBucketCondition sets the given condition with the given status, reason and
|
||||
// message on the Bucket.
|
||||
func SetBucketCondition(bucket *Bucket, conditionType string, status metav1.ConditionStatus, reason, message string) {
|
||||
bucket.Status.Conditions = meta.FilterOutCondition(bucket.Status.Conditions, conditionType)
|
||||
bucket.Status.Conditions = append(bucket.Status.Conditions, metav1.Condition{
|
||||
Type: conditionType,
|
||||
func SetBucketCondition(bucket *Bucket, condition string, status metav1.ConditionStatus, reason, message string) {
|
||||
conditions := &bucket.Status.Conditions
|
||||
generation := bucket.GetGeneration()
|
||||
newCondition := metav1.Condition{
|
||||
Type: condition,
|
||||
Status: status,
|
||||
LastTransitionTime: metav1.Now(),
|
||||
Reason: reason,
|
||||
Message: message,
|
||||
})
|
||||
ObservedGeneration: generation,
|
||||
}
|
||||
|
||||
apimeta.SetStatusCondition(conditions, newCondition)
|
||||
}
|
||||
|
||||
// BucketReady sets the given Artifact and URL on the Bucket and sets the
|
||||
|
|
|
|||
|
|
@ -143,14 +143,18 @@ func GitRepositoryProgressing(repository GitRepository) GitRepository {
|
|||
// SetGitRepositoryCondition sets the given condition with the given status,
|
||||
// reason and message on the GitRepository.
|
||||
func SetGitRepositoryCondition(repository *GitRepository, condition string, status metav1.ConditionStatus, reason, message string) {
|
||||
repository.Status.Conditions = meta.FilterOutCondition(repository.Status.Conditions, condition)
|
||||
repository.Status.Conditions = append(repository.Status.Conditions, metav1.Condition{
|
||||
conditions := &repository.Status.Conditions
|
||||
generation := repository.GetGeneration()
|
||||
newCondition := metav1.Condition{
|
||||
Type: condition,
|
||||
Status: status,
|
||||
LastTransitionTime: metav1.Now(),
|
||||
Reason: reason,
|
||||
Message: message,
|
||||
})
|
||||
ObservedGeneration: generation,
|
||||
}
|
||||
|
||||
apimeta.SetStatusCondition(conditions, newCondition)
|
||||
}
|
||||
|
||||
// GitRepositoryReady sets the given Artifact and URL on the GitRepository and
|
||||
|
|
|
|||
|
|
@ -120,14 +120,18 @@ func HelmChartProgressing(chart HelmChart) HelmChart {
|
|||
// SetHelmChartCondition sets the given condition with the given status, reason
|
||||
// and message on the HelmChart.
|
||||
func SetHelmChartCondition(chart *HelmChart, condition string, status metav1.ConditionStatus, reason, message string) {
|
||||
chart.Status.Conditions = meta.FilterOutCondition(chart.Status.Conditions, condition)
|
||||
chart.Status.Conditions = append(chart.Status.Conditions, metav1.Condition{
|
||||
conditions := &chart.Status.Conditions
|
||||
generation := chart.GetGeneration()
|
||||
newCondition := metav1.Condition{
|
||||
Type: condition,
|
||||
Status: status,
|
||||
LastTransitionTime: metav1.Now(),
|
||||
Reason: reason,
|
||||
Message: message,
|
||||
})
|
||||
ObservedGeneration: generation,
|
||||
}
|
||||
|
||||
apimeta.SetStatusCondition(conditions, newCondition)
|
||||
}
|
||||
|
||||
// HelmChartReady sets the given Artifact and URL on the HelmChart and sets the
|
||||
|
|
|
|||
|
|
@ -100,14 +100,18 @@ func HelmRepositoryProgressing(repository HelmRepository) HelmRepository {
|
|||
// SetHelmRepositoryCondition sets the given condition with the given status,
|
||||
// reason and message on the HelmRepository.
|
||||
func SetHelmRepositoryCondition(repository *HelmRepository, condition string, status metav1.ConditionStatus, reason, message string) {
|
||||
repository.Status.Conditions = meta.FilterOutCondition(repository.Status.Conditions, condition)
|
||||
repository.Status.Conditions = append(repository.Status.Conditions, metav1.Condition{
|
||||
conditions := &repository.Status.Conditions
|
||||
generation := repository.GetGeneration()
|
||||
newCondition := metav1.Condition{
|
||||
Type: condition,
|
||||
Status: status,
|
||||
LastTransitionTime: metav1.Now(),
|
||||
Reason: reason,
|
||||
Message: message,
|
||||
})
|
||||
ObservedGeneration: generation,
|
||||
}
|
||||
|
||||
apimeta.SetStatusCondition(conditions, newCondition)
|
||||
}
|
||||
|
||||
// HelmRepositoryReady sets the given Artifact and URL on the HelmRepository and
|
||||
|
|
|
|||
Loading…
Reference in New Issue