You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/12/22 07:56:24 UTC

[GitHub] [flink] wangyang0918 commented on a change in pull request #14447: [FLINK-20664][k8s] Support setting service account for TaskManager pod

wangyang0918 commented on a change in pull request #14447:
URL: https://github.com/apache/flink/pull/14447#discussion_r547112827



##########
File path: flink-kubernetes/src/main/java/org/apache/flink/kubernetes/configuration/KubernetesConfigOptions.java
##########
@@ -60,6 +60,13 @@
 		.withDescription("Service account that is used by jobmanager within kubernetes cluster. " +
 			"The job manager uses this service account when requesting taskmanager pods from the API server.");
 
+	public static final ConfigOption<String> TASK_MANAGER_SERVICE_ACCOUNT =
+		key("kubernetes.taskmanager.service-account")
+			.stringType()
+			.defaultValue("default")
+			.withDescription("Service account that is used by taskmanager within kubernetes cluster. " +
+				"The task manager uses this service account when watching config maps on the API server.");

Review comment:
       ```suggestion
   				"The task manager uses this service account when watching config maps on the API server to retrieve leader address of jobmanager and resourcemanager.");
   ```

##########
File path: flink-kubernetes/src/main/java/org/apache/flink/kubernetes/configuration/KubernetesConfigOptions.java
##########
@@ -60,6 +60,13 @@
 		.withDescription("Service account that is used by jobmanager within kubernetes cluster. " +
 			"The job manager uses this service account when requesting taskmanager pods from the API server.");
 
+	public static final ConfigOption<String> TASK_MANAGER_SERVICE_ACCOUNT =

Review comment:
       You need to run `mvn package -Dgenerate-config-docs -pl flink-docs -am -nsu -DskipTests` to regenerate the configuration docs.

##########
File path: flink-kubernetes/src/test/java/org/apache/flink/kubernetes/kubeclient/decorators/InitTaskManagerDecoratorTest.java
##########
@@ -187,6 +189,11 @@ public void testPodAnnotations() {
 		assertThat(resultAnnotations, is(equalTo(ANNOTATIONS)));
 	}
 
+	@Test
+	public void testPodServiceAccountName() {
+		assertEquals(SERVICE_ACCOUNT_NAME, this.resultPod.getSpec().getServiceAccountName());

Review comment:
       ```suggestion
   		assertThat(SERVICE_ACCOUNT_NAME, is(this.resultPod.getSpec().getServiceAccountName()))
   ```
   
   In Flink, we prefer `assertThat` for assertion.

##########
File path: flink-kubernetes/src/main/java/org/apache/flink/kubernetes/configuration/KubernetesConfigOptions.java
##########
@@ -60,6 +60,13 @@
 		.withDescription("Service account that is used by jobmanager within kubernetes cluster. " +
 			"The job manager uses this service account when requesting taskmanager pods from the API server.");
 
+	public static final ConfigOption<String> TASK_MANAGER_SERVICE_ACCOUNT =
+		key("kubernetes.taskmanager.service-account")

Review comment:
       I believe we also need to update the `native-kubernetes.md#RBAC` section. At least, we need to tell users they could set the service account for TaskManager via `kubernetes.taskmanager.service-account`. And it is necessary only Kubernetes HA mode,.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org