Feat: upgrade istio from 1.19.5 to 1.27.1 (#3066)

This commit is contained in:
EndlessSeeker
2025-11-20 14:43:30 +08:00
committed by GitHub
parent 7dfc42fd92
commit b2b4f72775
173 changed files with 25684 additions and 4741 deletions

View File

@@ -15,11 +15,10 @@
package gateway
import (
"istio.io/istio/pilot/pkg/features"
"sync/atomic"
"istio.io/istio/pilot/pkg/config/kube/crdclient"
"istio.io/istio/pilot/pkg/credentials"
kubecredentials "istio.io/istio/pilot/pkg/credentials/kube"
"istio.io/istio/pilot/pkg/model"
kubecontroller "istio.io/istio/pilot/pkg/serviceregistry/kube/controller"
"istio.io/istio/pilot/pkg/status"
@@ -30,7 +29,6 @@ import (
"istio.io/istio/pkg/config/schema/gvk"
"istio.io/istio/pkg/config/schema/resource"
"istio.io/istio/pkg/kube"
"istio.io/istio/pkg/kube/multicluster"
"k8s.io/client-go/tools/cache"
higressconfig "github.com/alibaba/higress/v2/pkg/config"
@@ -47,14 +45,13 @@ type gatewayController struct {
envoyFilterHandlers []model.EventHandler
store model.ConfigStoreController
credsController credentials.MulticlusterController
istioController *istiogateway.Controller
statusManager *status.Manager
resourceUpToDate atomic.Bool
}
func NewController(client kube.Client, options common.Options) common.GatewayController {
func NewController(client kube.Client, options common.Options, xdsUpdater model.XDSUpdater) common.GatewayController {
domainSuffix := util.GetDomainSuffix()
opts := crdclient.Option{
Revision: higressconfig.Revision,
@@ -68,12 +65,19 @@ func NewController(client kube.Client, options common.Options) common.GatewayCon
}
return false
})
// Add gateway api inference schema if enabled
if features.EnableGatewayAPIInferenceExtension {
schemasBuilder.MustAdd(collections.InferencePool)
}
store := crdclient.NewForSchemas(client, opts, schemasBuilder.Build())
clusterId := options.ClusterId
credsController := kubecredentials.NewMulticluster(clusterId)
credsController.ClusterAdded(&multicluster.Cluster{ID: clusterId, Client: client}, nil)
istioController := istiogateway.NewController(client, store, client.CrdWatcher().WaitForCRD, credsController, kubecontroller.Options{DomainSuffix: domainSuffix})
opt := kubecontroller.Options{
DomainSuffix: domainSuffix,
ClusterID: clusterId,
Revision: higressconfig.Revision,
}
istioController := istiogateway.NewController(client, client.CrdWatcher().WaitForCRD, opt, xdsUpdater)
if options.GatewaySelectorKey != "" {
istioController.DefaultGatewaySelector = map[string]string{options.GatewaySelectorKey: options.GatewaySelectorValue}
}
@@ -88,7 +92,6 @@ func NewController(client kube.Client, options common.Options) common.GatewayCon
return &gatewayController{
store: store,
credsController: credsController,
istioController: istioController,
statusManager: statusManager,
}
@@ -104,10 +107,7 @@ func (g *gatewayController) Get(typ config.GroupVersionKind, name, namespace str
func (g *gatewayController) List(typ config.GroupVersionKind, namespace string) []config.Config {
if g.resourceUpToDate.CompareAndSwap(false, true) {
err := g.istioController.Reconcile(model.NewPushContext())
if err != nil {
IngressLog.Errorf("failed to recompute Gateway API resources: %v", err)
}
g.istioController.Reconcile(model.NewPushContext())
}
return g.istioController.List(typ, namespace)
}
@@ -165,10 +165,7 @@ func (g *gatewayController) SetWatchErrorHandler(f func(r *cache.Reflector, err
func (g *gatewayController) HasSynced() bool {
ret := g.istioController.HasSynced()
if ret {
err := g.istioController.Reconcile(model.NewPushContext())
if err != nil {
IngressLog.Errorf("failed to recompute Gateway API resources: %v", err)
}
g.istioController.Reconcile(model.NewPushContext())
}
return ret
}