-
Notifications
You must be signed in to change notification settings - Fork 454
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
Add automatic RBAC creation for prometheus receiver #3459
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Israel Blancas <[email protected]>
roles, err := Role(params) | ||
if err != nil { | ||
return nil, err | ||
} | ||
// NOTE: we cannot just unpack the slice, the type checker doesn't coerce the type correctly. | ||
for _, role := range roles { | ||
resourceManifests = append(resourceManifests, role) | ||
} | ||
|
||
roleBindings, err := RoleBinding(params) | ||
if err != nil { | ||
return nil, err | ||
} | ||
// NOTE: we cannot just unpack the slice, the type checker doesn't coerce the type correctly. | ||
for _, roleBinding := range roleBindings { | ||
resourceManifests = append(resourceManifests, roleBinding) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to fold these into the manifest factory framework, but the idea of changing all the current functions to return slices doesn't seem appealing. Maybe we can instead do the conversion in manifests.Factory
? WDYT @jaronoff97 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah i think modifying the manifest factory to have a method that allows returning a slice makes sense to me. You could accomplish that in a similar way we do the factory without error today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will try. Thanks!
Link to tracking Issue(s):
Description of the changes:
Roles
andRoleBindings
when using theprometheusreciever
based on its configurationRoles
,RoleBindings
,ClusterRoles
orClusterRoleBindings
Roles
,RoleBindings
will be created in a different namespace than theOpenTelemetryCollector
instance,they cannot includeOwnerReferences
. This PR avoids them and ensures the resources are removed when neededcontrollers/opentelemetrycollector_controller_test.go
to check we are not breaking anything