|
1 | 1 | package config |
2 | 2 |
|
3 | 3 | import ( |
4 | | - "strconv" |
5 | 4 | "strings" |
6 | 5 |
|
7 | 6 | cnpgv1 "github.com/cloudnative-pg/cloudnative-pg/api/v1" |
@@ -58,29 +57,6 @@ type PluginConfiguration struct { |
58 | 57 |
|
59 | 58 | ReplicaSourceBarmanObjectName string |
60 | 59 | ReplicaSourceServerName string |
61 | | - |
62 | | - // Probe configuration |
63 | | - StartupProbeConfig *ProbeConfig |
64 | | -} |
65 | | - |
66 | | -// ProbeConfig holds configuration for Kubernetes probes |
67 | | -type ProbeConfig struct { |
68 | | - InitialDelaySeconds int32 |
69 | | - TimeoutSeconds int32 |
70 | | - PeriodSeconds int32 |
71 | | - FailureThreshold int32 |
72 | | - SuccessThreshold int32 |
73 | | -} |
74 | | - |
75 | | -// DefaultProbeConfig returns the default probe configuration |
76 | | -func DefaultProbeConfig() *ProbeConfig { |
77 | | - return &ProbeConfig{ |
78 | | - InitialDelaySeconds: 0, |
79 | | - TimeoutSeconds: 10, |
80 | | - PeriodSeconds: 10, |
81 | | - FailureThreshold: 10, |
82 | | - SuccessThreshold: 1, |
83 | | - } |
84 | 60 | } |
85 | 61 |
|
86 | 62 | // GetBarmanObjectKey gets the namespaced name of the barman object |
@@ -190,50 +166,11 @@ func NewFromCluster(cluster *cnpgv1.Cluster) *PluginConfiguration { |
190 | 166 | // used for wal_restore in the designed primary of a replica cluster |
191 | 167 | ReplicaSourceServerName: replicaSourceServerName, |
192 | 168 | ReplicaSourceBarmanObjectName: replicaSourceBarmanObjectName, |
193 | | - // probe configuration |
194 | | - StartupProbeConfig: parseProbeConfig(helper.Parameters), |
195 | 169 | } |
196 | 170 |
|
197 | 171 | return result |
198 | 172 | } |
199 | 173 |
|
200 | | -// parseProbeConfig parses probe configuration from plugin parameters |
201 | | -func parseProbeConfig(parameters map[string]string) *ProbeConfig { |
202 | | - config := DefaultProbeConfig() |
203 | | - |
204 | | - if val, ok := parameters["startupProbe.initialDelaySeconds"]; ok { |
205 | | - if parsed, err := strconv.ParseInt(val, 10, 32); err == nil { |
206 | | - config.InitialDelaySeconds = int32(parsed) |
207 | | - } |
208 | | - } |
209 | | - |
210 | | - if val, ok := parameters["startupProbe.timeoutSeconds"]; ok { |
211 | | - if parsed, err := strconv.ParseInt(val, 10, 32); err == nil { |
212 | | - config.TimeoutSeconds = int32(parsed) |
213 | | - } |
214 | | - } |
215 | | - |
216 | | - if val, ok := parameters["startupProbe.periodSeconds"]; ok { |
217 | | - if parsed, err := strconv.ParseInt(val, 10, 32); err == nil { |
218 | | - config.PeriodSeconds = int32(parsed) |
219 | | - } |
220 | | - } |
221 | | - |
222 | | - if val, ok := parameters["startupProbe.failureThreshold"]; ok { |
223 | | - if parsed, err := strconv.ParseInt(val, 10, 32); err == nil { |
224 | | - config.FailureThreshold = int32(parsed) |
225 | | - } |
226 | | - } |
227 | | - |
228 | | - if val, ok := parameters["startupProbe.successThreshold"]; ok { |
229 | | - if parsed, err := strconv.ParseInt(val, 10, 32); err == nil { |
230 | | - config.SuccessThreshold = int32(parsed) |
231 | | - } |
232 | | - } |
233 | | - |
234 | | - return config |
235 | | -} |
236 | | - |
237 | 174 | func getRecoveryParameters(cluster *cnpgv1.Cluster) map[string]string { |
238 | 175 | recoveryPluginConfiguration := getRecoverySourcePlugin(cluster) |
239 | 176 | if recoveryPluginConfiguration == nil { |
|
0 commit comments