@@ -72,37 +72,101 @@ type ServerGroupSpec struct {
72
72
type ServerGroupProbesSpec struct {
73
73
// LivenessProbeDisabled if true livenessProbes are disabled
74
74
LivenessProbeDisabled * bool `json:"livenessProbeDisabled,omitempty"`
75
- // LivenessProbeDisabled if specified the given probes is used as liveness probe
76
- //LivenessProbeOverride *v1.Probe `json:"LivenessProbeOverride,omitempty"`
77
- // LivenessProbeDisabled if true readinessProbes are disabled
78
- ReadinessProbeDisabled * bool `json:"ReadinessProbeDisabled,omitempty"`
79
- // ReadinessProbeOverride if specified the given probes is used as readiness probe
80
- //ReadinessProbeOverride *v1.Probe `json:"ReadinessProbeOverride,omitempty"`
75
+ // LivenessProbeSpec override liveness probe configuration
76
+ LivenessProbeSpec * ServerGroupProbeSpec `json:"livenessProbeSpec,omitempty"`
77
+
78
+ // OldReadinessProbeDisabled if true readinessProbes are disabled
79
+ //
80
+ // Deprecated: This field is deprecated, keept only for backward compatibility.
81
+ OldReadinessProbeDisabled * bool `json:"ReadinessProbeDisabled,omitempty"`
82
+ // ReadinessProbeDisabled override flag for probe disabled in good manner (lowercase) with backward compatibility
83
+ ReadinessProbeDisabled * bool `json:"readinessProbeDisabled,omitempty"`
84
+ // ReadinessProbeSpec override readiness probe configuration
85
+ ReadinessProbeSpec * ServerGroupProbeSpec `json:"readinessProbeSpec,omitempty"`
81
86
}
82
87
83
- // // HasLivenessProbeOverride returns true if a livenessprobe override is set
84
- // func (s ServerGroupProbesSpec) HasLivenessProbeOverride() bool {
85
- // return s.LivenessProbeOverride != nil
86
- // }
88
+ // GetReadinessProbeDisabled returns in proper manner readiness probe flag with backward compatibility.
89
+ func (s ServerGroupProbesSpec ) GetReadinessProbeDisabled () * bool {
90
+ if s .OldReadinessProbeDisabled != nil {
91
+ return s .OldReadinessProbeDisabled
92
+ }
87
93
88
- // // HasReadinessProbeOverride returns true if a readinessprobe override is set
89
- // func (s ServerGroupProbesSpec) HasReadinessProbeOverride() bool {
90
- // return s.ReadinessProbeOverride != nil
91
- // }
94
+ return s .ReadinessProbeDisabled
95
+ }
92
96
93
- // GetSidecars returns a list of sidecars the use wish to add
94
- func (s ServerGroupSpec ) GetSidecars () []v1.Container {
95
- return s .Sidecars
97
+ // ServerGroupProbeSpec
98
+ type ServerGroupProbeSpec struct {
99
+ InitialDelaySeconds * int32 `json:"initialDelaySeconds,omitempty"`
100
+ PeriodSeconds * int32 `json:"periodSeconds,omitempty"`
101
+ TimeoutSeconds * int32 `json:"timeoutSeconds,omitempty"`
102
+ SuccessThreshold * int32 `json:"successThreshold,omitempty"`
103
+ FailureThreshold * int32 `json:"failureThreshold,omitempty"`
104
+ }
105
+
106
+ // GetInitialDelaySeconds return InitialDelaySeconds valid value. In case if InitialDelaySeconds is nil default is returned.
107
+ func (s * ServerGroupProbeSpec ) GetInitialDelaySeconds (d int32 ) int32 {
108
+ if s == nil || s .InitialDelaySeconds == nil {
109
+ return d // Default Kubernetes value
110
+ }
111
+
112
+ return * s .InitialDelaySeconds
96
113
}
97
114
98
- // IsLivenessProbeDisabled returns true if liveness probes are disabled
99
- func (s ServerGroupProbesSpec ) IsLivenessProbeDisabled () bool {
100
- return util .BoolOrDefault (s .LivenessProbeDisabled )
115
+ // GetPeriodSeconds return PeriodSeconds valid value. In case if PeriodSeconds is nil default is returned.
116
+ func (s * ServerGroupProbeSpec ) GetPeriodSeconds (d int32 ) int32 {
117
+ if s == nil || s .PeriodSeconds == nil {
118
+ return d
119
+ }
120
+
121
+ if * s .PeriodSeconds <= 0 {
122
+ return 1 // Value 0 is not allowed
123
+ }
124
+
125
+ return * s .PeriodSeconds
101
126
}
102
127
103
- // IsReadinessProbeDisabled returns true if readiness probes are disabled
104
- func (s ServerGroupProbesSpec ) IsReadinessProbeDisabled () bool {
105
- return util .BoolOrDefault (s .ReadinessProbeDisabled )
128
+ // GetTimeoutSeconds return TimeoutSeconds valid value. In case if TimeoutSeconds is nil default is returned.
129
+ func (s * ServerGroupProbeSpec ) GetTimeoutSeconds (d int32 ) int32 {
130
+ if s == nil || s .TimeoutSeconds == nil {
131
+ return d
132
+ }
133
+
134
+ if * s .TimeoutSeconds <= 0 {
135
+ return 1 // Value 0 is not allowed
136
+ }
137
+
138
+ return * s .TimeoutSeconds
139
+ }
140
+
141
+ // GetSuccessThreshold return SuccessThreshold valid value. In case if SuccessThreshold is nil default is returned.
142
+ func (s * ServerGroupProbeSpec ) GetSuccessThreshold (d int32 ) int32 {
143
+ if s == nil || s .SuccessThreshold == nil {
144
+ return d
145
+ }
146
+
147
+ if * s .SuccessThreshold <= 0 {
148
+ return 1 // Value 0 is not allowed
149
+ }
150
+
151
+ return * s .SuccessThreshold
152
+ }
153
+
154
+ // GetFailureThreshold return FailureThreshold valid value. In case if FailureThreshold is nil default is returned.
155
+ func (s * ServerGroupProbeSpec ) GetFailureThreshold (d int32 ) int32 {
156
+ if s == nil || s .FailureThreshold == nil {
157
+ return d
158
+ }
159
+
160
+ if * s .FailureThreshold <= 0 {
161
+ return 1 // Value 0 is not allowed
162
+ }
163
+
164
+ return * s .FailureThreshold
165
+ }
166
+
167
+ // GetSidecars returns a list of sidecars the use wish to add
168
+ func (s ServerGroupSpec ) GetSidecars () []v1.Container {
169
+ return s .Sidecars
106
170
}
107
171
108
172
// HasVolumeClaimTemplate returns whether there is a volumeClaimTemplate or not
0 commit comments