Documentation ¶
Overview ¶
k8s implements Kubernetes-specific code.
SPDX-License-Identifier: MIT Copyright (c) 2019 Hadrien Chauvin
SPDX-License-Identifier: MIT Copyright (c) 2019 Hadrien Chauvin
SPDX-License-Identifier: MIT Copyright (c) 2019 Hadrien Chauvin
Index ¶
- Constants
- func NewClient(cfg *config.Config) (*kubernetes.Clientset, error)
- type K8s
- func (k8s *K8s) Apply(ctx context.Context, resourcesPath string, labelSelector string) error
- func (k8s *K8s) DeleteAll(ctx context.Context, labelSelector string) error
- func (k8s *K8s) Gc(ctx context.Context, cfg *config.Config, name names.Name) error
- func (k8s *K8s) KubectlCommandContext(ctx context.Context, args ...string) (*exec.Cmd, error)
- func (k8s *K8s) KubectlLikeCommandContext(ctx context.Context, command string, args ...string) (*exec.Cmd, error)
- func (k8s *K8s) Tail(ctx context.Context, cfg *config.Config, name names.Name) error
- func (k8s *K8s) WaitForEndpoints(ctx context.Context, k8sNamespace string, name names.Name) error
- func (k8s *K8s) WaitForPods(ctx context.Context, k8sNamespace string, name names.Name) error
- type Labels
- type Ports
- type ServiceSpec
Constants ¶
const ( // StackLabel is a label put on all the Kubernetes resources a stack. This label // indicates ownership, and can be used for resource pruning (kubectl --prune) // and deletion, when the stack is removed. StackLabel = "warp.stack" // ServiceLabel is a label put on a Service resource to identify it. Typically, // the service name (coming from metadata.name) contains some stack-specific // prefix, which makes it difficult to refer to a service by its name. ServiceLabel = "warp.service" // NameLabel is a label put on any resource to identify it. Typically, // the resource name (coming from metadata.name) contains some stack-specific // prefix, which makes it difficult to refer to a resource by its name. NameLabel = "warp.name" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type K8s ¶
type K8s struct { Ports *Ports // contains filtered or unexported fields }
func (*K8s) KubectlCommandContext ¶
func (*K8s) KubectlLikeCommandContext ¶
func (*K8s) WaitForEndpoints ¶
WaitForEndpoints waits for all the services to have at least one ready endpoint.
type Labels ¶
Labels maps labels to values. Combining Labels with the String function gives a convenient way to specify a Kubernetes selector.
type Ports ¶
type Ports struct {
// contains filtered or unexported fields
}
Ports is a "singleton" to pass around port forwarding information. This singleton keeps track of all the port forwarding to 1) avoid forwarding ports in duplicate, 2) provide a single function to cancel all the port forwarding.
func (*Ports) CancelForwarding ¶
func (ports *Ports) CancelForwarding()
CancelForwarding cancels all the port forwarding.
func (*Ports) PodPortForward ¶
func (ports *Ports) PodPortForward(service ServiceSpec, localPort, exposedTCPPort int) error
PodPortForward forward a remote port to a fixed local port. The remote port comes from the first pod that matches a service spec.
type ServiceSpec ¶
type ServiceSpec struct { // Namespace is the Kubernetes namespace to which the service belongs. Namespace string // Labels is a Kubernetes selector. Labels string }
ServiceSpec specifies a Kubernetes service to forward from.
func (ServiceSpec) String ¶
func (s ServiceSpec) String() string