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
|
// SetBucketCondition sets the given condition with the given status, reason and
|
||||||
// message on the Bucket.
|
// message on the Bucket.
|
||||||
func SetBucketCondition(bucket *Bucket, conditionType string, status metav1.ConditionStatus, reason, message string) {
|
func SetBucketCondition(bucket *Bucket, condition string, status metav1.ConditionStatus, reason, message string) {
|
||||||
bucket.Status.Conditions = meta.FilterOutCondition(bucket.Status.Conditions, conditionType)
|
conditions := &bucket.Status.Conditions
|
||||||
bucket.Status.Conditions = append(bucket.Status.Conditions, metav1.Condition{
|
generation := bucket.GetGeneration()
|
||||||
Type: conditionType,
|
newCondition := metav1.Condition{
|
||||||
|
Type: condition,
|
||||||
Status: status,
|
Status: status,
|
||||||
LastTransitionTime: metav1.Now(),
|
LastTransitionTime: metav1.Now(),
|
||||||
Reason: reason,
|
Reason: reason,
|
||||||
Message: message,
|
Message: message,
|
||||||
})
|
ObservedGeneration: generation,
|
||||||
|
}
|
||||||
|
|
||||||
|
apimeta.SetStatusCondition(conditions, newCondition)
|
||||||
}
|
}
|
||||||
|
|
||||||
// BucketReady sets the given Artifact and URL on the Bucket and sets the
|
// 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,
|
// SetGitRepositoryCondition sets the given condition with the given status,
|
||||||
// reason and message on the GitRepository.
|
// reason and message on the GitRepository.
|
||||||
func SetGitRepositoryCondition(repository *GitRepository, condition string, status metav1.ConditionStatus, reason, message string) {
|
func SetGitRepositoryCondition(repository *GitRepository, condition string, status metav1.ConditionStatus, reason, message string) {
|
||||||
repository.Status.Conditions = meta.FilterOutCondition(repository.Status.Conditions, condition)
|
conditions := &repository.Status.Conditions
|
||||||
repository.Status.Conditions = append(repository.Status.Conditions, metav1.Condition{
|
generation := repository.GetGeneration()
|
||||||
|
newCondition := metav1.Condition{
|
||||||
Type: condition,
|
Type: condition,
|
||||||
Status: status,
|
Status: status,
|
||||||
LastTransitionTime: metav1.Now(),
|
LastTransitionTime: metav1.Now(),
|
||||||
Reason: reason,
|
Reason: reason,
|
||||||
Message: message,
|
Message: message,
|
||||||
})
|
ObservedGeneration: generation,
|
||||||
|
}
|
||||||
|
|
||||||
|
apimeta.SetStatusCondition(conditions, newCondition)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GitRepositoryReady sets the given Artifact and URL on the GitRepository and
|
// 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
|
// SetHelmChartCondition sets the given condition with the given status, reason
|
||||||
// and message on the HelmChart.
|
// and message on the HelmChart.
|
||||||
func SetHelmChartCondition(chart *HelmChart, condition string, status metav1.ConditionStatus, reason, message string) {
|
func SetHelmChartCondition(chart *HelmChart, condition string, status metav1.ConditionStatus, reason, message string) {
|
||||||
chart.Status.Conditions = meta.FilterOutCondition(chart.Status.Conditions, condition)
|
conditions := &chart.Status.Conditions
|
||||||
chart.Status.Conditions = append(chart.Status.Conditions, metav1.Condition{
|
generation := chart.GetGeneration()
|
||||||
|
newCondition := metav1.Condition{
|
||||||
Type: condition,
|
Type: condition,
|
||||||
Status: status,
|
Status: status,
|
||||||
LastTransitionTime: metav1.Now(),
|
LastTransitionTime: metav1.Now(),
|
||||||
Reason: reason,
|
Reason: reason,
|
||||||
Message: message,
|
Message: message,
|
||||||
})
|
ObservedGeneration: generation,
|
||||||
|
}
|
||||||
|
|
||||||
|
apimeta.SetStatusCondition(conditions, newCondition)
|
||||||
}
|
}
|
||||||
|
|
||||||
// HelmChartReady sets the given Artifact and URL on the HelmChart and sets the
|
// 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,
|
// SetHelmRepositoryCondition sets the given condition with the given status,
|
||||||
// reason and message on the HelmRepository.
|
// reason and message on the HelmRepository.
|
||||||
func SetHelmRepositoryCondition(repository *HelmRepository, condition string, status metav1.ConditionStatus, reason, message string) {
|
func SetHelmRepositoryCondition(repository *HelmRepository, condition string, status metav1.ConditionStatus, reason, message string) {
|
||||||
repository.Status.Conditions = meta.FilterOutCondition(repository.Status.Conditions, condition)
|
conditions := &repository.Status.Conditions
|
||||||
repository.Status.Conditions = append(repository.Status.Conditions, metav1.Condition{
|
generation := repository.GetGeneration()
|
||||||
|
newCondition := metav1.Condition{
|
||||||
Type: condition,
|
Type: condition,
|
||||||
Status: status,
|
Status: status,
|
||||||
LastTransitionTime: metav1.Now(),
|
LastTransitionTime: metav1.Now(),
|
||||||
Reason: reason,
|
Reason: reason,
|
||||||
Message: message,
|
Message: message,
|
||||||
})
|
ObservedGeneration: generation,
|
||||||
|
}
|
||||||
|
|
||||||
|
apimeta.SetStatusCondition(conditions, newCondition)
|
||||||
}
|
}
|
||||||
|
|
||||||
// HelmRepositoryReady sets the given Artifact and URL on the HelmRepository and
|
// HelmRepositoryReady sets the given Artifact and URL on the HelmRepository and
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue