{"id":19378931,"url":"https://github.com/linbit/charmed-linstor","last_synced_at":"2025-02-24T16:26:26.144Z","repository":{"id":66192250,"uuid":"480292590","full_name":"LINBIT/charmed-linstor","owner":"LINBIT","description":"Juju charm for deploying LINBIT SDS / Piraeus-Datastore on a Kubernetes cluster","archived":false,"fork":false,"pushed_at":"2022-06-01T15:27:37.000Z","size":103,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-02-13T00:33:50.017Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LINBIT.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-11T08:30:40.000Z","updated_at":"2024-06-20T10:28:07.000Z","dependencies_parsed_at":"2023-02-25T06:45:55.429Z","dependency_job_id":null,"html_url":"https://github.com/LINBIT/charmed-linstor","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LINBIT%2Fcharmed-linstor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LINBIT%2Fcharmed-linstor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LINBIT%2Fcharmed-linstor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LINBIT%2Fcharmed-linstor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LINBIT","download_url":"https://codeload.github.com/LINBIT/charmed-linstor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240512002,"owners_count":19813394,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T09:08:01.282Z","updated_at":"2025-02-24T16:26:26.138Z","avatar_url":"https://github.com/LINBIT.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Charmed Linstor\n\nCharmed Operators for Kubernetes to deploy a LINSTOR cluster.\n\n# Usage\n\nSee [`./linstor`](./linstor).\n\n# Contributing\n\nTo build the charms, install [`charmcraft`] and run the following command in the checked out repository:\n\n```\n$ for charmmeta in */metadata.yaml ; do charmcraft pack -p $(dirname $charmmeta); done\nCreated 'linstor-controller.charm'.\nCreated 'linstor-csi-controller.charm'.\nCreated 'linstor-csi-node.charm'.\nCreated 'linstor-ha-controller.charm'.\nCreated 'linstor-satellite.charm'.\n```\n\nNow, assuming you have `juju` already configured for your cluster, run:\n\n```\n$ juju add-model linstor\n$ juju deploy ./linstor-controller.charm --resource linstor-controller-image=examples/linstor-controller.json\n$ juju deploy ./linstor-satellite.charm --resource linstor-satellite-image=examples/linstor-satellite.json --resource drbd-injector-image=examples/drbd-injector.json --config compile-module=true\n$ juju deploy ./linstor-csi-controller.charm --resource linstor-csi-image=examples/linstor-csi-controller.json --resource csi-snapshotter-image=k8s.gcr.io/sig-storage/csi-snapshotter:v3.0.3 --resource csi-resizer-image=k8s.gcr.io/sig-storage/csi-resizer:v1.1.0 --resource csi-provisioner-image=k8s.gcr.io/sig-storage/csi-provisioner:v2.1.2 --resource csi-liveness-probe-image=k8s.gcr.io/sig-storage/livenessprobe:v2.2.0 --resource csi-attacher-image=k8s.gcr.io/sig-storage/csi-attacher:v3.1.0\n$ juju deploy ./linstor-csi-node.charm --resource linstor-csi-image=examples/linstor-csi-node.json --resource csi-node-driver-registrar-image=k8s.gcr.io/sig-storage/csi-node-driver-registrar:v2.3.0 --config publish-path=/var/snap/microk8s/common/var/lib/kubelet/\n$ juju deploy ./linstor-ha-controller.charm --resource linstor-ha-controller-image=examples/linstor-ha-controller.json\n$ juju add-relation linstor-controller:linstor-api linstor-csi-controller:linstor\n$ juju add-relation linstor-controller:linstor-api linstor-csi-node:linstor\n$ juju add-relation linstor-satellite:satellite linstor-csi-node:satellite\n$ juju add-relation linstor-controller:linstor-api linstor-ha-controller:linstor\n```\n\nFor more information, take a look at the READMEs in each directory.\n\n[`charmcraft`]: https://github.com/canonical/charmcraft\n\n# Development\n\n## MicroK8s Quickstart\n\nFollow the instructions [here](https://juju.is/docs/sdk/dev-setup).\n\nTLDR:\n\n```\n$ snap install --classic microk8s\n2021-07-02T07:24:29Z INFO Waiting for automatic snapd restart...\nmicrok8s (1.21/stable) v1.21.1 from Canonical✓ installed\n$ microk8s enable storage dns rbac\n$ snap alias microk8s.kubectl kubectl\nAdded:\n  - microk8s.kubectl as kubectl\n$ snap alias microk8s.juju juju\nAdded:\n  - microk8s.juju as juju\n$ juju bootstrap microk8s micro\nCreating Juju controller \"micro\" on microk8s/localhost\nBootstrap to Kubernetes cluster identified as microk8s/localhost\nFetching Juju Dashboard 0.7.1\nCreating k8s resources for controller \"controller-micro\"\nDownloading images\nStarting controller pod\nBootstrap agent now started\nContacting Juju controller at 10.152.183.196 to verify accessibility...\n\nBootstrap complete, controller \"micro\" is now available in namespace \"controller-micro\"\n\nNow you can run\n\tjuju add-model \u003cmodel-name\u003e\nto create a new model to deploy k8s workloads.\n```\n\nYou can skip the next section and go directly to [Install Charms](#install-charms)\n\n## Other K8s clusters\n\nIf you are feeling adventurous, or you hate snaps, you can follow these instructions instead:\n\n```\n$ # Download juju cli from https://launchpad.net/juju/+download (insert appropriate URL below\n$ curl -fsSL https://launchpad.net/juju/2.9/2.9.7/+download/juju-2.9.7-linux-amd64.tar.xz | tar -xvJC ~/.local/bin\n./juju\n$ juju version\n2.9.7-genericlinux-amd64\n$ pip install --user charmcraft\n...\n$ charmcraft version\n1.0.0\n```\n\nNow add your k8s cluster to juju and bootstrap:\n\n```\n# Ensure kubectl is configured and has admin rights\n$ kubectl get nodes\n...\n$ # Add the kubernetes cluster to juju (can be skipped if using microk8s)\n$ juju add-k8s --context-name $(kubectl config current-context) --client k8s\nk8s substrate added as cloud \"k8s\" with storage provisioned\nby the existing \"local-storage\" storage class.\nYou can now bootstrap to this cloud by running 'juju bootstrap k8s'.\n$ juju bootstrap k8s\nCreating Juju controller \"k8s\" on k8s\nBootstrap to generic Kubernetes cluster\nFetching Juju Dashboard 0.7.1\nCreating k8s resources for controller \"controller-k8s\"\nDownloading images\nStarting controller pod\nBootstrap agent now started\nContacting Juju controller at 10.233.58.89 to verify accessibility...\nBootstrap complete, controller \"k8s\" is now available in namespace \"controller-k8s\"\n\nNow you can run\n\tjuju add-model \u003cmodel-name\u003e\nto create a new model to deploy k8s workloads.\n```\n\n# Install charms\n\nTo deploy charmed linstor, create a new model\n\n```\n$ juju add-model linstor\nAdded 'linstor' model with credential 'k8s' for user 'admin'\n```\n\nFirst you have to build the charms. You will have to re-build them if you make any changes\n\n```\n$ charmcraft build -f linstor-controller\nCreated 'linstor-controller.charm'.\n$ charmcraft build -f linstor-satellite\nCreated 'linstor-satellite.charm'.\n$ charmcraft build -f linstor-csi-controller\nCreated 'linstor-csi-controller.charm'.\n$ charmcraft build -f linstor-csi-node\nCreated 'linstor-csi-node.charm'.\n```\n\nThen you can deploy them. `juju` expects the images to be referenced as resources. See [`./example`](./examples) for how\nyou can reference images from private registries.\n\n```\n$ # Linstor optionally depends on a database. Right now only the postgres-k8s charm is supported\n$ # juju deploy postgresql-k8s\n$ juju deploy ./linstor-controller.charm --resource linstor-controller-image=examples/linstor-controller.json\nLocated local charm \"linstor-controller\", revision 0\nDeploying \"linstor-controller\" from local charm \"linstor-controller\", revision 0\n$ # Check out examples/drbd-injector.json to make sure you are using the right image for your distribution\n$ # If your kernel is supported, you can set --config compile-module=false\n$ juju deploy ./linstor-satellite.charm --resource linstor-satellite-image=examples/linstor-satellite.json --resource drbd-injector-image=examples/drbd-injector.json --config compile-module=true\nLocated local charm \"linstor-satellite\", revision 0\nDeploying \"linstor-satellite\" from local charm \"linstor-satellite\", revision 0\n$ # We can specify public image (like the ones for CSI) directly\n$ juju deploy ./linstor-csi-controller.charm --resource linstor-csi-image=examples/linstor-csi-controller.json --resource csi-snapshotter-image=k8s.gcr.io/sig-storage/csi-snapshotter:v4.2.1 --resource csi-resizer-image=k8s.gcr.io/sig-storage/csi-resizer:v1.3.0 --resource csi-provisioner-image=k8s.gcr.io/sig-storage/csi-provisioner:v2.2.2 --resource csi-liveness-probe-image=k8s.gcr.io/sig-storage/livenessprobe:v2.4.0 --resource csi-attacher-image=k8s.gcr.io/sig-storage/csi-attacher:v3.3.0\nLocated local charm \"linstor-csi-controller\", revision 0\nDeploying \"linstor-csi-controller\" from local charm \"linstor-csi-controller\", revision 0\n$ juju deploy ./linstor-csi-node.charm --resource linstor-csi-image=examples/linstor-csi-node.json --resource csi-node-driver-registrar-image=k8s.gcr.io/sig-storage/csi-node-driver-registrar:v2.3.0 --config publish-path=/var/snap/microk8s/common/var/lib/kubelet\nLocated local charm \"linstor-csi-node\", revision 0\nDeploying \"linstor-csi-node\" from local charm \"linstor-csi-node\", revision 0\n$ juju deploy ./linstor-ha-controller.charm --resource linstor-ha-controller-image=examples/linstor-ha-controller.json\nLocated local charm \"linstor-ha-controller\", revision 0\nDeploying \"linstor-ha-controller\" from local charm \"linstor-ha-controller\", revision 0\n```\n\nNow you will have the LINSTOR controller charm waiting and a database relation, and the CSI charms waiting for a\ncontroller relation. The following commands configures these relations.\n\n```\n$ juju status\nModel    Controller  Cloud/Region        Version  SLA          Timestamp\nlinstor  micro       microk8s/localhost  2.9.0    unsupported  12:54:37Z\n\nApp                     Version                    Status   Scale  Charm                   Store     Channel  Rev  OS          Address  Message\nlinstor-controller                                 blocked      1  linstor-controller      local                0  kubernetes           waiting for database relation\nlinstor-csi-controller                             blocked      1  linstor-csi-controller  local                0  kubernetes           waiting for linstor relation\nlinstor-csi-node                                   blocked      1  linstor-csi-node        local                0  kubernetes           waiting for linstor relation\nlinstor-ha-controller                              blocked      1  linstor-ha-controller   local                0  kubernetes           waiting for linstor relation\nlinstor-satellite       linstor-satellite:v1.13.0  active       1  linstor-satellite       local                0  kubernetes\npostgresql-k8s          .../postgresql@ed0e37f     active       1  postgresql-k8s          charmhub  stable     3  kubernetes\n\nUnit                       Workload  Agent  Address       Ports     Message\nlinstor-controller/0*      blocked   idle                           waiting for database relation\nlinstor-csi-controller/0*  blocked   idle                           waiting for linstor relation\nlinstor-csi-node/0*        blocked   idle                           waiting for linstor relation\nlinstor-ha-controller/0*   blocked   idle                           waiting for linstor relation\nlinstor-satellite/0*       active    idle   10.43.224.37  3366/TCP\npostgresql-k8s/0*          active    idle   10.1.142.163  5432/TCP  Pod configured\n$ juju add-relation linstor-controller:database postgresql-k8s:db\n$ juju add-relation linstor-controller:linstor-api linstor-csi-controller:linstor\n$ juju add-relation linstor-controller:linstor-api linstor-csi-node:linstor\n$ juju add-relation linstor-controller:linstor-api linstor-ha-controller:linstor\n$ # Wait a bit, and everything should be ready to go\n$ juju status\nModel    Controller  Cloud/Region        Version  SLA          Timestamp\nlinstor  micro       microk8s/localhost  2.9.0    unsupported  13:03:34Z\n\nApp                     Version                         Status  Scale  Charm                   Store     Channel  Rev  OS          Address        Message\nlinstor-controller      linstor-controller:v1.13.0      active      1  linstor-controller      local                1  kubernetes  10.152.183.69\nlinstor-csi-controller  linstor-csi:v0.13.1             active      1  linstor-csi-controller  local                0  kubernetes\nlinstor-csi-node        linstor-csi:v0.13.1             active      1  linstor-csi-node        local                0  kubernetes\nlinstor-ha-controller   linstor-k8s-ha-controller:v...  active      1  linstor-ha-controller   local                0  kubernetes\nlinstor-satellite       linstor-satellite:v1.13.0       active      1  linstor-satellite       local                0  kubernetes\npostgresql-k8s          .../postgresql@ed0e37f          active      1  postgresql-k8s          charmhub  stable     3  kubernetes\n\nUnit                       Workload  Agent  Address       Ports     Message\nlinstor-controller/1*      active    idle   10.1.142.157  3370/TCP\nlinstor-csi-controller/0*  active    idle   10.1.142.158\nlinstor-csi-node/0*        active    idle   10.1.142.153\nlinstor-ha-controller/0*   active    idle   10.1.142.180\nlinstor-satellite/0*       active    idle   10.43.224.37  3366/TCP\npostgresql-k8s/0*          active    idle   10.1.142.163  5432/TCP  Pod configured\n$ # We should also add the satellites to the controller, which can also be done using a relation\n$ juju add-relation linstor-controller:linstor-api linstor-satellite:linstor\n$ kubectl exec deployment/linstor-controller -- linstor n l\n+------------------------------------------------------------------------+\n| Node                | NodeType  | Addresses                   | State  |\n|========================================================================|\n| ubuntu-focal-k8s-10 | SATELLITE | 192.168.122.10:3366 (PLAIN) | Online |\n| ubuntu-focal-k8s-11 | SATELLITE | 192.168.122.11:3366 (PLAIN) | Online |\n+------------------------------------------------------------------------+\n$ # To automatically deploy the CSI driver on all nodes with satellites, use\n$ juju add-relation linstor-satellite:satellite linstor-csi-node:satellite\n```\n\nAnd that's it for now. You can create storage pools using the usual way by running the linstor command in the controller\ncontainer. `kubectl-linstor` does **_NOT_** work with charmed linstor. There are examples for storageclass/pvc/pods in\n[`/examples`](./examples).\n\n## Update\n\nIf you made changes to a charm, you can run these commands to update an existing application\n\n```\n$ # First rebuild the charm\n$ charmcraft build -f linstor-csi-controller\nCreated 'linstor-csi-controller.charm'.\n$ # Then update it\n$ juju refresh --path ./linstor-csi-controller.charm linstor-csi-controller\n```\n\n## Troubleshooting\n\nA collection of useful commands when developing\n\n```\n$ # Hopefully convince juju to continue if a charm errored out at some point. Find the name of the stuck unit with\n$ # juju status, in this example linstor-controller/1\n$ juju resolved linstor-controller/1\n$ # If the above command didn't manage it, you may need to remove the application\n$ juju remove-application linstor-controller\n$ # In some cases the above also gets stuck, then you can really force it\n$ juju remove-application linstor-satellite --force --no-wait\n```\n\n## Fixing charmcraft on non-ubuntu platforms\n\nCharms build on non-ubuntu platforms are rejected by `juju deploy` for some reason. To make them compatible, you can\ntrick `charmcraft` into writing the wrong metadata. Simply modify the `charmcraft/utils.py` file like shown below:\n\n```diff\n--- a.local/lib/python3.9/site-packages/charmcraft/utils.py.old\n+++ b.local/lib/python3.9/site-packages/charmcraft/utils.py\n@@ -205,12 +205,11 @@ def create_manifest(basedir, started_at):\n         'charmcraft-started-at': started_at.isoformat() + \"Z\",\n         'bases': [\n             {\n-                'name': name,\n-                'channel': channel,\n+                'name': 'ubuntu',\n+                'channel': '20.04',\n                 'architectures': architectures,\n             }\n         ],\n-\n     }\n     filepath = basedir / 'manifest.yaml'\n     if filepath.exists():\n```\n\nYou can find the file using the following command:\n\n```\n$ python3 -c \"import charmcraft.utils; print(charmcraft.utils.__file__)\"\n/home/test/.local/lib/python3.9/site-packages/charmcraft/utils.py\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinbit%2Fcharmed-linstor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinbit%2Fcharmed-linstor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinbit%2Fcharmed-linstor/lists"}