k8s

package
v18.8.4+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2018 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	All                   = "all"
	Authority             = "authority"
	DaemonSet             = "daemonset"
	Deployment            = "deployment"
	Namespace             = "namespace"
	Pod                   = "pod"
	ReplicationController = "replicationcontroller"
	ReplicaSet            = "replicaset"
	Service               = "service"
	StatefulSet           = "statefulset"
)
View Source
const (

	// ControllerComponentLabel identifies this object as a component of Linkerd's
	// control plane (e.g. web, controller).
	ControllerComponentLabel = "linkerd.io/control-plane-component"

	// ControllerNSLabel is injected into mesh-enabled apps, identifying the
	// namespace of the Linkerd control plane.
	ControllerNSLabel = "linkerd.io/control-plane-ns"

	// ProxyDeploymentLabel is injected into mesh-enabled apps, identifying the
	// deployment that this proxy belongs to.
	ProxyDeploymentLabel = "linkerd.io/proxy-deployment"

	// ProxyReplicationControllerLabel is injected into mesh-enabled apps,
	// identifying the ReplicationController that this proxy belongs to.
	ProxyReplicationControllerLabel = "linkerd.io/proxy-replicationcontroller"

	// ProxyReplicaSetLabel is injected into mesh-enabled apps, identifying the
	// ReplicaSet that this proxy belongs to.
	ProxyReplicaSetLabel = "linkerd.io/proxy-replicaset"

	// ProxyJobLabel is injected into mesh-enabled apps, identifying the Job that
	// this proxy belongs to.
	ProxyJobLabel = "linkerd.io/proxy-job"

	// ProxyDaemonSetLabel is injected into mesh-enabled apps, identifying the
	// DaemonSet that this proxy belongs to.
	ProxyDaemonSetLabel = "linkerd.io/proxy-daemonset"

	// ProxyStatefulSetLabel is injected into mesh-enabled apps, identifying the
	// StatefulSet that this proxy belongs to.
	ProxyStatefulSetLabel = "linkerd.io/proxy-statefulset"

	// CreatedByAnnotation indicates the source of the injected data plane
	// (e.g. linkerd/cli v2.0.0).
	CreatedByAnnotation = "linkerd.io/created-by"

	// ProxyVersionAnnotation indicates the version of the injected data plane
	// (e.g. v0.1.3).
	ProxyVersionAnnotation = "linkerd.io/proxy-version"

	// TLSTrustAnchorConfigMapName is the name of the ConfigMap that holds the
	// trust anchors (trusted root certificates).
	TLSTrustAnchorConfigMapName = "linkerd-ca-bundle"

	// TLSTrustAnchorFileName is the name (key) within the trust anchor ConfigMap
	// that contains the actual trust anchor bundle.
	TLSTrustAnchorFileName = "trust-anchors.pem"

	TLSCertFileName       = "certificate.crt"
	TLSPrivateKeyFileName = "private-key.p8"
)

Variables

View Source
var StatAllResourceTypes = []string{
	Deployment,
	ReplicationController,
	Pod,
	Service,
	Authority,
}

resources to query in StatSummary when Resource.Type is "all"

Functions

func CanonicalResourceNameFromFriendlyName added in v0.5.0

func CanonicalResourceNameFromFriendlyName(friendlyName string) (string, error)

CanonicalResourceNameFromFriendlyName returns a canonical name from common shorthands used in command line tools. This works based on https://github.com/kubernetes/kubernetes/blob/63ffb1995b292be0a1e9ebde6216b83fc79dd988/pkg/kubectl/kubectl.go#L39 This also works for non-k8s resources, e.g. authorities

func CreatedByAnnotationValue added in v0.3.0

func CreatedByAnnotationValue() string

CreatedByAnnotationValue returns the value associated with CreatedByAnnotation.

func GetPodLabels

func GetPodLabels(ownerKind, ownerName string, pod *coreV1.Pod) map[string]string

GetPodLabels returns the set of prometheus owner labels for a given pod

func IsMeshed

func IsMeshed(pod *coreV1.Pod, controllerNS string) bool

func ShortNameFromCanonicalResourceName added in v0.5.0

func ShortNameFromCanonicalResourceName(canonicalName string) string

Return a the shortest name for a k8s canonical name. Essentially the reverse of CanonicalResourceNameFromFriendlyName

Types

type KubernetesAPI

type KubernetesAPI struct {
	*rest.Config
}

func NewAPI added in v0.3.1

func NewAPI(configPath string) (*KubernetesAPI, error)

NewAPI validates a Kubernetes config and returns a client for accessing the configured cluster

func (*KubernetesAPI) CheckVersion

func (kubeAPI *KubernetesAPI) CheckVersion(versionInfo *version.Info) error

func (*KubernetesAPI) GetPodsForNamespace

func (kubeAPI *KubernetesAPI) GetPodsForNamespace(client *http.Client, namespace string) ([]v1.Pod, error)

func (*KubernetesAPI) GetVersionInfo

func (kubeAPI *KubernetesAPI) GetVersionInfo(client *http.Client) (*version.Info, error)

func (*KubernetesAPI) NamespaceExists

func (kubeAPI *KubernetesAPI) NamespaceExists(client *http.Client, namespace string) (bool, error)

func (*KubernetesAPI) NewClient

func (kubeAPI *KubernetesAPI) NewClient() (*http.Client, error)

func (*KubernetesAPI) UrlFor

func (kubeAPI *KubernetesAPI) UrlFor(namespace string, extraPathStartingWithSlash string) (*url.URL, error)

UrlFor generates a URL based on the Kubernetes config.

type KubernetesProxy added in v0.3.0

type KubernetesProxy struct {
	// contains filtered or unexported fields
}

func NewProxy added in v0.3.1

func NewProxy(configPath string, proxyPort int) (*KubernetesProxy, error)

NewProxy returns a new KubernetesProxy object and starts listening on a network address.

func (*KubernetesProxy) Run added in v0.3.0

func (kp *KubernetesProxy) Run() error

Run starts proxying a connection to Kubernetes, and blocks until the process exits.

func (*KubernetesProxy) URLFor added in v0.3.0

func (kp *KubernetesProxy) URLFor(namespace string, extraPathStartingWithSlash string) (*url.URL, error)

URLFor generates a URL based on the configured KubernetesProxy.

type TLSIdentity added in v0.5.0

type TLSIdentity struct {
	// Name is the name of the pod owner.
	Name string

	// Kind is the singular, lowercased Kubernetes resource type of the pod owner
	// (deployment, daemonset, job, replicationcontroller, etc.).
	Kind string

	// Namespace is the pod's namespace. Kubernetes requires that pods and
	// pod owners be in the same namespace.
	Namespace string

	// ControllerNamespace is the namespace of the controller for the pod.
	ControllerNamespace string
}

TLSIdentity is the identity of a pod owner (Deployment, Pod, ReplicationController, etc.).

func (TLSIdentity) ToControllerIdentity added in v0.5.0

func (i TLSIdentity) ToControllerIdentity() TLSIdentity

func (TLSIdentity) ToDNSName added in v0.5.0

func (i TLSIdentity) ToDNSName() string

func (TLSIdentity) ToSecretName added in v0.5.0

func (i TLSIdentity) ToSecretName() string

Jump to

Keyboard shortcuts

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