Repository: EnMasseProject/enmasse
Pull request #2414 (2019-03-06 13:31:06)

Add initial service account and permissions


Patch:
diff --git a/pom.xml b/pom.xml
index ffc962410..64d516e9f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -62,6 +62,7 @@
         <hamcrest.version>1.3</hamcrest.version>
         <junit.jupiter.version>5.4.0</junit.jupiter.version>
         <junit.platform.runner.version>1.4.0</junit.platform.runner.version>
+        <junit.platform.surefire.provider.version>1.3.2</junit.platform.surefire.provider.version>
         <junit.platform.launcher.version>1.4.0</junit.platform.launcher.version>
         <artemis.version>2.6.4</artemis.version>
         <ngwebdriver.version>1.1.4</ngwebdriver.version>
@@ -843,6 +844,13 @@
                       <vertx.logger-delegate-factory-class-name>io.vertx.core.logging.SLF4JLogDelegateFactory</vertx.logger-delegate-factory-class-name>
                     </systemPropertyVariables>
                 </configuration>
+                <dependencies>
+                  <dependency>
+                    <groupId>org.junit.platform</groupId>
+                    <artifactId>junit-platform-surefire-provider</artifactId>
+                    <version>${junit.platform.surefire.provider.version}</version>
+                  </dependency>
+                </dependencies>
             </plugin>
             <plugin>
                 <groupId>com.mycila</groupId>
diff --git a/templates/enmasse-controller-manager/010-ServiceAccount-enmasse-controller-manager b/templates/enmasse-controller-manager/010-ServiceAccount-enmasse-controller-manager
new file mode 100644
index 000000000..8042ab7f6
--- /dev/null
+++ b/templates/enmasse-controller-manager/010-ServiceAccount-enmasse-controller-manager
@@ -0,0 +1,6 @@
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+  name: enmasse-controller-manager
+  labels:
+    app: enmasse
diff --git a/templates/enmasse-controller-manager/020-Role-enmasse-controller-manager.yaml b/templates/enmasse-controller-manager/020-Role-enmasse-controller-manager.yaml
new file mode 100644
index 000000000..190dbc8ee
--- /dev/null
+++ b/templates/enmasse-controller-manager/020-Role-enmasse-controller-manager.yaml
@@ -0,0 +1,13 @@
+apiVersion: rbac.authorization.k8s.io/v1
+kind: Role
+metadata:
+  labels:
+    app: enmasse
+  name: enmasse.io:enmasse-controller-manager
+rules:
+  - apiGroups: [ "admin.enmasse.io" ]
+    resources: [ "authenticationservice" ]
+    verbs: [ "get", "list", "watch", "update", "create", "patch" ]
+  - apiGroups: [ "iot.enmasse.io" ]
+    resources: [ "iotconfig" ]
+    verbs: [ "get", "list", "watch", "update", "create", "patch" ]
diff --git a/templates/enmasse-controller-manager/030-Deployment-enmasse-controller-manager.yaml b/templates/enmasse-controller-manager/030-Deployment-enmasse-controller-manager.yaml
index 422214b91..e8b8a9da7 100644
--- a/templates/enmasse-controller-manager/030-Deployment-enmasse-controller-manager.yaml
+++ b/templates/enmasse-controller-manager/030-Deployment-enmasse-controller-manager.yaml
@@ -17,6 +17,7 @@ spec:
         app: enmasse
         name: enmasse-controller-manager
     spec:
+      serviceAccountName: enmasse-controller-manager
       containers:
       - name: controller
         image: ${ENMASSE_CONTROLLER_MANAGER_IMAGE}
diff --git a/templates/enmasse-controller-manager/030-RoleBinding-enmasse-controller-manager.yaml b/templates/enmasse-controller-manager/030-RoleBinding-enmasse-controller-manager.yaml
new file mode 100644
index 000000000..26638582b
--- /dev/null
+++ b/templates/enmasse-controller-manager/030-RoleBinding-enmasse-controller-manager.yaml
@@ -0,0 +1,14 @@
+apiVersion: rbac.authorization.k8s.io/v1
+kind: RoleBinding
+metadata:
+  name: enmasse-controller-manager
+  labels:
+    app: enmasse
+roleRef:
+  apiGroup: rbac.authorization.k8s.io
+  kind: Role
+  name: enmasse.io:enmasse-controller-manager
+subjects:
+- kind: ServiceAccount
+  name: enmasse-controller-manager
+  namespace: ${NAMESPACE}


Test patch:
diff --git a/systemtests/pom.xml b/systemtests/pom.xml
index 2ca34b816..24b0d0b8e 100644
--- a/systemtests/pom.xml
+++ b/systemtests/pom.xml
@@ -124,6 +124,13 @@
                         <enmasse.version>${release.version}</enmasse.version>
                     </systemProperties>
                 </configuration>
+                <dependencies>
+                  <dependency>
+                    <groupId>org.junit.platform</groupId>
+                    <artifactId>junit-platform-surefire-provider</artifactId>
+                    <version>${junit.platform.surefire.provider.version}</version>
+                  </dependency>
+                </dependencies>
             </plugin>
             <plugin>
                 <groupId>org.owasp</groupId>