crate.operator.upgrade module

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

Bases: StateBasedSubHandler

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

Parameters
  • namespace (str) –

  • name (str) –

  • ref (str) –

  • context (dict) –

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)

Bases: StateBasedSubHandler

Parameters
  • namespace (str) –

  • name (str) –

  • ref (str) –

  • context (dict) –

async handle(namespace, name, body, old, logger, **kwargs)
Parameters
async crate.operator.upgrade.update_statefulset(apps, namespace, sts_name, crate_image, old_version, new_version, data_nodes_count, logger)
Parameters
  • apps (AppsV1Api) –

  • namespace (str) –

  • sts_name (str) –

  • crate_image (str) –

  • old_version (str) –

  • new_version (str) –

  • data_nodes_count (int) –

  • logger (Logger) –

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