Docs Home
Viewing docs for
Self-ManagedNot available for BYOC

Deployment Defaults

On this page

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

YAML
1vvp:
2  globalDeploymentDefaults: |
3    spec:
4      upgradeStrategy:
5        kind: stateless
6      template:
7        spec:
8          flinkConfiguration:
9            restart-strategy: fixed-delay
10            restart-strategy.fixed-delay.attempts: 3
11            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.

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:

YAML
1kind: Deployment
2metadata:
3  name: my-deployment
4spec:
5  upgradeStrategy:
6    kind: stateful
7  template:
8    spec:
9      parallelism: 1
10      flinkConfiguration:
11        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:

YAML
1kind: Deployment
2metadata:
3  name: my-deployment
4spec:
5  upgradeStrategy:
6    kind: stateful
7template:
8  spec:
9    parallelism: 1
10    flinkConfiguration:
11      restart-strategy: fixed-delay
12      restart-strategy.fixed-delay.attempts: 3
13      restart-strategy.fixed-delay.delay: 10 s
14      state.backend: rocksdb

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:

YAML
1kind: DeploymentDefaults
2apiVersion: v1
3metadata:
4  id: 4ab0a579-7de2-452f-885e-ce03bbd0d917
5  name: default
6  namespace: default
7  createdAt: 2019-12-12T14:55:27.870Z
8  modifiedAt: 2019-12-12T14:55:27.870Z
9  resourceVersion: 1
10spec:
11  template:
12    upgradeStrategy:
13      kind: stateful
14    template:
15      spec:
16        flinkConfiguration:
17          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:

YAML
1kind: Deployment
2metadata:
3  name: my-deployment
4spec:
5  template:
6    spec:
7      parallelism: 1
8      flinkConfiguration:
9        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:

YAML
1kind: Deployment
2metadata:
3  name: my-deployment
4spec:
5  upgradeStrategy:
6    kind: stateful
7template:
8  spec:
9    parallelism: 1
10    flinkConfiguration:
11      restart-strategy: fixed-delay
12      restart-strategy.fixed-delay.attempts: 10
13      restart-strategy.fixed-delay.delay: 10 s
14      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.

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.
Was this helpful?