{"id":13818006,"url":"https://github.com/redhat-cop/volume-expander-operator","last_synced_at":"2025-04-09T22:02:05.796Z","repository":{"id":40663080,"uuid":"305887889","full_name":"redhat-cop/volume-expander-operator","owner":"redhat-cop","description":null,"archived":false,"fork":false,"pushed_at":"2024-04-05T02:40:48.000Z","size":418,"stargazers_count":17,"open_issues_count":15,"forks_count":12,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-04-09T22:01:44.302Z","etag":null,"topics":["container-cop","k8s-operator"],"latest_commit_sha":null,"homepage":"","language":"Go","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/redhat-cop.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":"2020-10-21T02:36:07.000Z","updated_at":"2024-08-21T01:52:12.000Z","dependencies_parsed_at":"2024-01-18T01:13:10.252Z","dependency_job_id":"3fbc4b48-0a91-4564-b9dd-9be864d28624","html_url":"https://github.com/redhat-cop/volume-expander-operator","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhat-cop%2Fvolume-expander-operator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhat-cop%2Fvolume-expander-operator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhat-cop%2Fvolume-expander-operator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhat-cop%2Fvolume-expander-operator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redhat-cop","download_url":"https://codeload.github.com/redhat-cop/volume-expander-operator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248119296,"owners_count":21050755,"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":["container-cop","k8s-operator"],"created_at":"2024-08-04T07:00:26.772Z","updated_at":"2025-04-09T22:02:05.747Z","avatar_url":"https://github.com/redhat-cop.png","language":"Go","funding_links":[],"categories":["Storage"],"sub_categories":[],"readme":"# Volume Expander Operator\n\nThe purpose of the volume-expander-operator is to expand volumes when they are running out of space.\nThis is achieved by using the [volume expansion feature](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#expanding-persistent-volumes-claims).\n\nThe operator periodically checks the `kubelet_volume_stats_used_bytes` and `kubelet_volume_stats_capacity_bytes` published by the kubelets to decide when to expand a volume.\nNotice that these metrics are generated only when a volume is mounted to a pod. Also the kubelet takes a minute or two to start generating accurate values for these metrics. The operator accounts for that.\n\nThis operator works based on the following annotations to PersistentVolumeClaim resources:\n\n| Annotation | Default  | Description  |\n| :-- | :-- | :-- |\n| `volume-expander-operator.redhat-cop.io/autoexpand`  | N/A  | if set to \"true\" enables the volume-expander-operator to watch on this PVC  |\n| `volume-expander-operator.redhat-cop.io/polling-frequency`  | `\"30s\"` | How frequently to poll the volume metrics. Express this value as a valid golang [Duration](https://golang.org/pkg/time/#ParseDuration)  |\n| `volume-expander-operator.redhat-cop.io/expand-threshold-percent` | `\"80\"` | the percentage of used storage after which the volume will be expanded. This must be a positive integer. |\n| `volume-expander-operator.redhat-cop.io/expand-by-percent` | `\"25\"` | the percentage by which the volume will be expanded, relative to the current size. This must be an integer between 0 and 100 |\n| `volume-expander-operator.redhat-cop.io/expand-up-to` | MaxInt64 | the upper bound for this volume to be expanded to. The default value is the largest quantity representable and is intended to be interpreted as infinite. If the default is used it is recommend to ensure the namespace has a quota on the used storage class. |\n\nNote that not all of the storage driver implementations support volume expansion. It is a responsibility of the user/platform administrator to ensure that storage class and the persistent volume claim meet all the requirements needed for the volume expansion feature to work properly.\n\nThis operator was tested with [OCS](https://www.redhat.com/en/technologies/cloud-computing/openshift-container-storage), but should work with any other storage driver that supports volume expansion.\n\n## Deploying the Operator\n\nThis is a cluster-level operator that you can deploy in any namespace, `volume-expander-operator` is recommended.\n\nIt is recommended to deploy this operator via [`OperatorHub`](https://operatorhub.io/), but you can also deploy it using [`Helm`](https://helm.sh/).\n\n### Multiarch Support\n\n| Arch  | Support  |\n|:-:|:-:|\n| amd64  | ✅ |\n| arm64  | ✅  |\n| ppc64le  | ✅  |\n| s390x  | ✅  |\n\n### Deploying from OperatorHub\n\n\u003e **Note**: This operator supports being installed disconnected environments\n\nIf you want to utilize the Operator Lifecycle Manager (OLM) to install this operator, you can do so in two ways: from the UI or the CLI.\n\n#### Deploying from OperatorHub UI\n\n- If you would like to launch this operator from the UI, you'll need to navigate to the OperatorHub tab in the console.Before starting, make sure you've created the namespace that you want to install this operator to with the following:\n\n```shell\noc new-project volume-expander-operator\n```\n\n- Once there, you can search for this operator by name: `volume expander operator`. This will then return an item for our operator and you can select it to get started. Once you've arrived here, you'll be presented with an option to install, which will begin the process.\n- After clicking the install button, you can then select the namespace that you would like to install this to as well as the installation strategy you would like to proceed with (`Automatic` or `Manual`).\n- Once you've made your selection, you can select `Subscribe` and the installation will begin. After a few moments you can go ahead and check your namespace and you should see the operator running.\n\n![Volume Expander Operator](./media/volume-expander-operator.png)\n\n#### Deploying from OperatorHub using CLI\n\nIf you'd like to launch this operator from the command line, you can use the manifests contained in this repository by running the following:\n\noc new-project volume-expander-operator\n\n```shell\noc apply -f config/operatorhub -n volume-expander-operator\n```\n\nThis will create the appropriate OperatorGroup and Subscription and will trigger OLM to launch the operator in the specified namespace.\n\n### Deploying with Helm\n\nHere are the instructions to install the latest release with Helm.\n\n```shell\noc new-project volume-expander-operator\nhelm repo add volume-expander-operator https://redhat-cop.github.io/volume-expander-operator\nhelm repo update\nhelm install volume-expander-operator volume-expander-operator/volume-expander-operator\n```\n\nThis can later be updated with the following commands:\n\n```shell\nhelm repo update\nhelm upgrade volume-expander-operator volume-expander-operator/volume-expander-operator\n```\n\n## Metrics\n\nPrometheus compatible metrics are exposed by the Operator and can be integrated into OpenShift's default cluster monitoring. To enable OpenShift cluster monitoring, label the namespace the operator is deployed in with the label `openshift.io/cluster-monitoring=\"true\"`.\n\n```shell\noc label namespace \u003cnamespace\u003e openshift.io/cluster-monitoring=\"true\"\n```\n\n### Testing metrics\n\n```sh\nexport operatorNamespace=volume-expander-operator-local # or volume-expander-operator\noc label namespace ${operatorNamespace} openshift.io/cluster-monitoring=\"true\"\noc rsh -n openshift-monitoring -c prometheus prometheus-k8s-0 /bin/bash\nexport operatorNamespace=volume-expander-operator-local # or volume-expander-operator\ncurl -v -s -k -H \"Authorization: Bearer $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)\" https://volume-expander-operator-controller-manager-metrics.${operatorNamespace}.svc.cluster.local:8443/metrics\nexit\n```\n\n## Development\n\n### Running the operator locally\n\n\u003e Note: this operator build process is tested with [podman](https://podman.io/), but some of the build files (Makefile specifically) use docker because they are generated automatically by operator-sdk. It is recommended [remap the docker command to the podman command](https://developers.redhat.com/blog/2020/11/19/transitioning-from-docker-to-podman#transition_to_the_podman_cli).\n\n```shell\nexport repo=raffaelespazzoli\ndocker login quay.io/$repo\noc new-project volume-expander-operator\noc project volume-expander-operator\ntilt up\n```\n\n### Test helm chart locally\n\nDefine an image and tag. For example...\n\n```shell\nexport imageRepository=\"quay.io/redhat-cop/volume-expander-operator\"\nexport imageTag=\"$(git -c 'versionsort.suffix=-' ls-remote --exit-code --refs --sort='version:refname' --tags https://github.com/redhat-cop/volume-expander-operator.git '*.*.*' | tail --lines=1 | cut --delimiter='/' --fields=3)\"\n```\n\nDeploy chart...\n\n```shell\nmake helmchart IMG=${imageRepository} VERSION=${imageTag}\nhelm upgrade -i volume-expander-operator-local charts/volume-expander-operator -n volume-expander-operator-local --create-namespace\n```\n\nDelete...\n\n```shell\nhelm delete volume-expander-operator-local -n volume-expander-operator-local\n```\n\n### Building/Pushing the operator image\n\n```shell\nexport repo=raffaelespazzoli #replace with yours\ndocker login quay.io/$repo\nmake docker-build IMG=quay.io/$repo/volume-expander-operator:latest\nmake docker-push IMG=quay.io/$repo/volume-expander-operator:latest\n```\n\n### Deploy to OLM via bundle\n\n```shell\nmake manifests\nmake bundle IMG=quay.io/$repo/volume-expander-operator:latest\noperator-sdk bundle validate ./bundle --select-optional name=operatorhub\nmake bundle-build BUNDLE_IMG=quay.io/$repo/volume-expander-operator-controller-bundle:latest\ndocker push quay.io/$repo/volume-expander-operator-controller-bundle:latest\noperator-sdk bundle validate quay.io/$repo/volume-expander-operator-controller-bundle:latest --select-optional name=operatorhub\noc new-project volume-expander-operator\noc label namespace volume-expander-operator openshift.io/cluster-monitoring=\"true\"\noperator-sdk cleanup volume-expander-operator -n volume-expander-operator\noperator-sdk run bundle --install-mode AllNamespaces -n volume-expander-operator quay.io/$repo/volume-expander-operator-controller-bundle:latest\n```\n\n### Testing\n\n#### Manual tests\n\n```shell\noc new-project volume-expander-operator-test\noc apply -f ./test/volume.yaml -n volume-expander-operator-test\noc apply -f ./test/deployment.yaml -n volume-expander-operator-test\n```\n\n## Releasing\n\n```shell\ngit tag -a \"\u003ctagname\u003e\" -m \"\u003ccommit message\u003e\"\ngit push upstream \u003ctagname\u003e\n```\n\nIf you need to remove a release:\n\n```shell\ngit tag -d \u003ctagname\u003e\ngit push upstream --delete \u003ctagname\u003e\n```\n\nIf you need to \"move\" a release to the current main\n\n```shell\ngit tag -f \u003ctagname\u003e\ngit push upstream -f \u003ctagname\u003e\n```\n\n### Cleaning up\n\n```shell\noperator-sdk cleanup volume-expander-operator -n volume-expander-operator\noc delete operatorgroup operator-sdk-og\noc delete catalogsource volume-expander-operator-catalog\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredhat-cop%2Fvolume-expander-operator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredhat-cop%2Fvolume-expander-operator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredhat-cop%2Fvolume-expander-operator/lists"}