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

Set protect-kernel-defaults on v2 clusters #1244

Merged
merged 1 commit into from
Oct 26, 2023

Conversation

a-blender
Copy link
Contributor

@a-blender a-blender commented Oct 5, 2023

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 setting config: 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 a terraform refresh to refresh the state causes the following to be set,

machineSelectorConfig:
      - config:
          protect-kernel-defaults: true
      - config:
          kubelet-arg:
            - cloud-provider=external
        machineLabelSelector:
          matchExpressions: []
          matchLabels:
            key: value

which is correct.

Engineering Testing

Manual Testing

Automated Testing

QA Testing Considerations

Regressions Considerations

@a-blender a-blender requested a review from a team October 5, 2023 18:43
@a-blender a-blender force-pushed the fix-cluster-config-load-err branch from cb734c0 to d8f629a Compare October 5, 2023 18:46
@a-blender a-blender force-pushed the fix-cluster-config-load-err branch from d8f629a to 8eb61cd Compare October 5, 2023 21:29
@a-blender a-blender changed the title Set protect-kernel-defaults on v2 clusters [DNM pending testing on 2.7] Set protect-kernel-defaults on v2 clusters Oct 5, 2023
@a-blender a-blender requested review from HarrisonWAffel and removed request for thatmidwesterncoder October 5, 2023 21:34
@a-blender
Copy link
Contributor Author

DNM waiting on QA testing before merging this forward port to 2.8

@a-blender a-blender requested review from a team and HarrisonWAffel and removed request for HarrisonWAffel October 23, 2023 16:04
@a-blender
Copy link
Contributor Author

@HarrisonWAffel Tested that on upgrade from a previous tf version to this one, a hardened RKE2 cluster with existing protect-kernel-defaults: true is not overwritten.

@a-blender a-blender changed the title [DNM pending testing on 2.7] Set protect-kernel-defaults on v2 clusters [DNM release 2.7.9] Set protect-kernel-defaults on v2 clusters Oct 26, 2023
@a-blender a-blender changed the title [DNM release 2.7.9] Set protect-kernel-defaults on v2 clusters Set protect-kernel-defaults on v2 clusters Oct 26, 2023
@a-blender a-blender merged commit d7d6ad1 into rancher:master Oct 26, 2023
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.

3 participants