Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added a new Helm option ignoreMissingValueFiles (#7767) #8003

Merged
merged 1 commit into from
Jan 3, 2022

Conversation

ocraviotto
Copy link
Contributor

@ocraviotto ocraviotto commented Dec 21, 2021

so as to allow operators to prevent Argo CD from passing valueFiles
to helm template if they don't exist in the source under the specified path.

Signed-off-by: Oscar Craviotto craviotto@avellaneda.com

Note on DCO:

If the DCO action in the integration test fails, one or more of your commits are not signed off. Please click on the Details link next to the DCO action for instructions on how to resolve this.

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • Optional. My organization is added to USERS.md.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).

Closes #7767

@codecov
Copy link

codecov bot commented Jan 1, 2022

Codecov Report

Merging #8003 (7089bce) into master (cb1f06c) will increase coverage by 0.00%.
The diff coverage is 34.61%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #8003   +/-   ##
=======================================
  Coverage   41.54%   41.54%           
=======================================
  Files         174      174           
  Lines       22681    22696   +15     
=======================================
+ Hits         9422     9430    +8     
- Misses      11918    11925    +7     
  Partials     1341     1341           
Impacted Files Coverage Δ
cmd/argocd/commands/app.go 0.53% <0.00%> (-0.01%) ⬇️
cmd/util/app.go 46.93% <60.00%> (+0.16%) ⬆️
pkg/apis/application/v1alpha1/types.go 55.19% <100.00%> (ø)
reposerver/repository/repository.go 58.64% <100.00%> (+0.23%) ⬆️
util/settings/settings.go 46.85% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cb1f06c...7089bce. Read the comment docs.

Copy link
Collaborator

@alexmt alexmt left a comment

Choose a reason for hiding this comment

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

Thank you for a useful feature @ocraviotto ! PR looks very solid. Noticed only one minor concern about the new warning message in logs. Let me know what you think please


_, err = os.Stat(path)
if os.IsNotExist(err) {
log.Warnf(" %s values file does not exist", path)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Most of the warning messages in logs indicate a problem that Argo CD operators have to act on. I think a warning about a missing values file is intended for the end-user only. This warning message will be printed in logs pretty frequently and won't be very useful for operators.

I would suggest changing the log level to DEBUG. Additionally, we can introduce a "warning" condition instead. (similar to

ApplicationConditionSharedResourceWarning = "SharedResourceWarning"
). In my opinion "warning" condition is a nice to have a feature and I would work on it in a separate PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you @alexmt for taking the time to start a review and for your comments.

I agree with the above on changing the log level as this definitely affects the end-user and not the operator. TBH I did think initially to emit an event for the application resource, but your pointing me to the status conditions as an alternative to warn the user makes sense too and I'll explore it (though might leave it for a separate PR depending on how much work it'd represent and other considerations, like the proper warning condition etc.).
In any case, my first idea was to let the end-user know about missing files, yet when looking at where in the RepoServer the file check takes place and what the various methods invoked return, I opted for the simpler log approach without much thought on how this would affect logs for operators with multiple managed resources.

To sum up, I'll update my branch, modify the log level and the location of the log within the affirmative conditional below (in normal conditions the helm operation will fail and we should have information on the missing file(s) being the cause) and explore ways to update resource status conditions and at least leave a comment here on that.

Copy link
Contributor Author

@ocraviotto ocraviotto Jan 1, 2022

Choose a reason for hiding this comment

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

@alexmt after a quick look, it seems to me that the best way to pass back additional information (used for conditions or events associated with application resources) from the RepoServer would be to add a new field to the proto ManifestResponse message for the caller to handle the condition update or event generation based on that field value.
If this sounds reasonable, I'd be willing to take a stab at it. In that case, let me know if you'd like me to create an enhancement first or what would be the best way to proceed.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree it makes sense to use ManifestResponse to pass back additional information. Thank you for resolving the comment about log level! Merging this PR.

@alexmt
Copy link
Collaborator

alexmt commented Jan 1, 2022

Failed Lint docs CI task is definitely not related to changes in the PR. I think issue is fixed already, can you try to merge changes from "master" branch?

so as to allow operators to prevent Argo CD from passing valueFiles
to helm template if they don't exist in the source under the specified path.

Signed-off-by: Oscar Craviotto <craviotto@avellaneda.com>
@ocraviotto ocraviotto force-pushed the ignore-missing-value-files branch from c1c5c9e to 7089bce Compare January 1, 2022 20:20
@ocraviotto ocraviotto requested a review from alexmt January 2, 2022 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IgnoreMissingValueFiles option to prevent passing non-existing valueFiles to helm template
2 participants