-
Notifications
You must be signed in to change notification settings - Fork 100
[CRD change] Add LocalDNSProfile to AKSNodeClassSpec + NAP Integration Tests #1233
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
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.
Pull Request Overview
This PR adds LocalDNSProfile support to the AKSNodeClass CRD, enabling Karpenter to configure local DNS settings for AKS nodes. The implementation follows the AKS-RP proto definitions for consistency with the broader Azure ecosystem.
Key changes:
- New LocalDNSProfile field in AKSNodeClassSpec with comprehensive DNS configuration options
- Validation tests for all enum types and boundaries
- Hash tests to ensure configuration changes trigger node updates
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/apis/v1beta1/aksnodeclass.go | Added LocalDNSProfile types and enum constants with kubebuilder validation tags |
| pkg/apis/v1alpha2/aksnodeclass.go | Added LocalDNSProfile types and enum constants with kubebuilder validation tags |
| pkg/apis/v1beta1/zz_generated.deepcopy.go | Auto-generated DeepCopy methods for LocalDNSProfile and LocalDNSOverrides |
| pkg/apis/v1alpha2/zz_generated.deepcopy.go | Auto-generated DeepCopy methods for LocalDNSProfile and LocalDNSOverrides |
| pkg/apis/v1beta1/crd_validation_cel_test.go | Added validation tests for all LocalDNS enum types |
| pkg/apis/v1alpha2/crd_validation_cel_test.go | Added validation tests for all LocalDNS enum types |
| pkg/apis/v1beta1/aksnodeclass_hash_test.go | Added hash tests for LocalDNSProfile fields |
| pkg/apis/v1alpha2/aksnodeclass_hash_test.go | Added hash tests for LocalDNSProfile fields |
| pkg/apis/crds/karpenter.azure.com_aksnodeclasses.yaml | Updated CRD with LocalDNSProfile schema definitions |
| charts/karpenter-crd/templates/karpenter.azure.com_aksnodeclasses.yaml | Updated CRD template with LocalDNSProfile schema definitions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Pull Request Overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
matthchr
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.
I don't think zz_generated.pricing.go needs to be regenerated for this PR?
29c6b95 to
4a16ccc
Compare
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.
Pull request overview
Copilot reviewed 36 out of 36 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| } | ||
|
|
||
| func TestConvertLocalDNSOverrideToModel(t *testing.T) { |
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.
minor, style: Consider just putting these tests into the above test and passing everything through convertLocalDNSToModel (test the public interface or at least the most public part)
618d2ab to
6a42d21
Compare
pkg/apis/v1beta1/aksnodeclass.go
Outdated
| // LocalDNSOverrides specifies DNS override configuration | ||
| type LocalDNSOverrides struct { | ||
| // Log level for DNS queries in localDNS. | ||
| // +optional |
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.
yup - i will make localdnsoverrides required only if localdns config is provided. i need to add the validation rule for it still. last time i attempted, my validation rule was too expensive so karpenter repo rejected it
f4c29d2 to
21c7ab0
Compare
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 logic looks good to me; left some comments around API, runtime validation (and status condition), and caching.
For the API best practices, had some feedback, started to question myself, and ended up just running kube-api-linter. Left what it found as comments - look for "(kubeapilinter)" - pretty much everything looks legitimate / should be addressed, I think. (For more insight on each see API Conventions doc.) We really should integrate kube-api-linter as part of our dev cycle/CI, TODO. There are more issues it flags elsewhere in our API, can be addressed later. But for the new API we introduce, let's get it right from the get go. (It might be possible to prioritize externally visible changes, and follow-up with internal-only later ...)
| if !p.isInstanceTypeSupportedByEncryptionAtHost(sku, nodeClass) { | ||
| continue | ||
| } | ||
| if !p.isInstanceTypeSupportedByLocalDNS(sku, nodeClass) { |
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.
I think you have to add local DNS setting (maybe IsLocalDNSEnabled) to the cache key above, since it now affects the set of instance types
| ConditionTypeImagesReady = "ImagesReady" | ||
| ConditionTypeKubernetesVersionReady = "KubernetesVersionReady" | ||
| ConditionTypeSubnetsReady = "SubnetsReady" | ||
| ConditionTypeLocalDNSReady = "LocalDNSReady" |
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.
Unlike other existing conditions (which fetch certain things and wait for them to be available/ready), this one is just about static API validation, and we are likely to have more of this kind of validation going forward (for other fields as well). So it probably needs to be a single ValidationSucceeded condition, with multiple possible reasons for it to be false - like LocalDNSValiationFailed in this case. Could use AWS provider as an example (e.g. https://github.com/aws/karpenter-provider-aws/blob/main/pkg/controllers/nodeclass/validation.go)
Fixes #
Description
We need to expose the localdns configuration in the CRD for Karpenter. This will allow NAP to leverage the same localdns currently used for node pools in AKS-RP.
How was this change tested?
Unit tests below
Need to learn how to do test like this PR: #688
Does this change impact docs?
Release Note