Skip to content

Commit 8044269

Browse files
author
jack munday
committed
merge master
2 parents ca0b5d5 + f18192b commit 8044269

File tree

16 files changed

+235
-125
lines changed

16 files changed

+235
-125
lines changed

.github/workflows/ci-test-go.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: ci-test-golang
2+
on:
3+
push:
4+
branches:
5+
- "*"
6+
pull_request:
7+
branches:
8+
- "master"
9+
# Allows for manual triggers using the `gh` CLI.
10+
workflow_dispatch:
11+
env:
12+
GO_VERSION: "1.24"
13+
14+
jobs:
15+
test:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Setup Go
20+
uses: actions/setup-go@v5
21+
with:
22+
go-version: ${{ env.GO_VERSION }}
23+
24+
- name: Install dependencies
25+
run: go mod download
26+
27+
- name: Run go vet
28+
run: go vet ./...
29+
30+
- name: Run go test
31+
run: go test ./... -json > test-results.json
32+
33+
- name: Publish test results
34+
uses: actions/upload-artifact@v4
35+
with:
36+
name: go-results
37+
path: test-results.json
38+
39+
lint:
40+
runs-on: ubuntu-latest
41+
steps:
42+
- uses: actions/checkout@v4
43+
- name: Setup Go
44+
uses: actions/setup-go@v5
45+
with:
46+
go-version: ${{ env.GO_VERSION }}
47+
48+
- name: Verify go mod tidy has been run
49+
run: |
50+
set -e
51+
go mod tidy
52+
if [ ! -z "$(git status --porcelain go.mod go.sum)" ]; then
53+
>&2 echo "Running go mod tidy modified go.mod and/or go.sum"
54+
exit 1
55+
fi
56+
57+
- name: Verify gofumpt has been run
58+
run: |
59+
set -e
60+
go install mvdan.cc/gofumpt@latest
61+
gofumpt -l -w .
62+
if [ ! -z "$(git status --porcelain .)" ]; then
63+
>&2 echo "Running gofumpt modified source code"
64+
exit 1
65+
fi

.gitlab-ci.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ build-bin:
1515
stage: build-bin
1616
rules:
1717
- if: $CI_COMMIT_BRANCH || $CI_COMMIT_TAG
18-
image: registry.cern.ch/docker.io/library/golang:1.22
18+
image: registry.cern.ch/docker.io/library/golang:1.24
1919
artifacts:
2020
expire_in: '10 min'
2121
paths:
@@ -48,20 +48,19 @@ build-chart:
4848
variables:
4949
PUSH_CHART: "true"
5050
- if: $CI_COMMIT_BRANCH
51-
image: registry.cern.ch/kubernetes/ops:0.4.0
51+
image: registry.cern.ch/kubernetes/ops:0.6.0
5252
stage: build-chart
5353
script: |
5454
CHART_NAME=cvmfs-csi
55-
CHART_VERSION=$(grep '^version:' "deployments/helm/${CHART_NAME}/Chart.yaml" | awk '{print $2}')
5655
helm package "deployments/helm/${CHART_NAME}"
5756
5857
if $PUSH_CHART; then
5958
helm registry login registry.cern.ch -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD
60-
helm push ${CHART_NAME}-${CHART_VERSION}.tgz "oci://${REGISTRY_CHART_PATH}"
59+
helm push ${CHART_NAME}-${CI_COMMIT_TAG}.tgz "oci://${REGISTRY_CHART_PATH}"
6160
6261
echo -n "${HARBOR_SIGNKEY}" | base64 -d > .sign.key
6362
cosign login registry.cern.ch -u ${HARBOR_USER} -p ${HARBOR_TOKEN}
64-
cosign sign --key .sign.key -y "${REGISTRY_CHART_PATH}/${CHART_NAME}:${CHART_VERSION}"
63+
cosign sign --key .sign.key -y "${REGISTRY_CHART_PATH}/${CHART_NAME}:${CI_COMMIT_TAG}"
6564
fi
6665
variables:
6766
REGISTRY_CHART_PATH: registry.cern.ch/kubernetes/charts

Makefile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ BINDIR := $(CURDIR)/bin
2020
DIST_DIRS := find * -type d -exec
2121
TARGETS ?= linux/amd64 linux/arm64
2222
IMAGE_BUILD_TOOL ?= podman
23+
IMAGE_ADDITIONAL_ARGS ?=
2324
GOX_PARALLEL ?= 3
2425

2526
GOPATH = $(shell go env GOPATH)
@@ -50,6 +51,7 @@ endif
5051
BINARY_VERSION ?= ${GIT_TAG}
5152

