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/25 03:15: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_r548783056



##########
File path: flink-kubernetes/src/main/java/org/apache/flink/kubernetes/configuration/KubernetesConfigOptions.java
##########
@@ -53,13 +53,27 @@
 		.withDescription("The type of the rest service (ClusterIP or NodePort or LoadBalancer). " +
 			"When set to ClusterIP, the rest service will not be created.");
 
+	public static final ConfigOption<String> KUBERNETES_SERVICE_ACCOUNT =
+		key("kubernetes.service-account")
+		.stringType()
+		.defaultValue("default")
+		.withDescription("Service account that is used by jobmanager and taskmanger within kubernetes cluster. " +

Review comment:
       typo `taskmanger` -> `taskmanager`

##########
File path: flink-kubernetes/src/main/java/org/apache/flink/kubernetes/configuration/KubernetesConfigOptions.java
##########
@@ -56,9 +58,27 @@
 	public static final ConfigOption<String> JOB_MANAGER_SERVICE_ACCOUNT =
 		key("kubernetes.jobmanager.service-account")
 		.stringType()
-		.defaultValue("default")
+		.noDefaultValue()
 		.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.");
+			"The job manager uses this service account when requesting taskmanager pods from the API server. " +
+			"If not explicitly configured, config option '" + KUBERNETES_SERVICE_ACCOUNT_KEY + "' will be used.");
+
+	public static final ConfigOption<String> TASK_MANAGER_SERVICE_ACCOUNT =
+		key("kubernetes.taskmanager.service-account")
+		.stringType()
+		.noDefaultValue()
+		.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 to retrieve " +
+			"leader address of jobmanager and resourcemanager. If not explicitly configured, config option '" +
+			KUBERNETES_SERVICE_ACCOUNT_KEY + "' will be used.");
+
+	public static final ConfigOption<String> KUBERNETES_SERVICE_ACCOUNT =
+		key(KUBERNETES_SERVICE_ACCOUNT_KEY)
+			.stringType()
+			.defaultValue("default")
+			.withDescription("Service account that is used by jobmanager and taskmanger within kubernetes cluster. " +
+				"Notice that this can be overwritten by config options '" + JOB_MANAGER_SERVICE_ACCOUNT.key() +
+				"' and '" + TASK_MANAGER_SERVICE_ACCOUNT.key() + "' for  jobmanager and taskmanager respectively.");

Review comment:
       ```suggestion
   				"' and '" + TASK_MANAGER_SERVICE_ACCOUNT.key() + "' for jobmanager and taskmanager respectively.");
   ```
   
   A useless space here.

##########
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() {
+		assertThat(SERVICE_ACCOUNT_NAME, is(this.resultPod.getSpec().getServiceAccountName()));

Review comment:
       ```suggestion
   		assertThat(this.resultPod.getSpec().getServiceAccountName(), is(SERVICE_ACCOUNT_NAME));
   ```




----------------------------------------------------------------
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