Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set status.cond when cluster secret not found #633

Merged
merged 1 commit into from
Jun 9, 2023
Merged

Conversation

ChunyiLyu
Copy link
Contributor

@ChunyiLyu ChunyiLyu commented Jun 9, 2023

Requested in rabbitmq/cluster-operator#1375

Note to reviewers: remember to look at the commits in this PR and consider if they can be squashed
Note to contributors: remember to re-generate client set if there are any API changes

Summary Of Changes

Previously error was only logger, with this commit status.condition log and event are all updated.

Before:

Spec:
  Ack Mode:  on-confirm
  Name:      origin
  Rabbitmq Cluster Reference:
    Connection Secret:
      Name:  secret-that-doesnt-exist
  Uri Secret:
    Name:  federation-uri
  Vhost:   downstream
Events:    <none>

With this change:

Spec:
  Ack Mode:  on-confirm
  Name:      origin
  Rabbitmq Cluster Reference:
    Connection Secret:
      Name:  secret-that-doesnt-exist
  Uri Secret:
    Name:  federation-uri
  Vhost:   downstream
Status:
  Conditions:
    Last Transition Time:  2023-06-09T12:19:49Z
    Message:               failed to retrieve cluster from reference: Secret "secret-that-doesnt-exist" not found
    Reason:                FailedCreateOrUpdate
    Status:                False
    Type:                  Ready
Events:
  Type     Reason                Age                   From                   Message
  ----     ------                ----                  ----                   -------
  Warning  FailedCreateOrUpdate  65s (x15 over 2m27s)  federation-controller  failed to retrieve cluster from reference: Secret "secret-that-doesnt-exist" not found

Additional Context

- previous error was only logger, with this commit status.condition
log and event are all updated
logger.Error(err, failedParseClusterRef)
msg := fmt.Sprintf("%s: %s", failedParseClusterRef, err.Error())
r.Recorder.Event(object, corev1.EventTypeWarning, "FailedCreateOrUpdate", msg)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just FTR, I wanted to suggest using a "type error" here but apparently there only "normal" and "warning" to choose from in the API :)

@ChunyiLyu ChunyiLyu merged commit 85a0693 into main Jun 9, 2023
@ChunyiLyu ChunyiLyu deleted the status-condition branch June 9, 2023 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants