Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Add --watch option to release command #1525

Merged

Conversation

iandotmartin
Copy link
Contributor

Adds a flag to fluxctl release to observe rollout progress during the release. Shows the numbers of pods desired, up-to-date, available, and outdated.

Note: I wasn't sure if it made sense to add a case somewhere in release_cmd_test for this flag, since there's no change to the release spec. Happy to add one if desired!

Addresses #1424

Copy link
Member

@squaremo squaremo left a comment

Choose a reason for hiding this comment

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

I tried this out and it works well! I've made some suggestions for refining it a bit.
It'd be cool if the progress table refreshed in place, but that can come after.

cmd/fluxctl/release_cmd.go Outdated Show resolved Hide resolved
cmd/fluxctl/release_cmd.go Outdated Show resolved Hide resolved
cmd/fluxctl/release_cmd.go Outdated Show resolved Hide resolved
@rndstr
Copy link
Contributor

rndstr commented Nov 27, 2018

Had a look and it worked great, thanks @iandotmartin!

I'm thinking about how to display the data. It's quite hard to parse for me now and gauge any progress:

CONTROLLER                CONTAINER  IMAGE            RELEASE   DESIRED  UP-TO-DATE  AVAILABLE  OUTDATED
default:deployment/nginx  nginx      nginx:1.14-perl  updating  3        2           2          2

What about having the column header say Replicas, and the cell value:
<available>/<desired>
if you pass in --verbose it expands
<available>/<desired> (<outdated> outdated, <updated> updated)
?

That would then look like

CONTROLLER                CONTAINER  IMAGE            RELEASE   REPLICAS
default:deployment/nginx  nginx      nginx:1.14-perl  updating  2/3 (2 outdated, 2 updated)

Edit: this could also eventually be displayed in fluxctl list-controller but that can be done separately later

cmd/fluxctl/release_cmd.go Outdated Show resolved Hide resolved
cmd/fluxctl/release_cmd.go Outdated Show resolved Hide resolved
* More humon-friendly replica information
* Handle err returned from await
* Exit early for watch to avoid nesting
* Unify dot styling
* Move status writing to function
* Only monitor AffectedResources
* Use status rather than outdated to determine completion
* Fix fallthrough behavior for `interactive` option
* Swap Ready and Desired for proper replica info
@iandotmartin
Copy link
Contributor Author

@squaremo @rndstr thanks for the reviews! this is ready for another look when you get a chance :)

@squaremo
Copy link
Member

@squaremo @rndstr thanks for the reviews! this is ready for another look when you get a chance :)

👀

@squaremo
Copy link
Member

@iandotmartin Please consider cherry-picking ae29a97, which I made to tweak how this works. Main thing it addresses: it needs to wait for the commit to be synced before moving on to show rollout progress, otherwise it will (usually) succeed immediately.

Unless the newly committed change has been synced, rollout status will
usually return "ready" trivially. Therefore, always wait for job
completion _and_ sync (using `await`) whether `--watch` was passed or
not.

Secondarily,

 - it doesn't make sense for someone to

       fluxctl release --dry-run --watch

    so make that a usage error.

 - print the updated pods vs desired, which gives a slightly better
   indication of progress; ready pods counts those that are outdated,
   so tends to be almost the same as desired. It's still not perfect
   -- I don't think there is a perfect -- since updated is different
   to updated-and-ready (I think).
@squaremo
Copy link
Member

@rndstr Can you advise on the best format for showing ready and updated pods?

@iandotmartin
Copy link
Contributor Author

@squaremo cherry-pick'd

Copy link
Contributor

@rndstr rndstr left a comment

Choose a reason for hiding this comment

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

@iandotmartin since we replaced the Ready with Updated, the verbose part should also be changed, bringing it to:
<updated>/<desired> (<outdated> outdated, <ready> ready)

cmd/fluxctl/release_cmd.go Outdated Show resolved Hide resolved
@iandotmartin
Copy link
Contributor Author

@rndstr yep, seems reasonable! made those updates.

Copy link
Contributor

@rndstr rndstr left a comment

Choose a reason for hiding this comment

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

Nice @iandotmartin, looks good to me.

Submitting release ...
CONTROLLER                STATUS   UPDATES
default:deployment/nginx  success  nginx: nginx:1.14 -> 1.15
Commit pushed:  ac2f3e3
Commit applied: ac2f3e3
Monitoring rollout ...
CONTROLLER                CONTAINER  IMAGE       RELEASE   REPLICAS
default:deployment/nginx  nginx      nginx:1.15  updating  2/3 (2 outdated, 2 ready)

CONTROLLER                CONTAINER  IMAGE       RELEASE   REPLICAS
default:deployment/nginx  nginx      nginx:1.15  updating  2/3 (2 outdated, 2 ready)

CONTROLLER                CONTAINER  IMAGE       RELEASE   REPLICAS
default:deployment/nginx  nginx      nginx:1.15  updating  3/3 (0 outdated, 2 ready)

CONTROLLER                CONTAINER  IMAGE       RELEASE  REPLICAS
default:deployment/nginx  nginx      nginx:1.15  ready    3/3 (0 outdated, 3 ready)

All controllers ready.

@squaremo squaremo merged commit 4d60825 into fluxcd:master Dec 17, 2018
@yinzara
Copy link

yinzara commented Mar 4, 2019

I tried using this with the helm operator and it seems to not work. For example, I have a custom git helm chart called "openapi-web" that I'm deploying to my cluster via the HelmRelease CRD and the helm-operator. When I disable automation and use "fluxctl release --all --update-all-images --watch" I get:
CONTROLLER CONTAINER IMAGE RELEASE REPLICAS
feature-fluxwatch:helmrelease/feature-fluxwatch-openapi-web deployment us.gcr.io/my-project/openapi-web:feature-fluxwatch-0c9ac47 DEPLOYED 0/0

Repeated over and over again and it never completes.

@MilanDasek
Copy link

MilanDasek commented Mar 18, 2019

I have exactly same problem. --watch never ends when automation disabled

  annotations:
     flux.weave.works/automated: "false"

BTW:
Is there any way/solution how to be sure whole set of charts/versions was successful?
I mean is it possible to push multiple image releases in one step/commit which will have --watch?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants