mirror of
https://github.com/arangodb/kube-arangodb.git
synced 2024-12-14 11:57:37 +00:00
Only bootstrap new deployments.
This commit is contained in:
parent
a699c1a216
commit
db386d9c69
2 changed files with 12 additions and 3 deletions
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
@ -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, "", "")
|
||||
|
|
Loading…
Reference in a new issue