Skip to content

Commit

Permalink
Add Readiness Probe for EventListener Deployment
Browse files Browse the repository at this point in the history
Add a Readiness Probe for EventListener Deployment at URL /live
  • Loading branch information
afrittoli authored and tekton-robot committed Apr 21, 2020
1 parent ea65816 commit bf53476
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 5 deletions.
21 changes: 16 additions & 5 deletions pkg/reconciler/v1alpha1/eventlistener/eventlistener.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ var (
// ElPort defines the port for the EventListener to listen on
ElPort = flag.Int("el-port", 8080,
"The container port for the EventListener to listen on.")
// PeriodSeconds defines Period Seconds for the EventListener Liveness Probe
// PeriodSeconds defines Period Seconds for the EventListener Liveness and Readiness Probes
PeriodSeconds = flag.Int("period-seconds", 10,
"The Period Seconds for the EventListener Liveness Probe.")
// FailureThreshold defines the Failure Threshold for the EventListener Liveness Probe
FailureThreshold = flag.Int("failure-threshold", 1,
"The Failure Threshold for the EventListener Liveness Probe.")
"The Period Seconds for the EventListener Liveness and Readiness Probes.")
// FailureThreshold defines the Failure Threshold for the EventListener Liveness and Readiness Probes
FailureThreshold = flag.Int("failure-threshold", 3,
"The Failure Threshold for the EventListener Liveness and Readiness Probes.")
// StaticResourceLabels is a map with all the labels that should be on
// all resources generated by the EventListener
StaticResourceLabels = map[string]string{
Expand Down Expand Up @@ -278,6 +278,17 @@ func (c *Reconciler) reconcileDeployment(el *v1alpha1.EventListener) error {
PeriodSeconds: int32(*PeriodSeconds),
FailureThreshold: int32(*FailureThreshold),
},
ReadinessProbe: &corev1.Probe{
Handler: corev1.Handler{
HTTPGet: &corev1.HTTPGetAction{
Path: "/live",
Scheme: corev1.URISchemeHTTP,
Port: intstr.FromInt((*ElPort)),
},
},
PeriodSeconds: int32(*PeriodSeconds),
FailureThreshold: int32(*FailureThreshold),
},
Args: []string{
"-el-name", el.Name,
"-el-namespace", el.Namespace,
Expand Down
22 changes: 22 additions & 0 deletions pkg/reconciler/v1alpha1/eventlistener/eventlistener_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,17 @@ func Test_reconcileDeployment(t *testing.T) {
PeriodSeconds: int32(*PeriodSeconds),
FailureThreshold: int32(*FailureThreshold),
},
ReadinessProbe: &corev1.Probe{
Handler: corev1.Handler{
HTTPGet: &corev1.HTTPGetAction{
Path: "/live",
Scheme: corev1.URISchemeHTTP,
Port: intstr.FromInt((*ElPort)),
},
},
PeriodSeconds: int32(*PeriodSeconds),
FailureThreshold: int32(*FailureThreshold),
},
Args: []string{
"-el-name", eventListenerName,
"-el-namespace", namespace,
Expand Down Expand Up @@ -571,6 +582,17 @@ func TestReconcile(t *testing.T) {
PeriodSeconds: int32(*PeriodSeconds),
FailureThreshold: int32(*FailureThreshold),
},
ReadinessProbe: &corev1.Probe{
Handler: corev1.Handler{
HTTPGet: &corev1.HTTPGetAction{
Path: "/live",
Scheme: corev1.URISchemeHTTP,
Port: intstr.FromInt((*ElPort)),
},
},
PeriodSeconds: int32(*PeriodSeconds),
FailureThreshold: int32(*FailureThreshold),
},
Args: []string{
"-el-name", eventListenerName,
"-el-namespace", namespace,
Expand Down

0 comments on commit bf53476

Please sign in to comment.