in pkg/providers/apisix/apisix_tls.go [318:367]
func (c *apisixTlsController) onUpdate(oldObj, newObj interface{}) {
prev, err := kube.NewApisixTls(oldObj)
if err != nil {
log.Errorw("found ApisixTls resource with bad type", zap.Error(err))
return
}
curr, err := kube.NewApisixTls(newObj)
if err != nil {
log.Errorw("found ApisixTls resource with bad type", zap.Error(err))
return
}
if prev.ResourceVersion() >= curr.ResourceVersion() {
return
}
// Updates triggered by status are ignored.
if prev.GetGeneration() == curr.GetGeneration() && prev.GetUID() == curr.GetUID() {
switch curr.GroupVersion() {
case config.ApisixV2:
if reflect.DeepEqual(prev.V2().Spec, curr.V2().Spec) && !reflect.DeepEqual(prev.V2().Status, curr.V2().Status) {
return
}
}
}
key, err := cache.MetaNamespaceKeyFunc(curr)
if err != nil {
log.Errorf("found ApisixTls object with bad namespace/name: %s, ignore it", err)
return
}
if !c.namespaceProvider.IsWatchingNamespace(key) {
return
}
if !c.isEffective(curr) {
return
}
log.Debugw("ApisixTls update event arrived",
zap.Any("new object", curr),
zap.Any("old object", prev),
)
c.workqueue.Add(&types.Event{
Type: types.EventUpdate,
Object: kube.ApisixTlsEvent{
Key: key,
OldObject: prev,
GroupVersion: curr.GroupVersion(),
},
})
c.MetricsCollector.IncrEvents("TLS", "update")
}