Documentation ¶
Index ¶
- Constants
- Variables
- func ComputeUniqueName(id types.PodID, uniqueKey types.PodUniqueKey) string
- type Factory
- type HookFactory
- type ManifestFinder
- type Pod
- func (pod *Pod) BuildRunitServices(launchables []launch.Launchable, newManifest manifest.Manifest) error
- func (pod *Pod) ConfigDir() string
- func (pod *Pod) CreateCgroupForPod() error
- func (pod *Pod) CurrentManifest() (manifest.Manifest, error)
- func (pod *Pod) EnvDir() string
- func (pod *Pod) FinishExecForExecutable(launchable launch.Launchable, executable launch.Executable) runit.Exec
- func (pod *Pod) Halt(manifest manifest.Manifest, force bool) (bool, error)
- func (pod *Pod) Home() string
- func (pod *Pod) Install(manifest manifest.Manifest, verifier auth.ArtifactVerifier, ...) error
- func (pod *Pod) Launch(manifest manifest.Manifest) (bool, error)
- func (pod *Pod) Launchables(manifest manifest.Manifest) ([]launch.Launchable, error)
- func (pod *Pod) Node() types.NodeName
- func (pod *Pod) PostActivate(launchables []launch.Launchable) error
- func (pod *Pod) Prune(max size.ByteCount, manifest manifest.Manifest)
- func (pod *Pod) ReadOnly() bool
- func (pod *Pod) Services(manifest manifest.Manifest) ([]runit.Service, error)
- func (pod *Pod) SetFinishExec(finishExec []string)
- func (pod *Pod) SetLogBridgeExec(logExec []string)
- func (pod *Pod) SetSubsystemer(s cgroups.Subsystemer)
- func (pod *Pod) StartLaunchables(launchables []launch.Launchable) bool
- func (pod *Pod) Uninstall() error
- func (pod *Pod) UniqueKey() types.PodUniqueKey
- func (pod *Pod) UniqueName() string
- func (pod *Pod) Verify(manifest manifest.Manifest, authPolicy auth.Policy) error
- func (pod *Pod) WriteCurrentManifest(manifest manifest.Manifest) (string, error)
- type ReadOnlyPolicy
Constants ¶
const ( ConfigPathEnvVar = "CONFIG_PATH" LaunchableIDEnvVar = "LAUNCHABLE_ID" LaunchableRootEnvVar = "LAUNCHABLE_ROOT" PodIDEnvVar = "POD_ID" PodHomeEnvVar = "POD_HOME" PodUniqueKeyEnvVar = "POD_UNIQUE_KEY" PlatformConfigPathEnvVar = "PLATFORM_CONFIG_PATH" ResourceLimitsPathEnvVar = "RESOURCE_LIMIT_PATH" // ResourceLimits is a superset of PlatformConfig LaunchableRestartTimeoutEnvVar = "RESTART_TIMEOUT" TerminationGracePeriod = 1 * time.Hour )
const DefaultPath = "/data/pods"
Variables ¶
var (
Log logging.Logger
)
var ( // NestedCgroups causes the p2-preparer to use a hierarchical cgroup naming scheme when // creating new launchables. NestedCgroups = param.Bool("nested_cgroups", false) )
var NoCurrentManifest error = fmt.Errorf("No current manifest for this pod")
var NopFinishExec = []string{"/bin/true"} // type must match preparerconfig
Functions ¶
func ComputeUniqueName ¶
func ComputeUniqueName(id types.PodID, uniqueKey types.PodUniqueKey) string
Types ¶
type Factory ¶
type Factory interface { NewUUIDPod(id types.PodID, uniqueKey types.PodUniqueKey) (*Pod, error) NewLegacyPod(id types.PodID) *Pod SetOSVersionDetector(osversion.Detector) SetDockerClient(dockerclient.Client) }
func NewFactory ¶
type HookFactory ¶
func NewHookFactory ¶
type Pod ¶
type Pod struct { // ID of the pod, i.e. result of ID() called on the manifest defining the pod Id types.PodID SV runit.SV ServiceBuilder *runit.ServiceBuilder P2Exec string DefaultTimeout time.Duration // this is the default timeout for stopping and restarting services in this pod LogExec runit.Exec FinishExec runit.Exec Fetcher uri.Fetcher ManifestFinder ManifestFinder OSVersionDetector osversion.Detector // Pod will not start if file is not present RequireFile string DockerClient *dockerclient.Client // contains filtered or unexported fields }
func (*Pod) BuildRunitServices ¶
func (pod *Pod) BuildRunitServices(launchables []launch.Launchable, newManifest manifest.Manifest) error
Write servicebuilder *.yaml file and run servicebuilder, which will register runit services for this pod.
func (*Pod) CreateCgroupForPod ¶
func (*Pod) FinishExecForExecutable ¶
func (pod *Pod) FinishExecForExecutable(launchable launch.Launchable, executable launch.Executable) runit.Exec
func (*Pod) Install ¶
func (pod *Pod) Install(manifest manifest.Manifest, verifier auth.ArtifactVerifier, artifactRegistry artifact.Registry, containerRegistryAuthStr string, dockerImageDirectoryWhitelist []string) error
Install will ensure that executables for all required services are present on the host machine and are set up to run. In the case of Hoist artifacts (which is the only format supported currently, this will set up runit services.).
func (*Pod) Launch ¶
Launch will attempt to start every launchable listed in the pod manifest. Errors encountered during the launch process will be logged, but will not stop attempts to launch other launchables in the same pod. If any services fail to start, the first return bool will be false. If an error occurs when writing the current manifest to the pod directory, an error will be returned.
func (*Pod) Launchables ¶
func (*Pod) PostActivate ¶
func (pod *Pod) PostActivate(launchables []launch.Launchable) error
runs post-activate for listed launchables
func (*Pod) SetFinishExec ¶
func (*Pod) SetLogBridgeExec ¶
func (*Pod) SetSubsystemer ¶
func (pod *Pod) SetSubsystemer(s cgroups.Subsystemer)
SetSubsystemer is useful for tests
func (*Pod) StartLaunchables ¶
func (pod *Pod) StartLaunchables(launchables []launch.Launchable) bool
func (*Pod) UniqueKey ¶
func (pod *Pod) UniqueKey() types.PodUniqueKey
func (*Pod) UniqueName ¶
A unique name for a pod instance, useful for avoiding filename conflicts. Typically <id>-<uuid> if the pod has a uuid, and simply <id> if it does not have a uuid
This is exported because being able to generate a unique deterministic string for pods is useful in hooks for example.
type ReadOnlyPolicy ¶
type ReadOnlyPolicy struct {
// contains filtered or unexported fields
}
func NewReadOnlyPolicy ¶
func (*ReadOnlyPolicy) IsReadOnly ¶
func (p *ReadOnlyPolicy) IsReadOnly(pod types.PodID) bool