v1

package
v0.0.0-...-7949e55 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package v1 contains API Schema definitions for the mesh v1 API group +kubebuilder:object:generate=true +groupName=mesh.meshd.co.tz

Index

Constants

This section is empty.

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "mesh.meshd.co.tz", Version: "v1"}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme
	SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)

Functions

func ResolveServicePort

func ResolveServicePort(svcPort corev1.ServicePort, containerPorts []corev1.ContainerPort) (int32, bool)

ResolveServicePort resolves the given service port against the given container port list, as described in the Kubernetes documentation, and returns true if it has been successfully resolved, false otherwise.

The Kubernetes documentation says: Port definitions in Pods have names, and you can reference these names in the targetPort attribute of a Service. This works even if there is a mixture of Pods in the Service using a single configured name, with the same network protocol available via different port numbers.

Types

type Key

type Key struct {
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
}

Key references a resource.

func (*Key) DeepCopy

func (in *Key) DeepCopy() *Key

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Key.

func (*Key) DeepCopyInto

func (in *Key) DeepCopyInto(out *Key)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (Key) MarshalText

func (k Key) MarshalText() ([]byte, error)

MarshalText marshals the Key.

func (Key) String

func (k Key) String() string

String stringifies the Key.

func (*Key) UnmarshalJSON

func (k *Key) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the `json.Unmarshaler` interface. This is a temporary workaround for the bug described in this issue: https://github.com/golang/go/issues/38771.

func (*Key) UnmarshalText

func (k *Key) UnmarshalText(data []byte) error

UnmarshalText unmarshals the Key.

type Pod

type Pod struct {
	Name            string                 `json:"name"`
	Namespace       string                 `json:"namespace"`
	ServiceAccount  string                 `json:"serviceAccount"`
	OwnerReferences []v1.OwnerReference    `json:"ownerReferences,omitempty"`
	ContainerPorts  []corev1.ContainerPort `json:"containerPorts,omitempty"`
	IP              string                 `json:"ip"`

	SourceOf      []ServiceTrafficTargetKey `json:"sourceOf,omitempty"`
	DestinationOf []ServiceTrafficTargetKey `json:"destinationOf,omitempty"`
}

Pod is a node of the graph representing a kubernetes pod. +k8s:deepcopy-gen=true

func (*Pod) DeepCopy

func (in *Pod) DeepCopy() *Pod

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Pod.

func (*Pod) DeepCopyInto

func (in *Pod) DeepCopyInto(out *Pod)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Service

type Service struct {
	Name        string               `json:"name"`
	Namespace   string               `json:"namespace"`
	Selector    map[string]string    `json:"selector"`
	Annotations map[string]string    `json:"annotations"`
	Ports       []corev1.ServicePort `json:"ports,omitempty"`
	ClusterIP   string               `json:"clusterIp"`
	Pods        []Key                `json:"pods,omitempty"`

	// List of TrafficTargets that are targeting pods which are selected by this service.
	TrafficTargets []ServiceTrafficTargetKey `json:"trafficTargets,omitempty"`
	// List of TrafficSplits that are targeting this service.
	TrafficSplits []Key `json:"trafficSplits,omitempty"`
	// List of TrafficSplit mentioning this service as a backend.
	BackendOf []Key `json:"backendOf,omitempty"`

	Errors []string `json:"errors"`
}

Service is a node of the graph representing a kubernetes service.

func (*Service) AddError

func (s *Service) AddError(err error)

AddError adds the given error to this Service.

func (*Service) DeepCopy

func (in *Service) DeepCopy() *Service

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Service.

func (*Service) DeepCopyInto

func (in *Service) DeepCopyInto(out *Service)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ServiceTrafficTarget

type ServiceTrafficTarget struct {
	Service   Key    `json:"service"`
	Name      string `json:"name"`
	Namespace string `json:"namespace"`

	Sources     []ServiceTrafficTargetSource    `json:"sources,omitempty"`
	Destination ServiceTrafficTargetDestination `json:"destination"`
	Rules       []TrafficSpec                   `json:"rules,omitempty"`

	Errors []string `json:"errors"`
}

ServiceTrafficTarget represents a TrafficTarget applied a on Service. TrafficTargets have a Destination service account. This service account can be set on many pods, each of them, potentially accessible through different services. A ServiceTrafficTarget is a TrafficTarget for a Service which exposes a Pod which has the TrafficTarget Destination service-account.

func (*ServiceTrafficTarget) AddError

func (tt *ServiceTrafficTarget) AddError(err error)

AddError adds the given error to this ServiceTrafficTarget.

func (*ServiceTrafficTarget) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceTrafficTarget.

func (*ServiceTrafficTarget) DeepCopyInto

func (in *ServiceTrafficTarget) DeepCopyInto(out *ServiceTrafficTarget)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ServiceTrafficTargetDestination

type ServiceTrafficTargetDestination struct {
	ServiceAccount string               `json:"serviceAccount"`
	Namespace      string               `json:"namespace"`
	Ports          []corev1.ServicePort `json:"ports,omitempty"`
	Pods           []Key                `json:"pods,omitempty"`
}

ServiceTrafficTargetDestination represents a destination of a ServiceTrafficTarget. In the SMI specification, a TrafficTarget has a destination service-account. ServiceTrafficTargetDestination holds the pods exposed by the Service which has this service-account. +k8s:deepcopy-gen=true

func (*ServiceTrafficTargetDestination) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceTrafficTargetDestination.

func (*ServiceTrafficTargetDestination) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ServiceTrafficTargetKey

type ServiceTrafficTargetKey struct {
	Service       Key `json:"service"`
	TrafficTarget Key `json:"trafficTarget"`
}

ServiceTrafficTargetKey references a TrafficTarget applied on a Service.

