service

package
v2.0.4+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2019 License: Apache-2.0 Imports: 4 Imported by: 14

Documentation

Index

Constants

View Source
const (
	// ServiceKeyword defines the keyword identifying Service data.
	ServiceKeyword = "service"
)

Variables

View Source
var Service_ServicePort_IntOrString_Type_name = map[int32]string{
	0: "NUMBER",
	1: "STRING",
}
View Source
var Service_ServicePort_IntOrString_Type_value = map[string]int32{
	"NUMBER": 0,
	"STRING": 1,
}

Functions

func Key

func Key(name string, namespace string) string

Key returns the key under which the given service is stored in the data-store.

func KeyPrefix

func KeyPrefix() string

KeyPrefix returns the key prefix identifying all K8s services in the data store.

func ParseServiceFromKey

func ParseServiceFromKey(key string) (service string, namespace string, err error)

ParseServiceFromKey parses service and namespace ids from the associated data-store key.

Types

type ID

type ID struct {
	Name      string
	Namespace string
}

ID used to uniquely represent a K8s Service.

func GetID

func GetID(service *Service) ID

GetID returns ID of a service.

func (ID) String

func (id ID) String() string

String returns a string representation of a service ID.

type Service

type Service struct {
	// Name of the service unique within the namespace.
	// Cannot be updated.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// Namespace the service is inserted into.
	// An empty namespace is equivalent to the "default" namespace, but "default"
	// is the canonical representation used in the key for a key-value store.
	// Cannot be updated.
	Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"`
	// The list of ports that are exposed by this service.
	Port []*Service_ServicePort `protobuf:"bytes,3,rep,name=port" json:"port,omitempty"`
	// Route service traffic to pods with label keys and values matching this
	// selector. If empty or not present, the service is assumed to have an
	// external process managing its endpoints, which Kubernetes will not
	// modify. Only applies to types ClusterIP, NodePort, and LoadBalancer.
	// Ignored if type is ExternalName.
	// More info: https://kubernetes.io/docs/concepts/services-networking/service/
	// +optional
	Selector map[string]string `` /* 150-byte string literal not displayed */
	// ClusterIP is the IP address of the service and is usually assigned
	// randomly by the master. If an address is specified manually and is not in
	// use by others, it will be allocated to the service; otherwise, creation
	// of the service will fail. This field can not be changed through updates.
	// Valid values are "None", empty string (""), or a valid IP address. "None"
	// can be specified for headless services when proxying is not required.
	// Only applies to types ClusterIP, NodePort, and LoadBalancer. Ignored if
	// type is ExternalName.
	// More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies
	// +optional
	ClusterIp string `protobuf:"bytes,5,opt,name=cluster_ip,json=clusterIp,proto3" json:"cluster_ip,omitempty"`
	// ServiceType determines how the Service is exposed. Defaults to ClusterIP. Valid
	// options are ExternalName, ClusterIP, NodePort, and LoadBalancer.
	// "ExternalName" maps to the specified externalName.
	// "ClusterIP" allocates a cluster-internal IP address for load-balancing
	// to endpoints. Endpoints are determined by the selector or if that is
	// not specified, by manual construction of an Endpoints object. If
	// clusterIP is "None", no virtual IP is allocated and the endpoints are
	// published as a set of endpoints rather than a stable IP.
	// "NodePort" builds on ClusterIP and allocates a port on every node which
	// routes to the clusterIP.
	// "LoadBalancer" builds on NodePort and creates an
	// external load-balancer (if supported in the current cloud) which routes
	// to the clusterIP.
	// More info: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services---service-types
	// +optional
	ServiceType string `protobuf:"bytes,6,opt,name=service_type,json=serviceType,proto3" json:"service_type,omitempty"`
	// ExternalIPs is a list of IP addresses for which nodes in the cluster
	// will also accept traffic for this service.  These IPs are not managed
	// by Kubernetes.  The user is responsible for ensuring that traffic
	// arrives at a node with this IP.  A common example is external
	// load-balancers that are not part of the Kubernetes system.
	// +optional
	ExternalIps []string `protobuf:"bytes,7,rep,name=external_ips,json=externalIps" json:"external_ips,omitempty"`
	// A list of IP addresses set as ingress points for IP-based load-balancers
	// (typically GCE, MetalLB or OpenStack load-balancers).
	// Only applies to Service Type: LoadBalancer
	// +optional
	LbIngressIps []string `protobuf:"bytes,8,rep,name=lb_ingress_ips,json=lbIngressIps" json:"lb_ingress_ips,omitempty"`
	// Supports "ClientIP" and "None". Used to maintain session affinity.
	// Enable client IP based session affinity.
	// Must be ClientIP or None.
	// Defaults to None.
	// More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies
	// +optional
	SessionAffinity string `protobuf:"bytes,9,opt,name=session_affinity,json=sessionAffinity,proto3" json:"session_affinity,omitempty"`
	// Only applies to Service Type: LoadBalancer
	// LoadBalancer will get created with the IP specified in this field.
	// This feature depends on whether the underlying cloud-provider supports
	// specifying the loadBalancerIP when a load balancer is created.
	// This field will be ignored if the cloud-provider does not support the
	// feature.
	// +optional
	LoadbalancerIp string `protobuf:"bytes,10,opt,name=loadbalancer_ip,json=loadbalancerIp,proto3" json:"loadbalancer_ip,omitempty"`
	// If specified and supported by the platform, this will restrict traffic
	// through the cloud-provider load-balancer will be restricted to the
	// specified client IPs. This field will be ignored if the cloud-provider
	// does not support the feature."
	// More info: https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/
	// +optional
	LoadbalancerSourceRanges []string `` /* 129-byte string literal not displayed */
	// externalTrafficPolicy denotes if this Service desires to route external
	// traffic to node-local or cluster-wide endpoints. "Local" preserves the
	// client source IP and avoids a second hop for LoadBalancer and Nodeport
	// type services, but risks potentially imbalanced traffic spreading.
	// "Cluster" obscures the client source IP and may cause a second hop to
	// another node, but should have good overall load-spreading.
	// +optional
	ExternalTrafficPolicy string `` /* 127-byte string literal not displayed */
	// healthCheckNodePort specifies the healthcheck nodePort for the service.
	// If not specified, HealthCheckNodePort is created by the service api
	// backend with the allocated nodePort. Will use user-specified nodePort
	// value if specified by the client. Only effects when Type is set to
	// LoadBalancer and ExternalTrafficPolicy is set to Local.
	// +optional
	HealthCheckNodePort  int32    `protobuf:"varint,13,opt,name=health_check_node_port,json=healthCheckNodePort,proto3" json:"health_check_node_port,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Service is a named abstraction of software service (for example, mysql) consisting of local port (for example 3306) that the proxy listens on, and the selector that determines which pods will answer requests sent through the proxy.

func (*Service) Descriptor

func (*Service) Descriptor() ([]byte, []int)

func (*Service) GetClusterIp

func (m *Service) GetClusterIp() string

func (*Service) GetExternalIps

func (m *Service) GetExternalIps() []string

func (*Service) GetExternalTrafficPolicy

func (m *Service) GetExternalTrafficPolicy() string

func (*Service) GetHealthCheckNodePort

func (m *Service) GetHealthCheckNodePort() int32

func (*Service) GetLbIngressIps added in v1.4.1

func (m *Service) GetLbIngressIps() []string

func (*Service) GetLoadbalancerIp

func (m *Service) GetLoadbalancerIp() string

func (*Service) GetLoadbalancerSourceRanges

func (m *Service) GetLoadbalancerSourceRanges() []string

func (*Service) GetName

func (m *Service) GetName() string

func (*Service) GetNamespace

func (m *Service) GetNamespace() string

func (*Service) GetPort

func (m *Service) GetPort() []*Service_ServicePort

func (*Service) GetSelector

func (m *Service) GetSelector() map[string]string

func (*Service) GetServiceType

func (m *Service) GetServiceType() string

func (*Service) GetSessionAffinity

func (m *Service) GetSessionAffinity() string

func (*Service) ProtoMessage

func (*Service) ProtoMessage()

func (*Service) Reset

func (m *Service) Reset()

func (*Service) String

func (m *Service) String() string

func (*Service) XXX_DiscardUnknown added in v1.4.0

func (m *Service) XXX_DiscardUnknown()

func (*Service) XXX_Marshal added in v1.4.0

func (m *Service) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Service) XXX_Merge added in v1.4.0

func (dst *Service) XXX_Merge(src proto.Message)

func (*Service) XXX_Size added in v1.4.0

func (m *Service) XXX_Size() int

func (*Service) XXX_Unmarshal added in v1.4.0

func (m *Service) XXX_Unmarshal(b []byte) error

type Service_ServicePort

type Service_ServicePort struct {
	// The name of this port within the service. This must be a DNS_LABEL.
	// All ports within a ServiceSpec must have unique names. This maps to
	// the 'Name' field in EndpointPort objects.
	// Optional if only one ServicePort is defined on this service.
	// +optional
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// The IP protocol for this port. Supports "TCP" and "UDP".
	// Default is TCP.
	// +optional
	Protocol string `protobuf:"bytes,2,opt,name=protocol,proto3" json:"protocol,omitempty"`
	// The port that will be exposed by this service.
	Port       int32                            `protobuf:"varint,3,opt,name=port,proto3" json:"port,omitempty"`
	TargetPort *Service_ServicePort_IntOrString `protobuf:"bytes,4,opt,name=target_port,json=targetPort" json:"target_port,omitempty"`
	// The port on each node on which this service is exposed when
	// type=NodePort or LoadBalancer.
	NodePort             int32    `protobuf:"varint,5,opt,name=node_port,json=nodePort,proto3" json:"node_port,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

ServicePort contains information on service's port.

func (*Service_ServicePort) Descriptor

func (*Service_ServicePort) Descriptor() ([]byte, []int)

func (*Service_ServicePort) GetName

func (m *Service_ServicePort) GetName() string

func (*Service_ServicePort) GetNodePort

func (m *Service_ServicePort) GetNodePort() int32

func (*Service_ServicePort) GetPort

func (m *Service_ServicePort) GetPort() int32

func (*Service_ServicePort) GetProtocol

func (m *Service_ServicePort) GetProtocol() string

func (*Service_ServicePort) GetTargetPort

func (*Service_ServicePort) ProtoMessage

func (*Service_ServicePort) ProtoMessage()

func (*Service_ServicePort) Reset

func (m *Service_ServicePort) Reset()

func (*Service_ServicePort) String

func (m *Service_ServicePort) String() string

func (*Service_ServicePort) XXX_DiscardUnknown added in v1.4.0

func (m *Service_ServicePort) XXX_DiscardUnknown()

func (*Service_ServicePort) XXX_Marshal added in v1.4.0

func (m *Service_ServicePort) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Service_ServicePort) XXX_Merge added in v1.4.0

