Skip to content

Conversation

@chatton
Copy link
Contributor

@chatton chatton commented Mar 25, 2020

All Submissions:

  • Have you opened an Issue before filing this PR?
  • Have you signed our CLA?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Put closes #XXXX in your comment to auto-close the issue that your PR fixes (if such).

Tested changing version manually

NAME                                           READY   STATUS             RESTARTS   AGE
example-mongodb-0                              1/2     CrashLoopBackOff   4          6m23s
...
mongodb-kubernetes-operator-7574d6b7b6-4mm8t   1/1     Running            0          6m43s

And when the pod is deleted manually, it restarts and reaches goal state, correctly joining the replica set

@chatton chatton added the wip label Mar 25, 2020
Comment on lines +315 to +320
func getUpdateStrategyType(mdb mdbv1.MongoDB) appsv1.StatefulSetUpdateStrategyType {
if !mdb.ChangingVersion() {
return appsv1.RollingUpdateStatefulSetStrategyType
}
return appsv1.OnDeleteStatefulSetStrategyType
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chatton chatton changed the base branch from CLOUDP-59033_mongo_uri_in_status to master March 27, 2020 12:09
@chatton chatton requested a review from rodrigovalin March 27, 2020 15:19
@chatton chatton removed the wip label Mar 27, 2020
Copy link
Contributor

@rodrigovalin rodrigovalin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The status structure should be used to indicate status to a client (a person most of the time), but not for us to keep our temporary values between reconciliation.

What about "last-saved-configuration" to maintain what was "before" the current changes?

func (m *MongoDB) UpdateSuccess() {
m.Status.MongoURI = m.MongoURI()
m.Status.Phase = Running
m.Status.Version = m.Spec.Version
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should not add the version to the status, given that it is already on the spec.

if !statefulset.IsReady(set) {
log.Infof("Stateful Set has not yet reached the ready state, requeuing reconciliation")
return reconcile.Result{RequeueAfter: time.Second * 10}, nil
return fmt.Errorf("stateful Set has not yet reached the ready state, requeuing reconciliation"), time.Second * 10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should log as info instead, this is not an "errorneous" situation.

Copy link
Contributor

@rodrigovalin rodrigovalin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

This is looking really promising!

@chatton chatton merged commit 8a49e24 into master Mar 31, 2020
@chatton chatton deleted the CLOUDP-59612_configure_statefulset_upgrade_policy branch March 31, 2020 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants