k8s

package
v0.2.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2017 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Client *k8sHelper

Client is used to keep only one connection with kubernetes

View Source
var K8sClient *unversioned.Client // FIXME: this is used just to keep back compatibility... whe should remove ASAP

K8sClient is used to keep back compatibility inside the Api

Functions

func AddPortConfigToService

func AddPortConfigToService(
	service *api.Service,
	name string,
	protocol api.Protocol,
	port int,
	targetPort int)

AddPortConfigToService add port to service

func BuildDeployment

func BuildDeployment(
	name string,
	namespace string,
	maxUnavailable int,
	maxSurge int,
	replicas int,
	selector string,
	podSpec api.PodSpec) *extensions.Deployment

BuildDeployment builds and returns a deployment pointer.

func BuildLoadBalancerService

func BuildLoadBalancerService(name, namespace, selector string) *api.Service

BuildLoadBalancerService creates a service of type load balancer

func BuildSlugRunnerDeployment

func BuildSlugRunnerDeployment(
	name string,
	namespace string,
	maxUnavailable int,
	maxSurge int,
	replicas int,
	selector string,
	slugURL string,
	env map[string]string) *extensions.Deployment

BuildSlugRunnerDeployment builds a deployment using a slugrunner image with the slug built by the slugbuilder some steps earlier.

func BuildSlugRunnerLBService

func BuildSlugRunnerLBService(name, namespace, selector string) *api.Service

BuildSlugRunnerLBService helps to create a slugrunner service pointing to port 5000

func BuildSlugbuilderPod

func BuildSlugbuilderPod(env map[string]string, name, namespace, tarKey, putKey, buildpackURL string, debug bool) *api.Pod

BuildSlugbuilderPod is used to create an builder pod

func IsAlreadyExistsError added in v0.2.0

func IsAlreadyExistsError(err error) bool

IsAlreadyExistsError checks if the error is of type "already exists"

func IsInputError added in v0.2.0

func IsInputError(err error) bool

IsInputError checks if the error is of type "input"

func IsNotFoundError added in v0.2.0

func IsNotFoundError(err error) bool

IsNotFoundError checks if the error is of type "not found"

func IsUnauthorizedError added in v0.2.0

func IsUnauthorizedError(err error) bool

IsUnauthorizedError checks if the error is of type "unauthorized error"

func NewAlreadyExistsError added in v0.2.0

func NewAlreadyExistsError(a ...interface{}) error

NewAlreadyExistsError creates a new "already exists" error

func NewAlreadyExistsErrorf added in v0.2.0

func NewAlreadyExistsErrorf(format string, a ...interface{}) error

NewAlreadyExistsErrorf formats a message according to a format specifier and returns the error

func NewAppBuilderError added in v0.2.0

func NewAppBuilderError(a ...interface{}) error

NewAppBuilderError creates a new "App Builder" error

func NewAppBuilderErrorf added in v0.2.0

func NewAppBuilderErrorf(format string, a ...interface{}) error

NewAppBuilderErrorf formats a message according to a format specifier and returns the error

func NewInputError added in v0.2.0

func NewInputError(a ...interface{}) error

NewInputError creates a new "input" error

func NewInputErrorf added in v0.2.0

func NewInputErrorf(format string, a ...interface{}) error

NewInputErrorf formats a message according to a format specifier and returns the error

func NewNotFoundError added in v0.2.0

func NewNotFoundError(a ...interface{}) error

NewNotFoundError creates a new "not found" error

func NewNotFoundErrorf added in v0.2.0

func NewNotFoundErrorf(format string, a ...interface{}) error

NewNotFoundErrorf formats a message according to a format specifier and returns the error

func NewUnauthorizedError added in v0.2.0

func NewUnauthorizedError(a ...interface{}) error

NewUnauthorizedError creates a new "unauthorized error" error

func NewUnauthorizedErrorf added in v0.2.0

func NewUnauthorizedErrorf(format string, a ...interface{}) error

NewUnauthorizedErrorf formats a message according to a format specifier and returns the error

func SlugBuilderPodName

func SlugBuilderPodName(appName, shortSha string) string

SlugBuilderPodName is used to generate a temp name to the builder pod

func WaitForPod

func WaitForPod(c *client.Client, ns, podName string, interval, timeout time.Duration) error

WaitForPod waits for running stated, among others

func WaitForPodEnd

func WaitForPodEnd(c *client.Client, ns, podName string, interval, timeout time.Duration) error

WaitForPodEnd waits for a pod in state succeeded or failed

Types

type AppInterface added in v0.2.0

