Skip to content

Commit f372e81

Browse files
authored
[spicedb] Change readiness probe to unblock startup (#19058)
1 parent 6dd8988 commit f372e81

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

install/installer/pkg/components/spicedb/deployment.go

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"k8s.io/apimachinery/pkg/api/resource"
2020
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2121
"k8s.io/apimachinery/pkg/runtime"
22+
"k8s.io/apimachinery/pkg/util/intstr"
2223
"k8s.io/utils/pointer"
2324
)
2425

@@ -148,10 +149,17 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) {
148149
RunAsNonRoot: pointer.Bool(true),
149150
RunAsUser: pointer.Int64(65532),
150151
},
152+
// Compare issue https://linear.app/gitpod/issue/EXP-906/spicedb-deployment-fails-in-gitpod-dedicated:
153+
// - this should be a single grpc_health_probe-based readiness probe
154+
// - but it started failing (with k8s 1.27.7 ?)
155+
// - to unblock container startup, we split into readiness and liveness probes
151156
ReadinessProbe: &corev1.Probe{
152157
ProbeHandler: corev1.ProbeHandler{
153-
Exec: &v1.ExecAction{
154-
Command: []string{"grpc_health_probe", "-v", fmt.Sprintf("-addr=localhost:%d", ContainerGRPCPort)},
158+
// Exec: &v1.ExecAction{
159+
// Command: []string{"grpc_health_probe", "-v", fmt.Sprintf("-addr=localhost:%d", ContainerGRPCPort)},
160+
// },
161+
TCPSocket: &v1.TCPSocketAction{
162+
Port: intstr.FromInt(ContainerGRPCPort),
155163
},
156164
},
157165
InitialDelaySeconds: 1,
@@ -162,6 +170,19 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) {
162170
SuccessThreshold: 1,
163171
TimeoutSeconds: 1,
164172
},
173+
// Because we can't test readiness properly to not block startup, we use a liveness probe to test whether the cluster has come up
174+
LivenessProbe: &corev1.Probe{
175+
ProbeHandler: corev1.ProbeHandler{
176+
Exec: &v1.ExecAction{
177+
Command: []string{"grpc_health_probe", "-v", fmt.Sprintf("-addr=localhost:%d", ContainerGRPCPort)},
178+
},
179+
},
180+
InitialDelaySeconds: 10,
181+
PeriodSeconds: 10,
182+
FailureThreshold: 3,
183+
SuccessThreshold: 1,
184+
TimeoutSeconds: 1,
185+
},
165186
VolumeMounts: []v1.VolumeMount{
166187
bootstrapVolumeMount,
167188
},

0 commit comments

Comments
 (0)