redhat-developer / app-services-cli

Command Line Interface for RHOAS
https://redhat-developer.github.io/app-services-website/
Apache License 2.0
41 stars 72 forks source link

feat(kafka): add promote command #1805

Closed rkpattnaik780 closed 1 year ago

rkpattnaik780 commented 1 year ago

rhoas kafka promote command to promote eval instances to use paid subscriptions.

Verification Steps

  1. Create an eval instance:
    rhoas kafka create --name test-instance --billing-model eval
  2. Run promote command to change billing model to standard.
    rhoas kafka promote --billing-model standard

Type of change

ziccardi commented 1 year ago

I gave a run to the code and it works very well.

I have only a few comments:

  1. If you run the promote command and the kafka is not in a valid state for promotion (ready/suspended/resuming), the cli gives a misleading error : Only Kafka instances with billing model "eval" can be promoted
  2. The promote is valid only for eval instances, but when I list the kafkas, the billing model is not visualised. How can I know what are the kafkas I can promote?
  3. When the promote is called and it is successful, it returns an 'instance has been successfully promoted' message. That is misleading. When you invoke the promotion endpoint, the promotion request gets accepted. A reconciler then manages the promotion. At this point, the promotion can still fail. The cli should take into consideration the promotion_status and the promotion_details fields.
  4. The billing_model is not shown in the kafka list: I have no way to know the current billing model and I don't have any way to check that the promotion has been really done.
rkpattnaik780 commented 1 year ago

Hello @ziccardi Thanks for the review. While going through the wrong error message issue, it turns out that the custom error code KAFKAS-MGMT-9 is associated with two failed reasons - kafka request \"cfivi8ubtv3kjdprf0v0\" has a kafka billing model \"standard\". Only kafka requests with a kafka billing model 'eval' can be promoted and kafka request \"cfivi8ubtv3kjdprf0v0\" with status \"accepted\" cannot be promoted: promotable status are: [ready suspended resuming]". Is there any reason we have two errors mapped to single error code? Shouldn't they be unique?

ziccardi commented 1 year ago

Is there any reason we have two errors mapped to single error code? Shouldn't they be unique?

Currently we return those errors as general errors, so they share the same code. If you need those to use different codes, please fire a jira and we will look into it

rkpattnaik780 commented 1 year ago

Is there any reason we have two errors mapped to single error code? Shouldn't they be unique?

Currently we return those errors as general errors, so they share the same code. If you need those to use different codes, please fire a jira and we will look into it

Thank you for explaining. Will be creating a JIRA.