@@ -265,7 +265,11 @@ func (s *Service) createCluster(ctx context.Context, log *logr.Logger) error {
265265 ReleaseChannel : & containerpb.ReleaseChannel {
266266 Channel : convertToSdkReleaseChannel (s .scope .GCPManagedControlPlane .Spec .ReleaseChannel ),
267267 },
268- MasterAuthorizedNetworksConfig : convertToSdkMasterAuthorizedNetworksConfig (s .scope .GCPManagedControlPlane .Spec .MasterAuthorizedNetworksConfig ),
268+ ControlPlaneEndpointsConfig : & containerpb.ControlPlaneEndpointsConfig {
269+ IpEndpointsConfig : & containerpb.ControlPlaneEndpointsConfig_IPEndpointsConfig {
270+ AuthorizedNetworksConfig : convertToSdkMasterAuthorizedNetworksConfig (s .scope .GCPManagedControlPlane .Spec .MasterAuthorizedNetworksConfig ),
271+ },
272+ },
269273 }
270274 if s .scope .GCPManagedControlPlane .Spec .ControlPlaneVersion != nil {
271275 cluster .InitialClusterVersion = convertToSdkMasterVersion (* s .scope .GCPManagedControlPlane .Spec .ControlPlaneVersion )
@@ -278,18 +282,18 @@ func (s *Service) createCluster(ctx context.Context, log *logr.Logger) error {
278282 }
279283 if cn .PrivateCluster != nil {
280284 cluster .PrivateClusterConfig = & containerpb.PrivateClusterConfig {}
281- cluster .PrivateClusterConfig .EnablePrivateEndpoint = cn .PrivateCluster .EnablePrivateEndpoint
285+
286+ enablePublicEndpoint := ! cn .PrivateCluster .EnablePrivateEndpoint
287+ cluster .ControlPlaneEndpointsConfig .IpEndpointsConfig .EnablePublicEndpoint = & enablePublicEndpoint
282288 if cn .PrivateCluster .EnablePrivateEndpoint {
283- cluster .MasterAuthorizedNetworksConfig = & containerpb.MasterAuthorizedNetworksConfig {
289+ cluster .ControlPlaneEndpointsConfig . IpEndpointsConfig . AuthorizedNetworksConfig = & containerpb.MasterAuthorizedNetworksConfig {
284290 Enabled : true ,
285291 }
286292 }
287- cluster .PrivateClusterConfig . EnablePrivateNodes = cn .PrivateCluster .EnablePrivateNodes
293+ cluster .NetworkConfig . DefaultEnablePrivateNodes = & cn .PrivateCluster .EnablePrivateNodes
288294
289295 cluster .PrivateClusterConfig .MasterIpv4CidrBlock = cn .PrivateCluster .ControlPlaneCidrBlock
290- cluster .PrivateClusterConfig .MasterGlobalAccessConfig = & containerpb.PrivateClusterMasterGlobalAccessConfig {
291- Enabled : cn .PrivateCluster .ControlPlaneGlobalAccess ,
292- }
296+ cluster .ControlPlaneEndpointsConfig .IpEndpointsConfig .GlobalAccess = & cn .PrivateCluster .ControlPlaneGlobalAccess
293297
294298 cluster .NetworkConfig = & containerpb.NetworkConfig {
295299 DefaultSnatStatus : & containerpb.DefaultSnatStatus {
@@ -457,12 +461,12 @@ func (s *Service) checkDiffAndPrepareUpdate(existingCluster *containerpb.Cluster
457461 // DesiredMasterAuthorizedNetworksConfig
458462 // When desiredMasterAuthorizedNetworksConfig is nil, it means that the user wants to disable the feature.
459463 desiredMasterAuthorizedNetworksConfig := convertToSdkMasterAuthorizedNetworksConfig (s .scope .GCPManagedControlPlane .Spec .MasterAuthorizedNetworksConfig )
460- if ! compareMasterAuthorizedNetworksConfig (desiredMasterAuthorizedNetworksConfig , existingCluster .GetMasterAuthorizedNetworksConfig ()) {
464+ if ! compareMasterAuthorizedNetworksConfig (desiredMasterAuthorizedNetworksConfig , existingCluster .GetControlPlaneEndpointsConfig (). GetIpEndpointsConfig (). GetAuthorizedNetworksConfig ()) {
461465 needUpdate = true
462- clusterUpdate .DesiredMasterAuthorizedNetworksConfig = desiredMasterAuthorizedNetworksConfig
463- log .V (2 ).Info ("Master authorized networks config update required" , "current" , existingCluster .GetMasterAuthorizedNetworksConfig (), "desired" , desiredMasterAuthorizedNetworksConfig )
466+ clusterUpdate .DesiredControlPlaneEndpointsConfig . IpEndpointsConfig . AuthorizedNetworksConfig = desiredMasterAuthorizedNetworksConfig
467+ log .V (2 ).Info ("Master authorized networks config update required" , "current" , existingCluster .GetControlPlaneEndpointsConfig (). GetIpEndpointsConfig (). GetAuthorizedNetworksConfig (), "desired" , desiredMasterAuthorizedNetworksConfig )
464468 }
465- log .V (4 ).Info ("Master authorized networks config update check" , "current" , existingCluster .GetMasterAuthorizedNetworksConfig ())
469+ log .V (4 ).Info ("Master authorized networks config update check" , "current" , existingCluster .GetControlPlaneEndpointsConfig (). GetIpEndpointsConfig (). GetAuthorizedNetworksConfig ())
466470 if desiredMasterAuthorizedNetworksConfig != nil {
467471 log .V (4 ).Info ("Master authorized networks config update check" , "desired" , desiredMasterAuthorizedNetworksConfig )
468472 }
0 commit comments