Documentation
¶
Index ¶
- type ConfigMount
- type CustomHealthCheck
- type DeploymentMode
- type DockerProxyConfig
- type DockerProxyPermission
- type DockerProxyPermissionType
- type Manager
- func (m Manager) BackupVolume(volumeName string, backupFilePath string, host string, port int, user string, ...) error
- func (m Manager) CIDRNetwork(name string) (string, error)
- func (m Manager) Close() error
- func (m Manager) CreateCIFSVolume(name string, cifsHost string, cifsShare string, username string, ...) error
- func (m Manager) CreateConfig(content string, applicationId string) (string, error)
- func (m Manager) CreateDockerProxy(serviceName string, placementConstraints []string, config DockerProxyConfig, ...) error
- func (m Manager) CreateImageWithContext(ctx context.Context, dockerfile string, buildargs map[string]string, ...) (*bufio.Scanner, error)
- func (m Manager) CreateLocalVolume(name string) error
- func (m Manager) CreateNFSVolume(name string, nfsServer string, nfsPath string, version int) error
- func (m Manager) CreateNetwork(name string) error
- func (m Manager) CreateService(service Service, username string, password string, queryRegistry bool) error
- func (m Manager) DemoteToWorker(hostname string) error
- func (m Manager) ExistsImage(image string) bool
- func (m Manager) ExistsNetwork(name string) bool
- func (m Manager) ExistsVolume(id string) bool
- func (m Manager) FetchConfig(configId string) (string, error)
- func (m Manager) FetchDockerConfigId(configId string) (string, error)
- func (m Manager) FetchNodeStatus(hostname string) (string, error)
- func (m Manager) FetchPublishedHostPorts(service_name string) ([]int, error)
- func (m Manager) FetchPublishedPortRules(service_name string) ([]swarm.PortConfig, error)
- func (m Manager) FetchVolumes() ([]string, error)
- func (m Manager) GatewayNetwork(name string) (string, error)
- func (m Manager) GenerateManagerJoinToken() (token string, err error)
- func (m Manager) GenerateWorkerJoinToken() (token string, err error)
- func (m Manager) GetService(serviceName string) (Service, error)
- func (m Manager) InitializeAsManager(advertiseIP string) error
- func (m Manager) IsContainerRunning(containerName string) (bool, error)
- func (m Manager) JoinSwarm(address string, token string, advertiseIP string) error
- func (m Manager) LeaveSwarm() error
- func (m Manager) ListNodes() (*map[string]swarm.Node, error)
- func (m Manager) LogsService(serviceName string, sinceMinutes int) (io.ReadCloser, error)
- func (m Manager) MarkNodeAsActive(hostname string) error
- func (m Manager) MarkNodeAsDrained(hostname string) error
- func (m Manager) NoOfRunningTasks(serviceName string) (int, error)
- func (m Manager) PromoteToManager(hostname string) error
- func (m Manager) PruneConfig(applicationId string)
- func (m Manager) PruneContainers() error
- func (m Manager) PruneImages() error
- func (m Manager) PullImage(imageTag string, username string, password string) (*bufio.Scanner, error)
- func (m Manager) PushImage(ctx context.Context, imageTag string, username string, password string) (*bufio.Scanner, error)
- func (m Manager) RandomServiceContainerID(serviceName string) (string, error)
- func (m Manager) RemoveDockerProxy(serviceName string)
- func (m Manager) RemoveImage(imageTag string) error
- func (m Manager) RemoveNetwork(name string) error
- func (m Manager) RemoveNode(hostname string) error
- func (m Manager) RemoveService(serviceName string) error
- func (m Manager) RemoveServiceContainers(serviceName string) error
- func (m Manager) RemoveVolume(id string) error
- func (m Manager) RestartService(serviceName string) error
- func (m Manager) RestoreVolume(volumeName string, backupFilePath string, host string, port int, user string, ...) error
- func (m Manager) RollbackService(serviceName string) error
- func (m Manager) RunCommandInServiceContainers(serviceName string, command []string) error
- func (m Manager) ServiceRunningServers(serviceName string) ([]string, error)
- func (m Manager) SetServiceReplicaCount(serviceName string, replicas int) error
- func (m Manager) SizeVolume(volumeName string, host string, port int, user string, privateKey string) (sizeMB float64, err error)
- func (m Manager) UpdatePublishedHostPorts(service_name string, ports []swarm.PortConfig) error
- func (m Manager) UpdateService(service Service, username string, password string, queryRegistry bool) error
- type Resource
- type Service
- type ServiceRealtimeInfo
- type ServiceTaskPlacementInfo
- type VolumeBind
- type VolumeMount
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigMount ¶
type CustomHealthCheck ¶
type CustomHealthCheck struct { Enabled bool `json:"enabled"` TestCommand string `json:"test_command"` IntervalSeconds uint64 `json:"interval_seconds"` // Time between running the check in seconds TimeoutSeconds uint64 `json:"timeout_seconds"` // Maximum time to allow one check to run in seconds StartPeriodSeconds uint64 `json:"start_period_seconds"` // Start period for the container to initialize before counting retries towards unstable StartIntervalSeconds uint64 `json:"start_interval_seconds"` // Time between running the check during the start period Retries uint64 `json:"retries"` // Consecutive failures needed to report unhealthy }
type DeploymentMode ¶
type DeploymentMode string
const ( DeploymentModeReplicated DeploymentMode = "replicated" DeploymentModeGlobal DeploymentMode = "global" )
type DockerProxyConfig ¶
type DockerProxyConfig struct {
Permission DockerProxyPermission `json:"permissions" gorm:"embedded;embeddedPrefix:permission_"`
}
type DockerProxyPermission ¶
type DockerProxyPermission struct { Ping DockerProxyPermissionType `json:"ping" gorm:"default:read"` Version DockerProxyPermissionType `json:"version" gorm:"default:none"` Info DockerProxyPermissionType `json:"info" gorm:"default:none"` Events DockerProxyPermissionType `json:"events" gorm:"default:none"` Auth DockerProxyPermissionType `json:"auth" gorm:"default:none"` Secrets DockerProxyPermissionType `json:"secrets" gorm:"default:none"` Build DockerProxyPermissionType `json:"build" gorm:"default:none"` Commit DockerProxyPermissionType `json:"commit" gorm:"default:none"` Configs DockerProxyPermissionType `json:"configs" gorm:"default:none"` Containers DockerProxyPermissionType `json:"containers" gorm:"default:none"` Distribution DockerProxyPermissionType `json:"distribution" gorm:"default:none"` Exec DockerProxyPermissionType `json:"exec" gorm:"default:none"` Grpc DockerProxyPermissionType `json:"grpc" gorm:"default:none"` Images DockerProxyPermissionType `json:"images" gorm:"default:none"` Networks DockerProxyPermissionType `json:"networks" gorm:"default:none"` Nodes DockerProxyPermissionType `json:"nodes" gorm:"default:none"` Plugins DockerProxyPermissionType `json:"plugins" gorm:"default:none"` Services DockerProxyPermissionType `json:"services" gorm:"default:none"` Session DockerProxyPermissionType `json:"session" gorm:"default:none"` Swarm DockerProxyPermissionType `json:"swarm" gorm:"default:none"` System DockerProxyPermissionType `json:"system" gorm:"default:none"` Tasks DockerProxyPermissionType `json:"tasks" gorm:"default:none"` Volumes DockerProxyPermissionType `json:"volumes" gorm:"default:none"` }
type DockerProxyPermissionType ¶
type DockerProxyPermissionType string
const ( // DockerProxyNoPermission no request will be allowed DockerProxyNoPermission DockerProxyPermissionType = "none" // DockerProxyReadPermission only [GET, HEAD] requests will be allowed DockerProxyReadPermission DockerProxyPermissionType = "read" // DockerProxyReadWritePermission all requests will be allowed [GET, HEAD, POST, PUT, DELETE, OPTIONS] DockerProxyReadWritePermission DockerProxyPermissionType = "read_write" )
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewLocalClient ¶
NewLocalClient creates a new container manager with a local client
func (Manager) BackupVolume ¶
func (m Manager) BackupVolume(volumeName string, backupFilePath string, host string, port int, user string, privateKey string) error
BackupVolume : Backup a volume to a file
func (Manager) CIDRNetwork ¶
CIDRNetwork Fetch CIDR of a network
func (Manager) CreateCIFSVolume ¶
func (m Manager) CreateCIFSVolume(name string, cifsHost string, cifsShare string, username string, password string, fileMode string, dirMode string, uid int, gid int) error
CreateCIFSVolume : Create a new CIFS volume, return id of the volume
func (Manager) CreateConfig ¶
CreateConfig creates a new config and returns the config id
func (Manager) CreateDockerProxy ¶
func (Manager) CreateImageWithContext ¶
func (m Manager) CreateImageWithContext(ctx context.Context, dockerfile string, buildargs map[string]string, sourceCodeDirectory string, codePath string, imagename string) (*bufio.Scanner, error)
CreateImageWithContext builds a Docker image from a Dockerfile and returns a scanner to read the build logs. It takes the Dockerfile content as a string, a map of build arguments, the path to the code directory, and the name of the image to be built. It returns a scanner to read the build logs and an error if any. It takes a context.Context as an additional argument.
func (Manager) CreateLocalVolume ¶
CreateLocalVolume : Create a new volume, return id of the volume
func (Manager) CreateNFSVolume ¶
CreateNFSVolume : Create a new NFS volume, return id of the volume
func (Manager) CreateNetwork ¶
CreateNetwork Create a new network with the given name It will create an overlay network with the given name and allow to attach containers to it
func (Manager) CreateService ¶
func (Manager) DemoteToWorker ¶
DemoteToWorker demotes a node to worker
func (Manager) ExistsImage ¶
ExistsImage checks if a Docker image exists locally.
func (Manager) ExistsNetwork ¶
ExistsNetwork Check if a network exists
func (Manager) ExistsVolume ¶
ExistsVolume : Check if volume exists
func (Manager) FetchConfig ¶
FetchConfig fetches the config with the given id
func (Manager) FetchDockerConfigId ¶
FetchDockerConfigId fetches the docker config id of a config
func (Manager) FetchNodeStatus ¶
FetchNodeStatus fetches the status of a node
func (Manager) FetchPublishedHostPorts ¶
Fetch published host ports of a service
func (Manager) FetchPublishedPortRules ¶
func (m Manager) FetchPublishedPortRules(service_name string) ([]swarm.PortConfig, error)
FetchPublishedPortRules Fetch published port rules of a service
func (Manager) FetchVolumes ¶
FetchVolumes Fetch all volumes
func (Manager) GatewayNetwork ¶
GatewayNetwork Fetch gateway of a network
func (Manager) GenerateManagerJoinToken ¶
GenerateManagerJoinToken generates a manager join token
func (Manager) GenerateWorkerJoinToken ¶
GenerateWorkerJoinToken generates a worker join token
func (Manager) InitializeAsManager ¶
InitializeAsManager initializes the swarm as a manager
func (Manager) IsContainerRunning ¶
IsContainerRunning checks if a container is running
func (Manager) LogsService ¶
LogsService Get service logs
func (Manager) MarkNodeAsActive ¶
MarkNodeAsActive marks a node as active
func (Manager) MarkNodeAsDrained ¶
MarkNodeAsDrained marks a node as drained
func (Manager) NoOfRunningTasks ¶
func (Manager) PromoteToManager ¶
PromoteToManager promotes a node to manager
func (Manager) PruneConfig ¶
PruneConfig removes all the configs with the given applicationId. It will remove all the possible configs It will not raise any error if failed to remove a config
func (Manager) PruneContainers ¶
PruneContainers prunes all containers
func (Manager) PruneImages ¶
PruneImages removes all unused Docker images from the local registry.
func (Manager) PullImage ¶
func (m Manager) PullImage(imageTag string, username string, password string) (*bufio.Scanner, error)
PullImage pulls a Docker image from a remote registry and returns a scanner to read the pull logs.
func (Manager) PushImage ¶
func (m Manager) PushImage(ctx context.Context, imageTag string, username string, password string) (*bufio.Scanner, error)
PushImage pushes a Docker image to a remote registry and returns a scanner to read the push logs.
func (Manager) RandomServiceContainerID ¶
RandomServiceContainerID returns a random container id of a service
func (Manager) RemoveDockerProxy ¶
func (Manager) RemoveImage ¶
RemoveImage removes a Docker image from the local registry.
func (Manager) RemoveNetwork ¶
RemoveNetwork Delete a network
func (Manager) RemoveNode ¶
RemoveNode removes a node from the swarm
func (Manager) RemoveService ¶
func (Manager) RemoveServiceContainers ¶
RemoveServiceContainers removes all containers for a service in a node
func (Manager) RemoveVolume ¶
RemoveVolume : Remove a volume by id
func (Manager) RestartService ¶
func (Manager) RestoreVolume ¶
func (m Manager) RestoreVolume(volumeName string, backupFilePath string, host string, port int, user string, privateKey string) error
RestoreVolume : Restore a volume from a backup file
func (Manager) RollbackService ¶
func (Manager) RunCommandInServiceContainers ¶
RunCommandInServiceContainers runs a command in all containers for a service
func (Manager) ServiceRunningServers ¶
ServiceRunningServers Fetch the servers where a service is running
func (Manager) SetServiceReplicaCount ¶
func (Manager) SizeVolume ¶
func (m Manager) SizeVolume(volumeName string, host string, port int, user string, privateKey string) (sizeMB float64, err error)
SizeVolume : Return a file which will contain the size of the volume in bytes
func (Manager) UpdatePublishedHostPorts ¶
func (m Manager) UpdatePublishedHostPorts(service_name string, ports []swarm.PortConfig) error
update published host ports of a service
type Service ¶
type Service struct { Name string `json:"name"` Image string `json:"image"` Command []string `json:"command,omitempty"` Env map[string]string `json:"env,omitempty"` Capabilities []string `json:"capabilities,omitempty"` Sysctls map[string]string `json:"sysctl,omitempty"` ConfigMounts []ConfigMount `json:"configmounts,omitempty"` VolumeMounts []VolumeMount `json:"volumemounts,omitempty"` VolumeBinds []VolumeBind `json:"volumebinds,omitempty"` Networks []string `json:"networks,omitempty"` DeploymentMode DeploymentMode `json:"deploymentmode"` Replicas uint64 `json:"replicas"` PlacementConstraints []string `json:"placementconstraints,omitempty"` ReservedResource Resource `json:"reserved_resource,omitempty"` ResourceLimit Resource `json:"resource_limit,omitempty"` CustomHealthCheck CustomHealthCheck `json:"custom_health_check,omitempty"` }