Documentation ¶
Index ¶
- Constants
- type CustomAnnotation
- type HatcheryConfiguration
- type HatcheryKubernetes
- func (h *HatcheryKubernetes) ApplyConfiguration(cfg interface{}) error
- func (h *HatcheryKubernetes) CanSpawn(ctx context.Context, _ sdk.WorkerStarterWorkerModel, jobID string, ...) bool
- func (h *HatcheryKubernetes) CheckConfiguration(cfg interface{}) error
- func (h *HatcheryKubernetes) Configuration() service.HatcheryCommonConfiguration
- func (h *HatcheryKubernetes) Init(config interface{}) (cdsclient.ServiceConfig, error)
- func (h *HatcheryKubernetes) InitHatchery(ctx context.Context) error
- func (*HatcheryKubernetes) ModelType() string
- func (h *HatcheryKubernetes) NeedRegistration(_ context.Context, m *sdk.Model) bool
- func (h *HatcheryKubernetes) Serve(ctx context.Context) error
- func (h *HatcheryKubernetes) Signin(ctx context.Context, clientConfig cdsclient.ServiceConfig, ...) error
- func (h *HatcheryKubernetes) SpawnWorker(ctx context.Context, spawnArgs hatchery.SpawnArguments) error
- func (h *HatcheryKubernetes) SpawnWorkerService(ctx context.Context, spawnArgs hatchery.SpawnArguments, podSchema *apiv1.Pod, ...) (apiv1.Container, error)
- func (h *HatcheryKubernetes) Start(ctx context.Context) error
- func (h *HatcheryKubernetes) Status(ctx context.Context) *sdk.MonitoringStatus
- func (h *HatcheryKubernetes) WatchPodEvents(ctx context.Context) error
- func (h *HatcheryKubernetes) WorkerModelSecretList(m sdk.Model) (sdk.WorkerModelSecrets, error)
- func (h *HatcheryKubernetes) WorkerModelsEnabled() ([]sdk.Model, error)
- func (h *HatcheryKubernetes) WorkersStarted(ctx context.Context) ([]string, error)
- type KubernetesClient
Constants ¶
const ( LABEL_HATCHERY_NAME = "CDS_HATCHERY_NAME" LABEL_WORKER_NAME = "CDS_WORKER_NAME" LABEL_WORKER_MODEL_PATH = "CDS_WORKER_MODEL_PATH" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CustomAnnotation ¶ added in v0.53.0
type HatcheryConfiguration ¶
type HatcheryConfiguration struct { service.HatcheryCommonConfiguration `mapstructure:"commonConfiguration" toml:"commonConfiguration" json:"commonConfiguration"` // DefaultCPU Worker default CPU DefaultCPU string `mapstructure:"defaultCPU" toml:"defaultCPU" default:"500m" commented:"false" comment:"Worker default CPU" json:"defaultCPU"` DisableCPULimit bool `` /* 147-byte string literal not displayed */ // DefaultMemory Worker default memory DefaultMemory int `` /* 141-byte string literal not displayed */ // DefaultEphemeralStorage Worker default ephemeral storage size DefaultEphemeralStorage string `` /* 180-byte string literal not displayed */ // DefaultServiceCPU Service default CPU DefaultServiceCPU string `` /* 145-byte string literal not displayed */ // DefaultServiceMemory Service default memory DefaultServiceMemory int `` /* 162-byte string literal not displayed */ // DefaultServiceEphemeralStorage Service default ephemeral storage size DefaultServiceEphemeralStorage string `` /* 204-byte string literal not displayed */ // Namespace is the kubernetes namespace in which workers are spawned" Namespace string `` /* 150-byte string literal not displayed */ // KubernetesMasterURL Address of kubernetes master KubernetesMasterURL string `` /* 156-byte string literal not displayed */ // KubernetesConfigFile Kubernetes config file in yaml KubernetesConfigFile string `` /* 161-byte string literal not displayed */ // KubernetesUsername Username to connect to kubernetes cluster (optional if config file is set) KubernetesUsername string `` /* 168-byte string literal not displayed */ // KubernetesPassword Password to connect to kubernetes cluster (optional if config file is set) KubernetesPassword string `` /* 161-byte string literal not displayed */ // KubernetesToken Token to connect to kubernetes cluster (optional if config file is set) KubernetesToken string `` /* 152-byte string literal not displayed */ // KubernetesCertAuthData Certificate authority data for tls kubernetes (optional if config file is set) KubernetesCertAuthData string `` /* 221-byte string literal not displayed */ // KubernetesClientCertData Client certificate data for tls kubernetes (optional if no tls needed) KubernetesClientCertData string `` /* 212-byte string literal not displayed */ // KubernetesKeyData Client certificate data for tls kubernetes (optional if no tls needed) KubernetesClientKeyData string `` /* 210-byte string literal not displayed */ // CustomAnnotations that will be added to pods spawned by the hatchery CustomAnnotations []CustomAnnotation `` /* 173-byte string literal not displayed */ // DeleteSecretsInterval used by deleteSecrets to clean secrets not used DeleteSecretsInterval int `` /* 173-byte string literal not displayed */ // KillAwolWorkersInterval used by killAwolWorkers to remove unused workers KillAwolWorkersInterval int `` /* 163-byte string literal not displayed */ }
HatcheryConfiguration is the configuration for local hatchery
type HatcheryKubernetes ¶
type HatcheryKubernetes struct { hatcheryCommon.Common Config HatcheryConfiguration // contains filtered or unexported fields }
HatcheryKubernetes implements HatcheryMode interface for local usage
func (*HatcheryKubernetes) ApplyConfiguration ¶
func (h *HatcheryKubernetes) ApplyConfiguration(cfg interface{}) error
ApplyConfiguration apply an object of type HatcheryConfiguration after checking it
func (*HatcheryKubernetes) CanSpawn ¶
func (h *HatcheryKubernetes) CanSpawn(ctx context.Context, _ sdk.WorkerStarterWorkerModel, jobID string, requirements []sdk.Requirement) bool
CanSpawn return wether or not hatchery can spawn model. requirements are not supported
func (*HatcheryKubernetes) CheckConfiguration ¶
func (h *HatcheryKubernetes) CheckConfiguration(cfg interface{}) error
CheckConfiguration checks the validity of the configuration object
func (*HatcheryKubernetes) Configuration ¶
func (h *HatcheryKubernetes) Configuration() service.HatcheryCommonConfiguration
Configuration returns Hatchery CommonConfiguration
func (*HatcheryKubernetes) Init ¶
func (h *HatcheryKubernetes) Init(config interface{}) (cdsclient.ServiceConfig, error)
Init cdsclient config.
func (*HatcheryKubernetes) InitHatchery ¶
func (h *HatcheryKubernetes) InitHatchery(ctx context.Context) error
InitHatchery register local hatchery with its worker model
func (*HatcheryKubernetes) ModelType ¶
func (*HatcheryKubernetes) ModelType() string
ModelType returns type of hatchery
func (*HatcheryKubernetes) NeedRegistration ¶
NeedRegistration return true if worker model need regsitration
func (*HatcheryKubernetes) Serve ¶
func (h *HatcheryKubernetes) Serve(ctx context.Context) error
Serve start the hatchery server
func (*HatcheryKubernetes) Signin ¶ added in v0.53.0
func (h *HatcheryKubernetes) Signin(ctx context.Context, clientConfig cdsclient.ServiceConfig, srvConfig interface{}) error
func (*HatcheryKubernetes) SpawnWorker ¶
func (h *HatcheryKubernetes) SpawnWorker(ctx context.Context, spawnArgs hatchery.SpawnArguments) error
SpawnWorker starts a new worker process
func (*HatcheryKubernetes) SpawnWorkerService ¶ added in v0.53.1
func (h *HatcheryKubernetes) SpawnWorkerService(ctx context.Context, spawnArgs hatchery.SpawnArguments, podSchema *apiv1.Pod, nService int, sName string, service sdk.V2JobService) (apiv1.Container, error)
func (*HatcheryKubernetes) Start ¶
func (h *HatcheryKubernetes) Start(ctx context.Context) error
Start inits client and routines for hatchery
func (*HatcheryKubernetes) Status ¶
func (h *HatcheryKubernetes) Status(ctx context.Context) *sdk.MonitoringStatus
Status returns sdk.MonitoringStatus, implements interface service.Service
func (*HatcheryKubernetes) WatchPodEvents ¶ added in v0.53.0
func (h *HatcheryKubernetes) WatchPodEvents(ctx context.Context) error
func (*HatcheryKubernetes) WorkerModelSecretList ¶
func (h *HatcheryKubernetes) WorkerModelSecretList(m sdk.Model) (sdk.WorkerModelSecrets, error)
WorkerModelSecretList returns secret for given model.
func (*HatcheryKubernetes) WorkerModelsEnabled ¶
func (h *HatcheryKubernetes) WorkerModelsEnabled() ([]sdk.Model, error)
WorkerModelsEnabled returns Worker model enabled.
func (*HatcheryKubernetes) WorkersStarted ¶
func (h *HatcheryKubernetes) WorkersStarted(ctx context.Context) ([]string, error)
WorkersStarted returns the number of instances started but not necessarily register on CDS yet
type KubernetesClient ¶
type KubernetesClient interface { PodCreate(ctx context.Context, ns string, spec *corev1.Pod, options metav1.CreateOptions) (*corev1.Pod, error) PodDelete(ctx context.Context, ns string, name string, options metav1.DeleteOptions) error PodGetRawLogs(ctx context.Context, ns string, name string, options *corev1.PodLogOptions) ([]byte, error) PodList(ctx context.Context, ns string, options metav1.ListOptions) (*corev1.PodList, error) SecretCreate(ctx context.Context, ns string, spec *corev1.Secret, options metav1.CreateOptions) (*corev1.Secret, error) SecretDelete(ctx context.Context, ns string, name string, options metav1.DeleteOptions) error SecretGet(ctx context.Context, ns string, name string, options metav1.GetOptions) (*corev1.Secret, error) SecretList(ctx context.Context, ns string, options metav1.ListOptions) (*corev1.SecretList, error) Events(ctx context.Context, ns string, options metav1.ListOptions) (watch.Interface, error) }