ko icon indicating copy to clipboard operation
ko copied to clipboard

RFC: deprecate and remove Watch Mode

Open imjasonh opened this issue 3 years ago • 7 comments

Watch Mode (i.e, ko apply --watch) was added about 2 1/2 years ago, in the old ggcr repo, in https://github.com/google/go-containerregistry/pull/336.

We don't collect usage metrics, but based on recommended/documented usage in projects that I know of that use ko, none use watch mode today. It was marked as EXPERIMENTAL from the beginning, and documentation for it was apparently accidentally removed from the README six months ago in https://github.com/google/ko/pull/318 😞.

Watch Mode adds quite a bit of complexity to what is otherwise a relatively straightforward transformation on inputs. It involves implementing non-standard concurrency primitives like Futures. It's not well tested, and not currently easily test-able. It might make future improvements to outputs like https://github.com/google/ko/issues/406 and ko extract more difficult, or simply incompatible with watch mode.

With support for watching and re-building images with ko available through Skaffold (today unofficially; in the future, officially), and upcoming improvements to speed up no-op builds (#267 #269) I think we should consider deprecating and eventually removing watch mode from ko, simplifying the codebase and focusing efforts on better release management integration and security best practices.

If we decide to proceed, we can start by adding a warning linking this issue when using --watch, to collect any feedback that might encourage us to reconsider deprecating. If we do decide to keep it, we should invest more in documentation and testing, and promote it out of an undocumented experiment.

wdyt @mattmoor @jonjohnsonjr

imjasonh avatar Aug 09 '21 13:08 imjasonh

If we decide to proceed, we can start by adding a warning linking this issue when using --watch, to collect any feedback that might encourage us to reconsider deprecating.

This seems funny to me. If --watch is set, print something like Come argue in issue 412 if you use this.

On the other hand, I think I like the future stuff. It is pretty nice for streaming support (ko resolve -f -).

jonjohnsonjr avatar Aug 09 '21 15:08 jonjohnsonjr

Honestly I'm fine with just removing it, I just want to give people an opportunity to tell us why they think it's load-bearing for them, if it is.

I'm not sure I can think of a case where we wouldn't be able to just buffer all of stdin then process it all non-streamily -- it's one YAML Michael, how much of it could there be, 10 MB? But you're right, it's easy enough to support today so why not.

imjasonh avatar Aug 09 '21 16:08 imjasonh

I'm not sure I can think of a case where we wouldn't be able to just buffer all of stdin

curl my-cluster.example.com/ko/out-of-date-image-stream | ko resolve -f -

This is obviously contrived, but imagine you have a service on your cluster that streams any yaml documents containing out of date images on that cluster and doesn't close the request until the images have been updated. ko apply -f - would update those deployments, which would cause the yaml stream to finally close.

😄

jonjohnsonjr avatar Aug 09 '21 17:08 jonjohnsonjr

This is obviously contrived.

🙃

imjasonh avatar Aug 09 '21 17:08 imjasonh

Do it, it doesn't work well enough on macOS, so I haven't used it since I left Google, and I'm not sure I ever tested it after some of Jon's go module changes.

mattmoor avatar Sep 11 '21 04:09 mattmoor

This issue is stale because it has been open for 90 days with no activity. It will automatically close after 30 more days of inactivity. Keep fresh with the 'lifecycle/frozen' label.

github-actions[bot] avatar Dec 11 '21 01:12 github-actions[bot]

We still haven't removed Watch Mode.

fsnotify, which we depend on for watch mode, is in need of maintainers, and if some aren't identified soon the repo will be archived: https://github.com/fsnotify/fsnotify/issues/413

imjasonh avatar Jan 14 '22 17:01 imjasonh

https://github.com/ko-build/ko/pull/585

imjasonh avatar Apr 04 '23 15:04 imjasonh