Documentation ¶
Index ¶
- Constants
- type HatcheryConfiguration
- type HatcheryKubernetes
- func (h *HatcheryKubernetes) ApplyConfiguration(cfg interface{}) error
- func (h *HatcheryKubernetes) CanSpawn(ctx context.Context, _ *sdk.Model, jobID int64, requirements []sdk.Requirement) bool
- func (h *HatcheryKubernetes) CheckConfiguration(cfg interface{}) error
- func (h *HatcheryKubernetes) Configuration() service.HatcheryCommonConfiguration
- func (h *HatcheryKubernetes) GetLogger() *logrus.Logger
- 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) SpawnWorker(ctx context.Context, spawnArgs hatchery.SpawnArguments) error
- func (h *HatcheryKubernetes) Start(ctx context.Context) error
- func (h *HatcheryKubernetes) Status(ctx context.Context) *sdk.MonitoringStatus
- 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
- type KubernetesClient
Constants ¶
const ( LABEL_HATCHERY_NAME = "CDS_HATCHERY_NAME" LABEL_WORKER = "CDS_WORKER" LABEL_SECRET = "CDS_SECRET" LABEL_WORKER_MODEL = "CDS_WORKER_MODEL" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HatcheryConfiguration ¶
type HatcheryConfiguration struct { service.HatcheryCommonConfiguration `mapstructure:"commonConfiguration" toml:"commonConfiguration" json:"commonConfiguration"` // DefaultMemory Worker default memory DefaultMemory int `` /* 141-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 */ }
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.Model, jobID int64, 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) GetLogger ¶
func (h *HatcheryKubernetes) GetLogger() *logrus.Logger
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) SpawnWorker ¶
func (h *HatcheryKubernetes) SpawnWorker(ctx context.Context, spawnArgs hatchery.SpawnArguments) error
SpawnWorker starts a new worker process
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) 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
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) }