func (*ServiceTrafficTargetKey) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceTrafficTargetKey.

func (*ServiceTrafficTargetKey) DeepCopyInto

func (in *ServiceTrafficTargetKey) DeepCopyInto(out *ServiceTrafficTargetKey)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (ServiceTrafficTargetKey) MarshalText

func (k ServiceTrafficTargetKey) MarshalText() ([]byte, error)

MarshalText marshals the ServiceTrafficTargetKey.

func (ServiceTrafficTargetKey) String

func (k ServiceTrafficTargetKey) String() string

String stringifies the ServiceTrafficTargetKey.

func (*ServiceTrafficTargetKey) UnmarshalJSON

func (k *ServiceTrafficTargetKey) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the `json.Unmarshaler` interface. This is a temporary workaround for the bug described in this issue: https://github.com/golang/go/issues/38771.

func (*ServiceTrafficTargetKey) UnmarshalText

func (k *ServiceTrafficTargetKey) UnmarshalText(data []byte) error

UnmarshalText unmarshals the ServiceTrafficTargetKey.

type ServiceTrafficTargetSource

type ServiceTrafficTargetSource struct {
	ServiceAccount string `json:"serviceAccount"`
	Namespace      string `json:"namespace"`
	Pods           []Key  `json:"pods,omitempty"`
}

ServiceTrafficTargetSource represents a source of a ServiceTrafficTarget. In the SMI specification, a TrafficTarget has a list of sources, each of them being a service-account name. ServiceTrafficTargetSource represents this service-account, populated with the pods having this Service.

func (*ServiceTrafficTargetSource) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceTrafficTargetSource.

func (*ServiceTrafficTargetSource) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Topology

type Topology struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   TopologySpec   `json:"spec,omitempty"`
	Status TopologyStatus `json:"status,omitempty"`
}

Topology is the Schema for the topologies API

func (*Topology) DeepCopy

func (in *Topology) DeepCopy() *Topology

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Topology.

func (*Topology) DeepCopyInto

func (in *Topology) DeepCopyInto(out *Topology)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Topology) DeepCopyObject

func (in *Topology) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type TopologyList

type TopologyList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Topology `json:"items"`
}

TopologyList contains a list of Topology

func (*TopologyList) DeepCopy

func (in *TopologyList) DeepCopy() *TopologyList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TopologyList.

func (*TopologyList) DeepCopyInto

func (in *TopologyList) DeepCopyInto(out *TopologyList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*TopologyList) DeepCopyObject

func (in *TopologyList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type TopologySpec

type TopologySpec struct {
	Services              []*Service              `json:"services"`
	Pods                  []*Pod                  `json:"pods"`
	ServiceTrafficTargets []*ServiceTrafficTarget `json:"serviceTrafficTargets"`
	TrafficSplits         []*TrafficSplit         `json:"trafficSplits"`
}

TopologySpec holds the graph and represents the different paths a request can follow. Each Pods and services are nodes of the graph.

func (*TopologySpec) DeepCopy

func (in *TopologySpec) DeepCopy() *TopologySpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TopologySpec.

func (*TopologySpec) DeepCopyInto

func (in *TopologySpec) DeepCopyInto(out *TopologySpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type TopologyStatus

type TopologyStatus struct{}

TopologyStatus defines the observed state of Topology

func (*TopologyStatus) DeepCopy

func (in *TopologyStatus) DeepCopy() *TopologyStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TopologyStatus.

func (*TopologyStatus) DeepCopyInto

func (in *TopologyStatus) DeepCopyInto(out *TopologyStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type TrafficSpec

type TrafficSpec struct {
	HTTPRouteGroup *specs.HTTPRouteGroup `json:"httpRouteGroup,omitempty"`
	TCPRoute       *specs.TCPRoute       `json:"tcpRoute,omitempty"`
}

TrafficSpec represents a Spec which can be used for restricting access to a route in a TrafficTarget or a TrafficSplit.

func (*TrafficSpec) DeepCopy

func (in *TrafficSpec) DeepCopy() *TrafficSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrafficSpec.

func (*TrafficSpec) DeepCopyInto

func (in *TrafficSpec) DeepCopyInto(out *TrafficSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type TrafficSplit

type TrafficSplit struct {
	Name      string `json:"name"`
	Namespace string `json:"namespace"`

	Service  Key                   `json:"service"`
	Backends []TrafficSplitBackend `json:"backends,omitempty"`
	Rules    []TrafficSpec         `json:"rules,omitempty"`

	// List of Pods that are explicitly allowed to pass through the TrafficSplit.
	Incoming []Key `json:"incoming,omitempty"`

	Errors []string `json:"errors"`
}

TrafficSplit represents a TrafficSplit applied on a Service. +k8s:deepcopy-gen=true

func (*TrafficSplit) AddError

func (ts *TrafficSplit) AddError(err error)

AddError adds the given error to this TrafficSplit.

func (*TrafficSplit) DeepCopy

func (in *TrafficSplit) DeepCopy() *TrafficSplit

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrafficSplit.

func (*TrafficSplit) DeepCopyInto

func (in *TrafficSplit) DeepCopyInto(out *TrafficSplit)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type TrafficSplitBackend

type TrafficSplitBackend struct {
	Weight  int `json:"weight"`
	Service Key `json:"service"`
}

TrafficSplitBackend is a backend of a TrafficSplit.

func (*TrafficSplitBackend) DeepCopy

func (in *TrafficSplitBackend) DeepCopy() *TrafficSplitBackend

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrafficSplitBackend.

func (*TrafficSplitBackend) DeepCopyInto

func (in *TrafficSplitBackend) DeepCopyInto(out *TrafficSplitBackend)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Jump to

Keyboard shortcuts

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