mirror of
https://github.com/alibaba/higress.git
synced 2026-05-31 16:17:28 +08:00
fix gateway name (#672)
This commit is contained in:
@@ -140,8 +140,6 @@ type IngressConfig struct {
|
||||
|
||||
annotationHandler annotations.AnnotationHandler
|
||||
|
||||
globalGatewayName string
|
||||
|
||||
namespace string
|
||||
|
||||
clusterId string
|
||||
@@ -157,13 +155,11 @@ func NewIngressConfig(localKubeClient kube.Client, XDSUpdater model.XDSUpdater,
|
||||
XDSUpdater: XDSUpdater,
|
||||
annotationHandler: annotations.NewAnnotationHandlerManager(),
|
||||
clusterId: clusterId,
|
||||
globalGatewayName: namespace + "/" +
|
||||
common.CreateConvertedName(clusterId, "global"),
|
||||
watchedSecretSet: sets.NewSet(),
|
||||
namespace: namespace,
|
||||
mcpbridgeReconciled: atomic.NewBool(false),
|
||||
wasmPlugins: make(map[string]*extensions.WasmPlugin),
|
||||
http2rpcs: make(map[string]*higressv1.Http2Rpc),
|
||||
watchedSecretSet: sets.NewSet(),
|
||||
namespace: namespace,
|
||||
mcpbridgeReconciled: atomic.NewBool(false),
|
||||
wasmPlugins: make(map[string]*extensions.WasmPlugin),
|
||||
http2rpcs: make(map[string]*higressv1.Http2Rpc),
|
||||
}
|
||||
mcpbridgeController := mcpbridge.NewController(localKubeClient, clusterId)
|
||||
mcpbridgeController.AddEventHandler(config.AddOrUpdateMcpBridge, config.DeleteMcpBridge)
|
||||
@@ -479,7 +475,7 @@ func (m *IngressConfig) convertVirtualService(configs []common.WrapperConfig) []
|
||||
common.CreateConvertedName(m.clusterId, cleanHost),
|
||||
common.CreateConvertedName(constants.IstioIngressGatewayName, cleanHost)}
|
||||
if host != "*" {
|
||||
gateways = append(gateways, m.globalGatewayName)
|
||||
gateways = append(gateways, m.namespace+"/"+common.CreateConvertedName(m.clusterId, common.CleanHost("*")))
|
||||
}
|
||||
|
||||
wrapperVS, exist := convertOptions.VirtualServices[host]
|
||||
|
||||
@@ -257,7 +257,7 @@ func TestConvertGatewaysForIngress(t *testing.T) {
|
||||
"foo.com": {
|
||||
Meta: config.Meta{
|
||||
GroupVersionKind: gvk.Gateway,
|
||||
Name: "istio-autogenerated-k8s-ingress-foo-com",
|
||||
Name: "istio-autogenerated-k8s-ingress-" + common.CleanHost("foo.com"),
|
||||
Namespace: "wakanda",
|
||||
Annotations: map[string]string{
|
||||
common.ClusterIdAnnotation: "ingress-v1beta1",
|
||||
@@ -270,7 +270,7 @@ func TestConvertGatewaysForIngress(t *testing.T) {
|
||||
Port: &networking.Port{
|
||||
Number: 80,
|
||||
Protocol: "HTTP",
|
||||
Name: "http-80-ingress-ingress-v1beta1-wakanda-test-1-foo-com",
|
||||
Name: "http-80-ingress-ingress-v1beta1",
|
||||
},
|
||||
Hosts: []string{"foo.com"},
|
||||
},
|
||||
@@ -278,7 +278,7 @@ func TestConvertGatewaysForIngress(t *testing.T) {
|
||||
Port: &networking.Port{
|
||||
Number: 443,
|
||||
Protocol: "HTTPS",
|
||||
Name: "https-443-ingress-ingress-v1beta1-wakanda-test-2-foo-com",
|
||||
Name: "https-443-ingress-ingress-v1beta1",
|
||||
},
|
||||
Hosts: []string{"foo.com"},
|
||||
Tls: &networking.ServerTLSSettings{
|
||||
@@ -293,7 +293,7 @@ func TestConvertGatewaysForIngress(t *testing.T) {
|
||||
"test.com": {
|
||||
Meta: config.Meta{
|
||||
GroupVersionKind: gvk.Gateway,
|
||||
Name: "istio-autogenerated-k8s-ingress-test-com",
|
||||
Name: "istio-autogenerated-k8s-ingress-" + common.CleanHost("test.com"),
|
||||
Namespace: "wakanda",
|
||||
Annotations: map[string]string{
|
||||
common.ClusterIdAnnotation: "ingress-v1beta1",
|
||||
@@ -306,7 +306,7 @@ func TestConvertGatewaysForIngress(t *testing.T) {
|
||||
Port: &networking.Port{
|
||||
Number: 80,
|
||||
Protocol: "HTTP",
|
||||
Name: "http-80-ingress-ingress-v1beta1-wakanda-test-1-test-com",
|
||||
Name: "http-80-ingress-ingress-v1beta1",
|
||||
},
|
||||
Hosts: []string{"test.com"},
|
||||
},
|
||||
@@ -314,7 +314,7 @@ func TestConvertGatewaysForIngress(t *testing.T) {
|
||||
Port: &networking.Port{
|
||||
Number: 443,
|
||||
Protocol: "HTTPS",
|
||||
Name: "https-443-ingress-ingress-v1beta1-wakanda-test-1-test-com",
|
||||
Name: "https-443-ingress-ingress-v1beta1",
|
||||
},
|
||||
Hosts: []string{"test.com"},
|
||||
Tls: &networking.ServerTLSSettings{
|
||||
@@ -329,7 +329,7 @@ func TestConvertGatewaysForIngress(t *testing.T) {
|
||||
"bar.com": {
|
||||
Meta: config.Meta{
|
||||
GroupVersionKind: gvk.Gateway,
|
||||
Name: "istio-autogenerated-k8s-ingress-bar-com",
|
||||
Name: "istio-autogenerated-k8s-ingress-" + common.CleanHost("bar.com"),
|
||||
Namespace: "wakanda",
|
||||
Annotations: map[string]string{
|
||||
common.ClusterIdAnnotation: "ingress-v1beta1",
|
||||
@@ -342,7 +342,7 @@ func TestConvertGatewaysForIngress(t *testing.T) {
|
||||
Port: &networking.Port{
|
||||
Number: 80,
|
||||
Protocol: "HTTP",
|
||||
Name: "http-80-ingress-ingress-v1beta1-wakanda-test-2-bar-com",
|
||||
Name: "http-80-ingress-ingress-v1beta1",
|
||||
},
|
||||
Hosts: []string{"bar.com"},
|
||||
},
|
||||
@@ -471,7 +471,7 @@ func TestConvertGatewaysForIngress(t *testing.T) {
|
||||
"foo.com": {
|
||||
Meta: config.Meta{
|
||||
GroupVersionKind: gvk.Gateway,
|
||||
Name: "istio-autogenerated-k8s-ingress-foo-com",
|
||||
Name: "istio-autogenerated-k8s-ingress-" + common.CleanHost("foo.com"),
|
||||
Namespace: "wakanda",
|
||||
Annotations: map[string]string{
|
||||
common.ClusterIdAnnotation: "ingress-v1",
|
||||
@@ -484,7 +484,7 @@ func TestConvertGatewaysForIngress(t *testing.T) {
|
||||
Port: &networking.Port{
|
||||
Number: 80,
|
||||
Protocol: "HTTP",
|
||||
Name: "http-80-ingress-ingress-v1-wakanda-test-1-foo-com",
|
||||
Name: "http-80-ingress-ingress-v1",
|
||||
},
|
||||
Hosts: []string{"foo.com"},
|
||||
},
|
||||
@@ -492,7 +492,7 @@ func TestConvertGatewaysForIngress(t *testing.T) {
|
||||
Port: &networking.Port{
|
||||
Number: 443,
|
||||
Protocol: "HTTPS",
|
||||
Name: "https-443-ingress-ingress-v1-wakanda-test-2-foo-com",
|
||||
Name: "https-443-ingress-ingress-v1",
|
||||
},
|
||||
Hosts: []string{"foo.com"},
|
||||
Tls: &networking.ServerTLSSettings{
|
||||
@@ -507,7 +507,7 @@ func TestConvertGatewaysForIngress(t *testing.T) {
|
||||
"test.com": {
|
||||
Meta: config.Meta{
|
||||
GroupVersionKind: gvk.Gateway,
|
||||
Name: "istio-autogenerated-k8s-ingress-test-com",
|
||||
Name: "istio-autogenerated-k8s-ingress-" + common.CleanHost("test.com"),
|
||||
Namespace: "wakanda",
|
||||
Annotations: map[string]string{
|
||||
common.ClusterIdAnnotation: "ingress-v1",
|
||||
@@ -520,7 +520,7 @@ func TestConvertGatewaysForIngress(t *testing.T) {
|
||||
Port: &networking.Port{
|
||||
Number: 80,
|
||||
Protocol: "HTTP",
|
||||
Name: "http-80-ingress-ingress-v1-wakanda-test-1-test-com",
|
||||
Name: "http-80-ingress-ingress-v1",
|
||||
},
|
||||
Hosts: []string{"test.com"},
|
||||
},
|
||||
@@ -528,7 +528,7 @@ func TestConvertGatewaysForIngress(t *testing.T) {
|
||||
Port: &networking.Port{
|
||||
Number: 443,
|
||||
Protocol: "HTTPS",
|
||||
Name: "https-443-ingress-ingress-v1-wakanda-test-1-test-com",
|
||||
Name: "https-443-ingress-ingress-v1",
|
||||
},
|
||||
Hosts: []string{"test.com"},
|
||||
Tls: &networking.ServerTLSSettings{
|
||||
@@ -543,7 +543,7 @@ func TestConvertGatewaysForIngress(t *testing.T) {
|
||||
"bar.com": {
|
||||
Meta: config.Meta{
|
||||
GroupVersionKind: gvk.Gateway,
|
||||
Name: "istio-autogenerated-k8s-ingress-bar-com",
|
||||
Name: "istio-autogenerated-k8s-ingress-" + common.CleanHost("bar.com"),
|
||||
Namespace: "wakanda",
|
||||
Annotations: map[string]string{
|
||||
common.ClusterIdAnnotation: "ingress-v1",
|
||||
@@ -556,7 +556,7 @@ func TestConvertGatewaysForIngress(t *testing.T) {
|
||||
Port: &networking.Port{
|
||||
Number: 80,
|
||||
Protocol: "HTTP",
|
||||
Name: "http-80-ingress-ingress-v1-wakanda-test-2-bar-com",
|
||||
Name: "http-80-ingress-ingress-v1",
|
||||
},
|
||||
Hosts: []string{"bar.com"},
|
||||
},
|
||||
|
||||
@@ -66,8 +66,6 @@ type KIngressConfig struct {
|
||||
|
||||
annotationHandler annotations.AnnotationHandler
|
||||
|
||||
globalGatewayName string
|
||||
|
||||
namespace string
|
||||
|
||||
clusterId string
|
||||
@@ -86,10 +84,8 @@ func NewKIngressConfig(localKubeClient kube.Client, XDSUpdater model.XDSUpdater,
|
||||
XDSUpdater: XDSUpdater,
|
||||
annotationHandler: annotations.NewAnnotationHandlerManager(),
|
||||
clusterId: clusterId,
|
||||
globalGatewayName: namespace + "/" +
|
||||
common.CreateConvertedName(clusterId, "global"),
|
||||
watchedSecretSet: sets.NewSet(),
|
||||
namespace: namespace,
|
||||
watchedSecretSet: sets.NewSet(),
|
||||
namespace: namespace,
|
||||
}
|
||||
|
||||
return config
|
||||
@@ -319,7 +315,7 @@ func (m *KIngressConfig) convertVirtualService(configs []common.WrapperConfig) [
|
||||
common.CreateConvertedName(m.clusterId, cleanHost),
|
||||
common.CreateConvertedName(constants.IstioIngressGatewayName, cleanHost)}
|
||||
if host != "*" {
|
||||
gateways = append(gateways, m.globalGatewayName)
|
||||
gateways = append(gateways, m.namespace+"/"+common.CreateConvertedName(m.clusterId, common.CleanHost("*")))
|
||||
}
|
||||
|
||||
wrapperVS, exist := convertOptions.VirtualServices[host]
|
||||
|
||||
@@ -363,7 +363,7 @@ func TestConvertGatewaysForKIngress(t *testing.T) {
|
||||
"foo.com": {
|
||||
Meta: config.Meta{
|
||||
GroupVersionKind: gvk.Gateway,
|
||||
Name: "istio-autogenerated-k8s-ingress-foo-com",
|
||||
Name: "istio-autogenerated-k8s-ingress-" + common.CleanHost("foo.com"),
|
||||
Namespace: "wakanda",
|
||||
Annotations: map[string]string{
|
||||
common.ClusterIdAnnotation: "kingress",
|
||||
@@ -376,7 +376,7 @@ func TestConvertGatewaysForKIngress(t *testing.T) {
|
||||
Port: &networking.Port{
|
||||
Number: 80,
|
||||
Protocol: "HTTP",
|
||||
Name: "http-80-ingress-kingress-wakanda-test-1-foo-com",
|
||||
Name: "http-80-ingress-kingress",
|
||||
},
|
||||
Hosts: []string{"foo.com"},
|
||||
//Tls: &networking.ServerTLSSettings{
|
||||
@@ -387,7 +387,7 @@ func TestConvertGatewaysForKIngress(t *testing.T) {
|
||||
Port: &networking.Port{
|
||||
Number: 443,
|
||||
Protocol: "HTTPS",
|
||||
Name: "https-443-ingress-kingress-wakanda-test-2-foo-com",
|
||||
Name: "https-443-ingress-kingress",
|
||||
},
|
||||
Hosts: []string{"foo.com"},
|
||||
Tls: &networking.ServerTLSSettings{
|
||||
@@ -402,7 +402,7 @@ func TestConvertGatewaysForKIngress(t *testing.T) {
|
||||
"test.com": {
|
||||
Meta: config.Meta{
|
||||
GroupVersionKind: gvk.Gateway,
|
||||
Name: "istio-autogenerated-k8s-ingress-test-com",
|
||||
Name: "istio-autogenerated-k8s-ingress-" + common.CleanHost("test.com"),
|
||||
Namespace: "wakanda",
|
||||
Annotations: map[string]string{
|
||||
common.ClusterIdAnnotation: "kingress",
|
||||
@@ -415,7 +415,7 @@ func TestConvertGatewaysForKIngress(t *testing.T) {
|
||||
Port: &networking.Port{
|
||||
Number: 80,
|
||||
Protocol: "HTTP",
|
||||
Name: "http-80-ingress-kingress-wakanda-test-1-test-com",
|
||||
Name: "http-80-ingress-kingress",
|
||||
},
|
||||
Hosts: []string{"test.com"},
|
||||
//Tls: &networking.ServerTLSSettings{
|
||||
@@ -426,7 +426,7 @@ func TestConvertGatewaysForKIngress(t *testing.T) {
|
||||
Port: &networking.Port{
|
||||
Number: 443,
|
||||
Protocol: "HTTPS",
|
||||
Name: "https-443-ingress-kingress-wakanda-test-1-test-com",
|
||||
Name: "https-443-ingress-kingress",
|
||||
},
|
||||
Hosts: []string{"test.com"},
|
||||
Tls: &networking.ServerTLSSettings{
|
||||
@@ -441,7 +441,7 @@ func TestConvertGatewaysForKIngress(t *testing.T) {
|
||||
"bar.com": {
|
||||
Meta: config.Meta{
|
||||
GroupVersionKind: gvk.Gateway,
|
||||
Name: "istio-autogenerated-k8s-ingress-bar-com",
|
||||
Name: "istio-autogenerated-k8s-ingress-" + common.CleanHost("bar.com"),
|
||||
Namespace: "wakanda",
|
||||
Annotations: map[string]string{
|
||||
common.ClusterIdAnnotation: "kingress",
|
||||
@@ -454,7 +454,7 @@ func TestConvertGatewaysForKIngress(t *testing.T) {
|
||||
Port: &networking.Port{
|
||||
Number: 80,
|
||||
Protocol: "HTTP",
|
||||
Name: "http-80-ingress-kingress-wakanda-test-2-bar-com",
|
||||
Name: "http-80-ingress-kingress",
|
||||
},
|
||||
Hosts: []string{"bar.com"},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user