kube

package
v0.0.0-...-12ae606 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package kube implements functionality to build Kubernetes for the purposes of installing into the kind node image

Index

Constants

View Source
const ImportPath = "k8s.io/kubernetes"

ImportPath is the canonical import path for the kubernetes root package this is used by FindSource

Variables

This section is empty.

Functions

func FindSource

func FindSource() (root string, err error)

FindSource attempts to locate a kubernetes checkout using go's build package

func NamedBitsRegistered

func NamedBitsRegistered(name string) bool

NamedBitsRegistered returns true if name is in the registry backing NewNamedBits

func RegisterNamedBits

func RegisterNamedBits(name string, fn func(string) (Bits, error))

RegisterNamedBits registers a new named Bits implementation for use from NewNamedBits

Types

type AptBits

type AptBits struct {
}

AptBits implements Bits for the official upstream debian packages

func (*AptBits) Build

func (b *AptBits) Build() error

Build implements Bits.Build for AptBits this does nothing

func (*AptBits) Install

func (b *AptBits) Install(install InstallContext) error

Install implements Bits.Install

func (*AptBits) Paths

func (b *AptBits) Paths() map[string]string

Paths implements Bits.Paths

type BazelBuildBits

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

BazelBuildBits implements Bits for a local Bazel build

func (*BazelBuildBits) Build

func (b *BazelBuildBits) Build() error

Build implements Bits.Build

func (*BazelBuildBits) Install

func (b *BazelBuildBits) Install(install InstallContext) error

Install implements Bits.Install

func (*BazelBuildBits) Paths

func (b *BazelBuildBits) Paths() map[string]string

Paths implements Bits.Paths

type Bits

type Bits interface {
	// Build returns any errors encountered while building it Kubernetes.
	// Some implementations (upstream binaries) may use this step to obtain
	// an existing build isntead
	Build() error
	// Paths returns a map of path on host machine to desired path in the image
	// These paths will be populated in the image relative to some base path,
	// obtainable by NodeInstall.BasePath()
	// Note: if Images are populated to images/, the cluster provisioning
	// will load these prior to calling kubeadm
	Paths() map[string]string
	// Install should install the built sources on the node, assuming paths
	// have been populated
	Install(InstallContext) error
}

Bits provides the locations of Kubernetes Binaries / Images needed on the cluster nodes Implementations should be registered with RegisterNamedBits

func NewAptBits

func NewAptBits(kubeRoot string) (bits Bits, err error)

NewAptBits returns a new Bits backed by the upstream debian packages

func NewBazelBuildBits

func NewBazelBuildBits(kubeRoot string) (bits Bits, err error)

NewBazelBuildBits returns a new Bits backed by bazel build, given kubeRoot, the path to the kubernetes source directory

func NewDockerBuildBits

func NewDockerBuildBits(kubeRoot string) (bits Bits, err error)

NewDockerBuildBits returns a new Bits backed by the docker-ized build, given kubeRoot, the path to the kubernetes source directory

func NewNamedBits

func NewNamedBits(name string, kubeRoot string) (bits Bits, err error)

NewNamedBits returns a new Bits by named implementation currently this includes: "apt" -> NewAptBits(kubeRoot) "bazel" -> NewBazelBuildBits(kubeRoot) "docker" or "make" -> NewDockerBuildBits(kubeRoot)

type DockerBuildBits

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

DockerBuildBits implements Bits for a local docker-ized make / bash build

func (*DockerBuildBits) Build

func (b *DockerBuildBits) Build() error

Build implements Bits.Build

func (*DockerBuildBits) Install

func (b *DockerBuildBits) Install(install InstallContext) error

Install implements Bits.Install

func (*DockerBuildBits) Paths

func (b *DockerBuildBits) Paths() map[string]string

Paths implements Bits.Paths

type InstallContext

type InstallContext interface {
	// Returns the base path Paths() were populated relative to
	BasePath() string
	// Run execs (cmd, ...args) in the build container and returns error
	Run(string, ...string) error
	// CombinedOutputLines is like Run but returns the output lines
	CombinedOutputLines(string, ...string) ([]string, error)
}

InstallContext should be implemented by users of Bits to allow installing the bits in a Docker image

Jump to

Keyboard shortcuts

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