org.apache.flink.kubernetes.configuration.KubernetesConfigOptions Maven / Gradle / Ivy
The newest version!
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.flink.kubernetes.configuration;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.configuration.ConfigOption;
import java.util.List;
import java.util.Map;
import static org.apache.flink.configuration.ConfigOptions.key;
/**
* This class holds configuration constants used by Flink's kubernetes runners.
*/
@PublicEvolving
public class KubernetesConfigOptions {
public static final ConfigOption CONTEXT =
key("kubernetes.context")
.stringType()
.noDefaultValue()
.withDescription("The desired context from your Kubernetes config file used to configure the Kubernetes client " +
"for interacting with the cluster. This could be helpful if one has multiple contexts configured and " +
"wants to administrate different Flink clusters on different Kubernetes clusters/contexts.");
public static final ConfigOption REST_SERVICE_EXPOSED_TYPE =
key("kubernetes.rest-service.exposed.type")
.enumType(ServiceExposedType.class)
.defaultValue(ServiceExposedType.LoadBalancer)
.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 JOB_MANAGER_SERVICE_ACCOUNT =
key("kubernetes.jobmanager.service-account")
.stringType()
.defaultValue("default")
.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 JOB_MANAGER_CPU =
key("kubernetes.jobmanager.cpu")
.doubleType()
.defaultValue(1.0)
.withDescription("The number of cpu used by job manager");
public static final ConfigOption TASK_MANAGER_CPU =
key("kubernetes.taskmanager.cpu")
.doubleType()
.defaultValue(-1.0)
.withDescription("The number of cpu used by task manager. By default, the cpu is set " +
"to the number of slots per TaskManager");
public static final ConfigOption CONTAINER_IMAGE_PULL_POLICY =
key("kubernetes.container.image.pull-policy")
.enumType(ImagePullPolicy.class)
.defaultValue(ImagePullPolicy.IfNotPresent)
.withDescription("The Kubernetes container image pull policy (IfNotPresent or Always or Never). " +
"The default policy is IfNotPresent to avoid putting pressure to image repository.");
public static final ConfigOption> CONTAINER_IMAGE_PULL_SECRETS =
key("kubernetes.container.image.pull-secrets")
.stringType()
.asList()
.noDefaultValue()
.withDescription("A semicolon-separated list of the Kubernetes secrets used to access " +
"private image registries.");
public static final ConfigOption KUBE_CONFIG_FILE =
key("kubernetes.config.file")
.stringType()
.noDefaultValue()
.withDescription("The kubernetes config file will be used to create the client. The default " +
"is located at ~/.kube/config");
public static final ConfigOption NAMESPACE =
key("kubernetes.namespace")
.stringType()
.defaultValue("default")
.withDescription("The namespace that will be used for running the jobmanager and taskmanager pods.");
public static final ConfigOption CONTAINER_START_COMMAND_TEMPLATE =
key("kubernetes.container-start-command-template")
.stringType()
.defaultValue("%java% %classpath% %jvmmem% %jvmopts% %logging% %class% %args% %redirects%")
.withDescription("Template for the kubernetes jobmanager and taskmanager container start invocation.");
public static final ConfigOption SERVICE_CREATE_TIMEOUT =
key("kubernetes.service.create-timeout")
.stringType()
.defaultValue("1 min")
.withDescription("Timeout used for creating the service. The timeout value requires a time-unit " +
"specifier (ms/s/min/h/d).");
// ---------------------------------------------------------------------------------
// The following config options could be overridden by KubernetesCliOptions.
// ---------------------------------------------------------------------------------
public static final ConfigOption CLUSTER_ID =
key("kubernetes.cluster-id")
.stringType()
.noDefaultValue()
.withDescription("The cluster id used for identifying the unique flink cluster. If it's not set, " +
"the client will generate a random UUID name.");
public static final ConfigOption CONTAINER_IMAGE =
key("kubernetes.container.image")
.stringType()
.defaultValue("flink:latest")
.withDescription("Image to use for Flink containers.");
/**
* The following config options need to be set according to the image.
*/
public static final ConfigOption KUBERNETES_ENTRY_PATH =
key("kubernetes.entry.path")
.stringType()
.defaultValue("/opt/flink/bin/kubernetes-entry.sh")
.withDescription("The entrypoint script of kubernetes in the image. It will be used as command for jobmanager " +
"and taskmanager container.");
public static final ConfigOption FLINK_CONF_DIR =
key("kubernetes.flink.conf.dir")
.stringType()
.defaultValue("/opt/flink/conf")
.withDescription("The flink conf directory that will be mounted in pod. The flink-conf.yaml, log4j.properties, " +
"logback.xml in this path will be overwritten from config map.");
public static final ConfigOption FLINK_LOG_DIR =
key("kubernetes.flink.log.dir")
.stringType()
.defaultValue("/opt/flink/log")
.withDescription("The directory that logs of jobmanager and taskmanager be saved in the pod.");
public static final ConfigOption HADOOP_CONF_CONFIG_MAP =
key("kubernetes.hadoop.conf.config-map.name")
.stringType()
.noDefaultValue()
.withDescription("Specify the name of an existing ConfigMap that contains custom Hadoop configuration " +
"to be mounted on the JobManager(s) and TaskManagers.");
public static final ConfigOption
© 2015 - 2025 Weber Informatics LLC | Privacy Policy