// Convert_config_ClientConnectionOverrides_To_v1_ClientConnectionOverrides is an autogenerated conversion function.
493963
func Convert_config_ClientConnectionOverrides_To_v1_ClientConnectionOverrides(in *config.ClientConnectionOverrides, out *v1.ClientConnectionOverrides, s conversion.Scope) error {
	return autoConvert_config_ClientConnectionOverrides_To_v1_ClientConnectionOverrides(in, out, s)
}
1252873
func Convert_v1alpha1_WebhookClientConfig_To_auditregistration_WebhookClientConfig(in *v1alpha1.WebhookClientConfig, out *auditregistration.WebhookClientConfig, s conversion.Scope) error {
	return autoConvert_v1alpha1_WebhookClientConfig_To_auditregistration_WebhookClientConfig(in, out, s)
}
988693
func ValidateClientConnectionConfiguration(cc *config.ClientConnectionConfiguration, fldPath *field.Path) field.ErrorList {
	allErrs := field.ErrorList{}
	if cc.Burst < 0 {
		allErrs = append(allErrs, field.Invalid(fldPath.Child("burst"), cc.Burst, "must be non-negative"))
	}
	return allErrs
}
232258
func SetDefaults_ClientConnectionOverrides(overrides *legacyconfigv1.ClientConnectionOverrides) {
	if len(overrides.AcceptContentTypes) == 0 {
		overrides.AcceptContentTypes = "application/json"
	}
	if len(overrides.ContentType) == 0 {
		overrides.ContentType = "application/json"
	}
}
370978
func Convert_route_TLSConfig_To_v1_TLSConfig(in *route.TLSConfig, out *v1.TLSConfig, s conversion.Scope) error {
	return autoConvert_route_TLSConfig_To_v1_TLSConfig(in, out, s)
}
285002
func Convert_v1_DNSConfig_To_config_DNSConfig(in *v1.DNSConfig, out *config.DNSConfig, s conversion.Scope) error {
	return autoConvert_v1_DNSConfig_To_config_DNSConfig(in, out, s)
}
82113
func Convert_config_ClusterNetworkEntry_To_v1_ClusterNetworkEntry(in *config.ClusterNetworkEntry, out *v1.ClusterNetworkEntry, s conversion.Scope) error {
	return autoConvert_config_ClusterNetworkEntry_To_v1_ClusterNetworkEntry(in, out, s)
}
919397
func Convert_build_ProxyConfig_To_v1_ProxyConfig(in *build.ProxyConfig, out *v1.ProxyConfig, s conversion.Scope) error {
	return autoConvert_build_ProxyConfig_To_v1_ProxyConfig(in, out, s)
}
1052157
func Convert_config_MasterAuthConfig_To_v1_MasterAuthConfig(in *config.MasterAuthConfig, out *v1.MasterAuthConfig, s conversion.Scope) error {
	return autoConvert_config_MasterAuthConfig_To_v1_MasterAuthConfig(in, out, s)
}
1228607
func Convert_v1_ServiceProxyOptions_To_core_ServiceProxyOptions(in *v1.ServiceProxyOptions, out *core.ServiceProxyOptions, s conversion.Scope) error {
	return autoConvert_v1_ServiceProxyOptions_To_core_ServiceProxyOptions(in, out, s)
}
517886
func Convert_config_SourceStrategyDefaultsConfig_To_v1_SourceStrategyDefaultsConfig(in *config.SourceStrategyDefaultsConfig, out *v1.SourceStrategyDefaultsConfig, s conversion.Scope) error {
	return autoConvert_config_SourceStrategyDefaultsConfig_To_v1_SourceStrategyDefaultsConfig(in, out, s)
}
27019
func Convert_config_ImageConfig_To_v1_ImageConfig(in *config.ImageConfig, out *v1.ImageConfig, s conversion.Scope) error {
	return autoConvert_config_ImageConfig_To_v1_ImageConfig(in, out, s)
}
1166738
func Convert_config_Key_To_v1_Key(in *config.Key, out *Key, s conversion.Scope) error {
	return autoConvert_config_Key_To_v1_Key(in, out, s)
}
955065
func Convert_config_LDAPSyncConfig_To_v1_LDAPSyncConfig(in *config.LDAPSyncConfig, out *v1.LDAPSyncConfig, s conversion.Scope) error {
	return autoConvert_config_LDAPSyncConfig_To_v1_LDAPSyncConfig(in, out, s)
}
71644
func Convert_config_KubeProxyConfiguration_To_v1alpha1_KubeProxyConfiguration(in *config.KubeProxyConfiguration, out *v1alpha1.KubeProxyConfiguration, s conversion.Scope) error {
	return autoConvert_config_KubeProxyConfiguration_To_v1alpha1_KubeProxyConfiguration(in, out, s)
}
55243
func Convert_v1_SourceStrategyDefaultsConfig_To_config_SourceStrategyDefaultsConfig(in *v1.SourceStrategyDefaultsConfig, out *config.SourceStrategyDefaultsConfig, s conversion.Scope) error {
	return autoConvert_v1_SourceStrategyDefaultsConfig_To_config_SourceStrategyDefaultsConfig(in, out, s)
}
1105255
func convertClientConfig(agentConfig *Config) (*clientconfig.Config, error) {
	// Setup the configuration
	conf := agentConfig.ClientConfig
	if conf == nil {
		conf = clientconfig.DefaultConfig()
	}

	conf.Servers = agentConfig.Client.Servers
	conf.LogLevel = agentConfig.LogLevel
	conf.DevMode = agentConfig.DevMode
	if agentConfig.Region != "" {
		conf.Region = agentConfig.Region
	}
	if agentConfig.DataDir != "" {
		conf.StateDir = filepath.Join(agentConfig.DataDir, "client")
		conf.AllocDir = filepath.Join(agentConfig.DataDir, "alloc")
	}
	if agentConfig.Client.StateDir != "" {
		conf.StateDir = agentConfig.Client.StateDir
	}
	if agentConfig.Client.AllocDir != "" {
		conf.AllocDir = agentConfig.Client.AllocDir
	}
	if agentConfig.Client.NetworkInterface != "" {
		conf.NetworkInterface = agentConfig.Client.NetworkInterface
	}
	conf.ChrootEnv = agentConfig.Client.ChrootEnv
	conf.Options = agentConfig.Client.Options
	if agentConfig.Client.NetworkSpeed != 0 {
		conf.NetworkSpeed = agentConfig.Client.NetworkSpeed
	}
	if agentConfig.Client.CpuCompute != 0 {
		conf.CpuCompute = agentConfig.Client.CpuCompute
	}
	if agentConfig.Client.MemoryMB != 0 {
		conf.MemoryMB = agentConfig.Client.MemoryMB
	}
	if agentConfig.Client.MaxKillTimeout != "" {
		dur, err := time.ParseDuration(agentConfig.Client.MaxKillTimeout)
		if err != nil {
			return nil, fmt.Errorf("Error parsing max kill timeout: %s", err)
		}
		conf.MaxKillTimeout = dur
	}
	conf.ClientMaxPort = uint(agentConfig.Client.ClientMaxPort)
	conf.ClientMinPort = uint(agentConfig.Client.ClientMinPort)

	// Setup the node
	conf.Node = new(structs.Node)
	conf.Node.Datacenter = agentConfig.Datacenter
	conf.Node.Name = agentConfig.NodeName
	conf.Node.Meta = agentConfig.Client.Meta
	conf.Node.NodeClass = agentConfig.Client.NodeClass

	// Set up the HTTP advertise address
	conf.Node.HTTPAddr = agentConfig.AdvertiseAddrs.HTTP

	// Reserve resources on the node.
	// COMPAT(0.10): Remove in 0.10
	r := conf.Node.Reserved
	if r == nil {
		r = new(structs.Resources)
		conf.Node.Reserved = r
	}
	r.CPU = agentConfig.Client.Reserved.CPU
	r.MemoryMB = agentConfig.Client.Reserved.MemoryMB
	r.DiskMB = agentConfig.Client.Reserved.DiskMB

	res := conf.Node.ReservedResources
	if res == nil {
		res = new(structs.NodeReservedResources)
		conf.Node.ReservedResources = res
	}
	res.Cpu.CpuShares = int64(agentConfig.Client.Reserved.CPU)
	res.Memory.MemoryMB = int64(agentConfig.Client.Reserved.MemoryMB)
	res.Disk.DiskMB = int64(agentConfig.Client.Reserved.DiskMB)
	res.Networks.ReservedHostPorts = agentConfig.Client.Reserved.ReservedPorts

	conf.Version = agentConfig.Version

	if *agentConfig.Consul.AutoAdvertise && agentConfig.Consul.ClientServiceName == "" {
		return nil, fmt.Errorf("client_service_name must be set when auto_advertise is enabled")
	}

	conf.ConsulConfig = agentConfig.Consul
	conf.VaultConfig = agentConfig.Vault

	// Set up Telemetry configuration
	conf.StatsCollectionInterval = agentConfig.Telemetry.collectionInterval
	conf.PublishNodeMetrics = agentConfig.Telemetry.PublishNodeMetrics
	conf.PublishAllocationMetrics = agentConfig.Telemetry.PublishAllocationMetrics
	conf.DisableTaggedMetrics = agentConfig.Telemetry.DisableTaggedMetrics
	conf.BackwardsCompatibleMetrics = agentConfig.Telemetry.BackwardsCompatibleMetrics

	// Set the TLS related configs
	conf.TLSConfig = agentConfig.TLSConfig
	conf.Node.TLSEnabled = conf.TLSConfig.EnableHTTP

	// Set the GC related configs
	conf.GCInterval = agentConfig.Client.GCInterval
	conf.GCParallelDestroys = agentConfig.Client.GCParallelDestroys
	conf.GCDiskUsageThreshold = agentConfig.Client.GCDiskUsageThreshold
	conf.GCInodeUsageThreshold = agentConfig.Client.GCInodeUsageThreshold
	conf.GCMaxAllocs = agentConfig.Client.GCMaxAllocs
	if agentConfig.Client.NoHostUUID != nil {
		conf.NoHostUUID = *agentConfig.Client.NoHostUUID
	} else {
		// Default no_host_uuid to true
		conf.NoHostUUID = true
	}

	// Setup the ACLs
	conf.ACLEnabled = agentConfig.ACL.Enabled
	conf.ACLTokenTTL = agentConfig.ACL.TokenTTL
	conf.ACLPolicyTTL = agentConfig.ACL.PolicyTTL

	return conf, nil
}