Skip to content

Commit 9099db9

Browse files
Merge upstream main: pin the released COSI driver v0.5.0
#5284 landed as a bump to the upstream v0.4.0 image instead of an in-tree build. v0.5.0, tagged on the merge of the public-read change, makes the in-tree build this branch carried unnecessary: drop it and pin the upstream image. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <[email protected]>
2 parents c45def3 + 76a34d3 commit 9099db9

7 files changed

Lines changed: 34 additions & 105 deletions

File tree

‎cmd/backport-batch/report_test.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ func TestReportDedupAndTrust(t *testing.T) {
130130
t.Setenv("GITHUB_SERVER_URL", "https://github.com")
131131
t.Setenv("GITHUB_REPOSITORY", "cozystack/cozystack")
132132
t.Setenv("GITHUB_RUN_ID", "100")
133+
t.Setenv("GITHUB_RUN_ATTEMPT", "1")
133134

134135
// The report the next run makes, read off a run that publishes nothing,
135136
// planted by someone the batch does not trust.

‎hack/overlay-main-images.sh‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,11 @@ img_line='(@sha256:|^[[:space:]]*(- )?(image|repository|registry|tag|digest):|^[
111111
# needs either a key or an `@sha256:`, and a .tag file carries neither until a
112112
# build stamps it, so an unstamped one is classified as a non-ref change, the
113113
# drift guard keeps the committed ref, and the overlay never replaces the
114-
# placeholder it exists to replace. A .tag file that a build has stamped passes
115-
# on `@sha256:` alone, which is why this went unnoticed: a first-party ref is
116-
# digest-less only between the commit that adds a new image and the release
117-
# that first stamps it.
114+
# placeholder it exists to replace. 17 of the 19 .tag files in the tree pass on
115+
# `@sha256:` alone, which is why this went unnoticed; the exception that proves
116+
# it is packages/extra/seaweedfs/images/seaweedfs-cosi-driver.tag, digest-less
117+
# but third-party, so build-main never rebuilds it, the artifact copy is
118+
# byte-identical and this test is never reached.
118119
#
119120
# Scoped to *.tag because only there is a whole line known to be a reference and
120121
# nothing else. An unkeyed line in a values.yaml is genuinely unclassifiable and
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ghcr.io/cozystack/cozystack/seaweedfs-cosi-driver:v0.4.0-4-g0ed46df-cozystack.0
1+
ghcr.io/seaweedfs/seaweedfs-cosi-driver:v0.5.0

‎packages/system/seaweedfs/Makefile‎

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ SEAWEEDFS_TAG=$(shell grep -F 'ARG VERSION=' images/seaweedfs/Dockerfile | cut -
44
include ../../../hack/common-envs.mk
55
include ../../../hack/package.mk
66

7-
.PHONY: image image-seaweedfs image-cosi-driver
8-
image: image-seaweedfs image-cosi-driver
9-
10-
image-seaweedfs:
7+
.PHONY: image
8+
image:
119
docker buildx build images/seaweedfs \
1210
$(call image-tags,seaweedfs,$(SEAWEEDFS_TAG)) \
1311
$(call cache-args,seaweedfs) \
@@ -19,33 +17,10 @@ image-seaweedfs:
1917
yq -i '.seaweedfs.image.tag = strenv(TAG)' values.yaml
2018
rm -f images/seaweedfs.json
2119

22-
# `git describe` of the upstream commit pinned by ARG VERSION in
23-
# images/seaweedfs-cosi-driver/Dockerfile; test-cosi-driver-version keeps the
24-
# two in lockstep.
25-
COSI_DRIVER_VERSION = v0.4.0-4-g0ed46df
26-
# Bump when the build changes on the same upstream commit.
27-
COSI_DRIVER_REV = 0
28-
COSI_DRIVER_COMPONENT_VERSION = $(COSI_DRIVER_VERSION)-cozystack.$(COSI_DRIVER_REV)
29-
30-
# Depends on image-seaweedfs so the two `yq -i` stamps of values.yaml never run
31-
# concurrently under `make -j image`.
32-
image-cosi-driver: image-seaweedfs
33-
docker buildx build images/seaweedfs-cosi-driver \
34-
$(call image-tags,seaweedfs-cosi-driver,$(COSI_DRIVER_COMPONENT_VERSION)) \
35-
$(call cache-args,seaweedfs-cosi-driver) \
36-
--metadata-file images/seaweedfs-cosi-driver.json \
37-
$(BUILDX_ARGS)
38-
IMAGE="$(REGISTRY)/seaweedfs-cosi-driver:$(COSI_DRIVER_COMPONENT_VERSION)@$$(yq e '."containerimage.digest"' images/seaweedfs-cosi-driver.json -o json -r)" \
39-
yq -i '.seaweedfs.cosi.image = strenv(IMAGE)' values.yaml
40-
rm -f images/seaweedfs-cosi-driver.json
41-
yq .seaweedfs.cosi.image values.yaml > ../../extra/seaweedfs/images/seaweedfs-cosi-driver.tag
42-
4320
test:
4421
helm unittest .
4522
$(MAKE) test-guard-fail-closed
4623
$(MAKE) test-image-version
47-
$(MAKE) test-cosi-driver-version
48-
$(MAKE) test-cosi-driver-tag
4924

5025
# The image replaces weed in the upstream image of ARG VERSION, so a chart moved
5126
# by `make update` without the Dockerfile would run the previous release's
@@ -57,25 +32,6 @@ test-image-version:
5732
|| { echo "FAIL: images/seaweedfs/Dockerfile builds $(SEAWEEDFS_TAG), the vendored chart is $$chart"; exit 1; }
5833
@echo "ok: images/seaweedfs builds the chart's appVersion $(SEAWEEDFS_TAG)"
5934

60-
# COSI_DRIVER_VERSION names the image tag, ARG VERSION the commit that is built;
61-
# a tag left behind by a commit bump would ship one build under another's name.
62-
.PHONY: test-cosi-driver-version
63-
test-cosi-driver-version:
64-
@commit=$$(grep -F 'ARG VERSION=' images/seaweedfs-cosi-driver/Dockerfile | cut -f2 -d=); \
65-
abbrev=$$(echo "$(COSI_DRIVER_VERSION)" | sed -n 's/.*-g\([0-9a-f]\{7,\}\)$$/\1/p'); \
66-
case "$$abbrev:$$commit" in ?*:"$$abbrev"*) ;; *) echo "FAIL: COSI_DRIVER_VERSION $(COSI_DRIVER_VERSION) does not name the commit images/seaweedfs-cosi-driver/Dockerfile builds ($$commit)"; exit 1;; esac
67-
@echo "ok: COSI_DRIVER_VERSION $(COSI_DRIVER_VERSION) names the built commit"
68-
69-
# The tenant release reads seaweedfs.cosi.image and the client-mode deployment in
70-
# packages/extra/seaweedfs reads the .tag file, so the two must name one image.
71-
.PHONY: test-cosi-driver-tag
72-
test-cosi-driver-tag:
73-
@values=$$(yq e '.seaweedfs.cosi.image' values.yaml); \
74-
tag=$$(cat ../../extra/seaweedfs/images/seaweedfs-cosi-driver.tag); \
75-
[ "$$values" = "$$tag" ] \
76-
|| { echo "FAIL: seaweedfs.cosi.image is $$values, packages/extra/seaweedfs/images/seaweedfs-cosi-driver.tag is $$tag"; exit 1; }
77-
@echo "ok: both COSI driver deployments run $$(yq e '.seaweedfs.cosi.image' values.yaml)"
78-
7935
# The naming guard refuses to render an UPGRADE that cannot see the cluster
8036
# (templates/naming-guard.yaml): a client-side lookup silently returns nothing,
8137
# which would classify a class-S tenant as net-new and rename its workloads away

