Skip to content

Commit

Permalink
Merge branch 'master' into selinux-documentation-apr13
Browse files Browse the repository at this point in the history
  • Loading branch information
Praveenrajmani authored Oct 16, 2024
2 parents 4f32cb7 + 35aaf55 commit 5f46bf6
Show file tree
Hide file tree
Showing 74 changed files with 2,302 additions and 986 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: Build

on:
push:
branches: [ master, devel ]
branches: [master, v4.0]

pull_request:
branches: [ master, devel ]
branches: [master, v4.0]

# This ensures that previous jobs for the PR are canceled when the PR is
# updated.
Expand All @@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.22.x
go-version: 1.23.x
check-latest: true
- name: Set environment
run: |
Expand All @@ -35,7 +35,6 @@ jobs:
go test -v ./...
- uses: docker/setup-qemu-action@v3
- name: Check Goreleaser
uses: goreleaser/goreleaser-action@v5
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: release --skip-publish --skip-sign --clean --snapshot
args: release --skip=publish,sign --clean --snapshot
9 changes: 7 additions & 2 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.15', 'v1.28.11', 'v1.29.6', 'v1.30.2']
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.14', 'v1.29.9', 'v1.30.5', 'v1.31.1']
os: [ubuntu-20.04, ubuntu-22.04]

steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.22.x
go-version: 1.23.x
check-latest: true

- name: Install dependencies
Expand Down Expand Up @@ -69,6 +69,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: Enable kustomize
if: contains(fromJson('["v1.24.17", "v1.25.16", "v1.26.15", "v1.27.15", "v1.28.11", "v1.29.6", "v1.30.2"]'), matrix.kube-version)
run: |
echo "KUSTOMIZE=true" >> $GITHUB_ENV
- name: Run tests
run: |
functests/run-tests.sh
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.22.x
go-version: 1.23.x
check-latest: true
- uses: ludeeus/action-shellcheck@master
- uses: golangci/golangci-lint-action@v6
with:
version: v1.59.1
version: v1.61.0
args: --config ./.golangci.yml --timeout=60m
2 changes: 1 addition & 1 deletion .github/workflows/vulncheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22.x
go-version: 1.23.x
check-latest: true
- name: Install govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@latest
Expand Down
8 changes: 4 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
linters-settings:
run:
go: "1.22"
go: "1.23"

misspell:
locale: US
Expand All @@ -26,8 +26,8 @@ linters:
issues:
exclude-use-default: false
exclude:
- should have a package comment
- exitAfterDefer
- should have a package comment
- exitAfterDefer

service:
golangci-lint-version: 1.59.1 # use the fixed version to not introduce new linters unexpectedly
golangci-lint-version: 1.61.0 # use the fixed version to not introduce new linters unexpectedly
123 changes: 62 additions & 61 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
---
version: 2
project_name: directpv

release:
name_template: "Release version {{.Version}}"
name_template: "Release version {{.Version}}"

github:
target_commitish: "{{ .Commit }}"

github:
owner: minio
name: directpv

extra_files:
- glob: "*.minisig"
- glob: "*.zip"
extra_files:
- glob: "*.minisig"
- glob: "*.zip"

before:
hooks:
- go mod tidy -compat=1.22
- go mod tidy -compat=1.23
- go mod download

builds:
-
main: ./cmd/directpv
- main: ./cmd/directpv
id: directpv
binary: directpv
goos:
Expand All @@ -35,8 +38,7 @@ builds:
ldflags:
- -s -w -X main.Version={{ .Tag }}

-
main: ./cmd/kubectl-directpv
- main: ./cmd/kubectl-directpv
id: kubectl-directpv
binary: kubectl-directpv
goos:
Expand All @@ -61,61 +63,60 @@ builds:
post: ./package.sh {{ .Path }}

archives:
-
allow_different_binary_count: true
- allow_different_binary_count: true
format: binary

changelog:
sort: asc

