diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index 924a6e03cce1c8131d77ad4467b8f57d306302ba..cc029bc52d92e851e11b8307917fd51876779e6a 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -3,14 +3,13 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: - creationTimestamp: null - name: manager-role-redis-operator + name: redis-operator rules: - apiGroups: - redis.redis.opstreelabs.in resources: - - redis - - rediscluster + - rediss + - redisclusters verbs: - create - delete @@ -35,3 +34,42 @@ rules: - get - patch - update +- apiGroups: + - "" + resources: + - secrets + - pods/exec + - services + - configmaps + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - apps + resources: + - statefulsets + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - "coordination.k8s.io" + resources: + - leases + verbs: + - create + - delete + - get + - list + - patch + - update + - watch diff --git a/config/rbac/role_binding.yaml b/config/rbac/role_binding.yaml index 93a0d82537eccb398238b8ff588e15d27fec81dd..1397f6df227caa7711e5f6f3353ea28f627ce91d 100644 --- a/config/rbac/role_binding.yaml +++ b/config/rbac/role_binding.yaml @@ -1,11 +1,11 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: - name: manager-rolebinding-redis-operator + name: redis-operator roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole - name: cluster-admin + name: redis-operator subjects: - kind: ServiceAccount name: redis-operator diff --git a/k8sutils/redis-cluster.go b/k8sutils/redis-cluster.go index 6b14f5b2830969c7cb60a5d92520f34e8d2878ae..87647aa763a10c49d6cc1a2fcbfb2d235c5832ae 100644 --- a/k8sutils/redis-cluster.go +++ b/k8sutils/redis-cluster.go @@ -62,7 +62,10 @@ func generateRedisClusterContainerParams(cr *redisv1beta1.RedisCluster) containe if cr.Spec.RedisExporter != nil { containerProp.RedisExporterImage = cr.Spec.RedisExporter.Image containerProp.RedisExporterImagePullPolicy = cr.Spec.RedisExporter.ImagePullPolicy - containerProp.RedisExporterResources = cr.Spec.RedisExporter.Resources + + if cr.Spec.RedisExporter.Resources != nil { + containerProp.RedisExporterResources = cr.Spec.RedisExporter.Resources + } if cr.Spec.RedisExporter.EnvVars != nil { containerProp.RedisExporterEnv = cr.Spec.RedisExporter.EnvVars diff --git a/k8sutils/redis-standalone.go b/k8sutils/redis-standalone.go index 8bf85b64b44d9792fe6c322032ca90f4a82ee053..b9a4ccd23d98069035939cdf2ff3c006c0cbb135 100644 --- a/k8sutils/redis-standalone.go +++ b/k8sutils/redis-standalone.go @@ -96,7 +96,10 @@ func generateRedisStandaloneContainerParams(cr *redisv1beta1.Redis) containerPar if cr.Spec.RedisExporter != nil { containerProp.RedisExporterImage = cr.Spec.RedisExporter.Image containerProp.RedisExporterImagePullPolicy = cr.Spec.RedisExporter.ImagePullPolicy - containerProp.RedisExporterResources = cr.Spec.RedisExporter.Resources + + if cr.Spec.RedisExporter.Resources != nil { + containerProp.RedisExporterResources = cr.Spec.RedisExporter.Resources + } if cr.Spec.RedisExporter.EnvVars != nil { containerProp.RedisExporterEnv = cr.Spec.RedisExporter.EnvVars