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

Improve experience with .flux.yaml files #2565

Merged
merged 3 commits into from
Nov 4, 2019

Conversation

squaremo
Copy link
Member

@squaremo squaremo commented Oct 30, 2019

  • include more information like filenames in errors
  • correct the implementation of resourceID so it uses the name of the
    resource

These two address a comment #2428 (comment) that fluxd should at least provide information about which file/resource is failing, when syncing goes wrong.

  • return an error if asked to update a manifest, but there are no (relevant) update commands in the config file

This addresses #2324 by making it more obvious what has failed (in that issue, the complaint can be interpreted as "nothing happened and I don't know why").

@squaremo squaremo force-pushed the kustomize-ignore-unlinky-patches branch 2 times, most recently from e36e0eb to 8ca1303 Compare October 31, 2019 16:43
@squaremo squaremo marked this pull request as ready for review October 31, 2019 17:01
@squaremo squaremo changed the title Improve experience with patch files Improve experience with .flux.yaml files Oct 31, 2019
@squaremo
Copy link
Member Author

@2opremio I've moved this out of draft, and done more work to surface mistakes with config files; PTAnotherL when you have a sec. 🍎

@@ -22,6 +22,7 @@ require (
github.com/pkg/errors v0.8.1
github.com/pkg/term v0.0.0-20190109203006-aa71e9d9e942
github.com/prometheus/client_golang v1.1.0
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90
Copy link
Contributor

Choose a reason for hiding this comment

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

Where did this come from? (just wondering)

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know, it keeps popping up whenever I run make; so whichever version of go I have, it thinks it's a dependency.

@2opremio
Copy link
Contributor

2opremio commented Nov 1, 2019

Very minor stuff, otherwise LGTM! 💯 (+ an extra 🥇 for the dispatching refactoring!)

 - include more information like filenames
 - correct the implementation of resourceID so it uses the name of the
   resource
With respect to .flux.yaml files, two types control the generation and
update of manifests in a repo:

 - ConfigFile, which is a directory subject to .flux.yaml; and
 - ConfigAware, which represents a set of directories, some of which
   have a ConfigFile, and some of which just have YAML files

The dispatch of operations based on whether a config file has a
PatchUpdated or CommandUpdated field more properly belongs among the
ConfigFile methods, but hitherto has been somewhat scattered.

This commit moves all the detail of how things are generated or
updated into methods of ConfigFile, and just delegates to those from
ConfigAware when there is a config file in effect. The methods to be
delegated to are exported; helpers are not exported.
It's evidently easy to end up with no commands in a config file for
updating manifests, either because you accidentally use
`commandUpdated` with a `patchFile` field, or because the instructions
were unclear, and so on.

Instead of silently running nothing, then complaining that no files
have changed, return an error if nothing got run. This way the person
or system attempting the update will at least see the reason nothing
happened.
@squaremo squaremo force-pushed the kustomize-ignore-unlinky-patches branch from 8ca1303 to 2fdaaa6 Compare November 4, 2019 10:33
@squaremo squaremo merged commit 467f719 into master Nov 4, 2019
2opremio pushed a commit to 2opremio/flux that referenced this pull request Nov 12, 2019
The problem was introduced at fluxcd#2565

Also, re-enable the manifest generation e2e test, which was disabled
because of the bug fixed here.
@2opremio 2opremio added this to the 1.16.0 milestone Nov 21, 2019
@squaremo squaremo deleted the kustomize-ignore-unlinky-patches branch January 20, 2020 14:53
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.

2 participants