Skip to content

feat(k8s): apply store buckets and rules from git - #6724

Merged
dan-petty merged 17 commits into
mainfrom
feat/4756-store-buckets-from-git
Nov 22, 2026
Merged

dan-petty merged 17 commits into
mainfrom
feat/4756-store-buckets-from-git

Conversation

@dan-petty

@dan-petty dan-petty commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

The buckets, quotas, anonymous read and lifecycle rules of the object store are in git, as CRs of the SeaweedFS operator. No reconcile Job runs.

  • buckets.yaml: reports and reports-private (20Gi, anonymous GET) and cache and argo-artifacts (10Gi), each with reclaimPolicy: Retain and one lifecycle policy. All CRs are in object-store beside the Seaweed CR, so no ResourceReferenceGrant is needed.
  • The operator puts back a quota, a lifecycle rule or a grant that it applied. A grant that a person adds stays.
  • The operator watches only object-store, so it gets no chart Role that can write the Secrets of devops or argo-workflows.
  • No ClusterSecret row holds a store key. The writer keys come from the tenant chart of dan-petty/infra.
  • The k8s row checks each bucket CR, one CR for each bucket, the anonymous read, the lifecycle rules, the watch scope and the kinds and namespace of the render. A unit test checks that CLUSTER_SECRETS has no object-store- row.

Closes #4756

Change: openspec/changes/archive/2026-11-22-4756-store-buckets-from-git/

@dan-petty dan-petty added type/feature Type feature: a new function scope/k8s Kubernetes commands, Helm charts, pods, services, and policies labels Nov 22, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Person steps

  1. Push the two writer keys. The Cluster Secrets rule of k8s/README.md and the owner answer of 2026-11-21 put the push before the merge. Run from this branch:
    uv run devops k8s push-secrets --only devops/object-store-devops --only argo-workflows/object-store-argo --plan
    uv run devops k8s push-secrets --only devops/object-store-devops --only argo-workflows/object-store-argo
    uv run devops k8s push-secrets --only devops/object-store-devops --only argo-workflows/object-store-argo --plan   # each key unchanged
    A push after the merge also works: no pod reads the two Secrets, and each S3Credentials stays Pending (SecretNotFound) and retries until the Secret exists.
  2. Merge before plan step 10 of feat(argocd): read the environment from the homelab repo #5134 (the item notes say it is at step 7).
  3. After the sync, run the live checks of the spec:
    kubectl -n object-store get deploy seaweedfs-operator -o jsonpath='{.spec.template.spec.containers[0].args}'   # --watch-namespaces=object-store,devops,argo-workflows
    kubectl get role -A | grep seaweedfs-operator-manager-role        # object-store, devops, argo-workflows
    kubectl -n object-store get buckets.seaweed.seaweedfs.com,bucketlifecyclepolicies.seaweed.seaweedfs.com,s3identities.seaweed.seaweedfs.com,s3policies.seaweed.seaweedfs.com,s3policybindings.seaweed.seaweedfs.com,s3credentials.seaweed.seaweedfs.com
    kubectl get jobs,cronjobs -n object-store                         # no resources
    Then, with the key of devops, put a test object in reports and cache, and send an anonymous GET of each, an anonymous List of reports, and a signed GET of the reports object with the key of argo. Expected: 200, AccessDenied, AccessDenied, AccessDenied. Change a quota with weed shell s3.bucket.quota and see it go back.
  4. Lifecycle expiry on a branch revision: the CRD of operator 1.0.45 has no expiration date, only expiration.days with a minimum of 1. So the check needs a 1-day rule on prefix lifecycle-test/ of cache, an object and an incomplete multipart upload that are older than 1 day at the S3 lifecycle pass of the worker.

