Documentation ¶
Index ¶
- Constants
- Variables
- func CalledAs() (executable string, wrapped bool)
- func ServeLifecyclePlugin(impl Lifecycler)
- func ServeVersionsPlugin(impl Versioner)
- type ContainerPort
- type ContainerPorts
- type DockerConfig
- type DockerConfigEntry
- type HostOpts
- type ISCInstance
- type ISCInstances
- func (is ISCInstances) ByPortOffsets() (map[int64]*ISCInstance, error)
- func (is ISCInstances) CalculatePortOffset(start int64) (int64, error)
- func (is ISCInstances) Exists(name string) bool
- func (is ISCInstances) Find(name string) *ISCInstance
- func (is ISCInstances) UsedPortOffset(offset int64) (bool, error)
- type ISCVersion
- type ISCVersions
- func (evs *ISCVersions) AddIfMissing(ev *ISCVersion) bool
- func (evs ISCVersions) Exists(versionString string) bool
- func (evs ISCVersions) Find(versionString string) *ISCVersion
- func (evs ISCVersions) Latest() *ISCVersion
- func (evs ISCVersions) Len() int
- func (evs ISCVersions) Less(i, j int) bool
- func (evs *ISCVersions) Sort()
- func (evs ISCVersions) Swap(i, j int)
- type Lifecycler
- type LifecyclerPlugin
- type LifecyclerRPC
- func (s LifecyclerRPC) AfterInstance(state *isclib.Instance) error
- func (s LifecyclerRPC) AfterStart(instance *ISCInstance) error
- func (s LifecyclerRPC) AfterStop(instance *ISCInstance) error
- func (s LifecyclerRPC) BeforeInstance(state *isclib.Instance) error
- func (s LifecyclerRPC) BeforeRemove(instance *ISCInstance) error
- func (s LifecyclerRPC) Copies(version string, flagValues map[string]interface{}) ([]string, error)
- func (s LifecyclerRPC) Environment(version string, flagValues map[string]interface{}) ([]string, error)
- func (s LifecyclerRPC) Flags() (PluginFlags, error)
- func (s LifecyclerRPC) Ports(version string, flagValues map[string]interface{}) ([]string, error)
- func (s LifecyclerRPC) Volumes(version string, flagValues map[string]interface{}) ([]string, error)
- func (s LifecyclerRPC) WithInstance(state *isclib.Instance) error
- type LifecyclerRPCServer
- func (s *LifecyclerRPCServer) AfterInstance(state *isclib.Instance, resp *struct{}) (err error)
- func (s *LifecyclerRPCServer) AfterStart(instance *ISCInstance, resp *struct{}) (err error)
- func (s *LifecyclerRPCServer) AfterStop(instance *ISCInstance, resp *struct{}) (err error)
- func (s *LifecyclerRPCServer) BeforeInstance(state *isclib.Instance, resp *struct{}) (err error)
- func (s *LifecyclerRPCServer) BeforeRemove(instance *ISCInstance, resp *struct{}) (err error)
- func (s *LifecyclerRPCServer) Copies(opts HostOpts, resp *[]string) (err error)
- func (s *LifecyclerRPCServer) Environment(opts HostOpts, resp *[]string) (err error)
- func (s *LifecyclerRPCServer) Flags(args interface{}, resp *PluginFlags) (err error)
- func (s *LifecyclerRPCServer) Ports(opts HostOpts, resp *[]string) (err error)
- func (s *LifecyclerRPCServer) Volumes(opts HostOpts, resp *[]string) (err error)
- func (s *LifecyclerRPCServer) WithInstance(state *isclib.Instance, resp *struct{}) (err error)
- type PluginFlag
- type PluginFlags
- type PluginFlagsBuilder
- type Versioner
- type VersionerPlugin
- type VersionerRPC
- type VersionerRPCServer
Constants ¶
const ( ApplicationName = "iscenv" PortInternalSS = 1972 PortExternalSS = 56772 EnvInternalSS = "ISC_SUPERSERVER_PORT" PortInternalWeb = 57772 PortExternalWeb = 57772 EnvInternalWeb = "ISC_HTTP_PORT" PortInternalHC = 59772 PortExternalHC = 59772 EnvInternalHC = "ISCENV_HEALTHCHECK_PORT" // TODO: These should be defaults and should be configurable with viper DockerSocket = "unix:///var/run/docker.sock" ContainerPrefix = ApplicationName + "-" InternalISCEnvBinaryDir = "/bin" InternalISCEnvPath = InternalISCEnvBinaryDir + "/iscenv" )
const (
LifecyclerKey = "lifecycle"
)
const (
VersionerKey = "versions"
)
Variables ¶
var PluginHandshake = plugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "ISCENV_PLUGIN",
MagicCookieValue: "activate",
}
var Version string
Version This version number will be injected by the build system based on the Mercurial tags on the repository
var ( // WrappedCommands are commands that when iscenv is called but renamed (or linked) to one of these names it will attempt to mimic // the command inside the container as closely as possible. WrappedCommands = []string{"ccontrol", "csession"} )
Functions ¶
func ServeLifecyclePlugin ¶
func ServeLifecyclePlugin(impl Lifecycler)
func ServeVersionsPlugin ¶
func ServeVersionsPlugin(impl Versioner)
Types ¶
type ContainerPort ¶
type ContainerPort int64
func (ContainerPort) String ¶
func (p ContainerPort) String() string
type ContainerPorts ¶
type ContainerPorts struct { SuperServer ContainerPort Web ContainerPort HealthCheck ContainerPort }
type DockerConfig ¶
type DockerConfig struct { Path string Entries map[string]DockerConfigEntry }
The contents of a docker ocnfiguration file
type DockerConfigEntry ¶
A single entry from a docker configuration file
func (DockerConfigEntry) Credentials ¶
func (dce DockerConfigEntry) Credentials() (user string, pass string, err error)
Parse the credentials from this entry
type ISCInstance ¶
type ISCInstance struct { ID string Name string Version string Created int64 Status string Ports ContainerPorts }
func (ISCInstance) PortOffset ¶
func (i ISCInstance) PortOffset() (offset int64, err error)
type ISCInstances ¶
type ISCInstances []*ISCInstance
func (ISCInstances) ByPortOffsets ¶
func (is ISCInstances) ByPortOffsets() (map[int64]*ISCInstance, error)
func (ISCInstances) CalculatePortOffset ¶
func (is ISCInstances) CalculatePortOffset(start int64) (int64, error)
func (ISCInstances) Exists ¶
func (is ISCInstances) Exists(name string) bool
func (ISCInstances) Find ¶
func (is ISCInstances) Find(name string) *ISCInstance
func (ISCInstances) UsedPortOffset ¶
func (is ISCInstances) UsedPortOffset(offset int64) (bool, error)
type ISCVersions ¶
type ISCVersions []*ISCVersion
func (*ISCVersions) AddIfMissing ¶
func (evs *ISCVersions) AddIfMissing(ev *ISCVersion) bool
func (ISCVersions) Exists ¶
func (evs ISCVersions) Exists(versionString string) bool
func (ISCVersions) Find ¶
func (evs ISCVersions) Find(versionString string) *ISCVersion
func (ISCVersions) Latest ¶
func (evs ISCVersions) Latest() *ISCVersion
func (ISCVersions) Len ¶
func (evs ISCVersions) Len() int
func (ISCVersions) Less ¶
func (evs ISCVersions) Less(i, j int) bool
func (*ISCVersions) Sort ¶
func (evs *ISCVersions) Sort()
func (ISCVersions) Swap ¶
func (evs ISCVersions) Swap(i, j int)
type Lifecycler ¶
type Lifecycler interface { // Runs on host - Returns an array of additional flags to add to the start command. These flags will be passed to the remaining *external* plugin hooks. Plugin hooks within the container and expected to depend upon environment variables or volumes configured by the host hooks. Flags() (PluginFlags, error) // Returns an array of docker API formatted environment variables (ENV_VAR=value) which will be added to the instance Environment(version string, flagValues map[string]interface{}) ([]string, error) // Returns an array of items to copy to the container in the format "src:dest" Copies(version string, flagValues map[string]interface{}) ([]string, error) // Returns an array of volumes to add where the string is a standard docker volume format "src:dest:flag" Volumes(version string, flagValues map[string]interface{}) ([]string, error) // Additional ports to map in the format <optional hostIP>:hostPort:containerPort. You may also prefix the host port with a + to indicate it should be shifted by the port offset Ports(version string, flagValues map[string]interface{}) ([]string, error) // Will run on the host after the container instance starts, receives the same flag values as start AfterStart(instance *ISCInstance) error // Will run within the container before the instance successfully starts BeforeInstance(state *isclib.Instance) error // Will run within the container after the instance starts WithInstance(state *isclib.Instance) error // Will run within the container after the instance stops AfterInstance(state *isclib.Instance) error // Will run on the host after the instance stops AfterStop(instance *ISCInstance) error // Will run on the host before the instance is removed BeforeRemove(instance *ISCInstance) error }
A plugin that is executed during instance starts
type LifecyclerPlugin ¶
type LifecyclerPlugin struct { // The actual implementation of the plugin. This will be unset on the client side Plugin Lifecycler }
The actual plugin interface needed by go-plugin. It's a little strange in that it has both the client and server sides in the same interface.
func (LifecyclerPlugin) Client ¶
func (LifecyclerPlugin) Client(_ *plugin.MuxBroker, c *rpc.Client) (interface{}, error)
func (LifecyclerPlugin) Server ¶
func (s LifecyclerPlugin) Server(*plugin.MuxBroker) (interface{}, error)
type LifecyclerRPC ¶
type LifecyclerRPC struct {
// contains filtered or unexported fields
}
The client (primary executable) RPC-based implementation of the interface
func (LifecyclerRPC) AfterInstance ¶
func (s LifecyclerRPC) AfterInstance(state *isclib.Instance) error
func (LifecyclerRPC) AfterStart ¶
func (s LifecyclerRPC) AfterStart(instance *ISCInstance) error
func (LifecyclerRPC) AfterStop ¶
func (s LifecyclerRPC) AfterStop(instance *ISCInstance) error
func (LifecyclerRPC) BeforeInstance ¶
func (s LifecyclerRPC) BeforeInstance(state *isclib.Instance) error
func (LifecyclerRPC) BeforeRemove ¶
func (s LifecyclerRPC) BeforeRemove(instance *ISCInstance) error
func (LifecyclerRPC) Copies ¶
func (s LifecyclerRPC) Copies(version string, flagValues map[string]interface{}) ([]string, error)
func (LifecyclerRPC) Environment ¶
func (s LifecyclerRPC) Environment(version string, flagValues map[string]interface{}) ([]string, error)
func (LifecyclerRPC) Flags ¶
func (s LifecyclerRPC) Flags() (PluginFlags, error)
The logger is intentionally not passed to this method as logging cannot yet be configured during the flag setup...
func (LifecyclerRPC) Ports ¶
func (s LifecyclerRPC) Ports(version string, flagValues map[string]interface{}) ([]string, error)
func (LifecyclerRPC) Volumes ¶
func (s LifecyclerRPC) Volumes(version string, flagValues map[string]interface{}) ([]string, error)
func (LifecyclerRPC) WithInstance ¶
func (s LifecyclerRPC) WithInstance(state *isclib.Instance) error
type LifecyclerRPCServer ¶
type LifecyclerRPCServer struct{ Plugin Lifecycler }
The server (plugin side) RPC wrapper around the concrete plugin implementation
func (*LifecyclerRPCServer) AfterInstance ¶
func (s *LifecyclerRPCServer) AfterInstance(state *isclib.Instance, resp *struct{}) (err error)
func (*LifecyclerRPCServer) AfterStart ¶
func (s *LifecyclerRPCServer) AfterStart(instance *ISCInstance, resp *struct{}) (err error)
func (*LifecyclerRPCServer) AfterStop ¶
func (s *LifecyclerRPCServer) AfterStop(instance *ISCInstance, resp *struct{}) (err error)
func (*LifecyclerRPCServer) BeforeInstance ¶
func (s *LifecyclerRPCServer) BeforeInstance(state *isclib.Instance, resp *struct{}) (err error)
func (*LifecyclerRPCServer) BeforeRemove ¶
func (s *LifecyclerRPCServer) BeforeRemove(instance *ISCInstance, resp *struct{}) (err error)
func (*LifecyclerRPCServer) Copies ¶
func (s *LifecyclerRPCServer) Copies(opts HostOpts, resp *[]string) (err error)
func (*LifecyclerRPCServer) Environment ¶
func (s *LifecyclerRPCServer) Environment(opts HostOpts, resp *[]string) (err error)
func (*LifecyclerRPCServer) Flags ¶
func (s *LifecyclerRPCServer) Flags(args interface{}, resp *PluginFlags) (err error)
func (*LifecyclerRPCServer) Ports ¶
func (s *LifecyclerRPCServer) Ports(opts HostOpts, resp *[]string) (err error)
func (*LifecyclerRPCServer) Volumes ¶
func (s *LifecyclerRPCServer) Volumes(opts HostOpts, resp *[]string) (err error)
func (*LifecyclerRPCServer) WithInstance ¶
func (s *LifecyclerRPCServer) WithInstance(state *isclib.Instance, resp *struct{}) (err error)
type PluginFlag ¶
func NewPluginFlag ¶
func NewPluginFlag(flag string, hasConfig bool, defaultValue interface{}, usage string) *PluginFlag
type PluginFlags ¶
type PluginFlags struct {
Flags map[string]*PluginFlag
}
func NewPluginFlags ¶
func NewPluginFlags() PluginFlags
type PluginFlagsBuilder ¶
type PluginFlagsBuilder struct {
// contains filtered or unexported fields
}
func NewPluginFlagsBuilder ¶
func NewPluginFlagsBuilder() *PluginFlagsBuilder
NewPluginFlagsBuilder creates a new instance of object meant to assist plugins in building flags
func (*PluginFlagsBuilder) AddFlag ¶
func (builder *PluginFlagsBuilder) AddFlag(flag string, hasConfig bool, defaultValue interface{}, usage string)
func (*PluginFlagsBuilder) Flags ¶
func (builder *PluginFlagsBuilder) Flags() (PluginFlags, error)
type Versioner ¶
type Versioner interface { // Find the versions avaiable for the provided image Versions(image string) (ISCVersions, error) }
The versioner interface describes a plugin which can find versions for iscenv
type VersionerPlugin ¶
type VersionerPlugin struct { // The actual implementation of the plugin. This will be unset on the client side Plugin Versioner }
The actual plugin interface needed by go-plugin. It's a little strange in that it has both the client and server sides in the same interface.
func (VersionerPlugin) Client ¶
func (VersionerPlugin) Client(_ *plugin.MuxBroker, c *rpc.Client) (interface{}, error)
func (VersionerPlugin) Server ¶
func (v VersionerPlugin) Server(*plugin.MuxBroker) (interface{}, error)
type VersionerRPC ¶
type VersionerRPC struct {
// contains filtered or unexported fields
}
The client (primary executable) RPC-based implementation of the interface
func (VersionerRPC) Versions ¶
func (v VersionerRPC) Versions(image string) (ISCVersions, error)
type VersionerRPCServer ¶
type VersionerRPCServer struct{ Plugin Versioner }
The server (plugin side) RPC wrapper around the concrete plugin implementation
func (*VersionerRPCServer) Versions ¶
func (v *VersionerRPCServer) Versions(image string, resp *ISCVersions) (err error)