Documentation ¶
Index ¶
- Constants
- Variables
- func CanonicalKubernetesNameFromFriendlyName(friendlyName string) (string, error)
- func CreatedByAnnotationValue() string
- func GetOwnerLabels(objectMeta meta.ObjectMeta) map[string]string
- func ShortNameFromCanonicalKubernetesName(canonicalName string) string
- type KubernetesApi
- type KubernetesProxy
- type MockKubeApi
Constants ¶
const ( KubeapiSubsystemName = "kubernetes-api" KubeapiClientCheckDescription = "can initialize the client" KubeapiAccessCheckDescription = "can query the Kubernetes API" KubeapiVersionCheckDescription = "is running the minimum Kubernetes API version" )
const ( Deployments = "deployments" Namespaces = "namespaces" Pods = "pods" ReplicationControllers = "replicationcontrollers" Services = "services" All = "all" )
const ( // ControllerComponentLabel identifies this object as a component of Conduit's // control plane (e.g. web, controller). ControllerComponentLabel = "conduit.io/control-plane-component" // ControllerNSLabel is injected into mesh-enabled apps, identifying the // namespace of the Conduit control plane. ControllerNSLabel = "conduit.io/control-plane-ns" // ProxyDeploymentLabel is injected into mesh-enabled apps, identifying the // deployment that this proxy belongs to. ProxyDeploymentLabel = "conduit.io/proxy-deployment" // ProxyReplicationControllerLabel is injected into mesh-enabled apps, // identifying the ReplicationController that this proxy belongs to. ProxyReplicationControllerLabel = "conduit.io/proxy-replication-controller" // ProxyReplicaSetLabel is injected into mesh-enabled apps, identifying the // ReplicaSet that this proxy belongs to. ProxyReplicaSetLabel = "conduit.io/proxy-replica-set" // ProxyJobLabel is injected into mesh-enabled apps, identifying the Job that // this proxy belongs to. ProxyJobLabel = "conduit.io/proxy-job" // ProxyDaemonSetLabel is injected into mesh-enabled apps, identifying the // DaemonSet that this proxy belongs to. ProxyDaemonSetLabel = "conduit.io/proxy-daemon-set" // ProxyStatefulSetLabel is injected into mesh-enabled apps, identifying the // StatefulSet that this proxy belongs to. ProxyStatefulSetLabel = "conduit.io/proxy-stateful-set" // CreatedByAnnotation indicates the source of the injected data plane // (e.g. conduit/cli v0.1.3). CreatedByAnnotation = "conduit.io/created-by" // ProxyVersionAnnotation indicates the version of the injected data plane // (e.g. v0.1.3). ProxyVersionAnnotation = "conduit.io/proxy-version" )
Variables ¶
var ResourceTypesToProxyLabels = map[string]string{ Deployments: "deployment", Namespaces: "namespace", Pods: "pod", ReplicationControllers: "replication_controller", Services: "service", }
ResourceTypesToProxyLabels maps Kubernetes resource type names to keys understood by the proxy, specifically Destination and Prometheus labels.
Functions ¶
func CanonicalKubernetesNameFromFriendlyName ¶
CanonicalKubernetesNameFromFriendlyName 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
func CreatedByAnnotationValue ¶ added in v0.3.0
func CreatedByAnnotationValue() string
CreatedByAnnotationValue returns the value associated with CreatedByAnnotation.
func GetOwnerLabels ¶ added in v0.4.0
func GetOwnerLabels(objectMeta meta.ObjectMeta) map[string]string
GetOwnerLabels returns the set of prometheus owner labels that can be extracted from the proxy labels that have been added to an injected kubernetes resource
func ShortNameFromCanonicalKubernetesName ¶ added in v0.4.2
Return a the shortest name for a k8s canonical name. Essentially the reverse of CanonicalKubernetesNameFromFriendlyName
Types ¶
type KubernetesApi ¶
type KubernetesApi interface { UrlFor(namespace string, extraPathStartingWithSlash string) (*url.URL, error) NewClient() (*http.Client, error) healthcheck.StatusChecker }
func NewAPI ¶ added in v0.3.1
func NewAPI(configPath string) (KubernetesApi, error)
NewAPI returns a new KubernetesApi interface
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.
type MockKubeApi ¶
type MockKubeApi struct { SelfCheckResultsToReturn []*healthcheckPb.CheckResult UrlForNamespaceReceived string UrlExtraPathStartingWithSlashReceived string UrlForUrlToReturn *url.URL NewClientClientToReturn *http.Client ErrorToReturn error }
func (*MockKubeApi) SelfCheck ¶
func (m *MockKubeApi) SelfCheck() []*healthcheckPb.CheckResult