Skip to content

Commit

Permalink
feat: Decommissioning PostgreSQL database
Browse files Browse the repository at this point in the history
Signed-off-by: Ilya Buziuk <[email protected]>
  • Loading branch information
ibuziuk committed Mar 17, 2023
1 parent fced074 commit ef01b23
Show file tree
Hide file tree
Showing 4 changed files with 158 additions and 0 deletions.
158 changes: 158 additions & 0 deletions _posts/2023-03-20-decommissioning-postgresql-database.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
---
title: Decommissioning PostgreSQL database
layout: post
author: Ilya Buziuk
description: >-
The article describes how the PostgreSQL database dependency has been removed in {prod}
categories: []
keywords: ['postgresql']
slug: /@ilya.buziuk/decommissioning-postgresql-database
---

Historically {prod} used PostgreSQL database for storing relevant information about the users, workspaces, devfiles, preferences, SSH keys, etc.
Overall there were dozens of tables in the database which represent the state of the {prod} instance:

[source,bash]
----
psql (13.7)
Type "help" for help.
dbche=> \dt
List of relations
Schema | Name | Type | Owner
--------+-------------------------------------------------+-------+-------
public | account | table | pgche
public | che_factory | table | pgche
public | che_factory_action | table | pgche
public | che_factory_action_properties | table | pgche
public | che_factory_ide | table | pgche
public | che_factory_on_app_closed_action | table | pgche
public | che_factory_on_app_closed_action_value | table | pgche
public | che_factory_on_app_loaded_action | table | pgche
public | che_factory_on_app_loaded_action_value | table | pgche
public | che_factory_on_projects_loaded_action | table | pgche
public | che_factory_on_projects_loaded_action_value | table | pgche
public | che_free_resources_limit | table | pgche
public | che_free_resources_limit_resource | table | pgche
public | che_k8s_machine | table | pgche
public | che_k8s_machine_attributes | table | pgche
public | che_k8s_runtime | table | pgche
public | che_k8s_server | table | pgche
public | che_k8s_server_attributes | table | pgche
public | che_member | table | pgche
public | che_member_actions | table | pgche
public | che_organization | table | pgche
public | che_organization_distributed_resources | table | pgche
public | che_organization_distributed_resources_resource | table | pgche
public | che_resource | table | pgche
public | che_sign_key | table | pgche
public | che_sign_key_pair | table | pgche
public | che_system_permissions | table | pgche
public | che_system_permissions_actions | table | pgche
public | che_userdevfile_permissions | table | pgche
public | che_userdevfile_permissions_actions | table | pgche
public | che_worker | table | pgche
public | che_worker_actions | table | pgche
public | che_workspace_activity | table | pgche
public | che_workspace_cfg_attributes | table | pgche
public | command | table | pgche
public | command_attributes | table | pgche
public | devfile | table | pgche
public | devfile_action | table | pgche
public | devfile_attributes | table | pgche
public | devfile_command | table | pgche
public | devfile_command_attributes | table | pgche
public | devfile_component | table | pgche
public | devfile_component_arg | table | pgche
public | devfile_component_command | table | pgche
public | devfile_component_preferences | table | pgche
public | devfile_component_selector | table | pgche
public | devfile_endpoint | table | pgche
public | devfile_endpoint_attributes | table | pgche
public | devfile_entrypoint | table | pgche
public | devfile_entrypoint_arg | table | pgche
public | devfile_entrypoint_commands | table | pgche
public | devfile_entrypoint_selector | table | pgche
public | devfile_env | table | pgche
public | devfile_project | table | pgche
public | devfile_volume | table | pgche
public | environment | table | pgche
public | externalmachine | table | pgche
public | externalmachine_attributes | table | pgche
public | externalmachine_env | table | pgche
public | k8s_runtime_command | table | pgche
public | k8s_runtime_command_attributes | table | pgche
public | machine_volume | table | pgche
public | preference | table | pgche
public | preference_preferences | table | pgche
public | profile | table | pgche
public | profile_attributes | table | pgche
public | projectattribute | table | pgche
public | projectattribute_values | table | pgche
public | projectconfig | table | pgche
public | projectconfig_mixins | table | pgche
public | schema_version | table | pgche
public | sequence | table | pgche
public | serverconf | table | pgche
public | serverconf_attributes | table | pgche
public | serverconf_properties | table | pgche
public | sourcestorage | table | pgche
public | sourcestorage_parameters | table | pgche
public | sshkeypair | table | pgche
public | user_aliases | table | pgche
public | userdevfile | table | pgche
public | usr | table | pgche
public | workspace | table | pgche
public | workspace_attributes | table | pgche
public | workspaceconfig | table | pgche
(84 rows)
----
{nbsp} +

However, with the switch to link:https://che.eclipseprojects.io/2021/10/12/@mario.loriedo-devfile-v2-and-the-devworkspace-operator-p1.html[DevWorkspace Operator], all this data become irrelevant since we start using native Kubernetes resources instead.
For instance, SSH keys are now configured using the dedicated link:https://github.com/devfile/devworkspace-operator/blob/main/docs/additional-configuration.adoc#configuring-devworkspaces-to-use-ssh-keys-for-git-operations[secret].

Starting from {prod} `7.62.0` version PostgreSQL operand cease to exist and we now only have 5 operands: Che Server, Dashboard, Plugin Registry, Devfile Registry, and Gateway.

image::/assets/img/decommissioning-postgresql-database/operands.png[{prod} operands]

From now on, all the relevant data is stored as Kubernetes resources such as Secrets and ConfigMaps in the user namespaces which makes database enty irrelevant.

image::/assets/img/decommissioning-postgresql-database/secrets.png[Secrets from the user namespace]

{nbsp} +

image::/assets/img/decommissioning-postgresql-database/configmaps.png[ConfigMaps from the user namespace]

It also worth mentioning that most of the https://<che_fqdn>/swagger endpoints are now deprecated. The only endpoints that are not going to be deprecated are related to namespace provisioning, factory, and Git OAuth flow:

- /kubernetes/namespace/*
- /factory/*
- /oauth/*

== Next steps

Decommissioning a PostgreSQL database in favor of native Kubernetes provides several benefits, including improved scalability, flexibility, and easier management of resources.
Ultimately, moving away from traditional database architectures and embracing Kubernetes makes {prod} agile and competitive in an increasingly complex and demanding technology landscape.
In the next {prod} releases we plan to make it possible to configure a number of replicas for operands from the CheCluster CustomResource:

[source,bash]
spec:
components:
cheServer:
deployment:
replicas: 1
dashboard:
deployment:
replicas: 1
devfileRegistry:
deployment:
replicas: 1
pluginRegistry:
deployment:
replicas: 1
[source,bash]

The progess can be tracked in the upstream link:https://github.com/eclipse/che/issues/22067[issue].
We anticipate receiving your valuable feedback, comments, remarks, and proposals on our link:https://accounts.eclipse.org/mailing-list/che-dev[mailing list], link:https://github.com/eclipse/che/issues[GitHub], and link:https://mattermost.eclipse.org/eclipse/channels/eclipse-che[Mattermost].
We wish you an enjoyable and productive coding experience with {prod}!
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ef01b23

Please sign in to comment.