diff --git a/actor/v7pushaction/create_deployment_for_push_plan.go b/actor/v7pushaction/create_deployment_for_push_plan.go index 9b369a56af0..b3f5ea2b01b 100644 --- a/actor/v7pushaction/create_deployment_for_push_plan.go +++ b/actor/v7pushaction/create_deployment_for_push_plan.go @@ -19,7 +19,7 @@ func (actor Actor) CreateDeploymentForApplication(pushPlan PushPlan, eventStream } if len(pushPlan.InstanceSteps) > 0 { - dep.Options.CanaryDeploymentOptions = resources.CanaryDeploymentOptions{Steps: []resources.CanaryStep{}} + dep.Options.CanaryDeploymentOptions = &resources.CanaryDeploymentOptions{Steps: []resources.CanaryStep{}} for _, w := range pushPlan.InstanceSteps { dep.Options.CanaryDeploymentOptions.Steps = append(dep.Options.CanaryDeploymentOptions.Steps, resources.CanaryStep{InstanceWeight: w}) } diff --git a/actor/v7pushaction/create_deployment_for_push_plan_test.go b/actor/v7pushaction/create_deployment_for_push_plan_test.go index 967cc36543c..1be4bc16976 100644 --- a/actor/v7pushaction/create_deployment_for_push_plan_test.go +++ b/actor/v7pushaction/create_deployment_for_push_plan_test.go @@ -175,7 +175,7 @@ var _ = Describe("CreateDeploymentForApplication()", func() { Expect(dep).To(Equal(resources.Deployment{ Strategy: "canary", Options: resources.DeploymentOpts{ - CanaryDeploymentOptions: resources.CanaryDeploymentOptions{ + CanaryDeploymentOptions: &resources.CanaryDeploymentOptions{ Steps: []resources.CanaryStep{ {InstanceWeight: 1}, {InstanceWeight: 2}, diff --git a/api/cloudcontroller/ccv3/deployment_test.go b/api/cloudcontroller/ccv3/deployment_test.go index 87b37f8c7cc..f0a1dbcf184 100644 --- a/api/cloudcontroller/ccv3/deployment_test.go +++ b/api/cloudcontroller/ccv3/deployment_test.go @@ -251,7 +251,7 @@ var _ = Describe("Deployment", func() { dep.Strategy = constant.DeploymentStrategyCanary dep.RevisionGUID = revisionGUID dep.Relationships = resources.Relationships{constant.RelationshipTypeApplication: resources.Relationship{GUID: "some-app-guid"}} - dep.Options.CanaryDeploymentOptions = resources.CanaryDeploymentOptions{Steps: []resources.CanaryStep{{InstanceWeight: 1}, {InstanceWeight: 2}}} + dep.Options.CanaryDeploymentOptions = &resources.CanaryDeploymentOptions{Steps: []resources.CanaryStep{{InstanceWeight: 1}, {InstanceWeight: 2}}} deploymentGUID, warnings, executeErr = client.CreateApplicationDeployment(dep) }) diff --git a/resources/deployment_resource.go b/resources/deployment_resource.go index 60dbdf4b9f1..81fa6fe9c74 100644 --- a/resources/deployment_resource.go +++ b/resources/deployment_resource.go @@ -24,12 +24,12 @@ type Deployment struct { } type DeploymentOpts struct { - MaxInFlight int `json:"max_in_flight,omitempty"` - CanaryDeploymentOptions CanaryDeploymentOptions `json:"canary,omitempty"` + MaxInFlight int `json:"max_in_flight,omitempty"` + CanaryDeploymentOptions *CanaryDeploymentOptions `json:"canary,omitempty"` } func (d DeploymentOpts) IsEmpty() bool { - return d.MaxInFlight == 0 && len(d.CanaryDeploymentOptions.Steps) == 0 + return d.MaxInFlight == 0 && (d.CanaryDeploymentOptions == nil || len(d.CanaryDeploymentOptions.Steps) == 0) } type CanaryDeploymentOptions struct {