-
Notifications
You must be signed in to change notification settings - Fork 222
feat: align GCPManagedControlPlane with CAPI >=v1.9 #1434
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -72,21 +72,21 @@ func TestGCPManagedControlPlaneDefaultingWebhook(t *testing.T) { | |
| resourceName: "cluster1", | ||
| resourceNS: "default", | ||
| spec: GCPManagedControlPlaneSpec{ | ||
| ClusterName: "cluster1_27_1", | ||
| ControlPlaneVersion: &vV1_27_1, | ||
| ClusterName: "cluster1_27_1", | ||
| Version: &vV1_27_1, | ||
| }, | ||
| expectSpec: GCPManagedControlPlaneSpec{ClusterName: "cluster1_27_1", ControlPlaneVersion: &vV1_27_1}, | ||
| expectSpec: GCPManagedControlPlaneSpec{ClusterName: "cluster1_27_1", Version: &vV1_27_1}, | ||
| }, | ||
| { | ||
| name: "with autopilot enabled", | ||
| resourceName: "cluster1", | ||
| resourceNS: "default", | ||
| spec: GCPManagedControlPlaneSpec{ | ||
| ClusterName: "cluster1_autopilot", | ||
| ControlPlaneVersion: &vV1_27_1, | ||
| EnableAutopilot: true, | ||
| ClusterName: "cluster1_autopilot", | ||
| Version: &vV1_27_1, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can be this updated?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll update this in a separate PR, if that's okay.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes |
||
| EnableAutopilot: true, | ||
| }, | ||
| expectSpec: GCPManagedControlPlaneSpec{ClusterName: "cluster1_autopilot", ControlPlaneVersion: &vV1_27_1, EnableAutopilot: true}, | ||
| expectSpec: GCPManagedControlPlaneSpec{ClusterName: "cluster1_autopilot", Version: &vV1_27_1, EnableAutopilot: true}, | ||
| }, | ||
| } | ||
|
|
||
|
|
@@ -120,18 +120,21 @@ func TestGCPManagedControlPlaneValidatingWebhookCreate(t *testing.T) { | |
| tests := []struct { | ||
| name string | ||
| expectError bool | ||
| expectWarn bool | ||
| spec GCPManagedControlPlaneSpec | ||
| }{ | ||
| { | ||
| name: "cluster name too long should cause an error", | ||
| expectError: true, | ||
| expectWarn: false, | ||
| spec: GCPManagedControlPlaneSpec{ | ||
| ClusterName: strings.Repeat("A", maxClusterNameLength+1), | ||
| }, | ||
| }, | ||
| { | ||
| name: "autopilot enabled without release channel should cause an error", | ||
| expectError: true, | ||
| expectWarn: false, | ||
| spec: GCPManagedControlPlaneSpec{ | ||
| ClusterName: "", | ||
| EnableAutopilot: true, | ||
|
|
@@ -141,12 +144,32 @@ func TestGCPManagedControlPlaneValidatingWebhookCreate(t *testing.T) { | |
| { | ||
| name: "autopilot enabled with release channel", | ||
| expectError: false, | ||
| expectWarn: false, | ||
| spec: GCPManagedControlPlaneSpec{ | ||
| ClusterName: "", | ||
| EnableAutopilot: true, | ||
| ReleaseChannel: &releaseChannel, | ||
| }, | ||
| }, | ||
| { | ||
| name: "using deprecated ControlPlaneVersion should cause a warning", | ||
| expectError: false, | ||
| expectWarn: true, | ||
| spec: GCPManagedControlPlaneSpec{ | ||
| ClusterName: "", | ||
| ControlPlaneVersion: &vV1_27_1, | ||
| }, | ||
| }, | ||
| { | ||
| name: "using both ControlPlaneVersion and Version should cause a warning and an error", | ||
| expectError: true, | ||
| expectWarn: false, | ||
| spec: GCPManagedControlPlaneSpec{ | ||
| ClusterName: "", | ||
| ControlPlaneVersion: &vV1_27_1, | ||
| Version: &vV1_27_1, | ||
| }, | ||
| }, | ||
| } | ||
|
|
||
| for _, tc := range tests { | ||
|
|
@@ -163,8 +186,11 @@ func TestGCPManagedControlPlaneValidatingWebhookCreate(t *testing.T) { | |
| } else { | ||
| g.Expect(err).ToNot(HaveOccurred()) | ||
| } | ||
| // Nothing emits warnings yet | ||
| g.Expect(warn).To(BeEmpty()) | ||
| if tc.expectWarn { | ||
| g.Expect(warn).ToNot(BeEmpty()) | ||
| } else { | ||
| g.Expect(warn).To(BeEmpty()) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.