upgrade to istio 1.19 (#1211)

Co-authored-by: CH3CHO <ch3cho@qq.com>
Co-authored-by: rinfx <893383980@qq.com>
This commit is contained in:
澄潭
2024-08-26 09:51:47 +08:00
committed by GitHub
parent a2c2d1d521
commit f7a419770d
401 changed files with 21171 additions and 7255 deletions

View File

@@ -18,9 +18,12 @@ import (
"sync"
"istio.io/istio/pilot/pkg/model"
istiomodel "istio.io/istio/pilot/pkg/model"
"istio.io/istio/pkg/cluster"
"istio.io/istio/pkg/config"
"istio.io/istio/pkg/config/schema/collection"
"istio.io/istio/pkg/config/schema/gvk"
v1 "k8s.io/api/core/v1"
"k8s.io/client-go/tools/cache"
ingressconfig "github.com/alibaba/higress/pkg/ingress/config"
@@ -30,8 +33,8 @@ import (
)
var (
_ model.ConfigStoreCache = &IngressTranslation{}
_ model.IngressStore = &IngressTranslation{}
_ istiomodel.ConfigStoreController = &IngressTranslation{}
_ istiomodel.IngressStore = &IngressTranslation{}
)
type IngressTranslation struct {
@@ -42,42 +45,29 @@ type IngressTranslation struct {
higressDomainCache model.IngressDomainCollection
}
func NewIngressTranslation(localKubeClient kube.Client, XDSUpdater model.XDSUpdater, namespace, clusterId string) *IngressTranslation {
func NewIngressTranslation(localKubeClient kube.Client, xdsUpdater istiomodel.XDSUpdater, namespace string, clusterId cluster.ID) *IngressTranslation {
if clusterId == "Kubernetes" {
clusterId = ""
}
Config := &IngressTranslation{
ingressConfig: ingressconfig.NewIngressConfig(localKubeClient, XDSUpdater, namespace, clusterId),
kingressConfig: ingressconfig.NewKIngressConfig(localKubeClient, XDSUpdater, namespace, clusterId),
ingressConfig: ingressconfig.NewIngressConfig(localKubeClient, xdsUpdater, namespace, clusterId),
kingressConfig: ingressconfig.NewKIngressConfig(localKubeClient, xdsUpdater, namespace, clusterId),
}
return Config
}
func (m *IngressTranslation) AddLocalCluster(options common.Options) (common.IngressController, common.KIngressController) {
if m.kingressConfig == nil {
return m.ingressConfig.AddLocalCluster(options), nil
func (m *IngressTranslation) AddLocalCluster(options common.Options) {
m.ingressConfig.AddLocalCluster(options)
if m.kingressConfig != nil {
m.kingressConfig.AddLocalCluster(options)
}
return m.ingressConfig.AddLocalCluster(options), m.kingressConfig.AddLocalCluster(options)
}
func (m *IngressTranslation) InitializeCluster(ingressController common.IngressController, kingressController common.KIngressController, stop <-chan struct{}) error {
if err := m.ingressConfig.InitializeCluster(ingressController, stop); err != nil {
return err
}
if kingressController == nil {
return nil
}
if err := m.kingressConfig.InitializeCluster(kingressController, stop); err != nil {
return err
}
return nil
}
func (m *IngressTranslation) GetIngressConfig() *ingressconfig.IngressConfig {
return m.ingressConfig
}
func (m *IngressTranslation) RegisterEventHandler(kind config.GroupVersionKind, f model.EventHandler) {
func (m *IngressTranslation) RegisterEventHandler(kind config.GroupVersionKind, f istiomodel.EventHandler) {
m.ingressConfig.RegisterEventHandler(kind, f)
if m.kingressConfig != nil {
m.kingressConfig.RegisterEventHandler(kind, f)
@@ -107,9 +97,15 @@ func (m *IngressTranslation) Run(stop <-chan struct{}) {
}
func (m *IngressTranslation) SetWatchErrorHandler(f func(r *cache.Reflector, err error)) error {
m.ingressConfig.SetWatchErrorHandler(f)
err := m.ingressConfig.SetWatchErrorHandler(f)
if err != nil {
return err
}
if m.kingressConfig != nil {
m.kingressConfig.SetWatchErrorHandler(f)
err := m.kingressConfig.SetWatchErrorHandler(f)
if err != nil {
return err
}
}
return nil
}
@@ -147,6 +143,18 @@ func (m *IngressTranslation) GetIngressDomains() model.IngressDomainCollection {
return m.higressDomainCache
}
func (m *IngressTranslation) CheckIngress(clusterName string) istiomodel.CheckIngressResponse {
return istiomodel.CheckIngressResponse{}
}
func (m *IngressTranslation) Services(clusterName string) ([]*v1.Service, error) {
return nil, nil
}
func (m *IngressTranslation) IngressControllers() map[string]string {
return nil
}
func (m *IngressTranslation) Schemas() collection.Schemas {
return common.IngressIR
}
@@ -155,36 +163,36 @@ func (m *IngressTranslation) Get(typ config.GroupVersionKind, name, namespace st
return nil
}
func (m *IngressTranslation) List(typ config.GroupVersionKind, namespace string) ([]config.Config, error) {
func (m *IngressTranslation) List(typ config.GroupVersionKind, namespace string) []config.Config {
if typ != gvk.Gateway &&
typ != gvk.VirtualService &&
typ != gvk.DestinationRule &&
typ != gvk.EnvoyFilter &&
typ != gvk.ServiceEntry &&
typ != gvk.WasmPlugin {
return nil, common.ErrUnsupportedOp
return nil
}
// Currently, only support list all namespaces gateways or virtualservices.
if namespace != "" {
IngressLog.Warnf("ingress store only support type %s of all namespace.", typ)
return nil, common.ErrUnsupportedOp
return nil
}
ingressConfig, err := m.ingressConfig.List(typ, namespace)
if err != nil {
return nil, err
ingressConfig := m.ingressConfig.List(typ, namespace)
if ingressConfig == nil {
return nil
}
var higressConfig []config.Config
higressConfig = append(higressConfig, ingressConfig...)
if m.kingressConfig != nil {
kingressConfig, err := m.kingressConfig.List(typ, namespace)
if err != nil {
return nil, err
kingressConfig := m.kingressConfig.List(typ, namespace)
if kingressConfig == nil {
return nil
}
higressConfig = append(higressConfig, kingressConfig...)
}
return higressConfig, nil
return higressConfig
}
func (m *IngressTranslation) Create(config config.Config) (revision string, err error) {