Documentation ¶
Index ¶
- Variables
- type HatcherySwarm
- func (h *HatcherySwarm) CanSpawn(model *sdk.Model, req []sdk.Requirement) bool
- func (h *HatcherySwarm) Hatchery() *sdk.Hatchery
- func (h *HatcherySwarm) ID() int64
- func (h *HatcherySwarm) Init() error
- func (h *HatcherySwarm) KillWorker(worker sdk.Worker) error
- func (h *HatcherySwarm) SpawnWorker(model *sdk.Model, req []sdk.Requirement) error
- func (h *HatcherySwarm) WorkerStarted(model *sdk.Model) int
Constants ¶
This section is empty.
Variables ¶
View Source
var Cmd = &cobra.Command{ Use: "swarm", Short: "Hatchery Swarm commands: hatchery swarm --help", Long: `Hatchery Swarm commands: hatchery swarm <command> Start worker on a docker swarm cluster. You have to export DOCKER_HOST You should export DOCKER_TLS_VERIFY and DOCKER_CERT_PATH $ cds generate token --group shared.infra --expiration persistent 2706bda13748877c57029598b915d46236988c7c57ea0d3808524a1e1a3adef4 $ DOCKER_HOST="tcp://localhost:2375" hatchery swarm --api=https://<api.domain> --token=<token> `, Run: func(cmd *cobra.Command, args []string) { hatchery.Born(hatcherySwarm, viper.GetString("api"), viper.GetString("token"), viper.GetInt("provision"), viper.GetInt("request-api-timeout"), viper.GetBool("insecure")) }, PreRun: func(cmd *cobra.Command, args []string) { hatcherySwarm.onlyWithServiceReq = viper.GetBool("only-with-service-req") hatcherySwarm.maxContainers = viper.GetInt("max-containers") hatcherySwarm.defaultMemory = viper.GetInt("worker-memory") hatcherySwarm.workerTTL = viper.GetInt("worker-ttl") if os.Getenv("DOCKER_HOST") == "" { sdk.Exit("Please export docker client env variables DOCKER_HOST, DOCKER_TLS_VERIFY, DOCKER_CERT_PATH") } }, }
Cmd configures comamnd for HatcherySwarm
Functions ¶
This section is empty.
Types ¶
type HatcherySwarm ¶
type HatcherySwarm struct {
// contains filtered or unexported fields
}
HatcherySwarm is a hatchery which can be connected to a remote to a docker remote api
func (*HatcherySwarm) CanSpawn ¶
func (h *HatcherySwarm) CanSpawn(model *sdk.Model, req []sdk.Requirement) bool
CanSpawn checks if the model can be spawned by this hatchery
func (*HatcherySwarm) Hatchery ¶
func (h *HatcherySwarm) Hatchery() *sdk.Hatchery
Hatchery returns Hatchery instances
func (*HatcherySwarm) Init ¶
func (h *HatcherySwarm) Init() error
Init connect the hatchery to the docker api
func (*HatcherySwarm) KillWorker ¶
func (h *HatcherySwarm) KillWorker(worker sdk.Worker) error
KillWorker kill the worker
func (*HatcherySwarm) SpawnWorker ¶
func (h *HatcherySwarm) SpawnWorker(model *sdk.Model, req []sdk.Requirement) error
SpawnWorker start a new docker container
func (*HatcherySwarm) WorkerStarted ¶
func (h *HatcherySwarm) WorkerStarted(model *sdk.Model) int
WorkerStarted returns the number of started workers
Click to show internal directories.
Click to hide internal directories.