@@ -55,18 +55,18 @@ func TestDefaultingWebhook(t *testing.T) {
55
55
},
56
56
},
57
57
},
58
- ResourceGroupName : "fooRg" ,
59
- SSHPublicKey : ptr .To ("" ),
58
+ SSHPublicKey : ptr .To ("" ),
60
59
},
61
60
}
62
61
mcpw := & azureManagedControlPlaneWebhook {}
63
62
err := mcpw .Default (context .Background (), amcp )
64
63
g .Expect (err ).NotTo (HaveOccurred ())
64
+ g .Expect (amcp .Spec .ResourceGroupName ).To (Equal ("fooCluster" ))
65
65
g .Expect (amcp .Spec .NetworkPlugin ).To (Equal (ptr .To (AzureNetworkPluginName )))
66
66
g .Expect (amcp .Spec .LoadBalancerSKU ).To (Equal (ptr .To ("Standard" )))
67
67
g .Expect (amcp .Spec .Version ).To (Equal ("v1.17.5" ))
68
68
g .Expect (* amcp .Spec .SSHPublicKey ).NotTo (BeEmpty ())
69
- g .Expect (amcp .Spec .NodeResourceGroupName ).To (Equal ("MC_fooRg_fooName_fooLocation " ))
69
+ g .Expect (amcp .Spec .NodeResourceGroupName ).To (Equal ("MC_fooCluster_fooName_fooLocation " ))
70
70
g .Expect (amcp .Spec .VirtualNetwork .Name ).To (Equal ("fooName" ))
71
71
g .Expect (amcp .Spec .VirtualNetwork .CIDRBlock ).To (Equal (defaultAKSVnetCIDR ))
72
72
g .Expect (amcp .Spec .VirtualNetwork .Subnet .Name ).To (Equal ("fooName" ))
@@ -87,6 +87,7 @@ func TestDefaultingWebhook(t *testing.T) {
87
87
amcp .Spec .NetworkPolicy = & netPol
88
88
amcp .Spec .Version = "9.99.99"
89
89
amcp .Spec .SSHPublicKey = nil
90
+ amcp .Spec .ResourceGroupName = "fooRg"
90
91
amcp .Spec .NodeResourceGroupName = "fooNodeRg"
91
92
amcp .Spec .VirtualNetwork .Name = "fooVnetName"
92
93
amcp .Spec .VirtualNetwork .Subnet .Name = "fooSubnetName"
@@ -116,6 +117,7 @@ func TestDefaultingWebhook(t *testing.T) {
116
117
g .Expect (* amcp .Spec .NetworkPolicy ).To (Equal (netPol ))
117
118
g .Expect (amcp .Spec .Version ).To (Equal ("v9.99.99" ))
118
119
g .Expect (amcp .Spec .SSHPublicKey ).To (BeNil ())
120
+ g .Expect (amcp .Spec .ResourceGroupName ).To (Equal ("fooRg" ))
119
121
g .Expect (amcp .Spec .NodeResourceGroupName ).To (Equal ("fooNodeRg" ))
120
122
g .Expect (amcp .Spec .VirtualNetwork .Name ).To (Equal ("fooVnetName" ))
121
123
g .Expect (amcp .Spec .VirtualNetwork .Subnet .Name ).To (Equal ("fooSubnetName" ))
@@ -142,6 +144,7 @@ func TestDefaultingWebhook(t *testing.T) {
142
144
},
143
145
Spec : AzureManagedControlPlaneSpec {
144
146
AzureManagedControlPlaneClassSpec : AzureManagedControlPlaneClassSpec {
147
+ ResourceGroupName : "fooRg" ,
145
148
Location : "fooLocation" ,
146
149
Version : "1.17.5" ,
147
150
NetworkPluginMode : ptr .To (NetworkPluginModeOverlay ),
@@ -160,8 +163,7 @@ func TestDefaultingWebhook(t *testing.T) {
160
163
},
161
164
},
162
165
},
163
- ResourceGroupName : "fooRg" ,
164
- SSHPublicKey : ptr .To ("" ),
166
+ SSHPublicKey : ptr .To ("" ),
165
167
},
166
168
}
167
169
err = mcpw .Default (context .Background (), amcp )
@@ -1991,19 +1993,19 @@ func TestAzureManagedControlPlane_ValidateUpdate(t *testing.T) {
1991
1993
oldAMCP : & AzureManagedControlPlane {
1992
1994
Spec : AzureManagedControlPlaneSpec {
1993
1995
AzureManagedControlPlaneClassSpec : AzureManagedControlPlaneClassSpec {
1994
- DNSServiceIP : ptr .To ("192.168.0.10" ),
1995
- Version : "v1.18.0" ,
1996
+ DNSServiceIP : ptr .To ("192.168.0.10" ),
1997
+ Version : "v1.18.0" ,
1998
+ ResourceGroupName : "hello-1" ,
1996
1999
},
1997
- ResourceGroupName : "hello-1" ,
1998
2000
},
1999
2001
},
2000
2002
amcp : & AzureManagedControlPlane {
2001
2003
Spec : AzureManagedControlPlaneSpec {
2002
2004
AzureManagedControlPlaneClassSpec : AzureManagedControlPlaneClassSpec {
2003
- DNSServiceIP : ptr .To ("192.168.0.10" ),
2004
- Version : "v1.18.0" ,
2005
+ DNSServiceIP : ptr .To ("192.168.0.10" ),
2006
+ Version : "v1.18.0" ,
2007
+ ResourceGroupName : "hello-2" ,
2005
2008
},
2006
- ResourceGroupName : "hello-2" ,
2007
2009
},
2008
2010
},
2009
2011
wantErr : true ,
@@ -4054,8 +4056,8 @@ func TestValidateAMCPVirtualNetwork(t *testing.T) {
4054
4056
},
4055
4057
},
4056
4058
Spec : AzureManagedControlPlaneSpec {
4057
- ResourceGroupName : "rg1" ,
4058
4059
AzureManagedControlPlaneClassSpec : AzureManagedControlPlaneClassSpec {
4060
+ ResourceGroupName : "rg1" ,
4059
4061
VirtualNetwork : ManagedControlPlaneVirtualNetwork {
4060
4062
ResourceGroup : "rg1" ,
4061
4063
Name : "vnet1" ,
@@ -4082,8 +4084,8 @@ func TestValidateAMCPVirtualNetwork(t *testing.T) {
4082
4084
},
4083
4085
},
4084
4086
Spec : AzureManagedControlPlaneSpec {
4085
- ResourceGroupName : "rg1" ,
4086
4087
AzureManagedControlPlaneClassSpec : AzureManagedControlPlaneClassSpec {
4088
+ ResourceGroupName : "rg1" ,
4087
4089
VirtualNetwork : ManagedControlPlaneVirtualNetwork {
4088
4090
ResourceGroup : "rg2" ,
4089
4091
Name : "vnet1" ,
@@ -4110,8 +4112,8 @@ func TestValidateAMCPVirtualNetwork(t *testing.T) {
4110
4112
},
4111
4113
},
4112
4114
Spec : AzureManagedControlPlaneSpec {
4113
- ResourceGroupName : "rg1" ,
4114
4115
AzureManagedControlPlaneClassSpec : AzureManagedControlPlaneClassSpec {
4116
+ ResourceGroupName : "rg1" ,
4115
4117
VirtualNetwork : ManagedControlPlaneVirtualNetwork {
4116
4118
ResourceGroup : "rg2" ,
4117
4119
Name : "vnet1" ,
@@ -4138,8 +4140,8 @@ func TestValidateAMCPVirtualNetwork(t *testing.T) {
4138
4140
},
4139
4141
},
4140
4142
Spec : AzureManagedControlPlaneSpec {
4141
- ResourceGroupName : "rg1" ,
4142
4143
AzureManagedControlPlaneClassSpec : AzureManagedControlPlaneClassSpec {
4144
+ ResourceGroupName : "rg1" ,
4143
4145
VirtualNetwork : ManagedControlPlaneVirtualNetwork {
4144
4146
ResourceGroup : "rg2" ,
4145
4147
Name : "vnet1" ,
@@ -4165,8 +4167,8 @@ func TestValidateAMCPVirtualNetwork(t *testing.T) {
4165
4167
},
4166
4168
},
4167
4169
Spec : AzureManagedControlPlaneSpec {
4168
- ResourceGroupName : "rg1" ,
4169
4170
AzureManagedControlPlaneClassSpec : AzureManagedControlPlaneClassSpec {
4171
+ ResourceGroupName : "rg1" ,
4170
4172
VirtualNetwork : ManagedControlPlaneVirtualNetwork {
4171
4173
ResourceGroup : "rg2" ,
4172
4174
Name : "vnet1" ,
@@ -4192,8 +4194,8 @@ func TestValidateAMCPVirtualNetwork(t *testing.T) {
4192
4194
},
4193
4195
},
4194
4196
Spec : AzureManagedControlPlaneSpec {
4195
- ResourceGroupName : "rg1" ,
4196
4197
AzureManagedControlPlaneClassSpec : AzureManagedControlPlaneClassSpec {
4198
+ ResourceGroupName : "rg1" ,
4197
4199
VirtualNetwork : ManagedControlPlaneVirtualNetwork {
4198
4200
ResourceGroup : "rg2" ,
4199
4201
Name : "vnet1" ,
@@ -4220,8 +4222,8 @@ func TestValidateAMCPVirtualNetwork(t *testing.T) {
4220
4222
},
4221
4223
},
4222
4224
Spec : AzureManagedControlPlaneSpec {
4223
- ResourceGroupName : "rg1" ,
4224
4225
AzureManagedControlPlaneClassSpec : AzureManagedControlPlaneClassSpec {
4226
+ ResourceGroupName : "rg1" ,
4225
4227
VirtualNetwork : ManagedControlPlaneVirtualNetwork {
4226
4228
ResourceGroup : "rg2" ,
4227
4229
Name : "vnet1" ,
0 commit comments