Skip to content

ClusterRoleBinding is missing for the ClusterRole. #116

Open
@snowdrop-bot

Description

@snowdrop-bot

Bug Report

Created Memcached operator using the steps from this tutorial.

What did you do?

Created Memcached operator using the steps from this tutorial.

I compiled the project successfully but Quarkus created only one ClusterRoleBinding for ClusterRole. There are two ClusterRole get created after compilation.

What did you expect to see?

It must create ClusterRoleBinding for ClusterRole.

What did you see instead? Under which circumstances?

ClusterRoleBinding is missing

Environment

Kubernetes cluster type:

minikube

$ Mention java-operator-sdk version from pom.xml file

<quarkus-sdk.version>2.0.0</quarkus-sdk.version>

$ java -version

openjdk version "16.0.2" 2021-07-20
OpenJDK Runtime Environment (build 16.0.2+7-67)
OpenJDK 64-Bit Server VM (build 16.0.2+7-67, mixed mode, sharing)

$ kubectl version

Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.2", GitCommit:"8b5a19147530eaac9476b0ab82980b4088bbc1b2", GitTreeState:"clean", BuildDate:"2021-09-15T21:38:50Z", GoVersion:"go1.16.8", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.1", GitCommit:"5e58841cce77d4bc13713ad2b91fa0d961e69192", GitTreeState:"clean", BuildDate:"2021-05-21T23:01:33Z", GoVersion:"go1.16.4", Compiler:"gc", Platform:"linux/amd64"}

Possible Solution

Additional context

Added YAML file created for the memcached-quarkus-operator

---
apiVersion: v1
kind: ServiceAccount
metadata:
  annotations:
    app.quarkus.io/build-timestamp: 2021-11-19 - 07:09:45 +0000
  labels:
    app.kubernetes.io/version: 0.0.1-SNAPSHOT
    app.kubernetes.io/name: memcached-quarkus-operator-operator
  name: memcached-quarkus-operator-operator
---
apiVersion: v1
kind: Service
metadata:
  annotations:
    app.quarkus.io/build-timestamp: 2021-11-19 - 07:09:45 +0000
    prometheus.io/scrape: "true"
    prometheus.io/path: /q/metrics
    prometheus.io/port: "8080"
    prometheus.io/scheme: http
  labels:
    app.kubernetes.io/name: memcached-quarkus-operator-operator
    app.kubernetes.io/version: 0.0.1-SNAPSHOT
  name: memcached-quarkus-operator-operator
spec:
  ports:
    - name: http
      port: 80
      targetPort: 8080
  selector:
    app.kubernetes.io/name: memcached-quarkus-operator-operator
    app.kubernetes.io/version: 0.0.1-SNAPSHOT
  type: ClusterIP
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: memcached-quarkus-operator-operator-view
roleRef:
  kind: ClusterRole
  apiGroup: rbac.authorization.k8s.io
  name: view
subjects:
  - kind: ServiceAccount
    name: memcached-quarkus-operator-operator
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: memcached-quarkus-operator-operator-crd-validating-cluster-role
rules:
  - apiGroups:
      - apiextensions.k8s.io
    resources:
      - customresourcedefinitions
    verbs:
      - get
      - list
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: memcachedcontroller-cluster-role
rules:
  - apiGroups:
      - cache.example.com
    resources:
      - memcacheds
      - memcacheds/status
    verbs:
      - get
      - list
      - watch
      - create
      - delete
      - patch
      - update
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: memcachedcontroller-cluster-role-binding
roleRef:
  kind: ClusterRole
  apiGroup: rbac.authorization.k8s.io
  name: memcachedcontroller-cluster-role
subjects:
  - kind: ServiceAccount
    name: memcached-quarkus-operator-operator
---
apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    app.quarkus.io/build-timestamp: 2021-11-19 - 07:09:45 +0000
    prometheus.io/scrape: "true"
    prometheus.io/path: /q/metrics
    prometheus.io/port: "8080"
    prometheus.io/scheme: http
  labels:
    app.kubernetes.io/version: 0.0.1-SNAPSHOT
    app.kubernetes.io/name: memcached-quarkus-operator-operator
  name: memcached-quarkus-operator-operator
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/version: 0.0.1-SNAPSHOT
      app.kubernetes.io/name: memcached-quarkus-operator-operator
  template:
    metadata:
      annotations:
        app.quarkus.io/build-timestamp: 2021-11-19 - 07:09:45 +0000
        prometheus.io/scrape: "true"
        prometheus.io/path: /q/metrics
        prometheus.io/port: "8080"
        prometheus.io/scheme: http
      labels:
        app.kubernetes.io/version: 0.0.1-SNAPSHOT
        app.kubernetes.io/name: memcached-quarkus-operator-operator
    spec:
      containers:
        - env:
            - name: KUBERNETES_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
          image: root/memcached-quarkus-operator-operator:0.0.1-SNAPSHOT
          imagePullPolicy: Always
          livenessProbe:
            failureThreshold: 3
            httpGet:
              path: /q/health/live
              port: 8080
              scheme: HTTP
            initialDelaySeconds: 0
            periodSeconds: 30
            successThreshold: 1
            timeoutSeconds: 10
          name: memcached-quarkus-operator-operator
          ports:
            - containerPort: 8080
              name: http
              protocol: TCP
          readinessProbe:
            failureThreshold: 3
            httpGet:
              path: /q/health/ready
              port: 8080
              scheme: HTTP
            initialDelaySeconds: 0
            periodSeconds: 30
            successThreshold: 1
            timeoutSeconds: 10
      serviceAccount: memcached-quarkus-operator-operator


operator-framework#699


$upstream:699$

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions