Deployment Defaults
Deployment resources have configurable defaults for attributes in their spec
section. This page describes how defaults apply to Deployment resources and how to customize them.
Overview
There are two levels of defaults for the spec section of Deployment resources, system-wide Global Deployment Defaults and Namespaced Deployment Defaults.
Configuration Source | URI |
---|---|
Deployment | /api/v1/namespaces/{name}/deployments |
DeploymentDefaults | /api/v1/namespaces/{name}/deployment-defaults |
GlobalDeploymentDefaults | /api/v1/global-deployment-defaults |
Namespaced Deployment Defaults override Global Deployment Defaults. The resulting set of default values is merged and applied to the spec of a Deployment resource during creation of the Deployment. If an attribute is manually specified in the Deployment resource, the default value is overwritten.
Global Deployment Defaults
Ververica Platform ships with built-in global defaults that are applied during Deployment creation in all Namespaces.
Users have read-only access to these defaults via the API at /api/v1/global-deployment-defaults.
Configuration
Administrators can selectively overwrite the built-in Global Deployment Defaults in the Platform configuration:
vvp:
globalDeploymentDefaults: |
spec:
upgradeStrategy:
kind: stateless
template:
spec:
flinkConfiguration:
restart-strategy: fixed-delay
restart-strategy.fixed-delay.attempts: 3
restart-strategy.fixed-delay.delay: 10 s
In the above snippet we overwrite the built-in global default for upgradeStrategy
and add three configuration entries to set the Apache Flink® restart strategy to fixed delay
.
The provided values are required to be a string. We recommend using the literal string notation using the |
symbol as in the example above when configuring the platform via YAML.
Example
In this example, we look at a minimal scenario where a user posts a Deployment resource given the above Global Deployment Defaults configuration.
The posted Deployment resource:
kind: Deployment
metadata:
name: my-deployment
spec:
upgradeStrategy:
kind: stateful
template:
spec:
parallelism: 1
flinkConfiguration:
state.backend: rocksdb
After posting the above Deployment resource, the resulting Deployment will have its upgrade strategy set to be stateful (overwriting the global default), parallelism of 1, and an additional Flink configuration entry for using the RocksDB state backend.
If there are no Namespace-specific default values configured, the resulting Deployment resource will be:
kind: Deployment
metadata:
name: my-deployment
spec:
upgradeStrategy:
kind: stateful
template:
spec:
parallelism: 1
flinkConfiguration:
restart-strategy: fixed-delay
restart-strategy.fixed-delay.attempts: 3
restart-strategy.fixed-delay.delay: 10 s
state.backend: rocksdb
In a real installation of Ververica Platform more attributes are provided as part of the built-in Global Deployment Defaults, resulting in more values to be pre-filled. If you are interested in the full set of defaults, check out the /api/v1/global-deployment-defaults
endpoint.
Namespaced Deployment Defaults
Each Namespace has a DeploymentDefaults resource that can provide Namespace-specific defaults that take precedence over global defaults in the respective Namespace.
Configuration
Users can read and modify this resource at /api/v1/namespace/{name}/deployment-defaults similar to other API resources using GET and PATCH requests. If authorization is enabled, users need to have the viewer role to read and the owner role to modify this resource.
Initially, the DeploymentDefaults of each Namespace will have an empty spec section. In this case, only the Global Deployment Defaults determine which values to use as defaults.
Example
In this example, we look at a minimal scenario where a user posts a Deployment resource given the following Namespaced Deployment Defaults:
kind: DeploymentDefaults
apiVersion: v1
metadata:
id: 4ab0a579-7de2-452f-885e-ce03bbd0d917
name: default
namespace: default
createdAt: 2019-12-12T14:55:27.870Z
modifiedAt: 2019-12-12T14:55:27.870Z
resourceVersion: 1
spec:
template:
upgradeStrategy:
kind: stateful
template:
spec:
flinkConfiguration:
restart-strategy.fixed-delay.attempts: 10
Attributes in the Namespaced Deployment Defaults are merged with the attributes in the Global Deployment Defaults, following JSON patch semantics.
The posted Deployment resource:
kind: Deployment
metadata:
name: my-deployment
spec:
template:
spec:
parallelism: 1
flinkConfiguration:
state.backend: rocksd
In combination with the Global Deployment Defaults example from above, this will result in Deployments created in this Namespace to have a stateful
upgrade strategy and 10 restart attempts instead of the globally defined stateless upgrade strategy and 3 restart attempts. Additionally, the user-provided Deployment will set the parallelism to 1 and configure the RocksDB state backend.
The resulting Deployment resource:
kind: Deployment
metadata:
name: my-deployment
spec:
upgradeStrategy:
kind: stateful
template:
spec:
parallelism: 1
flinkConfiguration:
restart-strategy: fixed-delay
restart-strategy.fixed-delay.attempts: 10
restart-strategy.fixed-delay.delay: 10 s
state.backend: rocksdb
Note that it is not possible to unset global defaults in Namespace defaults, but only overwrite them. If you need to unset a default, you can accomplish this by sending a null
value for the respective attributes when creating the Deployment.
Placeholders in {flink} Configuration
The following placeholders can be used in spec.template.spec.flinkConfiguration
:
{{ namespace }}
: Namespace of the Deployment resource.{{ deploymentId }}
: ID of Deployment resource.{{ deploymentName }}
: Name of Deployment resource.{{ jobId }}
: ID of the Job resource.
When used as values in JSON or YAML, the placeholders must be quoted to ensure they are parsed as strings.
Please be aware that the placeholders will only be resolved during Job resource creation, not when the Deployment resource is created.