From e12c4ece2a33253f8979de4bfdd4bfc3f44e2ed6 Mon Sep 17 00:00:00 2001 From: Joe Lanford Date: Tue, 6 Sep 2022 20:26:51 -0400 Subject: [PATCH 1/2] minor cleanup and refactoring for consistency and simplicity Signed-off-by: Joe Lanford --- .../aggregated_clusteroperator_controller.go | 39 ++- internal/clusteroperator/builder.go | 262 +++++------------- internal/clusteroperator/writer.go | 19 +- internal/util/util.go | 15 +- 4 files changed, 117 insertions(+), 218 deletions(-) diff --git a/controllers/aggregated_clusteroperator_controller.go b/controllers/aggregated_clusteroperator_controller.go index 409a9449..6c486eb1 100644 --- a/controllers/aggregated_clusteroperator_controller.go +++ b/controllers/aggregated_clusteroperator_controller.go @@ -20,6 +20,8 @@ import ( "context" configv1 "github.com/openshift/api/config/v1" + rukpakv1alpha1 "github.com/operator-framework/rukpak/api/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/builder" "sigs.k8s.io/controller-runtime/pkg/client" @@ -62,19 +64,26 @@ func (r *AggregatedClusterOperatorReconciler) Reconcile(ctx context.Context, req } defer func() { if err := coWriter.UpdateStatus(ctx, aggregatedCO, coBuilder.GetStatus()); err != nil { - log.Error(err, "error updating CO status") + log.Error(err, "error updating cluster operator status") } }() // Set the default CO status conditions: Progressing=True, Degraded=False, Available=False - coBuilder.WithProgressing(configv1.ConditionTrue, "") - coBuilder.WithDegraded(configv1.ConditionFalse) - coBuilder.WithAvailable(configv1.ConditionFalse, "", "") + // TODO: always set a reason (message is optional, but desirable) + coBuilder.WithProgressing(metav1.ConditionTrue, "", "") + coBuilder.WithDegraded(metav1.ConditionFalse, "", "") + coBuilder.WithAvailable(metav1.ConditionFalse, "", "") coBuilder.WithVersion("operator", r.ReleaseVersion) - coBuilder.WithRelatedObject("", "namespaces", "", r.SystemNamespace) - coBuilder.WithRelatedObject("platform.openshift.io", "platformoperators", "", "") - coBuilder.WithRelatedObject("core.rukpak.io", "bundles", "", "") - coBuilder.WithRelatedObject("core.rukpak.io", "bundledeployments", "", "") + coBuilder.WithRelatedObject(configv1.ObjectReference{Group: "", Resource: "namespaces", Name: r.SystemNamespace}) + + // NOTE: Group and resource can be referenced without name/namespace set, which is a signal + // that _ALL_ objects of that group/resource are related objects. This is useful for + // must-gather automation. + coBuilder.WithRelatedObject(configv1.ObjectReference{Group: platformv1alpha1.GroupName, Resource: "platformoperators"}) + + // TODO: move platform operator ownership of rukpak objects out prior to rukpak or PO GA. + coBuilder.WithRelatedObject(configv1.ObjectReference{Group: rukpakv1alpha1.GroupVersion.Group, Resource: "bundles"}) + coBuilder.WithRelatedObject(configv1.ObjectReference{Group: rukpakv1alpha1.GroupVersion.Group, Resource: "bundledeployments"}) poList := &platformv1alpha1.PlatformOperatorList{} if err := r.List(ctx, poList); err != nil { @@ -82,8 +91,12 @@ func (r *AggregatedClusterOperatorReconciler) Reconcile(ctx context.Context, req } if len(poList.Items) == 0 { // No POs on cluster, everything is fine - coBuilder.WithAvailable(configv1.ConditionTrue, "No POs are present in the cluster", "NoPOsFound") - coBuilder.WithProgressing(configv1.ConditionFalse, "No POs are present in the cluster") + // TODO: cleanup condition reasons. + // 1. use constants for condition reasons. + // 2. discuss/agree on reason values. + // 3. don't use abbreviations. + coBuilder.WithAvailable(metav1.ConditionTrue, "NoPOsFound", "No POs are present in the cluster") + coBuilder.WithProgressing(metav1.ConditionFalse, "", "No POs are present in the cluster") return ctrl.Result{}, nil } @@ -91,11 +104,11 @@ func (r *AggregatedClusterOperatorReconciler) Reconcile(ctx context.Context, req // any failing status states, and update the aggregate CO resource // to reflect those failing PO resources. if statusErrorCheck := util.InspectPlatformOperators(poList); statusErrorCheck != nil { - coBuilder.WithAvailable(configv1.ConditionFalse, statusErrorCheck.Error(), "POError") + coBuilder.WithAvailable(metav1.ConditionFalse, "POError", statusErrorCheck.Error()) return ctrl.Result{}, nil } - coBuilder.WithAvailable(configv1.ConditionTrue, "All POs in a successful state", "POsHealthy") - coBuilder.WithProgressing(configv1.ConditionFalse, "All POs in a successful state") + coBuilder.WithAvailable(metav1.ConditionTrue, "POsHealthy", "All POs in a successful state") + coBuilder.WithProgressing(metav1.ConditionFalse, "", "All POs in a successful state") return ctrl.Result{}, nil } diff --git a/internal/clusteroperator/builder.go b/internal/clusteroperator/builder.go index f3e5c905..00800c25 100644 --- a/internal/clusteroperator/builder.go +++ b/internal/clusteroperator/builder.go @@ -1,10 +1,9 @@ package clusteroperator import ( - "reflect" - "time" - configv1 "github.com/openshift/api/config/v1" + "k8s.io/apimachinery/pkg/api/equality" + "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -13,7 +12,13 @@ import ( // NewBuilder returns a builder for ClusterOperatorStatus. func NewBuilder() *Builder { - return &Builder{} + return &Builder{ + status: &configv1.ClusterOperatorStatus{ + Conditions: []configv1.ClusterOperatorStatusCondition{}, + Versions: []configv1.OperandVersion{}, + RelatedObjects: []configv1.ObjectReference{}, + }, + } } // Builder helps build ClusterOperatorStatus with appropriate @@ -23,232 +28,119 @@ type Builder struct { } // GetStatus returns the ClusterOperatorStatus built. -func (b *Builder) GetStatus() *configv1.ClusterOperatorStatus { - return b.status +func (b *Builder) GetStatus() configv1.ClusterOperatorStatus { + return *b.status } // WithProgressing sets an OperatorProgressing type condition. -func (b *Builder) WithProgressing(status configv1.ConditionStatus, message string) *Builder { - b.init() - - // check for equality first, before modifying - for _, cond := range b.status.Conditions { - if cond.Type == configv1.OperatorProgressing && cond.Status == status && cond.Message == message { - return b - } - } - - condition := &configv1.ClusterOperatorStatusCondition{ - Type: configv1.OperatorProgressing, - Status: status, - Message: message, - LastTransitionTime: metav1.NewTime(time.Now()), - } - - b.setCondition(condition) - - return b +func (b *Builder) WithProgressing(status metav1.ConditionStatus, reason, message string) *Builder { + return b.withCondition(string(configv1.OperatorProgressing), status, reason, message) } // WithDegraded sets an OperatorDegraded type condition. -// TODO: update to set Reason as well -func (b *Builder) WithDegraded(status configv1.ConditionStatus) *Builder { - b.init() - - // check for equality first, before modifying - for _, cond := range b.status.Conditions { - if cond.Type == configv1.OperatorDegraded && cond.Status == status { - return b - } - } - - condition := &configv1.ClusterOperatorStatusCondition{ - Type: configv1.OperatorDegraded, - Status: status, - LastTransitionTime: metav1.NewTime(time.Now()), - } - - b.setCondition(condition) - - return b +func (b *Builder) WithDegraded(status metav1.ConditionStatus, reason, message string) *Builder { + return b.withCondition(string(configv1.OperatorDegraded), status, reason, message) } // WithAvailable sets an OperatorAvailable type condition. -func (b *Builder) WithAvailable(status configv1.ConditionStatus, message, reason string) *Builder { - b.init() - - // check for equality first, before modifying - for _, cond := range b.status.Conditions { - if cond.Type == configv1.OperatorAvailable && cond.Status == status && cond.Message == message && cond.Reason == reason { - return b - } - } +func (b *Builder) WithAvailable(status metav1.ConditionStatus, reason, message string) *Builder { + return b.withCondition(string(configv1.OperatorAvailable), status, reason, message) +} - condition := &configv1.ClusterOperatorStatusCondition{ - Type: configv1.OperatorAvailable, - Status: status, - Message: message, - Reason: reason, - LastTransitionTime: metav1.NewTime(time.Now()), - } +// WithUpgradeable sets an OperatorUpgradeable type condition. +func (b *Builder) WithUpgradeable(status metav1.ConditionStatus, reason, message string) *Builder { + return b.withCondition(string(configv1.OperatorUpgradeable), status, reason, message) +} - b.setCondition(condition) +func (b *Builder) withCondition(typ string, status metav1.ConditionStatus, reason, message string) *Builder { + conditions := convertToMetaV1Conditions(b.status.Conditions) + meta.SetStatusCondition(&conditions, metav1.Condition{ + Type: typ, + Status: status, + Reason: reason, + Message: message, + }) + b.status.Conditions = convertToClusterOperatorConditions(conditions) return b } -// WithUpgradeable sets an OperatorUpgradeable type condition. -func (b *Builder) WithUpgradeable(status configv1.ConditionStatus, message string) *Builder { - b.init() - - // check for equality first, before modifying - for _, cond := range b.status.Conditions { - if cond.Type == configv1.OperatorUpgradeable && cond.Status == status && cond.Message == message { - return b - } +func convertToMetaV1Conditions(in []configv1.ClusterOperatorStatusCondition) []metav1.Condition { + out := make([]metav1.Condition, 0, len(in)) + for _, c := range in { + out = append(out, metav1.Condition{ + Type: string(c.Type), + Status: metav1.ConditionStatus(c.Status), + Reason: c.Reason, + Message: c.Message, + LastTransitionTime: c.LastTransitionTime, + }) } + return out +} - condition := &configv1.ClusterOperatorStatusCondition{ - Type: configv1.OperatorUpgradeable, - Status: status, - Message: message, - LastTransitionTime: metav1.NewTime(time.Now()), +func convertToClusterOperatorConditions(in []metav1.Condition) []configv1.ClusterOperatorStatusCondition { + out := make([]configv1.ClusterOperatorStatusCondition, 0, len(in)) + for _, c := range in { + out = append(out, configv1.ClusterOperatorStatusCondition{ + Type: configv1.ClusterStatusConditionType(c.Type), + Status: configv1.ConditionStatus(c.Status), + Reason: c.Reason, + Message: c.Message, + LastTransitionTime: c.LastTransitionTime, + }) } - - b.setCondition(condition) - - return b + return out } // WithVersion adds the specific version into the status. func (b *Builder) WithVersion(name, version string) *Builder { - b.init() - - existing := b.findVersion(name) - if existing != nil { - existing.Version = version - return b + for i := range b.status.Versions { + if b.status.Versions[i].Name == name { + b.status.Versions[i].Version = version + return b + } } - - ov := configv1.OperandVersion{ + b.status.Versions = append(b.status.Versions, configv1.OperandVersion{ Name: name, Version: version, - } - b.status.Versions = append(b.status.Versions, ov) - + }) return b } // WithoutVersion removes the specified version from the existing status. -func (b *Builder) WithoutVersion(name, version string) *Builder { - b.init() - - versions := make([]configv1.OperandVersion, 0) - - for _, v := range b.status.Versions { +func (b *Builder) WithoutVersion(name string) *Builder { + out := b.status.Versions[:0] + for i, v := range b.status.Versions { if v.Name == name { continue } - - versions = append(versions, v) + out[i] = v } - - b.status.Versions = versions + b.status.Versions = out return b } // WithRelatedObject adds the reference specified to the RelatedObjects list. -func (b *Builder) WithRelatedObject(group, resource, namespace, name string) *Builder { - b.init() - - reference := configv1.ObjectReference{ - Group: group, - Resource: resource, - Namespace: namespace, - Name: name, +func (b *Builder) WithRelatedObject(reference configv1.ObjectReference) *Builder { + for i := range b.status.RelatedObjects { + if equality.Semantic.DeepEqual(b.status.RelatedObjects[i], reference) { + return b + } } - - b.setRelatedObject(reference) - + b.status.RelatedObjects = append(b.status.RelatedObjects, reference) return b } // WithoutRelatedObject removes the reference specified from the RelatedObjects list. -func (b *Builder) WithoutRelatedObject(group, resource, namespace, name string) *Builder { - b.init() - - reference := configv1.ObjectReference{ - Group: group, - Resource: resource, - Namespace: namespace, - Name: name, - } - - related := make([]configv1.ObjectReference, 0) - for i := range b.status.RelatedObjects { - if reflect.DeepEqual(b.status.RelatedObjects[i], reference) { +func (b *Builder) WithoutRelatedObject(reference configv1.ObjectReference) *Builder { + related := b.status.RelatedObjects[:0] + for i, ro := range b.status.RelatedObjects { + if equality.Semantic.DeepEqual(b.status.RelatedObjects[i], reference) { continue } - - related = append(related, b.status.RelatedObjects[i]) + related[i] = ro } - b.status.RelatedObjects = related return b } - -func (b *Builder) init() { - if b.status == nil { - b.status = &configv1.ClusterOperatorStatus{ - Conditions: []configv1.ClusterOperatorStatusCondition{}, - Versions: []configv1.OperandVersion{}, - RelatedObjects: []configv1.ObjectReference{}, - } - } -} - -func (b *Builder) findCondition(conditionType configv1.ClusterStatusConditionType) *configv1.ClusterOperatorStatusCondition { - for i := range b.status.Conditions { - if b.status.Conditions[i].Type == conditionType { - return &b.status.Conditions[i] - } - } - - return nil -} - -func (b *Builder) setCondition(condition *configv1.ClusterOperatorStatusCondition) { - existing := b.findCondition(condition.Type) - if existing == nil { - b.status.Conditions = append(b.status.Conditions, *condition) - return - } - - existing.Reason = condition.Reason - existing.Message = condition.Message - - if existing.Status != condition.Status { - existing.Status = condition.Status - existing.LastTransitionTime = condition.LastTransitionTime - } -} - -func (b *Builder) findVersion(name string) *configv1.OperandVersion { - for i := range b.status.Versions { - if b.status.Versions[i].Name == name { - return &b.status.Versions[i] - } - } - - return nil -} - -func (b *Builder) setRelatedObject(reference configv1.ObjectReference) { - for i := range b.status.RelatedObjects { - if reflect.DeepEqual(b.status.RelatedObjects[i], reference) { - return - } - } - - b.status.RelatedObjects = append(b.status.RelatedObjects, reference) -} diff --git a/internal/clusteroperator/writer.go b/internal/clusteroperator/writer.go index 45c05d85..e3732e14 100644 --- a/internal/clusteroperator/writer.go +++ b/internal/clusteroperator/writer.go @@ -2,9 +2,9 @@ package clusteroperator import ( "context" - "reflect" configv1 "github.com/openshift/api/config/v1" + "k8s.io/apimachinery/pkg/api/equality" "sigs.k8s.io/controller-runtime/pkg/client" ) @@ -24,19 +24,16 @@ type Writer struct { } // UpdateStatus updates the clusteroperator object with the new status specified. -func (w *Writer) UpdateStatus(ctx context.Context, existing *configv1.ClusterOperator, newStatus *configv1.ClusterOperatorStatus) error { - if newStatus == nil || existing == nil { - panic("input specified is ") +func (w *Writer) UpdateStatus(ctx context.Context, existingCO *configv1.ClusterOperator, newStatus configv1.ClusterOperatorStatus) error { + if existingCO == nil { + panic("BUG: existingCO parameter was nil") } - existingStatus := existing.Status.DeepCopy() - if reflect.DeepEqual(existingStatus, newStatus) { + existingStatus := existingCO.Status + if equality.Semantic.DeepEqual(existingStatus, newStatus) { return nil } - existing.Status = *newStatus - if err := w.Status().Update(ctx, existing); err != nil { - return err - } - return nil + existingCO.Status = newStatus + return w.Status().Update(ctx, existingCO) } diff --git a/internal/util/util.go b/internal/util/util.go index 50ca9657..27c81896 100644 --- a/internal/util/util.go +++ b/internal/util/util.go @@ -84,20 +84,17 @@ func RequeueClusterOperator(c client.Client, name string) handler.MapFunc { } } -// InspectPlatformOperators iterates over all the POs on the cluster +// InspectPlatformOperators iterates over all the POs in the list // and determines whether a PO is in a failing state by inspecting its status. // A nil return value indicates no errors were found with the POs provided. -func InspectPlatformOperators(POList *platformv1alpha1.PlatformOperatorList) error { - var failingPOs []error - for _, po := range POList.Items { +func InspectPlatformOperators(poList *platformv1alpha1.PlatformOperatorList) error { + var poErrors []error + for _, po := range poList.Items { if err := inspectPlatformOperator(po); err != nil { - failingPOs = append(failingPOs, err) + poErrors = append(poErrors, err) } } - if len(failingPOs) > 0 { - return utilerror.NewAggregate(failingPOs) - } - return nil + return utilerror.NewAggregate(poErrors) } // inspectPlatformOperator is responsible for inspecting an individual platform From e080b5e18c8b42637baac588341da0515c4872dc Mon Sep 17 00:00:00 2001 From: Joe Lanford Date: Tue, 27 Sep 2022 10:21:03 -0400 Subject: [PATCH 2/2] address PR feedback Signed-off-by: Joe Lanford --- .../aggregated_clusteroperator_controller.go | 42 +++++++++++-------- internal/clusteroperator/types.go | 3 ++ test/e2e/aggregated_clusteroperator_test.go | 12 +++--- 3 files changed, 33 insertions(+), 24 deletions(-) diff --git a/controllers/aggregated_clusteroperator_controller.go b/controllers/aggregated_clusteroperator_controller.go index 6c486eb1..7678cea4 100644 --- a/controllers/aggregated_clusteroperator_controller.go +++ b/controllers/aggregated_clusteroperator_controller.go @@ -74,16 +74,9 @@ func (r *AggregatedClusterOperatorReconciler) Reconcile(ctx context.Context, req coBuilder.WithDegraded(metav1.ConditionFalse, "", "") coBuilder.WithAvailable(metav1.ConditionFalse, "", "") coBuilder.WithVersion("operator", r.ReleaseVersion) - coBuilder.WithRelatedObject(configv1.ObjectReference{Group: "", Resource: "namespaces", Name: r.SystemNamespace}) - // NOTE: Group and resource can be referenced without name/namespace set, which is a signal - // that _ALL_ objects of that group/resource are related objects. This is useful for - // must-gather automation. - coBuilder.WithRelatedObject(configv1.ObjectReference{Group: platformv1alpha1.GroupName, Resource: "platformoperators"}) - - // TODO: move platform operator ownership of rukpak objects out prior to rukpak or PO GA. - coBuilder.WithRelatedObject(configv1.ObjectReference{Group: rukpakv1alpha1.GroupVersion.Group, Resource: "bundles"}) - coBuilder.WithRelatedObject(configv1.ObjectReference{Group: rukpakv1alpha1.GroupVersion.Group, Resource: "bundledeployments"}) + // Set the static set of related objects + setStaticRelatedObjects(coBuilder, r.SystemNamespace) poList := &platformv1alpha1.PlatformOperatorList{} if err := r.List(ctx, poList); err != nil { @@ -91,24 +84,23 @@ func (r *AggregatedClusterOperatorReconciler) Reconcile(ctx context.Context, req } if len(poList.Items) == 0 { // No POs on cluster, everything is fine - // TODO: cleanup condition reasons. - // 1. use constants for condition reasons. - // 2. discuss/agree on reason values. - // 3. don't use abbreviations. - coBuilder.WithAvailable(metav1.ConditionTrue, "NoPOsFound", "No POs are present in the cluster") - coBuilder.WithProgressing(metav1.ConditionFalse, "", "No POs are present in the cluster") + coBuilder.WithAvailable(metav1.ConditionTrue, clusteroperator.ReasonAsExpected, "No platform operators are present in the cluster") + coBuilder.WithProgressing(metav1.ConditionFalse, clusteroperator.ReasonAsExpected, "No platform operators are present in the cluster") return ctrl.Result{}, nil } // check whether any of the underlying PO resources are reporting // any failing status states, and update the aggregate CO resource // to reflect those failing PO resources. + + // TODO: consider something more fine-grained than a catch-all "PlatformOperatorError" reason. + // There's a non-negligible difference between "PO is explicitly failing installation" and "PO is not yet installed" if statusErrorCheck := util.InspectPlatformOperators(poList); statusErrorCheck != nil { - coBuilder.WithAvailable(metav1.ConditionFalse, "POError", statusErrorCheck.Error()) + coBuilder.WithAvailable(metav1.ConditionFalse, clusteroperator.ReasonPlatformOperatorError, statusErrorCheck.Error()) return ctrl.Result{}, nil } - coBuilder.WithAvailable(metav1.ConditionTrue, "POsHealthy", "All POs in a successful state") - coBuilder.WithProgressing(metav1.ConditionFalse, "", "All POs in a successful state") + coBuilder.WithAvailable(metav1.ConditionTrue, clusteroperator.ReasonAsExpected, "All platform operators are in a successful state") + coBuilder.WithProgressing(metav1.ConditionFalse, clusteroperator.ReasonAsExpected, "All platform operators are in a successful state") return ctrl.Result{}, nil } @@ -122,3 +114,17 @@ func (r *AggregatedClusterOperatorReconciler) SetupWithManager(mgr ctrl.Manager) Watches(&source.Kind{Type: &platformv1alpha1.PlatformOperator{}}, handler.EnqueueRequestsFromMapFunc(util.RequeueClusterOperator(mgr.GetClient(), clusteroperator.AggregateResourceName))). Complete(r) } + +func setStaticRelatedObjects(coBuilder *clusteroperator.Builder, systemNamespace string) { + coBuilder. + WithRelatedObject(configv1.ObjectReference{Group: "", Resource: "namespaces", Name: systemNamespace}). + + // NOTE: Group and resource can be referenced without name/namespace set, which is a signal + // that _ALL_ objects of that group/resource are related objects. This is useful for + // must-gather automation. + WithRelatedObject(configv1.ObjectReference{Group: platformv1alpha1.GroupName, Resource: "platformoperators"}). + + // TODO: move platform operator ownership of rukpak objects out prior to rukpak or PO GA. + WithRelatedObject(configv1.ObjectReference{Group: rukpakv1alpha1.GroupVersion.Group, Resource: "bundles"}). + WithRelatedObject(configv1.ObjectReference{Group: rukpakv1alpha1.GroupVersion.Group, Resource: "bundledeployments"}) +} diff --git a/internal/clusteroperator/types.go b/internal/clusteroperator/types.go index ce948450..d4c33c64 100644 --- a/internal/clusteroperator/types.go +++ b/internal/clusteroperator/types.go @@ -3,4 +3,7 @@ package clusteroperator const ( CoreResourceName = "platform-operators-core" AggregateResourceName = "platform-operators-aggregated" + + ReasonAsExpected = "AsExpected" + ReasonPlatformOperatorError = "PlatformOperatorError" ) diff --git a/test/e2e/aggregated_clusteroperator_test.go b/test/e2e/aggregated_clusteroperator_test.go index 0f7cd668..38042175 100644 --- a/test/e2e/aggregated_clusteroperator_test.go +++ b/test/e2e/aggregated_clusteroperator_test.go @@ -36,8 +36,8 @@ var _ = Describe("aggregated clusteroperator controller", func() { Not(BeNil()), WithTransform(func(c *configv1.ClusterOperatorStatusCondition) configv1.ClusterStatusConditionType { return c.Type }, Equal(configv1.OperatorAvailable)), WithTransform(func(c *configv1.ClusterOperatorStatusCondition) configv1.ConditionStatus { return c.Status }, Equal(configv1.ConditionTrue)), - WithTransform(func(c *configv1.ClusterOperatorStatusCondition) string { return c.Reason }, Equal("NoPOsFound")), - WithTransform(func(c *configv1.ClusterOperatorStatusCondition) string { return c.Message }, ContainSubstring("No POs are present in the cluster")), + WithTransform(func(c *configv1.ClusterOperatorStatusCondition) string { return c.Reason }, Equal(clusteroperator.ReasonAsExpected)), + WithTransform(func(c *configv1.ClusterOperatorStatusCondition) string { return c.Message }, ContainSubstring("No platform operators are present in the cluster")), )) }) It("should consistently contain a populated status.versions array", func() { @@ -112,8 +112,8 @@ var _ = Describe("aggregated clusteroperator controller", func() { Not(BeNil()), WithTransform(func(c *configv1.ClusterOperatorStatusCondition) configv1.ClusterStatusConditionType { return c.Type }, Equal(configv1.OperatorAvailable)), WithTransform(func(c *configv1.ClusterOperatorStatusCondition) configv1.ConditionStatus { return c.Status }, Equal(configv1.ConditionTrue)), - WithTransform(func(c *configv1.ClusterOperatorStatusCondition) string { return c.Reason }, Equal("POsHealthy")), - WithTransform(func(c *configv1.ClusterOperatorStatusCondition) string { return c.Message }, ContainSubstring("All POs in a successful state")), + WithTransform(func(c *configv1.ClusterOperatorStatusCondition) string { return c.Reason }, Equal(clusteroperator.ReasonAsExpected)), + WithTransform(func(c *configv1.ClusterOperatorStatusCondition) string { return c.Message }, ContainSubstring("All platform operators are in a successful state")), )) }) @@ -180,7 +180,7 @@ var _ = Describe("aggregated clusteroperator controller", func() { Not(BeNil()), WithTransform(func(c *configv1.ClusterOperatorStatusCondition) configv1.ClusterStatusConditionType { return c.Type }, Equal(configv1.OperatorAvailable)), WithTransform(func(c *configv1.ClusterOperatorStatusCondition) configv1.ConditionStatus { return c.Status }, Equal(configv1.ConditionFalse)), - WithTransform(func(c *configv1.ClusterOperatorStatusCondition) string { return c.Reason }, Equal("POError")), + WithTransform(func(c *configv1.ClusterOperatorStatusCondition) string { return c.Reason }, Equal(clusteroperator.ReasonPlatformOperatorError)), WithTransform(func(c *configv1.ClusterOperatorStatusCondition) string { return c.Message }, ContainSubstring("encountered the failing")), )) }) @@ -262,7 +262,7 @@ var _ = Describe("aggregated clusteroperator controller", func() { Not(BeNil()), WithTransform(func(c *configv1.ClusterOperatorStatusCondition) configv1.ClusterStatusConditionType { return c.Type }, Equal(configv1.OperatorAvailable)), WithTransform(func(c *configv1.ClusterOperatorStatusCondition) configv1.ConditionStatus { return c.Status }, Equal(configv1.ConditionFalse)), - WithTransform(func(c *configv1.ClusterOperatorStatusCondition) string { return c.Reason }, Equal("POError")), + WithTransform(func(c *configv1.ClusterOperatorStatusCondition) string { return c.Reason }, Equal(clusteroperator.ReasonPlatformOperatorError)), WithTransform(func(c *configv1.ClusterOperatorStatusCondition) string { return c.Message }, ContainSubstring("encountered the failing")), )) })