resources

package
v0.0.0-...-8f52349 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

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/poy/kf/pkg/apis/kf/v1alpha1"
	"github.com/poy/kf/pkg/reconciler/route/resources"
)

func main() {
	vs, err := resources.MakeVirtualService([]*v1alpha1.RouteClaim{
		{
			Spec: v1alpha1.RouteClaimSpec{
				RouteSpecFields: v1alpha1.RouteSpecFields{
					Hostname: "some-host",
					Domain:   "example.com/",
				},
			},
		},
	}, []*v1alpha1.Route{
		{
			Spec: v1alpha1.RouteSpec{
				RouteSpecFields: v1alpha1.RouteSpecFields{
					Hostname: "some-host",
					Domain:   "example.com/",
				},
			},
		},
		{
			Spec: v1alpha1.RouteSpec{
				RouteSpecFields: v1alpha1.RouteSpecFields{
					Hostname: "some-host",
					Domain:   "example.com",
					Path:     "/some-path-1",
				},
			},
		},
		{
			Spec: v1alpha1.RouteSpec{
				RouteSpecFields: v1alpha1.RouteSpecFields{
					Hostname: "some-host",
					Domain:   "example.com",
					Path:     "/some-path-2",
				},
			},
		},
	})
	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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL