diff --git a/CHANGELOG.md b/CHANGELOG.md index 50a2e38f6..a0a0a8be5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Add runtime TLS rotation for ArangoDB EE 3.7+ - Add Kustomize support - Improve Helm 3 support +- Allow to customize ID Pod selectors ## [1.0.3](https://github.com/arangodb/kube-arangodb/tree/1.0.3) (2020-05-25) - Prevent deletion of not known PVC's diff --git a/pkg/deployment/reconcile/plan_builder.go b/pkg/deployment/reconcile/plan_builder.go index 94ec722c0..63d97187a 100644 --- a/pkg/deployment/reconcile/plan_builder.go +++ b/pkg/deployment/reconcile/plan_builder.go @@ -73,7 +73,15 @@ func (d *Reconciler) CreatePlan(ctx context.Context, cachedStatus inspector.Insp // Nothing to do return nil, false } + + // Send events + for id := len(status.Plan); id < len(newPlan); id++ { + action := newPlan[id] + d.context.CreateEvent(k8sutil.NewPlanAppendEvent(apiObject, action.Type.String(), action.Group.AsRole(), action.MemberID, action.Reason)) + } + status.Plan = newPlan + if err := d.context.UpdateStatus(status, lastVersion); err != nil { return maskAny(err), false } diff --git a/pkg/util/k8sutil/events.go b/pkg/util/k8sutil/events.go index 24e0dd48d..fb6ed05a6 100644 --- a/pkg/util/k8sutil/events.go +++ b/pkg/util/k8sutil/events.go @@ -153,6 +153,23 @@ func NewAccessPackageDeletedEvent(apiObject APIObject, apSecretName string) *Eve return event } +// NewPlanTimeoutEvent creates an event indicating that an item on a reconciliation plan has been added +func NewPlanAppendEvent(apiObject APIObject, itemType, memberID, role, reason string) *Event { + event := newDeploymentEvent(apiObject) + event.Type = v1.EventTypeNormal + event.Reason = "Plan Action added" + msg := fmt.Sprintf("An plan item of type %s", itemType) + if role != "" { + msg = fmt.Sprintf("%s for member %s with role %s", msg, memberID, role) + } + msg = fmt.Sprintf("%s has beed added", msg) + if reason != "" { + msg = fmt.Sprintf("%s with reason: %s", msg, reason) + } + event.Message = msg + return event +} + // NewPlanTimeoutEvent creates an event indicating that an item on a reconciliation plan did not // finish before its deadline. func NewPlanTimeoutEvent(apiObject APIObject, itemType, memberID, role string) *Event {