crate.operator.upgrade module

class crate.operator.upgrade.AfterUpgradeSubHandler(namespace, name, ref, context, depends_on=None, run_on_dep_failures=False, operation=None)

Bases: StateBasedSubHandler

A handler which depends on upgrade and restart having finished successfully and sends a success notification of the upgrade process.

Parameters:
async handle(namespace, name, body, old, logger, **kwargs)
Parameters:
class crate.operator.upgrade.BeforeUpgradeSubHandler(namespace, name, ref, context, depends_on=None, run_on_dep_failures=False, operation=None)

Bases: StateBasedSubHandler

A handler which checks if there are any resources created with an old crateDB version.

Parameters:
async handle(namespace, name, body, old, logger, **kwargs)
Parameters:
class crate.operator.upgrade.UpgradeSubHandler(namespace, name, ref, context, depends_on=None, run_on_dep_failures=False, operation=None)

Bases: StateBasedSubHandler

Parameters:
async handle(namespace, name, body, old, logger, **kwargs)
Parameters:
async crate.operator.upgrade.check_reindexing_tables(core, namespace, name, body, old, logger)

Check if there are any tables that need re-indexing before a major version upgrade.

Parameters:
  • core (CoreV1Api) – An instance of the Kubernetes Core V1 API.

  • namespace (str) – The Kubernetes namespace for the CrateDB cluster.

  • name (str) – The name for the CrateDB custom resource.

  • body (Body) – The full body of the CrateDB custom resource per kopf.Body.

  • old (Body) – The old resource body. Required to get the old version.

  • logger (Logger)

async crate.operator.upgrade.check_unsafe_upgrade_paths(core, namespace, name, body, old, logger)

Block upgrades to CrateDB 6.0.0–6.0.5 if the cluster contains tables created before CrateDB 5.5, which are affected by a data-loss bug.

Parameters:
  • core (CoreV1Api) – An instance of the Kubernetes Core V1 API.

  • namespace (str) – The Kubernetes namespace for the CrateDB cluster.

  • name (str) – The name for the CrateDB custom resource.

  • body (Body) – The full body of the CrateDB custom resource per kopf.Body.

  • old (Body) – The old resource body. Required to get the old version.

  • logger (Logger)

async crate.operator.upgrade.recreate_internal_tables(core, namespace, name, body, old, logger)

Re-create internal tables that may have been created with an old CrateDB major version.

Parameters:
  • core (CoreV1Api) – An instance of the Kubernetes Core V1 API.

  • namespace (str) – The Kubernetes namespace for the CrateDB cluster.

  • name (str) – The name for the CrateDB custom resource.

  • body (Body) – The full body of the CrateDB custom resource per kopf.Body.

  • old (Body) – The old resource body. Required to get the old version.

  • logger (Logger)

async crate.operator.upgrade.update_statefulset(apps, namespace, sts_name, crate_image, old_version, new_version, data_nodes_count, name, cloud_settings, logger)
Parameters:
async crate.operator.upgrade.upgrade_cluster(apps, namespace, name, body, old, logger)

Update the Docker image in all StatefulSets for the cluster.

For the changes to take affect, the cluster needs to be restarted.

Parameters:
  • apps (AppsV1Api) – An instance of the Kubernetes Apps V1 API.

  • namespace (str) – The Kubernetes namespace for the CrateDB cluster.

  • name (str) – The name for the CrateDB custom resource.

  • body (Body) – The full body of the CrateDB custom resource per kopf.Body.

  • old (Body) – The old resource body. Required to get the old version.

  • logger (Logger)

crate.operator.upgrade.upgrade_command_data_nodes(old_command, total_data_nodes)

Iterate through the old_command items and upgrade the setting’s names where required in versions >= 4.7.

Return the list making up the new CrateDB command.

Parameters:
  • old_command (List[str]) – The command used to start-up CrateDB inside a Kubernetes container. This consists of the path to the Docker entrypoint script, the crate command argument and any additional settings.

  • total_data_nodes (int) – The number of data nodes that will be in the CrateDB cluster. From that, the quorum is derived as well.

Return type:

List[str]

Returns:

The list forming the new CrateDB command.

crate.operator.upgrade.upgrade_command_global_jwt_config(command, name, cloud_settings)
Parameters:
Return type:

List[str]

crate.operator.upgrade.upgrade_command_hostname_and_zone(old_command)

Replace old patterns using rev | cut with new awk-based equivalents.

Return the list making up the new CrateDB command.

Parameters:

old_command (List[str]) – The command used to start-up CrateDB inside a Kubernetes container. This consists of the path to the Docker entrypoint script, the crate command argument and any additional settings.

Return type:

List[str]

Returns:

The list forming the new CrateDB command.

crate.operator.upgrade.upgrade_command_jwt_auth(command)

Add the settings required for JWT authentication if they are not present yet.

Return the list making up the new CrateDB command.

Parameters:
  • old_command – The command used to start-up CrateDB inside a Kubernetes container. This consists of the path to the Docker entrypoint script, the crate command argument and any additional settings.

  • command (List[str])

Return type:

List[str]

Returns:

The list forming the new CrateDB command.