-
Notifications
You must be signed in to change notification settings - Fork 31
/
container.go
32 lines (28 loc) · 1.12 KB
/
container.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package v1alpha1
import corev1 "k8s.io/api/core/v1"
type Container struct {
Image string `json:"image" protobuf:"bytes,1,opt,name=image"`
VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty" protobuf:"bytes,5,rep,name=volumeMounts"`
In *Interface `json:"in,omitempty" protobuf:"bytes,3,opt,name=in"`
Command []string `json:"command,omitempty" protobuf:"bytes,6,rep,name=command"`
Args []string `json:"args,omitempty" protobuf:"bytes,7,rep,name=args"`
Env []corev1.EnvVar `json:"env,omitempty" protobuf:"bytes,8,rep,name=env"`
}
func (in *Container) getContainer(req getContainerReq) corev1.Container {
return corev1.Container{
Name: CtrMain,
Image: in.Image,
ImagePullPolicy: req.imagePullPolicy,
Command: in.Command,
Args: in.Args,
Env: in.Env,
VolumeMounts: append(in.VolumeMounts, req.volumeMount),
Resources: SmallResourceRequirements,
}
}
func (in *Container) GetIn() *Interface {
if in.In != nil {
return in.In
}
return DefaultInterface
}