gardener-attic / gardener-resource-manager

Kubernetes resource reconciliation controller capable of performing health checks for managed resources.
https://gardener.cloud
5 stars 19 forks source link

add origin annotation to resources created an behalf of a managed resource #89

Closed mandelsoft closed 3 years ago

mandelsoft commented 3 years ago

How to categorize this PR?

/area control-plane /kind enhancement /priority normal

What this PR does / why we need it:

The PR introduces an origin annotation for resources managed on-behalf of a ManagedResource. An origin is typically a tripple cluster/namespace/name of the ManagedResource object. It can be used by humans to figure out the ManagedResource object used to manage an object just by looking at an object indicated to be maintained by a ManagedResource.

The cluster id can be taken from the cluster-identity of the cluster, of specified manually by a cluster-id command line argument. Here three kinds of values are possible:

This origin information can in a further step be used to support more deploy modes for objects that require the information whether an objects is deployed by the actual ManagedResource.

Which issue(s) this PR fixes: Fixes #100

Special notes for your reviewer:

Release note:

With this release for all objects managed by a `ManagedResource` an annotation `resources.gardener.cloud/origin` is set describing the `ManagedResource` that caused this object to be created. The format of the origin annotation is `[cluster id:]namespace/object-name`. For multi-cluster scenarios the GRM can be started with a `--cluster-id` options to enable the extended annotation format (see https://github.com/gardener/gardener-resource-manager/blob/master/docs/concepts/managed-resource.md for further details).
rfranzke commented 3 years ago

@mandelsoft is this PR ready for review (if yes, then please mark it accordingly) Also, please rebase to resolve the conflicting files.

rfranzke commented 3 years ago

/author-action

gardener-robot commented 3 years ago

@mandelsoft The pull request was assigned to you under author-action. Please unassign yourself when you are done. Thank you.

rfranzke commented 3 years ago

Also, the verify step is failing with

WARN [runner] Can't run linter goanalysis_metalinter: S1037: failed prerequisites: [(inspect@github.com/gardener/gardener-resource-manager/cmd/gardener-resource-manager/app, isgenerated@github.com/gardener/gardener-resource-manager/cmd/gardener-resource-manager/app): analysis skipped: errors in package: [/go/src/github.com/gardener/gardener-resource-manager/cmd/gardener-resource-manager/app/app.go:30:21: could not import github.com/gardener/gardener-resource-manager/pkg/controller/managedresource (/go/src/github.com/gardener/gardener-resource-manager/pkg/controller/managedresource/add.go:32:2: client redeclared in this block)]] 
ERRO Running error: S1037: failed prerequisites: [(inspect@github.com/gardener/gardener-resource-manager/cmd/gardener-resource-manager/app, isgenerated@github.com/gardener/gardener-resource-manager/cmd/gardener-resource-manager/app): analysis skipped: errors in package: [/go/src/github.com/gardener/gardener-resource-manager/cmd/gardener-resource-manager/app/app.go:30:21: could not import github.com/gardener/gardener-resource-manager/pkg/controller/managedresource (/go/src/github.com/gardener/gardener-resource-manager/pkg/controller/managedresource/add.go:32:2: client redeclared in this block)]] 

Have you verified the change locally? 👀

rfranzke commented 3 years ago

/needs documentation Rest looks good for now, thanks for addressing all the comments!

rfranzke commented 3 years ago

Can you also add a release-note for this change?

mandelsoft commented 3 years ago

@rfranzke After revendoring all the x-bits were lost for the vendored shell scripts and calling make verify did not work anymore.

I fixed your doc changes

mandelsoft commented 3 years ago

Oh, I just finished the release note

rfranzke commented 3 years ago

That's fine, it can be edited even after merge until the next release. Thanks!