func GenerateDefaultMaxPodsConstraint(in *v1beta2.MaxPodsConstraint, cluster *container.Cluster) {
	if in != nil {
		if cluster.DefaultMaxPodsConstraint == nil {
			cluster.DefaultMaxPodsConstraint = &container.MaxPodsConstraint{}
		}
		cluster.DefaultMaxPodsConstraint.MaxPodsPerNode = in.MaxPodsPerNode
	}
}
GenerateDefaultMaxPodsConstraint generates *container.MaxPodsConstraint from *DefaultMaxPodsConstraint.
package cluster
import (
	"context"
	"encoding/base64"
	"fmt"
	"github.com/google/go-cmp/cmp"
	"github.com/google/go-cmp/cmp/cmpopts"
	"github.com/mitchellh/copystructure"
	container "google.golang.org/api/container/v1"
	clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
	"github.com/crossplane/crossplane-runtime/pkg/errors"
	"github.com/crossplane/provider-gcp/apis/container/v1beta2"
	gcp "github.com/crossplane/provider-gcp/pkg/clients"
)
const (
	BootstrapNodePoolName = "crossplane-bootstrap"
	BNPNameFormat = "%s/nodePools/%s"
	ParentFormat = "projects/%s/locations/%s"
	ClusterNameFormat = "projects/%s/locations/%s/clusters/%s"
)
const (
	errNoSecretInfo  = "missing secret information for GKE cluster"
	errCheckUpToDate = "unable to determine if external resource is up to date"
)
func AddNodePoolForCreate(in *container.Cluster) {
	pool := &container.NodePool{
		Name:             BootstrapNodePoolName,
		InitialNodeCount: 0,
	}
	in.NodePools = []*container.NodePool{pool}
}
func GenerateCluster(name string, in v1beta2.ClusterParameters, cluster *container.Cluster) {  
	cluster.ClusterIpv4Cidr = gcp.StringValue(in.ClusterIpv4Cidr)
	cluster.Description = gcp.StringValue(in.Description)
	cluster.EnableKubernetesAlpha = gcp.BoolValue(in.EnableKubernetesAlpha)
	cluster.EnableTpu = gcp.BoolValue(in.EnableTpu)
	cluster.InitialClusterVersion = gcp.StringValue(in.InitialClusterVersion)
	cluster.LabelFingerprint = gcp.StringValue(in.LabelFingerprint)
	cluster.Locations = in.Locations
	cluster.LoggingService = gcp.StringValue(in.LoggingService)
	cluster.MonitoringService = gcp.StringValue(in.MonitoringService)
	cluster.Name = name
	cluster.Network = gcp.StringValue(in.Network)
	cluster.ResourceLabels = in.ResourceLabels
	cluster.Subnetwork = gcp.StringValue(in.Subnetwork)
	GenerateAddonsConfig(in.AddonsConfig, cluster)
	GenerateAutopilot(in.Autopilot, cluster)
	GenerateAuthenticatorGroupsConfig(in.AuthenticatorGroupsConfig, cluster)
	GenerateAutoscaling(in.Autoscaling, cluster)
	GenerateConfidentialNodes(in.ConfidentialNodes, cluster)
	GenerateBinaryAuthorization(in.BinaryAuthorization, cluster)
	GenerateDatabaseEncryption(in.DatabaseEncryption, cluster)
	GenerateDefaultMaxPodsConstraint(in.DefaultMaxPodsConstraint, cluster)
	GenerateIPAllocationPolicy(in.IPAllocationPolicy, cluster)
	GenerateLegacyAbac(in.LegacyAbac, cluster)
	GenerateMaintenancePolicy(in.MaintenancePolicy, cluster)
	GenerateMasterAuth(in.MasterAuth, cluster)
	GenerateMasterAuthorizedNetworksConfig(in.MasterAuthorizedNetworksConfig, cluster)
	GenerateNetworkConfig(in.NetworkConfig, cluster)
	GenerateNetworkPolicy(in.NetworkPolicy, cluster)
	GenerateNotificationConfig(in.NotificationConfig, cluster)
	GeneratePrivateClusterConfig(in.PrivateClusterConfig, cluster)
	GenerateReleaseChannel(in.ReleaseChannel, cluster)
	GenerateResourceUsageExportConfig(in.ResourceUsageExportConfig, cluster)
	GenerateVerticalPodAutoscaling(in.VerticalPodAutoscaling, cluster)
	GenerateWorkloadIdentityConfig(in.WorkloadIdentityConfig, cluster)
}
func GenerateAddonsConfig(in *v1beta2.AddonsConfig, cluster *container.Cluster) {  
	if in != nil {
		if cluster.AddonsConfig == nil {
			cluster.AddonsConfig = &container.AddonsConfig{}
		}
		if in.CloudRunConfig != nil {
			if cluster.AddonsConfig.CloudRunConfig == nil {
				cluster.AddonsConfig.CloudRunConfig = &container.CloudRunConfig{}
			}
			cluster.AddonsConfig.CloudRunConfig.Disabled = in.CloudRunConfig.Disabled
			cluster.AddonsConfig.CloudRunConfig.LoadBalancerType = gcp.StringValue(in.CloudRunConfig.LoadBalancerType)
			cluster.AddonsConfig.CloudRunConfig.ForceSendFields = []string{"Disabled", "LoadBalancerType"}
		}
		if in.ConfigConnectorConfig != nil {
			if cluster.AddonsConfig.ConfigConnectorConfig == nil {
				cluster.AddonsConfig.ConfigConnectorConfig = &container.ConfigConnectorConfig{}
			}
			cluster.AddonsConfig.ConfigConnectorConfig.Enabled = in.ConfigConnectorConfig.Enabled
			cluster.AddonsConfig.ConfigConnectorConfig.ForceSendFields = []string{"Enabled"}
		}
		if in.DNSCacheConfig != nil {
			if cluster.AddonsConfig.DnsCacheConfig == nil {
				cluster.AddonsConfig.DnsCacheConfig = &container.DnsCacheConfig{}
			}
			cluster.AddonsConfig.DnsCacheConfig.Enabled = in.DNSCacheConfig.Enabled
			cluster.AddonsConfig.DnsCacheConfig.ForceSendFields = []string{"Enabled"}
		}
		if in.GCEPersistentDiskCSIDriverConfig != nil {
			if cluster.AddonsConfig.GcePersistentDiskCsiDriverConfig == nil {
				cluster.AddonsConfig.GcePersistentDiskCsiDriverConfig = &container.GcePersistentDiskCsiDriverConfig{}
			}
			cluster.AddonsConfig.GcePersistentDiskCsiDriverConfig.Enabled = in.GCEPersistentDiskCSIDriverConfig.Enabled
			cluster.AddonsConfig.GcePersistentDiskCsiDriverConfig.ForceSendFields = []string{"Enabled"}
		}
		if in.HorizontalPodAutoscaling != nil {
			if cluster.AddonsConfig.HorizontalPodAutoscaling == nil {
				cluster.AddonsConfig.HorizontalPodAutoscaling = &container.HorizontalPodAutoscaling{}
			}
			cluster.AddonsConfig.HorizontalPodAutoscaling.Disabled = in.HorizontalPodAutoscaling.Disabled
			cluster.AddonsConfig.HorizontalPodAutoscaling.ForceSendFields = []string{"Disabled"}
		}
		if in.HTTPLoadBalancing != nil {
			if cluster.AddonsConfig.HttpLoadBalancing == nil {
				cluster.AddonsConfig.HttpLoadBalancing = &container.HttpLoadBalancing{}
			}
			cluster.AddonsConfig.HttpLoadBalancing.Disabled = in.HTTPLoadBalancing.Disabled
			cluster.AddonsConfig.HttpLoadBalancing.ForceSendFields = []string{"Disabled"}
		}
		if in.KubernetesDashboard != nil {
			if cluster.AddonsConfig.KubernetesDashboard == nil {
				cluster.AddonsConfig.KubernetesDashboard = &container.KubernetesDashboard{}
			}
			cluster.AddonsConfig.KubernetesDashboard.Disabled = in.KubernetesDashboard.Disabled
			cluster.AddonsConfig.KubernetesDashboard.ForceSendFields = []string{"Disabled"}
		}
		if in.NetworkPolicyConfig != nil {
			if cluster.AddonsConfig.NetworkPolicyConfig == nil {
				cluster.AddonsConfig.NetworkPolicyConfig = &container.NetworkPolicyConfig{}
			}
			cluster.AddonsConfig.NetworkPolicyConfig.Disabled = in.NetworkPolicyConfig.Disabled
			cluster.AddonsConfig.NetworkPolicyConfig.ForceSendFields = []string{"Disabled"}
		}
	}
}
func GenerateAutopilot(in *v1beta2.Autopilot, cluster *container.Cluster) {
	if in != nil {
		if cluster.Autopilot == nil {
			cluster.Autopilot = &container.Autopilot{}
		}
		cluster.Autopilot.Enabled = in.Enabled
	}
}
func GenerateAuthenticatorGroupsConfig(in *v1beta2.AuthenticatorGroupsConfig, cluster *container.Cluster) {
	if in != nil {
		if cluster.AuthenticatorGroupsConfig == nil {
			cluster.AuthenticatorGroupsConfig = &container.AuthenticatorGroupsConfig{}
		}
		cluster.AuthenticatorGroupsConfig.Enabled = gcp.BoolValue(in.Enabled)
		cluster.AuthenticatorGroupsConfig.SecurityGroup = gcp.StringValue(in.SecurityGroup)
	}
}
func GenerateAutoscaling(in *v1beta2.ClusterAutoscaling, cluster *container.Cluster) {  
	if in != nil {
		if cluster.Autoscaling == nil {
			cluster.Autoscaling = &container.ClusterAutoscaling{}
		}
		cluster.Autoscaling.AutoprovisioningLocations = in.AutoprovisioningLocations
		cluster.Autoscaling.EnableNodeAutoprovisioning = gcp.BoolValue(in.EnableNodeAutoprovisioning)
		if in.AutoprovisioningNodePoolDefaults != nil {
			if cluster.Autoscaling.AutoprovisioningNodePoolDefaults == nil {
				cluster.Autoscaling.AutoprovisioningNodePoolDefaults = &container.AutoprovisioningNodePoolDefaults{}
			}
			cluster.Autoscaling.AutoprovisioningNodePoolDefaults.BootDiskKmsKey = gcp.StringValue(in.AutoprovisioningNodePoolDefaults.BootDiskKMSKey)
			cluster.Autoscaling.AutoprovisioningNodePoolDefaults.DiskSizeGb = gcp.Int64Value(in.AutoprovisioningNodePoolDefaults.DiskSizeGb)
			cluster.Autoscaling.AutoprovisioningNodePoolDefaults.MinCpuPlatform = gcp.StringValue(in.AutoprovisioningNodePoolDefaults.MinCPUPlatform)
			cluster.Autoscaling.AutoprovisioningNodePoolDefaults.OauthScopes = in.AutoprovisioningNodePoolDefaults.OauthScopes
			cluster.Autoscaling.AutoprovisioningNodePoolDefaults.ServiceAccount = gcp.StringValue(in.AutoprovisioningNodePoolDefaults.ServiceAccount)
			if in.AutoprovisioningNodePoolDefaults.Management != nil {
				if cluster.Autoscaling.AutoprovisioningNodePoolDefaults.Management == nil {
					cluster.Autoscaling.AutoprovisioningNodePoolDefaults.Management = &container.NodeManagement{}
				}
				cluster.Autoscaling.AutoprovisioningNodePoolDefaults.Management.AutoRepair = gcp.BoolValue(in.AutoprovisioningNodePoolDefaults.Management.AutoRepair)
				cluster.Autoscaling.AutoprovisioningNodePoolDefaults.Management.AutoUpgrade = gcp.BoolValue(in.AutoprovisioningNodePoolDefaults.Management.AutoUpgrade)
			}
			if in.AutoprovisioningNodePoolDefaults.ShieldedInstanceConfig != nil {
				if cluster.Autoscaling.AutoprovisioningNodePoolDefaults.ShieldedInstanceConfig == nil {
					cluster.Autoscaling.AutoprovisioningNodePoolDefaults.ShieldedInstanceConfig = &container.ShieldedInstanceConfig{}
				}
				cluster.Autoscaling.AutoprovisioningNodePoolDefaults.ShieldedInstanceConfig.EnableIntegrityMonitoring = gcp.BoolValue(in.AutoprovisioningNodePoolDefaults.ShieldedInstanceConfig.EnableIntegrityMonitoring)
				cluster.Autoscaling.AutoprovisioningNodePoolDefaults.ShieldedInstanceConfig.EnableSecureBoot = gcp.BoolValue(in.AutoprovisioningNodePoolDefaults.ShieldedInstanceConfig.EnableSecureBoot)
			}
			if in.AutoprovisioningNodePoolDefaults.UpgradeSettings != nil {
				if cluster.Autoscaling.AutoprovisioningNodePoolDefaults.UpgradeSettings == nil {
					cluster.Autoscaling.AutoprovisioningNodePoolDefaults.UpgradeSettings = &container.UpgradeSettings{}
				}
				cluster.Autoscaling.AutoprovisioningNodePoolDefaults.UpgradeSettings.MaxSurge = gcp.Int64Value(in.AutoprovisioningNodePoolDefaults.UpgradeSettings.MaxSurge)
				cluster.Autoscaling.AutoprovisioningNodePoolDefaults.UpgradeSettings.MaxUnavailable = gcp.Int64Value(in.AutoprovisioningNodePoolDefaults.UpgradeSettings.MaxUnavailable)
			}
		}
		if len(in.ResourceLimits) > 0 {
			cluster.Autoscaling.ResourceLimits = make([]*container.ResourceLimit, len(in.ResourceLimits))
		}
		for i, limit := range in.ResourceLimits {
			if limit != nil {
				cluster.Autoscaling.ResourceLimits[i] = &container.ResourceLimit{
					Maximum:      gcp.Int64Value(limit.Maximum),
					Minimum:      gcp.Int64Value(limit.Minimum),
					ResourceType: gcp.StringValue(limit.ResourceType),
				}
			}
		}
	}
}
func GenerateBinaryAuthorization(in *v1beta2.BinaryAuthorization, cluster *container.Cluster) {
	if in != nil {
		if cluster.BinaryAuthorization == nil {
			cluster.BinaryAuthorization = &container.BinaryAuthorization{}
		}
		cluster.BinaryAuthorization.Enabled = in.Enabled
	}
}
func GenerateConfidentialNodes(in *v1beta2.ConfidentialNodes, cluster *container.Cluster) {
	if in != nil {
		if cluster.ConfidentialNodes == nil {
			cluster.ConfidentialNodes = &container.ConfidentialNodes{}
		}
		cluster.ConfidentialNodes.Enabled = in.Enabled
	}
}
func GenerateDatabaseEncryption(in *v1beta2.DatabaseEncryption, cluster *container.Cluster) {
	if in != nil {
		if cluster.DatabaseEncryption == nil {
			cluster.DatabaseEncryption = &container.DatabaseEncryption{}
		}
		cluster.DatabaseEncryption.KeyName = gcp.StringValue(in.KeyName)
		cluster.DatabaseEncryption.State = gcp.StringValue(in.State)
	}
}