‎packages/system/seaweedfs/images/seaweedfs-cosi-driver/Dockerfile‎

Lines changed: 0 additions & 41 deletions
This file was deleted.
Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
suite: seaweedfs COSI driver image pin
22

3-
# The vendored chart default is seaweedfs-cosi-driver v0.1.2, which ignores
4-
# accessPolicy, so a -readonly BucketAccessClass would issue read-write keys.
5-
# Upstream v0.3.1 fixes that but loses a grant made while the S3 gateways
6-
# migrate identity.json, so the package values.yaml points cosi.image at the
7-
# first-party build in images/seaweedfs-cosi-driver.
8-
# `make update` resets the vendored default; this goes red if the override is
9-
# lost or points back at an upstream image.
3+
# Pins the COSI driver image to a release that enforces read-only bucket access.
4+
#
5+
# The vendored chart default is seaweedfs-cosi-driver v0.1.2 (see
6+
# charts/seaweedfs/values.yaml), which hardcodes read-write S3 actions for every
7+
# BucketAccess and ignores the accessPolicy parameter. The chart ships a
8+
# -readonly BucketAccessClass with parameters.accessPolicy: readonly, so on
9+
# v0.1.2 a credential meant to be read-only is silently granted read-write.
10+
# The package values.yaml overrides cosi.image to v0.5.0, which honours
11+
# accessPolicy: readonly and public-read.
12+
#
13+
# This test does not set the image itself; it relies on the package values.yaml
14+
# override, so it goes red if that override is removed and the image falls back
15+
# to the vulnerable v0.1.2 — turning a silent security regression into a build
16+
# failure. Note: `make update` re-vendors charts/ and resets the vendored
17+
# default to v0.1.2 but does not touch the package values.yaml, so the override
18+
# (and this guard) must be preserved across any re-vendor.
1019

1120
templates:
1221
- charts/seaweedfs/templates/cosi/cosi-deployment.yaml
@@ -16,14 +25,14 @@ release:
1625
namespace: cozy-seaweedfs
1726

1827
tests:
19-
- it: runs the first-party cosi-driver build
28+
- it: pins the cosi-driver container to v0.5.0 (read-only and public-read access policies)
2029
template: charts/seaweedfs/templates/cosi/cosi-deployment.yaml
2130
set:
2231
seaweedfs.cosi.enabled: true
2332
asserts:
2433
- equal:
2534
path: spec.template.spec.containers[0].name
2635
value: seaweedfs-cosi-driver
27-
- matchRegex:
36+
- equal:
2837
path: spec.template.spec.containers[0].image
29-
pattern: ^ghcr\.io/cozystack/cozystack/seaweedfs-cosi-driver:.+-cozystack\.[0-9]+(@sha256:[0-9a-f]{64})?$
38+
value: ghcr.io/seaweedfs/seaweedfs-cosi-driver:v0.5.0

‎packages/system/seaweedfs/values.yaml‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,12 @@ seaweedfs:
302302
# Override the vendored chart default (v0.1.2), which hardcodes read-write
303303
# S3 actions for every BucketAccess and ignores the accessPolicy parameter.
304304
# v0.3.x honours accessPolicy: readonly, so a -readonly BucketAccessClass
305-
# actually issues read-only credentials instead of read-write. Built here
306-
# from images/seaweedfs-cosi-driver until upstream releases public-read.
307-
image: "ghcr.io/cozystack/cozystack/seaweedfs-cosi-driver:v0.4.0-4-g0ed46df-cozystack.0"
305+
# actually issues read-only (Read,List) credentials instead of read-write.
306+
# v0.4.0 also writes each grant to the per-identity IAM file: v0.3.1
307+
# rewrites only the legacy identity.json, which the S3 gateways migrate
308+
# concurrently, so a grant could be lost for good. v0.5.0 adds the
309+
# public-read accessPolicy the -public BucketAccessClass relies on.
310+
image: "ghcr.io/seaweedfs/seaweedfs-cosi-driver:v0.5.0"
308311
podLabels:
309312
policy.cozystack.io/allow-to-apiserver: "true"
310313
driverName: "seaweedfs.objectstorage.k8s.io"

0 commit comments

Comments
 (0)