provision

package
v0.0.0-...-15beef2 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: BSD-3-Clause Imports: 5 Imported by: 18

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClusterNotFound = errors.New("cluster not found")
	ErrNoCluster       = errors.New("no cluster")
)
View Source
var (
	ErrPoolNotFound      = errors.New("pool does not exist")
	ErrTooManyPoolsFound = errors.New("too many pools found")
)

Functions

This section is empty.

Types

type Cluster

type Cluster struct {
	Name        string            `json:"name"`
	Addresses   []string          `json:"addresses"`
	Provisioner string            `json:"provisioner"`
	CaCert      []byte            `json:"cacert"`
	ClientCert  []byte            `json:"clientcert"`
	ClientKey   []byte            `json:"clientkey"`
	Pools       []string          `json:"pools"`
	CustomData  map[string]string `json:"custom_data"`
	Local       bool              `json:"local"`
	Default     bool              `json:"default"`
	KubeConfig  *KubeConfig       `json:"kubeConfig,omitempty"`
	HTTPProxy   string            `json:"httpProxy,omitempty"`

	Writer io.Writer `json:"-"`
}

Cluster represents a cluster of nodes.

func (*Cluster) CleanUpSensitive

func (c *Cluster) CleanUpSensitive()

type ClusterHelpInfo

type ClusterHelpInfo struct {
	ProvisionerHelp string            `json:"provisioner_help"`
	CustomDataHelp  map[string]string `json:"custom_data_help"`
}

type ClusterService

type ClusterService interface {
	Create(context.Context, Cluster) error
	Update(context.Context, Cluster) error
	List(context.Context) ([]Cluster, error)
	FindByName(context.Context, string) (*Cluster, error)
	FindByProvisioner(context.Context, string) ([]Cluster, error)
	FindByPool(ctx context.Context, provisioner, pool string) (*Cluster, error)
	FindByPools(ctx context.Context, provisioner string, pools []string) (map[string]Cluster, error)
	Delete(context.Context, Cluster) error
}

type ClusterStorage

type ClusterStorage interface {
	Upsert(context.Context, Cluster) error
	FindAll(context.Context) ([]Cluster, error)
	FindByName(context.Context, string) (*Cluster, error)
	FindByProvisioner(context.Context, string) ([]Cluster, error)
	FindByPool(context.Context, string, string) (*Cluster, error)
	Delete(context.Context, Cluster) error
}

type DeployKind

type DeployKind string
const (
	DeployArchiveURL   DeployKind = "archive-url"
	DeployGit          DeployKind = "git"
	DeployImage        DeployKind = "image"
	DeployBuildedImage DeployKind = "imagebuild"
	DeployRollback     DeployKind = "rollback"
	DeployUpload       DeployKind = "upload"
	DeployUploadBuild  DeployKind = "uploadbuild"
	DeployRebuild      DeployKind = "rebuild"
	DeployDockerfile   DeployKind = "dockerfile"
)

type DeployOptions

type DeployOptions interface {
	GetKind() (kind DeployKind)
}

type KubeConfig

type KubeConfig struct {
	Cluster  clientcmdapi.Cluster  `json:"cluster"`
	AuthInfo clientcmdapi.AuthInfo `json:"user"`
}

type MockClusterService

type MockClusterService struct {
	OnCreate            func(Cluster) error
	OnUpdate            func(Cluster) error
	OnList              func() ([]Cluster, error)
	OnFindByName        func(string) (*Cluster, error)
	OnFindByProvisioner func(string) ([]Cluster, error)
	OnFindByPool        func(string, string) (*Cluster, error)
	OnFindByPools       func(string, []string) (map[string]Cluster, error)
	OnDelete            func(Cluster) error
}

func (*MockClusterService) Create

func (m *MockClusterService) Create(ctx context.Context, c Cluster) error

func (*MockClusterService) Delete

func (m *MockClusterService) Delete(ctx context.Context, c Cluster) error

func (*MockClusterService) FindByName

func (m *MockClusterService) FindByName(ctx context.Context, name string) (*Cluster, error)

func (*MockClusterService) FindByPool

func (m *MockClusterService) FindByPool(ctx context.Context, prov, pool string) (*Cluster, error)

func (*MockClusterService) FindByPools

func (m *MockClusterService) FindByPools(ctx context.Context, provisioner string, pool []string) (map[string]Cluster, error)

func (*MockClusterService) FindByProvisioner

func (m *MockClusterService) FindByProvisioner(ctx context.Context, prov string) ([]Cluster, error)

func (*MockClusterService) List

func (*MockClusterService) Update

func (m *MockClusterService) Update(ctx context.Context, c Cluster) error

type MockClusterStorage

type MockClusterStorage struct {
	OnUpsert            func(Cluster) error
	OnFindAll           func() ([]Cluster, error)
	OnFindByName        func(string) (*Cluster, error)
	OnFindByProvisioner func(string) ([]Cluster, error)
	OnFindByPool        func(string, string) (*Cluster, error)
	OnDelete            func(Cluster) error
}

MockClusterStorage implements ClusterStorage interface

func (*MockClusterStorage) Delete

func (m *MockClusterStorage) Delete(ctx context.Context, c Cluster) error

func (*MockClusterStorage) FindAll

func (m *MockClusterStorage) FindAll(context.Context) ([]Cluster, error)

func (*MockClusterStorage) FindByName

func (m *MockClusterStorage) FindByName(ctx context.Context, name string) (*Cluster, error)

func (*MockClusterStorage) FindByPool

