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

support KubeletConfiguration and flag passthrough in NodeConfig #1593

Merged
merged 7 commits into from
Jan 27, 2024

Conversation

ndbaker1
Copy link
Member

@ndbaker1 ndbaker1 commented Jan 24, 2024

Issue #, if available:

Description of changes:

supporting KubeletConfiguration parameters through the NodeConfig as pass through as well as the kubelet cli flags.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Testing Done

added e2e tests to cover the additional configuration surface area

See this guide for recommended testing for PRs. Some tests may not apply. Completing tests and providing additional validation steps are not required, but it is recommended and may reduce review time and time to merge.

@cartermckinnon
Copy link
Member

Chatted offline, I think we have to find a more generic way to accept kubelet config customizations. Clients like Karpenter want to pass a defined subset of the options, but clients like eksctl want to set arbitrary options: https://github.com/eksctl-io/eksctl/blob/9575570b554610129382d0a181645a3806cea98f/pkg/apis/eksctl.io/v1alpha5/types.go#L1247

We shouldn't need to make a code change here for every kubelet config option that every user wants to modify, it's toil for the maintainers and an artificial limitation for users.

I don't think we can do any meaningful validation of these options; when nodeadm runs, it's already too late to tell the user whether or not their kubelet config is valid. Kubelet will tell us itself. :)

@ellistarn
Copy link

We shouldn't need to make a code change here for every kubelet config option that every user wants to modify, it's toil for the maintainers and an artificial limitation for users.

I'm curious to interrogate this assumption. I think that there's value in knowing how customers are using your API, and intentionally constraining things. I think we can pretty trivially fine examples of kubeletconfiguration that would never be used.

@cartermckinnon
Copy link
Member

knowing how customers are using your API

I think this data is valuable, but I think asking folks to cut an issue/PR here, get it merged, and wait for a release is a lot of friction just to permit them to set a field in the kubelet config file. If it were me, I'd just hack around it myself.

I think we can pretty trivially fine examples of kubeletconfiguration that would never be used.

If the knob exists, someone wants (or perhaps less often, needs) to turn it. 😉

@ndbaker1 ndbaker1 force-pushed the kubeletconfig-ext branch 4 times, most recently from 532b88c to 8cdc11e Compare January 25, 2024 18:15
@ndbaker1 ndbaker1 changed the title support subset of KubeletConfiguration through NodeConfig support KubeletConfiguration and flag passthrough in NodeConfig Jan 25, 2024
@mmerkes
Copy link
Member

mmerkes commented Jan 25, 2024

I think that there's value in knowing how customers are using your API, and intentionally constraining things

For the Karpenter use case, I think this makes sense because there's some inherent expectations that you can make. However, in the case of these AMIs as a whole, the use cases are pretty vast. I don't think that we can realistically decide what parameters are and are not useful to customers without just allowing a majority of them to be set regardless, and this code will be significantly less maintainable because any new (or unsupported) config that needs to be added will require a PR. Given, may be a minor PR, but will still need to be cut and then released. Some people will just hope to hack their user data with jq to get it done, which is less desirable. There will be undoubtedly be niche use cases where very few actually need to support something, but it may be very important to them.

I like the idea of making it easy for customers to configure the fields they want and easily adopt new config options.

nodeadm/internal/api/net.go Outdated Show resolved Hide resolved
nodeadm/internal/api/types.go Outdated Show resolved Hide resolved
nodeadm/internal/kubelet/environment.go Outdated Show resolved Hide resolved
nodeadm/test/e2e/cases/kubeconfig/config.yaml Outdated Show resolved Hide resolved
nodeadm/test/e2e/cases/kubelet-flags/config.yaml Outdated Show resolved Hide resolved
assert::file-contains /etc/eks/kubelet/environment "--register-with-taints=foo=:NoSchedule,foo2=baz:NoSchedule"

mock::kubelet 1.28.0
nodeadm init --skip run --config-source file://config.yaml
Copy link

@ellistarn ellistarn Jan 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be sweet if we could do

cat <<EOF | nodeadm init -f -
... inline file
EOF

Copy link
Member Author

@ndbaker1 ndbaker1 Jan 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

most users wont have a need to actually call nodeadm based on how its configured to boot in the ami, but im a fan of the style

name: my-cluster
apiServerEndpoint: https://example.com
certificateAuthority: Y2VydGlmaWNhdGVBdXRob3JpdHk=
cidr: 10.100.0.0/16

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this cause NodeConfig to inject kubelet flags? What if they conflict with user defined flags?

Copy link
Member Author

@ndbaker1 ndbaker1 Jan 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

carter just answered this one while we determined the input style; we will generate flags in nodeadm as a string and then user-provided flags can override any of these

// InlineConfig is a raw document of a kubelet config that can be provided
// by the user to override default generated configurations
// https://kubernetes.io/docs/reference/config-api/kubelet-config.v1/
InlineConfig string `json:"inline,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSON key should match the struct field name here, and I think we should use extraConfig or just config

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im going with config for the brevity 😬

@@ -130,17 +127,6 @@ func enrichConfig(log *zap.Logger, cfg *api.NodeConfig) error {
}
cfg.Status.Instance = *instanceDetails
log.Info("Instance details populated", zap.Reflect("details", instanceDetails))

if featuregates.DefaultFalse(featuregates.DescribeClusterDetails, cfg.Spec.FeatureGates) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to isolate changes like this in their own PR going forward 😉

@ndbaker1 ndbaker1 merged commit 25a470a into awslabs:al2023 Jan 27, 2024
6 checks passed
@ndbaker1 ndbaker1 deleted the kubeletconfig-ext branch January 27, 2024 00:13
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.

4 participants