Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Commit

Permalink
Merge pull request #118 from containscafeine/refactor_podSpecMod
Browse files Browse the repository at this point in the history
Refactor modified PodSpec to PodSpecMod
  • Loading branch information
surajssd authored Jul 6, 2017
2 parents 576e4ce + e1a4ff3 commit f9d575b
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 36 deletions.
10 changes: 6 additions & 4 deletions pkg/encoding/fixtures/multiple_ports_no_names_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ import (

var MultiplePortsNoNamesApp spec.App = spec.App{
Name: "test",
Containers: []spec.Container{
{
Container: api_v1.Container{
Image: "nginx",
PodSpecMod: spec.PodSpecMod{
Containers: []spec.Container{
{
Container: api_v1.Container{
Image: "nginx",
},
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ import (

var MultiplePortsWithAndWithoutNamesApp spec.App = spec.App{
Name: "test",
Containers: []spec.Container{
{
Container: api_v1.Container{
Image: "nginx",
PodSpecMod: spec.PodSpecMod{
Containers: []spec.Container{
{
Container: api_v1.Container{
Image: "nginx",
},
},
},
},
Expand Down
10 changes: 6 additions & 4 deletions pkg/encoding/fixtures/multiple_ports_with_names_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ import (

var MultiplePortsWithNamesApp spec.App = spec.App{
Name: "test",
Containers: []spec.Container{
{
Container: api_v1.Container{
Image: "nginx",
PodSpecMod: spec.PodSpecMod{
Containers: []spec.Container{
{
Container: api_v1.Container{
Image: "nginx",
},
},
},
},
Expand Down
10 changes: 6 additions & 4 deletions pkg/encoding/fixtures/single_container_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ import (

var SingleContainerApp spec.App = spec.App{
Name: "test",
Containers: []spec.Container{
{
Container: api_v1.Container{
Image: "nginx",
PodSpecMod: spec.PodSpecMod{
Containers: []spec.Container{
{
Container: api_v1.Container{
Image: "nginx",
},
},
},
},
Expand Down
10 changes: 6 additions & 4 deletions pkg/encoding/fixtures/single_persistent_volume_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ import (

var SinglePersistentVolumeApp spec.App = spec.App{
Name: "test",
Containers: []spec.Container{
{
Container: api_v1.Container{
Image: "nginx",
PodSpecMod: spec.PodSpecMod{
Containers: []spec.Container{
{
Container: api_v1.Container{
Image: "nginx",
},
},
},
},
Expand Down
10 changes: 6 additions & 4 deletions pkg/encoding/fixtures/single_port_without_name_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ import (

var SinglePortWithoutNameApp spec.App = spec.App{
Name: "test",
Containers: []spec.Container{
{
Container: api_v1.Container{
Image: "nginx",
PodSpecMod: spec.PodSpecMod{
Containers: []spec.Container{
{
Container: api_v1.Container{
Image: "nginx",
},
},
},
},
Expand Down
25 changes: 13 additions & 12 deletions pkg/spec/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,19 @@ type ConfigMapMod struct {
Data map[string]string `json:"data,omitempty"`
}

type PodSpecMod struct {
Containers []Container `json:"containers,omitempty"`
api_v1.PodSpec `json:",inline"`
}

type App struct {
Name string `json:"name"`
Replicas *int32 `json:"replicas,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
PersistentVolumes []PersistentVolume `json:"persistentVolumes,omitempty"`
ConfigMaps []ConfigMapMod `json:"configMaps,omitempty"`
Services []ServiceSpecMod `json:"services,omitempty"`
Ingresses []IngressSpecMod `json:"ingresses,omitempty"`

// overwrite containers from PodSpec
Containers []Container `json:"containers,omitempty"`

api_v1.PodSpec `json:",inline"`
Name string `json:"name"`
Replicas *int32 `json:"replicas,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
PersistentVolumes []PersistentVolume `json:"persistentVolumes,omitempty"`
ConfigMaps []ConfigMapMod `json:"configMaps,omitempty"`
Services []ServiceSpecMod `json:"services,omitempty"`
Ingresses []IngressSpecMod `json:"ingresses,omitempty"`
PodSpecMod `json:",inline"`
ext_v1beta1.DeploymentSpec `json:",inline"`
}

0 comments on commit f9d575b

Please sign in to comment.