kube

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2018 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPodNotFound = errors.New("pod not found")
	ErrPodNotReady = errors.New("pod not ready")
)

Pod Errors

View Source
var DefaultInstallOptions = InstallOptions{
	Namespace: "kube-system",
	Labels: map[string]string{
		"name": "needle",
		"app":  "compass",
	},
	RBAC:               false,
	ServiceAccountName: "needle",
	DeoploymentName:    "needle",
	Replicas:           1,
	PGPVClaimName:      "needle-postgres-pv",
	PGPassword:         "",
	PGPWSecretName:     "needle-postgres-password",
	PGPWSecretKey:      "password",
}

Default install options - these can be modified using Option functions

View Source
var DefaultTunnelOptions = TunnelOptions{
	Namespace: "kube-system",
	PodLabels: labels.Set{
		"name": "needle",
		"app":  "compass",
	},
	RemotePort: 5000,
}

Default Tunnel Options

Functions

func Clientset

func Clientset(overrides ...OverrideOption) (*kubernetes.Clientset, error)

Clientset creates a new kubernetes Clientset

func Config

func Config(overrides ...OverrideOption) clientcmd.ClientConfig

Returns a kubernetes client config - with no overrides

func FreePort

func FreePort() (int, error)

FreePort returns a free open port to forward requests too locally

func Install

func Install(client *kubernetes.Clientset, opts ...InstallOption) error

Install will intall neeedle into a k8s cluster

func RestClient

func RestClient(overrides ...OverrideOption) (*rest.Config, kubernetes.Interface, error)

RestClient creates a Kubernetes config and client for a given kubeconfig context.

Types

type InstallOption

type InstallOption func(*InstallOptions)

An Option can configure InstallOptions

func InstallWithDeploymentName

func InstallWithDeploymentName(name string) InstallOption

WithDeploymentName sets the deployment name

func InstallWithLabels

func InstallWithLabels(labels map[string]string) InstallOption

WithLabels sets the labels used for the needle install

func InstallWithNamerdHost

func InstallWithNamerdHost(name string) InstallOption

InstallWithNamerdHost sets the namerd configuration

func InstallWithNamespace

func InstallWithNamespace(name string) InstallOption

WithNamespace sets the namespace needle should be installed into

func InstallWithRBAC

func InstallWithRBAC() InstallOption

WithRBAC enables RBAC roles to be created for needle on install

func InstallWithVersion

func InstallWithVersion(version string) InstallOption

InstallWithVersion sets the version to install

func WithInastallServiceAccount

func WithInastallServiceAccount(name string) InstallOption

WithServiceAccount sets the service account name

type InstallOptions

type InstallOptions struct {
	Namespace          string
	RBAC               bool
	ServiceAccountName string
	DeoploymentName    string
	Replicas           int32
	Labels             map[string]string
	NamerdHost         string
	PGPVClaimName      string
	PGPassword         string
	PGPWSecretName     string
	PGPWSecretKey      string
	Version            string
}

InstallOptions configures the installation of needle into a k8s cluster

type OverrideOption

type OverrideOption func(o *clientcmd.ConfigOverrides)

Allows kubernetes config overrides

func WithCurrentContext

func WithCurrentContext(c string) OverrideOption

WithCurrentContext overrides a kubernetes client context

type Tunnel

type Tunnel struct {
	// Options to configure the tunnel
	Options TunnelOptions
	// contains filtered or unexported fields
}

Tunnel opens a tunnel to a kubernetes port locally

func NewTunnel

func NewTunnel(opts ...TunnelOption) *Tunnel

New constructs a new Tunnel

func (*Tunnel) Close

func (t *Tunnel) Close()

Close stops the port forward

func (*Tunnel) LocalAddress

func (t *Tunnel) LocalAddress() string

LocalAddress returns the local address, e.g 127.0.0.1:12345

func (*Tunnel) Open

func (t *Tunnel) Open() error

Open opens the tunnel

func (*Tunnel) Port

func (t *Tunnel) Port() int

Port returns the local port the port forward is served on

type TunnelOption

type TunnelOption func(o *TunnelOptions)

An Option configures a Tunnel

func TunnelWithNamespace

func TunnelWithNamespace(namespace string) TunnelOption

WithPodName returns an Option for configuring the namespace

func TunnelWithPodLabels

func TunnelWithPodLabels(labels labels.Set) TunnelOption

TunnelWithPodLabels sets the pod labels to tunnel too

func TunnelWithRemotePort

func TunnelWithRemotePort(port int) TunnelOption

WithRemotePort returns an Option for configuring the Tunnel remote port

type TunnelOptions

type TunnelOptions struct {
	Namespace  string
	PodLabels  labels.Set
	RemotePort int
}

TunnelOptions configures a Tunnel

Jump to

Keyboard shortcuts

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