Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: openebs/dynamic-localpv-provisioner
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v4.1.4
Choose a base ref
...
head repository: openebs/dynamic-localpv-provisioner
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v4.2.0
Choose a head ref

Commits on Jul 3, 2024

  1. feat(chart): add chart changes for v4.1.0

    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    niladrih committed Jul 3, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    84a19be View commit details
  2. Allow specifying additional labels to be applied to all helm chart re…

    …sources
    
    This is added as a top-level `labels` map within the values file.
    If it is populated, these labels will be added to the storageclass.
    It is also added to the 'localpv.labels' variable, already included
    within every resource besides the storageclass.
    
    Signed-off-by: Andrew Lavery <laverya@umich.edu>
    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    laverya authored and niladrih committed Jul 3, 2024
    Copy the full SHA
    ce8fc6a View commit details
  3. Add pod priorityClassName

    Signed-off-by: Bernard Gütermann <bernard.gutermann@sekops.ch>
    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    bernardgut authored and niladrih committed Jul 3, 2024
    Copy the full SHA
    e56c509 View commit details

Commits on Jul 4, 2024

  1. refactor(chart): refactor implementation for adding extra labels to a…

    …ll chart resources
    
    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    niladrih committed Jul 4, 2024
    Copy the full SHA
    4eb5a65 View commit details
  2. refactor(chart): refactor implementation for adding priorityClassName

    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    niladrih committed Jul 4, 2024
    Copy the full SHA
    fc47e47 View commit details
  3. chore(changelog): add changelog entries for PRs 182 & 183

    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    niladrih committed Jul 4, 2024
    Copy the full SHA
    aa12164 View commit details

Commits on Jul 5, 2024

  1. Merge pull request #194 from openebs/chart-v4.1.0

    feat(chart): add chart changes for v4.1.0
    
    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    niladrih authored Jul 5, 2024
    Copy the full SHA
    893f1e8 View commit details
  2. ci: remove caching for openebs-ndm dependency

    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    niladrih committed Jul 5, 2024
    Copy the full SHA
    41bcb36 View commit details
  3. ci: add workflow_dispatch trigger for chart release

    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    niladrih committed Jul 5, 2024
    Copy the full SHA
    015d012 View commit details
  4. Merge pull request #195 from niladrih/fix-ci

    ci: remove caching for openebs-ndm dependency
    
    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    niladrih authored Jul 5, 2024
    Copy the full SHA
    65f8eb0 View commit details
  5. Revert "ci: add workflow_dispatch trigger for chart release" (#196)

    This reverts commit 015d012.
    This commit was required to manually trigger the chart-releaser workflow after a
    failed post-merge run. This is not required any more.
    
    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    niladrih authored Jul 5, 2024
    Copy the full SHA
    1034995 View commit details

Commits on Jul 15, 2024

  1. feat(provisioner-localpv): Merge CAS config from PersistentVolumeClaim (

    #190)
    
    * Merge CAS config from PersistentVolumeClaim
    
    Signed-off-by: Nobi <nobi@nobidev.com>
    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    
    * feat(provisioner): prefer StorageClass config over PVC config
    In the typical use-case for the provisioner, an admin sets the config on the
    StorageClass, and a user sets the config on the PVC. The admin's config may
    set boundaries on to the volumes which the PVC config map try to override.
    Preferring StorageClass config when there is a conflict may be the right way
    to go.
    
    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    
    * tests: add integration test for pvc config
    
    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    
    * chore(changelog): add changelog entry
    
    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    
    ---------
    
    Signed-off-by: Nobi <nobi@nobidev.com>
    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    Co-authored-by: Nobi <nobi@nobidev.com>
    niladrih and nobiit authored Jul 15, 2024
    Copy the full SHA
    cab53c4 View commit details

Commits on Jul 16, 2024

  1. tests: add tests for custom NodeAffinityLabels feature (#197)

    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    niladrih authored Jul 16, 2024
    Copy the full SHA
    52d6cb5 View commit details

Commits on Jul 30, 2024

  1. Add BDD spec (#198)

    * tests(quota): add namespace to the PVC delete calls
    
    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    
    * tests(bdd): add bdd specs for existing tests
    
    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    
    * tests(bdd): use Then directive to only check code behaviour
    
    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    
    ---------
    
    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    niladrih authored Jul 30, 2024
    Copy the full SHA
    eb0e8bd View commit details

Commits on Aug 29, 2024

  1. chore(deps): update analytics dependency (#200)

    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    niladrih authored Aug 29, 2024
    Copy the full SHA
    10a891b View commit details

Commits on Sep 13, 2024

  1. feat(charts): add analytics ID and KEY envs to provisioner deployment (

    …#201)
    
    * feat(charts): add analytics ID and KEY envs to provisioner deployment
    
    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    
    * chore(charts): bump chart version
    
    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    
    ---------
    
    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    niladrih authored Sep 13, 2024
    Copy the full SHA
    9a3f5e5 View commit details

Commits on Nov 6, 2024

  1. ci: add support for incremental builds and helm charts (#204)

    Signed-off-by: Prateek Chandra <Prateek.Chandra@datacore.com>
    pchandra19 authored Nov 6, 2024
    Copy the full SHA
    2e2234e View commit details

Commits on Nov 7, 2024

  1. ci: fix build_and_push awk command (#212)

    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    niladrih authored Nov 7, 2024
    Copy the full SHA
    6e3659d View commit details
  2. ci: fix build_and_push and release workflows (#213)

    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    niladrih authored Nov 7, 2024
    Copy the full SHA
    f0f4acc View commit details

Commits on Nov 8, 2024

  1. ci: add Fossa CLI workflow (#208)

    Signed-off-by: Abhinandan Purkait <purkaitabhinandan@gmail.com>
    Abhinandan-Purkait authored Nov 8, 2024
    Copy the full SHA
    16d7557 View commit details
  2. fix(analytics): respect environment variable to disable reporting eve…

    …nt analytics (#211)
    
    Signed-off-by: Ethan Mosbaugh <ethan@replicated.com>
    emosbaugh authored Nov 8, 2024
    Copy the full SHA
    dae0845 View commit details

Commits on Nov 28, 2024

  1. ci: pull in git history for ct lint job (#216) (#217)

    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    niladrih authored Nov 28, 2024
    Copy the full SHA
    e6af23f View commit details
  2. ci: remove lint step with ref to pull_request in release workflow (#219)

    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    niladrih authored Nov 28, 2024
    Copy the full SHA
    25bba1c View commit details
  3. ci: fix trigger for build_and_push workflow (#222)

    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    niladrih authored Nov 28, 2024
    Copy the full SHA
    79d1e0c View commit details

Commits on Dec 10, 2024

  1. feat: support helper pod to use hostNetwork (#224)

    * feat: support helper pod to use hostNetwork
    
    Signed-off-by: mchtech <michu_an@126.com>
    
    * feat: use k8s.io/utils/env to parse bool from env
    
    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    
    * chore(changelog): add changelog entry for helperPod hostNetwork support
    
    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    
    ---------
    
    Signed-off-by: mchtech <michu_an@126.com>
    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    Co-authored-by: mchtech <michu_an@126.com>
    niladrih and mchtech authored Dec 10, 2024
    Copy the full SHA
    9f71dab View commit details

Commits on Jan 10, 2025

  1. ci: pin medyagh/setup-minikube runs to ubuntu-22.04 (#229)

    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    niladrih authored Jan 10, 2025
    Copy the full SHA
    08b09af View commit details

Commits on Jan 13, 2025

  1. feat(charts): add global.imageRegistry parameter (#227)

    * feat(charts): add global.imageRegistry parameter
    
    Add global.imageRegistry option overridden by localpv.image.registry and
    helperPod.image.registry for localpv and helper Pod respectively.
    Fix registry options requiring a trailing slash while still supporting a
    trailing slash to avoid breaking existing configurations.
    
    Signed-off-by: Lior Friedman <lior@sneakybugs.com>
    
    * docs(charts): add global.imageRegistry parameter description
    
    Signed-off-by: Lior Friedman <lior@sneakybugs.com>
    
    * chore(changelog): add changelog entry
    
    Signed-off-by: Lior Friedman <lior@sneakybugs.com>
    
    ---------
    
    Signed-off-by: Lior Friedman <lior@sneakybugs.com>
    LKummer authored Jan 13, 2025
    Copy the full SHA
    e3146fd View commit details

Commits on Jan 16, 2025

  1. docs(security): cross-reference security docs

    Signed-off-by: Tiago Castro <tiagolobocastro@gmail.com>
    tiagolobocastro committed Jan 16, 2025
    Copy the full SHA
    3d893b9 View commit details
  2. docs: cross-reference maintainers markdown

    Signed-off-by: Tiago Castro <tiagolobocastro@gmail.com>
    tiagolobocastro committed Jan 16, 2025
    Copy the full SHA
    2b14b0a View commit details

Commits on Jan 17, 2025

  1. Merge pull request #230 from openebs/security

    docs(security): cross-reference security docs
    tiagolobocastro authored Jan 17, 2025
    Copy the full SHA
    4f8df11 View commit details

Commits on Jan 27, 2025

  1. Cherry-pick PR 233 to develop branch (#236)

    * refactor(charts): make priorityClassName template-able (#233)
    
    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    
    * chore: update changelogs
    
    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    
    ---------
    
    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    niladrih authored Jan 27, 2025
    Copy the full SHA
    64cca24 View commit details

Commits on Jan 28, 2025

  1. build(nix-shell): enhance local shell environment

    Signed-off-by: Tiago Castro <tiagolobocastro@gmail.com>
    tiagolobocastro committed Jan 28, 2025
    Copy the full SHA
    2fd153a View commit details
  2. build: add bootstrap tools

    Adds a bootstrap target to install required go tools, similar
    to how other local repos handle this.
    
    Signed-off-by: Tiago Castro <tiagolobocastro@gmail.com>
    tiagolobocastro committed Jan 28, 2025
    Copy the full SHA
    285e6dc View commit details
  3. refactor: shellcheck on build script

    Signed-off-by: Tiago Castro <tiagolobocastro@gmail.com>
    tiagolobocastro committed Jan 28, 2025
    Copy the full SHA
    47aa238 View commit details

Commits on Jan 29, 2025

  1. test: add ci helper script

    Similar to the other local drivers, it can install the helm chart,
    run the tests, etc
    
    Signed-off-by: Tiago Castro <tiagolobocastro@gmail.com>
    tiagolobocastro committed Jan 29, 2025
    Copy the full SHA
    1278667 View commit details
  2. test: add nixos shell

    Adds a nixos shell for local testing.
    This a headless vm with fs utils installed and configured for testing,
     as well as being a single node k3s cluster.
    
    Signed-off-by: Tiago Castro <tiagolobocastro@gmail.com>
    tiagolobocastro committed Jan 29, 2025
    Copy the full SHA
    86f5960 View commit details
  3. test: speed up with graceful termination

    Add test pod graceful termination as 5s
    This speeds up tests by around 2m20s
    
    Signed-off-by: Tiago Castro <tiagolobocastro@gmail.com>
    tiagolobocastro committed Jan 29, 2025
    Copy the full SHA
    12918f2 View commit details
  4. fix: don't wait forever if the launch pod failed

    For launch pods which don't restart, there's no point in waiting for the
    given timeout.
    
    Signed-off-by: Tiago Castro <tiagolobocastro@gmail.com>
    tiagolobocastro committed Jan 29, 2025
    Copy the full SHA
    72a0daa View commit details

Commits on Jan 30, 2025

  1. docs: enhance contributors development setup guide

    Linted all the markdown files but noticed they have outdated content,
    example: installing openebs 3.X and operator lite
    Improve development setup guide, including the nixos-shell k3s docs
    
    Signed-off-by: Tiago Castro <tiagolobocastro@gmail.com>
    tiagolobocastro committed Jan 30, 2025
    Copy the full SHA
    d340df7 View commit details

Commits on Jan 31, 2025

  1. Merge pull request #237 from openebs/dev

    - docs: enhance contributors development setup guide
    - fix: don't wait forever if the launch pod failed
    - test: speed up with graceful termination
    - test: add nixos shell
    - test: add ci helper script
    - refactor: shellcheck on build script
    - build: add bootstrap tools
    - build(nix-shell): enhance local shell environment
    tiagolobocastro authored Jan 31, 2025
    Copy the full SHA
    b3b69bf View commit details
  2. feat(charts): add eviction tolerations to the provisioner deployment (#…

    …238)
    
    * feat(charts): add eviction tolerations to the provisioner deployment
    
    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    
    * ci: omit the timeout flag on ct lint
    
    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    
    ---------
    
    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    niladrih authored Jan 31, 2025
    Copy the full SHA
    d0ec9a2 View commit details
  3. chore(ci): update helm chart versions and/or git submodules (#240)

    Signed-off-by: GitHub <noreply@github.com>
    Co-authored-by: niladrih <niladrih@users.noreply.github.com>
    github-actions[bot] and niladrih authored Jan 31, 2025
    Copy the full SHA
    beeb353 View commit details
  4. chore: add changelog for 4.2.0 (#242)

    * chore: remove build artifact
    
    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    
    * chore: add changelog for v4.1.4
    
    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    
    * chore: add changelog entry for 4.2.0
    
    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    
    ---------
    
    Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
    niladrih authored Jan 31, 2025
    Copy the full SHA
    901261a View commit details
Showing with 3,233 additions and 830 deletions.
  1. +131 −0 .github/workflows/branch_preparation.yml
  2. +90 −97 .github/workflows/{build.yml → build_and_push.yml}
  3. +0 −53 .github/workflows/chart-lint-test.yml
  4. +17 −0 .github/workflows/fossa.yml
  5. +76 −67 .github/workflows/pull_request.yml
  6. +0 −38 .github/workflows/release-charts.yml
  7. +157 −10 .github/workflows/release.yml
  8. +9 −0 .gitignore
  9. +25 −0 CHANGELOG.md
  10. +3 −1 CODE_OF_CONDUCT.md
  11. +39 −30 CONTRIBUTING.md
  12. +3 −1 GOVERNANCE.md
  13. +0 −1 MAINTAINERS
  14. +10 −0 MAINTAINERS.md
  15. +52 −19 Makefile
  16. +23 −24 README.md
  17. +5 −2 RELEASE.md
  18. +10 −0 SECURITY.md
  19. +10 −0 SECURITY_CONTACTS.md
  20. +20 −18 buildscripts/build.sh
  21. +1 −0 changelogs/released/v4.1.1/200-niladrih
  22. +1 −0 changelogs/released/v4.1.2/211-emosbaugh
  23. +1 −0 changelogs/released/v4.1.3/182-bernardgut
  24. +1 −0 changelogs/released/v4.1.3/183-laverya
  25. +1 −0 changelogs/released/v4.1.4/236-niladrih
  26. +1 −0 changelogs/released/v4.2.0/190-nobiit
  27. +1 −0 changelogs/released/v4.2.0/224-mctech
  28. +1 −0 changelogs/released/v4.2.0/227-lkummer
  29. +1 −0 changelogs/released/v4.2.0/237-tiagolobocastro
  30. +1 −0 changelogs/released/v4.2.0/238-niladrih
  31. +290 −0 ci/ci-test.sh
  32. +19 −29 cmd/provisioner-localpv/app/config.go
  33. +9 −16 cmd/provisioner-localpv/app/env.go
  34. +35 −16 cmd/provisioner-localpv/app/env_test.go
  35. +9 −19 cmd/provisioner-localpv/app/helper_hostpath.go
  36. +12 −9 cmd/provisioner-localpv/app/provisioner.go
  37. +8 −16 cmd/provisioner-localpv/app/provisioner_hostpath.go
  38. +3 −2 ct.yaml
  39. +2 −2 deploy/helm/charts/Chart.yaml
  40. +5 −3 deploy/helm/charts/README.md
  41. +1 −4 deploy/helm/charts/templates/NOTES.txt
  42. +14 −2 deploy/helm/charts/templates/_helpers.tpl
  43. +24 −6 deploy/helm/charts/templates/deployment.yaml
  44. +3 −0 deploy/helm/charts/templates/hostpath-class.yaml
  45. +3 −0 deploy/helm/charts/templates/psp.yaml
  46. +15 −0 deploy/helm/charts/templates/rbac.yaml
  47. +23 −7 deploy/helm/charts/values.yaml
  48. +236 −122 docs/developer.md
  49. +24 −17 docs/installation/platforms/microk8s.md
  50. +2 −0 docs/installation/platforms/minikube.md
  51. +14 −5 docs/quickstart.md
  52. +7 −2 docs/tutorials/backup_and_restore/backup.md
  53. +9 −4 docs/tutorials/backup_and_restore/restore.md
  54. +22 −19 docs/tutorials/backup_and_restore/velero/velero_with_restic.md
  55. +28 −15 docs/tutorials/hostpath/xfs_quota/enable-xfs-quota.md
  56. +30 −22 docs/tutorials/hostpath/xfs_quota/modify-xfs-quota.md
  57. +38 −16 docs/tutorials/hostpath/xfs_quota/prerequisites.md
  58. +24 −19 docs/tutorials/hostpath/xfs_quota/use-xfs-fs-with-loop-device.md
  59. +3 −3 go.mod
  60. +4 −4 go.sum
  61. +14 −0 nix/sources.json
  62. +198 −0 nix/sources.nix
  63. +16 −15 pkg/kubernetes/api/apps/v1/deployment/deployment.go
  64. +2 −18 pkg/kubernetes/api/core/v1/persistentvolumeclaim/build.go
  65. +15 −16 pkg/kubernetes/api/core/v1/pod/build.go
  66. +8 −0 pkg/kubernetes/api/core/v1/podtemplatespec/podtemplatespec.go
  67. +18 −16 pkg/kubernetes/api/storage/v1/storageclass/build.go
  68. +96 −0 scripts/test-update-chart-version.sh
  69. +224 −0 scripts/update-chart-version.sh
  70. +104 −0 scripts/validate-chart-version.sh
  71. +51 −0 shell.nix
  72. +56 −0 tests/bdd/ext4_quota.feature
  73. +30 −0 tests/bdd/hostpath.feature
  74. +21 −0 tests/bdd/nodeAffinityLabels_cas_config.feature
  75. +50 −0 tests/bdd/pvc_cas_config.feature
  76. +54 −0 tests/bdd/xfs_quota.feature
  77. +8 −4 tests/hostpath_quota_test.go
  78. +2 −0 tests/hostpath_test.go
  79. +147 −0 tests/nodeAffinityLabels_cas_config_test.go
  80. +112 −21 tests/operations.go
  81. +311 −0 tests/pvc_cas_config_test.go
  82. +90 −0 vm.nix
131 changes: 131 additions & 0 deletions .github/workflows/branch_preparation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
name: Branch Preparation

on:
push:
branches:
- 'release/**'
tags:
- 'v[0-9]+.[0-9]+.[0-9]+**'

jobs:
update_release_branch_after_release:
runs-on: ubuntu-latest
if: ${{ github.ref_type == 'tag' }}
steps:
- uses: actions/checkout@v4

- uses: cachix/install-nix-action@v22
- name: Pre-populate nix-shell
run: |
export NIX_PATH=nixpkgs=$(jq '.nixpkgs.url' nix/sources.json -r)
echo "NIX_PATH=$NIX_PATH" >> $GITHUB_ENV
nix-shell --pure --run "echo" ./shell.nix
- name: Test the chart version updater script
run: |
nix-shell --pure --run "./scripts/test-update-chart-version.sh" ./shell.nix
- name: Modify the chart version based on the tag
run: |
tag=${{ github.ref_name }}
echo "BASE=$(nix-shell --pure --run "./scripts/update-chart-version.sh --tag $tag" ./shell.nix)" >> $GITHUB_ENV
- name: Create Pull Request to release
if: ${{ env.BASE }}
id: cpr
uses: peter-evans/create-pull-request@v5
with:
base: ${{ env.BASE }}
commit-message: "chore(ci): update helm chart versions and/or git submodules"
committer: GitHub <noreply@github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
title: "Prepare release branch after release ${{ github.ref_name }}"
labels: |
update-release-branch
automated-pr
draft: false
signoff: true
branch: "create-pull-request/patch-${{ env.BASE }}"
token: ${{ secrets.GITHUB_TOKEN }}

update_develop_branch_on_release_branch_creation:
runs-on: ubuntu-latest
if: ${{ github.ref_type == 'branch' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: |
git checkout develop
- uses: cachix/install-nix-action@v22
- name: Pre-populate nix-shell
run: |
export NIX_PATH=nixpkgs=$(jq '.nixpkgs.url' nix/sources.json -r)
echo "NIX_PATH=$NIX_PATH" >> $GITHUB_ENV
nix-shell --pure --run "echo" ./shell.nix
- name: Test the chart version updater script
run: |
nix-shell --pure --run "./scripts/test-update-chart-version.sh" ./shell.nix
- name: Modify the chart version based on the branch name for develop
run: |
branch_name=${{ github.ref_name }}
nix-shell --pure --run "./scripts/update-chart-version.sh --branch $branch_name --type develop" ./shell.nix
- name: Create Pull Request to develop
id: cpr
uses: peter-evans/create-pull-request@v5
with:
base: develop
commit-message: "chore(ci): update helm chart versions and/or git submodules"
committer: GitHub <noreply@github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
title: "Prepare develop branch on ${{ github.ref_name }} creation"
labels: |
update-develop-branch
automated-pr
draft: false
signoff: true
branch: "create-pull-request/patch-develop"
token: ${{ secrets.GITHUB_TOKEN }}

prepare_release_branch_on_creation:
runs-on: ubuntu-latest
if: ${{ github.ref_type == 'branch' }}
steps:
- uses: actions/checkout@v4

- uses: cachix/install-nix-action@v22
- name: Pre-populate nix-shell
run: |
export NIX_PATH=nixpkgs=$(jq '.nixpkgs.url' nix/sources.json -r)
echo "NIX_PATH=$NIX_PATH" >> $GITHUB_ENV
nix-shell --pure --run "echo" ./shell.nix
- name: Test the chart version updater script
run: |
nix-shell --pure --run "./scripts/test-update-chart-version.sh" ./shell.nix
- name: Modify the chart version based on the branch name for release
run: |
branch_name=${{ github.ref_name }}
nix-shell --pure --run "./scripts/update-chart-version.sh --branch $branch_name --type release" ./shell.nix
- name: Create Pull Request to release
id: cpr
uses: peter-evans/create-pull-request@v5
with:
base: ${{ github.ref_name }}
commit-message: "chore(ci): update helm chart versions and/or git submodules"
committer: GitHub <noreply@github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
title: "Prepare ${{ github.ref_name }} branch"
labels: |
prepare-release-branch
automated-pr
draft: false
signoff: true
branch: "create-pull-request/patch-${{ github.ref_name }}"
token: ${{ secrets.GITHUB_TOKEN }}
187 changes: 90 additions & 97 deletions .github/workflows/build.yml → .github/workflows/build_and_push.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,47 @@
name: build
name: Build and Push

on:
create:
push:
branches:
- 'develop'
- 'v*'
- 'release/**'
paths-ignore:
- '**.md'
- 'changelogs/**'
- 'deploy/helm/**'
- 'docs/**'
- 'design/**'
- 'LICENSE'
- 'MAINTAINERS'

jobs:
lint:
# to ignore builds on release
if: ${{ (github.event.ref_type != 'tag') }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: cachix/install-nix-action@v22
- uses: rrbutani/use-nix-shell-action@v1.1.0
with:
file: shell.nix

- name: Check if the chart follows a valid semver version
run: |
BRANCH=${{ github.ref_name }}
./scripts/validate-chart-version.sh --branch $BRANCH
- name: Run chart-testing lint
run: |
ct lint --config ct.yaml
unit-test:
# to ignore builds on release
if: ${{ (github.event.ref_type != 'tag') }}
runs-on: ubuntu-latest
needs: ['lint']
steps:
- name: Set up Go 1.19
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.19.13

@@ -44,17 +55,70 @@ jobs:
run: make verify-src

- name: Upload Coverage Report
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
name: coverage-$(date +%s)
flags: unittests

integration-test:
runs-on: ubuntu-22.04
needs: ['lint', 'unit-test']
strategy:
matrix:
kubernetes: [v1.27.2]
steps:
- name: Set up Go 1.19
uses: actions/setup-go@v5
with:
go-version: 1.19.13

- name: Checkout
uses: actions/checkout@v4

- name: Build images locally
run: make provisioner-localpv-image

- name: Setup Minikube-Kubernetes
uses: medyagh/setup-minikube@latest
with:
cache: false
minikube-version: 1.31.1
driver: none
kubernetes-version: ${{ matrix.kubernetes }}
cni: calico
start-args: '--install-addons=false'

- name: Set up infra for integration test
run: sudo apt-get update && sudo apt-get install -y xfsprogs quota linux-modules-extra-`uname -r`

- name: Integration test
run: |
make bootstrap
make helm-install
make integration-test
- name: Upload Integration Test Coverage Report
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./tests/integration_coverage.txt
name: coverage-integration-test-$(date +%s)
flags: integrationtests

provisioner-localpv:
runs-on: ubuntu-latest
needs: ['lint', 'unit-test']
needs: ['integration-test']
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Go 1.19
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.19.13

- name: Set Image Org
# sets the default IMAGE_ORG to openebs
run: |
@@ -63,11 +127,9 @@ jobs:
- name: Set CI Tag
run: |
BRANCH="${GITHUB_REF##*/}"
CI_TAG=${BRANCH#v}-ci
if [ ${BRANCH} = "develop" ]; then
CI_TAG="ci"
fi
BRANCH=${{ github.ref_name }}
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
CI_TAG=$(awk -F': ' '/^version:/ {print $2}' deploy/helm/charts/Chart.yaml)
echo "TAG=${CI_TAG}" >> $GITHUB_ENV
- name: Set Build Date
@@ -88,8 +150,9 @@ jobs:
type=raw,value=latest,enable=false
type=raw,value=${{ env.TAG }}
- name: Print Tags
- name: Print Tag info
run: |
echo "BRANCH: ${{ env.BRANCH }}"
echo "${{ steps.docker_meta.outputs.tags }}"
- name: Set up QEMU
@@ -140,85 +203,15 @@ jobs:
DBUILD_DATE=${{ steps.date.outputs.DATE }}
DBUILD_REPO_URL=https://github.com/openebs/dynamic-localpv-provisioner
DBUILD_SITE_URL=https://openebs.io
BRANCH=${{ env.BRANCH }}
integration-test:
runs-on: ubuntu-latest
needs: ['lint', 'unit-test']
strategy:
matrix:
kubernetes: [v1.27.2]
steps:
- name: Set up Go 1.19
uses: actions/setup-go@v4
with:
go-version: 1.19.13

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
version: v0.5.1

- name: Checkout
uses: actions/checkout@v4

- name: Build Image
uses: docker/build-push-action@v4
with:
context: .
file: ./buildscripts/provisioner-localpv/provisioner-localpv.Dockerfile
push: false
load: true
platforms: linux/amd64
tags: |
openebs/provisioner-localpv:ci
- name: Setup Minikube-Kubernetes
uses: medyagh/setup-minikube@latest
with:
cache: false
minikube-version: 1.31.1
driver: none
kubernetes-version: ${{ matrix.kubernetes }}
cni: calico
start-args: '--install-addons=false'

- name: Set up infra for integration test
run: |
sudo apt-get update && sudo apt-get install -y xfsprogs quota linux-modules-extra-`uname -r`
go install -mod=mod github.com/onsi/ginkgo/v2/ginkgo@v2.14.0
sed -e '/openebs-provisioner-hostpath/{N;s/IfNotPresent/Never/}' deploy/kubectl/openebs-operator-lite.yaml | kubectl apply -f -
- name: Integration test
run: |
make integration-test
localpv-e2e:
# to ignore builds on release AND build only if the branch is develop
if: ${{ (github.event.ref_type != 'tag') && (github.ref == 'refs/heads/develop') }}
release-chart:
runs-on: ubuntu-latest
needs: ['provisioner-localpv']
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set Image Org
# sets the default IMAGE_ORG to openebs
run: |
[ -z "${{ secrets.IMAGE_ORG }}" ] && IMAGE_ORG=openebs || IMAGE_ORG=${{ secrets.IMAGE_ORG}}
echo "IMAGE_ORG=${IMAGE_ORG}" >> $GITHUB_ENV
- name: Login to Docker Hub
uses: docker/login-action@v2
- uses: actions/checkout@v4
- name: Publish provisioner-localpv develop or prerelease helm chart
uses: stefanprodan/helm-gh-pages@master
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push the localpv-e2e image
uses: docker/build-push-action@v4
with:
file: ./e2e-tests/Dockerfile
push: true
load: false
platforms: linux/amd64
tags: |
${{ env.IMAGE_ORG }}/localpv-e2e:ci
token: ${{ secrets.GITHUB_TOKEN }}
charts_dir: ./deploy/helm
53 changes: 0 additions & 53 deletions .github/workflows/chart-lint-test.yml

This file was deleted.

17 changes: 17 additions & 0 deletions .github/workflows/fossa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Fossa CLI
on:
push:
branches:
- 'develop'
- 'release/**'

jobs:
fossa-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: fossas/fossa-action@v1.4.0
with:
api-key: ${{ secrets.FOSSA_API_KEY }}
143 changes: 76 additions & 67 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
name: ci
name: Pull Request

on:
pull_request:
branches:
# on pull requests to develop and release branches
- 'develop'
- 'v*'
- 'release/**'
paths-ignore:
- '**.md'
- 'changelogs/**'
- 'deploy/helm/**'
- 'docs/**'
- 'design/**'
- 'LICENSE'
@@ -21,12 +20,43 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Shellcheck
uses: reviewdog/action-shellcheck@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
path: "."
pattern: "*.sh"

- uses: cachix/install-nix-action@v22
- uses: rrbutani/use-nix-shell-action@v1.1.0
with:
file: shell.nix

- name: Set up Go 1.19
uses: actions/setup-go@v5
with:
go-version: 1.19.13
cache: false

- name: Check if the chart follows a valid semver version
run: |
branch_name="${{ github.event.pull_request.base.ref }}"
./scripts/validate-chart-version.sh --branch $branch_name
- name: Run chart-testing lint
run: |
ct lint --config ct.yaml
unit-test:
needs: ['lint']
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.19
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.19.13

@@ -40,73 +70,30 @@ jobs:
run: make verify-src

- name: Upload Coverage Report
uses: codecov/codecov-action@v1

provisioner-localpv:
runs-on: ubuntu-latest
needs: ['lint', 'unit-test']
steps:
- name: Set up Go 1.19
uses: actions/setup-go@v4
uses: codecov/codecov-action@v4
with:
go-version: 1.19.13

- name: Setup QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: all

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
version: v0.5.1

- name: Checkout
uses: actions/checkout@v4

- name: Build multi-arch Image
uses: docker/build-push-action@v4
with:
context: .
file: ./buildscripts/provisioner-localpv/provisioner-localpv.Dockerfile
push: false
load: false
platforms: linux/amd64, linux/arm64, linux/arm/v7, linux/ppc64le
tags: |
openebs/provisioner-localpv:ci
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
name: coverage-$(date +%s)
flags: unittests

integration-test:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
needs: ['lint', 'unit-test']
strategy:
matrix:
kubernetes: [v1.27.2]
steps:
- name: Set up Go 1.19
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.19.13

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
version: v0.5.1

- name: Checkout
uses: actions/checkout@v4

- name: Build Image
uses: docker/build-push-action@v4
with:
context: .
file: ./buildscripts/provisioner-localpv/provisioner-localpv.Dockerfile
push: false
load: true
platforms: linux/amd64
tags: |
openebs/provisioner-localpv:ci
- name: Build images locally
run: make provisioner-localpv-image

- name: Setup Minikube-Kubernetes
uses: medyagh/setup-minikube@latest
@@ -119,28 +106,50 @@ jobs:
start-args: '--install-addons=false'

- name: Set up infra for integration test
run: |
sudo apt-get update && sudo apt-get install -y xfsprogs quota linux-modules-extra-`uname -r`
go install -mod=mod github.com/onsi/ginkgo/v2/ginkgo@v2.14.0
sed -e '/openebs-provisioner-hostpath/{N;s/IfNotPresent/Never/}' deploy/kubectl/openebs-operator-lite.yaml | kubectl apply -f -
run: sudo apt-get update && sudo apt-get install -y xfsprogs quota linux-modules-extra-`uname -r`

- name: Integration test
run: |
make bootstrap
make helm-install
make integration-test
localpv-e2e:
- name: Upload Integration Test Coverage Report
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./tests/integration_coverage.txt
name: coverage-integration-test-$(date +%s)
flags: integrationtests

provisioner-localpv:
runs-on: ubuntu-latest
needs: ['integration-test']
steps:
- name: Set up Go 1.19
uses: actions/setup-go@v5
with:
go-version: 1.19.13

- name: Setup QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: all

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
version: v0.5.1

- name: Checkout
uses: actions/checkout@v4

- name: Build the localpv-e2e image
- name: Build multi-arch Image
uses: docker/build-push-action@v4
with:
file: ./e2e-tests/Dockerfile
context: .
file: ./buildscripts/provisioner-localpv/provisioner-localpv.Dockerfile
push: false
load: false
platforms: linux/amd64
tags: |
openebs/localpv-e2e:ci
platforms: linux/amd64, linux/arm64, linux/arm/v7, linux/ppc64le
38 changes: 0 additions & 38 deletions .github/workflows/release-charts.yml

This file was deleted.

167 changes: 157 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -12,31 +12,153 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: release
name: Release Images and Charts

on:
release:
types:
- 'created'

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Shellcheck
uses: reviewdog/action-shellcheck@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
path: "."
pattern: "*.sh"

- uses: cachix/install-nix-action@v22
- uses: rrbutani/use-nix-shell-action@v1.1.0
with:
file: shell.nix

- name: Set up Go 1.19
uses: actions/setup-go@v5
with:
go-version: 1.19.13
cache: false

- name: Check if the chart is publishable
run: |
TAG=${{ github.event.release.tag_name }}
./scripts/update-chart-version.sh --tag $TAG --publish-release
- name: Run chart-testing lint
run: |
ct lint --config ct.yaml
unit-test:
runs-on: ubuntu-latest
needs: ['lint']
steps:
- name: Set up Go 1.19
uses: actions/setup-go@v5
with:
go-version: 1.19.13

- name: Checkout
uses: actions/checkout@v4

- name: Unit test
run: make test

- name: Verify corrections
run: make verify-src

- name: Upload Coverage Report
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
name: coverage-$(date +%s)
flags: unittests

integration-test:
runs-on: ubuntu-22.04
needs: ['lint', 'unit-test']
strategy:
matrix:
kubernetes: [v1.27.2]
steps:
- name: Set up Go 1.19
uses: actions/setup-go@v5
with:
go-version: 1.19.13

- name: Checkout
uses: actions/checkout@v4

- name: Build images locally
run: make provisioner-localpv-image || exit 1;

- name: Setup Minikube-Kubernetes
uses: medyagh/setup-minikube@latest
with:
cache: false
minikube-version: 1.31.1
driver: none
kubernetes-version: ${{ matrix.kubernetes }}
cni: calico
start-args: '--install-addons=false'

- name: Set up infra for integration test
run: |
sudo apt-get update && sudo apt-get install -y xfsprogs quota linux-modules-extra-`uname -r`
go install -mod=mod github.com/onsi/ginkgo/v2/ginkgo@v2.14.0
helm install localpv-provisioner ./deploy/helm/charts -n openebs --create-namespace --set localpv.image.pullPolicy=Never --set analytics.enabled=false
kubectl get pods -A
- name: Integration test
run: |
make integration-test
- name: Upload Integration Test Coverage Report
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./tests/integration_coverage.txt
name: coverage-integration-test-$(date +%s)
flags: integrationtests

provisioner-localpv:
if: contains(github.ref, 'tags/v')
needs: ['integration-test']
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: cachix/install-nix-action@v22
- name: Pre-populate nix-shell
run: |
export NIX_PATH=nixpkgs=$(jq '.nixpkgs.url' nix/sources.json -r)
echo "NIX_PATH=$NIX_PATH" >> $GITHUB_ENV
nix-shell --pure --run "echo" ./shell.nix
- name: Check if the chart is publishable
run: |
TAG=${{ github.event.release.tag_name }}
nix-shell --pure --run "./scripts/update-chart-version.sh --tag $TAG --publish-release" ./shell.nix
- name: Set Image Org
# sets the default IMAGE_ORG to openebs
run: |
[ -z "${{ secrets.IMAGE_ORG }}" ] && IMAGE_ORG=openebs || IMAGE_ORG=${{ secrets.IMAGE_ORG}}
echo "IMAGE_ORG=${IMAGE_ORG}" >> $GITHUB_ENV
- name: Set Release Tag
- name: Set IMAGE_TAG and BRANCH
run: |
TAG="${GITHUB_REF#refs/*/v}"
echo "RELEASE_TAG=${TAG}" >> $GITHUB_ENV
BRANCH=${{ github.ref_name }}
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
echo "IMAGE_TAG=$(awk -F': ' '/^version:/ {print $2}' deploy/helm/charts/Chart.yaml)" >> $GITHUB_ENV
- name: Set Build Date
id: date
@@ -53,12 +175,13 @@ jobs:
quay.io/${{ env.IMAGE_ORG }}/provisioner-localpv
ghcr.io/${{ env.IMAGE_ORG }}/provisioner-localpv
tags: |
type=semver,pattern={{version}}
type=raw,value=latest,enable=false
type=raw,value=${{ env.IMAGE_TAG }}
- name: Print Tags
- name: Print Tag info
run: |
echo "${{ steps.docker_meta.outputs.tags }}"
echo "RELEASE TAG: ${RELEASE_TAG}"
echo "BRANCH: ${{ env.BRANCH }}"
echo "RELEASE_TAG: ${{ steps.docker_meta.outputs.tags }}"
- name: Setup QEMU
uses: docker/setup-qemu-action@v2
@@ -104,4 +227,28 @@ jobs:
DBUILD_DATE=${{ steps.date.outputs.DATE }}
DBUILD_REPO_URL=https://github.com/openebs/dynamic-localpv-provisioner
DBUILD_SITE_URL=https://openebs.io
RELEASE_TAG=${{ env.RELEASE_TAG }}
BRANCH=${{ env.BRANCH }}
release-chart:
runs-on: ubuntu-latest
needs: ["provisioner-localpv"]
steps:
- uses: actions/checkout@v4

- uses: cachix/install-nix-action@v22
- name: Pre-populate nix-shell
run: |
export NIX_PATH=nixpkgs=$(jq '.nixpkgs.url' nix/sources.json -r)
echo "NIX_PATH=$NIX_PATH" >> $GITHUB_ENV
nix-shell --pure --run "echo" ./shell.nix
- name: Check if the chart is publishable
run: |
TAG=${{ github.event.release.tag_name }}
nix-shell --pure --run "./scripts/update-chart-version.sh --tag $TAG --publish-release" ./shell.nix
- name: Publish dynamic localpv develop or prerelease helm chart
uses: stefanprodan/helm-gh-pages@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
charts_dir: ./deploy/helm
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -8,3 +8,12 @@ cmd/provisioner-localpv/start.sh

# Ginkgo test
tests/tests.test
/tests/integration_coverage.txt

# Nix-Shell Go
/nix/.go/
/nix/.tmp/

/nixos.qcow2

/nix/bins/sudo
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
v4.2.0 / 2025-02-01
===================
* Merge cas-config from PVC ([#190](https://github.com/openebs/dynamic-localpv-provisioner/pull/238),[@nobiit](https://github.com/nobiit))
* Add option for helperPod to use hostNetwork ([#224](https://github.com/openebs/dynamic-localpv-provisioner/pull/224),[@mchtech](https://github.com/mchtech))
* Add global.imageRegistry Helm chart parameter ([#227](https://github.com/openebs/dynamic-localpv-provisioner/pull/227),[@lkummer](https://github.com/lkummer))
* Add timeout to helperPod wait if the launchPod failed ([#237](https://github.com/openebs/dynamic-localpv-provisioner/pull/237),[@tiagolobocastro](https://github.com/tiagolobocastro))
* Add eviction tolerations to the provisioner pod ([#238](https://github.com/openebs/dynamic-localpv-provisioner/pull/238),[@niladrih](https://github.com/niladrih))

v4.1.4 / 2025-01-23
===================
* Let helm chart generate priorityClassName from go-template ([#236](https://github.com/openebs/dynamic-localpv-provisioner/pull/236),[@niladrih](https://github.com/niladrih))

v4.1.3 / 2025-01-22
===================
* Add pod priorityClassName to prevent race condition due to pod eviction ([#182](https://github.com/openebs/dynamic-localpv-provisioner/pull/182),[@bernardgut](https://github.com/bernardgut))
* Allow specifying additional labels to be applied to all helm chart resources ([#183](https://github.com/openebs/dynamic-localpv-provisioner/pull/183),[@laverya](https://github.com/laverya))

v4.1.2 / 2024-11-28
===================
* Fix bug where analytics toggle env configuration doesn't disable analytics ([#211](https://github.com/openebs/dynamic-localpv-provisioner/pull/211),[@emosbaugh](https://github.com/emosbaugh))

v4.1.1 / 2024-09-13
===================
* Update analytics dependency to v0.3.0 ([#200](https://github.com/openebs/dynamic-localpv-provisioner/pull/200),[@niladrih](https://github.com/niladrih))

v4.1.0 / 2024-07-03
===================
* feat(provisioner): update analytics pkg ([#188](https://github.com/openebs/dynamic-localpv-provisioner/pull/188),[@niladrih](https://github.com/niladrih))
4 changes: 3 additions & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Code of Conduct

<BR>

## Umbrella Project

OpenEBS is an "umbrella project". Every project, repository and file in the OpenEBS organization adopts and follows the policies found in the Community repo umbrella project files.
<BR>

This project follows the [OpenEBS Code of Conduct](https://github.com/openebs/community/blob/HEAD/CODE_OF_CONDUCT.md)
This project follows the [OpenEBS Code of Conduct](https://github.com/openebs/community/blob/HEAD/CODE_OF_CONDUCT.md)
69 changes: 39 additions & 30 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,55 @@
# Contributing Guidelines
<BR>

<br>

## Umbrella Project

OpenEBS is an "umbrella project". Every project, repository and file in the OpenEBS organization adopts and follows the policies found in the Community repo umbrella project files.
<BR>
<br>

This project follows the [OpenEBS Contributor Guidelines](https://github.com/openebs/community/blob/HEAD/CONTRIBUTING.md)

# Contributing to OpenEBS Dynamic Local PV Provisioner
## Contributing to OpenEBS Dynamic Local PV Provisioner

OpenEBS uses the standard GitHub pull requests process to review and accept contributions. There are several areas that could use your help. For starters, you could help in improving the sections in this document by either creating a new issue describing the improvement or submitting a pull request to this repository. The issues for the various OpenEBS components (including this repository) are maintained in [openebs/openebs](https://github.com/openebs/openebs/issues) repository.

* If you are a first-time contributor, please see [Steps to Contribute](#steps-to-contribute).
* If you have documentation improvement ideas, go ahead and create a pull request. See [Pull Request checklist](#pull-request-checklist).
* If you would like to make code contributions, please start with [Setting up the Development Environment](#setting-up-your-development-environment).
* If you would like to work on something more involved, please connect with the OpenEBS Contributors. See [OpenEBS Community](https://github.com/openebs/openebs/tree/master/community).
* If you would like to work on something more involved, please connect with the OpenEBS Contributors. See [OpenEBS Community](https://github.com/openebs/openebs/tree/HEAD/community).

## Steps to Contribute
### Steps to Contribute

OpenEBS is an Apache 2.0 Licensed project and all your commits should be signed with Developer Certificate of Origin. See [Sign your work](#sign-your-work).

* Find an issue to work on or create a new issue. The issues are maintained at [openebs/openebs](https://github.com/openebs/openebs/issues). You can pick up from a list of [good-first-issues](https://github.com/openebs/openebs/labels/good%20first%20issue).
* Claim your issue by commenting your intent to work on it to avoid duplication of efforts.
* Fork the repository on GitHub.
* Create a branch from where you want to base your work (usually master).
* Create a branch from where you want to base your work (usually `develop`).
* Make your changes. If you are working on code contributions, please see [Setting up the Development Environment](#setting-up-your-development-environment).
* Relevant coding style guidelines are the [Go Code Review Comments](https://code.google.com/p/go-wiki/wiki/CodeReviewComments) and the _Formatting and style_ section of Peter Bourgon's [Go: Best Practices for Production Environments](http://peter.bourgon.org/go-in-production/#formatting-and-style).
* Commit your changes by making sure the commit messages convey the need and notes about the commit.
* Push your changes to the branch in your fork of the repository.
* Submit a pull request to the original repository. See [Pull Request checklist](#pull-request-checklist).

## Pull Request Checklist
### Pull Request Checklist

* Rebase to the current master branch before submitting your pull request.
* Rebase to the current `develop` branch before submitting your pull request.
* Commits should be as small as possible. Each commit should follow the checklist below:
- For code changes, add tests relevant to the fixed bug or new feature.
- Pass the compile and tests - includes spell checks, formatting, etc.
- Commit header (first line) should convey what changed.
- Commit body should include details such as why the changes are required and how the proposed changes.
- DCO Signed.
* If your PR is not getting reviewed or you need a specific person to review it, please reach out to the OpenEBS Contributors. See [OpenEBS Community](https://github.com/openebs/openebs/tree/master/community).
* For code changes, add tests relevant to the fixed bug or new feature.
* Pass the compile and tests - includes spell checks, formatting, etc.
* Commit header (first line) should convey what changed.
* Commit body should include details such as why the changes are required and how the proposed changes.
* DCO Signed.
* If your PR is not getting reviewed or you need a specific person to review it, please reach out to the OpenEBS Contributors. See [OpenEBS Community](https://github.com/openebs/openebs/tree/HEAD/community).

## Sign your work
### Sign your work

We use the Developer Certificate of Origin (DCO) as an additional safeguard for the OpenEBS project. This is a well established and widely used mechanism to assure that contributors have confirmed their right to license their contribution under the project's license. Please read [dcofile](https://github.com/openebs/openebs/blob/master/contribute/developer-certificate-of-origin). If you can certify it, then just add a line to every git commit message:
We use the Developer Certificate of Origin (DCO) as an additional safeguard for the OpenEBS project. This is a well established and widely used mechanism to assure that contributors have confirmed their right to license their contribution under the project's license. Please read [dcofile](https://github.com/openebs/openebs/blob/HEAD/contribute/developer-certificate-of-origin). If you can certify it, then just add a line to every git commit message:

Please certify it by just adding a line to every git commit message. Any PR with Commits which does not have DCO Signoff will not be accepted:

```
```text
Signed-off-by: Random J Developer <random@developer.example.org>
```

@@ -56,38 +58,45 @@ If you set your `user.name` and `user.email` in git config, you can sign your co

You can also use git [aliases](https://git-scm.com/book/tr/v2/Git-Basics-Git-Aliases) like `git config --global alias.ci 'commit -s'`. Now you can commit with `git ci` and the commit will be signed.

## Setting up your Development Environment
### Setting up your Development Environment

This project is implemented using Go and uses the standard golang tools for development and build. In addition, this project heavily relies on Docker and Kubernetes. It is expected that the contributors:
- are familiar with working with Go;
- are familiar with Docker containers;
- are familiar with Kubernetes and have access to a Kubernetes cluster or Minikube to test the changes.

* are familiar with working with Go;
* are familiar with Docker containers;
* are familiar with Kubernetes and have access to a Kubernetes cluster or Minikube to test the changes.

For setting up a Development environment on your local host, see the detailed instructions [here](./docs/developer.md).

## Reviews against Pull Requests
### Reviews against Pull Requests

A PR can be reviewed by both core as well as external contributors. Below can be referred to during reviews:
- contributor should fix all the linting issues raised by the lint tools integrated with CI (`make test`)
- contributor should try to implement relevant golang based unit tests for the fix/enhancement (`make test`)
- contributor should try to rework on the review comments as much as possible
- a review comment can be taken up later if it falls under any of the following categories
- if the review comment talks about a new idiom or code pattern that is not currently in use by this repo
- if the review comment talks about the need to implement integration test corresponding to the fix/enhancement
- if contributor as well as reviewer agree that it can be addressed in a different PR
- contributor should follow below pattern in code comments when some rework needs to be done at a later point:

* contributor should fix all the linting issues raised by the lint tools integrated with CI (`make test`)
* contributor should try to implement relevant golang based unit tests for the fix/enhancement (`make test`)
* contributor should try to rework on the review comments as much as possible
* a review comment can be taken up later if it falls under any of the following categories
* if the review comment talks about a new idiom or code pattern that is not currently in use by this repo
* if the review comment talks about the need to implement integration test corresponding to the fix/enhancement
* if contributor as well as reviewer agree that it can be addressed in a different PR
* contributor should follow below pattern in code comments when some rework needs to be done at a later point:

```go
// TD: -- indicates technical debt
```

```go
// NBDD: -- indicates needs integration tests in BDD format _(i.e. ginkgo tests)_
```

```go
// TD: SMALL -- indicates few/similar code changes & hence less impact
```

```go
// TD: MEDIUM -- indicates code changes at multiple files & may impact certain feature
```

```go
// TD: LARGE -- indicates code changes at multiple files & has impact on more than one features
```
4 changes: 3 additions & 1 deletion GOVERNANCE.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Governance

<BR>

## Umbrella Project

OpenEBS is an "umbrella project". Every project, repository and file in the OpenEBS organization adopts and follows the policies found in the Community repo umbrella project files.
<BR>

This project follows the [OpenEBS Governance](https://github.com/openebs/community/blob/HEAD/GOVERNANCE.md)
This project follows the [OpenEBS Governance](https://github.com/openebs/community/blob/HEAD/GOVERNANCE.md)
1 change: 0 additions & 1 deletion MAINTAINERS

This file was deleted.

10 changes: 10 additions & 0 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Maintainers

<BR>

## Umbrella Project

OpenEBS is an "umbrella project". Every project, repository and file in the OpenEBS organization adopts and follows the policies found in the Community repo umbrella project files.
<BR>

Please refer to the [OpenEBS Maintainers](https://github.com/openebs/community/blob/HEAD/MAINTAINERS.md).
71 changes: 52 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
@@ -23,21 +23,21 @@ PACKAGES = $(shell go list ./... | grep -v '/pkg/version\|tests')
PACKAGES_IT = $(shell go list ./... | grep -v 'pkg/client/generated' | grep 'tests')

# The images can be pushed to any docker/image registeries
# like docker hub, quay. The registries are specified in
# like docker hub, quay. The registries are specified in
# the `buildscripts/push` script.
#
# The images of a project or company can then be grouped
# or hosted under a unique organization key like `openebs`
#
# Each component (container) will be pushed to a unique
# repository under an organization.
# Putting all this together, an unique uri for a given
# Each component (container) will be pushed to a unique
# repository under an organization.
# Putting all this together, an unique uri for a given
# image comprises of:
# <registry url>/<image org>/<image repo>:<image-tag>
#
# IMAGE_ORG can be used to customize the organization
# under which images should be pushed.
# By default the organization name is `openebs`.
# IMAGE_ORG can be used to customize the organization
# under which images should be pushed.
# By default the organization name is `openebs`.

ifeq (${IMAGE_ORG}, )
IMAGE_ORG = openebs
@@ -46,14 +46,18 @@ endif
# If IMAGE_TAG is mentioned then TAG will be set to IMAGE_TAG
# If RELEASE_TAG is mentioned then TAG will be set to RELEAE_TAG
# If both are mentioned then TAG will be set to RELEASE_TAG
TAG=ci

# Set the path to the Chart.yaml file
ROOT_DIR:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
CHART_YAML:=${ROOT_DIR}/deploy/helm/charts/Chart.yaml
TAG := $(shell awk -F': ' '/^version:/ {print $$2}' $(CHART_YAML))

ifneq (${IMAGE_TAG}, )
TAG=${IMAGE_TAG:v%=%}
endif

ifneq (${RELEASE_TAG}, )
TAG=${RELEASE_TAG:v%=%}
ifeq (${RELEASE_TAG}, )
IMAGE_TAG=${RELEASE_TAG:v%=%}
endif

# Specify the name for the binaries
@@ -80,13 +84,16 @@ ifeq (${DBUILD_SITE_URL}, )
export DBUILD_SITE_URL
endif

# Specify the kubeconfig path to a Kubernetes cluster
# Specify the kubeconfig path to a Kubernetes cluster
# to run Hostpath integration tests
ifeq (${KUBECONFIG}, )
KUBECONFIG=${HOME}/.kube/config
export KUBECONFIG
endif

EXTERNAL_TOOLS=\
github.com/onsi/ginkgo/v2/ginkgo@v2.14.0

export DBUILD_ARGS=--build-arg DBUILD_DATE=${DBUILD_DATE} --build-arg DBUILD_REPO_URL=${DBUILD_REPO_URL} --build-arg DBUILD_SITE_URL=${DBUILD_SITE_URL} --build-arg BRANCH=${BRANCH} --build-arg RELEASE_TAG=${RELEASE_TAG}

.PHONY: all
@@ -96,7 +103,7 @@ all: test provisioner-localpv-image
deps:
@echo "--> Tidying up submodules"
@go mod tidy
@echo "--> Veryfying submodules"
@echo "--> Verifying submodules"
@go mod verify


@@ -106,25 +113,40 @@ verify-deps: deps
echo "go module files are out of date, please commit the changes to go.mod and go.sum"; exit 1; \
fi

.PHONY: bootstrap
bootstrap:
@for tool in $(EXTERNAL_TOOLS) ; do \
echo "+ Installing $$tool" ; \
GO111MODULE=on go install -mod=mod $$tool; \
done

.PHONY: clean
clean:
clean:
go clean -testcache
rm -rf bin
./ci/ci-test.sh clean
chmod -R u+w ${GOPATH}/bin/${PROVISIONER_LOCALPV} 2>/dev/null || true
chmod -R u+w ${GOPATH}/pkg/* 2>/dev/null || true
rm -rf ${GOPATH}/bin/${PROVISIONER_LOCALPV}
rm -rf ${GOPATH}/pkg/*

.PHONY: test
test: format vet
@echo "--> Running go test";
$(PWD)/buildscripts/test.sh ${XC_ARCH}
./buildscripts/test.sh ${XC_ARCH}

.PHONY: testv
testv: format
@echo "--> Running go test verbose" ;
@go test -v $(PACKAGES)

# Requires KUBECONFIG env and Ginkgo binary
.PHONY: helm-install
helm-install:
./ci/ci-test.sh install

.PHONY: integration-test
integration-test:
@cd tests && sudo -E env "PATH=${PATH}" ginkgo -v -failFast
./ci/ci-test.sh run -t

.PHONY: format
format:
@@ -138,9 +160,9 @@ vet:
@go list ./... | xargs go vet -composites

.PHONY: verify-src
verify-src:
verify-src:
@echo "--> Checking for git changes post running tests";
$(PWD)/buildscripts/check-diff.sh "format"
./buildscripts/check-diff.sh "format"


#Use this to build provisioner-localpv
@@ -149,7 +171,7 @@ provisioner-localpv:
@echo "----------------------------"
@echo "--> provisioner-localpv "
@echo "----------------------------"
@PNAME=${PROVISIONER_LOCALPV} CTLNAME=${PROVISIONER_LOCALPV} sh -c "'$(PWD)/buildscripts/build.sh'"
@PNAME=${PROVISIONER_LOCALPV} CTLNAME=${PROVISIONER_LOCALPV} sh -c "'./buildscripts/build.sh'"

.PHONY: provisioner-localpv-image
provisioner-localpv-image: provisioner-localpv
@@ -160,6 +182,17 @@ provisioner-localpv-image: provisioner-localpv
@cd buildscripts/provisioner-localpv && docker build -t ${PROVISIONER_LOCALPV_IMAGE_TAG} ${DBUILD_ARGS} . --no-cache
@rm buildscripts/provisioner-localpv/${PROVISIONER_LOCALPV}

.PHONY: image-tag
image-tag:
@echo ${TAG}

.PHONY: image-repo
image-repo:
@echo ${IMAGE_ORG}/${PROVISIONER_LOCALPV_IMAGE}

.PHONY: image-ref
image-ref:
@echo ${IMAGE_ORG}/${PROVISIONER_LOCALPV_IMAGE}:${TAG}

.PHONY: push
push:
47 changes: 23 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,33 @@
# Dynamic Kubernetes Local Persistent Volumes
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/openebs/dynamic-localpv-provisioner?color=orange&style=for-the-badge)](https://github.com/openebs/dynamic-localpv-provisioner/blob/develop/docs/quickstart.md)<br>
[![GitHub build (develop)](https://github.com/openebs/dynamic-localpv-provisioner/actions/workflows/build.yml/badge.svg?branch=develop)](https://github.com/openebs/dynamic-localpv-provisioner/actions/workflows/build.yml)
[![GitHub go.mod Go version (develop)](https://img.shields.io/github/go-mod/go-version/openebs/dynamic-localpv-provisioner/develop?style=flat)](https://github.com/openebs/dynamic-localpv-provisioner/blob/develop/go.mod)
[![codecov](https://codecov.io/gh/openebs/dynamic-localpv-provisioner/branch/develop/graph/badge.svg)](https://codecov.io/gh/openebs/dynamic-localpv-provisioner)
[![Go Report Card](https://goreportcard.com/badge/github.com/openebs/maya)](https://goreportcard.com/report/github.com/openebs/maya)
![stability-GA](https://img.shields.io/badge/stability-GA-33bbff.svg)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/openebs/dynamic-localpv-provisioner/blob/develop/LICENSE)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fopenebs%2Fdynamic-localpv-provisioner.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fopenebs%2Fdynamic-localpv-provisioner?ref=badge_shield)

[![Slack](https://img.shields.io/badge/chat-slack-ff1493.svg?style=flat-square)](https://kubernetes.slack.com/messages/openebs)
[![Community Meetings](https://img.shields.io/badge/Community-Meetings-blue)](https://us05web.zoom.us/j/87535654586?pwd=CigbXigJPn38USc6Vuzt7qSVFoO79X.1)
[![Go Report Card](https://goreportcard.com/badge/github.com/openebs/dynamic-localpv-provisioner)](https://goreportcard.com/report/github.com/openebs/dynamic-localpv-provisioner)
[![FOSSA Status](https://app.fossa.com/api/projects/custom%2B162%2Fgithub.com%2Fopenebs%2Fdynamic-localpv-provisioner.svg?type=shield&issueType=license)](https://app.fossa.com/projects/custom%2B162%2Fgithub.com%2Fopenebs%2Fdynamic-localpv-provisioner?ref=badge_shield&issueType=license)
[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/9666/badge)](https://www.bestpractices.dev/projects/9666)

<img width="300" align="right" alt="OpenEBS Logo" src="https://raw.githubusercontent.com/cncf/artwork/master/projects/openebs/stacked/color/openebs-stacked-color.png" xmlns="http://www.w3.org/1999/html">

<p align="justify">
<strong>OpenEBS Dynamic Local PV provisioner</strong> can be used to dynamically provision
Kubernetes Local Volumes using different kinds of storage available on the Kubernetes nodes.
<strong>OpenEBS Dynamic Local PV provisioner</strong> can be used to dynamically provision
Kubernetes Local Volumes using different kinds of storage available on the Kubernetes nodes.
<br>
</p>

## Project Status: GA

Local Persistent Volumes are great for distributed cloud native data services that can handle resiliency and availability and expect low-latency access to the storage. Local Persistent Volumes can be provisioned using the hostpath, NVMe or PCIe based SSDs, Hard Disks or on top of other filesystems like ZFS, LVM.
Local Persistent Volumes are great for distributed cloud native data services that can handle resiliency and availability and expect low-latency access to the storage. Local Persistent Volumes can be provisioned using the hostpath, NVMe or PCIe based SSDs, Hard Disks or on top of other filesystems like ZFS, LVM.

Some of the targetted applications are:

- Distributed SQL Databases like PostgreSQL
- Distributed No-SQL Databases like MongoDB, Cassandra
- Distributed Object Storages like MinIO (distributed mode)
- Distributed Streaming services like Apache Kakfa,
- Distributed Streaming services like Apache Kakfa,
- Distributed Logging and search services like ElasticSearch, Solr
- AI/ML workloads

## Overview
## Overview

Kubernetes Local persistent volumes allows users to access local storage through the
standard PVC interface in a simple and portable way. The PV contains node
@@ -59,21 +57,21 @@ Head over to the [CONTRIBUTING.md](./CONTRIBUTING.md) page.

## Roadmap

Find the Dynamic Local PV roadmap items at the [OpenEBS Roadmap page](https://github.com/openebs/openebs/blob/master/ROADMAP.md#dynamic-local-pvs).
Find the Dynamic Local PV roadmap items at the [OpenEBS Roadmap page](https://github.com/openebs/openebs/blob/HEAD/ROADMAP.md#dynamic-local-pvs).

## OpenEBS Adopters

Check out the list of organizations and users who have chosen OpenEBS to run their stateful workloads, over at the [OpenEBS Adopters page](https://github.com/openebs/openebs/blob/master/ADOPTERS.md).
Check out the list of organizations and users who have chosen OpenEBS to run their stateful workloads, over at the [OpenEBS Adopters page](https://github.com/openebs/openebs/blob/HEAD/ADOPTERS.md).

## Community, discussion, and support

Learn how to engage with the OpenEBS community on the [community page](https://github.com/openebs/openebs/tree/master/community).
Learn how to engage with the OpenEBS community on the [community page](https://github.com/openebs/openebs/tree/HEAD/community).

You can reach the maintainers of this project at:

- [Kubernetes Slack](http://slack.k8s.io/) channels:
* [#openebs](https://kubernetes.slack.com/messages/openebs/)
* [#openebs-dev](https://kubernetes.slack.com/messages/openebs-dev/)
- [Kubernetes Slack](http://slack.k8s.io/) channels:
- [#openebs](https://kubernetes.slack.com/messages/openebs/)
- [#openebs-dev](https://kubernetes.slack.com/messages/openebs-dev/)
- [Mailing List](https://lists.cncf.io/g/cncf-openebs-users)

### Code of conduct
@@ -83,10 +81,11 @@ Participation in the OpenEBS community is governed by the [CNCF Code of Conduct]
## Inspiration/Credit

OpenEBS Local PV has been inspired by the prior work done by the following the Kubernetes projects:
- https://github.com/kubernetes-sigs/sig-storage-lib-external-provisioner/tree/master/examples/hostpath-provisioner
- https://github.com/kubernetes-sigs/sig-storage-local-static-provisioner
- https://github.com/rancher/local-path-provisioner

- <https://github.com/kubernetes-sigs/sig-storage-lib-external-provisioner/tree/HEAD/examples/hostpath-provisioner>
- <https://github.com/kubernetes-sigs/sig-storage-local-static-provisioner>
- <https://github.com/rancher/local-path-provisioner>

## License Compliance

## License
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fopenebs%2Fdynamic-localpv-provisioner.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fopenebs%2Fdynamic-localpv-provisioner?ref=badge_large)
[![FOSSA Status](https://app.fossa.com/api/projects/custom%2B162%2Fgithub.com%2Fopenebs%2Fdynamic-localpv-provisioner.svg?type=large&issueType=license)](https://app.fossa.com/projects/custom%2B162%2Fgithub.com%2Fopenebs%2Fdynamic-localpv-provisioner?ref=badge_large&issueType=license)
7 changes: 5 additions & 2 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Release Process

OpenEBS Dynamic Local PV Provisioner follows a monthly release cadence. The scope of the release is determined by contributor availability. The scope is published in the [Release Tracker Projects](https://github.com/orgs/openebs/projects).

## Release Candidate Verification Checklist

Every release has release candidate builds that are created starting from the third week into the release. These release candidate builds help to freeze the scope and maintain the quality of the release. The release candidate builds will go through:

- Platform Verification
- Regression and Feature Verification Automated tests.
- Exploratory testing by QA engineers
@@ -31,10 +33,11 @@ Once the release is triggered, Github Actions release workflow has to be monitor
Images for the different components are published at the following location:

- Dynamic LocalPV Provisioner <br />
https://quay.io/repository/openebs/provisioner-localpv?tab=tags <br />
https://hub.docker.com/r/openebs/provisioner-localpv/tags <br />
<https://quay.io/repository/openebs/provisioner-localpv?tab=tags> <br />
<https://hub.docker.com/r/openebs/provisioner-localpv/tags> <br />

Once a release is created, update the release description with the changelog mentioned in `changelog/v1.9.x`. Once the changelogs are updated in the release, the repo owner needs to create a PR to `develop` with the following details:

1. update the changelog from `changelog/v1.9.x` to `CHANGELOG.md`
2. If a release is not an RC tag then PR should include the changes to remove `changelog/v1.9.x` folder.
3. If a release is an RC tag then PR should include the changes to remove the changelog from `changelog/v1.9.x` which are already mentioned in `CHANGELOG.md` as part of step number 1.
10 changes: 10 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Security Policy

<BR>

## Umbrella Project

OpenEBS is an "umbrella project". Every project, repository and file in the OpenEBS organization adopts and follows the policies found in the Community repo umbrella project files.
<BR>

This project follows the [OpenEBS Security Policy](https://github.com/openebs/community/blob/HEAD/SECURITY.md).
10 changes: 10 additions & 0 deletions SECURITY_CONTACTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Security Contacts

<BR>

## Umbrella Project

OpenEBS is an "umbrella project". Every project, repository and file in the OpenEBS organization adopts and follows the policies found in the Community repo umbrella project files.
<BR>

Please refer to the [OpenEBS Security Contacts](https://github.com/openebs/community/blob/HEAD/SECURITY_CONTACTS.md).
38 changes: 20 additions & 18 deletions buildscripts/build.sh
Original file line number Diff line number Diff line change
@@ -48,15 +48,16 @@ if [ -n "$RELEASE_TAG" ]; then
# Example: v1.10.0-custom maps to 1.10.0-custom
VERSION="${RELEASE_TAG#v}"
else
VERSION="ci"
BUILDDATE="$(date +%m-%d-%Y)"
SHORT_COMMIT="$(git rev-parse --short HEAD)"
VERSION="$CURRENT_BRANCH-$SHORT_COMMIT:$BUILDDATE"
fi

echo "Building for ${VERSION} VERSION"

# Determine the arch/os combos we're building for
UNAME=$(uname)
ARCH=$(uname -m)
if [ "$UNAME" != "Linux" -a "$UNAME" != "Darwin" ] ; then
if [ "$UNAME" != "Linux" ] && [ "$UNAME" != "Darwin" ] ; then
echo "Sorry, this OS is not supported yet."
exit 1
fi
@@ -82,8 +83,8 @@ fi

# Delete the old dir
echo "==> Removing old directory..."
rm -rf bin/${PNAME}/*
mkdir -p bin/${PNAME}/
rm -rf bin/"$PNAME"/*
mkdir -p bin/"$PNAME"/

# If its dev mode, only build for ourself
if [[ "${DEV}" ]]; then
@@ -96,43 +97,44 @@ echo "==> Building ${CTLNAME} using $(go version)... "

GOOS="${XC_OS}"
GOARCH="${XC_ARCH}"
output_name="bin/${PNAME}/"$GOOS"_"$GOARCH"/"$CTLNAME
output_name=bin/"$PNAME"/"$GOOS"_"$GOARCH"/$CTLNAME

if [ $GOOS = "windows" ]; then
if [ "$GOOS" = "windows" ]; then
output_name+='.exe'
fi

env GOOS=$GOOS GOARCH=$GOARCH go build ${BUILD_TAG} -ldflags \
env GOOS="$GOOS" GOARCH="$GOARCH" CGO_ENABLED=0 go build -ldflags \
"-X github.com/openebs/maya/pkg/version.GitCommit=${GIT_COMMIT} \
-X main.CtlName='${CTLNAME}' \
-X github.com/openebs/maya/pkg/version.Version=${VERSION}" \
-o $output_name\
./cmd/${CTLNAME}
-o "$output_name"\
./cmd/"${CTLNAME}"

echo ""

# Move all the compiled things to the $GOPATH/bin
GOPATH=${GOPATH:-$(go env GOPATH)}
case $(uname) in
CYGWIN*)
GOPATH="$(cygpath $GOPATH)"
GOPATH=$(cygpath "$GOPATH")
;;
esac
OLDIFS=$IFS
IFS=: MAIN_GOPATH=($GOPATH)
IFS=: MAIN_GOPATH="$GOPATH"
IFS=$OLDIFS

# Create the gopath bin if not already available
mkdir -p ${MAIN_GOPATH}/bin/
mkdir -p "${MAIN_GOPATH}"/bin/

# Copy our OS/Arch to the bin/ directory
DEV_PLATFORM="./bin/${PNAME}/$(go env GOOS)_$(go env GOARCH)"
for F in $(find ${DEV_PLATFORM} -mindepth 1 -maxdepth 2 -type f); do
cp ${F} bin/${PNAME}/
cp ${F} ${MAIN_GOPATH}/bin/
DEV_PLATFORM=./bin/"${PNAME}"/$(go env GOOS)_$(go env GOARCH)
find "${DEV_PLATFORM}" -mindepth 1 -maxdepth 1 -type f -print0 | while IFS= read -r -d '' file
do
cp "$file" bin/"${PNAME}"/
cp "$file" "${MAIN_GOPATH}"/bin/
done

# Done!
echo
echo "==> Results:"
ls -hl bin/${PNAME}/
ls -hl bin/"${PNAME}"/
1 change: 1 addition & 0 deletions changelogs/released/v4.1.1/200-niladrih
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update analytics dependency to v0.3.0
1 change: 1 addition & 0 deletions changelogs/released/v4.1.2/211-emosbaugh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix bug where analytics toggle env configuration doesn't disable analytics
1 change: 1 addition & 0 deletions changelogs/released/v4.1.3/182-bernardgut
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add pod priorityClassName to prevent race condition due to pod eviction
1 change: 1 addition & 0 deletions changelogs/released/v4.1.3/183-laverya
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
allow specifying additional labels to be applied to all helm chart resources
1 change: 1 addition & 0 deletions changelogs/released/v4.1.4/236-niladrih
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Let helm chart generate priorityClassName from go-template
1 change: 1 addition & 0 deletions changelogs/released/v4.2.0/190-nobiit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add feature to merge cas-config from PVC
1 change: 1 addition & 0 deletions changelogs/released/v4.2.0/224-mctech
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
support helper pod to use hostNetwork
1 change: 1 addition & 0 deletions changelogs/released/v4.2.0/227-lkummer
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add global.imageRegistry Helm chart parameter
1 change: 1 addition & 0 deletions changelogs/released/v4.2.0/237-tiagolobocastro
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
don't wait forever if the launch pod failed
1 change: 1 addition & 0 deletions changelogs/released/v4.2.0/238-niladrih
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add eviction tolerations to the provisioner pod
290 changes: 290 additions & 0 deletions ci/ci-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,290 @@
#!/usr/bin/env bash

set -eu

SCRIPT_DIR="$(dirname "$(realpath "${BASH_SOURCE[0]:-"$0"}")")"
export OPENEBS_NAMESPACE=${OPENEBS_NAMESPACE:-openebs}
TEST_DIR="$SCRIPT_DIR"/../tests

help() {
cat <<EOF >&2
Usage: $(basename "${0}") [COMMAND] [OPTIONS]
Commands:
run Run the tests.
load Build and load the image into the K8s cluster.
install Install helm chart and wait for it to be ready.
clean Clean the leftovers.
Options:
-h, --help Display this text.
Options for run:
-r, --reset Clean before running the tests.
-x, --no-cleanup Don't cleanup after running the tests.
-b, --build-always Build and load the images before running the tests. [ By default image is built if not present only ]
-t, --test-only Don't install, test only.
Examples:
$(basename "${0}") run -rxb
EOF
}

echo_err() {
echo -e "ERROR: $1" >&2
}

needs_help() {
[ -n "${1:-}" ] && echo_err "$1\n"
help
exit 1
}

die() {
echo_err "FATAL: $1"
exit 1
}

cleanup() {
set +e

echo "Cleaning up test resources"

if kubectl get nodes 2>/dev/null; then
kubectl delete deployment -lrole=test -A
kubectl delete pod -lrole=test --force -A

sleep 3

if helm uninstall localpv-provisioner -n "$OPENEBS_NAMESPACE" --ignore-not-found --timeout=1m --wait; then
kubectl delete pod --force --all -n "$OPENEBS_NAMESPACE"
fi
fi

set -e
# always return true
return 0
}

dump_provisioner_logs() {
NR=$1
POD=$(kubectl get pods -l app=localpv-provisioner -o jsonpath='{.items[0].metadata.name}' -n "$OPENEBS_NAMESPACE")
kubectl describe po "$POD" -n "$OPENEBS_NAMESPACE"
printf "\n\n"
kubectl logs --tail="${NR}" "$POD" -n "$OPENEBS_NAMESPACE" -c localpv-provisioner
printf "\n\n"
}

dump_logs() {
echo "******************** Dynamic LocalPV-Provisioner logs ***************************** "
dump_provisioner_logs 1000

echo "get all the pods"
kubectl get pods -owide --all-namespaces

echo "get pvc and pv details"
kubectl get pvc,pv -oyaml --all-namespaces

echo "get sc details"
kubectl get sc --all-namespaces -oyaml
}

is_pod_ready(){
[ "$(kubectl get po "$1" -o 'jsonpath={.status.conditions[?(@.type=="Ready")].status}' -n "$OPENEBS_NAMESPACE")" = 'True' ] &&
[ "$(kubectl get po "$1" -o 'jsonpath={.metadata.deletionTimestamp}' -n "$OPENEBS_NAMESPACE")" = "" ]
}

is_provisioner_ready(){
for pod in $localDriver;do
is_pod_ready "$pod" || return 1
done
}

wait_for_provisioner_ready() {
period=120
interval=1
i=0
while [ "$i" -le "$period" ]; do
localDriver="$(kubectl get pods -l release=localpv-provisioner -o 'jsonpath={.items[*].metadata.name}' -n "$OPENEBS_NAMESPACE")"
if is_provisioner_ready "$localDriver"; then
return 0
fi

i=$(( i + interval ))
echo "Waiting for localpv-provisioner to be ready..."
sleep "$interval"
done

echo "Waited for $period seconds, but all pods are not ready yet."
return 1
}

helm_install() {
helm install localpv-provisioner ./deploy/helm/charts -n "$OPENEBS_NAMESPACE" --create-namespace --set localpv.image.pullPolicy=Never --set analytics.enabled=false

wait_for_provisioner_ready

kubectl get pods -n "$OPENEBS_NAMESPACE"
}

run_test_suit() {
wait_for_provisioner_ready

cd "$TEST_DIR"

echo "running ginkgo test case with coverage"

# --focus="TEST HOSTPATH EXT4 QUOTA LOCAL PV WITH UNSUPPORTED FILESYSTEM"
if ! sudo -E env "PATH=${PATH}" ginkgo -v -coverprofile="integration_coverage.txt" -covermode=atomic; then
dump_logs
[ "$CLEAN_AFTER" = "true" ] && cleanup
exit 1
fi
}

run() {
[ "$CLEAN_BEFORE" = "true" ] && cleanup

if [ "$TEST_ONLY" = "false" ]; then
maybe_load_image
helm_install
fi

run_test_suit

printf "\n\n"
echo "######### All test cases passed #########"

[ "$CLEAN_AFTER" = "true" ] && cleanup
}

load_k3s() {
if [ "${CI_K3S:-}" = "true" ]; then
local img="${1:-}"
if [ -z "${1:-}" ]; then
repo="$(make image-repo -s -C "$SCRIPT_DIR"/.. 2>/dev/null)"
tag="$(make image-tag -s -C "$SCRIPT_DIR"/.. 2>/dev/null)"
img="$repo:$tag"
fi
docker save "$img" | ctr images import -
fi
}

load_image() {
make provisioner-localpv-image
load_k3s "${1:-}"
}

maybe_load_image() {
local repo tag img did cid

if [ "$BUILD_ALWAYS" = "true" ]; then
load_image
return 0
fi

repo="$(make image-repo -s -C "$SCRIPT_DIR"/.. 2>/dev/null)"
tag="$(make image-tag -s -C "$SCRIPT_DIR"/.. 2>/dev/null)"
img="$repo:$tag"

did="$(docker image ls --no-trunc --format json | jq -r --arg repo "$repo" --arg tag "$tag" 'select(.Repository == $repo and .Tag == $tag)|.ID')"
if [ -z "$did" ]; then
make provisioner-localpv-image
fi

if ! [ "${CI_K3S:-}" = "true" ]; then
return 0
fi

cid="$(crictl image --output json | jq -r --arg image "docker.io/$(make image-ref -s -C "$SCRIPT_DIR"/.. 2>/dev/null)" '.images[]|select(.repoTags[0] == $image)|.id')"
# If image not present, or different to the docker source, then rebuild it!
if [ -z "$cid" ] || [ "$cid" != "$did" ]; then
load_image "$img"
return 0
fi

return 0
}


# allow override
if [ -z "${KUBECONFIG:-}" ]
then
export KUBECONFIG="${HOME}/.kube/config"
fi

COMMAND=
CLEAN_BEFORE="false"
CLEAN_AFTER="true"
BUILD_ALWAYS="false"
TEST_ONLY="false"

while test $# -gt 0; do
arg="$1"
case "$arg" in
run | clean | load | install)
[ -n "$COMMAND" ] && needs_help "Can't specify two commands"
COMMAND="$1"
;;
-r | --reset)
CLEAN_BEFORE="true"
;;
-x | --no-cleanup)
CLEAN_AFTER="false"
;;
-b | --build-always)
BUILD_ALWAYS="true"
;;
-t | --test-only)
TEST_ONLY="true"
;;
-h | --help)
needs_help
;;
-*)
singleLetterOpts="${1:1}"
while [ -n "$singleLetterOpts" ]; do
case "${singleLetterOpts:0:1}" in
r)
CLEAN_BEFORE="true"
;;
x)
CLEAN_AFTER="false"
;;
b)
BUILD_ALWAYS="true"
;;
t)
TEST_ONLY="true"
;;
*)
needs_help "Unrecognized argument $singleLetterOpts"
;;
esac
singleLetterOpts="${singleLetterOpts:1}"
done
;;
*)
needs_help "Unrecognized argument $1"
;;
esac
shift
done

case "$COMMAND" in
clean)
cleanup
;;
load)
load_image
;;
install)
helm_install
;;
run)
run
;;
*)
needs_help "Missing Command"
;;
esac
48 changes: 19 additions & 29 deletions cmd/provisioner-localpv/app/config.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
/*
Copyright 2019 The OpenEBS Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package app

import (
@@ -26,7 +9,7 @@ import (
cast "github.com/openebs/maya/pkg/castemplate/v1alpha1"
hostpath "github.com/openebs/maya/pkg/hostpath/v1alpha1"
"github.com/openebs/maya/pkg/util"
errors "github.com/pkg/errors"
"github.com/pkg/errors"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/klog/v2"
@@ -143,7 +126,7 @@ const (
)

// GetVolumeConfig creates a new VolumeConfig struct by
// parsing and merging the configuration provided in the PVC
// parsing and merging the configuration provided in the PVC/SC
// annotation - cas.openebs.io/config with the
// default configuration of the provisioner.
func (p *Provisioner) GetVolumeConfig(ctx context.Context, pvName string, pvc *corev1.PersistentVolumeClaim) (*VolumeConfig, error) {
@@ -169,16 +152,23 @@ func (p *Provisioner) GetVolumeConfig(ctx context.Context, pvName string, pvc *c
}
}

//TODO : extract and merge the cas volume config from pvc
//This block can be added once validation checks are added
// as to the type of config that can be passed via PVC
//pvcCASConfigStr := pvc.ObjectMeta.Annotations[string(mconfig.CASConfigKey)]
//if len(strings.TrimSpace(pvcCASConfigStr)) != 0 {
// pvcCASConfig, err := cast.UnMarshallToConfig(pvcCASConfigStr)
// if err == nil {
// pvConfig = cast.MergeConfig(pvcCASConfig, pvConfig)
// }
//}
// Extract and merge the cas config from persistentvolumeclaim.
// TODO: Validation checks for what all cas-config options can be
// set on the PVC.
pvcCASConfigStr := pvc.Annotations[string(mconfig.CASConfigKey)]
klog.V(4).Infof("PVC %v has config:%v", pvc.Name, pvcCASConfigStr)
if len(strings.TrimSpace(pvcCASConfigStr)) != 0 {
pvcCASConfig, err := cast.UnMarshallToConfig(pvcCASConfigStr)
if err == nil {
// Config keys which already exist (SC config),
// will be skipped
// i.e. SC config will have precedence over PVC config,
// if both have the same keys
pvConfig = cast.MergeConfig(pvConfig, pvcCASConfig)
} else {
return nil, errors.Wrapf(err, "failed to get config: invalid pvc config {%v}", pvcCASConfigStr)
}
}

pvConfigMap, err := cast.ConfigToMap(pvConfig)
if err != nil {
25 changes: 9 additions & 16 deletions cmd/provisioner-localpv/app/env.go
Original file line number Diff line number Diff line change
@@ -1,23 +1,8 @@
/*
Copyright 2019 The OpenEBS Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package app

import (
menv "github.com/openebs/maya/pkg/env/v1alpha1"
k8sEnv "k8s.io/utils/env"
)

//This file defines the environement variable names that are specific
@@ -35,6 +20,10 @@ const (
// host path
ProvisionerHelperImage menv.ENVKey = "OPENEBS_IO_HELPER_IMAGE"

// ProvisionerHelperPodHostNetwork is the environment variable that provides the
// host network mode to be used to launch the help pods
ProvisionerHelperPodHostNetwork string = "OPENEBS_IO_HELPER_POD_HOST_NETWORK"

// ProvisionerBasePath is the environment variable that provides the
// default base path on the node where host-path PVs will be provisioned.
ProvisionerBasePath menv.ENVKey = "OPENEBS_IO_BASE_PATH"
@@ -55,6 +44,10 @@ func getOpenEBSNamespace() string {
func getDefaultHelperImage() string {
return menv.GetOrDefault(ProvisionerHelperImage, string(defaultHelperImage))
}
func getHelperPodHostNetwork() bool {
val, _ := k8sEnv.GetBool(ProvisionerHelperPodHostNetwork, false)
return val
}

func getDefaultBasePath() string {
return menv.GetOrDefault(ProvisionerBasePath, string(defaultBasePath))
51 changes: 35 additions & 16 deletions cmd/provisioner-localpv/app/env_test.go
Original file line number Diff line number Diff line change
@@ -1,24 +1,9 @@
/*
Copyright 2019 The OpenEBS Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package app

import (
"os"
"reflect"
"strconv"
"testing"

menv "github.com/openebs/maya/pkg/env/v1alpha1"
@@ -92,6 +77,40 @@ func TestGetDefaultHelperImage(t *testing.T) {
}
}

func TestGetHelperPodHostNetworke(t *testing.T) {
testCases := map[string]struct {
value string
expectValue string
}{
"Missing env variable": {
value: "",
expectValue: "false",
},
"Present env variable with value": {
value: "value1",
expectValue: "false",
},
"Present env variable with whitespaces": {
value: "true",
expectValue: "true",
},
}

for k, v := range testCases {
v := v
t.Run(k, func(t *testing.T) {
if len(v.value) != 0 {
os.Setenv(string(ProvisionerHelperPodHostNetwork), v.value)
}
actualValue := strconv.FormatBool(getHelperPodHostNetwork())
if !reflect.DeepEqual(actualValue, v.expectValue) {
t.Errorf("expected %s got %s", v.expectValue, actualValue)
}
os.Unsetenv(string(ProvisionerHelperPodHostNetwork))
})
}
}

func TestGetDefaultBasePath(t *testing.T) {
testCases := map[string]struct {
value string
28 changes: 9 additions & 19 deletions cmd/provisioner-localpv/app/helper_hostpath.go
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
/*
Copyright 2019 The OpenEBS Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
This code was taken from https://github.com/rancher/local-path-provisioner
and modified to work with the configuration options used by OpenEBS
*/

package app

import (
@@ -84,6 +65,9 @@ type HelperPodOptions struct {

//pvcStorage is the storage requested for pv
pvcStorage int64

//hostNetwork is the network type of helper Pod
hostNetwork bool
}

// validate checks that the required fields to launch
@@ -357,6 +341,7 @@ func (p *Provisioner) launchPod(ctx context.Context, config podConfig) (*corev1.
WithName("dev").
WithHostDirectory("/dev/"),
).
WithHostNetwork(config.pOpts.hostNetwork).
Build()

if err != nil {
@@ -387,6 +372,11 @@ func (p *Provisioner) exitPod(ctx context.Context, hPod *corev1.Pod) error {
} else if checkPod.Status.Phase == corev1.PodSucceeded {
completed = true
break
} else {
// Currently we use `RestartPolicyNever`, if this changes we may need a different logic here, ex: x many restarts.
if checkPod.Spec.RestartPolicy == corev1.RestartPolicyNever && checkPod.Status.Phase == corev1.PodFailed {
return errors.Errorf("pod %v has failed", checkPod.Name)
}
}
time.Sleep(1 * time.Second)
}
21 changes: 12 additions & 9 deletions cmd/provisioner-localpv/app/provisioner.go
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@ import (
analytics "github.com/openebs/google-analytics-4/usage"
"github.com/openebs/maya/pkg/alertlog"
mconfig "github.com/openebs/maya/pkg/apis/openebs.io/v1alpha1"
menv "github.com/openebs/maya/pkg/env/v1alpha1"
"github.com/pkg/errors"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
@@ -192,15 +193,17 @@ func (p *Provisioner) Delete(ctx context.Context, pv *v1.PersistentVolume) (err

// sendEventOrIgnore sends anonymous local-pv provision/delete events
func sendEventOrIgnore(pvcName, pvName, capacity, stgType, method string) {
stgType = "local-" + stgType

analytics.New().CommonBuild(stgType).ApplicationBuilder().
SetVolumeName(pvName).
SetVolumeClaimName(pvcName).
SetReplicaCount(DefaultUnknownReplicaCount).
SetCategory(method).
SetVolumeCapacity(capacity).
Send()
if menv.Truthy(menv.OpenEBSEnableAnalytics) {
stgType = "local-" + stgType

analytics.New().CommonBuild(stgType).ApplicationBuilder().
SetVolumeName(pvName).
SetVolumeClaimName(pvcName).
SetReplicaCount(DefaultUnknownReplicaCount).
SetCategory(method).
SetVolumeCapacity(capacity).
Send()
}
}

// validateVolumeSource validates datasource field of the pvc.
24 changes: 8 additions & 16 deletions cmd/provisioner-localpv/app/provisioner_hostpath.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
/*
Copyright 2019 The OpenEBS Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package app

import (
@@ -74,6 +58,8 @@ func (p *Provisioner) ProvisionHostPath(ctx context.Context, opts pvController.P

imagePullSecrets := GetImagePullSecrets(getOpenEBSImagePullSecrets())

hostNetwork := getHelperPodHostNetwork()

klog.Infof("Creating volume %v at node with labels {%v}, path:%v,ImagePullSecrets:%v", name, nodeAffinityLabels, path, imagePullSecrets)

//Before using the path for local PV, make sure it is created.
@@ -86,6 +72,7 @@ func (p *Provisioner) ProvisionHostPath(ctx context.Context, opts pvController.P
serviceAccountName: saName,
selectedNodeTaints: taints,
imagePullSecrets: imagePullSecrets,
hostNetwork: hostNetwork,
}
iErr := p.createInitPod(ctx, podOpts)
if iErr != nil {
@@ -115,6 +102,7 @@ func (p *Provisioner) ProvisionHostPath(ctx context.Context, opts pvController.P
softLimitGrace: softLimitGrace,
hardLimitGrace: hardLimitGrace,
pvcStorage: pvcStorage,
hostNetwork: hostNetwork,
}
iErr := p.createQuotaPod(ctx, podOpts)
if iErr != nil {
@@ -151,6 +139,7 @@ func (p *Provisioner) ProvisionHostPath(ctx context.Context, opts pvController.P
softLimitGrace: softLimitGrace,
hardLimitGrace: hardLimitGrace,
pvcStorage: pvcStorage,
hostNetwork: hostNetwork,
}
iErr := p.createQuotaPod(ctx, podOpts)
if iErr != nil {
@@ -278,6 +267,8 @@ func (p *Provisioner) DeleteHostPath(ctx context.Context, pv *v1.PersistentVolum

imagePullSecrets := GetImagePullSecrets(getOpenEBSImagePullSecrets())

hostNetwork := getHelperPodHostNetwork()

//Initiate clean up only when reclaim policy is not retain.
klog.Infof("Deleting volume %v at %v:%v", pv.Name, GetNodeHostname(nodeObject), path)
cleanupCmdsForPath := []string{"rm", "-rf"}
@@ -289,6 +280,7 @@ func (p *Provisioner) DeleteHostPath(ctx context.Context, pv *v1.PersistentVolum
serviceAccountName: saName,
selectedNodeTaints: taints,
imagePullSecrets: imagePullSecrets,
hostNetwork: hostNetwork,
}

if err := p.createCleanupPod(ctx, podOpts); err != nil {
5 changes: 3 additions & 2 deletions ct.yaml
Original file line number Diff line number Diff line change
@@ -3,5 +3,6 @@ remote: origin
target-branch: develop
chart-dirs:
- deploy/helm
helm-extra-args: --timeout=500s
validate-maintainers: false
# helm-extra-args: --timeout=500s
validate-maintainers: false
check-version-increment: false
4 changes: 2 additions & 2 deletions deploy/helm/charts/Chart.yaml
Original file line number Diff line number Diff line change
@@ -4,10 +4,10 @@ description: Helm chart for OpenEBS Dynamic Local PV. For instructions to instal
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
version: 4.0.0
version: 4.2.0-prerelease
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
appVersion: 4.0.0
appVersion: 4.2.0-prerelease
icon: https://raw.githubusercontent.com/cncf/artwork/master/projects/openebs/icon/color/openebs-icon-color.png
home: http://www.openebs.io/
keywords:
8 changes: 5 additions & 3 deletions deploy/helm/charts/README.md
Original file line number Diff line number Diff line change
@@ -68,13 +68,14 @@ helm install openebs-localpv openebs-localpv/localpv-provisioner --namespace ope

| Parameter | Description | Default |
| ------------------------------------------- |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------|
| `release.version` | LocalPV Provisioner release version | `4.0.0` |
| `analytics.enabled` | Enable sending stats to Google Analytics | `true` |
| `analytics.pingInterval` | Duration(hours) between sending ping stat | `24h` |
| `extraLabels` | Additional labels to add to all chart resources | `{}` |
| `global.imageRegistry` | Default image registry, overridden by localpv.image.registry and helperPod.image.registry | `""` |
| `helperPod.image.registry` | Registry for helper image | `""` |
| `helperPod.image.repository` | Image for helper pod | `"openebs/linux-utils"` |
| `helperPod.image.pullPolicy` | Pull policy for helper pod | `"IfNotPresent"` |
| `helperPod.image.tag` | Image tag for helper image | `4.0.0` |
| `helperPod.image.tag` | Image tag for helper image | `4.1.0` |
| `hostpathClass.basePath` | BasePath for openebs-hostpath StorageClass | `"/var/openebs/local"` |
| `hostpathClass.enabled` | Enables creation of default Hostpath StorageClass | `true` |
| `hostpathClass.isDefaultClass` | Make openebs-hostpath the default StorageClass | `"false"` |
@@ -87,7 +88,7 @@ helm install openebs-localpv openebs-localpv/localpv-provisioner --namespace ope
| `localpv.image.registry` | Registry for LocalPV Provisioner image | `""` |
| `localpv.image.repository` | Image repository for LocalPV Provisioner | `openebs/localpv-provisioner` |
| `localpv.image.pullPolicy` | Image pull policy for LocalPV Provisioner | `IfNotPresent` |
| `localpv.image.tag` | Image tag for LocalPV Provisioner | `4.0.0` |
| `localpv.image.tag` | Image tag for LocalPV Provisioner | `4.1.1` |
| `localpv.updateStrategy.type` | Update strategy for LocalPV Provisioner | `RollingUpdate` |
| `localpv.annotations` | Annotations for LocalPV Provisioner metadata | `""` |
| `localpv.podAnnotations` | Annotations for LocalPV Provisioner pods metadata | `""` |
@@ -102,6 +103,7 @@ helm install openebs-localpv openebs-localpv/localpv-provisioner --namespace ope
| `localpv.replicas` | No. of LocalPV Provisioner replica | `1` |
| `localpv.enableLeaderElection` | Enable leader election | `true` |
| `localpv.affinity` | LocalPV Provisioner pod affinity | `{}` |
| `localpv.priorityClassName` | Sets priorityClassName in pod | `""` |
| `rbac.create` | Enable RBAC Resources | `true` |
| `rbac.pspEnabled` | Create pod security policy resources | `false` |

5 changes: 1 addition & 4 deletions deploy/helm/charts/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -2,11 +2,8 @@ The OpenEBS Dynamic LocalPV Provisioner has been installed.
Check its status by running:
$ kubectl get pods -n {{ .Release.Namespace }}

Use `kubectl get bd -n {{ .Release.Namespace }}` to list the
blockdevices attached to the Kubernetes cluster nodes.

Get started with the Dynamic LocalPV Provisioner Quickstart guide at:
https://github.com/openebs/dynamic-localpv-provisioner/blob/develop/docs/quickstart.md

For more information, visit our Slack at https://openebs.io/community or view
For more information, visit our Slack at https://kubernetes.slack.com/messages/openebs or view
the OpenEBS documentation online at https://openebs.io/docs
16 changes: 14 additions & 2 deletions deploy/helm/charts/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -38,7 +38,6 @@ Meta labels
{{- define "localpv.common.metaLabels" -}}
chart: {{ template "localpv.chart" . }}
heritage: {{ .Release.Service }}
openebs.io/version: {{ .Values.release.version | quote }}
{{- end -}}

{{/*
@@ -66,7 +65,6 @@ Common labels
{{ include "localpv.componentLabels" . }}
{{- end -}}


{{/*
Create the name of the service account to use
*/}}
@@ -77,3 +75,17 @@ Create the name of the service account to use
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}

{{/*
Creates the tolerations based on the global tolerations, with early eviction
Usage:
{{ include "tolerations_with_early_eviction" . }}
*/}}
{{- define "tolerations_with_early_eviction" -}}
{{- if .Values.earlyEvictionTolerations }}
{{- toYaml .Values.earlyEvictionTolerations | nindent 8 }}
{{- end }}
{{- if .Values.localpv.tolerations }}
{{- toYaml .Values.localpv.tolerations | nindent 8 }}
{{- end }}
{{- end }}
30 changes: 24 additions & 6 deletions deploy/helm/charts/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -8,6 +8,9 @@ metadata:
{{- end }}
labels:
{{- include "localpv.labels" . | nindent 4 }}
{{- if .Values.extraLabels -}}
{{- toYaml .Values.extraLabels | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.localpv.replicas }}
strategy:
@@ -23,10 +26,16 @@ spec:
{{- end }}
labels:
{{- include "localpv.labels" . | nindent 8 }}
{{- if .Values.extraLabels -}}
{{- toYaml .Values.extraLabels | nindent 8 }}
{{- end }}
{{- with .Values.localpv.podLabels }}
{{ toYaml . | nindent 8 }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- if .Values.localpv.priorityClassName }}
priorityClassName: {{ tpl .Values.localpv.priorityClassName . }}
{{- end }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
@@ -36,7 +45,7 @@ spec:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ template "localpv.fullname" . }}
image: "{{ .Values.localpv.image.registry }}{{ .Values.localpv.image.repository }}:{{ .Values.localpv.image.tag }}"
image: "{{ with .Values.localpv.image.registry | default .Values.global.imageRegistry | trimSuffix "/" }}{{ . }}/{{ end }}{{ .Values.localpv.image.repository }}:{{ .Values.localpv.image.tag }}"
imagePullPolicy: {{ .Values.localpv.image.pullPolicy }}
resources:
{{ toYaml .Values.localpv.resources | indent 10 }}
@@ -69,10 +78,20 @@ spec:
# default base path on the node where host-path PVs will be provisioned.
- name: OPENEBS_IO_ENABLE_ANALYTICS
value: "{{ .Values.analytics.enabled }}"
{{- if .Values.analytics.gaId }}
- name: GA_ID
value: {{ .Values.analytics.gaId | quote }}
{{- end }}
{{- if .Values.analytics.gaKey }}
- name: GA_KEY
value: {{ .Values.analytics.gaKey | quote }}
{{- end }}
- name: OPENEBS_IO_BASE_PATH
value: "{{ .Values.localpv.basePath }}"
- name: OPENEBS_IO_HELPER_IMAGE
value: "{{ .Values.helperPod.image.registry }}{{ .Values.helperPod.image.repository }}:{{ .Values.helperPod.image.tag }}"
value: "{{ with .Values.helperPod.image.registry | default .Values.global.imageRegistry | trimSuffix "/" }}{{ . }}/{{ end }}{{ .Values.helperPod.image.repository }}:{{ .Values.helperPod.image.tag }}"
- name: OPENEBS_IO_HELPER_POD_HOST_NETWORK
value: "{{ .Values.helperPod.hostNetwork }}"
- name: OPENEBS_IO_INSTALLER_TYPE
value: "localpv-charts-helm"
# LEADER_ELECTION_ENABLED is used to enable/disable leader election. By default
@@ -101,9 +120,8 @@ spec:
nodeSelector:
{{ toYaml .Values.localpv.nodeSelector | indent 8 }}
{{- end }}
{{- if .Values.localpv.tolerations }}
tolerations:
{{ toYaml .Values.localpv.tolerations | indent 8 }}
{{- if $tolerations := include "tolerations_with_early_eviction" . }}
tolerations: {{ $tolerations }}
{{- end }}
{{- if .Values.localpv.affinity }}
affinity:
3 changes: 3 additions & 0 deletions deploy/helm/charts/templates/hostpath-class.yaml
Original file line number Diff line number Diff line change
@@ -34,6 +34,9 @@ metadata:
{{- if .Values.hostpathClass.isDefaultClass }}
storageclass.kubernetes.io/is-default-class: "true"
{{- end }}
{{- if .Values.extraLabels }}
labels: {{- toYaml .Values.extraLabels | nindent 4 -}}
{{- end }}
provisioner: openebs.io/local
volumeBindingMode: WaitForFirstConsumer
reclaimPolicy: {{ .Values.hostpathClass.reclaimPolicy }}
3 changes: 3 additions & 0 deletions deploy/helm/charts/templates/psp.yaml
Original file line number Diff line number Diff line change
@@ -8,6 +8,9 @@ metadata:
{{- end }}
labels:
{{- include "localpv.labels" . | nindent 4 }}
{{- if .Values.extraLabels -}}
{{- toYaml .Values.extraLabels | nindent 4 }}
{{- end }}
spec:
privileged: {{ .Values.localpv.privileged }}
allowPrivilegeEscalation: true
15 changes: 15 additions & 0 deletions deploy/helm/charts/templates/rbac.yaml
Original file line number Diff line number Diff line change
@@ -5,6 +5,9 @@ metadata:
name: {{ include "localpv.serviceAccountName" . }}
labels:
{{- include "localpv.labels" . | nindent 4 }}
{{- if .Values.extraLabels -}}
{{- toYaml .Values.extraLabels | nindent 4 }}
{{- end }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
@@ -21,6 +24,9 @@ metadata:
{{- end }}
labels:
{{- include "localpv.labels" . | nindent 4 }}
{{- if .Values.extraLabels -}}
{{- toYaml .Values.extraLabels | nindent 4 }}
{{- end }}
rules:
- apiGroups: ["*"]
resources: ["nodes"]
@@ -55,6 +61,9 @@ metadata:
{{- end }}
labels:
{{- include "localpv.labels" . | nindent 4 }}
{{- if .Values.extraLabels -}}
{{- toYaml .Values.extraLabels | nindent 4 }}
{{- end }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
@@ -74,6 +83,9 @@ metadata:
{{- end }}
labels:
{{- include "localpv.labels" . | nindent 4 }}
{{- if .Values.extraLabels -}}
{{- toYaml .Values.extraLabels | nindent 4 }}
{{- end }}
rules:
- apiGroups: ['policy']
resources: ['podsecuritypolicies']
@@ -90,6 +102,9 @@ metadata:
{{- end }}
labels:
{{- include "localpv.labels" . | nindent 4 }}
{{- if .Values.extraLabels -}}
{{- toYaml .Values.extraLabels | nindent 4 }}
{{- end }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
30 changes: 23 additions & 7 deletions deploy/helm/charts/values.yaml
Original file line number Diff line number Diff line change
@@ -2,24 +2,34 @@
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

release:
version: "4.0.0"
global:
# Used as default image registry, values supplied by localpv.image.registry
# and helperPod.image.registry override this value.
imageRegistry: ""

rbac:
# rbac.create: `true` if rbac resources should be created
create: true
# rbac.pspEnabled: `true` if PodSecurityPolicy resources should be created
pspEnabled: false

earlyEvictionTolerations:
- effect: NoExecute
key: node.kubernetes.io/unreachable
operator: Exists
tolerationSeconds: 5
- effect: NoExecute
key: node.kubernetes.io/not-ready
operator: Exists
tolerationSeconds: 5

localpv:
name: localpv-provisioner
enabled: true
image:
# Make sure that registry name end with a '/'.
# For example : quay.io/ is a correct value here and quay.io is incorrect
registry:
registry: ""
repository: openebs/provisioner-localpv
tag: 4.0.0
tag: 4.2.0-prerelease
pullPolicy: IfNotPresent
updateStrategy:
type: RollingUpdate
@@ -51,6 +61,8 @@ localpv:
tolerations: []
affinity: {}
securityContext: {}
## Sets priorityClassName in pod
priorityClassName: ""

imagePullSecrets:
# - name: img-pull-secret
@@ -118,7 +130,11 @@ helperPod:
repository: openebs/linux-utils
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: 4.0.0
tag: 4.1.0
hostNetwork: false

# Additional labels to add to all chart resources
extraLabels: {}

analytics:
enabled: true
358 changes: 236 additions & 122 deletions docs/developer.md

Large diffs are not rendered by default.

41 changes: 24 additions & 17 deletions docs/installation/platforms/microk8s.md
Original file line number Diff line number Diff line change
@@ -5,59 +5,66 @@ The Dynamic-LocalPV-Provisioner may be installed into a MicroK8s cluster in ANY
## Using the OpenEBS Addon

MicroK8s (v1.21 onwards) ships with an OpenEBS Addon which deploys LocalPV, cStor and Jiva storage engine control-plane components. Enable the addon using the following command:

```console
$ microk8s enable openebs
microk8s enable openebs
```

Once installation succeeds, you may verify the creation of the Dynamic-LocalPV-Provisioner components using the following commands:

```console
$ microk8s kubectl get pods -n openebs
$ microk8s kubectl get storageclass
microk8s kubectl get pods -n openebs
microk8s kubectl get storageclass
```

## Using the OpenEBS Helm Chart

Using the helm chart directly let's you cuztomize your Dynamic-LocalPV-Provisioner deployment ([Helm chart README](https://github.com/openebs/charts/blob/develop/charts/openebs/README.md)). You will need to use the Helm3 MicroK8s Addon for this.

```console
$ microk8s enable helm3
microk8s enable helm3
```

Add the openebs helm chart repo

```console
$ microk8s helm3 repo add openebs https://openebs.github.io/charts
$ microk8s helm3 repo update
microk8s helm3 repo add openebs https://openebs.github.io/charts
microk8s helm3 repo update
```

Install the helm chart.

```console
$ #Default installation command. This sets the default directories under '/var/snap/microk8s/common'
$ microk8s helm3 install openebs openebs/openebs -n openebs --create-namespace \
--set localprovisioner.basePath="/var/snap/microk8s/common/var/openebs/local"
--set ndm.sparse.path="/var/snap/microk8s/common/var/openebs/sparse"
--set varDirectoryPath.baseDir="/var/snap/microk8s/common/var/openebs"
--set localprovisioner.basePath="/var/snap/microk8s/common/var/openebs/local"
--set ndm.sparse.path="/var/snap/microk8s/common/var/openebs/sparse"
--set varDirectoryPath.baseDir="/var/snap/microk8s/common/var/openebs"
```

Once installation succeeds, you may verify the creation of the Dynamic-LocalPV-Provisioner components using the following commands:

```console
$ microk8s kubectl get pods -n openebs
$ microk8s kubectl get storageclass
microk8s kubectl get pods -n openebs
microk8s kubectl get storageclass
```

## Using Operator YAML

You may install Dynamic-LocalPV-Provisioner using the openebs-operator-lite.yaml and openebs-lite-sc.yaml files as well. Use the following commands to install using the Operator YAMLs, while creating the default directories under '/var/snap/microk8s/common'

```console
$ #Apply openebs-operator-lite.yaml
$ curl -fSsL https://openebs.github.io/charts/openebs-operator-lite.yaml | sed 's|\(/var/openebs\)|/var/snap/microk8s/common\1|g' | kubectl apply -f -
$ #Apply openebs-lite-sc.yaml
$ curl -fSsL https://openebs.github.io/charts/openebs-lite-sc.yaml | sed 's|\(/var/openebs\)|/var/snap/microk8s/common\1|g' | kubectl apply -f -
#Apply openebs-operator-lite.yaml
curl -fSsL https://openebs.github.io/charts/openebs-operator-lite.yaml | sed 's|\(/var/openebs\)|/var/snap/microk8s/common\1|g' | kubectl apply -f -
#Apply openebs-lite-sc.yaml
curl -fSsL https://openebs.github.io/charts/openebs-lite-sc.yaml | sed 's|\(/var/openebs\)|/var/snap/microk8s/common\1|g' | kubectl apply -f -
```

Once installation succeeds, you may verify the creation of the Dynamic-LocalPV-Provisioner components using the following commands:

```console
$ microk8s kubectl get pods -n openebs
$ microk8s kubectl get storageclass
microk8s kubectl get pods -n openebs
microk8s kubectl get storageclass
```

For instructions on using the StorageClasses and creating volumes, refer to the [quickstart](https://github.com/openebs/dynamic-localpv-provisioner/blob/develop/docs/quickstart.md).
2 changes: 2 additions & 0 deletions docs/installation/platforms/minikube.md
Original file line number Diff line number Diff line change
@@ -7,9 +7,11 @@ Follow the instructions below when installing dynamic-localpv-provisioner on min
The node-disk-manager DaemonSet Pods require Kubernetes hostpath mounts for the directories '/run/udev', '/dev', '/proc', '/var/openebs' and '/var/openebs/sparse' from the host node. Running minikube with the 'none' driver allows the kubelet to mount the directories into the a mountpoint inside the NDM DaemonSet Pods.

Run minikube with the flag `--driver=none` to run minikube with no VM driver.

```bash
minikube start --driver=none
```

For more information on using the 'none' driver flag argument, [read the official minikube docs](https://minikube.sigs.k8s.io/docs/drivers/none/).

After minikube is started with no VM driver, proceed with installation as described in [the quickstart](https://github.com/openebs/dynamic-localpv-provisioner/blob/develop/docs/quickstart.md).
19 changes: 14 additions & 5 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
@@ -2,32 +2,37 @@

## Prerequisites

A Kubernetes cluster with Kubernetes v1.23 or above.
A Kubernetes cluster with Kubernetes v1.23 or above.

For more platform-specific installation instructions, [click here](./installation/platforms/).

## Install using Helm chart

Install OpenEBS LocalPV Hostpath using the openebs helm chart. Sample command:

```console
#helm repo add openebs https://openebs.github.io/openebs
#helm repo update
helm install openebs openebs/openebs -n openebs --create-namespace
```

<details>
<summary>Click here for configuration options.</summary>

1. Install OpenEBS Dynamic LocalPV Provisioner with a custom hostpath directory.
1. Install OpenEBS Dynamic LocalPV Provisioner with a custom hostpath directory.
This will change the `BasePath` value for the 'openebs-hostpath' StorageClass.

```console
helm install openebs openebs/openebs -n openebs --create-namespace \
--set localpv-provisioner.hostpathClass.basePath=<custom-hostpath>
--set localpv-provisioner.hostpathClass.basePath=<custom-hostpath>
```

</details>

[Click here](https://github.com/openebs/openebs/tree/HEAD/charts) for detailed instructions on using the Helm chart.

You are ready to provision LocalPV volumes once the pods in 'openebs' namespace report RUNNING status.

```console
$ kubectl get pods -n openebs -l openebs.io/component-name=openebs-localpv-provisioner

@@ -72,11 +77,13 @@ You can provision LocalPV hostpath StorageType volumes dynamically using the def
# - worker-1
# - worker-2
```

</details><br>

For more advanced tutorials, visit [./tutorials/hostpath](./tutorials/hostpath).

Create a PVC with the StorageClass.

```yaml
kind: PersistentVolumeClaim
apiVersion: v1
@@ -91,7 +98,9 @@ spec:
#Set capacity here
storage: 5Gi
```
The PVC will be in 'Pending' state until the volume is mounted.
```console
$ kubectl get pvc

@@ -102,6 +111,7 @@ localpv-vol Pending openebs-hostpath 21
## Mount the volume

Mount the volume to the application pod container. The PVC status will change to 'Bound' when the volume is mounted to a container. A sample BusyBox Pod template is given below.

```yaml
apiVersion: v1
kind: Pod
@@ -124,7 +134,6 @@ spec:
claimName: localpv-vol
```
Visit the official [OpenEBS documentation](https://openebs.io/docs/) for more information.
Connect with the OpenEBS maintainers at the [Kubernetes Slack workspace](https://kubernetes.slack.com/messages/openebs). Visit [openebs.io/community](https://openebs.io/community) for details.
9 changes: 7 additions & 2 deletions docs/tutorials/backup_and_restore/backup.md
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ You will need Velero with Restic to create backups. In this guide, we'll use the
We will 'exec' into the Velero container's shell and run the following commands.

Get the Pod name for the Velero Pod running in 'velero' namespace.

```console
$ kubectl -n velero get pods

@@ -31,11 +32,13 @@ velero-7dd57b857-2gd25 1/1 Running 0 7h12m
```

'Exec' into the Pod's velero container.

```console
$ kubectl -n velero exec -it velero-7dd57b857-2gd25 -c velero -- /bin/bash
kubectl -n velero exec -it velero-7dd57b857-2gd25 -c velero -- /bin/bash
```

Verify if the following command lists the backup-location 'default' as 'Available'.

```console
$ ./velero backup-location get

@@ -44,6 +47,7 @@ default aws velero Available 2021-09-04 01:05:06 +0000 UTC
```

Create a backup. We will use the `--default-volumes-to-restic` to use the Restic plugin for volumes. Use the `--wait` flag to wait for the backup to complete or fail before the command returns.

```console
$ ./velero create backup my-localpv-backup --include-namespaces <app-namespace> --default-volumes-to-restic --wait

@@ -54,14 +58,15 @@ Backup completed with status: Completed. You may check for more information usin
```

Verify the status of the backup using the following command...

```console
$ ./velero backup get
NAME STATUS ERRORS WARNINGS CREATED EXPIRES STORAGE LOCATION SELECTOR
my-localpv-backup Completed 0 0 2021-09-04 01:13:36 +0000 UTC 29d default <none>
```

```console
$ exit
exit
```

For more information on using Velero, refer to the Velero documentation at [velero.io/docs](https://velero.io/docs).
13 changes: 9 additions & 4 deletions docs/tutorials/backup_and_restore/restore.md
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
We will 'exec' into the Velero container to list our backups.

Get the Pod name for the Velero Pod running in 'velero' namespace.

```console
$ kubectl -n velero get pods

@@ -15,11 +16,13 @@ velero-7dd57b857-2gd25 1/1 Running 0 7h12m
```

'Exec' into the Pod's velero container.

```console
$ kubectl -n velero exec -it velero-7dd57b857-2gd25 -c velero -- /bin/bash
kubectl -n velero exec -it velero-7dd57b857-2gd25 -c velero -- /bin/bash
```

List the backups available.

```console
$ ./velero backup get

@@ -32,15 +35,17 @@ my-localpv-backup Completed 0 0 2021-09-04 01:13:36 +0000 UT
Restores don't overwrite already existing components with the same name. To replace already-existing components with the contents of the backup, you will have to delete.

Use the `--namespace-mappings [SOURCE_NAMESPACE]:[DESTINATION_NAMESPACE]` flag to restore to a different namespace.

```console
$ ./velero restore create my-localpv-restore --from-backup my-localpv-backup --restore-volumes=true
./velero restore create my-localpv-restore --from-backup my-localpv-backup --restore-volumes=true
```

Verify the status of the restore and also the components that were restored.

```console
$ ./velero restore get
./velero restore get
```

```console
$ exit
exit
```
41 changes: 22 additions & 19 deletions docs/tutorials/backup_and_restore/velero/velero_with_restic.md
Original file line number Diff line number Diff line change
@@ -7,9 +7,11 @@ Follow the steps below to install Velero with Restic. We will use the velero-plu
We will use the 'mc' MinIO client to create a bucket to store our volume backups.

Execute the following kubectl command to run the 'minio/mc' container in the MinIO instance's namespace. We will execute the commands in a TTY shell inside the container.

```console
$ kubectl -n velero run minio-client --image=minio/mc --rm -it --command -- /bin/sh
kubectl -n velero run minio-client --image=minio/mc --rm -it --command -- /bin/sh
```

You should be inside the container and able to run commands in the shell. Run the following commands to configure the MinIO client and create the bucket 'velero'.

```console
@@ -29,7 +31,7 @@ Bucket created successfully `velero/velero`.
```

```console
$ exit
exit
```

## Step 2: Create a file to store the MinIO credentials
@@ -52,25 +54,26 @@ Install Velero using the vmware-tanzu/velero helm chart. We are creating a relea
$ #helm repo add vmware-tanzu https://vmware-tanzu.github.io/helm-charts
$ #helm repo update
$ helm install velero vmware-tanzu/velero \
--namespace velero \
--create-namespace \
--set-file credentials.secretContents.cloud=$(pwd)/minio-credentials \
--set configuration.provider="aws" \
--set configuration.backupStorageLocation.name="default" \
--set configuration.backupStorageLocation.bucket="velero" \
--set configuration.backupStorageLocation.config.region="minio" \
--set configuration.backupStorageLocation.config.s3ForcePathStyle="true" \
--set configuration.backupStorageLocation.config.s3Url="http://minio.velero.svc:80" \
--set backupsEnabled=true \
--set snapshotsEnabled=false \
--set deployRestic=true \
--set initContainers[0].name=velero-plugin-for-aws \
--set initContainers[0].image=velero/velero-plugin-for-aws:latest \
--set initContainers[0].volumeMounts[0].mountPath=/target \
--set initContainers[0].volumeMounts[0].name=plugins
--namespace velero \
--create-namespace \
--set-file credentials.secretContents.cloud=$(pwd)/minio-credentials \
--set configuration.provider="aws" \
--set configuration.backupStorageLocation.name="default" \
--set configuration.backupStorageLocation.bucket="velero" \
--set configuration.backupStorageLocation.config.region="minio" \
--set configuration.backupStorageLocation.config.s3ForcePathStyle="true" \
--set configuration.backupStorageLocation.config.s3Url="http://minio.velero.svc:80" \
--set backupsEnabled=true \
--set snapshotsEnabled=false \
--set deployRestic=true \
--set initContainers[0].name=velero-plugin-for-aws \
--set initContainers[0].image=velero/velero-plugin-for-aws:latest \
--set initContainers[0].volumeMounts[0].mountPath=/target \
--set initContainers[0].volumeMounts[0].name=plugins
```

Verify if the Velero and Restic components got created.

```console
$ kubectl get secrets,backupstoragelocations,pods -n velero

@@ -93,5 +96,5 @@ pod/restic-2xwsf 1/1 Running 0 6h57m
pod/velero-7dd57b857-2gd25 1/1 Running 0 6h57m
```

You can use the 'velero' CLI tool to use Velero if your MinIO service is exposed (NodePort or LocalBalancer service) and is reachable from your shell.
You can use the 'velero' CLI tool to use Velero if your MinIO service is exposed (NodePort or LocalBalancer service) and is reachable from your shell.
We will use Velero from inside the 'velero' container's shell.
43 changes: 28 additions & 15 deletions docs/tutorials/hostpath/xfs_quota/enable-xfs-quota.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
# OpenEBS LocalPV Hostpath Enable XFS Quota

### Prerequisites
## Prerequisites

1. The BasePath used by the provisioner should have XFS filesystem
2. All of the nodes used for hostpath storage must have [the 'xfsprogs' package installed](./prerequisites.md#install-the-xfsprogs-package).
3. The BasePath used by the provisioner [should be mounted with XFS project quotas enabled](./prerequisites.md#mount-filesystem-using-pquota-mount-option).

>**Note:** You may [use a loop device with XFS filesystem](./use-xfs-fs-with-loop-device.md) for XFS Quota. With a loop device based setup, you don't have to have an XFS root filesystem or external disks with XFS.
### Install the OpenEBS Dynamic LocalPV Provisioner
## Install the OpenEBS Dynamic LocalPV Provisioner

Install the OpenEBS LocalPV Hostpath Provisioner using the following given below. For more installation options, refer to [the quickstart guide](../../../quickstart.md).

```console
kubectl apply -f https://openebs.github.io/charts/openebs-operator-lite.yaml
```

Verify that pods in openebs namespace are running

```console
$ kubectl get pods -n openebs

NAME READY STATUS RESTARTS AGE
openebs-localpv-provisioner-6ddbd95d4d-htp7g 1/1 Running 0 7m12s
```

### Create StorageClass
## Create StorageClass

Create a hostpath StorageClass with the XFSQuota config option.

```yaml
apiVersion: storage.k8s.io/v1
kind: StorageClass
@@ -43,9 +47,10 @@ provisioner: openebs.io/local
volumeBindingMode: WaitForFirstConsumer
reclaimPolicy: Delete
```
<details>
<summary>Click here if you want to configure advanced XFSQuota options.</summary>
```yaml
apiVersion: storage.k8s.io/v1
kind: StorageClass
@@ -67,9 +72,9 @@ reclaimPolicy: Delete
volumeBindingMode: WaitForFirstConsumer
reclaimPolicy: Delete
```
`softLimitGrace` and `hardLimitGrace` with PV Storage Request will decide the soft limit and hard limit to be set beyond the storage capacity of the PV.

The size of a limit will be as follows:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Size of PV storage request * ( 1 + LimitGrace% )

@@ -79,15 +84,16 @@ reclaimPolicy: Delete

For a PV with 100Gi capacity, and values --> softLimitGrace: "90%" / hardLimitGrace: "100%"<br>
This sets the soft limit at 190Gi and the hard limit at 200Gi.

Anyone one of hardLimitGrace or softLimitGrace can also be used.<br>
[Click here](https://man7.org/linux/man-pages/man8/xfs_quota.8.html#QUOTA_OVERVIEW) for detailed instructions about soft and hard limits.

</details><br>

### Create a PVC
## Create a PVC

Create a PVC using the StorageClass's name.

```yaml
kind: PersistentVolumeClaim
apiVersion: v1
@@ -101,16 +107,20 @@ spec:
requests:
storage: 5Gi
```

The PVC will be in 'Pending' state until the volume is mounted.

```console
$ kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
local-hostpath-xfs Pending openebs-hostpath-xfs 21s
```

### Mount the Volume
## Mount the Volume

Mount the volume to the application pod container. The PVC status will change to 'Bound' when the volume is mounted to a container and quota is applied. A sample BusyBox Pod template is given below.

```yaml
apiVersion: v1
kind: Pod
@@ -134,15 +144,18 @@ spec:
```
Verify that the project quota is applied successfully.
```console
$ sudo xfs_quota -x -c 'report -h' /var/openebs/local/
$ sudo xfs_quota -x -c 'report -h' /var/openebs/local/

Project quota on /var/openebs/local (/dev/loop16)
Blocks
Project ID Used Soft Hard Warn/Grace
---------- ---------------------------------
Blocks
Project ID Used Soft Hard Warn/Grace
---------- ---------------------------------
#0 0 0 0 00 [------]
#1 0 5.7G 6.7G 00 [------]
```
### Limitation
* Resize of quota is not supported.

## Limitation

* Resize of quota is not supported.
Loading