Fix machine selector config to allow kubelet arg list #1181
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue: #1074
Problem
Machine Selector Config
kubelet-arg
values could not be passed via Terraform to downstream machines and would not show up in the rancher UI.Solution
My solution is to convert
machine_selector_config.config
from Type.Map (string map) to Type.String that supports yaml like Machine Global Config + state migration logic to handle the schema update. This allows for users to input both strings and lists, which allows subfieldkubelet-arg
to be passed as a list which is what Rancher is expecting. It also prevents a potential regression caused by 1) only allowing string args or lists which will reduce the flexibility of Machine Selector Config or 2) defining kubelet-arg as a subfield which will break other config fields that are already expected in the Rancher backend such asprivate-default-registry.
Before, passing
kubelet-arg
under Machine Selector Config would not work. This feature now works with the following configurationTesting
Engineering Testing
Manual Testing
Test plan
terraform plan/apply
or updates to Machine Selector Config.Automated Testing
Tests updated. Ran
go test -v ./rancher2
to make sure all automated tests pass.QA Testing Considerations
Regressions Considerations