diff --git a/pkg/deployment/bootstrap.go b/pkg/deployment/bootstrap.go index 22fe2c46b..a83eeb979 100644 --- a/pkg/deployment/bootstrap.go +++ b/pkg/deployment/bootstrap.go @@ -46,6 +46,10 @@ func (d *Deployment) EnsureBootstrap() error { status, version := d.GetStatus() if status.Conditions.IsTrue(api.ConditionTypeReady) { + if _, hasBootstrap := status.Conditions.Get(api.ConditionTypeBoostrapCompleted); !hasBootstrap { + return nil // The cluster was not initialised with ConditionTypeBoostrapCompleted == false + } + if status.Conditions.IsTrue(api.ConditionTypeBoostrapCompleted) { return nil // Nothing to do, already bootstrapped } @@ -68,6 +72,7 @@ func (d *Deployment) EnsureBootstrap() error { return nil } +// ensureRootUserPassword ensures the root user secret and returns the password specified or generated func (d *Deployment) ensureRootUserPassword() (string, error) { spec := d.GetSpec() @@ -98,6 +103,7 @@ func (d *Deployment) ensureRootUserPassword() (string, error) { } } +// runBootstrap is run for a deployment once func (d *Deployment) runBootstrap() error { // execute the boostrap code @@ -118,10 +124,9 @@ func (d *Deployment) runBootstrap() error { return maskAny(err) } - err = root.Update(nil, driver.UserOptions{ + if err = root.Update(nil, driver.UserOptions{ Password: password, - }) - if err != nil { + }); err != nil { return maskAny(err) } diff --git a/pkg/deployment/resources/pod_inspector.go b/pkg/deployment/resources/pod_inspector.go index 44ef74f0b..eb7c834d5 100644 --- a/pkg/deployment/resources/pod_inspector.go +++ b/pkg/deployment/resources/pod_inspector.go @@ -233,6 +233,10 @@ func (r *Resources) InspectPods(ctx context.Context) (util.Interval, error) { }) // Update overall conditions + if _, hasReady := status.Conditions.Get(api.ConditionTypeReady); !hasReady { + // Ready was never set, set BootstrapComplete to false + status.Conditions.Update(api.ConditionTypeBoostrapCompleted, false, "Bootstrap waiting", "Waiting for deployment") + } spec := r.context.GetSpec() allMembersReady := status.Members.AllMembersReady(spec.GetMode(), spec.Sync.IsEnabled()) status.Conditions.Update(api.ConditionTypeReady, allMembersReady, "", "")