Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: 1.24.x
go-version: 1.26.x
check-latest: true
- name: Set environment
run: |
Expand All @@ -33,8 +33,8 @@ jobs:
run: |
./build.sh
go test -v ./...
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-qemu-action@v4
- name: Check Goreleaser
uses: goreleaser/goreleaser-action@v6
uses: goreleaser/goreleaser-action@v7
with:
args: release --skip=publish,sign --clean --snapshot
21 changes: 11 additions & 10 deletions .github/workflows/functests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ jobs:
timeout-minutes: 60
strategy:
matrix:
kube-version: ['v1.20.15', 'v1.21.14', 'v1.22.17', 'v1.23.17', 'v1.24.17', 'v1.25.16', 'v1.26.15', 'v1.27.16', 'v1.28.15', 'v1.29.14', 'v1.30.14', 'v1.31.10', 'v1.32.6', 'v1.33.2']
kube-version: ['v1.19.16', 'v1.20.15', 'v1.21.14', 'v1.22.17', 'v1.23.17', 'v1.24.17', 'v1.25.16', 'v1.26.15', 'v1.27.16', 'v1.28.15', 'v1.29.14', 'v1.30.14', 'v1.31.14', 'v1.32.13', 'v1.33.9', 'v1.34.5', 'v1.35.2']
os: [ubuntu-22.04, ubuntu-24.04]

steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: 1.24.x
go-version: 1.26.x
check-latest: true

- name: Install dependencies
Expand All @@ -51,16 +51,12 @@ jobs:
go build -tags "osusergo netgo static_build" -ldflags="-X main.Version=${VERSION} -extldflags=-static" github.com/minio/directpv/cmd/directpv
go build -tags "osusergo netgo static_build" -ldflags="-X main.Version=${VERSION} -extldflags=-static" github.com/minio/directpv/cmd/kubectl-directpv

- name: Build docker image
run: |
docker build --quiet -t quay.io/minio/directpv:${VERSION} .
docker build --quiet -t example.org/test/sleep:v0.0.1 -f functests/Dockerfile.sleep functests

- name: Setup Minikube
uses: medyagh/setup-minikube@latest
with:
driver: none
kubernetes-version: ${{ matrix.kube-version }}
start-args: '--force'

- name: Check Minikube
run: |
Expand All @@ -69,6 +65,11 @@ jobs:
while kubectl get pods -n kube-system --no-headers | grep -vqw Running; do echo "Waiting for Minikube pods to be ready"; sleep 3; done
while kubectl get nodes --no-headers | grep -vqw Ready; do echo "Waiting for Minikube node to be ready"; sleep 3; done

- name: Build docker image
run: |
docker build --quiet -t quay.io/minio/directpv:${VERSION} .
docker build --quiet -t example.org/test/sleep:v0.0.1 -f functests/Dockerfile.sleep functests

- name: Run tests
run: |
functests/run-tests.sh
Expand All @@ -79,7 +80,7 @@ jobs:
functests/run-migration-tests.sh "v3.2.2"

- name: Run migration tests with DirectCSI v2.0.9
if: contains(fromJson('["v1.20.15", "v1.21.14", "v1.22.17"]'), matrix.kube-version)
if: contains(fromJson('["v1.19.16", "v1.20.15", "v1.21.14", "v1.22.17"]'), matrix.kube-version)
run: |
sudo rm -fr /var/lib/directpv /var/lib/direct-csi
functests/run-migration-tests.sh "v2.0.9"
10 changes: 5 additions & 5 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ jobs:
linters:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: 1.24.x
go-version: 1.26.x
check-latest: true
- uses: ludeeus/action-shellcheck@master
- uses: golangci/golangci-lint-action@v8
- uses: golangci/golangci-lint-action@v9
with:
version: v2.2.1
version: v2.11.3
args: --config ./.golangci.yml --timeout=60m
6 changes: 3 additions & 3 deletions .github/workflows/vulncheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v5
uses: actions/setup-go@v6
with:
go-version: 1.24.x
go-version: 1.26.x
check-latest: true
- name: Install govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@latest
Expand Down
35 changes: 19 additions & 16 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: "2"
run:
go: "1.24"
go: "1.26"
linters:
default: none
enable:
Expand All @@ -15,24 +15,27 @@ linters:
- unconvert
- unused
- usetesting
- dupword
- errorlint
- intrange
- nilnesserr
- perfsprint
- unparam
settings:
misspell:
locale: US
exclusions:
generated: lax
rules:
- path: (.+)\.go$
text: should have a package comment
- path: (.+)\.go$
text: exitAfterDefer
- path: (.+)\.go$
text: redefines-builtin-id
- path: (.+)\.go$
text: avoid meaningless package names
paths:
- third_party$
- builtin$
- examples$
staticcheck:
checks:
- all
- -ST1000
- -SA1019
revive:
rules:
- name: var-naming
disabled: true
gocritic:
disabled-checks:
- exitAfterDefer
formatters:
enable:
- gofmt
Expand Down
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ release:

before:
hooks:
- go mod tidy -compat=1.24
- go mod tidy -compat=1.26
- go mod download

builds:
Expand Down
8 changes: 6 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ COPY LICENSE /licenses/LICENSE

RUN microdnf update --nodocs

COPY AlmaLinux.repo /etc/yum.repos.d/AlmaLinux.repo
COPY AlmaLinux.repo /AlmaLinux.repo

RUN \
curl -L https://repo.almalinux.org/almalinux/8/BaseOS/x86_64/os/RPM-GPG-KEY-AlmaLinux -o /etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux && \
microdnf install xfsprogs --nodocs && \
microdnf install dnf --nodocs && \
mv /AlmaLinux.repo /etc/yum.repos.d/AlmaLinux.repo && \
dnf --quiet --assumeyes --nodocs install xfsprogs && \
dnf --quiet --assumeyes clean all && \
rpm -e --nodeps dnf dnf-data gdbm gdbm-libs ima-evm-utils libcomps libevent libreport-filesystem platform-python platform-python-pip platform-python-setuptools python3-dnf python3-gpg python3-hawkey python3-libcomps python3-libdnf python3-libs python3-pip-wheel python3-rpm python3-setuptools-wheel python3-unbound rpm-build-libs tpm2-tss unbound-libs && \
microdnf clean all && \
rm -f /etc/yum.repos.d/AlmaLinux.repo

Expand Down
4 changes: 2 additions & 2 deletions cmd/directpv/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ package main

