Skip to content

Commit

Permalink
Add channels support to the Habitat type
Browse files Browse the repository at this point in the history
Habitat applications can exist in the different "channels" -
like "staging", "production", "unstable" etc. Those names
can be configured by the user.

Those channels will be expressed as labels in Kubernetes.

Fixes #126

Signed-off-by: Michal Rostecki <michal@kinvolk.io>
  • Loading branch information
Michal Rostecki committed Nov 15, 2017
1 parent b8d7cf6 commit 755b5d1
Show file tree
Hide file tree
Showing 5 changed files with 275 additions and 35 deletions.
30 changes: 30 additions & 0 deletions pkg/habitat/apis/cr/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ const (
HabitatNameLabel = "habitat-name"

TopologyLabel = "topology"

// HabitatChannelLabel contains the information about stability of application.
// Example: 'channel: production'
HabitatChannelLabel = "channel"

HabitatPromoteResourcePlural = "habitatpromotes"
)

type Habitat struct {
Expand All @@ -44,6 +50,9 @@ type HabitatSpec struct {
// Image is the Docker image of the Habitat Service.
Image string `json:"image"`
Service Service `json:"service"`
// Channel is the information about stability of the application, expressed as a label in Kubernetes.
// Optional.
Channel string `json:"channel,omitempty"`
}

type HabitatStatus struct {
Expand Down Expand Up @@ -94,6 +103,27 @@ const (
TopologyLeader Topology = "leader"
)

type HabitatPromote struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"`
Spec HabitatPromoteSpec `json:"spec"`
Status HabitatPromoteStatus `json:"status,omitempty"`
}

type HabitatPromoteSpec struct {
HabitatName string `json:"habitatName"`
OldChannel string `json:"oldChannel"`
NewChannel string `json:"newChannel"`
Replace bool `json:"replace"`
}

type HabitatPromoteStatus struct {
State HabitatPromoteState `json:"state,omitempty"`
Message string `json:"message,omitempty"`
}

type HabitatPromoteState string

type HabitatList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Expand Down
Loading

0 comments on commit 755b5d1

Please sign in to comment.