Skip to content
Merged
Show file tree
Hide file tree
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
10 changes: 10 additions & 0 deletions pkg/apis/deployment/v1alpha/deployment_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

package v1alpha

import "github.com/arangodb/kube-arangodb/pkg/util"

// DeploymentStatus contains the status part of a Cluster resource.
type DeploymentStatus struct {
// Phase holds the current lifetime phase of the deployment
Expand Down Expand Up @@ -56,6 +58,9 @@ type DeploymentStatus struct {
// SecretHashes keeps a sha256 hash of secret values, so we can
// detect changes in secret values.
SecretHashes *SecretHashes `json:"secret-hashes,omitempty"`

// ForceStatusReload if set to true forces a reload of the status from the custom resource.
ForceStatusReload *bool `json:"force-status-reload,omitempty"`
}

// Equal checks for equality
Expand All @@ -72,3 +77,8 @@ func (ds *DeploymentStatus) Equal(other DeploymentStatus) bool {
ds.AcceptedSpec.Equal(other.AcceptedSpec) &&
ds.SecretHashes.Equal(other.SecretHashes)
}

// IsForceReload returns true if ForceStatusReload is set to true
func (ds *DeploymentStatus) IsForceReload() bool {
return util.BoolOrDefault(ds.ForceStatusReload, false)
}
5 changes: 5 additions & 0 deletions pkg/apis/deployment/v1alpha/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion pkg/deployment/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ func (d *Deployment) handleArangoDeploymentUpdatedEvent() error {
newAPIObject := current.DeepCopy()
newAPIObject.Spec.SetDefaultsFrom(specBefore)
newAPIObject.Spec.SetDefaults(d.apiObject.GetName())
newAPIObject.Status = status

resetFields := specBefore.ResetImmutableFields(&newAPIObject.Spec)
if len(resetFields) > 0 {
log.Debug().Strs("fields", resetFields).Msg("Found modified immutable fields")
Expand Down Expand Up @@ -318,6 +318,11 @@ func (d *Deployment) handleArangoDeploymentUpdatedEvent() error {
// Save updated accepted spec
{
status, lastVersion := d.GetStatus()
if newAPIObject.Status.IsForceReload() {
log.Warn().Msg("Forced status reload!")
status = newAPIObject.Status
status.ForceStatusReload = nil
}
status.AcceptedSpec = newAPIObject.Spec.DeepCopy()
if err := d.UpdateStatus(status, lastVersion); err != nil {
return maskAny(fmt.Errorf("failed to update ArangoDeployment status: %v", err))
Expand Down
2 changes: 2 additions & 0 deletions pkg/deployment/reconcile/action_remove_member.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ func (a *actionRemoveMember) Start(ctx context.Context) (bool, error) {
if err := arangod.RemoveServerFromCluster(ctx, client.Connection(), driver.ServerID(m.ID)); err != nil {
if !driver.IsNotFound(err) && !driver.IsPreconditionFailed(err) {
return false, maskAny(errors.Wrapf(err, "Failed to remove server from cluster: %#v", err))
} else {
a.log.Warn().Msgf("ignoring error: %s", err.Error())
}
}
}
Expand Down