istio: istio.io/istio/pilot/pkg/serviceregistry/kube/controller Index | Files

package controller

import "istio.io/istio/pilot/pkg/serviceregistry/kube/controller"

package controller implements the shared and reusable library for Kubernetes

Index

Package Files

client.go controller.go pod.go util.go

Constants

const (
    // NodeRegionLabel is the well-known label for kubernetes node region in beta
    NodeRegionLabel = "failure-domain.beta.kubernetes.io/region"
    // NodeZoneLabel is the well-known label for kubernetes node zone in beta
    NodeZoneLabel = "failure-domain.beta.kubernetes.io/zone"
    // NodeRegionLabelGA is the well-known label for kubernetes node region in ga
    NodeRegionLabelGA = "failure-domain.kubernetes.io/region"
    // NodeZoneLabelGA is the well-known label for kubernetes node zone in ga
    NodeZoneLabelGA = "failure-domain.kubernetes.io/zone"
    // IstioNamespace used by default for Istio cluster-wide installation
    IstioNamespace = "istio-system"
    // IstioConfigMap is used by default
    IstioConfigMap = "istio"
    // PrometheusScrape is the annotation used by prometheus to determine if service metrics should be scraped (collected)
    PrometheusScrape = "prometheus.io/scrape"
    // PrometheusPort is the annotation used to explicitly specify the port to use for scraping metrics
    PrometheusPort = "prometheus.io/port"
    // PrometheusPath is the annotation used to specify a path for scraping metrics. Default is "/metrics"
    PrometheusPath = "prometheus.io/path"
    // PrometheusPathDefault is the default value for the PrometheusPath annotation
    PrometheusPathDefault = "/metrics"
)

func CreateInterface Uses

func CreateInterface(kubeconfig string) (kubernetes.Interface, error)

CreateInterface is a helper function to create Kubernetes interface from kubeconfig file

func FindPort Uses

func FindPort(pod *v1.Pod, svcPort *v1.ServicePort) (int, error)

Forked from Kubernetes k8s.io/kubernetes/pkg/api/v1/pod FindPort locates the container port for the given pod and portName. If the targetPort is a number, use that. If the targetPort is a string, look that string up in all named ports in all containers in the target pod. If no match is found, fail.

type Controller Uses

type Controller struct {

    // Env is set by server to point to the environment, to allow the controller to
    // use env data and push status. It may be null in tests.
    Env *model.Environment

    // ClusterID identifies the remote cluster in a multicluster env.
    ClusterID string

    // XDSUpdater will push EDS changes to the ADS model.
    XDSUpdater model.XDSUpdater

    sync.RWMutex
    // contains filtered or unexported fields
}

Controller is a collection of synchronized resource watchers Caches are thread-safe

func NewController Uses

func NewController(client kubernetes.Interface, options Options) *Controller

NewController creates a new Kubernetes controller Created by bootstrap and multicluster (see secretcontroler).

func (*Controller) AppendInstanceHandler Uses

func (c *Controller) AppendInstanceHandler(f func(*model.ServiceInstance, model.Event)) error

AppendInstanceHandler implements a service catalog operation

func (*Controller) AppendServiceHandler Uses

func (c *Controller) AppendServiceHandler(f func(*model.Service, model.Event)) error

AppendServiceHandler implements a service catalog operation

func (*Controller) GetIstioServiceAccounts Uses

func (c *Controller) GetIstioServiceAccounts(svc *model.Service, ports []int) []string

GetIstioServiceAccounts returns the Istio service accounts running a serivce hostname. Each service account is encoded according to the SPIFFE VSID spec. For example, a service account named "bar" in namespace "foo" is encoded as "spiffe://cluster.local/ns/foo/sa/bar".

func (*Controller) GetPodLocality Uses

func (c *Controller) GetPodLocality(pod *v1.Pod) string

GetPodLocality retrieves the locality for a pod.

func (*Controller) GetProxyServiceInstances Uses

func (c *Controller) GetProxyServiceInstances(proxy *model.Proxy) ([]*model.ServiceInstance, error)

GetProxyServiceInstances returns service instances co-located with a given proxy

func (*Controller) GetProxyWorkloadLabels Uses

func (c *Controller) GetProxyWorkloadLabels(proxy *model.Proxy) (labels.Collection, error)

func (*Controller) GetService Uses

func (c *Controller) GetService(hostname host.Name) (*model.Service, error)

GetService implements a service catalog operation by hostname specified.

func (*Controller) HasSynced Uses

func (c *Controller) HasSynced() bool

HasSynced returns true after the initial state synchronization

func (*Controller) InitNetworkLookup Uses

func (c *Controller) InitNetworkLookup(meshNetworks *meshconfig.MeshNetworks)

InitNetworkLookup will read the mesh networks configuration from the environment and initialize CIDR rangers for an efficient network lookup when needed

func (*Controller) InstancesByPort Uses

func (c *Controller) InstancesByPort(svc *model.Service, reqSvcPort int,
    labelsList labels.Collection) ([]*model.ServiceInstance, error)

InstancesByPort implements a service catalog operation

func (*Controller) ManagementPorts Uses

func (c *Controller) ManagementPorts(addr string) model.PortList

ManagementPorts implements a service catalog operation

func (*Controller) Run Uses

func (c *Controller) Run(stop <-chan struct{})

Run all controllers until a signal is received

func (*Controller) Services Uses

func (c *Controller) Services() ([]*model.Service, error)

Services implements a service catalog operation

func (*Controller) Stop Uses

func (c *Controller) Stop()

Stop the controller. Mostly for tests, to simplify the code (defer c.Stop())

func (*Controller) WorkloadHealthCheckInfo Uses

func (c *Controller) WorkloadHealthCheckInfo(addr string) model.ProbeList

WorkloadHealthCheckInfo implements a service catalog operation

type Options Uses

type Options struct {
    // Namespace the controller watches. If set to meta_v1.NamespaceAll (""), controller watches all namespaces
    WatchedNamespace string
    ResyncPeriod     time.Duration
    DomainSuffix     string

    // ClusterID identifies the remote cluster in a multicluster env.
    ClusterID string

    // XDSUpdater will push changes to the xDS server.
    XDSUpdater model.XDSUpdater

    // TrustDomain used in SPIFFE identity
    TrustDomain string
}

Options stores the configurable attributes of a Controller.

type PodCache Uses

type PodCache struct {
    sync.RWMutex
    // contains filtered or unexported fields
}

PodCache is an eventually consistent pod cache

Package controller imports 31 packages (graph) and is imported by 18 packages. Updated 2019-11-14. Refresh now. Tools for package owners.