Owner review points

  • Operator scope. The live operator runs with --watch-namespaces=object-store. At tag seaweedfs-operator-0.1.48, cmd/main.go sets Cache.DefaultNamespaces from this flag, and the S3Credentials controller lists the grants of the Secret namespace and gets the Secret through that cache. So the operator must watch devops and argo-workflows, and the chart then gives it its manager Role there, which includes write access to Secrets and workloads (helm template of chart 0.1.48 with the new values renders the Role and RoleBinding in the three namespaces). An empty list gives a ClusterRole over every namespace, which is wider.
  • CR namespaces differ from the refined plan. The plan put the Buckets in devops and argo-workflows. Operator 1.0.45 resolves identityRef, policyRef, the binding subjects and bucketRef in the namespace of their own CR, and a cross-namespace secretRef must name an existing Secret. So all store CRs live in object-store, and only the grant and the Secret live in the writer namespace. The design has the table of the scope and namespace of each CR. This is the form that dan-petty/infra#14 describes for the tenant chart.
  • Secret rows. The refined plan had no ClusterSecret row for a store key. This PR adds the two platform rows, as the item notes and the owner answer of 2026-11-21 06:16 ask. The ESO Password generator of the owner answer of 20:37 is for the tenant keys, and no External Secrets Operator CRD is on the cluster (kubectl get crd, 2026-11-22).
  • Backup buckets. backups-gitea, backups-llm, backups-mattermost, backups-devops and backups-monitoring are namespaces of devops-cli stacks, not service repositories. The tenant chart of dan-petty/infra#14 renders a bucket for a namespace with backup.quotaGiB in its services entry. Please confirm that these five namespaces get such an entry, or name the item that makes their buckets. feat(k8s): back up the other app volumes off their node #4767 writes to backups-devops and backups-monitoring.
  • Deferred parts. The read-only identity cloud-backup comes with dan-petty/homelab#343, which gives it its key; the 90-day rule of the version-review HTML comes when feat(roadmap): publish the project review and link it on GitHub #4733 names its prefix. I commented on both issues.
  • Network. No NetworkPolicy changed: object-store-perimeter and object-store-worker are untouched (fix(k8s): an in-namespace egress allow skips the ingress rules #6708), and no new path is needed. The operator reaches the filer gRPC port 18888 and the master gRPC port 19333 through the existing in-namespace egress. No client pod exists yet, so devops and argo-workflows get no backup-client label in this PR.
  • Schema proof. devops k8s validate has no kubeconform schema for the operator kinds (it reports the Seaweed CR on main too; fix(ci): validate the k8s manifests against a schema in CI #5084, commented). The 18 new CRs passed kubectl apply --dry-run=server against the live CRDs, their CEL rules and the admission webhooks on 2026-11-22. Nothing was applied.
  • Overlap. PR fix(k8s): split the network policies whose egress skips their ingress #6721 also changes k8s/README.md, openspec/specs/object-store/spec.md and tests/gate/k8s_checks/object_store.py, in other hunks. The PR that merges second needs a rebase.

@devops-cli-service

Copy link
Copy Markdown
Contributor

Pull request #6724 has merge conflicts with main at commit 01ddb59519ae. GitHub cannot merge it. Rebase the branch onto the current main, resolve the conflicts and push the branch.

@dan-petty
dan-petty force-pushed the feat/4756-store-buckets-from-git branch from 01ddb59 to 69fda27 Compare November 22, 2026 03:27
@dan-petty dan-petty changed the title feat(k8s): apply store buckets, keys and rules from git feat(k8s): apply store buckets and rules from git Nov 22, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Person steps (these replace comment 7073025449)

The steps of the earlier comment do not apply now. This branch adds no ClusterSecret row and no Secret reference, so no devops k8s push-secrets step comes before the merge.

  1. After the merge and the sync of Application object-store, run the live checks of the spec:
    • kubectl get buckets.seaweed.seaweedfs.com -A -o yaml: reports 20Gi, reports-private 20Gi and cache 10Gi in devops, argo-artifacts 10Gi in argo-workflows, each Ready with reclaimPolicy: Retain and a clusterRef to object-store/seaweedfs. No bucket has the condition ClusterRefForbidden with status True.
    • kubectl get bucketlifecyclepolicies.seaweed.seaweedfs.com -A -o yaml: the rules of git, each Ready.
    • kubectl -n object-store get deploy seaweedfs-operator -o jsonpath='{.spec.template.spec.containers[0].args}' holds --watch-namespaces= with object-store, devops and argo-workflows, and kubectl get role -A | grep seaweedfs-operator-manager-role shows the Role in each of the three.
    • Put a test object in reports, reports-private and cache through the filer path /buckets/<bucket>/ of a filer pod. An anonymous GET returns 200 in reports and reports-private and AccessDenied in cache. An anonymous List of reports returns AccessDenied.
    • Change a quota with weed shell s3.bucket.quota; the operator sets the git value again at its next reconcile.
    • kubectl get jobs,cronjobs -n object-store reports no resources.
    • On a branch revision, add a 1-day expiration rule on prefix lifecycle-test/ of cache, put a test object there and start a multipart upload. After the S3 lifecycle pass of the next day, both are gone.
  2. Review the diff in tuicr (tuicr -r origin/main..HEAD).

Owner review points

  • The branch now follows the refined design of feat(k8s): apply store buckets, keys and rules from git #4756. The four Buckets and their lifecycle policies are in devops and argo-workflows, each with a clusterRef to the store, and one ResourceReferenceGrant in object-store admits them. A server-side dry run on the live CRDs (operator 1.0.45) accepted each object. The clusterRef field is supported; only its Go type alias BucketClusterRef is marked deprecated (api/v1/bucket_types.go, tag seaweedfs-operator-0.1.48).
  • The writer identities, policies, credentials and keys are not in this branch. Until the tenant chart of dan-petty/infra#14 adds them, no key can write the buckets; only the anonymous GET of the two report buckets works. The first criteria of the issue body ("A key of namespace llm gets AccessDenied on backups-gitea", "A person ran uv run devops k8s push-secrets before the merge") move with that item, as the refined section says.
  • The operator must watch each bucket namespace, so the chart gives its manager Role in devops and argo-workflows too. That Role includes write access to the Secrets of those namespaces. The per-namespace layout of the refined design has this cost; a bucket in a namespace that the operator does not watch never reconciles.
  • The refined section puts the merge window before plan step 10 of feat(argocd): read the environment from the homelab repo #5134.

@dan-petty

Copy link
Copy Markdown
Owner Author

RBAC proof, head 9d094af78: with the values of this branch, chart seaweedfs-operator 0.1.48 (operator 1.0.45) gives the operator no Role, no RoleBinding and no other RBAC in devops or argo-workflows.

Command, from the root of the branch (0.1.48 is the targetRevision of k8s/argocd/apps/seaweedfs-operator.yaml):

helm template seaweedfs-operator seaweedfs-operator \
  --repo https://seaweedfs.github.io/seaweedfs-operator --version 0.1.48 \
  --namespace object-store -f k8s/object-store/operator-values.yaml > render.yaml
grep -A6 -E '^kind: (Role|RoleBinding|ClusterRole|ClusterRoleBinding)$' render.yaml | grep -E '^kind:|^  name:|^  namespace:'
grep -E '^  namespace:' render.yaml | sort | uniq -c
grep -c -E 'devops|argo-workflows' render.yaml

Result:

Kind Name Namespace Access
Role seaweedfs-operator-manager-role object-store The manager rules, with write access to Secrets, ConfigMaps and Services
RoleBinding seaweedfs-operator-manager-rolebinding object-store The Role above to ServiceAccount object-store/seaweedfs-operator
Role seaweedfs-operator-leader-election-role object-store Leader election
RoleBinding seaweedfs-operator-leader-election-rolebinding object-store The Role above to the same ServiceAccount
ClusterRole seaweedfs-operator-manager-role cluster Only get, list, watch on namespaces and storageclasses
ClusterRoleBinding seaweedfs-operator-manager-rolebinding cluster The ClusterRole above to the same ServiceAccount
ClusterRole seaweed-editor-role, seaweed-viewer-role cluster No binding in the render, no aggregation label
  • object-store is the only namespace in the render: grep -E '^ namespace:' gives 13 lines of object-store (10 namespaced objects and the subjects of the 3 bindings), the other 21 objects are cluster-scoped, and grep -c -E 'devops|argo-workflows' gives 0.
  • The one ClusterRoleBinding reads only Namespace and StorageClass objects, which are cluster-scoped, so it gives no access to an object in devops or argo-workflows.
  • The operator arguments hold --watch-namespaces=object-store.

Contrast: the values of the previous head 69fda278b (watchNamespaces: [object-store, devops, argo-workflows]) render seaweedfs-operator-manager-role and seaweedfs-operator-manager-rolebinding also in devops and in argo-workflows.

Other evidence (read-only):

  • kubectl get roles,rolebindings -A lists the four seaweedfs-operator-* objects in object-store only, and kubectl -n object-store get deploy seaweedfs-operator runs chrislusf/seaweedfs-operator:1.0.45 with --watch-namespaces=object-store.
  • kubectl apply --dry-run=server accepts the 4 Buckets and the 4 BucketLifecyclePolicies of the render in object-store.
  • uv run devops ci --check --only lint,format,docs,constructs,openspec,test-settings,test-tree,startup-imports,swallowed-failures,k8s,domain passes (k8s: 236 cases, 0 failed), and uv run devops ci test tests/k8s/test_cluster_secret_plan.py tests/invariants/test_k8s_manifests.py passes (31 tests). On the previous head, the new k8s rules fail with 6 cases.

Plan the OpenSpec change 4756-store-buckets-from-git: the four platform
buckets with quotas, anonymous read and lifecycle rules, the writer
identities, policies and keys, and the watch scope of the operator.
Rows devops/object-store-devops and argo-workflows/object-store-argo hold
the S3 key pair of the writers devops and argo of the object store. The
push makes each pair under keyring-only keys.
The rules of object_store_buckets.py check the platform buckets and
quotas, the anonymous read, the lifecycle rules, the writer policies,
the writer keys and grants, the watch scope and the kinds of the render.
The Secret rule of object_store.py reads the namespace of a secretRef.
Add the four platform buckets with their quotas, anonymous read and
lifecycle rules, and the identity, policy, binding, credentials and grant
of the writers devops and argo. The operator watches the two writer
namespaces.
Add the section Buckets and keys to the Object Store section of the k8s
README, and update the identities, clients, rollout and folder tree.
Sync the object-store spec with the buckets, the writer keys, the watch
scope and the kinds of the store render.
A unit test holds the table to no row whose name starts with object-store-: the tenant chart makes each writer key with an ESO Password generator.
The Buckets and their lifecycle policies of reports, reports-private and cache move to devops, and argo-artifacts to argo-workflows. Each Bucket names the store in clusterRef, and one ResourceReferenceGrant in object-store admits the Buckets of the two namespaces. The writer identities, credentials and grants go: the tenant chart makes them.
The bucket rule, the watch rule and the kind rule now refuse a bucket or a
policy outside object-store, a watched writer namespace and a
ResourceReferenceGrant. The operator gets its manager Role, which can write
Secrets, in each watched namespace (#4756).
The four buckets and their lifecycle policies live beside the Seaweed CR, with
no ResourceReferenceGrant, and the operator watches only object-store again.
Thus it has no Role in devops or argo-workflows. The comments on the S3
identities file name identity anonymous, which the operator keeps in the filer
for the anonymous read (#4756).
The specs, the archived change and k8s/README.md put the buckets in
object-store and keep the operator on that namespace. The design records the
rejected plan of the writer namespaces and its reason (#4756).
bucket_problems kept one CR for each S3 name, so a second CR of a bucket
with reclaimPolicy Delete passed. The rule now reads each CR and reports
two CRs with the same bucket name.
Operator 1.0.45 puts back a quota, a lifecycle rule or a grant that it
applied. It revokes only the grants of its annotation, so a grant that a
person adds stays, and versioning Off and an unset owner change nothing
(internal/controller/bucket_controller.go). The spec gets the requirement
that one CR makes each bucket.
@dan-petty
dan-petty force-pushed the feat/4756-store-buckets-from-git branch from 9d094af to 621eb12 Compare November 22, 2026 04:12
@dan-petty
dan-petty marked this pull request as ready for review November 22, 2026 04:22
@dan-petty
dan-petty merged commit 0036c70 into main Nov 22, 2026
32 checks passed
@dan-petty
dan-petty deleted the feat/4756-store-buckets-from-git branch November 22, 2026 04:22
dan-petty-release Bot added a commit that referenced this pull request Nov 22, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.193.0](v0.192.2...v0.193.0)
(2026-11-22)


### Features

* **k8s:** apply store buckets and rules from git
([#6724](#6724))
([0036c70](0036c70))


### Bug Fixes

* **ci:** match the real release image job names in job-time
([#6740](#6740))
([d2dd628](d2dd628))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/k8s Kubernetes commands, Helm charts, pods, services, and policies type/feature Type feature: a new function

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(k8s): apply store buckets, keys and rules from git

1 participant