fix(seaweedfs): remove identities left behind by deleted BucketAccesses

Since SeaweedFS 4.08 the S3 gateways move every identity from
/etc/iam/identity.json into /etc/iam/identities/<name>.json, and the
COSI driver up to v0.3.1 revokes only from identity.json. Every
BucketAccess deleted on such a filer left its identity file behind,
with its keys still accepted (seaweedfs/seaweedfs-cosi-driver#11). A
driver that deletes the file on revoke does nothing for the files
already left.

A post-install/post-upgrade hook removes a ba-<uid>.json file when no
BucketAccess in any namespace names it, by uid or by
status.accountID. The uid covers a BucketAccess still being granted,
the accountID one restored with its status. The identity directory is
listed before the BucketAccesses: a BucketAccess exists before its
grant writes a file, so a file seen in the first listing whose
BucketAccess still exists is always named by the second. File ages are
not used, because grants and gateway migrations rewrite left-over
files as well. A failed or empty listing removes nothing. Each removal
is logged and recorded as an Event on the HelmRelease. The hook runs
before the Object Lock hook, so in delete mode a left-over identity is
removed before that hook grants it anything.

A filer published for Client-topology clusters holds identities whose
BucketAccesses live in those clusters, so cosi.orphanIdentities
defaults to auto: report there, delete otherwise. An operator can
force either.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
This commit is contained in:
Aleksei Sviridkin committed 2026-11-17 22:07:25 +03:00
1 parent c49f58c4a4
commit 045f1a9bbc
11 files changed
+970 -2

No files matched your search

+336
View File
@@ -0,0 +1,336 @@
#!/usr/bin/env bats
# Unit tests for packages/system/seaweedfs/files/orphan-identities.sh, the
# post-install/post-upgrade hook that removes the per-identity IAM files of BucketAccesses
# that no longer exist. Drives it against a fake `weed shell` that keeps the
# identity files in a directory, and a fake kubectl.
load test_helper
SCRIPT="$PWD/packages/system/seaweedfs/files/orphan-identities.sh"
OTHER=0b5e1a7e-0000-4000-8000-000000000009
LIVE=0b5e1a7e-0000-4000-8000-00000000000a
GONE=0b5e1a7e-0000-4000-8000-00000000000b
GONE2=0b5e1a7e-0000-4000-8000-00000000000c
setup() {
strict_setup
BIN="$BATS_TEST_TMPDIR/bin"
mkdir -p "$BIN"
export IDS="$BATS_TEST_TMPDIR/identities"
export BA_JSON="$BATS_TEST_TMPDIR/bucketaccesses.json"
export KUBECTL_LOG="$BATS_TEST_TMPDIR/kubectl"
export WEED_LOG="$BATS_TEST_TMPDIR/weed"
mkdir -p "$IDS"
: > "$KUBECTL_LOG"
: > "$WEED_LOG"
# One BucketAccess with no file, so the listing is never empty by accident.
echo '{"apiVersion":"v1","kind":"List","items":[{"metadata":{"uid":"'"$OTHER"'"},"status":{"accountID":"ba-'"$OTHER"'"}}]}' > "$BA_JSON"
cat > "$BIN/weed" <<'EOF'
#!/bin/bash
# A weed shell session over $IDS, one file per identity.
# Like the real one it reports a failed command on stderr and exits 0.
# WEED_SLEEP hangs every session. WEED_LS_FAIL fails a listing (WEED_LS_FAIL_FROM: from that listing on),
# WEED_RM_FAIL makes every removal fail.
set -eu
[ "$1" = shell ] || exit 2
echo session >> "$WEED_LOG"
[ -z "${WEED_SLEEP:-}" ] || sleep "$WEED_SLEEP"
while read -r cmd path; do
echo "$cmd $path" >> "$WEED_LOG"
case $cmd in
fs.ls)
[ "$path" = /etc/iam/identities ] || exit 3
n=$(($(cat "$WEED_LOG.ls" 2>/dev/null || echo 0) + 1)); echo "$n" > "$WEED_LOG.ls"
[ "$n" -ge "${WEED_LS_FAIL_FROM:-1}" ] || { ls -1 "$IDS"; continue; }
case ${WEED_LS_FAIL:-} in
exit) exit 1 ;;
print) echo "error: list $path: connection refused" >&2; continue ;;
esac
ls -1 "$IDS"
;;
fs.rm)
[ -z "${WEED_RM_FAIL:-}" ] || { echo "error: rm $path: permission denied" >&2; continue; }
rm "$IDS/${path##*/}"
;;
*)
exit 4
;;
esac
done
EOF
cat > "$BIN/kubectl" <<'EOF'
#!/bin/sh
echo "ARGS: $*" >> "$KUBECTL_LOG"
# Like the real one: any --request-timeout drops the in-cluster credentials.
case " $* " in
*" --request-timeout"*) echo 'The connection to the server localhost:8080 was refused' >&2; exit 1 ;;
esac
[ -z "${KUBECTL_SLEEP:-}" ] || exec sleep "$KUBECTL_SLEEP"
case $1 in
get)
case $2 in
helmrelease) printf 0b5e1a7e-0000-4000-8000-000000000001 ;;
*)
[ -z "${KUBECTL_BA_FAIL:-}" ] || { echo 'Error from server (Forbidden): bucketaccesses is forbidden' >&2; exit 1; }
# Child tenants keep their BucketAccesses in their own namespaces.
case " $* " in
*" --all-namespaces "*)
cat "$BA_JSON"
# A BucketAccess created and granted right after this listing.
[ -z "${KUBECTL_GRANT_AFTER:-}" ] || echo SECRET > "$IDS/ba-$KUBECTL_GRANT_AFTER.json"
;;
*) echo '{"kind":"List","items":[]}' ;;
esac
;;
esac
;;
*) cat >> "$KUBECTL_LOG" ;;
esac
EOF
chmod +x "$BIN/weed" "$BIN/kubectl"
export PATH="$BIN:$PATH"
export MASTER=seaweedfs-master:9333 FILER=seaweedfs-filer-client:8888
export NAMESPACE=tenant-foo RELEASE=seaweedfs-system JOB=seaweedfs-system-orphan-identities
export MODE=delete SHELL_TIMEOUT=5
}
# identity <file name>
identity() {
echo SECRET > "$IDS/$1"
}
# bucketaccess <uid> [accountID]
bucketaccess() {
jq --arg uid "$1" --arg acct "${2:-}" \
'.items += [{"metadata": {"uid": $uid}, "status": (if $acct == "" then {} else {"accountID": $acct} end)}]' \
"$BA_JSON" > "$BA_JSON.new"
mv "$BA_JSON.new" "$BA_JSON"
}
kept() {
[ -f "$IDS/$1" ] || { echo "FAIL: $1 was removed"; false; }
}
removed() {
if [ -f "$IDS/$1" ]; then echo "FAIL: $1 is still there"; false; fi
}
@test "an old identity file with no BucketAccess behind it is removed" {
identity "ba-$GONE.json"
identity "ba-$LIVE.json"
bucketaccess "$LIVE" "ba-$LIVE"
"$SCRIPT"
removed "ba-$GONE.json"
kept "ba-$LIVE.json"
}
@test "a BucketAccess still being granted protects its file by uid alone" {
identity "ba-$LIVE.json"
bucketaccess "$LIVE"
"$SCRIPT"
kept "ba-$LIVE.json"
}
@test "a BucketAccess restored under a new uid protects the file its accountID names" {
identity "ba-$GONE.json"
bucketaccess "$LIVE" "ba-$GONE"
"$SCRIPT"
kept "ba-$GONE.json"
}
@test "an empty BucketAccess listing removes nothing" {
identity "ba-$GONE.json"
echo '{"kind":"List","items":[]}' > "$BA_JSON"
"$SCRIPT"
kept "ba-$GONE.json"
grep -q '^type: Warning$' "$KUBECTL_LOG"
grep -q '^reason: OrphanIdentitiesFound$' "$KUBECTL_LOG"
}
@test "the identity directory is listed before the BucketAccesses" {
KUBECTL_GRANT_AFTER=$LIVE "$SCRIPT"
kept "ba-$LIVE.json"
}
@test "a file rewritten by a grant a moment ago is removed once its BucketAccess is gone" {
identity "ba-$GONE.json"
touch "$IDS/ba-$GONE.json"
"$SCRIPT"
removed "ba-$GONE.json"
}
@test "listing, removals and the check listing take one weed shell session each" {
identity "ba-$GONE.json"
identity "ba-$GONE2.json"
"$SCRIPT"
[ "$(grep -c '^session' "$WEED_LOG")" -eq 3 ]
}
@test "identities the COSI driver did not name are never touched" {
identity admin.json
identity ba-backup.json
identity "ba-$GONE.json.old"
identity "BA-$GONE.json"
identity "xba-$GONE.json"
identity "ba-${GONE}0.json"
identity ba-1234.json
"$SCRIPT"
kept "xba-$GONE.json"
kept "ba-${GONE}0.json"
kept ba-1234.json
kept admin.json
kept ba-backup.json
kept "ba-$GONE.json.old"
kept "BA-$GONE.json"
if grep -q '^fs.rm' "$WEED_LOG"; then echo "FAIL: removed something"; cat "$WEED_LOG"; false; fi
}
@test "report mode names the orphan and removes nothing" {
identity "ba-$GONE.json"
out=$(MODE=report "$SCRIPT" 2>&1)
kept "ba-$GONE.json"
if grep -q '^fs.rm' "$WEED_LOG"; then echo "FAIL: report mode removed a file"; false; fi
case $out in *"ba-$GONE"*) ;; *) echo "FAIL: orphan not named: $out"; false ;; esac
grep -q '^reason: OrphanIdentitiesFound$' "$KUBECTL_LOG"
grep -q "ba-$GONE" "$KUBECTL_LOG"
grep -q 'not removed (mode report)' "$KUBECTL_LOG"
grep -q 'cosi.orphanIdentities to delete' "$KUBECTL_LOG"
if grep -q 'other clusters' "$KUBECTL_LOG"; then echo "FAIL: Event claims a reason the script cannot know"; false; fi
}
@test "an unknown mode only reports" {
identity "ba-$GONE.json"
MODE=Delete "$SCRIPT"
kept "ba-$GONE.json"
grep -q '^reason: OrphanIdentitiesFound$' "$KUBECTL_LOG"
grep -q 'not removed (mode Delete)' "$KUBECTL_LOG"
}
@test "a BucketAccess listing that fails removes nothing and ends in a Warning Event" {
identity "ba-$GONE.json"
KUBECTL_BA_FAIL=1 "$SCRIPT"
kept "ba-$GONE.json"
if grep -q '^fs.rm' "$WEED_LOG"; then echo "FAIL: removed a file without a BucketAccess listing"; false; fi
grep -q '^type: Warning$' "$KUBECTL_LOG"
grep -q '^reason: OrphanIdentitiesNotChecked$' "$KUBECTL_LOG"
}
@test "a BucketAccess listing that is not a list removes nothing" {
identity "ba-$GONE.json"
echo '{"kind":"Status","status":"Failure"}' > "$BA_JSON"
"$SCRIPT"
kept "ba-$GONE.json"
grep -q '^reason: OrphanIdentitiesNotChecked$' "$KUBECTL_LOG"
}
@test "a listing item without a uid removes nothing" {
identity "ba-$GONE.json"
echo '{"kind":"List","items":[{"metadata":{}}]}' > "$BA_JSON"
"$SCRIPT"
kept "ba-$GONE.json"
grep -q '^reason: OrphanIdentitiesNotChecked$' "$KUBECTL_LOG"
}
@test "a listing of the identity directory that exits non-zero removes nothing and ends in a Warning Event" {
identity "ba-$GONE.json"
WEED_LS_FAIL="exit" "$SCRIPT"
kept "ba-$GONE.json"
if grep -q '^fs.rm' "$WEED_LOG"; then echo "FAIL: removed a file"; false; fi
grep -q '^reason: OrphanIdentitiesNotChecked$' "$KUBECTL_LOG"
}
@test "a listing of the identity directory that reports an error removes nothing" {
identity "ba-$GONE.json"
WEED_LS_FAIL="print" "$SCRIPT"
kept "ba-$GONE.json"
grep -q '^reason: OrphanIdentitiesNotChecked$' "$KUBECTL_LOG"
}
@test "every removal is logged and recorded as an Event on the HelmRelease" {
identity "ba-$GONE.json"
identity "ba-$GONE2.json"
out=$("$SCRIPT" 2>&1)
case $out in *"removed ba-$GONE"*) ;; *) echo "FAIL: removal not logged: $out"; false ;; esac
case $out in *"removed ba-$GONE2"*) ;; *) echo "FAIL: removal not logged: $out"; false ;; esac
[ "$(grep -c '^reason: OrphanIdentityRemoved$' "$KUBECTL_LOG")" -eq 2 ]
grep -q '^ kind: HelmRelease$' "$KUBECTL_LOG"
grep -q '^ name: seaweedfs-system$' "$KUBECTL_LOG"
grep -q '^ namespace: tenant-foo$' "$KUBECTL_LOG"
grep -q '^ uid: "0b5e1a7e-0000-4000-8000-000000000001"$' "$KUBECTL_LOG"
}
@test "a listing that fails after the removal ends in a Warning Event" {
identity "ba-$GONE.json"
WEED_LS_FAIL="exit" WEED_LS_FAIL_FROM=2 "$SCRIPT"
grep -q '^type: Warning$' "$KUBECTL_LOG"
grep -q '^reason: OrphanIdentityNotRemoved$' "$KUBECTL_LOG"
if grep -q '^reason: OrphanIdentityRemoved$' "$KUBECTL_LOG"; then echo "FAIL: claimed a removal it could not confirm"; false; fi
}
@test "a listing after the removal that reports an error claims no removal" {
identity "ba-$GONE.json"
WEED_LS_FAIL="print" WEED_LS_FAIL_FROM=2 "$SCRIPT"
grep -q '^reason: OrphanIdentityNotRemoved$' "$KUBECTL_LOG"
if grep -q '^reason: OrphanIdentityRemoved$' "$KUBECTL_LOG"; then echo "FAIL: claimed a removal it could not confirm"; false; fi
}
@test "a removal that fails ends in a Warning Event and exit 0" {
identity "ba-$GONE.json"
WEED_RM_FAIL=1 "$SCRIPT"
kept "ba-$GONE.json"
grep -q '^type: Warning$' "$KUBECTL_LOG"
grep -q '^reason: OrphanIdentityNotRemoved$' "$KUBECTL_LOG"
}
@test "nothing to do records no Event" {
identity "ba-$LIVE.json"
bucketaccess "$LIVE"
"$SCRIPT"
if grep -q '^ARGS: create' "$KUBECTL_LOG"; then echo "FAIL: recorded an Event"; false; fi
}
@test "a weed shell that never returns is cut off and removes nothing" {
identity "ba-$GONE.json"
start=$(date +%s)
SHELL_TIMEOUT=3 WEED_SLEEP=60 "$SCRIPT"
[ $(($(date +%s) - start)) -lt 60 ]
kept "ba-$GONE.json"
grep -q '^reason: OrphanIdentitiesNotChecked$' "$KUBECTL_LOG"
}
@test "secret content of an identity file never reaches the output" {
identity "ba-$GONE.json"
out=$("$SCRIPT" 2>&1)
case $out in *SECRET*) echo "FAIL: file content printed: $out"; false ;; esac
if grep -q SECRET "$KUBECTL_LOG"; then echo "FAIL: file content in an Event"; false; fi
}
# The Object Lock hook grants every identity with Read or Write, left-over
# ones included; removal has to come first.
@test "orphan removal runs before the Object Lock grant" {
helm template seaweedfs-system packages/system/seaweedfs --namespace tenant-foo > "$BATS_TEST_TMPDIR/manifest"
weight() {
yq eval-all "select(.kind == \"$1\" and .metadata.name == \"$2\") | .metadata.annotations[\"helm.sh/hook-weight\"]" "$BATS_TEST_TMPDIR/manifest"
}
orphan=$(weight Job seaweedfs-system-orphan-identities)
grant=$(weight Job seaweedfs-system-object-lock-actions)
[ -n "$orphan" ] && [ -n "$grant" ]
[ "$orphan" -lt "$grant" ]
for kind in ConfigMap ServiceAccount Role RoleBinding; do
[ "$(weight "$kind" seaweedfs-system-orphan-identities)" -lt "$orphan" ]
done
}
# The stub logs its call before it hangs, so SHELL_TIMEOUT has to leave a
# loaded runner time to start it.
@test "a kubectl that never returns is cut off and removes nothing" {
identity "ba-$GONE.json"
start=$SECONDS
SHELL_TIMEOUT=3 KUBECTL_SLEEP=60 "$SCRIPT"
[ $((SECONDS - start)) -lt 60 ]
kept "ba-$GONE.json"
grep -q '^ARGS: get bucketaccesses' "$KUBECTL_LOG"
grep -q '^ARGS: get helmrelease' "$KUBECTL_LOG"
grep -q '^ARGS: create' "$KUBECTL_LOG"
}
+2
View File
@@ -81,4 +81,6 @@
| `lifecycle` | S3 bucket lifecycle configuration. | `object` | `{}` | | `lifecycle` | S3 bucket lifecycle configuration. | `object` | `{}` |
| `lifecycle.enabled` | Run the SeaweedFS admin server and a worker that applies bucket lifecycle rules, once a day. When disabled, rules are still accepted and stored, but not applied. Ignored with the Client topology, whose rules are enforced by the instance it connects to. Rules stored before enabling are applied on the first pass, minutes after the switch. While on, in a bucket without versioning enabled, an object overwritten between the daily listing and its expiry delete can be deleted although it is new. | `bool` | `false` | | `lifecycle.enabled` | Run the SeaweedFS admin server and a worker that applies bucket lifecycle rules, once a day. When disabled, rules are still accepted and stored, but not applied. Ignored with the Client topology, whose rules are enforced by the instance it connects to. Rules stored before enabling are applied on the first pass, minutes after the switch. While on, in a bucket without versioning enabled, an object overwritten between the daily listing and its expiry delete can be deleted although it is new. | `bool` | `false` |
| `lifecycle.storageClass` | StorageClass of the admin server's 1Gi job-state volume. Empty uses the cluster default; `volume.storageClass` is not used, because in MultiZone it can be local to one zone. Prefer a replicated class: on a node-local one, losing the node stops lifecycle enforcement. Set it before enabling lifecycle: the class is part of the admin StatefulSet's volume claim template, which cannot change, so changing it while lifecycle is on makes every upgrade of the instance fail until it is reverted. To move the volume, disable lifecycle, delete the `admin-data-seaweedfs-admin-0` PVC of the instance, change the class and enable lifecycle again. | `string` | `""` | | `lifecycle.storageClass` | StorageClass of the admin server's 1Gi job-state volume. Empty uses the cluster default; `volume.storageClass` is not used, because in MultiZone it can be local to one zone. Prefer a replicated class: on a node-local one, losing the node stops lifecycle enforcement. Set it before enabling lifecycle: the class is part of the admin StatefulSet's volume claim template, which cannot change, so changing it while lifecycle is on makes every upgrade of the instance fail until it is reverted. To move the volume, disable lifecycle, delete the `admin-data-seaweedfs-admin-0` PVC of the instance, change the class and enable lifecycle again. | `string` | `""` |
| `cosi` | Bucket provisioning configuration. | `object` | `{}` |
| `cosi.orphanIdentities` | What installs and upgrades do with S3 identities left behind by deleted BucketAccesses: `delete` removes them, `report` only lists them in an Event, `auto` reports when `filer.grpcHost` is set (other clusters may use this filer) and removes them otherwise. Set `report` if the filer is reachable from other clusters some other way. Ignored with the Client topology, whose identities live on the filer of the instance it connects to. | `string` | `auto` |
@@ -421,6 +421,14 @@ spec:
cosi: cosi:
driverName: "{{ .Release.Namespace }}.seaweedfs.objectstorage.k8s.io" driverName: "{{ .Release.Namespace }}.seaweedfs.objectstorage.k8s.io"
bucketClassName: "{{ .Release.Namespace }}" bucketClassName: "{{ .Release.Namespace }}"
orphanIdentities:
{{- $orphans := dig "orphanIdentities" "auto" (.Values.cosi | default dict) }}
{{- if eq $orphans "auto" }}
{{- /* A filer published for Client-topology clusters (ingress.yaml)
holds identities of BucketAccesses in those clusters. */}}
{{- $orphans = ternary "report" "delete" (not (empty .Values.filer.grpcHost)) }}
{{- end }}
mode: {{ $orphans | quote }}
resources: resources:
requests: requests:
cpu: "100m" cpu: "100m"
@@ -0,0 +1,100 @@
suite: seaweedfs orphan identities cleanup mode
templates:
- templates/seaweedfs.yaml
release:
name: seaweedfs
namespace: tenant-root
tests:
- it: auto removes orphaned identities when the filer serves only this cluster
set: &platform
_namespace:
host: example.org
ingress: tenant-root
_cluster:
issuer-name: letsencrypt-prod
solver: http01
documentSelector:
path: metadata.name
value: seaweedfs-system
asserts:
- equal:
path: spec.values.seaweedfs.cosi.orphanIdentities.mode
value: delete
- it: auto only reports them when the filer is published for Client-topology clusters
set:
<<: *platform
filer:
grpcHost: filer.example.org
documentSelector:
path: metadata.name
value: seaweedfs-system
asserts:
- equal:
path: spec.values.seaweedfs.cosi.orphanIdentities.mode
value: report
- it: report holds even when the filer is not published
set:
<<: *platform
cosi:
orphanIdentities: report
documentSelector:
path: metadata.name
value: seaweedfs-system
asserts:
- equal:
path: spec.values.seaweedfs.cosi.orphanIdentities.mode
value: report
- it: delete holds even when the filer is published
set:
<<: *platform
filer:
grpcHost: filer.example.org
cosi:
orphanIdentities: delete
documentSelector:
path: metadata.name
value: seaweedfs-system
asserts:
- equal:
path: spec.values.seaweedfs.cosi.orphanIdentities.mode
value: delete
- it: an empty cosi block behaves as auto
set:
<<: *platform
filer:
grpcHost: filer.example.org
cosi: null
documentSelector:
path: metadata.name
value: seaweedfs-system
asserts:
- equal:
path: spec.values.seaweedfs.cosi.orphanIdentities.mode
value: report
- it: an empty cosi block removes when the filer is not published
set:
<<: *platform
cosi: null
documentSelector:
path: metadata.name
value: seaweedfs-system
asserts:
- equal:
path: spec.values.seaweedfs.cosi.orphanIdentities.mode
value: delete
- it: an unknown mode is rejected
set:
<<: *platform
cosi:
orphanIdentities: bogus
asserts:
- failedTemplate: {}
@@ -887,6 +887,23 @@
"pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$" "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$"
} }
} }
},
"cosi": {
"description": "Bucket provisioning configuration.",
"type": "object",
"default": {},
"properties": {
"orphanIdentities": {
"description": "What installs and upgrades do with S3 identities left behind by deleted BucketAccesses: `delete` removes them, `report` only lists them in an Event, `auto` reports when `filer.grpcHost` is set (other clusters may use this filer) and removes them otherwise. Set `report` if the filer is reachable from other clusters some other way. Ignored with the Client topology, whose identities live on the filer of the instance it connects to.",
"type": "string",
"default": "auto",
"enum": [
"auto",
"report",
"delete"
]
}
}
} }
} }
} }
+12
View File
@@ -210,3 +210,15 @@ lifecycle:
# fixed key can hit. On by default only once that path carries identity. # fixed key can hit. On by default only once that path carries identity.
enabled: false enabled: false
storageClass: "" storageClass: ""
## @enum {string} OrphanIdentities - What installs and upgrades do with S3 identities left behind by deleted BucketAccesses.
## @value auto
## @value report
## @value delete
## @typedef {struct} Cosi - Bucket provisioning configuration.
## @field {OrphanIdentities} [orphanIdentities] - What installs and upgrades do with S3 identities left behind by deleted BucketAccesses: `delete` removes them, `report` only lists them in an Event, `auto` reports when `filer.grpcHost` is set (other clusters may use this filer) and removes them otherwise. Set `report` if the filer is reachable from other clusters some other way. Ignored with the Client topology, whose identities live on the filer of the instance it connects to.
## @param {Cosi} [cosi] - Bucket provisioning configuration.
cosi:
orphanIdentities: auto
+2 -2
View File
@@ -8,7 +8,7 @@ spec:
singular: seaweedfs singular: seaweedfs
plural: seaweedfses plural: seaweedfses
openAPISchema: |- openAPISchema: |-
{"title":"Chart Values","type":"object","properties":{"host":{"description":"The hostname used to access SeaweedFS externally (defaults to 's3' subdomain for the tenant host).","type":"string","default":""},"topology":{"description":"The topology of the SeaweedFS cluster.","type":"string","default":"Simple","enum":["Simple","MultiZone","Client"]},"replicationFactor":{"description":"Replication factor: number of replicas for each volume in the SeaweedFS cluster.","type":"integer","default":2},"db":{"description":"Database configuration.","type":"object","default":{},"properties":{"replicas":{"description":"Number of database replicas.","type":"integer","default":2},"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"memory":{"description":"Amount of memory allocated.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true}}},"resourcesPreset":{"description":"Default sizing preset used when `resources` is omitted.","type":"string","default":"t1.small","enum":["t1.nano","t1.micro","t1.small","t1.medium","t1.large","t1.xlarge","t1.2xlarge","t1.4xlarge","c1.nano","c1.micro","c1.small","c1.medium","c1.large","c1.xlarge","c1.2xlarge","c1.4xlarge","s1.nano","s1.micro","s1.small","s1.medium","s1.large","s1.xlarge","s1.2xlarge","s1.4xlarge","u1.nano","u1.micro","u1.small","u1.medium","u1.large","u1.xlarge","u1.2xlarge","u1.4xlarge","m1.nano","m1.micro","m1.small","m1.medium","m1.large","m1.xlarge","m1.2xlarge","m1.4xlarge","nano","micro","small","medium","large","xlarge","2xlarge"]},"size":{"description":"Persistent Volume size.","default":"10Gi","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"storageClass":{"description":"StorageClass used to store the data.","type":"string","default":""}}},"master":{"description":"Master service configuration.","type":"object","default":{},"properties":{"replicas":{"description":"Number of master replicas.","type":"integer","default":3},"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"memory":{"description":"Amount of memory allocated.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true}}},"resourcesPreset":{"description":"Default sizing preset used when `resources` is omitted.","type":"string","default":"t1.small","enum":["t1.nano","t1.micro","t1.small","t1.medium","t1.large","t1.xlarge","t1.2xlarge","t1.4xlarge","c1.nano","c1.micro","c1.small","c1.medium","c1.large","c1.xlarge","c1.2xlarge","c1.4xlarge","s1.nano","s1.micro","s1.small","s1.medium","s1.large","s1.xlarge","s1.2xlarge","s1.4xlarge","u1.nano","u1.micro","u1.small","u1.medium","u1.large","u1.xlarge","u1.2xlarge","u1.4xlarge","m1.nano","m1.micro","m1.small","m1.medium","m1.large","m1.xlarge","m1.2xlarge","m1.4xlarge","nano","micro","small","medium","large","xlarge","2xlarge"]},"volumeSizeLimitMB":{"description":"Size in MB at which a volume stops taking writes, and the divisor that sets how many buckets a volume server can serve. Lower it to fit more buckets on the same disk, at the cost of more volume files for the same stored data; on a large volume it is worth raising instead. Changing it on an instance that already holds data costs something either way: lowering it stops writes to every bucket whose volumes all reach the new value until that bucket can grow, and raising it takes the room new buckets grow into, so run the check in docs/operations/seaweedfs-lowering-the-volume-size-limit.md first. Must be between 1 and 30000. A value close to or above `volume.size` leaves each volume server a single slot rather than failing, since the server floors its slot count at one.","type":"integer","default":400,"maximum":30000,"minimum":1}}},"filer":{"description":"Filer service configuration.","type":"object","default":{},"properties":{"grpcHost":{"description":"TheLine truncated {"title":"Chart Values","type":"object","properties":{"host":{"description":"The hostname used to access SeaweedFS externally (defaults to 's3' subdomain for the tenant host).","type":"string","default":""},"topology":{"description":"The topology of the SeaweedFS cluster.","type":"string","default":"Simple","enum":["Simple","MultiZone","Client"]},"replicationFactor":{"description":"Replication factor: number of replicas for each volume in the SeaweedFS cluster.","type":"integer","default":2},"db":{"description":"Database configuration.","type":"object","default":{},"properties":{"replicas":{"description":"Number of database replicas.","type":"integer","default":2},"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"memory":{"description":"Amount of memory allocated.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true}}},"resourcesPreset":{"description":"Default sizing preset used when `resources` is omitted.","type":"string","default":"t1.small","enum":["t1.nano","t1.micro","t1.small","t1.medium","t1.large","t1.xlarge","t1.2xlarge","t1.4xlarge","c1.nano","c1.micro","c1.small","c1.medium","c1.large","c1.xlarge","c1.2xlarge","c1.4xlarge","s1.nano","s1.micro","s1.small","s1.medium","s1.large","s1.xlarge","s1.2xlarge","s1.4xlarge","u1.nano","u1.micro","u1.small","u1.medium","u1.large","u1.xlarge","u1.2xlarge","u1.4xlarge","m1.nano","m1.micro","m1.small","m1.medium","m1.large","m1.xlarge","m1.2xlarge","m1.4xlarge","nano","micro","small","medium","large","xlarge","2xlarge"]},"size":{"description":"Persistent Volume size.","default":"10Gi","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"storageClass":{"description":"StorageClass used to store the data.","type":"string","default":""}}},"master":{"description":"Master service configuration.","type":"object","default":{},"properties":{"replicas":{"description":"Number of master replicas.","type":"integer","default":3},"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"memory":{"description":"Amount of memory allocated.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true}}},"resourcesPreset":{"description":"Default sizing preset used when `resources` is omitted.","type":"string","default":"t1.small","enum":["t1.nano","t1.micro","t1.small","t1.medium","t1.large","t1.xlarge","t1.2xlarge","t1.4xlarge","c1.nano","c1.micro","c1.small","c1.medium","c1.large","c1.xlarge","c1.2xlarge","c1.4xlarge","s1.nano","s1.micro","s1.small","s1.medium","s1.large","s1.xlarge","s1.2xlarge","s1.4xlarge","u1.nano","u1.micro","u1.small","u1.medium","u1.large","u1.xlarge","u1.2xlarge","u1.4xlarge","m1.nano","m1.micro","m1.small","m1.medium","m1.large","m1.xlarge","m1.2xlarge","m1.4xlarge","nano","micro","small","medium","large","xlarge","2xlarge"]},"volumeSizeLimitMB":{"description":"Size in MB at which a volume stops taking writes, and the divisor that sets how many buckets a volume server can serve. Lower it to fit more buckets on the same disk, at the cost of more volume files for the same stored data; on a large volume it is worth raising instead. Changing it on an instance that already holds data costs something either way: lowering it stops writes to every bucket whose volumes all reach the new value until that bucket can grow, and raising it takes the room new buckets grow into, so run the check in docs/operations/seaweedfs-lowering-the-volume-size-limit.md first. Must be between 1 and 30000. A value close to or above `volume.size` leaves each volume server a single slot rather than failing, since the server floors its slot count at one.","type":"integer","default":400,"maximum":30000,"minimum":1}}},"filer":{"description":"Filer service configuration.","type":"object","default":{},"properties":{"grpcHost":{"description":"TheLine truncated
release: release:
prefix: "" prefix: ""
labels: labels:
@@ -26,7 +26,7 @@ spec:
description: Seaweedfs description: Seaweedfs
module: true module: true
icon: PHN2ZyB3aWR0aD0iMTQ0IiBoZWlnaHQ9IjE0NCIgdmlld0JveD0iMCAwIDE0NCAxNDQiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIxNDQiIGhlaWdodD0iMTQ0IiByeD0iMjQiIGZpbGw9InVybCgjcGFpbnQwX2xpbmVhcl82NzlfMTkxMCkiLz4KPHBh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jYwNCAxMTQuNDg5IDEyNC45MzYgMTE0Ljc4NyAxMjQuMzM5IDExNC41NzlaTTExMi4zMTkgMTE2Ljk4QzEwOS45NiAxMTUuNjcgMTEwLjI4NiAxMTEuMDA2IDExMi40MTcgMTA4Ljk2NUMxMLine truncated
keysOrder: [["apiVersion"], ["appVersion"], ["kind"], ["metadata"], ["metadata", "name"], ["spec", "host"], ["spec", "topology"], ["spec", "replicationFactor"], ["spec", "db"], ["spec", "db", "replicas"], ["spec", "db", "size"], ["spec", "db", "storageClass"], ["spec", "db", "resources"], ["spec", "db", "resourcesPreset"], ["spec", "master"], ["spec", "master", "replicas"], ["spec", "master", "resources"], ["spec", "master", "resourcesPreset"], ["spec", "master", "volumeSizeLimitMB"], ["spec", "filer"], ["spec", "filer", "replicas"], ["spec", "filer", "resources"], ["spec", "filer", "resourcesPreset"], ["spec", "filer", "grpcHost"], ["spec", "filer", "grpcPort"], ["spec", "filer", "whitelist"], ["spec", "volume"], ["spec", "volume", "replicas"], ["spec", "volume", "size"], ["spec", "volume", "storageClass"], ["spec", "volume", "diskType"], ["spec", "volume", "resources"], ["spec", "volume", "resourcesPreset"], ["spec", "volume", "zones"], ["spec", "volume", "pools"], ["spec", "s3"], ["spec", "s3", "replicas"], ["spec", "s3", "resources"], ["spec", "s3", "resourcesPreset"], ["spec", "lifecycle"], ["spec", "lifecycle", "enabled"], ["spec", "lifecycle", "storageClass"]] keysOrder: [["apiVersion"], ["appVersion"], ["kind"], ["metadata"], ["metadata", "name"], ["spec", "host"], ["spec", "topology"], ["spec", "replicationFactor"], ["spec", "db"], ["spec", "db", "replicas"], ["spec", "db", "size"], ["spec", "db", "storageClass"], ["spec", "db", "resources"], ["spec", "db", "resourcesPreset"], ["spec", "master"], ["spec", "master", "replicas"], ["spec", "master", "resources"], ["spec", "master", "resourcesPreset"], ["spec", "master", "volumeSizeLimitMB"], ["spec", "filer"], ["spec", "filer", "replicas"], ["spec", "filer", "resources"], ["spec", "filer", "resourcesPreset"], ["spec", "filer", "grpcHost"], ["spec", "filer", "grpcPort"], ["spec", "filer", "whitelist"], ["spec", "volume"], ["spec", "volume", "replicas"], ["spec", "volume", "size"], ["spec", "volume", "storageClass"], ["spec", "volume", "diskType"], ["spec", "volume", "resources"], ["spec", "volume", "resourcesPreset"], ["spec", "volume", "zones"], ["spec", "volume", "pools"], ["spec", "s3"], ["spec", "s3", "replicas"], ["spec", "s3", "resources"], ["spec", "s3", "resourcesPreset"], ["spec", "lifecycle"], ["spec", "lifecycle", "enabled"], ["spec", "lifecycle", "storageClass"], ["spec", "cosi"], ["spec", "cosi", "orphanIdentities"]]
secrets: secrets:
exclude: [] exclude: []
include: [] include: []
+137
View File
@@ -0,0 +1,137 @@
#!/bin/sh
# Removes the per-identity IAM files of BucketAccesses that no longer exist.
# Since SeaweedFS 4.08 the S3 gateways move every identity out of
# /etc/iam/identity.json into /etc/iam/identities/<name>.json, and COSI driver
# releases up to v0.3.1 revoke only from identity.json, so each deleted
# BucketAccess left its file behind.
#
# The COSI sidecar names every identity it creates ba-<BucketAccess uid>. A
# file of that shape that no BucketAccess in any namespace names, by uid or by
# status.accountID, is left over; anything else on the filer is never touched.
# The uid covers a BucketAccess still being granted, which has no accountID
# yet; the accountID covers one restored with its status under a new uid.
# One restored without its status is granted afresh, so a workload still
# holding the old keys loses them once their file is removed.
#
# The directory is listed before the BucketAccesses. A BucketAccess exists
# before its grant writes a file, so every file in the first listing whose
# BucketAccess still exists is named by the second one. File ages are not
# used: grants and gateway migrations rewrite left-over files too.
#
# MODE=delete removes; anything else only reports. A filer that other clusters
# reach as Client topology carries identities whose BucketAccesses this
# cluster cannot see, so the chart sets report there.
#
# Identity files carry secret keys, so their content is never printed. Any
# failure to list leaves everything in place, and no failure the script meets
# fails the release: it ends in a Warning Event on the HelmRelease instead.
set -eu
: "${MASTER:?}" "${FILER:?}" "${NAMESPACE:?}" "${RELEASE:?}"
JOB=${JOB:-$RELEASE-orphan-identities}
MODE=${MODE:-report}
SHELL_TIMEOUT=${SHELL_TIMEOUT:-30}
DIR=/etc/iam/identities
# weed shell reports a failed command as an "error:" line on stderr and still
# exits 0, so stderr is kept with the output for the callers to check.
weed_shell() {
timeout "$SHELL_TIMEOUT" weed shell -master="$MASTER" -filer="$FILER" 2>&1
}
# event <type> <reason> <message>
event() {
message=$(printf '%s' "$3" | tr -d '"\134')
stamp=$(date -u +%Y-%m-%dT%H:%M:%SZ)
# kubectl describe matches events by uid as well as name.
if [ -z "${hr_uid+set}" ]; then
hr_uid=$(timeout "$SHELL_TIMEOUT" kubectl get helmrelease "$RELEASE" --namespace "$NAMESPACE" --output jsonpath='{.metadata.uid}') || hr_uid=
fi
timeout "$SHELL_TIMEOUT" kubectl create --filename - <<EOF >/dev/null || echo "could not record the $2 Event" >&2
apiVersion: v1
kind: Event
metadata:
generateName: $JOB-
namespace: $NAMESPACE
involvedObject:
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
name: $RELEASE
namespace: $NAMESPACE
uid: "$hr_uid"
type: $1
reason: $2
message: "$message"
source:
component: $JOB
firstTimestamp: "$stamp"
lastTimestamp: "$stamp"
count: 1
EOF
}
not_checked() {
echo "$1" >&2
event Warning OrphanIdentitiesNotChecked "$1 Nothing was removed. See the logs of Job $JOB."
exit 0
}
# The ba-<uuid> names in a listing of $DIR, without the .json suffix.
cosi_names() {
grep -E '^ba-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\.json$' | sed 's/\.json$//'
}
if ! files=$(echo "fs.ls $DIR" | weed_shell) || printf '%s\n' "$files" | grep -q '^error'; then
not_checked "Could not list $DIR."
fi
if ! listing=$(timeout "$SHELL_TIMEOUT" kubectl get bucketaccesses.objectstorage.k8s.io --all-namespaces --output json) ||
! live=$(printf '%s\n' "$listing" | jq -r '
.items[]
| (.metadata.uid | if type == "string" and . != "" then "ba-" + . else error("no uid") end),
(.status.accountID // empty)' 2>/dev/null); then
not_checked "Could not list BucketAccesses."
fi
orphans=
for name in $(printf '%s\n' "$files" | cosi_names); do
printf '%s\n' "$live" | grep -qxF "$name" || orphans="$orphans $name"
done
orphans=${orphans# }
if [ -z "$orphans" ]; then
echo "nothing to remove"
exit 0
fi
if [ "$MODE" != delete ]; then
echo "left over from deleted BucketAccesses, not removed: $orphans"
event Warning OrphanIdentitiesFound "Identities left over from deleted BucketAccesses, not removed (mode $MODE): $orphans. Set cosi.orphanIdentities to delete in the SeaweedFS application to remove them, once no other cluster uses this filer."
exit 0
fi
# An empty list next to identities on the filer is likelier a wrong answer
# than every bucket user gone at once.
if [ -z "$live" ]; then
echo "no BucketAccess exists, not removed: $orphans" >&2
event Warning OrphanIdentitiesFound "No BucketAccess exists in the cluster, so these identities on the filer were not removed: $orphans"
exit 0
fi
# fs.rm exits 0 and may print nothing on failure, so what is gone is read back.
for name in $orphans; do echo "fs.rm $DIR/$name.json"; done | weed_shell >/dev/null || true
if ! after=$(echo "fs.ls $DIR" | weed_shell) || printf '%s\n' "$after" | grep -q '^error'; then
echo "could not list $DIR after removing: $orphans" >&2
event Warning OrphanIdentityNotRemoved "Could not confirm the removal of identities left over from deleted BucketAccesses: $orphans. See the logs of Job $JOB."
exit 0
fi
left=$(printf '%s\n' "$after" | cosi_names)
for name in $orphans; do
if printf '%s\n' "$left" | grep -qxF "$name"; then
echo "could not remove $name" >&2
event Warning OrphanIdentityNotRemoved "Could not remove identity $name, left over from a deleted BucketAccess. See the logs of Job $JOB."
else
echo "removed $name"
event Normal OrphanIdentityRemoved "Removed identity $name, left over from a deleted BucketAccess."
fi
done
@@ -0,0 +1,205 @@
{{- /* Removes identity files left behind by deleted BucketAccesses;
files/orphan-identities.sh says why and how it decides. Runs on every
install and upgrade, before the Object Lock hook, so in delete mode a
left-over identity is gone before that hook grants it anything. Errors
the script handles do not fail the hook, and the Job stays behind for
its logs. A pod that never runs still fails the hook. */}}
{{- if .Values.seaweedfs.cosi.enabled }}
{{- $name := printf "%s-orphan-identities" .Release.Name | trunc 63 | trimSuffix "-" }}
{{- $clusterName := printf "%s-%s-orphan-identities" .Release.Namespace .Release.Name }}
{{- $env := .Values.global.seaweedfs.extraEnvironmentVars }}
{{- $security := .Values.global.seaweedfs.enableSecurity }}
{{- $fullname := include "seaweedfs.fullname" .Subcharts.seaweedfs }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ $name }}
annotations:
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-weight: "-2"
helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded
data:
orphan-identities.sh: |
{{- .Files.Get "files/orphan-identities.sh" | nindent 4 }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ $name }}
annotations:
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-weight: "-2"
helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ $name }}
annotations:
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-weight: "-2"
helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded
rules:
- apiGroups: [""]
resources: ["events"]
verbs: ["create"]
- apiGroups: ["helm.toolkit.fluxcd.io"]
resources: ["helmreleases"]
resourceNames: [{{ .Release.Name | quote }}]
verbs: ["get"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ $name }}
annotations:
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-weight: "-2"
helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ $name }}
subjects:
- kind: ServiceAccount
name: {{ $name }}
namespace: {{ .Release.Namespace | quote }}
{{- /* A tenant's SeaweedFS also serves its child tenants, whose BucketAccesses
live in their own namespaces. */}}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ $clusterName }}
annotations:
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-weight: "-2"
helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded
rules:
- apiGroups: ["objectstorage.k8s.io"]
resources: ["bucketaccesses"]
verbs: ["list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ $clusterName }}
annotations:
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-weight: "-2"
helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ $clusterName }}
subjects:
- kind: ServiceAccount
name: {{ $name }}
namespace: {{ .Release.Namespace | quote }}
---
apiVersion: batch/v1
kind: Job
metadata:
name: {{ $name }}
annotations:
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-weight: "-1"
helm.sh/hook-delete-policy: before-hook-creation
spec:
backoffLimit: 0
template:
metadata:
labels:
policy.cozystack.io/allow-to-apiserver: "true"
spec:
serviceAccountName: {{ $name }}
restartPolicy: Never
securityContext:
runAsNonRoot: true
runAsUser: 65534
seccompProfile:
type: RuntimeDefault
initContainers:
- name: weed
image: {{ include "seaweedfs.s3.image" .Subcharts.seaweedfs }}
command: ["cp", "/usr/bin/weed", "/opt/weed/weed"]
resources:
requests:
cpu: 10m
memory: 64Mi
limits:
memory: 256Mi
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
volumeMounts:
- name: weed
mountPath: /opt/weed
containers:
- name: cleanup
image: {{ .Values.seaweedfs.volume.resizeHook.image }}
command: ["/bin/sh", "/opt/script/orphan-identities.sh"]
resources:
requests:
cpu: 10m
memory: 64Mi
limits:
memory: 256Mi
env:
- name: PATH
value: /opt/weed:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
- name: MASTER
value: {{ $env.WEED_CLUSTER_SW_MASTER | quote }}
- name: FILER
value: {{ $env.WEED_CLUSTER_SW_FILER | quote }}
- name: RELEASE
value: {{ .Release.Name | quote }}
- name: JOB
value: {{ $name | quote }}
- name: MODE
value: {{ .Values.seaweedfs.cosi.orphanIdentities.mode | quote }}
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
volumeMounts:
- name: weed
mountPath: /opt/weed
- name: script
mountPath: /opt/script
{{- if $security }}
- name: security-config
mountPath: /etc/seaweedfs/security.toml
subPath: security.toml
readOnly: true
- name: ca-cert
mountPath: /usr/local/share/ca-certificates/ca/
readOnly: true
- name: client-cert
mountPath: /usr/local/share/ca-certificates/client/
readOnly: true
{{- end }}
volumes:
- name: weed
emptyDir: {}
- name: script
configMap:
name: {{ $name }}
{{- if $security }}
- name: security-config
configMap:
name: {{ $fullname }}-security-config
- name: ca-cert
secret:
secretName: {{ $fullname }}-ca-cert
- name: client-cert
secret:
secretName: {{ $fullname }}-client-cert
{{- end }}
{{- end }}
@@ -0,0 +1,145 @@
suite: seaweedfs orphan identities hook
templates:
- templates/orphan-identities-hook.yaml
release:
name: seaweedfs-system
namespace: tenant-foo
tests:
- it: renders nothing without COSI
set:
seaweedfs.cosi.enabled: false
asserts:
- hasDocuments:
count: 0
- it: every object is a hook on both install and upgrade
asserts:
- hasDocuments:
count: 7
- equal:
path: metadata.annotations["helm.sh/hook"]
value: post-install,post-upgrade
- it: only reports unless the chart is told to delete
documentSelector:
path: kind
value: Job
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: MODE
value: report
- it: passes delete through when set
documentSelector:
path: kind
value: Job
set:
seaweedfs.cosi.orphanIdentities.mode: delete
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: MODE
value: delete
- it: can list BucketAccesses in every namespace and nothing else cluster-wide
documentSelector:
path: kind
value: ClusterRole
asserts:
- equal:
path: rules
value:
- apiGroups: ["objectstorage.k8s.io"]
resources: ["bucketaccesses"]
verbs: ["list"]
- it: names its cluster-scoped objects after the namespace so tenants do not share them
release:
name: seaweedfs-system
namespace: tenant-bar
documentSelector:
path: kind
value: ClusterRoleBinding
asserts:
- equal:
path: metadata.name
value: tenant-bar-seaweedfs-system-orphan-identities
- equal:
path: roleRef.name
value: tenant-bar-seaweedfs-system-orphan-identities
- contains:
path: subjects
content:
kind: ServiceAccount
name: seaweedfs-system-orphan-identities
namespace: tenant-bar
- it: the Job outlives a run so its logs stay readable
documentSelector:
path: kind
value: Job
asserts:
- equal:
path: metadata.annotations["helm.sh/hook-delete-policy"]
value: before-hook-creation
- equal:
path: metadata.annotations["helm.sh/hook-weight"]
value: "-1"
- it: the Job runs under a restrictive non-root securityContext
documentSelector:
path: kind
value: Job
asserts:
- equal:
path: spec.template.spec.securityContext.runAsNonRoot
value: true
- equal:
path: spec.template.spec.containers[0].securityContext.allowPrivilegeEscalation
value: false
- it: ships the script and points it at the cluster
documentSelector:
path: kind
value: Job
asserts:
- equal:
path: spec.template.spec.containers[0].command
value: ["/bin/sh", "/opt/script/orphan-identities.sh"]
- contains:
path: spec.template.spec.containers[0].env
content:
name: MASTER
value: seaweedfs-master:9333
- contains:
path: spec.template.spec.containers[0].env
content:
name: FILER
value: seaweedfs-filer-client:8888
- it: the script in the ConfigMap is the file under test
documentSelector:
path: kind
value: ConfigMap
asserts:
- matchRegex:
path: data["orphan-identities.sh"]
pattern: 'OrphanIdentityRemoved'
- it: mounts the gRPC client credentials when security is on
documentSelector:
path: kind
value: Job
asserts:
- contains:
path: spec.template.spec.volumes
content:
name: client-cert
secret:
secretName: seaweedfs-client-cert
+6
View File
@@ -321,6 +321,12 @@ seaweedfs:
driverName: "seaweedfs.objectstorage.k8s.io" driverName: "seaweedfs.objectstorage.k8s.io"
bucketClassName: "seaweedfs" bucketClassName: "seaweedfs"
region: "" region: ""
# What the post-install/post-upgrade hook does with identity files no BucketAccess
# carries (files/orphan-identities.sh): "delete" removes them, anything
# else only reports them. extra/seaweedfs sets it from its
# cosi.orphanIdentities value.
orphanIdentities:
mode: report
sidecar: sidecar:
image: "ghcr.io/cozystack/cozystack/objectstorage-sidecar:v1.6.0@sha256:4d665becd3399c2fe1e8a66e15d14d16e4a5a75395fb0ae65cff46679a8989f1" image: "ghcr.io/cozystack/cozystack/objectstorage-sidecar:v1.6.0@sha256:4d665becd3399c2fe1e8a66e15d14d16e4a5a75395fb0ae65cff46679a8989f1"
# A bucket lifecycle rule is stored on PUT and acted on only by the # A bucket lifecycle rule is stored on PUT and acted on only by the