func (h *NamespaceHandler) OnUpdate(oldObj, newObj interface{}) {
	nns, ok := newObj.(*v1.Namespace)
	if !ok {
		log.Errorf("Expected Namespace but OnUpdate handler received %+v %+v", oldObj, newObj)
		return
	}
	logger := log.WithFields(h.namespaceFields(nns))
	logger.Debug("Namespace OnUpdate")
	roles := GetNamespaceRoleAnnotation(nns, h.namespaceKey)
	for _, role := range roles {
		logger.WithField("ns.role", role).Info("Discovered role on namespace (OnUpdate)")
	}
}
OnUpdate called with a namespace is updated inside k8s.
package kube2iam
import (
	"encoding/json"
	"fmt"
	log "github.com/sirupsen/logrus"
	v1 "k8s.io/api/core/v1"
)
type NamespaceHandler struct {
	namespaceKey string
}
func (h *NamespaceHandler) namespaceFields(ns *v1.Namespace) log.Fields {
	return log.Fields{
		"ns.name": ns.GetName(),
	}
}
func (h *NamespaceHandler) OnAdd(obj interface{}) {
	ns, ok := obj.(*v1.Namespace)
	if !ok {
		log.Errorf("Expected Namespace but OnAdd handler received %+v", obj)
		return
	}
	logger := log.WithFields(h.namespaceFields(ns))
	logger.Debug("Namespace OnAdd")
	roles := GetNamespaceRoleAnnotation(ns, h.namespaceKey)
	for _, role := range roles {
		logger.WithField("ns.role", role).Info("Discovered role on namespace (OnAdd)")
	}
}