resources

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2020 License: Apache-2.0 Imports: 33 Imported by: 1

Documentation

Overview

Package resources holds simple functions for synthesizing child resources from an Ingress resource and any relevant Ingress controller configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CategorizeSecrets added in v0.15.0

func CategorizeSecrets(secrets map[string]*corev1.Secret) (map[string]*corev1.Secret, map[string]*corev1.Secret, error)

CategorizeSecrets categorizes secrets into two sets: wildcard cert secrets and non-wildcard cert secrets.

func GatewayName

func GatewayName(accessor kmeta.Accessor, gatewaySvc *corev1.Service) string

GatewayName create a name for the Gateway that is built based on the given Ingress and bonds to the given ingress gateway service.

func GatewayRef added in v0.16.0

func GatewayRef(gw *v1alpha3.Gateway) corev1.ObjectReference

GatewayRef returns the ObjectReference for a give Gateway.

func GenerateCertificate added in v0.16.0

func GenerateCertificate(host string, secretName string, namespace string) (*corev1.Secret, error)

func GetHTTPServer

func GetHTTPServer(gateway *v1alpha3.Gateway) *istiov1alpha3.Server

GetHTTPServer gets the HTTP `Server` from `Gateway`.

func GetHostsFromCertSecret added in v0.15.0

func GetHostsFromCertSecret(secret *corev1.Secret) ([]string, error)

GetHostsFromCertSecret gets cert hosts from cert secret.

func GetIngressGatewaySvcNameNamespaces

func GetIngressGatewaySvcNameNamespaces(ctx context.Context) ([]metav1.ObjectMeta, error)

TODO(nghia): Remove this by parsing at config parsing time. GetIngressGatewaySvcNameNamespaces gets the Istio ingress namespaces from ConfigMap.

func GetNonWildcardIngressTLS added in v0.16.0

func GetNonWildcardIngressTLS(ingressTLS []v1alpha1.IngressTLS, nonWildcardSecrest map[string]*corev1.Secret) []v1alpha1.IngressTLS

GetNonWildcardIngressTLS gets Ingress TLS that do not reference wildcard certificates.

func GetQualifiedGatewayNames added in v0.15.0

func GetQualifiedGatewayNames(gateways []*v1alpha3.Gateway) []string

GetQualifiedGatewayNames return the qualified Gateway names for the given Gateways.

func GetSecrets

func GetSecrets(ing *v1alpha1.Ingress, secretLister corev1listers.SecretLister) (map[string]*corev1.Secret, error)

GetSecrets gets the all of the secrets referenced by the given Ingress, and returns a map whose key is the a secret namespace/name key and value is pointer of the secret.

func GetServers

func GetServers(gateway *v1alpha3.Gateway, ing *v1alpha1.Ingress) []*istiov1alpha3.Server

GetServers gets the `Servers` from `Gateway` that belongs to the given Ingress.

func MakeHTTPServer

func MakeHTTPServer(httpProtocol network.HTTPProtocol, hosts []string) *istiov1alpha3.Server

MakeHTTPServer creates a HTTP Gateway `Server` based on the HTTPProtocol configuration.

func MakeIngressGateways

func MakeIngressGateways(ctx context.Context, ing *v1alpha1.Ingress, originSecrets map[string]*corev1.Secret, svcLister corev1listers.ServiceLister) ([]*v1alpha3.Gateway, error)

MakeIngressGateways creates Gateways for a given Ingress.

func MakeIngressVirtualService

func MakeIngressVirtualService(ing *v1alpha1.Ingress, gateways map[v1alpha1.IngressVisibility]sets.String) *v1alpha3.VirtualService

MakeIngressVirtualService creates Istio VirtualService as network programming for Istio Gateways other than 'mesh'.

func MakeMeshVirtualService

func MakeMeshVirtualService(ing *v1alpha1.Ingress, gateways map[v1alpha1.IngressVisibility]sets.String) *v1alpha3.VirtualService

MakeMeshVirtualService creates a mesh Virtual Service

func MakeSecrets

func MakeSecrets(ctx context.Context, originSecrets map[string]*corev1.Secret, accessor kmeta.OwnerRefableAccessor) ([]*corev1.Secret, error)

MakeSecrets makes copies of the origin Secrets under the namespace of Istio gateway service.

func MakeTLSServers

func MakeTLSServers(ing *v1alpha1.Ingress, ingressTLS []v1alpha1.IngressTLS, gatewayServiceNamespace string, originSecrets map[string]*corev1.Secret) ([]*istiov1alpha3.Server, error)

MakeTLSServers creates the expected Gateway TLS `Servers` based on the given IngressTLS.

func MakeTargetSecretLabels

func MakeTargetSecretLabels(originSecretName, originSecretNamespace string) map[string]string

MakeTargetSecretLabels returns the labels used in target secret.

func MakeVirtualServices

func MakeVirtualServices(ing *v1alpha1.Ingress, gateways map[v1alpha1.IngressVisibility]sets.String) ([]*v1alpha3.VirtualService, error)

MakeVirtualServices creates a mesh VirtualService and a virtual service for each gateway

func MakeWildcardGateways added in v0.15.0

func MakeWildcardGateways(ctx context.Context, originWildcardSecrets map[string]*corev1.Secret,
	svcLister corev1listers.ServiceLister) ([]*v1alpha3.Gateway, error)

MakeWildcardGateways creates gateways with wildcard hosts based on the wildcard secret information. For each public ingress service, we will create a list of Gateways. Each Gateway of the list corresponds to a wildcard cert secret.

func MakeWildcardSecrets added in v0.15.0

func MakeWildcardSecrets(ctx context.Context, originWildcardCerts map[string]*corev1.Secret) ([]*corev1.Secret, error)

MakeWildcardSecrets copies wildcard certificates from origin namespace to the namespace of gateway servicess so they could consumed by Istio ingress.

func SecretRef

func SecretRef(namespace, name string) corev1.ObjectReference

SecretRef returns the ObjectReference of a secret given the namespace and name of the secret.

func ServiceNamespaceFromURL

func ServiceNamespaceFromURL(svc string) (string, error)

ServiceNamespaceFromURL extracts the namespace part from the service URL. TODO(nghia): Remove this by parsing at config parsing time.

func SortServers

func SortServers(servers []*istiov1alpha3.Server) []*istiov1alpha3.Server

SortServers sorts `Server` according to its port name.

func UpdateGateway

func UpdateGateway(gateway *v1alpha3.Gateway, want []*istiov1alpha3.Server, existing []*istiov1alpha3.Server) *v1alpha3.Gateway

UpdateGateway replaces the existing servers with the wanted servers.

func VirtualServiceNamespace

func VirtualServiceNamespace(ing *v1alpha1.Ingress) string

VirtualServiceNamespace gives the namespace of the child VirtualServices for a given Ingress.

func WildcardGatewayName added in v0.15.0

func WildcardGatewayName(secretName, gatewayServiceNamespace, gatewayServiceName string) string

WildcardGatewayName creates the name of wildcard Gateway.

Types

This section is empty.

Directories

Path Synopsis
Package names holds simple functions for synthesizing resource names.
Package names holds simple functions for synthesizing resource names.

Jump to

Keyboard shortcuts

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