kube

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2019 License: Apache-2.0 Imports: 12 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 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) ImagePaths

func (b *BazelBuildBits) ImagePaths() []string

ImagePaths implements Bits.ImagePaths

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()
	Paths() map[string]string
	// ImagePaths returns a list of paths to image archives to be loaded into
	// the Node
	ImagePaths() []string
	// Install should install the built sources on the node, assuming paths
	// have been populated
	// TODO(bentheelder): eliminate install, make install file-copies only,
	// support cross-building
	Install(InstallContext) error
}

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

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) ImagePaths

func (b *DockerBuildBits) ImagePaths() []string

ImagePaths implements Bits.ImagePaths

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