Skip to content

Commit

Permalink
Reconcile GCPManagedControlPlane new settings
Browse files Browse the repository at this point in the history
Signed-off-by: Akshay Gaikwad <[email protected]>
  • Loading branch information
akshay196-rafay committed Mar 27, 2024
1 parent e8fd997 commit fc5d3c3
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions cloud/services/container/clusters/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,9 @@ func (s *Service) createCluster(ctx context.Context, log *logr.Logger) error {
isRegional := shared.IsRegional(s.scope.Region())

cluster := &containerpb.Cluster{
Name: s.scope.ClusterName(),
Network: *s.scope.GCPManagedCluster.Spec.Network.Name,
Name: s.scope.ClusterName(),
Description: s.scope.GCPManagedControlPlane.Spec.Description,
Network: *s.scope.GCPManagedCluster.Spec.Network.Name,
Autopilot: &containerpb.Autopilot{
Enabled: s.scope.GCPManagedControlPlane.Spec.EnableAutopilot,
},
Expand All @@ -265,6 +266,25 @@ func (s *Service) createCluster(ctx context.Context, log *logr.Logger) error {
if s.scope.GCPManagedControlPlane.Spec.ControlPlaneVersion != nil {
cluster.InitialClusterVersion = convertToSdkMasterVersion(*s.scope.GCPManagedControlPlane.Spec.ControlPlaneVersion)
}
if s.scope.GCPManagedControlPlane.Spec.ClusterNetwork != nil {
cn := s.scope.GCPManagedControlPlane.Spec.ClusterNetwork
if cn.UseIPAliases {
cluster.IpAllocationPolicy = &containerpb.IPAllocationPolicy{}
cluster.IpAllocationPolicy.UseIpAliases = cn.UseIPAliases
}
if cn.PrivateCluster != nil {
cluster.PrivateClusterConfig = &containerpb.PrivateClusterConfig{}
cluster.PrivateClusterConfig.EnablePrivateEndpoint = cn.PrivateCluster.EnablePrivateEndpoint
cluster.PrivateClusterConfig.EnablePrivateNodes = cn.PrivateCluster.EnablePrivateNodes

cluster.PrivateClusterConfig.MasterIpv4CidrBlock = cn.PrivateCluster.ControlPlaneCidrBlock
cluster.PrivateClusterConfig.MasterGlobalAccessConfig = &containerpb.PrivateClusterMasterGlobalAccessConfig{
Enabled: cn.PrivateCluster.ControlPlaneGlobalAccess,
}

// TODO(Akshay): Set Default SNAT
}
}
if !s.scope.IsAutopilotCluster() {
cluster.NodePools = scope.ConvertToSdkNodePools(nodePools, machinePools, isRegional, cluster.Name)
}
Expand Down

0 comments on commit fc5d3c3

Please sign in to comment.