You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What happened:
While setting custom rlimits to containerd containers as mentioned in the documentation you can use a custom NodeConfig passed into the user data to override it. However we are using karpenter for provisioning nodes and it adds a custom NodeConfig to the user data as well to establish cluster connectivity. When adding our custom NodeConfig to the user data, the baseRuntimeSpec config key is not reflected in the merged NodeConfig.
How to reproduce it (as minimally and precisely as possible):
Pass the above mentioned node config into user data of any EC2 instance, ssh and run nodeadm init
The merged node config should be visible in the logs.
Anything else we need to know?:
I dived into nodeadm source code to understand why it is happening. My understanding is, when we call the config.Merge(nodeConfig)here we setup our merger with some custom transformers using mergo.WithTransformers(nodeConfigTransformer{})
The transformer sets up custom transformers for containerd and kubelet config using type reflection but we only setup the transformer for Config key of containerd config and not BaseRuntimeSpec. I reused the logic from the func transformKubeletConfig and tested by making the following changes to the transformer to see if the merge functionality is working as expected. Please let me know this makes sense, would be happy to send out a PR for this fix.
Sounds good, would there be any different merge strategy in case of transformContainerdBaseRuntimeSpec ? Currently I just reused the same code as for transformKubeletConfig
@vedantrathore makes sense to me, you can add a test case to confirm
cartermckinnon
changed the title
Nodeadm does not merge containerd BaseRuntimeSpec config correctly
bug(nodeadm): containerd BaseRuntimeSpec config not merged correctly
Aug 23, 2024
What happened:
While setting custom rlimits to containerd containers as mentioned in the documentation you can use a custom
NodeConfig
passed into the user data to override it. However we are using karpenter for provisioning nodes and it adds a customNodeConfig
to the user data as well to establish cluster connectivity. When adding our customNodeConfig
to the user data, thebaseRuntimeSpec
config key is not reflected in the merged NodeConfig.User data script:
What you expected to happen:
Expected merged
NodeConfig
But the result is
How to reproduce it (as minimally and precisely as possible):
Pass the above mentioned node config into user data of any EC2 instance, ssh and run
nodeadm init
The merged node config should be visible in the logs.
Anything else we need to know?:
I dived into nodeadm source code to understand why it is happening. My understanding is, when we call the
config.Merge(nodeConfig)
here we setup our merger with some custom transformers usingmergo.WithTransformers(nodeConfigTransformer{})
The transformer sets up custom transformers for
containerd
andkubelet
config using type reflection but we only setup the transformer forConfig
key ofcontainerd
config and notBaseRuntimeSpec
. I reused the logic from the functransformKubeletConfig
and tested by making the following changes to the transformer to see if the merge functionality is working as expected. Please let me know this makes sense, would be happy to send out a PR for this fix.The text was updated successfully, but these errors were encountered: