diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a7a174b1..5c9dc2c2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 @@ -46,11 +46,17 @@ 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 @@ -58,10 +64,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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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: | @@ -180,17 +186,16 @@ 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: | @@ -198,38 +203,38 @@ jobs: 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 diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index ed2dfac8..981ea740 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c3608643..64bfc281 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 @@ -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: | @@ -45,16 +45,15 @@ 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: | @@ -62,38 +61,38 @@ jobs: 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 diff --git a/Makefile b/Makefile index 6366d610..3fe72c29 100644 --- a/Makefile +++ b/Makefile @@ -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: diff --git a/deploy/lvm-operator.yaml b/deploy/lvm-operator.yaml index ed3012f1..98743970 100644 --- a/deploy/lvm-operator.yaml +++ b/deploy/lvm-operator.yaml @@ -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 @@ -1389,7 +1389,6 @@ spec: matchLabels: app: openebs-lvm-controller role: openebs-lvm - serviceName: "openebs-lvm" replicas: 1 template: metadata: @@ -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 diff --git a/deploy/yamls/lvm-driver.yaml b/deploy/yamls/lvm-driver.yaml index 96e817b5..0385df6c 100644 --- a/deploy/yamls/lvm-driver.yaml +++ b/deploy/yamls/lvm-driver.yaml @@ -940,7 +940,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 @@ -953,7 +953,6 @@ spec: matchLabels: app: openebs-lvm-controller role: openebs-lvm - serviceName: "openebs-lvm" replicas: 1 template: metadata: @@ -1197,7 +1196,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 diff --git a/tests/suite_test.go b/tests/suite_test.go index 92ed1f04..56a493e2 100644 --- a/tests/suite_test.go +++ b/tests/suite_test.go @@ -63,7 +63,7 @@ var ( appName = "busybox-lvmpv" nodeDaemonSet = "openebs-lvm-node" - controllerStatefulSet = "openebs-lvm-controller" + controllerDeployment = "openebs-lvm-controller" nsObj *corev1.Namespace scObj *storagev1.StorageClass diff --git a/tests/utils.go b/tests/utils.go index 57e328fc..62d14b66 100644 --- a/tests/utils.go +++ b/tests/utils.go @@ -612,34 +612,34 @@ func WaitForLVMVolumeReady() { } func scaleControllerPlugin(num int32) int32 { - ginkgo.By(fmt.Sprintf("scaling controller plugin statefulset %v to size %v", controllerStatefulSet, num)) + ginkgo.By(fmt.Sprintf("scaling controller plugin deployment %v to size %v", controllerDeployment, num)) - scale, err := K8sClient.AppsV1().StatefulSets(metav1.NamespaceSystem). - GetScale(context.Background(), controllerStatefulSet, metav1.GetOptions{}) + scale, err := K8sClient.AppsV1().Deployments(metav1.NamespaceSystem). + GetScale(context.Background(), controllerDeployment, metav1.GetOptions{}) gomega.Expect(err).To( gomega.BeNil(), - "fetch current replica of stateful set %v", controllerStatefulSet) + "fetch current replica of deployment %v", controllerDeployment) existingReplicas := scale.Spec.Replicas if scale.Spec.Replicas == num { return existingReplicas } scale.Spec.Replicas = num - scale, err = K8sClient.AppsV1().StatefulSets(metav1.NamespaceSystem). - UpdateScale(context.Background(), controllerStatefulSet, scale, metav1.UpdateOptions{}) + scale, err = K8sClient.AppsV1().Deployments(metav1.NamespaceSystem). + UpdateScale(context.Background(), controllerDeployment, scale, metav1.UpdateOptions{}) gomega.Expect(err).To( gomega.BeNil(), - "update replicas of stateful set %v to %v", controllerStatefulSet, num) + "update replicas of deployment %v to %v", controllerDeployment, num) scaled := gomega.Eventually(func() bool { - scale, err = K8sClient.AppsV1().StatefulSets(metav1.NamespaceSystem). - GetScale(context.Background(), controllerStatefulSet, metav1.GetOptions{}) + scale, err = K8sClient.AppsV1().Deployments(metav1.NamespaceSystem). + GetScale(context.Background(), controllerDeployment, metav1.GetOptions{}) gomega.Expect(err).ShouldNot(gomega.HaveOccurred()) return scale.Spec.Replicas == num }, 120, 10). Should(gomega.BeTrue()) gomega.Expect(scaled).To(gomega.BeTrue(), - "failed to scale up stateful set %v to size %v", controllerStatefulSet, num) + "failed to scale up deployment %v to size %v", controllerDeployment, num) return existingReplicas }