Apply overrides to chart values on install #15025#15181
Apply overrides to chart values on install #15025#15181raykroeker wants to merge 5 commits intomainfrom
Conversation
The install process did not apply the '--set' command line options onto internal values state before attempting to initialize the issuer credentials. * The change applies the overrides to the values before initialize. * Add test code to cover initializeIssuerCredentials. * Track unit test run history in 'go-test.json' in the root directory when running in the justfile. * Ignore 'go-test.json.' * Add testify assertions as a go module.
| if err != nil { | ||
| return err | ||
| } | ||
| err = yaml.Unmarshal(data, values) |
There was a problem hiding this comment.
This relies on the "partial unmarshal" behavior where existing fields in values will be retained with their value if the field is not present in data. This is a bit subtle and in a casual reading of this code, one might expect values to be completely replaced by data. I think this could use a comment.
| github.com/fatih/color v1.19.0 | ||
| github.com/fsnotify/fsnotify v1.9.0 | ||
| github.com/go-openapi/spec v0.22.4 | ||
| github.com/go-openapi/testify/v2 v2.4.0 |
There was a problem hiding this comment.
I hesitate to introduce a new testing library that is used here but not throughout the project. I'd prefer to evaluate testify independently of this PR. Can the test here be written without it?
* Drop testify as a dependency. * Add comment articulating nuanced umarshal behaviour.
alpeb
left a comment
There was a problem hiding this comment.
Thanks @raykroeker , I think this correctly addresses the issue for the linkerd install command, but if I'm not mistaking the problem remains for linkerd upgrade, so the function upgradeControlPlane needs a similar treatment.
| buf := &bytes.Buffer{} | ||
| err := renderCRDs(context.Background(), nil, buf, opts, "yaml") | ||
| if err != nil { | ||
| t.Fatalf("cannot render-crds for new-k8s-api opts=%+v err=%v", | ||
| opts, err) | ||
| } | ||
| api, err := k8s.NewFakeAPIFromManifests([]io.Reader{buf}) |
There was a problem hiding this comment.
No need to account for the CRDs here. Shorter version:
| buf := &bytes.Buffer{} | |
| err := renderCRDs(context.Background(), nil, buf, opts, "yaml") | |
| if err != nil { | |
| t.Fatalf("cannot render-crds for new-k8s-api opts=%+v err=%v", | |
| opts, err) | |
| } | |
| api, err := k8s.NewFakeAPIFromManifests([]io.Reader{buf}) | |
| api, err := k8s.NewFakeAPI() |
|
Ok I think the issue might actually be a bit different. Say you install cert-manager+trust-manager configured for linkerd as described here. So you end up with the That will retrieve the trust-root and put it in linkerd's config: So when running I think that check needs to be relaxed for the upgrade case. |
|
... and avoiding |
Running
linkerd upgradefails after running install with an external ca. The issue presents at upgrade but the cause is due to install incorrectly initializing the chart values for identity, specifically it initializes the issuer versus querying for one that is already set.The install process did not apply the '--set' command line options onto internal values state before attempting to initialize the issuer credentials.
Added unit test and ran through the integration test suite.
Fixes #15025