-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Use go-toml v2 in strict mode to log ERROR for unknown Bottlerocket k8s parameters" #8745
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
base: main
Are you sure you want to change the base?
Conversation
… break backward compatibility)
|
Last commit introduces backwards compatibility and just logs an error but proceeds as usual i.e. Example: EC2NodeClass definition apiVersion: karpenter.k8s.aws/v1
kind: EC2NodeClass
...
name: default
...
spec:
...
userData: |
[settings.kubernetes]
unknown = "yes"
log-level = 2logs error message in Karpenter logs like:
and corresponding EC2NodeClass stayed in $ kubectl get ec2nodeclass default
NAME READY AGE
default True 47d |
ryan-mist
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/karpenter snapshot
|
LGTM. Can you also change the PR description to align with the new implementation? |
|
Snapshot successfully published to |
|
Preview deployment ready! Preview URL: https://pr-8745.d18coufmbnnaag.amplifyapp.com Built from commit |
Pull Request Test Coverage Report for Build 20028523045Details
💛 - Coveralls |
ryan-mist
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀
Fixes #8738
Description
Karpenter supports only a subset of available K8s related Bottlerocket API attributes using a struct
BottlerocketKubernetesas defined in pkg/providers/amifamily/bootstrap/bottlerocketsettings.go.Currently if the EC2NodeClass contains an attribute in Bottlerocket
userDatawhich is not supported it will be silently ignored without any log info in Karpenter logs, see Karpenter docs here.Karpenter uses the go-toml v2 which supports a strict mode to throw a
toml.StrictMissingErrorerror.Using strict mode, EC2NodeClass validation is still returning
status: "True"for conditiontype: Readyif an unknown attribute is used inspec.userData, but throws a log of"level":"ERROR"with details.How was this change tested?
Yes, successfully tested using:
Prerequisite:
EC2NodeClass
defaultwith the following setting:Run patched Karpenter locally with
make runand got log entry:{"level":"ERROR","time":"2025-12-08T13:42:58.699+0100","logger":"controller","caller":"bootstrap/bottlerocketsettings.go:31","message":"Unknown parameter in userData K8s settings","reason":"1| [settings.kubernetes]\n2| unknown = \"yes\"\n | ~~~~~~~ missing field\n3| log-level = 2","error":"strict mode: fields in the document are missing in the target struct"}and corresponding EC2NodeClass stayed in
Ready: truestatus: