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

Enforce Restricted Fields usage when no default value #345

Merged
merged 4 commits into from
Feb 7, 2022

Conversation

eytan-avisror
Copy link
Collaborator

Signed-off-by: Eytan Avisror eytan_avisror@intuit.com

Fixes #341

This fixes a gap in our admin configuration where we allow CRs to use restricted fields if there are no defaults.
This change sets field to Nil if there is no default value provided and field is a restricted field.

Signed-off-by: Eytan Avisror <eytan_avisror@intuit.com>
eytan-avisror and others added 2 commits February 4, 2022 14:42
Signed-off-by: Eytan Avisror <eytan_avisror@intuit.com>
// if no default value exist, make sure to ignore CR value for restricted fields
err := unstructured.SetNestedField(unstructuredInstanceGroup, nil, path...)
if err != nil {
errors.Wrap(err, "failed to set nested field to nil")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@backjo I just noticed we are not returning any of these errors here.. do you remember if we did this intentionally? Thinking we should return these errors to caller WDYT

Copy link
Collaborator

Choose a reason for hiding this comment

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

👍 I don't think it was intentional

@codecov
Copy link

codecov bot commented Feb 4, 2022

Codecov Report

Merging #345 (3806286) into master (c321140) will decrease coverage by 0.00%.
The diff coverage is 33.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #345      +/-   ##
==========================================
- Coverage   51.15%   51.15%   -0.01%     
==========================================
  Files          33       33              
  Lines        4510     4514       +4     
==========================================
+ Hits         2307     2309       +2     
- Misses       2062     2063       +1     
- Partials      141      142       +1     
Impacted Files Coverage Δ
api/v1alpha1/zz_generated.deepcopy.go 0.00% <ø> (ø)
controllers/provisioners/config.go 76.47% <33.33%> (-0.64%) ⬇️

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 c321140...3806286. Read the comment docs.

Signed-off-by: Eytan Avisror <eytan_avisror@intuit.com>
@eytan-avisror eytan-avisror merged commit bda2adc into keikoproj:master Feb 7, 2022
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.

Changing a boundary does not roll back changes on CRs
2 participants