From 756a2214fe1949764d91f68ec337d3e0d8898c01 Mon Sep 17 00:00:00 2001 From: Christoph Muellner <33160506+chrismuellner@users.noreply.github.com> Date: Wed, 10 Apr 2024 11:17:57 +0200 Subject: [PATCH] Add new rules to permission script and remove outdated permission (#2992) --- .gitignore | 2 ++ .../Common/operator/clusterrole-operator.yaml | 1 - hack/doc/role-permissions2md.py | 18 ++++++++++++------ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index b460de211b..603b886772 100644 --- a/.gitignore +++ b/.gitignore @@ -104,3 +104,5 @@ kind-logs-* test/testdata/secrets/* local/ + +permissions.md diff --git a/config/helm/chart/default/templates/Common/operator/clusterrole-operator.yaml b/config/helm/chart/default/templates/Common/operator/clusterrole-operator.yaml index 5fdb4d9f8e..6dd8603f15 100644 --- a/config/helm/chart/default/templates/Common/operator/clusterrole-operator.yaml +++ b/config/helm/chart/default/templates/Common/operator/clusterrole-operator.yaml @@ -88,7 +88,6 @@ rules: resourceNames: - dynakubes.dynatrace.com - edgeconnects.dynatrace.com - - activegates.dynatrace.com verbs: - get - update diff --git a/hack/doc/role-permissions2md.py b/hack/doc/role-permissions2md.py index 565111f741..8ab4ce33fb 100644 --- a/hack/doc/role-permissions2md.py +++ b/hack/doc/role-permissions2md.py @@ -39,15 +39,21 @@ "virtualservices": "VirtualServices", "leases": "Leases", "endpoints": "EndPoints", - "securitycontextconstraints": "SecurityContextConstraints" + "securitycontextconstraints": "SecurityContextConstraints", + "edgeconnects": "EdgeConnects", + "edgeconnects/finalizers": "EdgeConnects/Finalizers", + "edgeconnects/status": "EdgeConnects/Status", + "activegates": "ActiveGates", + "activegates/finalizers": "ActiveGates/Finalizers", + "activegates/status": "ActiveGates/Status", } sectionTitles = { "dynatrace-operator": "Dynatrace Operator", - "dynatrace-kubernetes-monitoring": "Dynatrace Kubernetes Monitoring (ActiveGate)", + "dynatrace-kubernetes-monitoring": "Dynatrace Activegate (Kubernetes Monitoring)", "dynatrace-webhook": "Dynatrace webhook server", "dynatrace-oneagent-csi-driver": "Dynatrace CSI driver", - "dynatrace-activegate": "Dynatrace Kubernetes Monitoring (ActiveGate)", + "dynatrace-activegate": "Dynatrace ActiveGate (Default)", "dynatrace-dynakube-oneagent": "Dynatrace OneAgent" } @@ -70,7 +76,7 @@ def multiline_codestyle_block(entries): if len(entry) > 0: result_string += f"`{entry}`" else: - result_string += f"`-`" + result_string += f"`\"\"`" return result_string def get_resource_names(rule): @@ -95,8 +101,8 @@ def create_role_table(role): for resource in resources: apis = get_apis(rule) resource_names = get_resource_names(rule) - api_gropus = get_api_groups(rule) - print(f"|`{resourceTerms[resource]}` |{api_gropus} |{apis} |{resource_names} |") + api_groups = get_api_groups(rule) + print(f"|`{resourceTerms[resource]}` |{api_groups} |{apis} |{resource_names} |") def convert_cluster_roles_to_markdown(role): print(f"\n## {sectionTitles[role['metadata']['name']]} (cluster-wide)\n")