5253
BASE_PKG = github.com/cvmfs-contrib/cvmfs-csi
54+
BASE_REPOSITORY ?= registry.cern.ch/kubernetes/cvmfs-csi
5355
# Only set Version if building a tag or VERSION is set
5456
ifneq ($(BINARY_VERSION),)
5557
LDFLAGS += -X ${BASE_PKG}/internal/version.version=${BINARY_VERSION}
@@ -62,7 +64,8 @@ endif
6264
LDFLAGS += -X ${BASE_PKG}/internal/version.commit=${GIT_COMMIT}
6365
LDFLAGS += -X ${BASE_PKG}/internal/version.treestate=${GIT_DIRTY}
6466

65-
IMAGE_TAG := ${GIT_BRANCH}
67+
# Replaces all "/" in git branch name with "-": docker tags can not contain a "/".
68+
IMAGE_TAG := $(shell echo $(GIT_BRANCH) | sed 's/\//-/g')
6669
ifneq ($(GIT_TAG),)
6770
IMAGE_TAG = ${GIT_TAG}
6871
endif
@@ -80,7 +83,7 @@ all: build
8083
# ------------------------------------------------------------------------------
8184
# build
8285

83-
build: TARGETS = $(LOCAL_TARGET)
86+
# build: TARGETS = $(LOCAL_TARGET)
8487
build: build-cross
8588

8689
$(BINDIR)/csi-cvmfsplugin: $(SRC)
@@ -107,11 +110,12 @@ build-cross: $(GOX) $(SRC)
107110
# image
108111

109112
image: build
110-
$(IMAGE_BUILD_TOOL) build \
113+
$(IMAGE_BUILD_TOOL) build \
111114
--build-arg RELEASE=$(IMAGE_TAG) \
112115
--build-arg GITREF=$(GIT_COMMIT) \
113116
--build-arg CREATED=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ") \
114-
-t registry.cern.ch/kubernetes/cvmfs-csi:$(IMAGE_TAG) \
117+
$(IMAGE_ADDITIONAL_ARGS) \
118+
-t $(BASE_REPOSITORY):$(IMAGE_TAG) \
115119
-f ./deployments/docker/Dockerfile .
116120

117121
# ------------------------------------------------------------------------------

deployments/docker/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
FROM registry.access.redhat.com/ubi9/ubi:9.4-947
1+
FROM registry.access.redhat.com/ubi9/ubi:9.6-1745489786
22

33
ARG TARGETARCH
4-
ARG REL_VERSION=2.11.3
5-
ARG PKG_VERSION=2.11.3-1
4+
ARG REL_VERSION=2.12.7
5+
ARG PKG_VERSION=2.12.7-1
66

77
RUN if [[ "${TARGETARCH}" == "amd64" ]]; then \
88
export FRIENDLY_ARCH_NAME="x86_64" ; \

deployments/helm/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# cvmfs-csi
2+
13
A Helm chart for the CVMFS-CSI driver, allowing the mounting of CVMFS repositories in Kubernetes environments. This chart will deploy the CSI driver as a DaemonSet, thus automatically scaling the driver on each cluster node.
24

35
## Usage
@@ -47,9 +49,11 @@ Alternatively, a YAML file that specifies the values of the parameters can be pr
4749
| `cvmfsConfig."config.d".use` | Whether to use this ConfigMap in /etc/cvmfs/config.d. |
4850
| `cvmfsConfig."config.d".create` | Whether to create config.d ConfigMap. If not, and `use` is set to true, it is expected the ConfigMap is already present. |
4951
| `cvmfsConfig."config.d".data` | config.d ConfigMap contents to use when `create` is set to true. |
52+
| `cache.local.location` | Location of the local cvmfs cache i.e. `CVMFS_CACHE_BASE`.
5053
| `cache.local.volumeSpec` | Volume spec for local cache. ReadWriteOnce access mode for persistent volumes is sufficient. |
5154
| `cache.local.cvmfsQuotaLimit` | Maximum size of local cache in MiB. CVMFS client will garbage collect the exceeding amount. |
5255
| `cache.alien.enabled` | Whether to use alien cache in deployment. |
56+
| `cache.alien.location` | Location of the alien cvmfs cache if enabled i.e. `CVMFS_ALIEN_CACHE`.
5357
| `cache.alien.volumeSpec` | Volume spec for local cache. ReadWriteMany access mode for persistent volumes is required. |
5458
| `nodeplugin.name` | Component name for node plugin component. Used as `component` label value and to generate DaemonSet name. |
5559
| `nodeplugin.plugin.image.repository` | Container image repository for CVMFS CSI node plugin. |

