Skip to content

Commit

Permalink
Merge pull request #7 from namely/move-lb-declarations
Browse files Browse the repository at this point in the history
Define load balancers on the group yaml level
  • Loading branch information
shraykay authored Feb 1, 2018
2 parents fd335f7 + 9631131 commit a447dbb
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 20 deletions.
2 changes: 1 addition & 1 deletion cmd/k8s-pipeliner/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

const (
// Version defines the current version of k8s-pipeliner
Version = "0.0.5"
Version = "0.0.6"
)

func main() {
Expand Down
9 changes: 1 addition & 8 deletions pipeline/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"encoding/json"
"errors"
"fmt"
"strings"

"github.com/namely/k8s-pipeliner/pipeline/builder/types"
"github.com/namely/k8s-pipeliner/pipeline/config"
Expand Down Expand Up @@ -157,17 +156,11 @@ func (b *Builder) buildDeployStage(index int, s config.Stage) (*types.DeployStag
}
}

// grab the load balancers for the deployment
var lbs []string
if l, ok := mg.Annotations[SpinnakerLoadBalancersAnnotations]; ok {
lbs = strings.Split(l, ",")
}

cluster := types.Cluster{
Account: s.Account,
Application: b.pipeline.Application,
Containers: mg.Containers,
LoadBalancers: lbs,
LoadBalancers: group.LoadBalancers,
Region: mg.Namespace,
Namespace: mg.Namespace,
MaxRemainingAsgs: group.MaxRemainingASGS,
Expand Down
5 changes: 0 additions & 5 deletions pipeline/builder/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ const (
// SpinnakerImageDescriptionOrganizationAnnotation is the registry org that owns the image.
// Example: "namely" (where registry.namely.land/namely <- is the org)
SpinnakerImageDescriptionOrganizationAnnotation = "namely.com/spinnaker-image-description-organization"

// SpinnakerLoadBalancersAnnotations is a comma separated list of load balancers
// defined in Spinnaker that should be attached to a cluster
// Example: "catalog,catalog-public"
SpinnakerLoadBalancersAnnotations = "namely.com/spinnaker-load-balancers"
)

// ManifestGroup keeps a collection of containers from a deployment
Expand Down
13 changes: 7 additions & 6 deletions pipeline/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,13 @@ type DeployStage struct {
// of a group is filled out by the defined manifest file. This means things like commands, env vars,
// etc, are all pulled into the group spec for you.
type Group struct {
ManifestFile string `yaml:"manifestFile"`
MaxRemainingASGS int `yaml:"maxRemainingASGS"`
ScaleDown bool `yaml:"scaleDown"`
Stack string `yaml:"stack"`
Strategy string `yaml:"strategy"`
TargetSize int `yaml:"targetSize"`
ManifestFile string `yaml:"manifestFile"`
MaxRemainingASGS int `yaml:"maxRemainingASGS"`
ScaleDown bool `yaml:"scaleDown"`
Stack string `yaml:"stack"`
Strategy string `yaml:"strategy"`
TargetSize int `yaml:"targetSize"`
LoadBalancers []string `yaml:"loadBalancers"`

// If overrides are provided, the group will run a check to make sure
// the given manifest only defines one container. If it does, the given
Expand Down
2 changes: 2 additions & 0 deletions test-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ stages:
strategy: redblack
targetSize: 2 # this is the total amount of replicas for the deployment
containerOverrides: {}
loadBalancers:
- "test"
- account: int-k8s
name: "Proceed to Staging?"
refId: "3"
Expand Down

0 comments on commit a447dbb

Please sign in to comment.