import (
"context"
"errors"
"flag"
"fmt"
"os"
"os/signal"
"syscall"
Expand Down Expand Up @@ -67,7 +67,7 @@ var mainCmd = &cobra.Command{
},
PersistentPreRunE: func(_ *cobra.Command, _ []string) error {
if kubeNodeName == "" {
return fmt.Errorf("value to --kube-node-name must be provided")
return errors.New("value to --kube-node-name must be provided")
}

nodeID = directpvtypes.NodeID(kubeNodeName)
Expand Down
2 changes: 1 addition & 1 deletion cmd/kubectl-directpv/discover.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ func discoverDevices(ctx context.Context, nodes, drives []string, teaProgram *te
default:
}
case <-ctx.Done():
err = fmt.Errorf("unable to complete the discovery; %v", ctx.Err())
err = fmt.Errorf("unable to complete the discovery; %w", ctx.Err())
return
}
}
Expand Down
12 changes: 6 additions & 6 deletions cmd/kubectl-directpv/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func validateNodeArgs() error {
for i := range nodesArgs {
nodesArgs[i] = strings.TrimSpace(nodesArgs[i])
if nodesArgs[i] == "" {
return fmt.Errorf("empty node name")
return errors.New("empty node name")
}
result, err := ellipsis.Expand(nodesArgs[i])
if err != nil {
Expand All @@ -164,7 +164,7 @@ func validateDriveNameArgs() error {
for i := range drivesArgs {
drivesArgs[i] = strings.TrimSpace(utils.TrimDevPrefix(drivesArgs[i]))
if drivesArgs[i] == "" {
return fmt.Errorf("empty drive name")
return errors.New("empty drive name")
}
result, err := ellipsis.Expand(drivesArgs[i])
if err != nil {
Expand Down Expand Up @@ -193,7 +193,7 @@ func validateDriveIDArgs() error {
for i := range driveIDArgs {
driveIDArgs[i] = strings.TrimSpace(driveIDArgs[i])
if driveIDArgs[i] == "" {
return fmt.Errorf("empty drive ID")
return errors.New("empty drive ID")
}
if !utils.IsUUID(driveIDArgs[i]) {
return fmt.Errorf("invalid drive ID %v", driveIDArgs[i])
Expand All @@ -209,7 +209,7 @@ func validatePodNameArgs() error {
for i := range podNameArgs {
podNameArgs[i] = strings.TrimSpace(podNameArgs[i])
if podNameArgs[i] == "" {
return fmt.Errorf("empty pod name")
return errors.New("empty pod name")
}
result, err := ellipsis.Expand(podNameArgs[i])
if err != nil {
Expand All @@ -228,7 +228,7 @@ func validatePodNSArgs() error {
for i := range podNSArgs {
podNSArgs[i] = strings.TrimSpace(podNSArgs[i])
if podNSArgs[i] == "" {
return fmt.Errorf("empty pod namespace")
return errors.New("empty pod namespace")
}
result, err := ellipsis.Expand(podNSArgs[i])
if err != nil {
Expand All @@ -245,7 +245,7 @@ func validateVolumeNameArgs() error {
for i := range volumeNameArgs {
volumeNameArgs[i] = strings.TrimSpace(volumeNameArgs[i])
if volumeNameArgs[i] == "" {
return fmt.Errorf("empty volume name")
return errors.New("empty volume name")
}
}
return nil
Expand Down
5 changes: 3 additions & 2 deletions cmd/kubectl-directpv/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"fmt"
"os"
"strconv"

"github.com/fatih/color"
"github.com/jedib0t/go-pretty/v6/table"
Expand Down Expand Up @@ -93,8 +94,8 @@ func infoMain(ctx context.Context) {
fmt.Sprintf("%s %s", color.GreenString(dot), n),
utils.IBytes(info.DriveSize),
utils.IBytes(info.VolumeSize),
fmt.Sprintf("%d", info.VolumeCount),
fmt.Sprintf("%d", info.DriveCount),
strconv.Itoa(info.VolumeCount),
strconv.Itoa(info.DriveCount),
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/kubectl-directpv/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func initDevices(ctx context.Context, initRequests []types.InitRequest, requestI
default:
}
case <-ctx.Done():
err = fmt.Errorf("unable to initialize devices; %v", ctx.Err())
err = fmt.Errorf("unable to initialize devices; %w", ctx.Err())
return
}
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/kubectl-directpv/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var (
imagePullSecrets = []string{}
nodeSelector map[string]string
tolerations []corev1.Toleration
k8sVersion = "1.33.0"
k8sVersion = "1.35.0"
kubeVersion *version.Version
legacyFlag bool
declarativeFlag bool
Expand Down Expand Up @@ -126,18 +126,18 @@ func init() {
func validateInstallCmd() (err error) {
nodeSelector, err = k8s.ParseNodeSelector(nodeSelectorArgs)
if err != nil {
return fmt.Errorf("%v; format of '--node-selector' flag value must be [<key>=<value>]", err)
return fmt.Errorf("%w; format of '--node-selector' flag value must be [<key>=<value>]", err)
}
tolerations, err = k8s.ParseTolerations(tolerationArgs)
if err != nil {
return fmt.Errorf("%v; format of '--tolerations' flag value must be <key>[=value]:<NoSchedule|PreferNoSchedule|NoExecute>", err)
return fmt.Errorf("%w; format of '--tolerations' flag value must be <key>[=value]:<NoSchedule|PreferNoSchedule|NoExecute>", err)
}
if err = validateOutputFormat(false); err != nil {
return err
}
if dryRunPrinter != nil && k8sVersion != "" {
if kubeVersion, err = version.ParseSemantic(k8sVersion); err != nil {
return fmt.Errorf("invalid kubernetes version %v; %v", k8sVersion, err)
return fmt.Errorf("invalid kubernetes version %v; %w", k8sVersion, err)
}
}
return nil
Expand Down
2 changes: 1 addition & 1 deletion cmd/kubectl-directpv/label.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func validateLabelCmdArgs(args []string) (labels []admin.Label, err error) {
return nil, err
}
default:
return nil, fmt.Errorf("argument must be formatted k=v or k-")
return nil, errors.New("argument must be formatted k=v or k-")
}
labels = append(labels, label)
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/kubectl-directpv/list_drives.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ package main

import (
"context"
"fmt"
"os"
"strconv"
"strings"

"github.com/jedib0t/go-pretty/v6/table"
Expand Down Expand Up @@ -183,7 +183,7 @@ func listDrivesMain(ctx context.Context) {
volumeCount := drive.GetVolumeCount()
volumes := "-"
if volumeCount > 0 {
volumes = fmt.Sprintf("%v", volumeCount)
volumes = strconv.Itoa(volumeCount)
}
status := drive.Status.Status
if drive.IsUnschedulable() {
Expand Down
Loading