deployments/helm/cvmfs-csi/templates/nodeplugin-daemonset.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ spec:
121121
mountPath: /cvmfs
122122
mountPropagation: Bidirectional
123123
- name: cvmfs-localcache
124-
mountPath: /cvmfs-localcache
124+
mountPath: {{ .Values.cache.local.location }}
125125
{{- if .Values.cache.alien.enabled }}
126126
- name: cvmfs-aliencache
127-
mountPath: /cvmfs-aliencache
127+
mountPath: {{ .Values.cache.alien.location }}
128128
{{- end }}
129129
{{- with .Values.nodeplugin.automount.extraVolumeMounts }}
130130
{{- toYaml . | nindent 12 }}
@@ -149,7 +149,7 @@ spec:
149149
mountPath: /cvmfs
150150
mountPropagation: Bidirectional
151151
- name: cvmfs-localcache
152-
mountPath: /cvmfs-localcache
152+
mountPath: {{ .Values.cache.local.location }}
153153
{{- with .Values.nodeplugin.automountReconciler.extraVolumeMounts }}
154154
{{- toYaml . | nindent 12 }}
155155
{{- end }}

deployments/helm/cvmfs-csi/values.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ extraConfigMaps:
1313
CVMFS_USE_GEOAPI=yes
1414
CVMFS_HTTP_PROXY="http://ca-proxy.cern.ch:3128"
1515
16-
# It is advised to change these configs in the cache section of the helm values
17-
# and leave them unchanged here, so they auto-generate.
16+
# It is advised to change these configurations in the cache section of
17+
# the helm values and leave them unchanged here, so they auto-generate.
1818
CVMFS_QUOTA_LIMIT={{ .Values.cache.local.cvmfsQuotaLimit }}
19-
CVMFS_CACHE_BASE=/cvmfs-localcache
19+
CVMFS_CACHE_BASE={{ .Values.cache.local.location }}
2020
2121
{{- if .Values.cache.alien.enabled }}
22-
CVMFS_ALIEN_CACHE=/cvmfs-aliencache
22+
CVMFS_ALIEN_CACHE={{ .Values.cache.alien.location }}
2323
# When alien cache is used, CVMFS does not control the size of the cache.
2424
CVMFS_QUOTA_LIMIT=-1
2525
# Whether repositories should share a cache directory or each have their own.
@@ -46,6 +46,7 @@ extraConfigMaps:
4646
# https://cvmfs.readthedocs.io/en/stable/cpt-configure.html#alien-cache
4747
cache:
4848
local:
49+
location: /cvmfs-localcache
4950
volumeSpec:
5051
hostPath:
5152
path: /var/lib/cvmfs.csi.cern.ch/cache
@@ -55,6 +56,7 @@ cache:
5556
cvmfsQuotaLimit: 1000
5657
alien:
5758
enabled: false
59+
location: /cvmfs-aliencache
5860
volumeSpec:
5961
persistentVolumeClaim:
6062
claimName: cvmfs-alien-cache

go.mod

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
11
module github.com/cvmfs-contrib/cvmfs-csi
22

3-
go 1.22.0
3+
go 1.24.0
44

5-
toolchain go1.22.2
5+
toolchain go1.24.3
66

77
require (
8-
github.com/container-storage-interface/spec v1.9.0
9-
github.com/kubernetes-csi/csi-lib-utils v0.17.0
10-
github.com/moby/sys/mountinfo v0.7.1
11-
google.golang.org/grpc v1.63.2
12-
google.golang.org/protobuf v1.34.0
13-
k8s.io/apimachinery v0.30.0
14-
k8s.io/klog/v2 v2.120.1
15-
k8s.io/mount-utils v0.30.0
8+
github.com/container-storage-interface/spec v1.11.0
9+
github.com/kubernetes-csi/csi-lib-utils v0.21.0
10+
github.com/moby/sys/mountinfo v0.7.2
11+
google.golang.org/grpc v1.72.1
12+
google.golang.org/protobuf v1.36.6
13+
k8s.io/apimachinery v0.33.1
14+
k8s.io/klog/v2 v2.130.1
15+
k8s.io/mount-utils v0.33.1
1616
)
1717

1818
require (
19-
github.com/go-logr/logr v1.4.1 // indirect
20-
github.com/golang/protobuf v1.5.4 // indirect
21-
golang.org/x/net v0.24.0 // indirect
22-
golang.org/x/sys v0.19.0 // indirect
23-
golang.org/x/text v0.14.0 // indirect
24-
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect
25-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240429193739-8cf5692501f6 // indirect
26-
k8s.io/utils v0.0.0-20240423183400-0849a56e8f22 // indirect
19+
github.com/go-logr/logr v1.4.2 // indirect
20+
golang.org/x/net v0.40.0 // indirect
21+
golang.org/x/sys v0.33.0 // indirect
22+
golang.org/x/text v0.25.0 // indirect
23+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250512202823-5a2f75b736a9 // indirect
24+
k8s.io/utils v0.0.0-20250502105355-0f33e8f1c979 // indirect
2725
)

0 commit comments

Comments
 (0)