...
1
16
17 package v1beta1
18
19 import (
20 "k8s.io/api/flowcontrol/v1beta1"
21 )
22
23
24 const (
25 FlowSchemaDefaultMatchingPrecedence int32 = 1000
26 )
27
28
29 const (
30 PriorityLevelConfigurationDefaultHandSize int32 = 8
31 PriorityLevelConfigurationDefaultQueues int32 = 64
32 PriorityLevelConfigurationDefaultQueueLengthLimit int32 = 50
33 PriorityLevelConfigurationDefaultAssuredConcurrencyShares int32 = 30
34 )
35
36
37 func SetDefaults_FlowSchemaSpec(spec *v1beta1.FlowSchemaSpec) {
38 if spec.MatchingPrecedence == 0 {
39 spec.MatchingPrecedence = FlowSchemaDefaultMatchingPrecedence
40 }
41 }
42
43 func SetDefaults_ExemptPriorityLevelConfiguration(eplc *v1beta1.ExemptPriorityLevelConfiguration) {
44 if eplc.NominalConcurrencyShares == nil {
45 eplc.NominalConcurrencyShares = new(int32)
46 *eplc.NominalConcurrencyShares = 0
47 }
48 if eplc.LendablePercent == nil {
49 eplc.LendablePercent = new(int32)
50 *eplc.LendablePercent = 0
51 }
52 }
53
54 func SetDefaults_LimitedPriorityLevelConfiguration(lplc *v1beta1.LimitedPriorityLevelConfiguration) {
55 if lplc.AssuredConcurrencyShares == 0 {
56 lplc.AssuredConcurrencyShares = PriorityLevelConfigurationDefaultAssuredConcurrencyShares
57 }
58 if lplc.LendablePercent == nil {
59 lplc.LendablePercent = new(int32)
60 *lplc.LendablePercent = 0
61 }
62 }
63
64
65 func SetDefaults_QueuingConfiguration(cfg *v1beta1.QueuingConfiguration) {
66 if cfg.HandSize == 0 {
67 cfg.HandSize = PriorityLevelConfigurationDefaultHandSize
68 }
69 if cfg.Queues == 0 {
70 cfg.Queues = PriorityLevelConfigurationDefaultQueues
71 }
72 if cfg.QueueLengthLimit == 0 {
73 cfg.QueueLengthLimit = PriorityLevelConfigurationDefaultQueueLengthLimit
74 }
75 }
76
View as plain text