Documentation ¶
Overview ¶
Package resources holds simple functions for synthesizing child resources from a Route.
Index ¶
Examples ¶
Constants ¶
View Source
const ( ManagedByLabel = "app.kubernetes.io/managed-by" KnativeIngressGateway = "knative-ingress-gateway.knative-serving.svc.cluster.local" GatewayHost = "istio-ingressgateway.istio-system.svc.cluster.local" )
Variables ¶
This section is empty.
Functions ¶
func MakeVirtualService ¶
func MakeVirtualService(claims []*v1alpha1.RouteClaim, routes []*v1alpha1.Route) (*networking.VirtualService, error)
MakeVirtualService creates a VirtualService from a Route object.
Example ¶
package main import ( "fmt" "github.com/google/kf/pkg/apis/kf/v1alpha1" "github.com/google/kf/pkg/reconciler/route/resources" ) func makeRouteSpecFields(host, domain, path string) v1alpha1.RouteSpecFields { return v1alpha1.RouteSpecFields{ Hostname: host, Domain: domain, Path: path, } } func makeRoute(host, domain, path string) *v1alpha1.Route { return &v1alpha1.Route{ Spec: v1alpha1.RouteSpec{ RouteSpecFields: makeRouteSpecFields(host, domain, path), }, } } func makeRouteClaim(host, domain, path string) *v1alpha1.RouteClaim { return &v1alpha1.RouteClaim{ Spec: v1alpha1.RouteClaimSpec{ RouteSpecFields: makeRouteSpecFields(host, domain, path), }, } } func main() { claims := []*v1alpha1.RouteClaim{ makeRouteClaim("some-host", "example.com/", ""), } routes := []*v1alpha1.Route{ makeRoute("some-host", "example.com/", ""), makeRoute("some-host", "example.com/", "/some-path-1"), makeRoute("some-host", "example.com/", "/some-path-2"), } vs, err := resources.MakeVirtualService(claims, routes) if err != nil { panic(err) } for i, h := range vs.Spec.HTTP { fmt.Printf("Regex %d: %s\n", i, h.Match[0].URI.Regex) } }
Output: Regex 0: ^(/.*)? Regex 1: ^/some-path-1(/.*)? Regex 2: ^/some-path-2(/.*)?
func MakeVirtualServiceLabels ¶
func MakeVirtualServiceLabels(spec v1alpha1.RouteSpecFields) map[string]string
MakeVirtualServiceLabels creates Labels that can be used to tie a VirtualService to a Route.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.