Skip to content

Commit

Permalink
Merge pull request #66 from arangodb/fix-immutable-mode
Browse files Browse the repository at this point in the history
Fixed immitable `mode` field.
  • Loading branch information
ewoutp authored Mar 22, 2018
2 parents 5f52f0d + f49f621 commit 5c43746
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pkg/operator/operator_deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,19 +147,19 @@ func (o *Operator) handleDeploymentEvent(event *Event) error {
return maskAny(fmt.Errorf("ignore failed deployment (%s). Please delete its CR", apiObject.Name))
}

// Fill in defaults
apiObject.Spec.SetDefaults(apiObject.GetName())
// Validate deployment spec
if err := apiObject.Spec.Validate(); err != nil {
return maskAny(errors.Wrapf(err, "invalid deployment spec. please fix the following problem with the deployment spec: %v", err))
}

switch event.Type {
case kwatch.Added:
if _, ok := o.deployments[apiObject.Name]; ok {
return maskAny(fmt.Errorf("unsafe state. deployment (%s) was created before but we received event (%s)", apiObject.Name, event.Type))
}

// Fill in defaults
apiObject.Spec.SetDefaults(apiObject.GetName())
// Validate deployment spec
if err := apiObject.Spec.Validate(); err != nil {
return maskAny(errors.Wrapf(err, "invalid deployment spec. please fix the following problem with the deployment spec: %v", err))
}

cfg, deps := o.makeDeploymentConfigAndDeps(apiObject)
nc, err := deployment.New(cfg, deps, apiObject)
if err != nil {
Expand Down

0 comments on commit 5c43746

Please sign in to comment.