Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Commit

Permalink
Added labels support. (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Santamaria authored Aug 16, 2019
1 parent bdcc120 commit 96d9022
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
21 changes: 11 additions & 10 deletions compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@ type DockerCompose struct {

// Service a service declared in a Docker Compose file.
type Service struct {
Image string `yaml:"image"`
Build string `yaml:"build"`
Volumes []string `yaml:"volumes"`
Entrypoint []string `yaml:"entrypoint"`
Ports []string `yaml:"ports"`
Environment []string `yaml:"environment"`
CapAdd []string `yaml:"cap_add"`
Tmpfs []string `yaml:"tmpfs"`
Deploy ServiceDeploy `yaml:"deploy"`
ExtraHosts []string `yaml:"extra_hosts"`
Image string `yaml:"image"`
Build string `yaml:"build"`
Volumes []string `yaml:"volumes"`
Entrypoint []string `yaml:"entrypoint"`
Ports []string `yaml:"ports"`
Environment []string `yaml:"environment"`
CapAdd []string `yaml:"cap_add"`
Tmpfs []string `yaml:"tmpfs"`
Deploy ServiceDeploy `yaml:"deploy"`
ExtraHosts []string `yaml:"extra_hosts"`
Labels map[string]string `yaml:"labels"`
}

// ServiceDeploy provides deployment information for a service.
Expand Down
1 change: 1 addition & 0 deletions compose_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ func TestLoad(t *testing.T) {
assert.Equal(t, compose.Services["a"].Deploy.Resources.Limits.CPUs, "500m")
assert.Equal(t, compose.Services["a"].Deploy.Resources.Limits.Memory, "2048Mi")
assert.Equal(t, compose.Services["a"].ExtraHosts, []string{"some.hostname:1.2.3.4"})
assert.Equal(t, compose.Services["a"].Labels, map[string]string{ "m8s.io/skip": "true"})
}
4 changes: 3 additions & 1 deletion test-data/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ services:
cpus: '500m'
memory: '2048Mi'
extra_hosts:
- "some.hostname:1.2.3.4"
- "some.hostname:1.2.3.4"
labels:
"m8s.io/skip": "true"

0 comments on commit 96d9022

Please sign in to comment.