Set protect-kernel-defaults on v2 clusters #1244
Merged
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: #1243
Problem
When going to Cluster Management and clicking Edit Config on a cluster, the page crashes and displays a "Loading ..." text but ends up with the following message: Cannot read properties of undefined (reading 'length'). This happens if a MachineSelectorConfig config is set as null.
Solution
Rancher sets protect-kernel-defaults false by default under the hood for rke2/k3s clusters but it is not exposed in the UI. My solution is for the TF rancher2 provider to set this field for any empty MachineSelectorConfig config so tf doesn't remove it every time to reconcile the state.
Testing
Confirmed removing
protect-kernel-defaults: false
and settingconfig: null
causes the page to crash. Adding the field back in fixes it. Prov an rke2 cluster on EC2 with the fix resolves the bug. Adding the same MachineSelectorConfig via the UI that @Josh-Diamond did during our debug session and then running aterraform refresh
to refresh the state causes the following to be set,which is correct.
Engineering Testing
Manual Testing
Automated Testing
QA Testing Considerations
Regressions Considerations