dockers:
- image_templates:
- "quay.io/minio/directpv:{{ .Tag }}-amd64"
use: buildx
goarch: amd64
ids:
- directpv
dockerfile: Dockerfile
extra_files:
- LICENSE
- CREDITS
- AlmaLinux.repo
build_flag_templates:
- "--platform=linux/amd64"
- image_templates:
- "quay.io/minio/directpv:{{ .Tag }}-ppc64le"
use: buildx
goarch: ppc64le
ids:
- directpv
dockerfile: Dockerfile
extra_files:
- LICENSE
- CREDITS
- AlmaLinux.repo
build_flag_templates:
- "--platform=linux/ppc64le"
- image_templates:
- "quay.io/minio/directpv:{{ .Tag }}-arm64"
use: buildx
goarch: arm64
ids:
- directpv
dockerfile: Dockerfile
extra_files:
- LICENSE
- CREDITS
- AlmaLinux.repo
build_flag_templates:
- "--platform=linux/arm64"
- image_templates:
- "quay.io/minio/directpv:{{ .Tag }}-amd64"
use: buildx
goarch: amd64
ids:
- directpv
dockerfile: Dockerfile
extra_files:
- LICENSE
- CREDITS
- AlmaLinux.repo
build_flag_templates:
- "--platform=linux/amd64"
- image_templates:
- "quay.io/minio/directpv:{{ .Tag }}-ppc64le"
use: buildx
goarch: ppc64le
ids:
- directpv
dockerfile: Dockerfile
extra_files:
- LICENSE
- CREDITS
- AlmaLinux.repo
build_flag_templates:
- "--platform=linux/ppc64le"
- image_templates:
- "quay.io/minio/directpv:{{ .Tag }}-arm64"
use: buildx
goarch: arm64
ids:
- directpv
dockerfile: Dockerfile
extra_files:
- LICENSE
- CREDITS
- AlmaLinux.repo
build_flag_templates:
- "--platform=linux/arm64"
docker_manifests:
- name_template: quay.io/minio/directpv:{{ .Tag }}
image_templates:
- quay.io/minio/directpv:{{ .Tag }}-amd64
- quay.io/minio/directpv:{{ .Tag }}-arm64
- quay.io/minio/directpv:{{ .Tag }}-ppc64le
- name_template: quay.io/minio/directpv:latest
image_templates:
- quay.io/minio/directpv:{{ .Tag }}-amd64
- quay.io/minio/directpv:{{ .Tag }}-arm64
- quay.io/minio/directpv:{{ .Tag }}-ppc64le
- name_template: quay.io/minio/directpv:{{ .Tag }}
image_templates:
- quay.io/minio/directpv:{{ .Tag }}-amd64
- quay.io/minio/directpv:{{ .Tag }}-arm64
- quay.io/minio/directpv:{{ .Tag }}-ppc64le
- name_template: quay.io/minio/directpv:latest
image_templates:
- quay.io/minio/directpv:{{ .Tag }}-amd64
- quay.io/minio/directpv:{{ .Tag }}-arm64
- quay.io/minio/directpv:{{ .Tag }}-ppc64le
4 changes: 2 additions & 2 deletions cmd/kubectl-directpv/discover.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func showDevices(resultMap map[directpvtypes.NodeID][]types.Device) error {
}

if writer.Length() == 0 || !foundAvailableDrive {
eprintf(false, color.HiYellowString("No drives are available to initialize")+"\n")
eprintf(false, "%v\n", color.HiYellowString("No drives are available to initialize"))
return errDiscoveryFailed
}

Expand Down Expand Up @@ -218,7 +218,7 @@ func discoverMain(ctx context.Context) {
eprintf(true, "discovery failed; %v\n", err)
os.Exit(1)
case <-ctx.Done():
eprintf(true, ctx.Err().Error())
eprintf(true, "%v", ctx.Err().Error())
os.Exit(1)
}
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/kubectl-directpv/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,5 @@ func eprintf(isErr bool, format string, args ...any) {
}

func logFunc(log admin.LogMessage) {
eprintf(log.Type == admin.ErrorLogType, log.FormattedMessage)
eprintf(log.Type == admin.ErrorLogType, "%v", log.FormattedMessage)
}
54 changes: 19 additions & 35 deletions codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,32 +25,13 @@ export PATH="$PATH:$GOPATH/bin"
# Must keep versions sorted.
VERSIONS=(v1beta1)

