-
Notifications
You must be signed in to change notification settings - Fork 440
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
Automate the creation of the permissions needed by resourcedetection #2394
Conversation
Signed-off-by: Israel Blancas <iblancasa@gmail.com>
Signed-off-by: Israel Blancas <iblancasa@gmail.com>
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 love the spirit of this PR, and think it would be great if we continued this for other processors like the k8sattr processor
internal/manifests/collector/parser/processor/processor_resourcedetection.go
Show resolved
Hide resolved
…or into task/2393
Signed-off-by: Israel Blancas <iblancasa@gmail.com>
@iblancasa CI failed |
…or into task/2393
…or into task/2393
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.
LGTM, but I'd like to see a e2e test added as well.
@iblancasa the PR needs to be rebased, also @swiatekm-sumo suggested adding e2e test |
…or into task/2393
Signed-off-by: Israel Blancas <iblancasa@gmail.com>
…or into task/2393
Signed-off-by: Israel Blancas <iblancasa@gmail.com>
…or into task/2393
…or into task/2393
Signed-off-by: Israel Blancas <iblancasa@gmail.com>
…or into task/2393
…or into task/2393
Signed-off-by: Israel Blancas <iblancasa@gmail.com>
…or into task/2393
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.
LGTM 👍🏼
just few nit comments before merning.
} | ||
|
||
var logger = logf.Log.WithName("collector-unit-tests") | ||
for _, test := range tests { |
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.
It's good that the test table is used but the tests should be run in a separate execution t.Run
"github.com/open-telemetry/opentelemetry-operator/internal/manifests/collector/parser/processor" | ||
) | ||
|
||
func ConfigToRBAC(logger logr.Logger, config map[interface{}]interface{}) []rbacv1.PolicyRule { |
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.
nit: it's worth adding a comment to a public API
rbacv1 "k8s.io/api/rbac/v1" | ||
) | ||
|
||
type ProcessorParser interface { |
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.
nit: document public APIs
GetRBACRules() []rbacv1.PolicyRule | ||
} | ||
|
||
type Builder func(logr.Logger, string, map[interface{}]interface{}) ProcessorParser |
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.
nit: document public APIs
@@ -124,6 +125,7 @@ func main() { | |||
pflag.BoolVar(&enableLeaderElection, "enable-leader-election", false, | |||
"Enable leader election for controller manager. "+ | |||
"Enabling this will ensure there is only one active controller manager.") | |||
pflag.BoolVar(&createRBACPermissions, "create-rbac-permissions", false, "Automatically create RBAC permissions needed by the processors") |
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.
did we discuss whether it should be disabled by default?
I would prefer to ship the OSS distro with as much enabled functionality.
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.
It is disabled by default because otherwise, it would change the current behavior and could be considered as a breaking change. I think this approach is good for now and we can set it to true
in the future.
…or into task/2393
…or into task/2393
Signed-off-by: Israel Blancas <iblancasa@gmail.com>
…pen-telemetry#2394) * Automate the creation of the permissions requested by resourcedetection Signed-off-by: Israel Blancas <iblancasa@gmail.com> * Add changelog Signed-off-by: Israel Blancas <iblancasa@gmail.com> * Fix merge Signed-off-by: Israel Blancas <iblancasa@gmail.com> * Apply changes requested in code review Signed-off-by: Israel Blancas <iblancasa@gmail.com> * Fix lint Signed-off-by: Israel Blancas <iblancasa@gmail.com> * Add feature gate and test Signed-off-by: Israel Blancas <iblancasa@gmail.com> * Add unit tests Signed-off-by: Israel Blancas <iblancasa@gmail.com> * Apply feedback from pull request Signed-off-by: Israel Blancas <iblancasa@gmail.com> * Apply changes requested as part of the Pull Request Signed-off-by: Israel Blancas <iblancasa@gmail.com> * Apply changes requested as part of the Pull Request Signed-off-by: Israel Blancas <iblancasa@gmail.com> --------- Signed-off-by: Israel Blancas <iblancasa@gmail.com>
Description:
Link to tracking Issue: #2393