model

package
v0.0.0-...-260b785 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AllContainers gets all container running in a cluster
	AllContainers = "all"
	// ServiceContainers gets all the service containers running in a cluster
	ServiceContainers = "service"
	// DbContainers gets all the database containers running in a cluster
	DbContainers = "db"
	// RegistryContainers gets all the registry containers running in a cluster
	RegistryContainers = "registry"
	// ScContainers gets runner & gateway container running in a cluster
	ScContainers = "space-cloud"

	// ApplyWithNoDelay used as param to indicate to used 0 delay while applying spec objects
	ApplyWithNoDelay = time.Duration(0)

	// HelmSpaceCloudChartDownloadURL url of space cloud helm chart
	HelmSpaceCloudChartDownloadURL = "https://storage.googleapis.com/space-cloud/helm/space-cloud"
	// HelmPostgresChartDownloadURL url of postgres helm chart
	HelmPostgresChartDownloadURL = "https://storage.googleapis.com/space-cloud/helm/postgres/postgres-0.1.0.tgz"
	// HelmMysqlChartDownloadURL url of mysql helm chart
	HelmMysqlChartDownloadURL = "https://storage.googleapis.com/space-cloud/helm/mysql/mysql-0.1.0.tgz"
	// HelmSQLServerCloudChartDownloadURL url of sql server helm chart
	HelmSQLServerCloudChartDownloadURL = "https://storage.googleapis.com/space-cloud/helm/sqlserver/sqlserver-0.1.0.tgz"
	// HelmMongoChartDownloadURL url of mongo helm chart
	HelmMongoChartDownloadURL = "https://storage.googleapis.com/space-cloud/helm/mongo/mongo-0.1.0.tgz"
	// HelmSpaceCloudNamespace space cloud namespace for helm
	HelmSpaceCloudNamespace = "space-cloud"
)
View Source
const Version string = "0.21.5"

Version version of space cli

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	ID             string `json:"id" yaml:"id"`
	UserName       string `json:"username" yaml:"username"`
	Key            string `json:"key" yaml:"key"`
	ServerURL      string `json:"serverurl" yaml:"serverurl"`
	DefaultProject string `json:"defaultProject" yaml:"defaultProject"`
}

Account is the object for representing individual account information

type ActionCode

type ActionCode struct {
	Service   *Service `json:"service" yaml:"service"`
	IsDeploy  bool     `json:"isdeploy" yaml:"isdeploy"`
	Condition string   `json:"condition" yaml:"condition"`
}

ActionCode describes the data structure sent to Space Cloud when deploy is called

type Affinity

type Affinity struct {
	Attribute string           `json:"attribute" yaml:"attribute"`
	Value     string           `json:"value" yaml:"value"`
	Weight    float32          `json:"weight" yaml:"weight"`
	Operator  AffinityOperator `json:"operator" yaml:"operator"`
}

Affinity describes the affinity rules of a service

type AffinityOperator

type AffinityOperator string

AffinityOperator describes the type of operator

const (
	// AffinityOperatorEQ is used for equal to operation
	AffinityOperatorEQ AffinityOperator = "=="

	// AffinityOperatorNEQ is used for not equal to operation
	AffinityOperatorNEQ AffinityOperator = "!="
)

type AutoScaleAuthRef

type AutoScaleAuthRef struct {
	SecretMapping []AutoScaleAuthRefMapping `json:"secretMapping" yaml:"secretMapping"`
}

AutoScaleAuthRef describes the authentication reference for a scaler

type AutoScaleAuthRefMapping

type AutoScaleAuthRefMapping struct {
	Parameter string `json:"param" yaml:"param"`
	Key       string `json:"key" yaml:"key"`
}

AutoScaleAuthRefMapping describes the mapping between the keys of the secret and parameters of the scaler

type AutoScaleConfig