function install_code_generator() {
if [ ! -x "$GOPATH/bin/deepcopy-gen" ]; then
go install -v k8s.io/code-generator/cmd/[email protected]
fi

if [ ! -x "$GOPATH/bin/openapi-gen" ]; then
go install -v k8s.io/code-generator/cmd/[email protected]
fi

if [ ! -x "$GOPATH/bin/client-gen" ]; then
go install -v k8s.io/code-generator/cmd/[email protected]
fi

if [ ! -x "$GOPATH/bin/conversion-gen" ]; then
go install -v k8s.io/code-generator/cmd/[email protected]
fi
}

function install_controller_tools() {
if [ ! -x "$GOPATH/bin/controller-gen" ]; then
go install -v sigs.k8s.io/controller-tools/cmd/[email protected]
fi
}

install_code_generator
install_controller_tools
echo "Installing code generators ..."
go install -v \
k8s.io/code-generator/cmd/[email protected] \
k8s.io/code-generator/cmd/[email protected] \
k8s.io/code-generator/cmd/[email protected]
go install -v k8s.io/kube-openapi/cmd/[email protected]
go install -v sigs.k8s.io/controller-tools/cmd/[email protected]

cd "$(dirname "$0")"

Expand Down Expand Up @@ -80,16 +61,18 @@ input_dirs=$(IFS=,; echo "${arr[*]}")
echo "Running deepcopy-gen ..."
deepcopy-gen \
--go-header-file boilerplate.go.txt \
--input-dirs "${input_dirs}" \
--output-package "${REPOSITORY}/pkg/"
--output-file deepcopy_generated.go \
"${input_dirs}"

echo "Running openapi-gen ..."
for version in "${VERSIONS[@]}"; do
repo="${REPOSITORY}/pkg/apis/directpv.min.io/${version}"
openapi-gen \
--go-header-file boilerplate.go.txt \
--input-dirs "${repo}" \
--output-package "${repo}"
--output-file openapi_generated.go \
--output-dir "pkg/apis/directpv.min.io/${version}" \
--output-pkg "${repo}" \
"${repo}"
done

echo "Running client-gen ..."
Expand All @@ -99,12 +82,13 @@ arr=("${VERSIONS[@]/#/directpv.min.io/}")
input_versions=$(IFS=,; echo "${arr[*]}")
client-gen \
--go-header-file boilerplate.go.txt \
--input-dirs "${input_dirs}" \
--output-package "${REPOSITORY}/pkg/" \
--fake-clientset \
--output-dir pkg \
--output-pkg "${REPOSITORY}/pkg" \
--clientset-name clientset \
--input "${input_versions}" \
--input-base "${REPOSITORY}/pkg/apis"
--input-base "${REPOSITORY}/pkg/apis" \
"${input_dirs}"

echo "Running controller-gen ..."
controller-gen crd:crdVersions=v1 paths=./... output:dir=pkg/admin/installer
Expand All @@ -113,5 +97,5 @@ rm -f pkg/admin/installer/direct.csi.min.io_directcsidrives.yaml pkg/admin/insta
echo "Running conversion-gen ..."
conversion-gen \
--go-header-file boilerplate.go.txt \
--input-dirs "${VERSIONS[-1]/#/$REPOSITORY/pkg/apis/directpv.min.io/}" \
--output-package "${REPOSITORY}/pkg/"
--output-file zz_generated.conversion.go \
"${VERSIONS[-1]/#/$REPOSITORY/pkg/apis/directpv.min.io/}"
8 changes: 7 additions & 1 deletion docs/monitoring.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
DirectPV nodes export Prometheus compatible metrics data via port `10443`. The metrics data includes
* directpv_stats_bytes_used
* directpv_stats_bytes_total
and categorized by labels `tenant`, `volumeID` and `node`.
* directpv_stats_drive_ready
* directpv_stats_drive_total_read_bytes
* directpv_stats_drive_total_write_bytes
* directpv_stats_drive_read_latency_seconds
* directpv_stats_drive_write_latency_seconds
* directpv_stats_drive_wait_time_seconds
and categorized by labels `drive`, `tenant`, `volumeID` and `node`.

To scrape data in Prometheus, each node must be accessible by port `10443`. A simple example is below

Expand Down
Loading

0 comments on commit 5f46bf6

Please sign in to comment.