container.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package scheme
  2. const CONTAINER_KIND_ONESHOT = "oneshot"
  3. const CONTAINER_KIND_CONTINIOUS = "continious"
  4. type Image struct {
  5. Tag string `json:"tag" yaml:"tag"`
  6. Version string `json:"version" yaml:"version"`
  7. Pull bool `json:"pull" yaml:"pull"`
  8. }
  9. type Variable struct {
  10. Key string `json:"key" yaml:"key"`
  11. Value string `json:"value" yaml:"value"`
  12. }
  13. type Network struct {
  14. Name string `json:"name" yaml:"name"`
  15. CIDR string `json:"cidr" yaml:"cidr"`
  16. Gateway string `json:"gateway" yaml:"gateway"`
  17. }
  18. type ContainerPermissions struct {
  19. Privileged bool `json:"privileged" yaml:"privileged"`
  20. Capabilities []string `json:"capabilities" yaml:"capabilities"`
  21. }
  22. type ContainerNetwork struct {
  23. IP string `json:"ip" yaml:"ip"`
  24. }
  25. type ContainerResources struct {
  26. CPU int64 `json:"cpu" yaml:"cpu"`
  27. Memory int64 `json:"memory" yaml:"memory"`
  28. // TODO: disk iops, network iops
  29. }
  30. type Container struct {
  31. ID string `json:"id" yaml:"id"`
  32. Image Image `json:"image" yaml:"image"`
  33. Command string `json:"command" yaml:"command"`
  34. Variables []Variable `json:"environment" yaml:"environment"`
  35. Binds []string `json:"binds" yaml:"binds"`
  36. Permissions ContainerPermissions `json:"permissions" yaml:"permissions"`
  37. Network ContainerNetwork `json:"network" yaml:"network"`
  38. Resources ContainerResources `json:"resources" yaml:"resources"`
  39. Kind string `json:"kind" yaml:"kind"`
  40. KindOneshot ContainerOneshot `json:"kind_oneshot" yaml:"kind_oneshot"`
  41. KindContinious ContainerContinious `json:"kind_continious" yaml:"kind_continious"`
  42. }