type AppInterface interface {
	Create(app *models.App, storage helpers.Storage, tk *Token) error
	Update(app *models.App, storage helpers.Storage, tk *Token) error
	UpdateEnvVars(appName string, operations []*models.PatchAppRequest, storage helpers.Storage, tk *Token) (app *models.App, err error)
	UpdateScale(appName string, scale int64, storage helpers.Storage, tk *Token) (app *models.App, err error)
	UpdateAutoScale(appName string, autoScale *models.AutoScale, storage helpers.Storage, tk *Token) (app *models.App, err error)
	Get(appName string, tk *Token) (app *models.App, err error)
	List(tk *Token) (app []*models.App, err error)
	GetLogs(appName string, tk *Token, opts *api.PodLogOptions) (io.ReadCloser, error)
}

AppInterface is used to interact with Kubernetes and also to allow mock testing

type AppsInterface added in v0.2.0

type AppsInterface interface {
	Apps() AppInterface
}

AppsInterface is used to allow mock testing

type DeploymentInterface added in v0.2.0

type DeploymentInterface interface {
	Get(appName string) (d *extensions.Deployment, err error)
	CreateWelcomeDeployment(app *models.App) error
	Create(appName, description string, file *runtime.File, storage helpers.Storage, tk *Token) (io.ReadCloser, error)
	Update(app *models.App, description string, storage helpers.Storage) error
	CreateAutoScale(app *models.App) error
	UpdateAutoScale(app *models.App) error
}

DeploymentInterface is used to interact with Kubernetes and also to allow mock testing

type DeploymentsInterface added in v0.2.0

type DeploymentsInterface interface {
	Deployments() DeploymentInterface
}

DeploymentsInterface is used to allow mock testing

type ErrorReason added in v0.2.0

type ErrorReason string

ErrorReason used to check error types

const (
	InputError        ErrorReason = "InputError"
	AlreadyExists     ErrorReason = "AlreadyExists"
	NotFound          ErrorReason = "NotFound"
	UnauthorizedError ErrorReason = "UnauthorizedError"
	AppBuilderError   ErrorReason = "AppBuilderError"
)

Error Reasons const used to check error types

type HealthCheckProbe added in v0.2.0

type HealthCheckProbe struct {
	FailureThreshold   int32  `yaml:"failureThreshold"`
	InitialDelaySecond int32  `yaml:"initialDelaySeconds"`
	PeriodSeconds      int32  `yaml:"periodSeconds"`
	SuccessThreshold   int32  `yaml:"successThreshold"`
	TimeoutSeconds     int32  `yaml:"timeoutSeconds"`
	Path               string `yaml:"path"`
}

type NetworkInterface added in v0.2.0

type NetworkInterface interface {
	CreateService(app *models.App) error
	GetService(appName string) (srv *api.Service, err error)
}

NetworkInterface is used to interact with Kubernetes and also to allow mock testing

type NetworksInterface added in v0.2.0

type NetworksInterface interface {
	Networks() DeploymentInterface
}

NetworksInterface is used to allow mock testing

type TeamInterface added in v0.2.0

type TeamInterface interface {
	ListAll(l *log.Entry) (teams []*models.Team, err error)
}

TeamInterface is used to interact with Kubernetes and also to allow mock testing

type TeamsInterface added in v0.2.0

type TeamsInterface interface {
	Teams() TeamInterface
}

TeamsInterface is used to allow mock testing

type TeresaYaml added in v0.2.0

type TeresaYaml struct {
	HealthCheck *struct {
		Liveness  *HealthCheckProbe
		Readiness *HealthCheckProbe
	} `yaml:"healthCheck,omitempty"`
	RollingUpdate *struct {
		MaxSurge       *string `yaml:"maxSurge,omitempty"`
		MaxUnavailable *string `yaml:"maxUnavailable,omitempty"`
	} `yaml:"rollingUpdate,omitempty"`
}

type Token added in v0.2.0

type Token struct {
	jwt.StandardClaims
	*models.User
}

Token is a web token with all the user info

func IToToken added in v0.2.0

func IToToken(i interface{}) *Token

IToToken executes a type assertion from the interface to a Token

func (*Token) IsAuthorized added in v0.2.0

func (t *Token) IsAuthorized(teamName string) bool

IsAuthorized checks if the user (from token) is authorized to do something with the team passed as param

type UserInterface added in v0.2.0

type UserInterface interface {
	GetWithTeams(userEmail string, tk *Token, l *log.Entry) (user *models.User, err error)
	LoadUserToToken(tk *Token, l *log.Entry) error
}

UserInterface is used to interact with Kubernetes and also to allow mock testing

type UsersInterface added in v0.2.0

type UsersInterface interface {
	Users() UserInterface
}

UsersInterface is used to allow mock testing

Jump to

Keyboard shortcuts

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