mirror of
https://github.com/kubevela/kubevela.git
synced 2026-08-19 04:26:39 +00:00
Feat: support HTTPRoute to generate endpoint (#4378)
* Feat: support HTTPRoute to generate endpoint Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Feat: print the inner in CLI Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: change the comment Signed-off-by: barnettZQG <barnett.zqg@gmail.com>
This commit is contained in:
@@ -70,6 +70,8 @@ const (
|
||||
AnnoIngressControllerHTTPSPort = "ingress.controller/https-port"
|
||||
// AnnoIngressControllerHTTPPort define ingress controller listen port for http
|
||||
AnnoIngressControllerHTTPPort = "ingress.controller/http-port"
|
||||
// AnnoIngressControllerHost define ingress controller externally host
|
||||
AnnoIngressControllerHost = "ingress.controller/host"
|
||||
// LabelConfigType is the label for config type
|
||||
LabelConfigType = "config.oam.dev/type"
|
||||
// LabelConfigCatalog is the label for config catalog
|
||||
|
||||
@@ -38,6 +38,9 @@ spec:
|
||||
if !parameter.classInSpec {
|
||||
"kubernetes.io/ingress.class": parameter.class
|
||||
}
|
||||
if parameter.gatewayHost != _|_ {
|
||||
"ingress.controller/host": parameter.gatewayHost
|
||||
}
|
||||
}
|
||||
}
|
||||
spec: {
|
||||
@@ -84,6 +87,9 @@ spec:
|
||||
|
||||
// +usage=Specify the secret name you want to quote.
|
||||
secretName?: string
|
||||
|
||||
// +usage=Specify the host of the ingress gateway, which is used to generate the endpoints when the host is empty.
|
||||
gatewayHost?: string
|
||||
}
|
||||
status:
|
||||
customStatus: |-
|
||||
|
||||
@@ -329,8 +329,8 @@ spec:
|
||||
}]
|
||||
|
||||
// +ignore
|
||||
// +usage=Specify what kind of Service you want. options: "ClusterIP", "NodePort", "LoadBalancer", "ExternalName"
|
||||
exposeType: *"ClusterIP" | "NodePort" | "LoadBalancer" | "ExternalName"
|
||||
// +usage=Specify what kind of Service you want. options: "ClusterIP", "NodePort", "LoadBalancer"
|
||||
exposeType: *"ClusterIP" | "NodePort" | "LoadBalancer"
|
||||
|
||||
// +ignore
|
||||
// +usage=If addRevisionLabel is true, the revision label will be added to the underlying pods
|
||||
|
||||
@@ -38,6 +38,9 @@ spec:
|
||||
if !parameter.classInSpec {
|
||||
"kubernetes.io/ingress.class": parameter.class
|
||||
}
|
||||
if parameter.gatewayHost != _|_ {
|
||||
"ingress.controller/host": parameter.gatewayHost
|
||||
}
|
||||
}
|
||||
}
|
||||
spec: {
|
||||
@@ -84,6 +87,9 @@ spec:
|
||||
|
||||
// +usage=Specify the secret name you want to quote.
|
||||
secretName?: string
|
||||
|
||||
// +usage=Specify the host of the ingress gateway, which is used to generate the endpoints when the host is empty.
|
||||
gatewayHost?: string
|
||||
}
|
||||
status:
|
||||
customStatus: |-
|
||||
|
||||
@@ -329,8 +329,8 @@ spec:
|
||||
}]
|
||||
|
||||
// +ignore
|
||||
// +usage=Specify what kind of Service you want. options: "ClusterIP", "NodePort", "LoadBalancer", "ExternalName"
|
||||
exposeType: *"ClusterIP" | "NodePort" | "LoadBalancer" | "ExternalName"
|
||||
// +usage=Specify what kind of Service you want. options: "ClusterIP", "NodePort", "LoadBalancer"
|
||||
exposeType: *"ClusterIP" | "NodePort" | "LoadBalancer"
|
||||
|
||||
// +ignore
|
||||
// +usage=If addRevisionLabel is true, the revision label will be added to the underlying pods
|
||||
|
||||
@@ -121,6 +121,7 @@ require (
|
||||
golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e // indirect
|
||||
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 // indirect
|
||||
google.golang.org/protobuf v1.28.0 // indirect
|
||||
sigs.k8s.io/gateway-api v0.4.3
|
||||
)
|
||||
|
||||
require (
|
||||
|
||||
@@ -220,6 +220,7 @@ github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki
|
||||
github.com/agiledragon/gomonkey/v2 v2.4.0 h1:YDQJYiSQ8o78dCMXehU1E4F/Kh4jPX+MV+/iK/yfL7s=
|
||||
github.com/agiledragon/gomonkey/v2 v2.4.0/go.mod h1:ap1AmDzcVOAz1YpeJ3TCzIgstoaWLA6jbbgxfB4w2iY=
|
||||
github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM=
|
||||
github.com/ahmetb/gen-crd-api-reference-docs v0.3.0/go.mod h1:TdjdkYhlOifCQWPs1UdTma97kQQMozf5h26hTuG70u8=
|
||||
github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=
|
||||
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7 h1:uSoVVbwJiQipAclBbw+8quDsfcvFjOpI5iCf4p/cqCs=
|
||||
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs=
|
||||
@@ -3256,6 +3257,7 @@ k8s.io/code-generator v0.20.10/go.mod h1:i6FmG+QxaLxvJsezvZp0q/gAEzzOz3U53KFibgh
|
||||
k8s.io/code-generator v0.20.10/go.mod h1:i6FmG+QxaLxvJsezvZp0q/gAEzzOz3U53KFibghWToU=
|
||||
k8s.io/code-generator v0.21.2/go.mod h1:8mXJDCB7HcRo1xiEQstcguZkbxZaqeUOrO9SsicWs3U=
|
||||
k8s.io/code-generator v0.21.3/go.mod h1:K3y0Bv9Cz2cOW2vXUrNZlFbflhuPvuadW6JdnN6gGKo=
|
||||
k8s.io/code-generator v0.22.0/go.mod h1:eV77Y09IopzeXOJzndrDyCI88UBok2h6WxAlBwpxa+o=
|
||||
k8s.io/code-generator v0.22.1/go.mod h1:eV77Y09IopzeXOJzndrDyCI88UBok2h6WxAlBwpxa+o=
|
||||
k8s.io/code-generator v0.22.2/go.mod h1:eV77Y09IopzeXOJzndrDyCI88UBok2h6WxAlBwpxa+o=
|
||||
k8s.io/code-generator v0.22.4/go.mod h1:qjYl54pQ/emhkT0UxbufbREYJMWsHNNV/jSVwhYZQGw=
|
||||
@@ -3300,11 +3302,13 @@ k8s.io/gengo v0.0.0-20190822140433-26a664648505/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8
|
||||
k8s.io/gengo v0.0.0-20200114144118-36b2048a9120/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
|
||||
k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
|
||||
k8s.io/gengo v0.0.0-20201113003025-83324d819ded/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
|
||||
k8s.io/gengo v0.0.0-20201203183100-97869a43a9d9/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
|
||||
k8s.io/gengo v0.0.0-20201214224949-b6c5ce23f027/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
|
||||
k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
|
||||
k8s.io/helm v2.17.0+incompatible h1:Bpn6o1wKLYqKM3+Osh8e+1/K2g/GsQJ4F4yNF2+deao=
|
||||
k8s.io/helm v2.17.0+incompatible/go.mod h1:LZzlS4LQBHfciFOurYBFkCMTaZ0D1l+p0teMg7TSULI=
|
||||
k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
|
||||
k8s.io/klog v0.2.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
|
||||
k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
|
||||
k8s.io/klog v0.3.1/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
|
||||
k8s.io/klog v0.4.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I=
|
||||
@@ -3315,6 +3319,7 @@ k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
|
||||
k8s.io/klog/v2 v2.4.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
|
||||
k8s.io/klog/v2 v2.8.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec=
|
||||
k8s.io/klog/v2 v2.9.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec=
|
||||
k8s.io/klog/v2 v2.10.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec=
|
||||
k8s.io/klog/v2 v2.30.0/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
k8s.io/klog/v2 v2.60.1 h1:VW25q3bZx9uE3vvdL6M8ezOX79vA2Aq1nEWLqNQclHc=
|
||||
k8s.io/klog/v2 v2.60.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||
@@ -3363,6 +3368,7 @@ k8s.io/utils v0.0.0-20210722164352-7f3ee0f31471/go.mod h1:jPW/WVKK9YHAvNhRxK0md/
|
||||
k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
|
||||
k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
|
||||
k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
|
||||
k8s.io/utils v0.0.0-20210820185131-d34e5cb4466e/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
|
||||
k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
|
||||
k8s.io/utils v0.0.0-20211116205334-6203023598ed/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
|
||||
k8s.io/utils v0.0.0-20211208161948-7d6a63dca704/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
|
||||
@@ -3406,6 +3412,7 @@ sigs.k8s.io/controller-runtime v0.6.0/go.mod h1:CpYf5pdNY/B352A1TFLAS2JVSlnGQ5O2
|
||||
sigs.k8s.io/controller-runtime v0.6.2/go.mod h1:vhcq/rlnENJ09SIRp3EveTaZ0yqH526hjf9iJdbUJ/E=
|
||||
sigs.k8s.io/controller-runtime v0.9.2/go.mod h1:TxzMCHyEUpaeuOiZx/bIdc2T81vfs/aKdvJt9wuu0zk=
|
||||
sigs.k8s.io/controller-runtime v0.9.5/go.mod h1:q6PpkM5vqQubEKUKOM6qr06oXGzOBcCby1DA9FbyZeA=
|
||||
sigs.k8s.io/controller-runtime v0.9.6/go.mod h1:q6PpkM5vqQubEKUKOM6qr06oXGzOBcCby1DA9FbyZeA=
|
||||
sigs.k8s.io/controller-runtime v0.10.3/go.mod h1:CQp8eyUQZ/Q7PJvnIrB6/hgfTC1kBkGylwsLgOQi1WY=
|
||||
sigs.k8s.io/controller-runtime v0.11.0/go.mod h1:KKwLiTooNGu+JmLZGn9Sl3Gjmfj66eMbCQznLP5zcqA=
|
||||
sigs.k8s.io/controller-runtime v0.11.1/go.mod h1:KKwLiTooNGu+JmLZGn9Sl3Gjmfj66eMbCQznLP5zcqA=
|
||||
@@ -3415,6 +3422,8 @@ sigs.k8s.io/controller-tools v0.2.4/go.mod h1:m/ztfQNocGYBgTTCmFdnK94uVvgxeZeE3L
|
||||
sigs.k8s.io/controller-tools v0.2.8/go.mod h1:9VKHPszmf2DHz/QmHkcfZoewO6BL7pPs9uAiBVsaJSE=
|
||||
sigs.k8s.io/controller-tools v0.6.2 h1:+Y8L0UsAugDipGRw8lrkPoAi6XqlQVZuf1DQHME3PgU=
|
||||
sigs.k8s.io/controller-tools v0.6.2/go.mod h1:oaeGpjXn6+ZSEIQkUe/+3I40PNiDYp9aeawbt3xTgJ8=
|
||||
sigs.k8s.io/gateway-api v0.4.3 h1:9kdHAcfkyP7jVMSFshc8EYEKNLlFM7hbZL8vCKcMwps=
|
||||
sigs.k8s.io/gateway-api v0.4.3/go.mod h1:r3eiNP+0el+NTLwaTfOrCNXy8TukC+dIM3ggc+fbNWk=
|
||||
sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6/go.mod h1:p4QtZmO4uMYipTQNzagwnNoseA6OxSUutVw05NhYDRs=
|
||||
sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 h1:kDi4JBNAsJWfz1aEXhO8Jg87JJaPNLh5tIzYHgStQ9Y=
|
||||
sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2/go.mod h1:B+TnT182UBxE84DiCz4CVE26eOSDAeYCpfDnC2kdKMY=
|
||||
|
||||
@@ -119,6 +119,7 @@
|
||||
host?: string
|
||||
port: int
|
||||
path?: string
|
||||
inner?: bool
|
||||
}
|
||||
ref: {...}
|
||||
cluster?: string
|
||||
|
||||
@@ -58,6 +58,7 @@ import (
|
||||
ocmworkv1 "open-cluster-management.io/api/work/v1"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client/config"
|
||||
gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
|
||||
"sigs.k8s.io/yaml"
|
||||
|
||||
prismclusterv1alpha1 "github.com/kubevela/prism/pkg/apis/cluster/v1alpha1"
|
||||
@@ -110,6 +111,7 @@ func init() {
|
||||
_ = kruisev1alpha1.AddToScheme(Scheme)
|
||||
_ = prismclusterv1alpha1.AddToScheme(Scheme)
|
||||
_ = cloudshellv1alpha1.AddToScheme(Scheme)
|
||||
_ = gatewayv1alpha2.AddToScheme(Scheme)
|
||||
// +kubebuilder:scaffold:scheme
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ func (c *AppCollector) CollectResourceFromApp() ([]Resource, error) {
|
||||
}
|
||||
|
||||
// ListApplicationResources list application applied resources from tracker
|
||||
func (c *AppCollector) ListApplicationResources(app *v1beta1.Application) ([]*types.AppliedResource, error) {
|
||||
func (c *AppCollector) ListApplicationResources(app *v1beta1.Application, queryTree bool) ([]*types.AppliedResource, error) {
|
||||
ctx := context.Background()
|
||||
rootRT, currentRT, historyRTs, _, err := resourcetracker.ListApplicationResourceTrackers(ctx, c.k8sClient, app)
|
||||
if err != nil {
|
||||
@@ -129,6 +129,10 @@ func (c *AppCollector) ListApplicationResources(app *v1beta1.Application) ([]*ty
|
||||
}
|
||||
}
|
||||
|
||||
if !queryTree {
|
||||
return managedResources, nil
|
||||
}
|
||||
|
||||
// merge user defined customize rule before every request.
|
||||
err = mergeCustomRules(ctx, c.k8sClient)
|
||||
if err != nil {
|
||||
@@ -566,7 +570,7 @@ func isResourceInTargetCluster(opt FilterOption, resource common.ClusterObjectRe
|
||||
}
|
||||
|
||||
func isResourceInTargetComponent(opt FilterOption, componentName string) bool {
|
||||
if len(opt.Components) == 0 && len(componentName) != 0 {
|
||||
if len(opt.Components) == 0 {
|
||||
return true
|
||||
}
|
||||
for _, component := range opt.Components {
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
@@ -30,9 +31,11 @@ import (
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/klog"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1beta1"
|
||||
apis "github.com/oam-dev/kubevela/apis/types"
|
||||
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
|
||||
helmapi "github.com/oam-dev/kubevela/pkg/appfile/helm/flux2apis"
|
||||
"github.com/oam-dev/kubevela/pkg/cue/model/value"
|
||||
"github.com/oam-dev/kubevela/pkg/multicluster"
|
||||
@@ -64,7 +67,7 @@ func (h *provider) GeneratorServiceEndpoints(wfctx wfContext.Context, v *value.V
|
||||
serviceEndpoints := make([]querytypes.ServiceEndpoint, 0)
|
||||
var clusterGatewayNodeIP = make(map[string]string)
|
||||
collector := NewAppCollector(h.cli, opt)
|
||||
resources, err := collector.ListApplicationResources(app)
|
||||
resources, err := collector.ListApplicationResources(app, true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -80,7 +83,11 @@ func (h *provider) GeneratorServiceEndpoints(wfctx wfContext.Context, v *value.V
|
||||
}
|
||||
return ip
|
||||
}
|
||||
serviceEndpoints = append(serviceEndpoints, getEndpointFromNode(ctx, h.cli, resource.ResourceTree, resource.Component, cachedSelectorNodeIP)...)
|
||||
if resource.ResourceTree != nil {
|
||||
serviceEndpoints = append(serviceEndpoints, getEndpointFromNode(ctx, h.cli, resource.ResourceTree, resource.Component, cachedSelectorNodeIP)...)
|
||||
} else {
|
||||
serviceEndpoints = append(serviceEndpoints, getServiceEndpoints(ctx, h.cli, resource.GroupVersionKind(), resource.Name, resource.Namespace, resource.Cluster, resource.Component, cachedSelectorNodeIP)...)
|
||||
}
|
||||
}
|
||||
return fillQueryResult(v, serviceEndpoints, "list")
|
||||
}
|
||||
@@ -170,6 +177,14 @@ func getServiceEndpoints(ctx context.Context, cli client.Client, gvk schema.Grou
|
||||
return nil
|
||||
}
|
||||
serviceEndpoints = append(serviceEndpoints, generatorFromService(service, cachedSelectorNodeIP, cluster, component, fmt.Sprintf("/seldon/%s/%s", namespace, name))...)
|
||||
case "HTTPRoute":
|
||||
var route gatewayv1alpha2.HTTPRoute
|
||||
route.SetGroupVersionKind(gvk)
|
||||
if err := findResource(ctx, cli, &route, name, namespace, cluster); err != nil {
|
||||
klog.Error(err, fmt.Sprintf("find HTTPRoute %s/%s from cluster %s failure", name, namespace, cluster))
|
||||
return nil
|
||||
}
|
||||
serviceEndpoints = append(serviceEndpoints, generatorFromHTTPRoute(ctx, cli, route, cluster, component)...)
|
||||
}
|
||||
return serviceEndpoints
|
||||
}
|
||||
@@ -201,7 +216,7 @@ func generatorFromService(service corev1.Service, selectorNodeIP func() string,
|
||||
ResourceVersion: service.ResourceVersion,
|
||||
}
|
||||
|
||||
formatEndpoint := func(host, appProtocol string, portProtocol corev1.Protocol, portNum int32) querytypes.ServiceEndpoint {
|
||||
formatEndpoint := func(host, appProtocol string, portProtocol corev1.Protocol, portNum int32, inner bool) querytypes.ServiceEndpoint {
|
||||
return querytypes.ServiceEndpoint{
|
||||
Endpoint: querytypes.Endpoint{
|
||||
Protocol: portProtocol,
|
||||
@@ -209,6 +224,7 @@ func generatorFromService(service corev1.Service, selectorNodeIP func() string,
|
||||
Host: host,
|
||||
Port: int(portNum),
|
||||
Path: path,
|
||||
Inner: inner,
|
||||
},
|
||||
Ref: objRef,
|
||||
Cluster: cluster,
|
||||
@@ -221,22 +237,22 @@ func generatorFromService(service corev1.Service, selectorNodeIP func() string,
|
||||
appp := judgeAppProtocol(port.Port)
|
||||
for _, ingress := range service.Status.LoadBalancer.Ingress {
|
||||
if ingress.Hostname != "" {
|
||||
serviceEndpoints = append(serviceEndpoints, formatEndpoint(ingress.Hostname, appp, port.Protocol, port.Port))
|
||||
serviceEndpoints = append(serviceEndpoints, formatEndpoint(ingress.Hostname, appp, port.Protocol, port.Port, false))
|
||||
}
|
||||
if ingress.IP != "" {
|
||||
serviceEndpoints = append(serviceEndpoints, formatEndpoint(ingress.IP, appp, port.Protocol, port.Port))
|
||||
serviceEndpoints = append(serviceEndpoints, formatEndpoint(ingress.IP, appp, port.Protocol, port.Port, false))
|
||||
}
|
||||
}
|
||||
}
|
||||
case corev1.ServiceTypeNodePort:
|
||||
for _, port := range service.Spec.Ports {
|
||||
appp := judgeAppProtocol(port.Port)
|
||||
serviceEndpoints = append(serviceEndpoints, formatEndpoint(selectorNodeIP(), appp, port.Protocol, port.NodePort))
|
||||
serviceEndpoints = append(serviceEndpoints, formatEndpoint(selectorNodeIP(), appp, port.Protocol, port.NodePort, false))
|
||||
}
|
||||
case corev1.ServiceTypeClusterIP, corev1.ServiceTypeExternalName:
|
||||
for _, port := range service.Spec.Ports {
|
||||
appp := judgeAppProtocol(port.Port)
|
||||
serviceEndpoints = append(serviceEndpoints, formatEndpoint(fmt.Sprintf("%s.%s", service.Name, service.Namespace), appp, port.Protocol, port.Port))
|
||||
serviceEndpoints = append(serviceEndpoints, formatEndpoint(fmt.Sprintf("%s.%s", service.Name, service.Namespace), appp, port.Protocol, port.Port, true))
|
||||
}
|
||||
}
|
||||
return serviceEndpoints
|
||||
@@ -254,7 +270,7 @@ func generatorFromIngress(ingress networkv1beta1.Ingress, cluster, component str
|
||||
}
|
||||
}
|
||||
}
|
||||
return "http"
|
||||
return querytypes.HTTP
|
||||
}
|
||||
// It depends on the Ingress Controller
|
||||
getEndpointPort := func(appProtocol string) int {
|
||||
@@ -269,6 +285,15 @@ func generatorFromIngress(ingress networkv1beta1.Ingress, cluster, component str
|
||||
}
|
||||
return 80
|
||||
}
|
||||
|
||||
// The host in rule maybe empty, means access the application by the Gateway Host(IP)
|
||||
getHost := func(host string) string {
|
||||
if host != "" {
|
||||
return host
|
||||
}
|
||||
return ingress.Annotations[apis.AnnoIngressControllerHost]
|
||||
}
|
||||
|
||||
for _, rule := range ingress.Spec.Rules {
|
||||
var appProtocol = getAppProtocol(rule.Host)
|
||||
var appPort = getEndpointPort(appProtocol)
|
||||
@@ -278,7 +303,7 @@ func generatorFromIngress(ingress networkv1beta1.Ingress, cluster, component str
|
||||
Endpoint: querytypes.Endpoint{
|
||||
Protocol: corev1.ProtocolTCP,
|
||||
AppProtocol: &appProtocol,
|
||||
Host: rule.Host,
|
||||
Host: getHost(rule.Host),
|
||||
Path: path.Path,
|
||||
Port: appPort,
|
||||
},
|
||||
@@ -299,6 +324,87 @@ func generatorFromIngress(ingress networkv1beta1.Ingress, cluster, component str
|
||||
return serviceEndpoints
|
||||
}
|
||||
|
||||
func getGatewayPortAndProtocol(ctx context.Context, cli client.Client, defaultNamespace, cluster string, parents []gatewayv1alpha2.ParentRef) (string, int) {
|
||||
for _, parent := range parents {
|
||||
if parent.Kind != nil && *parent.Kind == "Gateway" {
|
||||
var gateway gatewayv1alpha2.Gateway
|
||||
namespace := defaultNamespace
|
||||
if parent.Namespace != nil {
|
||||
namespace = string(*parent.Namespace)
|
||||
}
|
||||
if err := findResource(ctx, cli, &gateway, string(parent.Name), namespace, cluster); err != nil {
|
||||
log.Logger.Errorf("query the Gateway %s/%s/%s failure %s", cluster, namespace, string(parent.Name), err.Error())
|
||||
}
|
||||
for _, listener := range gateway.Spec.Listeners {
|
||||
if listener.Name == *parent.SectionName {
|
||||
var protocol = querytypes.HTTP
|
||||
if listener.Protocol == gatewayv1alpha2.HTTPSProtocolType {
|
||||
protocol = querytypes.HTTPS
|
||||
}
|
||||
var port = int(listener.Port)
|
||||
// The gateway listener port may not be the externally exposed port.
|
||||
// For example, the traefik addon has a default port mapping configuration of 8443->443 8000->80
|
||||
// So users could set the `ports-mapping` annotation.
|
||||
if mapping := gateway.Annotations["ports-mapping"]; mapping != "" {
|
||||
fmt.Println(mapping)
|
||||
for _, portItem := range strings.Split(mapping, ",") {
|
||||
if portMap := strings.Split(portItem, ":"); len(portMap) == 2 {
|
||||
if portMap[0] == fmt.Sprintf("%d", listener.Port) {
|
||||
newPort, err := strconv.Atoi(portMap[1])
|
||||
if err == nil {
|
||||
port = newPort
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return protocol, port
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return querytypes.HTTP, 80
|
||||
}
|
||||
|
||||
func generatorFromHTTPRoute(ctx context.Context, cli client.Client, route gatewayv1alpha2.HTTPRoute, cluster, component string) []querytypes.ServiceEndpoint {
|
||||
existPath := make(map[string]bool)
|
||||
var serviceEndpoints []querytypes.ServiceEndpoint
|
||||
for _, rule := range route.Spec.Rules {
|
||||
for _, host := range route.Spec.Hostnames {
|
||||
appProtocol, appPort := getGatewayPortAndProtocol(ctx, cli, route.Namespace, cluster, route.Spec.ParentRefs)
|
||||
for _, match := range rule.Matches {
|
||||
path := ""
|
||||
if match.Path != nil && (match.Path.Type == nil || string(*match.Path.Type) == string(gatewayv1alpha2.PathMatchPathPrefix)) {
|
||||
path = *match.Path.Value
|
||||
}
|
||||
if !existPath[path] {
|
||||
existPath[path] = true
|
||||
serviceEndpoints = append(serviceEndpoints, querytypes.ServiceEndpoint{
|
||||
Endpoint: querytypes.Endpoint{
|
||||
Protocol: corev1.ProtocolTCP,
|
||||
AppProtocol: &appProtocol,
|
||||
Host: string(host),
|
||||
Path: path,
|
||||
Port: appPort,
|
||||
},
|
||||
Ref: corev1.ObjectReference{
|
||||
Kind: route.Kind,
|
||||
Namespace: route.ObjectMeta.Namespace,
|
||||
Name: route.ObjectMeta.Name,
|
||||
UID: route.UID,
|
||||
APIVersion: route.APIVersion,
|
||||
ResourceVersion: route.ResourceVersion,
|
||||
},
|
||||
Cluster: cluster,
|
||||
Component: component,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return serviceEndpoints
|
||||
}
|
||||
|
||||
func selectorNodeIP(ctx context.Context, clusterName string, client client.Client) string {
|
||||
ctx, cancel := context.WithTimeout(ctx, time.Second*10)
|
||||
defer cancel()
|
||||
|
||||
@@ -125,7 +125,7 @@ func (h *provider) ListAppliedResources(ctx wfContext.Context, v *value.Value, a
|
||||
if err = h.cli.Get(context.Background(), appKey, app); err != nil {
|
||||
return v.FillObject(err.Error(), "err")
|
||||
}
|
||||
appResList, err := collector.ListApplicationResources(app)
|
||||
appResList, err := collector.ListApplicationResources(app, false)
|
||||
if err != nil {
|
||||
return v.FillObject(err.Error(), "err")
|
||||
}
|
||||
@@ -151,7 +151,7 @@ func (h *provider) GetApplicationResourceTree(ctx wfContext.Context, v *value.Va
|
||||
if err = h.cli.Get(context.Background(), appKey, app); err != nil {
|
||||
return v.FillObject(err.Error(), "err")
|
||||
}
|
||||
appResList, err := collector.ListApplicationResources(app)
|
||||
appResList, err := collector.ListApplicationResources(app, true)
|
||||
if err != nil {
|
||||
return v.FillObject(err.Error(), "err")
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"time"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
@@ -634,6 +635,15 @@ options: {
|
||||
Name: "sdep",
|
||||
},
|
||||
},
|
||||
{
|
||||
Cluster: "",
|
||||
ObjectReference: corev1.ObjectReference{
|
||||
APIVersion: "gateway.networking.k8s.io/v1alpha2",
|
||||
Kind: "HTTPRoute",
|
||||
Namespace: "default",
|
||||
Name: "http-test-route",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
testApp := &v1beta1.Application{
|
||||
@@ -683,7 +693,7 @@ options: {
|
||||
err = k8sClient.Create(context.TODO(), rt)
|
||||
Expect(err).Should(BeNil())
|
||||
|
||||
testServicelist := []map[string]interface{}{
|
||||
testServiceList := []map[string]interface{}{
|
||||
{
|
||||
"name": "clusterip",
|
||||
"ports": []corev1.ServicePort{
|
||||
@@ -753,7 +763,7 @@ options: {
|
||||
},
|
||||
})
|
||||
Expect(err).Should(SatisfyAny(BeNil(), util.AlreadyExistMatcher{}))
|
||||
for _, s := range testServicelist {
|
||||
for _, s := range testServiceList {
|
||||
ns := "default"
|
||||
if s["namespace"] != nil {
|
||||
ns = s["namespace"].(string)
|
||||
@@ -937,6 +947,22 @@ options: {
|
||||
err = k8sClient.Create(context.TODO(), obj)
|
||||
Expect(err).Should(BeNil())
|
||||
|
||||
// Create the HTTPRoute for test
|
||||
routeData, err := ioutil.ReadFile("./testdata/gateway/http-route.yaml")
|
||||
Expect(err).Should(BeNil())
|
||||
gatewayData, err := ioutil.ReadFile("./testdata/gateway/gateway.yaml")
|
||||
Expect(err).Should(BeNil())
|
||||
var route unstructured.Unstructured
|
||||
err = yaml.Unmarshal(routeData, &route)
|
||||
Expect(err).Should(BeNil())
|
||||
var gateway unstructured.Unstructured
|
||||
err = yaml.Unmarshal(gatewayData, &gateway)
|
||||
Expect(err).Should(BeNil())
|
||||
for _, res := range []client.Object{&route, &gateway} {
|
||||
err := k8sClient.Create(context.TODO(), res)
|
||||
Expect(err).Should(BeNil())
|
||||
}
|
||||
|
||||
opt := `app: {
|
||||
name: "endpoints-app"
|
||||
namespace: "default"
|
||||
@@ -952,18 +978,7 @@ options: {
|
||||
}
|
||||
err = pr.GeneratorServiceEndpoints(nil, v, nil)
|
||||
Expect(err).Should(BeNil())
|
||||
var node corev1.NodeList
|
||||
err = k8sClient.List(context.TODO(), &node)
|
||||
Expect(err).Should(BeNil())
|
||||
var gatewayIP string
|
||||
if len(node.Items) > 0 {
|
||||
for _, address := range node.Items[0].Status.Addresses {
|
||||
if address.Type == corev1.NodeInternalIP {
|
||||
gatewayIP = address.Address
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
gatewayIP := selectorNodeIP(ctx, "", k8sClient)
|
||||
urls := []string{
|
||||
"http://ingress.domain",
|
||||
"https://ingress.domain.https",
|
||||
@@ -974,7 +989,11 @@ options: {
|
||||
"http://text.example.com",
|
||||
"10.10.10.10:81",
|
||||
"text.example.com:81",
|
||||
fmt.Sprintf("http://%s:30002", gatewayIP),
|
||||
"http://ingress.domain.helm",
|
||||
"http://1.1.1.1/seldon/default/sdep",
|
||||
"http://gateway.domain",
|
||||
"http://gateway.domain/api",
|
||||
}
|
||||
endValue, err := v.Field("list")
|
||||
Expect(err).Should(BeNil())
|
||||
|
||||
@@ -44,7 +44,11 @@ var _ = BeforeSuite(func(done Done) {
|
||||
ControlPlaneStartTimeout: time.Minute * 3,
|
||||
ControlPlaneStopTimeout: time.Minute,
|
||||
UseExistingCluster: pointer.BoolPtr(false),
|
||||
CRDDirectoryPaths: []string{"../../../../charts/vela-core/crds", "./testdata/machinelearning.seldon.io_seldondeployments.yaml"},
|
||||
CRDDirectoryPaths: []string{
|
||||
"./testdata/gateway/crds",
|
||||
"../../../../charts/vela-core/crds",
|
||||
"./testdata/machinelearning.seldon.io_seldondeployments.yaml",
|
||||
},
|
||||
}
|
||||
|
||||
By("start kube test env")
|
||||
|
||||
+717
@@ -0,0 +1,717 @@
|
||||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
api-approved.kubernetes.io: https://github.com/kubernetes-sigs/gateway-api/pull/891
|
||||
creationTimestamp: null
|
||||
name: gateways.gateway.networking.k8s.io
|
||||
spec:
|
||||
group: gateway.networking.k8s.io
|
||||
names:
|
||||
categories:
|
||||
- gateway-api
|
||||
kind: Gateway
|
||||
listKind: GatewayList
|
||||
plural: gateways
|
||||
shortNames:
|
||||
- gtw
|
||||
singular: gateway
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- additionalPrinterColumns:
|
||||
- jsonPath: .spec.gatewayClassName
|
||||
name: Class
|
||||
type: string
|
||||
- jsonPath: .status.addresses[*].value
|
||||
name: Address
|
||||
type: string
|
||||
- jsonPath: .status.conditions[?(@.type=="Ready")].status
|
||||
name: Ready
|
||||
type: string
|
||||
- jsonPath: .metadata.creationTimestamp
|
||||
name: Age
|
||||
type: date
|
||||
name: v1alpha2
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
description: Gateway represents an instance of a service-traffic handling
|
||||
infrastructure by binding Listeners to a set of IP addresses.
|
||||
properties:
|
||||
apiVersion:
|
||||
description: 'APIVersion defines the versioned schema of this representation
|
||||
of an object. Servers should convert recognized schemas to the latest
|
||||
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
|
||||
type: string
|
||||
kind:
|
||||
description: 'Kind is a string value representing the REST resource this
|
||||
object represents. Servers may infer this from the endpoint the client
|
||||
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
|
||||
type: string
|
||||
metadata:
|
||||
type: object
|
||||
spec:
|
||||
description: Spec defines the desired state of Gateway.
|
||||
properties:
|
||||
addresses:
|
||||
description: "Addresses requested for this Gateway. This is optional
|
||||
and behavior can depend on the implementation. If a value is set
|
||||
in the spec and the requested address is invalid or unavailable,
|
||||
the implementation MUST indicate this in the associated entry in
|
||||
GatewayStatus.Addresses. \n The Addresses field represents a request
|
||||
for the address(es) on the \"outside of the Gateway\", that traffic
|
||||
bound for this Gateway will use. This could be the IP address or
|
||||
hostname of an external load balancer or other networking infrastructure,
|
||||
or some other address that traffic will be sent to. \n The .listener.hostname
|
||||
field is used to route traffic that has already arrived at the Gateway
|
||||
to the correct in-cluster destination. \n If no Addresses are specified,
|
||||
the implementation MAY schedule the Gateway in an implementation-specific
|
||||
manner, assigning an appropriate set of Addresses. \n The implementation
|
||||
MUST bind all Listeners to every GatewayAddress that it assigns
|
||||
to the Gateway and add a corresponding entry in GatewayStatus.Addresses.
|
||||
\n Support: Core"
|
||||
items:
|
||||
description: GatewayAddress describes an address that can be bound
|
||||
to a Gateway.
|
||||
properties:
|
||||
type:
|
||||
default: IPAddress
|
||||
description: Type of the address.
|
||||
enum:
|
||||
- IPAddress
|
||||
- Hostname
|
||||
- NamedAddress
|
||||
type: string
|
||||
value:
|
||||
description: "Value of the address. The validity of the values
|
||||
will depend on the type and support by the controller. \n
|
||||
Examples: `1.2.3.4`, `128::1`, `my-ip-address`."
|
||||
maxLength: 253
|
||||
minLength: 1
|
||||
type: string
|
||||
required:
|
||||
- value
|
||||
type: object
|
||||
maxItems: 16
|
||||
type: array
|
||||
gatewayClassName:
|
||||
description: GatewayClassName used for this Gateway. This is the name
|
||||
of a GatewayClass resource.
|
||||
maxLength: 253
|
||||
minLength: 1
|
||||
type: string
|
||||
listeners:
|
||||
description: "Listeners associated with this Gateway. Listeners define
|
||||
logical endpoints that are bound on this Gateway's addresses. At
|
||||
least one Listener MUST be specified. \n Each listener in a Gateway
|
||||
must have a unique combination of Hostname, Port, and Protocol.
|
||||
\n An implementation MAY group Listeners by Port and then collapse
|
||||
each group of Listeners into a single Listener if the implementation
|
||||
determines that the Listeners in the group are \"compatible\". An
|
||||
implementation MAY also group together and collapse compatible Listeners
|
||||
belonging to different Gateways. \n For example, an implementation
|
||||
might consider Listeners to be compatible with each other if all
|
||||
of the following conditions are met: \n 1. Either each Listener
|
||||
within the group specifies the \"HTTP\" Protocol or each Listener
|
||||
within the group specifies either the \"HTTPS\" or \"TLS\" Protocol.
|
||||
\n 2. Each Listener within the group specifies a Hostname that is
|
||||
unique within the group. \n 3. As a special case, one Listener
|
||||
within a group may omit Hostname, in which case this Listener
|
||||
matches when no other Listener matches. \n If the implementation
|
||||
does collapse compatible Listeners, the hostname provided in the
|
||||
incoming client request MUST be matched to a Listener to find the
|
||||
correct set of Routes. The incoming hostname MUST be matched using
|
||||
the Hostname field for each Listener in order of most to least specific.
|
||||
That is, exact matches must be processed before wildcard matches.
|
||||
\n If this field specifies multiple Listeners that have the same
|
||||
Port value but are not compatible, the implementation must raise
|
||||
a \"Conflicted\" condition in the Listener status. \n Support: Core"
|
||||
items:
|
||||
description: Listener embodies the concept of a logical endpoint
|
||||
where a Gateway accepts network connections.
|
||||
properties:
|
||||
allowedRoutes:
|
||||
default:
|
||||
namespaces:
|
||||
from: Same
|
||||
description: "AllowedRoutes defines the types of routes that
|
||||
MAY be attached to a Listener and the trusted namespaces where
|
||||
those Route resources MAY be present. \n Although a client
|
||||
request may match multiple route rules, only one rule may
|
||||
ultimately receive the request. Matching precedence MUST be
|
||||
determined in order of the following criteria: \n * The most
|
||||
specific match as defined by the Route type. * The oldest
|
||||
Route based on creation timestamp. For example, a Route with
|
||||
\ a creation timestamp of \"2020-09-08 01:02:03\" is given
|
||||
precedence over a Route with a creation timestamp of \"2020-09-08
|
||||
01:02:04\". * If everything else is equivalent, the Route
|
||||
appearing first in alphabetical order (namespace/name) should
|
||||
be given precedence. For example, foo/bar is given precedence
|
||||
over foo/baz. \n All valid rules within a Route attached to
|
||||
this Listener should be implemented. Invalid Route rules can
|
||||
be ignored (sometimes that will mean the full Route). If a
|
||||
Route rule transitions from valid to invalid, support for
|
||||
that Route rule should be dropped to ensure consistency. For
|
||||
example, even if a filter specified by a Route rule is invalid,
|
||||
the rest of the rules within that Route should still be supported.
|
||||
\n Support: Core"
|
||||
properties:
|
||||
kinds:
|
||||
description: "Kinds specifies the groups and kinds of Routes
|
||||
that are allowed to bind to this Gateway Listener. When
|
||||
unspecified or empty, the kinds of Routes selected are
|
||||
determined using the Listener protocol. \n A RouteGroupKind
|
||||
MUST correspond to kinds of Routes that are compatible
|
||||
with the application protocol specified in the Listener's
|
||||
Protocol field. If an implementation does not support
|
||||
or recognize this resource type, it MUST set the \"ResolvedRefs\"
|
||||
condition to False for this Listener with the \"InvalidRoutesRef\"
|
||||
reason. \n Support: Core"
|
||||
items:
|
||||
description: RouteGroupKind indicates the group and kind
|
||||
of a Route resource.
|
||||
properties:
|
||||
group:
|
||||
default: gateway.networking.k8s.io
|
||||
description: Group is the group of the Route.
|
||||
maxLength: 253
|
||||
pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
|
||||
type: string
|
||||
kind:
|
||||
description: Kind is the kind of the Route.
|
||||
maxLength: 63
|
||||
minLength: 1
|
||||
pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$
|
||||
type: string
|
||||
required:
|
||||
- kind
|
||||
type: object
|
||||
maxItems: 8
|
||||
type: array
|
||||
namespaces:
|
||||
default:
|
||||
from: Same
|
||||
description: "Namespaces indicates namespaces from which
|
||||
Routes may be attached to this Listener. This is restricted
|
||||
to the namespace of this Gateway by default. \n Support:
|
||||
Core"
|
||||
properties:
|
||||
from:
|
||||
default: Same
|
||||
description: "From indicates where Routes will be selected
|
||||
for this Gateway. Possible values are: * All: Routes
|
||||
in all namespaces may be used by this Gateway. * Selector:
|
||||
Routes in namespaces selected by the selector may
|
||||
be used by this Gateway. * Same: Only Routes in
|
||||
the same namespace may be used by this Gateway. \n
|
||||
Support: Core"
|
||||
enum:
|
||||
- All
|
||||
- Selector
|
||||
- Same
|
||||
type: string
|
||||
selector:
|
||||
description: "Selector must be specified when From is
|
||||
set to \"Selector\". In that case, only Routes in
|
||||
Namespaces matching this Selector will be selected
|
||||
by this Gateway. This field is ignored for other values
|
||||
of \"From\". \n Support: Core"
|
||||
properties:
|
||||
matchExpressions:
|
||||
description: matchExpressions is a list of label
|
||||
selector requirements. The requirements are ANDed.
|
||||
items:
|
||||
description: A label selector requirement is a
|
||||
selector that contains values, a key, and an
|
||||
operator that relates the key and values.
|
||||
properties:
|
||||
key:
|
||||
description: key is the label key that the
|
||||
selector applies to.
|
||||
type: string
|
||||
operator:
|
||||
description: operator represents a key's relationship
|
||||
to a set of values. Valid operators are
|
||||
In, NotIn, Exists and DoesNotExist.
|
||||
type: string
|
||||
values:
|
||||
description: values is an array of string
|
||||
values. If the operator is In or NotIn,
|
||||
the values array must be non-empty. If the
|
||||
operator is Exists or DoesNotExist, the
|
||||
values array must be empty. This array is
|
||||
replaced during a strategic merge patch.
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
required:
|
||||
- key
|
||||
- operator
|
||||
type: object
|
||||
type: array
|
||||
matchLabels:
|
||||
additionalProperties:
|
||||
type: string
|
||||
description: matchLabels is a map of {key,value}
|
||||
pairs. A single {key,value} in the matchLabels
|
||||
map is equivalent to an element of matchExpressions,
|
||||
whose key field is "key", the operator is "In",
|
||||
and the values array contains only "value". The
|
||||
requirements are ANDed.
|
||||
type: object
|
||||
type: object
|
||||
type: object
|
||||
type: object
|
||||
hostname:
|
||||
description: "Hostname specifies the virtual hostname to match
|
||||
for protocol types that define this concept. When unspecified,
|
||||
all hostnames are matched. This field is ignored for protocols
|
||||
that don't require hostname based matching. \n Implementations
|
||||
MUST apply Hostname matching appropriately for each of the
|
||||
following protocols: \n * TLS: The Listener Hostname MUST
|
||||
match the SNI. * HTTP: The Listener Hostname MUST match the
|
||||
Host header of the request. * HTTPS: The Listener Hostname
|
||||
SHOULD match at both the TLS and HTTP protocol layers as
|
||||
described above. If an implementation does not ensure that
|
||||
both the SNI and Host header match the Listener hostname,
|
||||
\ it MUST clearly document that. \n For HTTPRoute and TLSRoute
|
||||
resources, there is an interaction with the `spec.hostnames`
|
||||
array. When both listener and route specify hostnames, there
|
||||
MUST be an intersection between the values for a Route to
|
||||
be accepted. For more information, refer to the Route specific
|
||||
Hostnames documentation. \n Support: Core"
|
||||
maxLength: 253
|
||||
minLength: 1
|
||||
pattern: ^(\*\.)?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
|
||||
type: string
|
||||
name:
|
||||
description: "Name is the name of the Listener. \n Support:
|
||||
Core"
|
||||
maxLength: 253
|
||||
minLength: 1
|
||||
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
|
||||
type: string
|
||||
port:
|
||||
description: "Port is the network port. Multiple listeners may
|
||||
use the same port, subject to the Listener compatibility rules.
|
||||
\n Support: Core"
|
||||
format: int32
|
||||
maximum: 65535
|
||||
minimum: 1
|
||||
type: integer
|
||||
protocol:
|
||||
description: "Protocol specifies the network protocol this listener
|
||||
expects to receive. \n Support: Core"
|
||||
maxLength: 255
|
||||
minLength: 1
|
||||
pattern: ^[a-zA-Z0-9]([-a-zSA-Z0-9]*[a-zA-Z0-9])?$|[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[A-Za-z0-9]+$
|
||||
type: string
|
||||
tls:
|
||||
description: "TLS is the TLS configuration for the Listener.
|
||||
This field is required if the Protocol field is \"HTTPS\"
|
||||
or \"TLS\". It is invalid to set this field if the Protocol
|
||||
field is \"HTTP\", \"TCP\", or \"UDP\". \n The association
|
||||
of SNIs to Certificate defined in GatewayTLSConfig is defined
|
||||
based on the Hostname field for this listener. \n The GatewayClass
|
||||
MUST use the longest matching SNI out of all available certificates
|
||||
for any TLS handshake. \n Support: Core"
|
||||
properties:
|
||||
certificateRefs:
|
||||
description: "CertificateRefs contains a series of references
|
||||
to Kubernetes objects that contains TLS certificates and
|
||||
private keys. These certificates are used to establish
|
||||
a TLS handshake for requests that match the hostname of
|
||||
the associated listener. \n A single CertificateRef to
|
||||
a Kubernetes Secret has \"Core\" support. Implementations
|
||||
MAY choose to support attaching multiple certificates
|
||||
to a Listener, but this behavior is implementation-specific.
|
||||
\n References to a resource in different namespace are
|
||||
invalid UNLESS there is a ReferencePolicy in the target
|
||||
namespace that allows the certificate to be attached.
|
||||
If a ReferencePolicy does not allow this reference, the
|
||||
\"ResolvedRefs\" condition MUST be set to False for this
|
||||
listener with the \"InvalidCertificateRef\" reason. \n
|
||||
This field is required to have at least one element when
|
||||
the mode is set to \"Terminate\" (default) and is optional
|
||||
otherwise. \n CertificateRefs can reference to standard
|
||||
Kubernetes resources, i.e. Secret, or implementation-specific
|
||||
custom resources. \n Support: Core - A single reference
|
||||
to a Kubernetes Secret \n Support: Implementation-specific
|
||||
(More than one reference or other resource types)"
|
||||
items:
|
||||
description: "SecretObjectReference identifies an API
|
||||
object including its namespace, defaulting to Secret.
|
||||
\n The API object must be valid in the cluster; the
|
||||
Group and Kind must be registered in the cluster for
|
||||
this reference to be valid. \n References to objects
|
||||
with invalid Group and Kind are not valid, and must
|
||||
be rejected by the implementation, with appropriate
|
||||
Conditions set on the containing object."
|
||||
properties:
|
||||
group:
|
||||
default: ""
|
||||
description: Group is the group of the referent. For
|
||||
example, "networking.k8s.io". When unspecified (empty
|
||||
string), core API group is inferred.
|
||||
maxLength: 253
|
||||
pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
|
||||
type: string
|
||||
kind:
|
||||
default: Secret
|
||||
description: Kind is kind of the referent. For example
|
||||
"HTTPRoute" or "Service".
|
||||
maxLength: 63
|
||||
minLength: 1
|
||||
pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$
|
||||
type: string
|
||||
name:
|
||||
description: Name is the name of the referent.
|
||||
maxLength: 253
|
||||
minLength: 1
|
||||
type: string
|
||||
namespace:
|
||||
description: "Namespace is the namespace of the backend.
|
||||
When unspecified, the local namespace is inferred.
|
||||
\n Note that when a namespace is specified, a ReferencePolicy
|
||||
object is required in the referent namespace to
|
||||
allow that namespace's owner to accept the reference.
|
||||
See the ReferencePolicy documentation for details.
|
||||
\n Support: Core"
|
||||
maxLength: 63
|
||||
minLength: 1
|
||||
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
|
||||
type: string
|
||||
required:
|
||||
- name
|
||||
type: object
|
||||
maxItems: 64
|
||||
type: array
|
||||
mode:
|
||||
default: Terminate
|
||||
description: "Mode defines the TLS behavior for the TLS
|
||||
session initiated by the client. There are two possible
|
||||
modes: \n - Terminate: The TLS session between the downstream
|
||||
client and the Gateway is terminated at the Gateway.
|
||||
This mode requires certificateRefs to be set and contain
|
||||
at least one element. - Passthrough: The TLS session is
|
||||
NOT terminated by the Gateway. This implies that the
|
||||
Gateway can't decipher the TLS stream except for the
|
||||
ClientHello message of the TLS protocol. CertificateRefs
|
||||
field is ignored in this mode. \n Support: Core"
|
||||
enum:
|
||||
- Terminate
|
||||
- Passthrough
|
||||
type: string
|
||||
options:
|
||||
additionalProperties:
|
||||
description: AnnotationValue is the value of an annotation
|
||||
in Gateway API. This is used for validation of maps
|
||||
such as TLS options. This roughly matches Kubernetes
|
||||
annotation validation, although the length validation
|
||||
in that case is based on the entire size of the annotations
|
||||
struct.
|
||||
maxLength: 4096
|
||||
minLength: 0
|
||||
type: string
|
||||
description: "Options are a list of key/value pairs to enable
|
||||
extended TLS configuration for each implementation. For
|
||||
example, configuring the minimum TLS version or supported
|
||||
cipher suites. \n A set of common keys MAY be defined
|
||||
by the API in the future. To avoid any ambiguity, implementation-specific
|
||||
definitions MUST use domain-prefixed names, such as `example.com/my-custom-option`.
|
||||
Un-prefixed names are reserved for key names defined by
|
||||
Gateway API. \n Support: Implementation-specific"
|
||||
maxProperties: 16
|
||||
type: object
|
||||
type: object
|
||||
required:
|
||||
- name
|
||||
- port
|
||||
- protocol
|
||||
type: object
|
||||
maxItems: 64
|
||||
minItems: 1
|
||||
type: array
|
||||
x-kubernetes-list-map-keys:
|
||||
- name
|
||||
x-kubernetes-list-type: map
|
||||
required:
|
||||
- gatewayClassName
|
||||
- listeners
|
||||
type: object
|
||||
status:
|
||||
default:
|
||||
conditions:
|
||||
- lastTransitionTime: "1970-01-01T00:00:00Z"
|
||||
message: Waiting for controller
|
||||
reason: NotReconciled
|
||||
status: Unknown
|
||||
type: Scheduled
|
||||
description: Status defines the current state of Gateway.
|
||||
properties:
|
||||
addresses:
|
||||
description: Addresses lists the IP addresses that have actually been
|
||||
bound to the Gateway. These addresses may differ from the addresses
|
||||
in the Spec, e.g. if the Gateway automatically assigns an address
|
||||
from a reserved pool.
|
||||
items:
|
||||
description: GatewayAddress describes an address that can be bound
|
||||
to a Gateway.
|
||||
properties:
|
||||
type:
|
||||
default: IPAddress
|
||||
description: Type of the address.
|
||||
enum:
|
||||
- IPAddress
|
||||
- Hostname
|
||||
- NamedAddress
|
||||
type: string
|
||||
value:
|
||||
description: "Value of the address. The validity of the values
|
||||
will depend on the type and support by the controller. \n
|
||||
Examples: `1.2.3.4`, `128::1`, `my-ip-address`."
|
||||
maxLength: 253
|
||||
minLength: 1
|
||||
type: string
|
||||
required:
|
||||
- value
|
||||
type: object
|
||||
maxItems: 16
|
||||
type: array
|
||||
conditions:
|
||||
default:
|
||||
- lastTransitionTime: "1970-01-01T00:00:00Z"
|
||||
message: Waiting for controller
|
||||
reason: NotReconciled
|
||||
status: Unknown
|
||||
type: Scheduled
|
||||
description: "Conditions describe the current conditions of the Gateway.
|
||||
\n Implementations should prefer to express Gateway conditions using
|
||||
the `GatewayConditionType` and `GatewayConditionReason` constants
|
||||
so that operators and tools can converge on a common vocabulary
|
||||
to describe Gateway state. \n Known condition types are: \n * \"Scheduled\"
|
||||
* \"Ready\""
|
||||
items:
|
||||
description: "Condition contains details for one aspect of the current
|
||||
state of this API Resource. --- This struct is intended for direct
|
||||
use as an array at the field path .status.conditions. For example,
|
||||
type FooStatus struct{ // Represents the observations of a
|
||||
foo's current state. // Known .status.conditions.type are:
|
||||
\"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type
|
||||
\ // +patchStrategy=merge // +listType=map // +listMapKey=type
|
||||
\ Conditions []metav1.Condition `json:\"conditions,omitempty\"
|
||||
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`
|
||||
\n // other fields }"
|
||||
properties:
|
||||
lastTransitionTime:
|
||||
description: lastTransitionTime is the last time the condition
|
||||
transitioned from one status to another. This should be when
|
||||
the underlying condition changed. If that is not known, then
|
||||
using the time when the API field changed is acceptable.
|
||||
format: date-time
|
||||
type: string
|
||||
message:
|
||||
description: message is a human readable message indicating
|
||||
details about the transition. This may be an empty string.
|
||||
maxLength: 32768
|
||||
type: string
|
||||
observedGeneration:
|
||||
description: observedGeneration represents the .metadata.generation
|
||||
that the condition was set based upon. For instance, if .metadata.generation
|
||||
is currently 12, but the .status.conditions[x].observedGeneration
|
||||
is 9, the condition is out of date with respect to the current
|
||||
state of the instance.
|
||||
format: int64
|
||||
minimum: 0
|
||||
type: integer
|
||||
reason:
|
||||
description: reason contains a programmatic identifier indicating
|
||||
the reason for the condition's last transition. Producers
|
||||
of specific condition types may define expected values and
|
||||
meanings for this field, and whether the values are considered
|
||||
a guaranteed API. The value should be a CamelCase string.
|
||||
This field may not be empty.
|
||||
maxLength: 1024
|
||||
minLength: 1
|
||||
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
|
||||
type: string
|
||||
status:
|
||||
description: status of the condition, one of True, False, Unknown.
|
||||
enum:
|
||||
- "True"
|
||||
- "False"
|
||||
- Unknown
|
||||
type: string
|
||||
type:
|
||||
description: type of condition in CamelCase or in foo.example.com/CamelCase.
|
||||
--- Many .condition.type values are consistent across resources
|
||||
like Available, but because arbitrary conditions can be useful
|
||||
(see .node.status.conditions), the ability to deconflict is
|
||||
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
|
||||
maxLength: 316
|
||||
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
|
||||
type: string
|
||||
required:
|
||||
- lastTransitionTime
|
||||
- message
|
||||
- reason
|
||||
- status
|
||||
- type
|
||||
type: object
|
||||
maxItems: 8
|
||||
type: array
|
||||
x-kubernetes-list-map-keys:
|
||||
- type
|
||||
x-kubernetes-list-type: map
|
||||
listeners:
|
||||
description: Listeners provide status for each unique listener port
|
||||
defined in the Spec.
|
||||
items:
|
||||
description: ListenerStatus is the status associated with a Listener.
|
||||
properties:
|
||||
attachedRoutes:
|
||||
description: AttachedRoutes represents the total number of Routes
|
||||
that have been successfully attached to this Listener.
|
||||
format: int32
|
||||
type: integer
|
||||
conditions:
|
||||
description: Conditions describe the current condition of this
|
||||
listener.
|
||||
items:
|
||||
description: "Condition contains details for one aspect of
|
||||
the current state of this API Resource. --- This struct
|
||||
is intended for direct use as an array at the field path
|
||||
.status.conditions. For example, type FooStatus struct{
|
||||
\ // Represents the observations of a foo's current state.
|
||||
\ // Known .status.conditions.type are: \"Available\",
|
||||
\"Progressing\", and \"Degraded\" // +patchMergeKey=type
|
||||
\ // +patchStrategy=merge // +listType=map //
|
||||
+listMapKey=type Conditions []metav1.Condition `json:\"conditions,omitempty\"
|
||||
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`
|
||||
\n // other fields }"
|
||||
properties:
|
||||
lastTransitionTime:
|
||||
description: lastTransitionTime is the last time the condition
|
||||
transitioned from one status to another. This should
|
||||
be when the underlying condition changed. If that is
|
||||
not known, then using the time when the API field changed
|
||||
is acceptable.
|
||||
format: date-time
|
||||
type: string
|
||||
message:
|
||||
description: message is a human readable message indicating
|
||||
details about the transition. This may be an empty string.
|
||||
maxLength: 32768
|
||||
type: string
|
||||
observedGeneration:
|
||||
description: observedGeneration represents the .metadata.generation
|
||||
that the condition was set based upon. For instance,
|
||||
if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration
|
||||
is 9, the condition is out of date with respect to the
|
||||
current state of the instance.
|
||||
format: int64
|
||||
minimum: 0
|
||||
type: integer
|
||||
reason:
|
||||
description: reason contains a programmatic identifier
|
||||
indicating the reason for the condition's last transition.
|
||||
Producers of specific condition types may define expected
|
||||
values and meanings for this field, and whether the
|
||||
values are considered a guaranteed API. The value should
|
||||
be a CamelCase string. This field may not be empty.
|
||||
maxLength: 1024
|
||||
minLength: 1
|
||||
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
|
||||
type: string
|
||||
status:
|
||||
description: status of the condition, one of True, False,
|
||||
Unknown.
|
||||
enum:
|
||||
- "True"
|
||||
- "False"
|
||||
- Unknown
|
||||
type: string
|
||||
type:
|
||||
description: type of condition in CamelCase or in foo.example.com/CamelCase.
|
||||
--- Many .condition.type values are consistent across
|
||||
resources like Available, but because arbitrary conditions
|
||||
can be useful (see .node.status.conditions), the ability
|
||||
to deconflict is important. The regex it matches is
|
||||
(dns1123SubdomainFmt/)?(qualifiedNameFmt)
|
||||
maxLength: 316
|
||||
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
|
||||
type: string
|
||||
required:
|
||||
- lastTransitionTime
|
||||
- message
|
||||
- reason
|
||||
- status
|
||||
- type
|
||||
type: object
|
||||
maxItems: 8
|
||||
type: array
|
||||
x-kubernetes-list-map-keys:
|
||||
- type
|
||||
x-kubernetes-list-type: map
|
||||
name:
|
||||
description: Name is the name of the Listener that this status
|
||||
corresponds to.
|
||||
maxLength: 253
|
||||
minLength: 1
|
||||
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
|
||||
type: string
|
||||
supportedKinds:
|
||||
description: "SupportedKinds is the list indicating the Kinds
|
||||
supported by this listener. This MUST represent the kinds
|
||||
an implementation supports for that Listener configuration.
|
||||
\n If kinds are specified in Spec that are not supported,
|
||||
they MUST NOT appear in this list and an implementation MUST
|
||||
set the \"ResolvedRefs\" condition to \"False\" with the \"InvalidRouteKinds\"
|
||||
reason. If both valid and invalid Route kinds are specified,
|
||||
the implementation MUST reference the valid Route kinds that
|
||||
have been specified."
|
||||
items:
|
||||
description: RouteGroupKind indicates the group and kind of
|
||||
a Route resource.
|
||||
properties:
|
||||
group:
|
||||
default: gateway.networking.k8s.io
|
||||
description: Group is the group of the Route.
|
||||
maxLength: 253
|
||||
pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
|
||||
type: string
|
||||
kind:
|
||||
description: Kind is the kind of the Route.
|
||||
maxLength: 63
|
||||
minLength: 1
|
||||
pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$
|
||||
type: string
|
||||
required:
|
||||
- kind
|
||||
type: object
|
||||
maxItems: 8
|
||||
type: array
|
||||
required:
|
||||
- attachedRoutes
|
||||
- conditions
|
||||
- name
|
||||
- supportedKinds
|
||||
type: object
|
||||
maxItems: 64
|
||||
type: array
|
||||
x-kubernetes-list-map-keys:
|
||||
- name
|
||||
x-kubernetes-list-type: map
|
||||
type: object
|
||||
required:
|
||||
- spec
|
||||
type: object
|
||||
served: true
|
||||
storage: true
|
||||
subresources:
|
||||
status: {}
|
||||
status:
|
||||
acceptedNames:
|
||||
kind: ""
|
||||
plural: ""
|
||||
conditions: []
|
||||
storedVersions: []
|
||||
+1282
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,16 @@
|
||||
apiVersion: gateway.networking.k8s.io/v1alpha2
|
||||
kind: Gateway
|
||||
metadata:
|
||||
name: traefik-gateway
|
||||
namespace: vela-system
|
||||
annotations:
|
||||
ports-mapping: "8000:80,8443:443"
|
||||
spec:
|
||||
gatewayClassName: traefik
|
||||
listeners:
|
||||
- allowedRoutes:
|
||||
namespaces:
|
||||
from: All
|
||||
name: web
|
||||
port: 8000
|
||||
protocol: HTTP
|
||||
@@ -0,0 +1,40 @@
|
||||
apiVersion: gateway.networking.k8s.io/v1alpha2
|
||||
kind: HTTPRoute
|
||||
metadata:
|
||||
name: http-test-route
|
||||
namespace: default
|
||||
spec:
|
||||
hostnames:
|
||||
- gateway.domain
|
||||
parentRefs:
|
||||
- group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
name: traefik-gateway
|
||||
namespace: vela-system
|
||||
sectionName: web
|
||||
rules:
|
||||
- backendRefs:
|
||||
- group: ""
|
||||
kind: Service
|
||||
name: game2048
|
||||
port: 80
|
||||
weight: 1
|
||||
matches:
|
||||
- path:
|
||||
type: PathPrefix
|
||||
value: /
|
||||
- group: ""
|
||||
kind: Service
|
||||
name: game2048
|
||||
port: 80
|
||||
weight: 1
|
||||
- backendRefs:
|
||||
- group: ""
|
||||
kind: Service
|
||||
name: game2048-2
|
||||
port: 80
|
||||
weight: 1
|
||||
matches:
|
||||
- path:
|
||||
type: PathPrefix
|
||||
value: /api
|
||||
@@ -17,7 +17,6 @@ limitations under the License.
|
||||
package query
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -331,8 +330,7 @@ func TestReplicaSetStatus(t *testing.T) {
|
||||
res: types.HealthStatus{Status: types.HealthStatusProgressing, Message: "Waiting for rollout to finish: observed replica set generation less then desired generation"},
|
||||
},
|
||||
}
|
||||
for d, s := range testCases {
|
||||
fmt.Println(d)
|
||||
for _, s := range testCases {
|
||||
rs := s.input.DeepCopy()
|
||||
u, err := runtime.DefaultUnstructuredConverter.ToUnstructured(&rs)
|
||||
assert.NoError(t, err)
|
||||
@@ -852,8 +850,7 @@ func TestPodAdditionalInfo(t *testing.T) {
|
||||
"pod15": case15,
|
||||
}
|
||||
|
||||
for des, t2 := range testCases {
|
||||
fmt.Println(des)
|
||||
for _, t2 := range testCases {
|
||||
u, err := runtime.DefaultUnstructuredConverter.ToUnstructured(t2.pod.DeepCopy())
|
||||
assert.NoError(t, err)
|
||||
res, err := additionalInfo(unstructured.Unstructured{Object: u})
|
||||
@@ -895,8 +892,7 @@ func TestSvcAdditionalInfo(t *testing.T) {
|
||||
"svc2": case2,
|
||||
}
|
||||
|
||||
for des, t2 := range testCases {
|
||||
fmt.Println(des)
|
||||
for _, t2 := range testCases {
|
||||
u, err := runtime.DefaultUnstructuredConverter.ToUnstructured(t2.svc.DeepCopy())
|
||||
assert.NoError(t, err)
|
||||
res, err := additionalInfo(unstructured.Unstructured{Object: u})
|
||||
|
||||
@@ -87,6 +87,9 @@ type Endpoint struct {
|
||||
|
||||
// the path for the endpoint
|
||||
Path string `json:"path,omitempty"`
|
||||
|
||||
// Inner means the endpoint is only accessible within the cluster.
|
||||
Inner bool `json:"inner,omitempty"`
|
||||
}
|
||||
|
||||
// AppliedResource resource metadata
|
||||
|
||||
@@ -180,12 +180,12 @@ func printAppEndpoints(ctx context.Context, appName string, namespace string, f
|
||||
}
|
||||
table := tablewriter.NewWriter(os.Stdout)
|
||||
table.SetColWidth(100)
|
||||
table.SetHeader([]string{"Cluster", "Component", "Ref(Kind/Namespace/Name)", "Endpoint"})
|
||||
table.SetHeader([]string{"Cluster", "Component", "Ref(Kind/Namespace/Name)", "Endpoint", "Inner"})
|
||||
for _, endpoint := range endpoints {
|
||||
if endpoint.Cluster == "" {
|
||||
endpoint.Cluster = multicluster.ClusterLocalName
|
||||
}
|
||||
table.Append([]string{endpoint.Cluster, endpoint.Component, fmt.Sprintf("%s/%s/%s", endpoint.Ref.Kind, endpoint.Ref.Namespace, endpoint.Ref.Name), endpoint.String()})
|
||||
table.Append([]string{endpoint.Cluster, endpoint.Component, fmt.Sprintf("%s/%s/%s", endpoint.Ref.Kind, endpoint.Ref.Namespace, endpoint.Ref.Name), endpoint.String(), fmt.Sprintf("%v", endpoint.Endpoint.Inner)})
|
||||
}
|
||||
table.Render()
|
||||
return nil
|
||||
|
||||
@@ -375,8 +375,8 @@ template: {
|
||||
}]
|
||||
|
||||
// +ignore
|
||||
// +usage=Specify what kind of Service you want. options: "ClusterIP", "NodePort", "LoadBalancer", "ExternalName"
|
||||
exposeType: *"ClusterIP" | "NodePort" | "LoadBalancer" | "ExternalName"
|
||||
// +usage=Specify what kind of Service you want. options: "ClusterIP", "NodePort", "LoadBalancer"
|
||||
exposeType: *"ClusterIP" | "NodePort" | "LoadBalancer"
|
||||
|
||||
// +ignore
|
||||
// +usage=If addRevisionLabel is true, the revision label will be added to the underlying pods
|
||||
|
||||
@@ -63,6 +63,9 @@ template: {
|
||||
if !parameter.classInSpec {
|
||||
"kubernetes.io/ingress.class": parameter.class
|
||||
}
|
||||
if parameter.gatewayHost != _|_ {
|
||||
"ingress.controller/host": parameter.gatewayHost
|
||||
}
|
||||
}
|
||||
}
|
||||
spec: {
|
||||
@@ -110,5 +113,8 @@ template: {
|
||||
|
||||
// +usage=Specify the secret name you want to quote.
|
||||
secretName?: string
|
||||
|
||||
// +usage=Specify the host of the ingress gateway, which is used to generate the endpoints when the host is empty.
|
||||
gatewayHost?: string
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user