Skip to content

Commit 8bae018

Browse files
author
Carlos Tadeu Panato Junior
authored
probes: remove startup probe because 1.17 thisis not enabled and was causing reconcile infinite loop (#169)
1 parent 5769001 commit 8bae018

File tree

4 files changed

+5
-102
lines changed

4 files changed

+5
-102
lines changed

pkg/controller/clusterinstallation/create_resources.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func (r *ReconcileClusterInstallation) update(current, desired Object, reqLogger
5454
reqLogger.Error(err, "error applying the annotation in the resource")
5555
return err
5656
}
57-
reqLogger.Info("updating resource", "name", desired.GetName(), "namespace", desired.GetNamespace())
57+
reqLogger.Info("updating resource", "name", desired.GetName(), "namespace", desired.GetNamespace(), "diff", patchResult.String())
5858
// Resource version is required for the update, but need to be set after
5959
// the last applied annotation to avoid unnecessary diffs
6060
desired.SetResourceVersion(current.GetResourceVersion())

pkg/mattermost/helpers.go

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func mergeEnvVars(original, new []corev1.EnvVar) []corev1.EnvVar {
4444
return original
4545
}
4646

47-
func setProbes(customLiveness, customStartup, customReadiness corev1.Probe) (*corev1.Probe, *corev1.Probe, *corev1.Probe) {
47+
func setProbes(customLiveness, customReadiness corev1.Probe) (*corev1.Probe, *corev1.Probe) {
4848
liveness := &corev1.Probe{
4949
Handler: corev1.Handler{
5050
HTTPGet: &corev1.HTTPGetAction{
@@ -77,38 +77,6 @@ func setProbes(customLiveness, customStartup, customReadiness corev1.Probe) (*co
7777
liveness.SuccessThreshold = customLiveness.SuccessThreshold
7878
}
7979

80-
startUp := &corev1.Probe{
81-
Handler: corev1.Handler{
82-
HTTPGet: &corev1.HTTPGetAction{
83-
Path: "/api/v4/system/ping",
84-
Port: intstr.FromInt(8065),
85-
},
86-
},
87-
InitialDelaySeconds: 1,
88-
PeriodSeconds: 10,
89-
FailureThreshold: 60,
90-
}
91-
92-
if customStartup.Handler != (corev1.Handler{}) {
93-
startUp.Handler = customStartup.Handler
94-
}
95-
96-
if customStartup.InitialDelaySeconds != 0 {
97-
startUp.InitialDelaySeconds = customStartup.InitialDelaySeconds
98-
}
99-
100-
if customStartup.PeriodSeconds != 0 {
101-
startUp.PeriodSeconds = customStartup.PeriodSeconds
102-
}
103-
104-
if customStartup.FailureThreshold != 0 {
105-
startUp.FailureThreshold = customStartup.FailureThreshold
106-
}
107-
108-
if customStartup.SuccessThreshold != 0 {
109-
startUp.SuccessThreshold = customStartup.SuccessThreshold
110-
}
111-
11280
readiness := &corev1.Probe{
11381
Handler: corev1.Handler{
11482
HTTPGet: &corev1.HTTPGetAction{
@@ -141,5 +109,5 @@ func setProbes(customLiveness, customStartup, customReadiness corev1.Probe) (*co
141109
readiness.SuccessThreshold = customReadiness.SuccessThreshold
142110
}
143111

144-
return liveness, startUp, readiness
112+
return liveness, readiness
145113
}

pkg/mattermost/helpers_test.go

Lines changed: 1 addition & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,13 @@ func TestSetProbes(t *testing.T) {
110110
tests := []struct {
111111
name string
112112
customLiveness corev1.Probe
113-
customStartup corev1.Probe
114113
customReadiness corev1.Probe
115114
wantLiveness *corev1.Probe
116-
wantStartup *corev1.Probe
117115
wantReadiness *corev1.Probe
118116
}{
119117
{
120118
name: "No Custom probes",
121119
customLiveness: corev1.Probe{},
122-
customStartup: corev1.Probe{},
123120
customReadiness: corev1.Probe{},
124121
wantLiveness: &corev1.Probe{
125122
Handler: corev1.Handler{
@@ -132,17 +129,6 @@ func TestSetProbes(t *testing.T) {
132129
PeriodSeconds: 10,
133130
FailureThreshold: 3,
134131
},
135-
wantStartup: &corev1.Probe{
136-
Handler: corev1.Handler{
137-
HTTPGet: &corev1.HTTPGetAction{
138-
Path: "/api/v4/system/ping",
139-
Port: intstr.FromInt(8065),
140-
},
141-
},
142-
InitialDelaySeconds: 1,
143-
PeriodSeconds: 10,
144-
FailureThreshold: 60,
145-
},
146132
wantReadiness: &corev1.Probe{
147133
Handler: corev1.Handler{
148134
HTTPGet: &corev1.HTTPGetAction{
@@ -160,9 +146,6 @@ func TestSetProbes(t *testing.T) {
160146
customLiveness: corev1.Probe{
161147
InitialDelaySeconds: 120,
162148
},
163-
customStartup: corev1.Probe{
164-
InitialDelaySeconds: 1,
165-
},
166149
customReadiness: corev1.Probe{
167150
InitialDelaySeconds: 90,
168151
},
@@ -177,17 +160,6 @@ func TestSetProbes(t *testing.T) {
177160
PeriodSeconds: 10,
178161
FailureThreshold: 3,
179162
},
180-
wantStartup: &corev1.Probe{
181-
Handler: corev1.Handler{
182-
HTTPGet: &corev1.HTTPGetAction{
183-
Path: "/api/v4/system/ping",
184-
Port: intstr.FromInt(8065),
185-
},
186-
},
187-
InitialDelaySeconds: 1,
188-
PeriodSeconds: 10,
189-
FailureThreshold: 60,
190-
},
191163
wantReadiness: &corev1.Probe{
192164
Handler: corev1.Handler{
193165
HTTPGet: &corev1.HTTPGetAction{
@@ -206,10 +178,6 @@ func TestSetProbes(t *testing.T) {
206178
InitialDelaySeconds: 20,
207179
PeriodSeconds: 20,
208180
},
209-
customStartup: corev1.Probe{
210-
InitialDelaySeconds: 20,
211-
PeriodSeconds: 20,
212-
},
213181
customReadiness: corev1.Probe{
214182
InitialDelaySeconds: 10,
215183
FailureThreshold: 10,
@@ -225,17 +193,6 @@ func TestSetProbes(t *testing.T) {
225193
PeriodSeconds: 20,
226194
FailureThreshold: 3,
227195
},
228-
wantStartup: &corev1.Probe{
229-
Handler: corev1.Handler{
230-
HTTPGet: &corev1.HTTPGetAction{
231-
Path: "/api/v4/system/ping",
232-
Port: intstr.FromInt(8065),
233-
},
234-
},
235-
InitialDelaySeconds: 20,
236-
PeriodSeconds: 20,
237-
FailureThreshold: 60,
238-
},
239196
wantReadiness: &corev1.Probe{
240197
Handler: corev1.Handler{
241198
HTTPGet: &corev1.HTTPGetAction{
@@ -259,15 +216,6 @@ func TestSetProbes(t *testing.T) {
259216
},
260217
InitialDelaySeconds: 120,
261218
},
262-
customStartup: corev1.Probe{
263-
Handler: corev1.Handler{
264-
HTTPGet: &corev1.HTTPGetAction{
265-
Path: "/api/v4/system/pong",
266-
Port: intstr.FromInt(8080),
267-
},
268-
},
269-
InitialDelaySeconds: 120,
270-
},
271219
customReadiness: corev1.Probe{
272220
Handler: corev1.Handler{
273221
HTTPGet: &corev1.HTTPGetAction{
@@ -287,17 +235,6 @@ func TestSetProbes(t *testing.T) {
287235
PeriodSeconds: 10,
288236
FailureThreshold: 3,
289237
},
290-
wantStartup: &corev1.Probe{
291-
Handler: corev1.Handler{
292-
HTTPGet: &corev1.HTTPGetAction{
293-
Path: "/api/v4/system/pong",
294-
Port: intstr.FromInt(8080),
295-
},
296-
},
297-
InitialDelaySeconds: 120,
298-
PeriodSeconds: 10,
299-
FailureThreshold: 60,
300-
},
301238
wantReadiness: &corev1.Probe{
302239
Handler: corev1.Handler{
303240
HTTPGet: &corev1.HTTPGetAction{
@@ -314,9 +251,8 @@ func TestSetProbes(t *testing.T) {
314251

315252
for _, tt := range tests {
316253
t.Run(tt.name, func(t *testing.T) {
317-
liveness, startUp, readiness := setProbes(tt.customLiveness, tt.customStartup, tt.customReadiness)
254+
liveness, readiness := setProbes(tt.customLiveness, tt.customReadiness)
318255
require.Equal(t, tt.wantLiveness, liveness)
319-
require.Equal(t, tt.wantStartup, startUp)
320256
require.Equal(t, tt.wantReadiness, readiness)
321257
})
322258
}

pkg/mattermost/mattermost.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ func GenerateDeployment(mattermost *mattermostv1alpha1.ClusterInstallation, dbIn
434434
maxUnavailable := intstr.FromInt(defaultMaxUnavailable)
435435
maxSurge := intstr.FromInt(defaultMaxSurge)
436436

437-
liveness, startupProbe, readiness := setProbes(mattermost.Spec.LivenessProbe, mattermost.Spec.StartupProbe, mattermost.Spec.ReadinessProbe)
437+
liveness, readiness := setProbes(mattermost.Spec.LivenessProbe, mattermost.Spec.ReadinessProbe)
438438

439439
replicas := mattermost.Spec.Replicas
440440
if replicas < 0 {
@@ -490,7 +490,6 @@ func GenerateDeployment(mattermost *mattermostv1alpha1.ClusterInstallation, dbIn
490490
},
491491
ReadinessProbe: readiness,
492492
LivenessProbe: liveness,
493-
StartupProbe: startupProbe,
494493
VolumeMounts: volumeMountLicense,
495494
Resources: mattermost.Spec.Resources,
496495
},

0 commit comments

Comments
 (0)