From: Thoralf Czichy Date: Thu, 7 Dec 2023 09:39:04 +0000 (+0000) Subject: Merge "Adding Cluster Role for RIC" X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=43d5525ce82538f64e50c12caeaa23572eddc7fe;hp=d8123116713107bfaf267a40ebf0faefac3a3fa0;p=ric-plt%2Fric-dep.git Merge "Adding Cluster Role for RIC" --- diff --git a/depRicKubernetesOperator/internal/controller/getClusterRole.go b/depRicKubernetesOperator/internal/controller/getClusterRole.go index 31e1bb4..13a8200 100644 --- a/depRicKubernetesOperator/internal/controller/getClusterRole.go +++ b/depRicKubernetesOperator/internal/controller/getClusterRole.go @@ -3,6 +3,7 @@ package controller import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + rbacv1 "k8s.io/api/rbac/v1" ) func GetClusterRole() []*rbacv1.ClusterRole { @@ -102,6 +103,273 @@ func GetClusterRole() []*rbacv1.ClusterRole { }, } - return []*rbacv1.ClusterRole{clusterRole1, clusterRole2} + clusterRole3 := &rbacv1.ClusterRole{ + ObjectMeta: metav1.ObjectMeta{ + Labels: map[string]string{ + "app.kubernetes.io/version": "1.4", + "helm.sh/chart": "kong-0.36.6", + "app.kubernetes.io/instance": "release-name", + "app.kubernetes.io/managed-by": "Helm", + "app.kubernetes.io/name": "kong", + }, + Name: "release-name-kong", + }, + Rules: []rbacv1.PolicyRule{ + + rbacv1.PolicyRule{ + Resources: []string{ + + "endpoints", + "nodes", + "pods", + "secrets", + }, + Verbs: []string{ + + "list", + "watch", + }, + APIGroups: []string{ + + "", + }, + }, + rbacv1.PolicyRule{ + APIGroups: []string{ + + "", + }, + Resources: []string{ + + "nodes", + }, + Verbs: []string{ + + "get", + }, + }, + rbacv1.PolicyRule{ + APIGroups: []string{ + + "", + }, + Resources: []string{ + + "services", + }, + Verbs: []string{ + + "get", + "list", + "watch", + }, + }, + rbacv1.PolicyRule{ + APIGroups: []string{ + + "extensions", + "networking.k8s.io", + }, + Resources: []string{ + + "ingresses", + }, + Verbs: []string{ + + "get", + "list", + "watch", + }, + }, + rbacv1.PolicyRule{ + APIGroups: []string{ + + "", + }, + Resources: []string{ + + "events", + }, + Verbs: []string{ + + "create", + "patch", + }, + }, + rbacv1.PolicyRule{ + APIGroups: []string{ + + "extensions", + "networking.k8s.io", + }, + Resources: []string{ + + "ingresses/status", + }, + Verbs: []string{ + + "update", + }, + }, + rbacv1.PolicyRule{ + Verbs: []string{ + + "get", + "list", + "watch", + }, + APIGroups: []string{ + + "configuration.konghq.com", + }, + Resources: []string{ + + "kongplugins", + "kongcredentials", + "kongconsumers", + "kongingresses", + }, + }, + }, + TypeMeta: metav1.TypeMeta{ + APIVersion: "rbac.authorization.k8s.io/v1", + Kind: "ClusterRole", + }, + } + + clusterRole4 := &rbacv1.ClusterRole{ + ObjectMeta: metav1.ObjectMeta{ + Labels: map[string]string{ + "app.kubernetes.io/managed-by": "Helm", + "app.kubernetes.io/name": "kong", + "app.kubernetes.io/version": "1.4", + "helm.sh/chart": "kong-0.36.6", + "app.kubernetes.io/instance": "release-name", + }, + Name: "release-name-kong", + }, + Rules: []rbacv1.PolicyRule{ + + rbacv1.PolicyRule{ + APIGroups: []string{ + + "", + }, + Resources: []string{ + + "endpoints", + "nodes", + "pods", + "secrets", + }, + Verbs: []string{ + + "list", + "watch", + }, + }, + rbacv1.PolicyRule{ + Resources: []string{ + + "nodes", + }, + Verbs: []string{ + + "get", + }, + APIGroups: []string{ + + "", + }, + }, + rbacv1.PolicyRule{ + Verbs: []string{ + + "get", + "list", + "watch", + }, + APIGroups: []string{ + + "", + }, + Resources: []string{ + + "services", + }, + }, + rbacv1.PolicyRule{ + APIGroups: []string{ + + "extensions", + "networking.k8s.io", + }, + Resources: []string{ + + "ingresses", + }, + Verbs: []string{ + + "get", + "list", + "watch", + }, + }, + rbacv1.PolicyRule{ + Resources: []string{ + + "events", + }, + Verbs: []string{ + + "create", + "patch", + }, + APIGroups: []string{ + + "", + }, + }, + rbacv1.PolicyRule{ + APIGroups: []string{ + + "extensions", + "networking.k8s.io", + }, + Resources: []string{ + + "ingresses/status", + }, + Verbs: []string{ + + "update", + }, + }, + rbacv1.PolicyRule{ + APIGroups: []string{ + + "configuration.konghq.com", + }, + Resources: []string{ + + "kongplugins", + "kongcredentials", + "kongconsumers", + "kongingresses", + }, + Verbs: []string{ + + "get", + "list", + "watch", + }, + }, + }, + TypeMeta: metav1.TypeMeta{ + APIVersion: "rbac.authorization.k8s.io/v1", + Kind: "ClusterRole", + }, + } + return []*rbacv1.ClusterRole{clusterRole1, clusterRole2, clusterRole3, clusterRole4} } \ No newline at end of file