-
Notifications
You must be signed in to change notification settings - Fork 31
/
group.go
32 lines (28 loc) · 986 Bytes
/
group.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 Storage struct {
Name string `json:"name" protobuf:"bytes,1,opt,name=name"` // volume name
SubPath string `json:"subPath,omitempty" protobuf:"bytes,2,opt,name=subPath"`
}
type Group struct {
Key string `json:"key" protobuf:"bytes,1,opt,name=key"`
EndOfGroup string `json:"endOfGroup" protobuf:"bytes,2,opt,name=endOfGroup"`
Format GroupFormat `json:"format,omitempty" protobuf:"bytes,3,opt,name=format,casttype=GroupFormat"`
Storage *Storage `json:"storage,omitempty" protobuf:"bytes,4,opt,name=storage"`
}
func (g *Group) getContainer(req getContainerReq) corev1.Container {
builder := containerBuilder{}.
init(req).
args("group", g.Key, g.EndOfGroup, string(g.Format))
if g.Storage != nil {
builder = builder.appendVolumeMounts(corev1.VolumeMount{
Name: g.Storage.Name,
MountPath: PathGroups,
SubPath: g.Storage.SubPath,
})
}
return builder.
build()
}