func (dst *Service_ServicePort) XXX_Merge(src proto.Message)

func (*Service_ServicePort) XXX_Size added in v1.4.0

func (m *Service_ServicePort) XXX_Size() int

func (*Service_ServicePort) XXX_Unmarshal added in v1.4.0

func (m *Service_ServicePort) XXX_Unmarshal(b []byte) error

type Service_ServicePort_IntOrString

type Service_ServicePort_IntOrString struct {
	Type                 Service_ServicePort_IntOrString_Type `protobuf:"varint,1,opt,name=type,proto3,enum=service.Service_ServicePort_IntOrString_Type" json:"type,omitempty"`
	IntVal               int32                                `protobuf:"varint,2,opt,name=int_val,json=intVal,proto3" json:"int_val,omitempty"`
	StringVal            string                               `protobuf:"bytes,3,opt,name=string_val,json=stringVal,proto3" json:"string_val,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                             `json:"-"`
	XXX_unrecognized     []byte                               `json:"-"`
	XXX_sizecache        int32                                `json:"-"`
}

Number or name of the port to access on the pods targeted by the service. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. If this is a string, it will be looked up as a named port in the target Pod's container ports. If this is not specified, the value of the 'port' field is used (an identity map). This field is ignored for services with clusterIP=None, and should be omitted or set equal to the 'port' field. +optional

func (*Service_ServicePort_IntOrString) Descriptor

func (*Service_ServicePort_IntOrString) Descriptor() ([]byte, []int)

func (*Service_ServicePort_IntOrString) GetIntVal

func (m *Service_ServicePort_IntOrString) GetIntVal() int32

func (*Service_ServicePort_IntOrString) GetStringVal

func (m *Service_ServicePort_IntOrString) GetStringVal() string

func (*Service_ServicePort_IntOrString) GetType

func (*Service_ServicePort_IntOrString) ProtoMessage

func (*Service_ServicePort_IntOrString) ProtoMessage()

func (*Service_ServicePort_IntOrString) Reset

func (*Service_ServicePort_IntOrString) String

func (*Service_ServicePort_IntOrString) XXX_DiscardUnknown added in v1.4.0

func (m *Service_ServicePort_IntOrString) XXX_DiscardUnknown()

func (*Service_ServicePort_IntOrString) XXX_Marshal added in v1.4.0

func (m *Service_ServicePort_IntOrString) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Service_ServicePort_IntOrString) XXX_Merge added in v1.4.0

func (dst *Service_ServicePort_IntOrString) XXX_Merge(src proto.Message)

func (*Service_ServicePort_IntOrString) XXX_Size added in v1.4.0

func (m *Service_ServicePort_IntOrString) XXX_Size() int

func (*Service_ServicePort_IntOrString) XXX_Unmarshal added in v1.4.0

func (m *Service_ServicePort_IntOrString) XXX_Unmarshal(b []byte) error

type Service_ServicePort_IntOrString_Type

type Service_ServicePort_IntOrString_Type int32
const (
	Service_ServicePort_IntOrString_NUMBER Service_ServicePort_IntOrString_Type = 0
	Service_ServicePort_IntOrString_STRING Service_ServicePort_IntOrString_Type = 1
)

func (Service_ServicePort_IntOrString_Type) EnumDescriptor

func (Service_ServicePort_IntOrString_Type) EnumDescriptor() ([]byte, []int)

func (Service_ServicePort_IntOrString_Type) String

Jump to

Keyboard shortcuts

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