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

Restrict cluster role of the amazon cloudwatch agent controller manager #83

Closed
wants to merge 6 commits into from
Closed
Changes from 5 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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ metadata:
rules:
- apiGroups: [ "" ]
resources: [ "configmaps" ]
verbs: [ "create", "delete", "get", "list", "patch", "update", "watch" ]
verbs: [ "create", "delete", "get", "list", "watch" ]
lisguo marked this conversation as resolved.
Show resolved Hide resolved
- apiGroups: [ "" ]
resources: [ "configmaps" ]
resourceNames: ["cloudwatch-agent", "cloudwatch-agent-windows", "cwagent-clusterleader", "dcgm-exporter-config-map", "fluent-bit-config", "fluent-bit-windows-config", "neuron-monitor-config-map", "kube-root-ca.crt"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restricting these by names is going to be tricky.
Customers installing their own AmazonCloudWatchAgent CR can set the name to be anything and the resources would get named accordingly per the regexes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, curious, why do we need the kube-root-ca.crt in this list?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I was hoping there would be a way to do this by namespace, but it doesn't seem like thats possible. What if we pull the actual names from the values.yaml?

kube-root-ca.crt was found in the amazon-cloudwatch namespace, so I assume the operator should have domain over anything we create via helm/operator

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we pull the actual names from the values.yaml?

In the scenario of customers installing their own CRs, it wouldnt come from the values. But perhaps thats just setting an expectation that they have to modify the RBAC accordingly when they do such customizations.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kube-root-ca.crt was found in the amazon-cloudwatch namespace, so I assume the operator should have domain over anything we create via helm/operator

Interesting. Is it actually created/modified by our service account though?

verbs: [ "patch", "update" ]
- apiGroups: [ "" ]
resources: [ "events" ]
verbs: [ "create", "patch" ]
Expand All @@ -14,10 +18,18 @@ rules:
verbs: [ "get","list","patch","update","watch" ]
- apiGroups: [ "" ]
resources: [ "serviceaccounts" ]
verbs: [ "create","delete","get","list","patch","update","watch" ]
verbs: [ "create","delete", "get", "list", "watch" ]
- apiGroups: [ "" ]
resources: [ "serviceaccounts" ]
resourceNames: [ "amazon-cloudwatch-observability-controller-manager", "cloudwatch-agent", "dcgm-exporter-service-acct", "neuron-monitor-service-acct"]
verbs: ["patch","update" ]
- apiGroups: [ "" ]
resources: [ "services" ]
verbs: [ "create","delete","get","list","patch","update","watch" ]
verbs: [ "create","delete","get","list","watch" ]
- apiGroups: [ "" ]
resources: [ "services" ]
resourceNames: [ "amazon-cloudwatch-observability-webhook-service", "cloudwatch-agent", "cloudwatch-agent-headless", "cloudwatch-agent-monitoring", "cloudwatch-agent-windows", "cloudwatch-agent-windows-headless", "cloudwatch-agent-windows-monitoring", "dcgm-exporter-service", "neuron-monitor-service" ]
verbs: [ "patch","update" ]
- apiGroups: [ "apps" ]
resources: [ "daemonsets" ]
verbs: [ "create","delete","get","list","patch","update","watch" ]
Expand All @@ -41,13 +53,4 @@ rules:
verbs: [ "get","patch","update" ]
- apiGroups: [ "cloudwatch.aws.amazon.com" ]
resources: [ "instrumentations" ]
verbs: [ "get","list","patch","update","watch" ]
- apiGroups: [ "coordination.k8s.io" ]
resources: [ "leases" ]
verbs: [ "create","get","list","update" ]
- apiGroups: [ "networking.k8s.io" ]
resources: [ "ingresses" ]
verbs: [ "create","delete","get","list","patch","update","watch" ]
- apiGroups: [ "route.openshift.io" ]
resources: [ "routes", "routes/custom-host" ]
verbs: [ "create","delete","get","list","patch","update","watch" ]
verbs: [ "get","list","patch","update","watch" ]
Loading