Skip to content

Commit

Permalink
add internal.istio.io/route-semantics=ingress annotation and also ski…
Browse files Browse the repository at this point in the history
…p push when ingress spec not change
  • Loading branch information
hzxuzhonghu committed Apr 10, 2024
1 parent 92a9480 commit d5fb49d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pilot/pkg/config/kube/ingress/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package ingress
import (
"errors"
"fmt"
"reflect"
"sort"
"sync"

Expand Down Expand Up @@ -186,25 +187,31 @@ func (c *controller) onEvent(item types.NamespacedName) error {
// we should check need process only when event is not delete,
// if it is delete event, and previously processed, we need to process too.
if event != model.EventDelete {
oldIngress := c.ingresses[config.NamespacedName(ing)]
shouldProcess := c.shouldProcessIngressUpdate(ing)
if !shouldProcess {
return nil
}
// only trigger when real changes were found
if oldIngress != nil && reflect.DeepEqual(oldIngress.Spec, ing.Spec) {
return nil
}
}

vsmetadata := config.Meta{
Name: item.Name + "-" + "virtualservice",
Namespace: item.Namespace,
GroupVersionKind: gvk.VirtualService,
Annotations: map[string]string{constants.InternalRouteSemantics: constants.RouteSemanticsIngress},
}
gatewaymetadata := config.Meta{
Name: item.Name + "-" + "gateway",
Namespace: item.Namespace,
GroupVersionKind: gvk.Gateway,
Annotations: map[string]string{constants.InternalRouteSemantics: constants.RouteSemanticsIngress},
}

// Trigger updates for Gateway and VirtualService
// TODO: we could be smarter here and only trigger when real changes were found
for _, f := range c.virtualServiceHandlers {
f(config.Config{Meta: vsmetadata}, config.Config{Meta: vsmetadata}, event)
}
Expand Down

0 comments on commit d5fb49d

Please sign in to comment.