func (m *MockClusterStorage) FindByPool(ctx context.Context, provisioner, pool string) (*Cluster, error)

func (*MockClusterStorage) FindByProvisioner

func (m *MockClusterStorage) FindByProvisioner(ctx context.Context, provisionerName string) ([]Cluster, error)

func (*MockClusterStorage) Upsert

func (m *MockClusterStorage) Upsert(ctx context.Context, c Cluster) error

type MockPoolService

type MockPoolService struct {
	OnList       func() ([]Pool, error)
	OnFindByName func(string) (*Pool, error)
	OnServices   func(pool string) ([]string, error)
}

func (*MockPoolService) FindByName

func (m *MockPoolService) FindByName(ctx context.Context, name string) (*Pool, error)

func (*MockPoolService) List

func (m *MockPoolService) List(ctx context.Context) ([]Pool, error)

func (*MockPoolService) Services

func (m *MockPoolService) Services(ctx context.Context, pool string) ([]string, error)

type MockPoolStorage

type MockPoolStorage struct {
	OnFindAll    func() ([]Pool, error)
	OnFindByName func(string) (*Pool, error)
}

func (*MockPoolStorage) FindAll

func (m *MockPoolStorage) FindAll(ctx context.Context) ([]Pool, error)

func (*MockPoolStorage) FindByName

func (m *MockPoolStorage) FindByName(ctx context.Context, name string) (*Pool, error)

type Pool

type Pool struct {
	Name        string `bson:"_id"`
	Provisioner string
	Default     bool
}

type PoolService

type PoolService interface {
	List(ctx context.Context) ([]Pool, error)
	FindByName(ctx context.Context, name string) (*Pool, error)
	Services(ctx context.Context, pool string) ([]string, error)
}

type PoolStorage

type PoolStorage interface {
	FindAll(ctx context.Context) ([]Pool, error)
	FindByName(ctx context.Context, name string) (*Pool, error)
}

type TsuruYamlData

type TsuruYamlData struct {
	Hooks       *TsuruYamlHooks            `json:"hooks,omitempty" bson:",omitempty"`
	Healthcheck *TsuruYamlHealthcheck      `json:"healthcheck,omitempty" bson:",omitempty"`
	Kubernetes  *TsuruYamlKubernetesConfig `json:"kubernetes,omitempty" bson:",omitempty"`
}

func (TsuruYamlData) ToRouterHC

func (y TsuruYamlData) ToRouterHC() router.HealthcheckData

type TsuruYamlHealthcheck

type TsuruYamlHealthcheck struct {
	Path                 string            `json:"path"`
	Method               string            `json:"method"`
	Status               int               `json:"status"`
	Scheme               string            `json:"scheme"`
	Command              []string          `json:"command,omitempty" bson:",omitempty"`
	Headers              map[string]string `json:"headers,omitempty" bson:",omitempty"`
	Match                string            `json:"match,omitempty" bson:",omitempty"`
	RouterBody           string            `json:"router_body,omitempty" yaml:"router_body" bson:"router_body,omitempty"`
	UseInRouter          bool              `json:"use_in_router,omitempty" yaml:"use_in_router" bson:"use_in_router,omitempty"`
	ForceRestart         bool              `json:"force_restart,omitempty" yaml:"force_restart" bson:"force_restart,omitempty"`
	AllowedFailures      int               `json:"allowed_failures,omitempty" yaml:"allowed_failures" bson:"allowed_failures,omitempty"`
	IntervalSeconds      int               `json:"interval_seconds,omitempty" yaml:"interval_seconds" bson:"interval_seconds,omitempty"`
	TimeoutSeconds       int               `json:"timeout_seconds,omitempty" yaml:"timeout_seconds" bson:"timeout_seconds,omitempty"`
	DeployTimeoutSeconds int               `json:"deploy_timeout_seconds,omitempty" yaml:"deploy_timeout_seconds" bson:"deploy_timeout_seconds,omitempty"`
}

type TsuruYamlHooks

type TsuruYamlHooks struct {
	Restart TsuruYamlRestartHooks `json:"restart" bson:",omitempty"`
	Build   []string              `json:"build" bson:",omitempty"`
}

type TsuruYamlKubernetesConfig

type TsuruYamlKubernetesConfig struct {
	Groups map[string]TsuruYamlKubernetesGroup `json:"groups,omitempty"`
}

func (*TsuruYamlKubernetesConfig) DeepCopy

func (*TsuruYamlKubernetesConfig) DeepCopyInto

func (*TsuruYamlKubernetesConfig) GetProcessConfigs

func (y *TsuruYamlKubernetesConfig) GetProcessConfigs(procName string) *TsuruYamlKubernetesProcessConfig

type TsuruYamlKubernetesGroup

type TsuruYamlKubernetesGroup map[string]TsuruYamlKubernetesProcessConfig

type TsuruYamlKubernetesProcessConfig

type TsuruYamlKubernetesProcessConfig struct {
	Ports []TsuruYamlKubernetesProcessPortConfig `json:"ports"`
}

type TsuruYamlKubernetesProcessPortConfig

type TsuruYamlKubernetesProcessPortConfig struct {
	Name       string `json:"name,omitempty"`
	Protocol   string `json:"protocol,omitempty"`
	Port       int    `json:"port,omitempty"`
	TargetPort int    `json:"target_port,omitempty"`
}

type TsuruYamlRestartHooks

type TsuruYamlRestartHooks struct {
	Before []string `json:"before" bson:",omitempty"`
	After  []string `json:"after" bson:",omitempty"`
}

Jump to

Keyboard shortcuts

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