Skip to content

Display topic count 0 instead of error when calling kafka cluster describe on a provisioning cluster#1471

Merged
Steven Gagniere (sgagniere) merged 4 commits intomainfrom
cluster-describe-fix
Oct 20, 2022
Merged

Display topic count 0 instead of error when calling kafka cluster describe on a provisioning cluster#1471
Steven Gagniere (sgagniere) merged 4 commits intomainfrom
cluster-describe-fix

Conversation

@sgagniere
Copy link
Member

@sgagniere Steven Gagniere (sgagniere) commented Oct 18, 2022

Checklist

  1. [CRUCIAL] Is the change for CP or CCloud functionalities that are already live in prod?
    • yes: ok

What

Another short PR.

Since kafka cluster describe now shows the number of topics for the cluster, it will display an error before the cluster is provisioned. I've modified the getTopicCountForKafkaCluster method to return 0, nil if the status is PROVISIONING. For status codes UP, EXPANDING, and SHRINKING, calling kafka REST is fine.

As far as I can tell, the only other status code is FAILED, but I don't think that needs special handling.

I've also added a new error message related to calling kafka REST while the cluster is provisioning; this is an error returned by GetKafkaREST.

Since commands in kafka topic, kafka acl and ksql cluster configure-acls don't currently handle errors so that backup code can run, I've duplicated the provisioning check code inside of topic and acl. This should be temporary, and removed pending removal of the backups. I didn't add it to configure-acls because there are enough checks before it gets to that point that should stop it.

References

#1470
https://confluent.slack.com/archives/C03NF1Z3069/p1657138258955639

Test & Review

Tested w/ some dedicated clusters.
Ran all tests locally.

@sgagniere Steven Gagniere (sgagniere) requested a review from a team as a code owner October 18, 2022 21:58
@brianstrauch

In general, should we be calling any Kafka REST endpoints while a cluster is provisioning? Maybe we should integrate this into our generic Kafka REST logic instead of just this function.

return errors.CatchKafkaNotFoundError(err, lkc, httpResp)
}
if cluster.Status.Phase == "PROVISIONING" {
return errors.Errorf(errors.KafkaRestProvisioningErrorMsg, lkc)
Copy link
Contributor

@MuweiHe MuweiHe Oct 20, 2022

Choose a reason for hiding this comment

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

What if the cluster has failed. What will the behavior be like/should we handle that too?

Copy link
Member Author

Choose a reason for hiding this comment

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

Unsure. Does a cluster that failed to provision still have endpoints? If not, then it will probably generate the same errors that happen when a cluster is provisioning. If so, then I don't know what kind of error the backend produces.

Copy link
Contributor

Choose a reason for hiding this comment

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

Shipping the fix today would be priority. let's keep an eye on this if it ever happens..

Copy link
Contributor

@MuweiHe MuweiHe left a comment

Choose a reason for hiding this comment

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

Thanks!

@sgagniere Steven Gagniere (sgagniere) deleted the cluster-describe-fix branch October 20, 2022 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants