{"id":18293096,"url":"https://github.com/kubesphere/pvc-autoresizer","last_synced_at":"2025-04-05T11:30:52.468Z","repository":{"id":44554878,"uuid":"438559867","full_name":"kubesphere/pvc-autoresizer","owner":"kubesphere","description":"pvc-autoresizer resizes PersistentVolumeClaims (PVCs) when the free amount of storage is below the threshold.","archived":false,"fork":false,"pushed_at":"2024-01-23T02:38:37.000Z","size":97,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-04-13T21:43:07.221Z","etag":null,"topics":[],"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/kubesphere.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}},"created_at":"2021-12-15T08:55:09.000Z","updated_at":"2023-10-17T14:10:28.000Z","dependencies_parsed_at":"2024-01-23T03:47:32.488Z","dependency_job_id":null,"html_url":"https://github.com/kubesphere/pvc-autoresizer","commit_stats":{"total_commits":16,"total_committers":5,"mean_commits":3.2,"dds":0.5625,"last_synced_commit":"72e47693725e60ae80099918fb005d23b2e4ce28"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kubesphere%2Fpvc-autoresizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kubesphere%2Fpvc-autoresizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kubesphere%2Fpvc-autoresizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kubesphere%2Fpvc-autoresizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kubesphere","download_url":"https://codeload.github.com/kubesphere/pvc-autoresizer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223184131,"owners_count":17102009,"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-05T14:21:58.282Z","updated_at":"2024-11-05T14:21:58.892Z","avatar_url":"https://github.com/kubesphere.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NOTICE\n\nThis repo is forked from [topolvm/pvc-autoresizer](https://github.com/topolvm/pvc-autoresizer) .This one adds storage class level control and automatic restart of workloads on top of that.\n# pvc-autoresizer\n\n`pvc-autoresizer` resizes PersistentVolumeClaims (PVCs) when the free amount of storage is below the threshold.\nIt queries the volume usage metrics from Prometheus that collects metrics from `kubelet`.\n\n**Status**: beta\n\n## Target CSI Drivers\n\n`pvc-autoresizer` supports CSI Drivers that meet the following requirements:\n\n- implement [Volume Expansion](https://kubernetes-csi.github.io/docs/volume-expansion.html).\n- implement [NodeGetVolumeStats](https://github.com/container-storage-interface/spec/blob/master/spec.md#nodegetvolumestats)\n\n## Prepare\n\n`pvc-autoresizer` behaves based on the metrics that prometheus collects from kubelet.\n\nPlease refer to the following pages to set up Prometheus:\n\n- [Installation | Prometheus](https://prometheus.io/docs/prometheus/latest/installation/)\n\n## Installation\n\nSpecify the Prometheus URL to `pvc-autoresizer` argument as `--prometheus-url`.\n\n`pvc-autoresizer` can be deployed to a Kubernetes cluster via `helm`:\n\n```sh\nhelm install --create-namespace --namespace pvc-autoresizer pvc-autoresizer pvc-autoresizer/pvc-autoresizer --set \"controller.args.prometheusURL=\u003cYOUR PROMETHEUS ENDPOINT\u003e\"\n```\n\nSee the Chart [README.md](https://github.com/kubesphere/helm-charts/tree/master/src/main/pvc-autoresizer) for detailed documentation on the Helm Chart.\n\n## How to use\n### pvc-autoresize\nTo allow auto volume expansion, the StorageClass of PVC need to allow volume expansion and\nhave `resize.kubesphere.io/enabled: \"true\"` annotation.  The annotation may be omitted if\nyou give `--no-annotation-check` command-line flag to `pvc-autoresizer` executable.\n\n```yaml\nkind: StorageClass\napiVersion: storage.k8s.io/v1\nmetadata:\n  name: csi-qingcloud\n  annotations:\n    resize.kubesphere.io/enabled: \"true\"\nprovisioner: csi-qingcloud\nallowVolumeExpansion: true\n```\n\nTo allow auto volume expansion, the PVC to be resized need to specify the upper limit of\nvolume size with the annotation `resize.kubesphere.io/storage_limit`. The PVC must have `volumeMode: Filesystem` too.\nYou can also set the upper limit of volume size with `.spec.resources.limits.storage`, but it is deprecated. If both are present, the annotation takes precedence.\n\n```yaml\nkind: PersistentVolumeClaim\napiVersion: v1\nmetadata:\n  name: test-pvc\n  namespace: default\n  annotations:\n    resize.kubesphere.io/storage-limit: 100Gi\nspec:\n  accessModes:\n  - ReadWriteOnce\n  volumeMode: Filesystem\n  resources:\n    requests:\n      storage: 30Gi\n  storageClassName: csi-qingcloud\n```\n\nThe PVC can optionally have `resize.kubesphere.io/threshold` and `resize.kubepshere.io/increase` annotations.\n(If they are not given, the default value is `10%`.)\n\nWhen the amount of free space of the volume is below `resize.kubesphere.io/threshold`,\n`.spec.resources.requests.storage` is increased by `resize.kubesphere.io/increase`.\n\nIf `resize.kubesphere.io/increase` is given as a percentage, the value is calculated as\nthe current `spec.resources.requests.storage` value multiplied by the annotation value.\n\n```yaml\nkind: PersistentVolumeClaim\napiVersion: v1\nmetadata:\n  name: kubesphere-pvc\n  namespace: default\n  annotations:\n    resize.kubesphere.io/storage-limit: 100Gi\n    resize.kubesphere.io/threshold: 20%\n    resize.kubesphere.io/increase: 20Gi\nspec:\n  \u003csnip\u003e\n```\n\n### workload-autoRestart\nThe restarter judges the workload that needs to be restarted automatically by checking the status of pvc, and the restarter will stop the workload after successful expansion or timeout and then turn it on again.\nIf you have a storage class that only supports offline expansion, and need to automatically complete the expansion, you can add the following annotations:\n```yaml\nkind: StorageClass\napiVersion: storage.k8s.io/v1\nmetadata:\n  name: csi-qingcloud\n  labels:\n    app.kubernetes.io/managed-by: Helm\n  annotations:\n    restart.kubesphere.io/enabled: 'true'\n    restart.kubesphere.io/online-expansion-support: 'false'\n    restart.kubesphere.io/max-time: '300'\n```\nThe workload-autoRestart will run when `restart.kubesphere.io/enabled` is *true* and `restart.kubesphere.io/online-expansion-support` is *false*.\n`restart.kubesphere.io/max-time` defines the maximum number of seconds that can be waited for restarting a workload. If the time is exceeded and the restart is not successful, the workload will be skipped afterwards.\n\n\nAdd the following annotations to Deployment or StatefulSet that do not require automatic restart:\n```yaml\nkind: \napiVersion: apps/v1\nmetadata:\n  name: kubesphere-workload\n  namespace: default\n  annotations:\n    restart.kubesphere.io/skip: \"true\"\n```\n## Container images\n\nContainer images are available on [Dockerhub](https://hub.docker.com/repository/docker/kubespheredev/pvc-autoresizer)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkubesphere%2Fpvc-autoresizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkubesphere%2Fpvc-autoresizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkubesphere%2Fpvc-autoresizer/lists"}