Skip to content

Commit

Permalink
feat(yaml): make csi-controller a deployment and disable hostNetwork (#…
Browse files Browse the repository at this point in the history
…286)

* feat(yaml): make csi-controller a deployment and disable hostNetwork

Signed-off-by: Niladri Halder <[email protected]>

* refactor(tests): replace StatefulSet with Deployment

Signed-off-by: Niladri Halder <[email protected]>

* ci: update GitHub Actions workflows

Signed-off-by: Niladri Halder <[email protected]>

* ci: update golang-ci to v1.56.2

Signed-off-by: Niladri Halder <[email protected]>

* ci: update codecov action

Signed-off-by: Niladri Halder <[email protected]>

---------

Signed-off-by: Niladri Halder <[email protected]>
  • Loading branch information
niladrih authored Mar 19, 2024
1 parent f3e9cd0 commit d8b2b9a
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 73 deletions.
61 changes: 33 additions & 28 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Shellcheck
uses: reviewdog/action-shellcheck@v1
Expand All @@ -46,22 +46,28 @@ jobs:
pattern: '*.sh'
exclude: './.git/*'

- name: install golangci-lint
run: make install-golangci-lint
- name: Set up Go 1.19
uses: actions/setup-go@v5
with:
go-version: 1.19.9
cache: false

- name: Lint checks
run: make golint
- name: Lint Check
uses: golangci/golangci-lint-action@v4
with:
version: v1.56.2
args: -E exportloopref,dupl,revive,bodyclose,goconst,misspell -D structcheck --timeout 5m0s

unit-test:
# to ignore builds on release
if: ${{ (github.event.ref_type != 'tag') }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
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.9
cache: false
Expand All @@ -70,7 +76,7 @@ jobs:
run: make test

- name: Upload Coverage Report
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
Expand All @@ -86,10 +92,10 @@ jobs:
kubernetes: [v1.27.3]
steps:
- name: Checkout
uses: actions/checkout@v2
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.9
cache: false
Expand All @@ -114,7 +120,7 @@ jobs:
run: ./ci/ci-test.sh

- name: Upload Coverage Report
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./tests/bdd_coverage.txt
Expand All @@ -126,7 +132,7 @@ jobs:
needs: ['lint', 'unit-test', 'bdd-test']
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set Image Org
# sets the default IMAGE_ORG to openebs
Expand All @@ -135,13 +141,13 @@ jobs:
echo "IMAGE_ORG=${IMAGE_ORG}" >> $GITHUB_ENV
- name: Login to Docker Hub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push the ansible image
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
file: ./e2e-tests/Dockerfile
push: true
Expand All @@ -155,7 +161,7 @@ jobs:
needs: ['lint', 'unit-test', 'bdd-test']
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set Image Org
# sets the default IMAGE_ORG to openebs
Expand All @@ -166,7 +172,7 @@ jobs:
- name: Set Build Date
id: date
run: |
echo "::set-output name=DATE::$(date -u +'%Y-%m-%dT%H:%M:%S%Z')"
echo "DATE=$(date -u +'%Y-%m-%dT%H:%M:%S%Z')" >> $GITHUB_OUTPUT
- name: Set Tag
run: |
Expand All @@ -180,56 +186,55 @@ jobs:
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
uses: docker/metadata-action@v4
with:
# add each registry to which the image needs to be pushed here
images: |
${{ env.IMAGE_ORG }}/lvm-driver
quay.io/${{ env.IMAGE_ORG }}/lvm-driver
ghcr.io/${{ env.IMAGE_ORG }}/lvm-driver
tag-latest: false
tag-custom-only: true
tag-custom: |
${{ env.TAG }}
tags: |
type=raw,value=latest,enable=false
type=raw,value=${{ env.TAG }}
- name: Print Tag info
run: |
echo "BRANCH: ${BRANCH}"
echo "${{ steps.docker_meta.outputs.tags }}"
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3
with:
platforms: all

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

- name: Login to Docker Hub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to Quay
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}

- name: Login to GHCR
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build & Push Image
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
context: .
file: ./buildscripts/lvm-driver/Dockerfile.buildx
Expand Down
31 changes: 17 additions & 14 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
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.9
cache: false
Expand All @@ -52,7 +52,10 @@ jobs:
run: make bootstrap

- name: Lint Check
run: make golint
uses: golangci/golangci-lint-action@v4
with:
version: v1.56.2
args: -E exportloopref,dupl,revive,bodyclose,goconst,misspell -D structcheck --timeout 5m0s

- name: Shellcheck
uses: reviewdog/action-shellcheck@v1
Expand All @@ -66,10 +69,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
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.9
cache: false
Expand All @@ -78,7 +81,7 @@ jobs:
run: make test

- name: Upload Coverage Report
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
Expand All @@ -94,10 +97,10 @@ jobs:
kubernetes: [v1.27.3]
steps:
- name: Checkout
uses: actions/checkout@v2
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.9
cache: false
Expand All @@ -122,7 +125,7 @@ jobs:
run: ./ci/ci-test.sh

- name: Upload Coverage Report
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./tests/bdd_coverage.txt
Expand All @@ -134,21 +137,21 @@ jobs:
needs: ['lint', 'unit-test', 'bdd-test']
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3
with:
platforms: all

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

- name: Build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
context: .
file: ./buildscripts/lvm-driver/Dockerfile.buildx
Expand Down
25 changes: 12 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v4

- name: Set Image Org
# sets the default IMAGE_ORG to openebs
Expand All @@ -35,7 +35,7 @@ jobs:
- name: Set Build Date
id: date
run: |
echo "::set-output name=DATE::$(date -u +'%Y-%m-%dT%H:%M:%S%Z')"
echo "DATE=$(date -u +'%Y-%m-%dT%H:%M:%S%Z')" >> $GITHUB_OUTPUT
- name: Set Tag
run: |
Expand All @@ -45,55 +45,54 @@ jobs:
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
uses: docker/metadata-action@v4
with:
# add each registry to which the image needs to be pushed here
images: |
${{ env.IMAGE_ORG }}/lvm-driver
quay.io/${{ env.IMAGE_ORG }}/lvm-driver
ghcr.io/${{ env.IMAGE_ORG }}/lvm-driver
tag-latest: true
tag-semver: |
{{version}}
tags: |
type=semver,pattern={{version}}
- name: Print Tag info
run: |
echo "${{ steps.docker_meta.outputs.tags }}"
echo "RELEASE TAG: ${RELEASE_TAG}"
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3
with:
platforms: all

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

- name: Login to Docker Hub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to Quay
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}

- name: Login to GHCR
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build & Push Image
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
context: .
file: ./buildscripts/lvm-driver/Dockerfile.buildx
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ bootstrap: controller-gen install-golangci-lint
## Install golangci-lint only if tool doesn't exist in system
.PHONY: install-golangci-lint
install-golangci-lint:
$(if $(shell which golangci-lint), echo "golangci-lint already exist in system", (curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sudo sh -s -- -b "${GOPATH}/bin" v1.52.2))
$(if $(shell which golangci-lint), echo "golangci-lint already exist in system", (curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sudo sh -s -- -b "${GOPATH}/bin" v1.56.2))

.PHONY: controller-gen
controller-gen:
Expand Down
4 changes: 1 addition & 3 deletions deploy/lvm-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1376,7 +1376,7 @@ description: "This priority class should be used for the OpenEBS LVM localPV CSI

---

kind: StatefulSet
kind: Deployment
apiVersion: apps/v1
metadata:
name: openebs-lvm-controller
Expand All @@ -1389,7 +1389,6 @@ spec:
matchLabels:
app: openebs-lvm-controller
role: openebs-lvm
serviceName: "openebs-lvm"
replicas: 1
template:
metadata:
Expand Down Expand Up @@ -1633,7 +1632,6 @@ spec:
spec:
priorityClassName: openebs-lvm-localpv-csi-node-critical
serviceAccountName: openebs-lvm-node-sa
hostNetwork: true
containers:
- name: csi-node-driver-registrar
image: registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.8.0
Expand Down
Loading

0 comments on commit d8b2b9a

Please sign in to comment.