func GenerateUpgradeSettings(in *v1beta2.UpgradeSettings, pool *container.NodePool) {
	if in != nil {
		if pool.UpgradeSettings == nil {
			pool.UpgradeSettings = &container.UpgradeSettings{}
		}
		pool.UpgradeSettings.MaxSurge = gcp.Int64Value(in.MaxSurge)
		pool.UpgradeSettings.MaxUnavailable = gcp.Int64Value(in.MaxUnavailable)
	}
}
GenerateUpgradeSettings generates *container.UpgradeSettings from *UpgradeSettings.
package nodepool
import (
	"context"
	"fmt"
	"strings"
	"github.com/google/go-cmp/cmp"
	"github.com/google/go-cmp/cmp/cmpopts"
	"github.com/mitchellh/copystructure"
	container "google.golang.org/api/container/v1"
	"github.com/crossplane/crossplane-runtime/pkg/errors"
	"github.com/crossplane/provider-gcp/apis/container/v1beta1"
	"github.com/crossplane/provider-gcp/apis/container/v1beta2"
	gcp "github.com/crossplane/provider-gcp/pkg/clients"
)
const (
	NodePoolNameFormat = "%s/nodePools/%s"
	errCheckUpToDate = "unable to determine if external resource is up to date"
	runtimeKey = "sandbox.gke.io/runtime"
)
func GenerateNodePool(name string, in v1beta1.NodePoolParameters, pool *container.NodePool) {  
	pool.InitialNodeCount = gcp.Int64Value(in.InitialNodeCount)
	pool.Locations = in.Locations
	pool.Name = name
	if pool.Version == "" || !isAutoUpgradeEnabled(in) {
		pool.Version = gcp.StringValue(in.Version)
	}
	GenerateAutoscaling(in.Autoscaling, pool)
	GenerateConfig(in.Config, pool)
	GenerateManagement(in.Management, pool)
	GenerateMaxPodsConstraint(in.MaxPodsConstraint, pool)
	GenerateUpgradeSettings(in.UpgradeSettings, pool)
}
func isAutoUpgradeEnabled(in v1beta1.NodePoolParameters) bool {
	return in.Management != nil && gcp.BoolValue(in.Management.AutoUpgrade)
}
func GenerateAutoscaling(in *v1beta1.NodePoolAutoscaling, pool *container.NodePool) {
	if in != nil {
		if pool.Autoscaling == nil {
			pool.Autoscaling = &container.NodePoolAutoscaling{}
		}
		pool.Autoscaling.Autoprovisioned = gcp.BoolValue(in.Autoprovisioned)
		pool.Autoscaling.Enabled = gcp.BoolValue(in.Enabled)
		pool.Autoscaling.MaxNodeCount = gcp.Int64Value(in.MaxNodeCount)
		pool.Autoscaling.MinNodeCount = gcp.Int64Value(in.MinNodeCount)
	}
}
func GenerateConfig(in *v1beta1.NodeConfig, pool *container.NodePool) {  
	if in != nil {
		if pool.Config == nil {
			pool.Config = &container.NodeConfig{}
		}
		pool.Config.BootDiskKmsKey = gcp.StringValue(in.BootDiskKmsKey)
		pool.Config.DiskSizeGb = gcp.Int64Value(in.DiskSizeGb)
		pool.Config.DiskType = gcp.StringValue(in.DiskType)
		pool.Config.ImageType = strings.ToUpper(gcp.StringValue(in.ImageType))
		pool.Config.Labels = in.Labels
		pool.Config.LocalSsdCount = gcp.Int64Value(in.LocalSsdCount)
		pool.Config.MachineType = gcp.StringValue(in.MachineType)
		pool.Config.Metadata = in.Metadata
		pool.Config.MinCpuPlatform = gcp.StringValue(in.MinCPUPlatform)
		pool.Config.NodeGroup = gcp.StringValue(in.NodeGroup)
		pool.Config.OauthScopes = in.OauthScopes
		pool.Config.Preemptible = gcp.BoolValue(in.Preemptible)
		pool.Config.ServiceAccount = gcp.StringValue(in.ServiceAccount)
		pool.Config.Tags = in.Tags
		if len(in.Accelerators) > 0 {
			pool.Config.Accelerators = make([]*container.AcceleratorConfig, len(in.Accelerators))
		}
		for i, a := range in.Accelerators {
			if a != nil {
				pool.Config.Accelerators[i] = &container.AcceleratorConfig{
					AcceleratorCount: a.AcceleratorCount,
					AcceleratorType:  a.AcceleratorType,
				}
			}
		}
		if in.KubeletConfig != nil {
			if pool.Config.KubeletConfig == nil {
				pool.Config.KubeletConfig = &container.NodeKubeletConfig{}
			}
			pool.Config.KubeletConfig.CpuCfsQuota = gcp.BoolValue(in.KubeletConfig.CpuCfsQuota)
			pool.Config.KubeletConfig.CpuCfsQuotaPeriod = gcp.StringValue(in.KubeletConfig.CpuCfsQuotaPeriod)
			pool.Config.KubeletConfig.CpuManagerPolicy = gcp.StringValue(in.KubeletConfig.CpuManagerPolicy)
		}
		if in.LinuxNodeConfig != nil {
			if pool.Config.LinuxNodeConfig == nil {
				pool.Config.LinuxNodeConfig = &container.LinuxNodeConfig{}
			}
			pool.Config.LinuxNodeConfig.Sysctls = in.LinuxNodeConfig.Sysctls
		}
		if in.ReservationAffinity != nil {
			if pool.Config.ReservationAffinity == nil {
				pool.Config.ReservationAffinity = &container.ReservationAffinity{}
			}
			pool.Config.ReservationAffinity.ConsumeReservationType = gcp.StringValue(in.ReservationAffinity.ConsumeReservationType)
			pool.Config.ReservationAffinity.Key = gcp.StringValue(in.ReservationAffinity.Key)
			pool.Config.ReservationAffinity.Values = in.ReservationAffinity.Values
		}
		if in.SandboxConfig != nil {
			if pool.Config.SandboxConfig == nil {
				pool.Config.SandboxConfig = &container.SandboxConfig{}
			}
			pool.Config.SandboxConfig.Type = in.SandboxConfig.Type
		}
		if in.ShieldedInstanceConfig != nil {
			if pool.Config.ShieldedInstanceConfig == nil {
				pool.Config.ShieldedInstanceConfig = &container.ShieldedInstanceConfig{}
			}
			pool.Config.ShieldedInstanceConfig.EnableIntegrityMonitoring = gcp.BoolValue(in.ShieldedInstanceConfig.EnableIntegrityMonitoring)
			pool.Config.ShieldedInstanceConfig.EnableSecureBoot = gcp.BoolValue(in.ShieldedInstanceConfig.EnableSecureBoot)
		}
		if len(in.Taints) > 0 {
			pool.Config.Taints = make([]*container.NodeTaint, len(in.Taints))
		}
		for i, t := range in.Taints {
			if t != nil {
				pool.Config.Taints[i] = &container.NodeTaint{
					Effect: t.Effect,
					Key:    t.Key,
					Value:  t.Value,
				}
			}
		}
		if in.WorkloadMetadataConfig != nil {
			if pool.Config.WorkloadMetadataConfig == nil {
				pool.Config.WorkloadMetadataConfig = &container.WorkloadMetadataConfig{}
			}
			pool.Config.WorkloadMetadataConfig.Mode = in.WorkloadMetadataConfig.Mode
		}
	}
}
func GenerateManagement(in *v1beta1.NodeManagementSpec, pool *container.NodePool) {
	if in != nil {
		if pool.Management == nil {
			pool.Management = &container.NodeManagement{}
		}
		pool.Management.AutoRepair = gcp.BoolValue(in.AutoRepair)
		pool.Management.AutoUpgrade = gcp.BoolValue(in.AutoUpgrade)
	}
}
func GenerateMaxPodsConstraint(in *v1beta2.MaxPodsConstraint, pool *container.NodePool) {
	if in != nil {
		if pool.MaxPodsConstraint == nil {
			pool.MaxPodsConstraint = &container.MaxPodsConstraint{}
		}
		pool.MaxPodsConstraint.MaxPodsPerNode = in.MaxPodsPerNode
	}
}