Skip to content

Commit

Permalink
add channel to supervisor
Browse files Browse the repository at this point in the history
Signed-off-by: Elliott Davis <elliott@excellent.io>
  • Loading branch information
Elliott Davis committed Apr 25, 2018
1 parent 592cffa commit 1d508b2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/apis/habitat/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ type Service struct {
// Name is the name of the Habitat service that this Habitat object represents.
// This field is used to mount the user.toml file in the correct directory under /hab/user/ in the Pod.
Name string `json:"name"`
// Channel is the value of the --channel flag for the hab client.
// Optional. Defaults to `stable`.
Channel string `json:"channel"`
}

type ServiceV1beta2 struct {
Expand All @@ -140,6 +143,9 @@ type ServiceV1beta2 struct {
// Name is the name of the Habitat service that this Habitat object represents.
// This field is used to mount the user.toml file in the correct directory under /hab/user/ in the Pod.
Name string `json:"name"`
// Channel is the value of the --channel flag for the hab client.
// Optional. Defaults to `stable`.
Channel *string `json:"channel,omitempty"`
}

type Bind struct {
Expand Down
7 changes: 7 additions & 0 deletions pkg/controller/v1beta1/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,13 @@ func (hc *HabitatController) newDeployment(h *habv1beta1.Habitat) (*appsv1beta1.
"--group", h.Spec.Service.Group)
}

if h.Spec.Service.Channel != "" {
// When a service is started without explicitly naming the group,
// it's assigned to the default group.
habArgs = append(habArgs,
"--channel", h.Spec.Service.Channel)
}

// As we want to label our pods with the
// topology type we set standalone as the default one.
// We do not need to pass this to habitat, as if no topology
Expand Down
7 changes: 7 additions & 0 deletions pkg/controller/v1beta2/stateful_sets.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ func (hc *HabitatController) newStatefulSet(h *habv1beta1.Habitat) (*appsv1beta1
"--group", *hs.Service.Group)
}

if hs.Service.Channel != nil {
// When a service is started without explicitly naming the channel,
// it's assigned to the stable channel.
habArgs = append(habArgs,
"--channel", *hs.Service.Channel)
}

// As we want to label our pods with the
// topology type we set standalone as the default one.
// We do not need to pass this to habitat, as if no topology
Expand Down

0 comments on commit 1d508b2

Please sign in to comment.