Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed immitable mode field. #66

Merged
merged 1 commit into from
Mar 22, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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