Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log resourceVersion on Create and Update #8503

Merged
Merged
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
7 changes: 4 additions & 3 deletions pkg/controller/common/reconciler/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ type Params struct {
PostUpdate func()
}

const resourceVersion = "resourceVersion"

func (p Params) CheckNilValues() error {
if p.Reconciled == nil {
return errors.New("Reconciled must not be nil")
Expand Down Expand Up @@ -88,7 +90,6 @@ func ReconcileResource(params Params) error {
namespace := params.Expected.GetNamespace()
name := params.Expected.GetName()
log := ulog.FromContext(params.Context).WithValues("kind", kind, "namespace", namespace, "name", name)

create := func() error {
log.Info("Creating resource")
if params.PreCreate != nil {
Expand All @@ -108,7 +109,7 @@ func ReconcileResource(params Params) error {
if err != nil {
return err
}
log.Info("Created resource successfully")
log.Info("Created resource successfully", resourceVersion, params.Reconciled.GetResourceVersion())
return nil
}

Expand Down Expand Up @@ -182,7 +183,7 @@ func ReconcileResource(params Params) error {
if params.PostUpdate != nil {
params.PostUpdate()
}
log.Info("Updated resource successfully")
log.Info("Updated resource successfully", resourceVersion, params.Reconciled.GetResourceVersion())
}
return nil
}