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

Scaling deployments #13

Merged
merged 16 commits into from
Feb 26, 2018
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Always start fom current api object instead of one found in event
  • Loading branch information
ewoutp committed Feb 23, 2018
commit 06b64c93de2bdfd514f7c95fbdd057543614841d
12 changes: 11 additions & 1 deletion pkg/deployment/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,17 @@ func (d *Deployment) run() {
func (d *Deployment) handleArangoDeploymentUpdatedEvent(event *deploymentEvent) error {
log := d.deps.Log.With().Str("deployment", event.Deployment.GetName()).Logger()

newAPIObject := event.Deployment.DeepCopy()
// Get the most recent version of the deployment from the API server
current, err := d.deps.DatabaseCRCli.DatabaseV1alpha().ArangoDeployments(d.apiObject.GetNamespace()).Get(d.apiObject.GetName(), metav1.GetOptions{})
if err != nil {
log.Debug().Err(err).Msg("Failed to get current version of deployment from API server")
if k8sutil.IsNotFound(err) {
return nil
}
return maskAny(err)
}

newAPIObject := current.DeepCopy()
newAPIObject.Spec.SetDefaults()
newAPIObject.Status = d.status
resetFields := d.apiObject.Spec.ResetImmutableFields(&newAPIObject.Spec)
Expand Down