@@ -19,6 +19,7 @@ import (
19
19
"k8s.io/apimachinery/pkg/api/resource"
20
20
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21
21
"k8s.io/apimachinery/pkg/runtime"
22
+ "k8s.io/apimachinery/pkg/util/intstr"
22
23
"k8s.io/utils/pointer"
23
24
)
24
25
@@ -148,10 +149,17 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) {
148
149
RunAsNonRoot : pointer .Bool (true ),
149
150
RunAsUser : pointer .Int64 (65532 ),
150
151
},
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
151
156
ReadinessProbe : & corev1.Probe {
152
157
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 ),
155
163
},
156
164
},
157
165
InitialDelaySeconds : 1 ,
@@ -162,6 +170,19 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) {
162
170
SuccessThreshold : 1 ,
163
171
TimeoutSeconds : 1 ,
164
172
},
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
+ },
165
186
VolumeMounts : []v1.VolumeMount {
166
187
bootstrapVolumeMount ,
167
188
},
0 commit comments