Skip to content

Commit

Permalink
Merge pull request #259 from habitat-sh/elliott/channels
Browse files Browse the repository at this point in the history
add channel to supervisor
  • Loading branch information
krnowak committed May 2, 2018
2 parents d6ec488 + d682a5b commit b6e28f3
Show file tree
Hide file tree
Showing 3 changed files with 22 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 @@ -140,6 +140,12 @@ 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.
// It can be used to track upstream packages in builder channels but will never be used directly by the supervisor.
// The should only be used in conjunction with the habitat updater https://github.com/habitat-sh/habitat-updater
// Defaults to `stable`.
// +optional
Channel *string `json:"channel,omitempty"`
}

type Bind struct {
Expand Down
9 changes: 9 additions & 0 deletions pkg/apis/habitat/v1beta1/zz_generated.deepcopy.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,15 @@ func (in *ServiceV1beta2) DeepCopyInto(out *ServiceV1beta2) {
*out = make([]Bind, len(*in))
copy(*out, *in)
}
if in.Channel != nil {
in, out := &in.Channel, &out.Channel
if *in == nil {
*out = nil
} else {
*out = new(string)
**out = **in
}
}
return
}

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 b6e28f3

Please sign in to comment.