@@ -158,29 +158,21 @@ func createCluster(cr *v1alpha1.GKECluster, log *logrus.Entry) (*v1alpha1.GKEClu
158158 args = append (args , cr .Spec .MachineType )
159159 }
160160
161- // if cr.Spec.EnableNetworkPolicy {
162- // args = append(args, "--enable-network-policy")
163- // }
164-
165- args = append (args , "--network=gke-dualstack-network" )
166- args = append (args , "--subnetwork=gke-dualstack-subnet" )
167- args = append (args , "--stack-type=ipv4-ipv6" )
168- args = append (args , "--enable-dataplane-v2" )
169-
170- // if cr.Spec.StackType == "ipv4-ipv6" {
171- // args = append(args, "--network=gke-dualstack-network")
172- // args = append(args, "--subnetwork=gke-dualstack-subnet")
173- // args = append(args, "--stack-type=ipv4-ipv6")
174- // args = append(args, "--enable-dataplane-v2")
175- // if cr.Spec.EnableNetworkPolicy {
176- // for i, v := range args {
177- // if v == "--enable-network-policy" {
178- // args = append(args[:i], args[i+1:]...)
179- // break
180- // }
181- // }
182- // }
183- // }
161+ if cr .Spec .StackType != "" {
162+ log .Infof ("use stack type: %s" , cr .Spec .StackType )
163+ if cr .Spec .StackType == "ipv4-ipv6" {
164+ args = append (args , "--network=gke-dualstack-network" )
165+ args = append (args , "--subnetwork=gke-dualstack-subnet" )
166+ args = append (args , "--stack-type=ipv4-ipv6" )
167+ args = append (args , "--enable-dataplane-v2" )
168+ log .Infof ("enable dualstack network" )
169+ }
170+ } else {
171+ if cr .Spec .EnableNetworkPolicy {
172+ args = append (args , "--enable-network-policy" )
173+ }
174+ args = append (args , "--create-subnetwork" , "" )
175+ }
184176
185177 if ! cr .Spec .DisableLegacyAuthorization {
186178 args = append (args , "--enable-legacy-authorization" )
@@ -228,7 +220,6 @@ func createCluster(cr *v1alpha1.GKECluster, log *logrus.Entry) (*v1alpha1.GKEClu
228220 }
229221
230222 args = append (args , "--enable-ip-alias" )
231- // args = append(args, "--create-subnetwork", "")
232223
233224 if cr .Spec .ClusterCidr == "" {
234225 cr .Spec .ClusterCidr = "/18"
0 commit comments