-
Notifications
You must be signed in to change notification settings - Fork 976
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
Adding a Runtime class resource #2080
Conversation
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.
Great job, @sheneska!
I have left a few comments regarding the acceptance tests. Once you address them, please make sure that they pass on your local cluster:
$ make testacc TESTARGS="-count 1 -run ^TestAccKubernetesruntime_class_v1_basic"
Please add the changelog file .changelog/2080.txt
.
Let me know if you have any questions or need any assistance. Thanks!
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.
Looks Good, just left some things to add such as Docs and adding pod tests
metadata { | ||
name = %q | ||
} | ||
handler = "myclass" |
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.
Since we use the runtime class resource with pods, we should have a pod using a runtimeclass resource as part of the tests.
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.
You don't need to create a Pod to actually test that this resource works. A RuntimeClass can exist without any Pods using it.
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.
@jrhouston wouldn't we want to have a test that checks that it works as expected with a Pod? I left this suggestion since not having a proper handler value would result in the Pod not being created. We could always have a message that informs the user what values to use to prevent this from happening.
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.
The schema already has validation for the handler
field so they will get an error message if the handler value is not in the proper format.
Other than that the API server doesn't produce any error if you supply a handler that doesn't exist on the node. So we don't really have a way of informing them that they've specified a bad handler value.
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.
Wondering about overhead
and scheduling
being missing – otherwise this looks good 🚀
|
||
Schema: map[string]*schema.Schema{ | ||
"metadata": metadataSchema("runtimeclass", true), | ||
|
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.
What about the overhead
and scheduling
fields? See API ref: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#runtimeclass-v1-node-k8s-io
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.
Sacha had recommended that i focus on the handler at first and get it working perfectly, he also mentioned that since the handler is will be the most commonly used we should merge this first and then add overhead
and scheduling
afterwards
Type: schema.TypeString, | ||
Description: "Specifies the underlying runtime and configuration that the CRI implementation will use to handle pods of this class", | ||
Required: true, | ||
ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-z0-9]([-a-z0-9]*[a-z0-9])?`), ""), |
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.
Kubernetes actually has a utility function to validate RFC 1123 DNS labels: https://pkg.go.dev/k8s.io/apimachinery/pkg/util/validation#IsDNS1123Label
So we don't need to roll our own regex here.
…etes_runtime_class_v1 and runtime_class_v1 files
Description
Added a runtime class resource (with handler attribute only for now) & wrote test file that asserts for only the
creating a runtime class
stepAcceptance tests
Output from acceptance testing:
Release Note
Release note for CHANGELOG:
References
Fix: #1114
Community Note