Skip to content

Commit

Permalink
prevent conditions missing information
Browse files Browse the repository at this point in the history
  • Loading branch information
deads2k committed Sep 27, 2024
1 parent 2402ef3 commit 7074143
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkg/operator/genericoperatorclient/dynamic_operator_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,18 @@ func (c dynamicOperatorClient) UpdateOperatorSpec(ctx context.Context, resourceV
// in operatorv1.OperatorStatus while preserving pre-existing status fields that have
// no correspondence in operatorv1.OperatorStatus.
func (c dynamicOperatorClient) UpdateOperatorStatus(ctx context.Context, resourceVersion string, status *operatorv1.OperatorStatus) (*operatorv1.OperatorStatus, error) {
if status != nil {
for i, curr := range status.Conditions {
// panicking so we can quickly find it and fix the source
if len(curr.Type) == 0 {
panic(fmt.Sprintf(".status.conditions[%d].type is missing", i))
}
if len(curr.Status) == 0 {
panic(fmt.Sprintf(".status.conditions[%q].status is missing", curr.Type))
}
}
}

uncastOriginal, err := c.informer.Lister().Get(c.configName)
if err != nil {
return nil, err
Expand Down

0 comments on commit 7074143

Please sign in to comment.