Documentation ¶
Index ¶
- Constants
- type Option
- type SingularityRuntime
- func (s *SingularityRuntime) Attach(ctx context.Context, req *k8s.AttachRequest) (*k8s.AttachResponse, error)
- func (s *SingularityRuntime) ContainerStats(ctx context.Context, req *k8s.ContainerStatsRequest) (*k8s.ContainerStatsResponse, error)
- func (s *SingularityRuntime) ContainerStatus(_ context.Context, req *k8s.ContainerStatusRequest) (*k8s.ContainerStatusResponse, error)
- func (s *SingularityRuntime) CreateContainer(_ context.Context, req *k8s.CreateContainerRequest) (*k8s.CreateContainerResponse, error)
- func (s *SingularityRuntime) Exec(ctx context.Context, req *k8s.ExecRequest) (*k8s.ExecResponse, error)
- func (s *SingularityRuntime) ExecSync(ctx context.Context, req *k8s.ExecSyncRequest) (*k8s.ExecSyncResponse, error)
- func (s *SingularityRuntime) ListContainerStats(ctx context.Context, req *k8s.ListContainerStatsRequest) (*k8s.ListContainerStatsResponse, error)
- func (s *SingularityRuntime) ListContainers(_ context.Context, req *k8s.ListContainersRequest) (*k8s.ListContainersResponse, error)
- func (s *SingularityRuntime) ListPodSandbox(_ context.Context, req *k8s.ListPodSandboxRequest) (*k8s.ListPodSandboxResponse, error)
- func (s *SingularityRuntime) PodSandboxStatus(_ context.Context, req *k8s.PodSandboxStatusRequest) (*k8s.PodSandboxStatusResponse, error)
- func (s *SingularityRuntime) PortForward(ctx context.Context, req *k8s.PortForwardRequest) (*k8s.PortForwardResponse, error)
- func (s *SingularityRuntime) RemoveContainer(_ context.Context, req *k8s.RemoveContainerRequest) (*k8s.RemoveContainerResponse, error)
- func (s *SingularityRuntime) RemovePodSandbox(_ context.Context, req *k8s.RemovePodSandboxRequest) (*k8s.RemovePodSandboxResponse, error)
- func (s *SingularityRuntime) ReopenContainerLog(ctx context.Context, req *k8s.ReopenContainerLogRequest) (*k8s.ReopenContainerLogResponse, error)
- func (s *SingularityRuntime) RunPodSandbox(_ context.Context, req *k8s.RunPodSandboxRequest) (*k8s.RunPodSandboxResponse, error)
- func (s *SingularityRuntime) Shutdown() error
- func (s *SingularityRuntime) StartContainer(_ context.Context, req *k8s.StartContainerRequest) (*k8s.StartContainerResponse, error)
- func (s *SingularityRuntime) Status(ctx context.Context, req *k8s.StatusRequest) (*k8s.StatusResponse, error)
- func (s *SingularityRuntime) StopContainer(_ context.Context, req *k8s.StopContainerRequest) (*k8s.StopContainerResponse, error)
- func (s *SingularityRuntime) StopPodSandbox(_ context.Context, req *k8s.StopPodSandboxRequest) (*k8s.StopPodSandboxResponse, error)
- func (s *SingularityRuntime) UpdateContainerResources(ctx context.Context, req *k8s.UpdateContainerResourcesRequest) (*k8s.UpdateContainerResourcesResponse, error)
- func (s *SingularityRuntime) UpdateRuntimeConfig(ctx context.Context, req *k8s.UpdateRuntimeConfigRequest) (*k8s.UpdateRuntimeConfigResponse, error)
- func (s *SingularityRuntime) Version(context.Context, *k8s.VersionRequest) (*k8s.VersionResponse, error)
Constants ¶
const ( // DefaultBaseRunDir is the default location for running pods and containers. DefaultBaseRunDir = "/var/run/singularity" // DefaultStreamingURL is the default streaming server address. DefaultStreamingURL = "127.0.0.1:12345" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(r *SingularityRuntime)
Option is run during SingularityRuntime initialization. Predefined options may be used to add streaming and network support.
func WithBaseRunDir ¶
WithBaseRunDir sets base directory where all running pods and containers are stored. Overrides DefaultBaseRunDir.
func WithNetwork ¶
WithNetwork accepts CNI paths and enables networking support. If cniBin or cniConf is an empty string corresponding default value from network package will be used.
func WithStreaming ¶
WithStreaming sets enables streaming endpoints by setting streaming server URL. If url is empty DefaultStreamingURL will be used.
func WithTrashDir ¶
WithTrashDir sets trash directory for containers where all logs and configs may be found even after contaienr removal.
type SingularityRuntime ¶
type SingularityRuntime struct {
// contains filtered or unexported fields
}
SingularityRuntime implements k8s RuntimeService interface.
func NewSingularityRuntime ¶
func NewSingularityRuntime(imgIndex *index.ImageIndex, opts ...Option) (*SingularityRuntime, error)
NewSingularityRuntime initializes and returns SingularityRuntime. Singularity must be installed on the host otherwise it will return an error. SingularityRuntime depends on SingularityRegistry so it must not be nil.
func (*SingularityRuntime) Attach ¶
func (s *SingularityRuntime) Attach(ctx context.Context, req *k8s.AttachRequest) (*k8s.AttachResponse, error)
Attach prepares a streaming endpoint to attach to a running container.
func (*SingularityRuntime) ContainerStats ¶
func (s *SingularityRuntime) ContainerStats(ctx context.Context, req *k8s.ContainerStatsRequest) (*k8s.ContainerStatsResponse, error)
ContainerStats returns stats of the container. If the container does not exist, the call returns an error.
func (*SingularityRuntime) ContainerStatus ¶
func (s *SingularityRuntime) ContainerStatus(_ context.Context, req *k8s.ContainerStatusRequest) (*k8s.ContainerStatusResponse, error)
ContainerStatus returns status of the container. If the container is not present, returns an error.
func (*SingularityRuntime) CreateContainer ¶
func (s *SingularityRuntime) CreateContainer(_ context.Context, req *k8s.CreateContainerRequest) (*k8s.CreateContainerResponse, error)
CreateContainer creates a new container in specified PodSandbox.
func (*SingularityRuntime) Exec ¶
func (s *SingularityRuntime) Exec(ctx context.Context, req *k8s.ExecRequest) (*k8s.ExecResponse, error)
Exec prepares a streaming endpoint to execute a command in the container.
func (*SingularityRuntime) ExecSync ¶
func (s *SingularityRuntime) ExecSync(ctx context.Context, req *k8s.ExecSyncRequest) (*k8s.ExecSyncResponse, error)
ExecSync runs a command in a container synchronously.
func (*SingularityRuntime) ListContainerStats ¶
func (s *SingularityRuntime) ListContainerStats(ctx context.Context, req *k8s.ListContainerStatsRequest) (*k8s.ListContainerStatsResponse, error)
ListContainerStats returns stats of all running containers.
func (*SingularityRuntime) ListContainers ¶
func (s *SingularityRuntime) ListContainers(_ context.Context, req *k8s.ListContainersRequest) (*k8s.ListContainersResponse, error)
ListContainers lists all containers by filters.
func (*SingularityRuntime) ListPodSandbox ¶
func (s *SingularityRuntime) ListPodSandbox(_ context.Context, req *k8s.ListPodSandboxRequest) (*k8s.ListPodSandboxResponse, error)
ListPodSandbox returns a list of PodSandboxes.
func (*SingularityRuntime) PodSandboxStatus ¶
func (s *SingularityRuntime) PodSandboxStatus(_ context.Context, req *k8s.PodSandboxStatusRequest) (*k8s.PodSandboxStatusResponse, error)
PodSandboxStatus returns the status of the PodSandbox. If the PodSandbox is not present, returns an error.
func (*SingularityRuntime) PortForward ¶
func (s *SingularityRuntime) PortForward(ctx context.Context, req *k8s.PortForwardRequest) (*k8s.PortForwardResponse, error)
PortForward prepares a streaming endpoint to forward ports from a PodSandbox.
func (*SingularityRuntime) RemoveContainer ¶
func (s *SingularityRuntime) RemoveContainer(_ context.Context, req *k8s.RemoveContainerRequest) (*k8s.RemoveContainerResponse, error)
RemoveContainer removes the container. If the container is running, the container must be forcibly removed. This call is idempotent, and must not return an error if the container has already been removed.
func (*SingularityRuntime) RemovePodSandbox ¶
func (s *SingularityRuntime) RemovePodSandbox(_ context.Context, req *k8s.RemovePodSandboxRequest) (*k8s.RemovePodSandboxResponse, error)
RemovePodSandbox removes the sandbox. If there are any running containers in the sandbox, they must be forcibly terminated and removed. This call is idempotent, and must not return an error if the sandbox has already been removed.
func (*SingularityRuntime) ReopenContainerLog ¶
func (s *SingularityRuntime) ReopenContainerLog(ctx context.Context, req *k8s.ReopenContainerLogRequest) (*k8s.ReopenContainerLogResponse, error)
ReopenContainerLog asks runtime to reopen the stdout/stderr log file for the container. This is often called after the log file has been rotated. If the container is not running, container runtime can choose to either create a new log file and return nil, or return an error. Once it returns error, new container log file MUST NOT be created.
func (*SingularityRuntime) RunPodSandbox ¶
func (s *SingularityRuntime) RunPodSandbox(_ context.Context, req *k8s.RunPodSandboxRequest) (*k8s.RunPodSandboxResponse, error)
RunPodSandbox creates and starts a pod-level sandbox. Runtimes must ensure the sandbox is in the ready state on success.
func (*SingularityRuntime) Shutdown ¶
func (s *SingularityRuntime) Shutdown() error
Shutdown shuts down any running background tasks created by SingularityRuntime. This methods should be called when SingularityRuntime will no longer be used.
func (*SingularityRuntime) StartContainer ¶
func (s *SingularityRuntime) StartContainer(_ context.Context, req *k8s.StartContainerRequest) (*k8s.StartContainerResponse, error)
StartContainer starts the container.
func (*SingularityRuntime) Status ¶
func (s *SingularityRuntime) Status(ctx context.Context, req *k8s.StatusRequest) (*k8s.StatusResponse, error)
Status returns the status of the runtime.
func (*SingularityRuntime) StopContainer ¶
func (s *SingularityRuntime) StopContainer(_ context.Context, req *k8s.StopContainerRequest) (*k8s.StopContainerResponse, error)
StopContainer stops a running container with a grace period (i.e., timeout). This call is idempotent, and must not return an error if the container has already been stopped. If a grace period is reached runtime will be asked to kill container.
func (*SingularityRuntime) StopPodSandbox ¶
func (s *SingularityRuntime) StopPodSandbox(_ context.Context, req *k8s.StopPodSandboxRequest) (*k8s.StopPodSandboxResponse, error)
StopPodSandbox stops any running process that is part of the sandbox and reclaims network resources (e.g., IP addresses) allocated to the sandbox. If there are any running containers in the sandbox, they must be forcibly terminated. This call is idempotent, and must not return an error if all relevant resources have already been reclaimed. kubelet will call StopPodSandbox at least once before calling RemovePodSandbox. It will also attempt to reclaim resources eagerly, as soon as a sandbox is not needed. Hence, multiple StopPodSandbox calls are expected.
func (*SingularityRuntime) UpdateContainerResources ¶
func (s *SingularityRuntime) UpdateContainerResources(ctx context.Context, req *k8s.UpdateContainerResourcesRequest) (*k8s.UpdateContainerResourcesResponse, error)
UpdateContainerResources updates ContainerConfig of the container.
func (*SingularityRuntime) UpdateRuntimeConfig ¶
func (s *SingularityRuntime) UpdateRuntimeConfig(ctx context.Context, req *k8s.UpdateRuntimeConfigRequest) (*k8s.UpdateRuntimeConfigResponse, error)
UpdateRuntimeConfig updates the runtime configuration based on the given request.
func (*SingularityRuntime) Version ¶
func (s *SingularityRuntime) Version(context.Context, *k8s.VersionRequest) (*k8s.VersionResponse, error)
Version returns the runtime name, runtime version and runtime API version.