serviceclient

package
v1.20.9 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// ServiceRegistryCustom for mesos-adapter
	ServiceRegistryCustom = "custom"
	// ServiceRegistryKubernetes for bcs kubernetes
	ServiceRegistryKubernetes = "kubernetes"
	// ServiceRegistryMesos for mesos etcd storage
	ServiceRegistryMesos = "mesos"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AppNode

type AppNode struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Index             string      `json:"index"`              //node key, pod instance name / taskgroup name
	Version           string      `json:"version,omitempty"`  //node version, like v1, v1.1, v12.01.1, come from env[BCS_DISCOVERY_VERSION]
	Weight            uint        `json:"weight,omitempty"`   //node weight, it's a Relative value
	Network           string      `json:"network,omitempty"`  //app node network mode
	NodeIP            string      `json:"nodeIP"`             //node ip address
	ProxyIP           string      `json:"proxyIP,omitempty"`  //proxy ip address for this node
	Ports             []NodePort  `json:"ports,omitempty"`    //port info for container
	Spec              interface{} `json:"spec,omitempty"`     //user custom definition attributes
	RawBytes          string      `json:"rawBytes,omitempty"` //raw string for user custom definition
}

AppNode node info from Taskgroup/Pod

func (*AppNode) GetPort

func (node *AppNode) GetPort(name string) *NodePort

GetPort get port by port name

type AppService

type AppService struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Version           string        `json:"version,omitempty"`
	Type              string        `json:"type,omitempty"`     //service type, ClusterIP, Intergration or Empty
	Frontend          []string      `json:"frontend,omitempty"` //frontend represents service ip address, use for proxy or intergate
	Alias             string        `json:"alias,omitempty"`    //domain alias
	WANIP             []string      `json:"wanip,omitempty"`    //use for wan export
	Master            string        `json:"master,omitempty"`   //reserved
	ServicePorts      []ServicePort `json:"ports"`              //BcsService.Ports
	Nodes             []AppNode     `json:"nodes"`              //TaskGroup/Pod info
	Spec              interface{}   `json:"spec,omitempty"`     //user custom definition attributes
	RawBytes          string        `json:"rawBytes,omitempty"` //raw string for user custom definition
}

AppService internal service structure for container service discovery

type Client

type Client interface {
	// GetAppService get service by specified namespace & name
	GetAppService(ns, name string) (*AppService, error)
	// ListAppService list all service in cache, filter by Label
	// selector comes from Set.AsSelector() see: k8s.io/apimachinery/pkg/labels.Set
	ListAppService(labels map[string]string) ([]*AppService, error)
	// ListAppServiceFromStatefulSet list app services, for each stateful node, generate a AppService object
	ListAppServiceFromStatefulSet(ns, name string) ([]*AppService, error)
	// Close client, clean resource
	Close()
}

Client service

type NodeList

type NodeList []AppNode

NodeList list for AppNode

func (NodeList) Len

func (list NodeList) Len() int

Len is the number of elements in the collection.

func (NodeList) Less

func (list NodeList) Less(i, j int) bool

Less reports whether the element with index i should sort before the element with index j.

func (NodeList) Swap

func (list NodeList) Swap(i, j int)

Swap swaps the elements with indexes i and j.

type NodePort

type NodePort struct {
	Name      string `json:"name"`                //name for port, must equal to one service port
	Protocol  string `json:"protocol"`            //protocol for this port
	NodePort  int    `json:"nodeport"`            //node port
	ProxyPort int    `json:"proxyport,omitempty"` //proxy port if exists
}

NodePort port info for one node of service

type PortList

type PortList []NodePort

PortList list for ports

func (PortList) Len

func (list PortList) Len() int

Len is the number of elements in the collection.

func (PortList) Less

func (list PortList) Less(i, j int) bool

Less reports whether the element with index i should sort before the element with index j.

func (PortList) Swap

func (list PortList) Swap(i, j int)

Swap swaps the elements with indexes i and j.

type ServicePort

type ServicePort struct {
	Name        string `json:"name"`                 //name for service port
	Protocol    string `json:"protocol"`             //protocol for service port
	Domain      string `json:"domain,omitempty"`     //domain value for http proxy
	Path        string `json:"path,omitempty"`       //http url path
	ServicePort int    `json:"serviceport"`          //service port for all AppNode, ServicePort.Name == AppNode.Ports[i].Name
	ProxyPort   int    `json:"proxyport,omitempty"`  //proxy port for this Service Port if exist
	TargetPort  int    `json:"targetport,omitempty"` //target port for this Service Port
}

ServicePort port definition for application

type ServicePortList

type ServicePortList []ServicePort

ServicePortList list for sorting

func (ServicePortList) Len

func (list ServicePortList) Len() int

Len is the number of elements in the collection.

func (ServicePortList) Less

func (list ServicePortList) Less(i, j int) bool

Less reports whether the element with index i should sort before the element with index j.

func (ServicePortList) Swap

func (list ServicePortList) Swap(i, j int)

Swap swaps the elements with indexes i and j.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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