-
Notifications
You must be signed in to change notification settings - Fork 431
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
Expose AKS preview features #4617
Conversation
Skipping CI for Draft Pull Request. |
15025ef
to
4dd5fcd
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4617 +/- ##
==========================================
+ Coverage 62.71% 62.73% +0.01%
==========================================
Files 192 192
Lines 15487 15641 +154
==========================================
+ Hits 9713 9812 +99
- Misses 5107 5146 +39
- Partials 667 683 +16 ☔ View full report in Codecov by Sentry. |
return nil, err | ||
} | ||
stable := &asocontainerservicev1.ManagedCluster{} | ||
if err := stable.ConvertFrom(hub); err != nil { |
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.
Maybe we could leave out this particular conversion and only operate against the hub-typed resource until the end where we ultimately convert to preview or stable based on the CAPZ spec? Like you pointed out, that would probably help reduce the agent pool duplicated code. Let's maybe do that in a follow-up PR though.
return err | ||
} | ||
prev := &asocontainerservicev1.ManagedCluster{} | ||
if err := prev.ConvertFrom(hub); err != nil { |
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.
Like in Parameters
, maybe we don't need to convert to any particular version again and we can stick with using the hub type here.
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.
Do we wanna make this change before merging?
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 wouldn't block on this.
@@ -252,7 +249,8 @@ func applyPatches[T deepCopier[T]](scheme *runtime.Scheme, spec azure.ASOResourc | |||
if err != nil { | |||
return zero, errors.Wrap(err, "failed to get GroupVersionKind for object") | |||
} | |||
parameters.SetGroupVersionKind(gvk) | |||
|
|||
(genruntime.MetaObject)(parameters).(interface{ SetGroupVersionKind(schema.GroupVersionKind) }).SetGroupVersionKind(gvk) |
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.
A slightly nicer version of this we could do in a follow up might look like this:
(genruntime.MetaObject)(parameters).(interface{ SetGroupVersionKind(schema.GroupVersionKind) }).SetGroupVersionKind(gvk) | |
type gvkSetter interface{ SetGroupVersionKind(schema.GroupVersionKind) } | |
var a any = parameters | |
a.(gvkSetter).SetGroupVersionKind(gvk) |
interested in getting one more data point to look at tomorrow: |
/retest |
/test pull-cluster-api-provider-azure-apidiff |
agentPoolName := agentPool.AzureName() | ||
var agentPoolName string | ||
if s.scope.IsPreviewEnabled() { | ||
agentPoolTyped := agentPool.(*asocontainerservicev1preview.ManagedClustersAgentPool) |
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.
nit: do we need this extra agentPoolTyped
var or can we just do:
agentPoolName = agentPool.(*asocontainerservicev1preview.ManagedClustersAgentPool).AzureName()
and ditto below
/hold for squash |
existing = existingObj.(*asocontainerservicev1.ManagedCluster) | ||
} | ||
} | ||
|
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.
@nojnhuh it appears that the // Additional tags managed separately
comment refers to functionality that this PR has broken (until we fix it, that is!)
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.
This should be fixed by this commit: 5ff390c#diff-d7496d9845d55dda5142aab2970a5a9aa1012fbb52d2c462cc5b220682ca520aR821
The issue was caused by not updating the type of the TagsGetterSetter
to genruntime.MetaObject
, and handling tags differently based on the api version.
Looks like the job passed with the tags fix and preview enabled! Will retest with preview disabled https://prow.k8s.io/view/gs/kubernetes-jenkins/pr-logs/pull/kubernetes-sigs_cluster-api-provider-azure/4617/pull-cluster-api-provider-azure-e2e-aks/1765178975744692224 |
/retest |
@@ -291,6 +292,266 @@ func TestParameters(t *testing.T) { | |||
g.Expect(cmp.Diff(actual, expected)).To(BeEmpty()) | |||
}) | |||
|
|||
t.Run("no existing preview managed cluster", func(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.
Can we pare down this test case any more so it's only testing preview-specific things? One test case with everything is enough I think. The bare minimum to show that the result is the preview type instead of the stable type should be enough. And we probably don't even need separate create and update test cases to feel good about that.
azure/services/virtualmachines/mock_virtualmachines/client_mock.go
Outdated
Show resolved
Hide resolved
7f2ffff
to
5ff9539
Compare
Co-authored-by: Jon Huhn <[email protected]>
5ff9539
to
ae1e38d
Compare
@willie-yao: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
/hold cancel Squashed! PTAL @jackfrancis @nojnhuh |
/lgtm Great work @willie-yao |
LGTM label has been added. Git tree hash: 6bb8d42bbaec8035af34c5284062c99a88a99140
|
FYI it doesn't look like any of your contribution here isn't included in the git history, which I think is worth fixing:
|
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
/approve
Thank you for sticking with this!
@@ -81,6 +81,7 @@ func (mw *azureManagedControlPlaneWebhook) Default(ctx context.Context, obj runt | |||
setDefault[*Identity](&m.Spec.Identity, &Identity{ | |||
Type: ManagedControlPlaneIdentityTypeSystemAssigned, | |||
}) | |||
setDefault[*bool](&m.Spec.EnablePreviewFeatures, ptr.To(false)) |
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.
For next time, the compiler can usually figure out what the type parameters are so they don't always need to be included.
setDefault[*bool](&m.Spec.EnablePreviewFeatures, ptr.To(false)) | |
setDefault(&m.Spec.EnablePreviewFeatures, ptr.To(false)) |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: nojnhuh The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/hold |
Sorry, not quick enough on the draw apparently. :( |
Whoops that's weird! I think it might've happened when I squashed the commits and I didn't realize 😅 |
What type of PR is this?
/kind feature
What this PR does / why we need it:
This PR enables users to configure AKS managed clusters with preview features to take advantage of the latest and greatest functionality available in AKS.
Big thanks to @nojnhuh for laying out the groundwork for this feature!
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #2625
Special notes for your reviewer:
TODOs:
Release note: