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

Check if mandatory secrets/configmaps exist #799

Merged
merged 2 commits into from
Feb 4, 2021
Merged

Conversation

Nerja
Copy link
Contributor

@Nerja Nerja commented Feb 1, 2021

This PR adds checks for errors when fetching secrets and config maps to make sure that an unavailable API server will not cause Flagger to consider it a diff and trigger a new canary deployment.

@Nerja Nerja requested a review from stefanprodan as a code owner February 1, 2021 16:36
@codecov-io
Copy link

codecov-io commented Feb 1, 2021

Codecov Report

Merging #799 (ec73a53) into main (118cac5) will increase coverage by 0.22%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #799      +/-   ##
==========================================
+ Coverage   56.61%   56.84%   +0.22%     
==========================================
  Files          67       67              
  Lines        5403     5401       -2     
==========================================
+ Hits         3059     3070      +11     
+ Misses       1882     1873       -9     
+ Partials      462      458       -4     
Impacted Files Coverage Δ
pkg/canary/config_tracker.go 83.64% <100.00%> (+5.86%) ⬆️

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 118cac5...af1614e. Read the comment docs.

@stefanprodan
Copy link
Member

stefanprodan commented Feb 1, 2021

Deployments can reference non existing Secrets and ConfigMaps https://github.com/kubernetes/kubernetes/blob/fc39904bed3b935f8989b7064e696a5c08ce77b3/pkg/apis/core/types.go#L1904 we need to error out only if the optional fields is set to false.

Signed-off-by: Marcus Rodan <[email protected]>
@Nerja
Copy link
Contributor Author

Nerja commented Feb 2, 2021

@stefanprodan Changed the implementation so that we keep the old behavior if optional is not set, or set to true. We will error out if we encounter a secret/config ref with the optional flag set to false.

Copy link
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

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

LGTM

Thanks @Nerja

@stefanprodan stefanprodan changed the title Added checks for API server errors Check if mandatory secrets/configmaps exist Feb 4, 2021
@stefanprodan stefanprodan merged commit 5cb343d into fluxcd:main Feb 4, 2021
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.

4 participants