|
| 1 | +package libpod |
| 2 | + |
| 3 | +import ( |
| 4 | + "fmt" |
| 5 | + |
| 6 | + "github.com/containers/storage" |
| 7 | + "github.com/kubernetes-incubator/cri-o/libpod/ctr" |
| 8 | + "github.com/kubernetes-incubator/cri-o/libpod/pod" |
| 9 | +) |
| 10 | + |
| 11 | +var ( |
| 12 | + runtimeNotImplemented = func(rt *Runtime) error { |
| 13 | + return fmt.Errorf("NOT IMPLEMENTED") |
| 14 | + } |
| 15 | + ctrNotImplemented = func(c *ctr.Container) error { |
| 16 | + return fmt.Errorf("NOT IMPLEMENTED") |
| 17 | + } |
| 18 | +) |
| 19 | + |
| 20 | +const ( |
| 21 | + // IPCNamespace represents the IPC namespace |
| 22 | + IPCNamespace = "ipc" |
| 23 | + // MountNamespace represents the mount namespace |
| 24 | + MountNamespace = "mount" |
| 25 | + // NetNamespace represents the network namespace |
| 26 | + NetNamespace = "net" |
| 27 | + // PIDNamespace represents the PID namespace |
| 28 | + PIDNamespace = "pid" |
| 29 | + // UserNamespace represents the user namespace |
| 30 | + UserNamespace = "user" |
| 31 | + // UTSNamespace represents the UTS namespace |
| 32 | + UTSNamespace = "uts" |
| 33 | +) |
| 34 | + |
| 35 | +// Runtime Creation Options |
| 36 | + |
| 37 | +// WithStorageConfig uses the given configuration to set up container storage |
| 38 | +// If this is not specified, the system default configuration will be used |
| 39 | +// instead |
| 40 | +func WithStorageConfig(config *storage.StoreOptions) RuntimeOption { |
| 41 | + return runtimeNotImplemented |
| 42 | +} |
| 43 | + |
| 44 | +// WithImageConfig uses the given configuration to set up image handling |
| 45 | +// If this is not specified, the system default configuration will be used |
| 46 | +// instead |
| 47 | +func WithImageConfig(defaultTransport string, insecureRegistries, registries []string) RuntimeOption { |
| 48 | + return runtimeNotImplemented |
| 49 | +} |
| 50 | + |
| 51 | +// WithSignaturePolicy specifies the path of a file which decides how trust is |
| 52 | +// managed for images we've pulled. |
| 53 | +// If this is not specified, the system default configuration will be used |
| 54 | +// instead |
| 55 | +func WithSignaturePolicy(path string) RuntimeOption { |
| 56 | + return runtimeNotImplemented |
| 57 | +} |
| 58 | + |
| 59 | +// WithOCIRuntime specifies an OCI runtime to use for running containers |
| 60 | +func WithOCIRuntime(runtimePath string) RuntimeOption { |
| 61 | + return runtimeNotImplemented |
| 62 | +} |
| 63 | + |
| 64 | +// WithConmonPath specifies the path to the conmon binary which manages the |
| 65 | +// runtime |
| 66 | +func WithConmonPath(path string) RuntimeOption { |
| 67 | + return runtimeNotImplemented |
| 68 | +} |
| 69 | + |
| 70 | +// WithConmonEnv specifies the environment variable list for the conmon process |
| 71 | +func WithConmonEnv(environment []string) RuntimeOption { |
| 72 | + return runtimeNotImplemented |
| 73 | +} |
| 74 | + |
| 75 | +// WithCgroupManager specifies the manager implementation name which is used to |
| 76 | +// handle cgroups for containers |
| 77 | +func WithCgroupManager(manager string) RuntimeOption { |
| 78 | + return runtimeNotImplemented |
| 79 | +} |
| 80 | + |
| 81 | +// WithSELinux enables SELinux on the container server |
| 82 | +func WithSELinux() RuntimeOption { |
| 83 | + return runtimeNotImplemented |
| 84 | +} |
| 85 | + |
| 86 | +// WithApparmorProfile specifies the apparmor profile name which will be used as |
| 87 | +// the default for created containers |
| 88 | +func WithApparmorProfile(profile string) RuntimeOption { |
| 89 | + return runtimeNotImplemented |
| 90 | +} |
| 91 | + |
| 92 | +// WithSeccompProfile specifies the seccomp profile which will be used as the |
| 93 | +// default for created containers |
| 94 | +func WithSeccompProfile(profilePath string) RuntimeOption { |
| 95 | + return runtimeNotImplemented |
| 96 | +} |
| 97 | + |
| 98 | +// WithPidsLimit specifies the maximum number of processes each container is |
| 99 | +// restricted to |
| 100 | +func WithPidsLimit(limit int64) RuntimeOption { |
| 101 | + return runtimeNotImplemented |
| 102 | +} |
| 103 | + |
| 104 | +// Container Creation Options |
| 105 | + |
| 106 | +// WithRootFSFromPath uses the given path as a container's root filesystem |
| 107 | +// No further setup is performed on this path |
| 108 | +func WithRootFSFromPath(path string) CtrCreateOption { |
| 109 | + return ctrNotImplemented |
| 110 | +} |
| 111 | + |
| 112 | +// WithRootFSFromImage sets up a fresh root filesystem using the given image |
| 113 | +// If useImageConfig is specified, image volumes, environment variables, and |
| 114 | +// other configuration from the image will be added to the config |
| 115 | +func WithRootFSFromImage(image string, useImageConfig bool) CtrCreateOption { |
| 116 | + return ctrNotImplemented |
| 117 | +} |
| 118 | + |
| 119 | +// WithSharedNamespaces sets a container to share namespaces with another |
| 120 | +// container. If the from container belongs to a pod, the new container will |
| 121 | +// be added to the pod. |
| 122 | +// By default no namespaces are shared. To share a namespace, add the Namespace |
| 123 | +// string constant to the map as a key |
| 124 | +func WithSharedNamespaces(from *ctr.Container, namespaces map[string]string) CtrCreateOption { |
| 125 | + return ctrNotImplemented |
| 126 | +} |
| 127 | + |
| 128 | +// WithPod adds the container to a pod |
| 129 | +func WithPod(pod *pod.Pod) CtrCreateOption { |
| 130 | + return ctrNotImplemented |
| 131 | +} |
| 132 | + |
| 133 | +// WithLabels adds labels to the pod |
| 134 | +func WithLabels(labels map[string]string) CtrCreateOption { |
| 135 | + return ctrNotImplemented |
| 136 | +} |
| 137 | + |
| 138 | +// WithAnnotations adds annotations to the pod |
| 139 | +func WithAnnotations(annotations map[string]string) CtrCreateOption { |
| 140 | + return ctrNotImplemented |
| 141 | +} |
| 142 | + |
| 143 | +// WithName sets the container's name |
| 144 | +func WithName(name string) CtrCreateOption { |
| 145 | + return ctrNotImplemented |
| 146 | +} |
| 147 | + |
| 148 | +// WithStopSignal sets the signal that will be sent to stop the container |
| 149 | +func WithStopSignal(signal uint) CtrCreateOption { |
| 150 | + return ctrNotImplemented |
| 151 | +} |
0 commit comments