type AutoScaleConfig struct {
	PollingInterval  int32 `json:"pollingInterval" yaml:"pollingInterval"`   // Default 15 (in seconds)
	CoolDownInterval int32 `json:"coolDownInterval" yaml:"coolDownInterval"` // Default 120 (in seconds)

	MinReplicas int32 `json:"minReplicas" yaml:"minReplicas"` // Default 1
	MaxReplicas int32 `json:"maxReplicas" yaml:"maxReplicas"` // Default 100

	Triggers []AutoScaleTrigger `json:"triggers,omitempty" yaml:"triggers,omitempty"`
}

AutoScaleConfig describes the config used to scale a service

type AutoScaleTrigger

type AutoScaleTrigger struct {
	Name             string            `json:"name" yaml:"name"`
	Type             string            `json:"type" yaml:"type"`
	MetaData         map[string]string `json:"metadata" yaml:"metadata"`
	AuthenticatedRef *AutoScaleAuthRef `json:"authRef" yaml:"authRef"` // Authentication ref is optional
}

AutoScaleTrigger describes the config of a scaler

type Cluster

type Cluster struct {
	ID  string `json:"id" yaml:"id"`
	URL string `json:"url" yaml:"url"`
}

Cluster describes the configuration of a single cluster

type Credential

type Credential struct {
	Accounts        []*Account `json:"accounts" yaml:"accounts"`
	SelectedAccount string     `json:"selectedAccount" yaml:"selectedAccount"`
}

Credential is the object for representing all the account information in accounts.yaml file

type Docker

type Docker struct {
	Image           string          `json:"image" yaml:"image"`
	Cmd             []string        `json:"cmd" yaml:"cmd"`
	Secret          string          `json:"secret" yaml:"secret"`
	ImagePullPolicy ImagePullPolicy `json:"imagePullPolicy" yaml:"imagePullPolicy"`
}

Docker describes the docker configurations

type Environment

type Environment struct {
	Name     string    `json:"name" yaml:"name"`
	ID       string    `json:"id" yaml:"id"`
	Clusters []Cluster `json:"clusters" yaml:"clusters"`
}

Environment describes the configuration of a single environment

type GPUResource

type GPUResource struct {
	Type  string `json:"type" yaml:"type"`
	Value int64  `json:"value" yaml:"value"`
}

GPUResource describes the GPUs required by a task

type ImagePullPolicy

type ImagePullPolicy string

ImagePullPolicy describes the image pull policy for docker config

const (
	// PullAlways is used for always pull policy
	PullAlways ImagePullPolicy = "always"

	// PullIfNotExists is use for pull if not exist locally pull policy
	PullIfNotExists ImagePullPolicy = "pull-if-not-exists"
)

type ImageType

type ImageType string

ImageType a type for specifying sc image name

const ImageGateway ImageType = "gateway"

ImageGateway represent sc gateway image type

const ImageRunner ImageType = "runner"

ImageRunner represent sc runner image type

type LoginResponse

type LoginResponse struct {
	Token string `json:"token" yaml:"token"`
	Error string `json:"error"`
}

LoginResponse is the object for storing payload for login response

type Port

type Port struct {
	Name     string   `json:"name" yaml:"name"`
	Protocol Protocol `json:"protocol" yaml:"protocol"`
	Port     int32    `json:"port" yaml:"port"`
}

Port describes the port used by a task

type Projects

type Projects struct {
	Name string `json:"name" yaml:"name"`
	ID   string `json:"id" yaml:"id"`
}

Projects describes the configuration of a single project

type Protocol

type Protocol string

Protocol describes the protocol to be used for a port

const (
	// TCP is used for tcp based workloads
	TCP Protocol = "tcp"

	// HTTP is used for http based workloads
	HTTP Protocol = "http"
)

type Resources

type Resources struct {
	CPU    int64        `json:"cpu" yaml:"cpu"`
	Memory int64        `json:"memory" yaml:"memory"`
	GPU    *GPUResource `json:"gpu,omitempty" yaml:"gpu,omitempty"`
}

Resources describes the resources to be used by a task

type Response

