-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Expand file tree
/
Copy pathdefaults.go
More file actions
34 lines (30 loc) · 839 Bytes
/
defaults.go
File metadata and controls
34 lines (30 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package v1
import "k8s.io/kubernetes/pkg/runtime"
func SetDefaults_RouteTargetReference(obj *RouteTargetReference) {
if len(obj.Kind) == 0 {
obj.Kind = "Service"
}
if obj.Weight == nil {
obj.Weight = new(int32)
*obj.Weight = 100
}
}
func SetDefaults_TLSConfig(obj *TLSConfig) {
if len(obj.Termination) == 0 && len(obj.DestinationCACertificate) == 0 {
obj.Termination = TLSTerminationEdge
}
switch obj.Termination {
case TLSTerminationType("Reencrypt"):
obj.Termination = TLSTerminationReencrypt
case TLSTerminationType("Edge"):
obj.Termination = TLSTerminationEdge
case TLSTerminationType("Passthrough"):
obj.Termination = TLSTerminationPassthrough
}
}
func addDefaultingFuncs(scheme *runtime.Scheme) error {
return scheme.AddDefaultingFuncs(
SetDefaults_RouteTargetReference,
SetDefaults_TLSConfig,
)
}