From b8c78fd0b4ecbcad0e8fe010a0b4525a965d1ed7 Mon Sep 17 00:00:00 2001 From: Tiago Castro Date: Wed, 11 Dec 2024 12:52:58 +0000 Subject: [PATCH 1/2] build: check and update fmt Use common script for linting, rather than spread commands... Signed-off-by: Tiago Castro --- .pre-commit-config.yaml | 4 ++-- Jenkinsfile | 3 +-- scripts/rust/linter.sh | 34 +++++++++++++++++++++++++++++----- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8a3e3e89f..e18326cae 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,14 +13,14 @@ repos: - id: rust-lint name: Rust lint description: Run cargo clippy on files included in the commit. - entry: nix-shell --pure --run 'cargo-clippy --all --all-targets -- -D warnings' + entry: nix-shell --pure --run './scripts/rust/linter.sh clippy' pass_filenames: false types: [file, rust] language: system - id: rust-style name: Rust style description: Run cargo fmt on files included in the commit. - entry: nix-shell --pure --run 'cargo-fmt --all -- --check' + entry: nix-shell --pure --run './scripts/rust/linter.sh fmt' pass_filenames: false types: [file, rust] language: system diff --git a/Jenkinsfile b/Jenkinsfile index 501746a14..f366813e6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -113,8 +113,7 @@ pipeline { steps { sh 'printenv' sh 'nix-shell --run "./dependencies/control-plane/scripts/rust/generate-openapi-bindings.sh"' - sh 'nix-shell --run "cargo fmt --all -- --check"' - sh 'nix-shell --run "cargo clippy --all-targets -- -D warnings"' + sh 'nix-shell --run "./scripts/rust/linter.sh"' sh 'nix-shell --run "./scripts/git/check-submodule-branches.sh"' } } diff --git a/scripts/rust/linter.sh b/scripts/rust/linter.sh index 18515d01d..37e429e6e 100755 --- a/scripts/rust/linter.sh +++ b/scripts/rust/linter.sh @@ -1,7 +1,31 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh -cargo fmt --version -cargo fmt --all +set -e -cargo clippy --version -cargo clippy --all --all-targets $1 -- -D warnings +FMT_ERROR= + +OP="${1:-}" + +case "$OP" in + "" | "fmt" | "clippy") + ;; + *) + echo "linter $OP not supported" + exit 2 +esac + +cargo fmt -- --version +cargo clippy -- --version + +if [ -z "$OP" ] || [ "$OP" = "fmt" ]; then + cargo fmt --all --check || FMT_ERROR=$? + if [ -n "$FMT_ERROR" ]; then + cargo fmt --all + fi +fi + +if [ -z "$OP" ] || [ "$OP" = "clippy" ]; then + cargo clippy --all --all-targets -- -D warnings +fi + +exit ${FMT_ERROR:-0} From ef78cc8030f6fab89137682f69ad47c0e23415d8 Mon Sep 17 00:00:00 2001 From: Tiago Castro Date: Wed, 11 Dec 2024 15:33:08 +0000 Subject: [PATCH 2/2] fix(csi/node): add rest client to csi node Also adds helm var to configure it (if ever needed). Signed-off-by: Tiago Castro --- chart/templates/mayastor/csi/csi-node-daemonset.yaml | 3 ++- chart/values.yaml | 2 ++ dependencies/control-plane | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/chart/templates/mayastor/csi/csi-node-daemonset.yaml b/chart/templates/mayastor/csi/csi-node-daemonset.yaml index 98399a082..4264005b4 100644 --- a/chart/templates/mayastor/csi/csi-node-daemonset.yaml +++ b/chart/templates/mayastor/csi/csi-node-daemonset.yaml @@ -88,7 +88,8 @@ spec: args: - "--csi-socket={{ default .Values.csi.node.pluginMountPath .Values.csi.node.pluginMounthPath }}/{{ .Values.csi.node.socketPath }}" - "--node-name=$(MY_NODE_NAME)" - - "--rest-endpoint=http://{{ .Release.Name }}-api-rest:8081" + - "--rest-endpoint=http://{{ .Release.Name }}-api-rest:8081"{{ if .Values.csi.node.restClient.enabled }} + - "--enable-rest"{{ end }} - "--enable-registration" - "--grpc-endpoint=$(MY_POD_IP):10199"{{ if .Values.csi.node.nvme.io_timeout }} - "--nvme-io-timeout={{ .Values.csi.node.nvme.io_timeout }}" diff --git a/chart/values.yaml b/chart/values.yaml index 5f3610a43..b38c176b3 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -386,6 +386,8 @@ csi: # Additional arguments when creating filesystems mkfs_args: xfs: "" + restClient: + enabled: true # -- Set tolerations, overrides global tolerations: [] # -- Set PriorityClass, overrides global diff --git a/dependencies/control-plane b/dependencies/control-plane index d54a84df2..e5e83427d 160000 --- a/dependencies/control-plane +++ b/dependencies/control-plane @@ -1 +1 @@ -Subproject commit d54a84df2cbb692e8ed82fc8a1fbdf8323524051 +Subproject commit e5e83427db666bb82555adbdaed8410047bdff29