func SetDefaults_Configuration()

in apis/config/v1beta1/defaults.go [50:108]


func SetDefaults_Configuration(cfg *Configuration) {
	if cfg.Namespace == nil {
		cfg.Namespace = pointer.String(DefaultNamespace)
	}
	if cfg.Webhook.Port == nil {
		cfg.Webhook.Port = pointer.Int(DefaultWebhookPort)
	}
	if len(cfg.Metrics.BindAddress) == 0 {
		cfg.Metrics.BindAddress = DefaultMetricsBindAddress
	}
	if len(cfg.Health.HealthProbeBindAddress) == 0 {
		cfg.Health.HealthProbeBindAddress = DefaultHealthProbeBindAddress
	}
	if cfg.LeaderElection != nil && cfg.LeaderElection.LeaderElect != nil &&
		*cfg.LeaderElection.LeaderElect && len(cfg.LeaderElection.ResourceName) == 0 {
		cfg.LeaderElection.ResourceName = DefaultLeaderElectionID
	}
	if cfg.InternalCertManagement == nil {
		cfg.InternalCertManagement = &InternalCertManagement{}
	}
	if cfg.InternalCertManagement.Enable == nil {
		cfg.InternalCertManagement.Enable = pointer.Bool(true)
	}
	if *cfg.InternalCertManagement.Enable {
		if cfg.InternalCertManagement.WebhookServiceName == nil {
			cfg.InternalCertManagement.WebhookServiceName = pointer.String(DefaultWebhookServiceName)
		}
		if cfg.InternalCertManagement.WebhookSecretName == nil {
			cfg.InternalCertManagement.WebhookSecretName = pointer.String(DefaultWebhookSecretName)
		}
	}
	if cfg.ClientConnection == nil {
		cfg.ClientConnection = &ClientConnection{}
	}
	if cfg.ClientConnection.QPS == nil {
		cfg.ClientConnection.QPS = pointer.Float32(DefaultClientConnectionQPS)
	}
	if cfg.ClientConnection.Burst == nil {
		cfg.ClientConnection.Burst = pointer.Int32(DefaultClientConnectionBurst)
	}
	if cfg.WaitForPodsReady != nil {
		if cfg.WaitForPodsReady.Timeout == nil {
			cfg.WaitForPodsReady.Timeout = &metav1.Duration{Duration: defaultPodsReadyTimeout}
		}
		if cfg.WaitForPodsReady.BlockAdmission == nil {
			defaultBlockAdmission := true
			if !cfg.WaitForPodsReady.Enable {
				defaultBlockAdmission = false
			}
			cfg.WaitForPodsReady.BlockAdmission = &defaultBlockAdmission
		}
	}
	if cfg.Integrations == nil {
		cfg.Integrations = &Integrations{}
	}
	if cfg.Integrations.Frameworks == nil {
		cfg.Integrations.Frameworks = []string{job.FrameworkName}
	}
}