type Response struct {
	Error  string        `json:"error,omitempty"`
	Result []interface{} `json:"result,omitempty"`
}

Response is the object returned by every handler to client

type Role

type Role struct {
	ID      string `json:"id" yaml:"id"`
	Project string `json:"project" yaml:"project"`
	Service string `json:"service" yaml:"service"`
	Type    string `json:"type" yaml:"type"`
	Rules   []Rule `json:"rules" yaml:"rules"`
}

Role describes the configuration for the service role

type Rule

type Rule struct {
	APIGroups []string `json:"apiGroups" yaml:"apiGroups"`
	Verbs     []string `json:"verbs" yaml:"verbs"`
	Resources []string `json:"resources" yaml:"resources"`
}

Rule describe rule for service role

type Runtime

type Runtime string

Runtime is the container runtime

const (
	// Image indicates that the user has provided a docker image
	Image Runtime = "image"

	// Code indicates that the user's code isn't containerized. We need to use a custom runtime for this
	Code Runtime = "code"
)

type ScaleConfig

type ScaleConfig struct {
	Replicas    int32  `json:"replicas" yaml:"replicas"`
	MinReplicas int32  `json:"minReplicas" yaml:"minReplicas"`
	MaxReplicas int32  `json:"maxReplicas" yaml:"maxReplicas"`
	Concurrency int32  `json:"concurrency" yaml:"concurrency"`
	Mode        string `json:"mode" yaml:"mode"`
}

ScaleConfig describes the config used to scale a service

type Service

type Service struct {
	ID                     string            `json:"id,omitempty" yaml:"id,omitempty"`
	Name                   string            `json:"name,omitempty" yaml:"name,omitempty"`
	ProjectID              string            `json:"projectId,omitempty" yaml:"projectId,omitempty"`
	Version                string            `json:"version,omitempty" yaml:"version,omitempty"`
	Scale                  *ScaleConfig      `json:"scale,omitempty" yaml:"scale,omitempty"`
	AutoScale              *AutoScaleConfig  `json:"autoScale,omitempty" yaml:"autoScale,omitempty"`
	Labels                 map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
	Tasks                  []Task            `json:"tasks" yaml:"tasks"`
	Affinity               []Affinity        `json:"affinity,omitempty" yaml:"affinity,omitempty"`
	Whitelist              []Whitelist       `json:"whitelists" yaml:"whitelists"`
	Upstreams              []Upstream        `json:"upstreams" yaml:"upstreams"`
	StatsInclusionPrefixes string            `json:"statsInclusionPrefixes" yaml:"statsInclusionPrefixes"`
}

Service describes a service's configurations

type SpecObject

type SpecObject struct {
	API  string            `json:"api" yaml:"api"`
	Type string            `json:"type" yaml:"type"`
	Meta map[string]string `json:"meta" yaml:"meta"`
	Spec interface{}       `json:"spec" yaml:"spec,omitempty"`
}

SpecObject describes the basic structure of config specifications

type Task

type Task struct {
	ID        string            `json:"id" yaml:"id"`
	Name      string            `json:"name,omitempty" yaml:"name,omitempty"`
	Ports     []Port            `json:"ports" yaml:"ports"`
	Resources Resources         `json:"resources" yaml:"resources"`
	Docker    Docker            `json:"docker" yaml:"docker"`
	Env       map[string]string `json:"env" yaml:"env"`
	Secrets   []string          `json:"secrets" yaml:"secrets"`
	Runtime   Runtime           `json:"runtime" yaml:"runtime"`
}

Task describes the configuration of a task

type Upstream

type Upstream struct {
	ProjectID string `json:"projectId" yaml:"projectId"`
	Service   string `json:"service" yaml:"service"`
}

Upstream is the upstream dependencies of this service

type Whitelist

type Whitelist struct {
	ProjectID string `json:"projectId" yaml:"projectId"`
	Service   string `json:"service" yaml:"service"`
}

Whitelist is the allowed downstream services

Jump to

Keyboard shortcuts

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