Skip to content
This repository has been archived by the owner on Mar 5, 2024. It is now read-only.

Commit

Permalink
check error before recording an event (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
Joseph-Irving authored Apr 1, 2019
1 parent d97c95e commit 9aca2d8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
7 changes: 3 additions & 4 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,10 @@ spec:
value: $(WEBHOOK_SECRET_NAME)
resources:
limits:
cpu: 100m
memory: 30Mi
memory: 200Mi
requests:
cpu: 100m
memory: 20Mi
memory: 100Mi
ports:
- containerPort: 9876
name: webhook-server
Expand Down Expand Up @@ -104,7 +103,7 @@ data:
config.json: |
{
"nodeSelector": {
"node-role.kubernetes.io/master": ""
"node-role.kubernetes.io/node": ""
},
"daemonsets": [
{
Expand Down
7 changes: 4 additions & 3 deletions pkg/nidhogg/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,14 @@ func (h *Handler) HandleNode(instance *corev1.Node) (reconcile.Result, error) {
instance = copy
log.Info("Updating Node taints", "instance", instance.Name, "taints added", taintChanges.taintsAdded, "taints removed", taintChanges.taintsRemoved)
err := h.Update(context.TODO(), instance)
if err != nil {
return reconcile.Result{}, err
}

// this is a hack to make the event work on a non-namespaced object
copy.UID = types.UID(copy.Name)

h.recorder.Eventf(copy, corev1.EventTypeNormal, "TaintsChanged", "Taints added: %s, Taints removed: %s", taintChanges.taintsAdded, taintChanges.taintsRemoved)
if err != nil {
return reconcile.Result{}, err
}
}

return reconcile.Result{}, nil
Expand Down

0 comments on commit 9aca2d8

Please sign in to comment.