Skip to content

Commit

Permalink
Put back the readiness probe (#721)
Browse files Browse the repository at this point in the history
Although the mounted secret is good from the beginning, webhook will be
only ready when webhook server is started up.

Signed-off-by: Quique Llorente <[email protected]>
  • Loading branch information
qinqon authored Mar 26, 2021
1 parent 044630b commit 4a7e41a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions deploy/handler/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ spec:
- containerPort: 9443
name: webhook-server
protocol: TCP
readinessProbe:
httpGet:
path: /readyz
port: webhook-server
scheme: HTTPS
httpHeaders:
- name: Content-Type
value: application/json
initialDelaySeconds: 10
periodSeconds: 10
volumeMounts:
- name: tls-key-pair
readOnly: true
Expand Down
2 changes: 2 additions & 0 deletions pkg/webhook/nodenetworkconfigurationpolicy/server.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package nodenetworkconfigurationpolicy

import (
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/manager"
"sigs.k8s.io/controller-runtime/pkg/webhook"
)
Expand All @@ -18,6 +19,7 @@ func Add(mgr manager.Manager) error {
// 2.- Since we have delete the condition the status-mutate webhook get called and
// there we set conditions to Unknown this final result will be updated.
server := &webhook.Server{}
server.Register("/readyz", healthz.CheckHandler{Checker: healthz.Ping})
server.Register("/nodenetworkconfigurationpolicies-mutate", deleteConditionsHook())
server.Register("/nodenetworkconfigurationpolicies-status-mutate", setConditionsUnknownHook())
server.Register("/nodenetworkconfigurationpolicies-timestamp-mutate", setTimestampAnnotationHook())
Expand Down

0 comments on commit 4a7e41a

Please sign in to comment.