kiler129
Dabbler
- Joined
- Apr 16, 2016
- Messages
- 22
I'm scripting a custom certificate installation for an application running on TNS. After the certificate is installed I need to "restart" the application (PoC: https://gist.github.com/kiler129/39c1330731ba263f15e28c04f154c0f8).
After playing with the API I came up with the following flow:
After playing with the API I came up with the following flow:
- Query application status via
midclt call chart.release.query '[["id","=","plex"]]' | jq -r '.[] | .status'
- If status is not
ACTIVE
norDEPLOYING
abort
- If status is not
- Scale to 0 replicas using
midclt call chart.release.scale 'plex' '{"replica_count":0}'
- Job id is returned, which took me a while to find. I'm not sure if there's any place where this is documented.
- Wait for the job to complete
- The websocket api seems to use some subscription API, but midclt doesn't seem to have any equivalent, or I cannot find it
- Currently I'm querying the jobs api to check the status:
midclt call core.get_jobs '[["id","=",1234]]' | jq -r '.[0].state'
- Based on the middleware source my code needs to wait until the status is
WAITING
orRUNNING
- When scaling succeeded the job will have a status of
SUCCESS
- Scale to 1 replica using
midclt call chart.release.scale 'plex' '{"replica_count":1}'
- Wait for the job to complete and report status to the user like in #3
Last edited: