Skip to content

fix(seaweedfs): restore S3 TLS and COSI provisioner SA after 4.31 bump - #2916

Merged
Aleksei Sviridkin (lexfrei) merged 2 commits into
mainfrom
fix/seaweedfs-e2e-tls-cosi
Jun 15, 2026
Merged

fix(seaweedfs): restore S3 TLS and COSI provisioner SA after 4.31 bump#2916
Aleksei Sviridkin (lexfrei) merged 2 commits into
mainfrom
fix/seaweedfs-e2e-tls-cosi

Conversation

@kvaps

@kvaps Andrei Kvapil (kvaps) commented Jun 14, 2026

Copy link
Copy Markdown
Member

What this PR does

The SeaweedFS 4.31 chart bump (#2834) broke E2E for every PR on main: in tenant-root the seaweedfs-system release never becomes ready, so install-cozystack times out waiting on its HelmRelease. Two regressions came in with the new chart; both reproduce with a plain helm template of packages/system/seaweedfs (no cluster needed) and are fixed here as vendored patches re-applied by make update, with helm-unittest coverage.

1. S3 served plaintext while everything expected HTTPS. Until chart 4.05 the -cert.file/-key.file args were rendered whenever enableSecurity was set, so weed s3 served TLS on the main port (8333). Chart 4.31 nested those args inside {{- if .Values.s3.httpsPort }}, and we ship httpsPort: 0 — so no TLS args rendered, s3 spoke HTTP, and the HTTPS readiness/liveness probes (plus the ingress backend-protocol: HTTPS and the COSI sidecar's https:// endpoint) all failed with server gave HTTP response to HTTPS client. patches/s3-tls-main-port.patch moves the cert/key args back out of the httpsPort gate, restoring TLS-on-main-port; -port.https is still only added when httpsPort is set.

2. COSI provisioner ServiceAccount name mismatch. cosi-service-account.yaml and the ClusterRoleBinding name the SA <global.seaweedfs.serviceAccountName>-objectstorage-provisioner, but the Deployment referenced componentName (<release>-objectstorage-provisioner). Whenever serviceAccountName != release name — our case, tenant-root-seaweedfs vs seaweedfs-system — the Deployment could not create pods (serviceaccount "seaweedfs-system-objectstorage-provisioner" not found). patches/cosi-provisioner-sa-name.patch aligns the Deployment with the SA and the binding. (Upstream installs only avoid this because their release name and serviceAccountName usually coincide.)

This is main-only: the 4.31 chart landed only on main, every release branch is still on 4.05, so no backport is needed.

Release note

fix(seaweedfs): restore S3 TLS on the main port and fix the COSI provisioner ServiceAccount name after the 4.31 chart bump, so tenant SeaweedFS becomes ready again

Summary by CodeRabbit

  • Bug Fixes

    • Fixed S3 TLS certificate arguments to render correctly when HTTPS port is disabled.
    • Updated COSI provisioner to use configurable service account naming.
  • Tests

    • Added regression tests for S3 TLS configuration and COSI service account handling.

The 4.31 chart bump (#2834) broke E2E for every PR: tenant-root
seaweedfs-system never becomes ready.

1. S3 served plaintext. Until 4.05 the -cert.file/-key.file args were
   rendered whenever enableSecurity was set, so weed s3 served TLS on the
   main port (8333); 4.31 nested them under 'if s3.httpsPort' and we ship
   httpsPort=0, so s3 spoke HTTP while the HTTPS probes, the ingress
   backend-protocol and the COSI sidecar endpoint all expected HTTPS
   ('server gave HTTP response to HTTPS client'). Restore the 4.05
   behaviour via patch.

2. COSI provisioner ServiceAccount mismatch. cosi-service-account.yaml
   and the ClusterRoleBinding name the SA
   <serviceAccountName>-objectstorage-provisioner, but the Deployment
   referenced componentName (<release>-objectstorage-provisioner). When
   serviceAccountName != release name (tenant-root-seaweedfs vs
   seaweedfs-system) the Deployment could not create pods
   ('serviceaccount not found'). Align the Deployment with the SA + binding.

Both fixes are vendored as patches re-applied by 'make update', and
covered by helm-unittest.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Andrei Kvapil <andrei.kvapil@aenix.io>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses two regressions introduced by the SeaweedFS 4.31 chart bump that were causing deployment failures in the system. By applying vendored patches and adding unit tests, the changes restore necessary TLS configurations for S3 and correct a ServiceAccount mismatch in the COSI provisioner, ensuring the SeaweedFS release becomes ready as expected.

Highlights

  • S3 TLS Restoration: Modified the SeaweedFS chart to ensure TLS certificate arguments are rendered for the main S3 port even when httpsPort is set to 0, preventing plaintext communication errors.
  • COSI Provisioner Fix: Aligned the COSI provisioner Deployment's ServiceAccount reference with the actual ServiceAccount and ClusterRoleBinding names to resolve pod creation failures.
  • Testing: Added comprehensive helm-unittest coverage to verify S3 TLS rendering logic and correct ServiceAccount naming in the COSI provisioner.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Ignored Files
  • Ignored by pattern: **/*.patch (2)
    • packages/system/seaweedfs/patches/cosi-provisioner-sa-name.patch
    • packages/system/seaweedfs/patches/s3-tls-main-port.patch
  • Ignored by pattern: **/charts/** (2)
    • packages/system/seaweedfs/charts/seaweedfs/templates/cosi/cosi-deployment.yaml
    • packages/system/seaweedfs/charts/seaweedfs/templates/s3/s3-deployment.yaml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment Gemini (@gemini-code-assist) Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on Gemini (@gemini-code-assist) comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions github-actions Bot added kind/bug Categorizes issue or PR as related to a bug size/L This PR changes 100-499 lines, ignoring generated files labels Jun 14, 2026
@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Two Helm template bug fixes for the SeaweedFS chart: the S3 deployment template now emits TLS cert/key arguments independently of whether httpsPort is set (by closing the httpsPort conditional before the tlsArgs include), and the COSI provisioner deployment derives serviceAccountName from a global value rather than the componentName helper. Each fix is delivered as a patch file and a rendered template update; regression tests and Makefile wiring are also added.

Changes

SeaweedFS Helm chart bug fixes

Layer / File(s) Summary
S3 TLS args decoupled from httpsPort
packages/system/seaweedfs/patches/s3-tls-main-port.patch, packages/system/seaweedfs/charts/seaweedfs/templates/s3/s3-deployment.yaml, packages/system/seaweedfs/tests/s3_tls_cosi_sa_test.yaml
Patch and rendered template close the httpsPort conditional before seaweedfs.s3.tlsArgs, so cert/key args render whenever enableSecurity is active regardless of httpsPort. Tests assert cert args with httpsPort: 0, no cert args when security disabled, and -port.https alongside cert args when httpsPort is non-zero.
COSI provisioner service account name fix
packages/system/seaweedfs/patches/cosi-provisioner-sa-name.patch, packages/system/seaweedfs/charts/seaweedfs/templates/cosi/cosi-deployment.yaml, packages/system/seaweedfs/tests/s3_tls_cosi_sa_test.yaml
Patch and rendered template replace the seaweedfs.componentName helper with {{ .Values.global.seaweedfs.serviceAccountName }}-objectstorage-provisioner for the COSI pod serviceAccountName. Test asserts the rendered name matches the value-based convention.
Makefile and test suite setup
packages/system/seaweedfs/Makefile, packages/system/seaweedfs/tests/s3_tls_cosi_sa_test.yaml
Makefile update target extended to apply the two new patch files. Test file header documents the regression context and configures s3-deployment.yaml and cosi-deployment.yaml as the templates under test.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 Hop hop, the certs now flow,
No port gate to block the show!
The COSI name, from values true,
No helper guessing what to do.
Two patches small, but regressions flee —
The bunny tested, now runs free! 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically summarizes the main change: restoring two broken features (S3 TLS and COSI provisioner ServiceAccount) that regressed after the SeaweedFS 4.31 bump.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/seaweedfs-e2e-tls-cosi

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dosubot dosubot Bot added the kind/regression Categorizes issue or PR as related to a regression from a prior release label Jun 14, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the SeaweedFS package Makefile to apply two new patches: s3-tls-main-port.patch and cosi-provisioner-sa-name.patch. It also introduces a new test suite (s3_tls_cosi_sa_test.yaml) to verify S3 TLS behavior on the main port and ensure the COSI provisioner deployment correctly uses the service-account-name-based ServiceAccount. I have no feedback to provide as the changes are well-implemented and include appropriate tests.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/system/seaweedfs/patches/cosi-provisioner-sa-name.patch`:
- Around line 9-10: The patch removes the seaweedfs.componentName helper
function which provides critical default fallback behavior for
serviceAccountName. When global.seaweedfs.serviceAccountName is unset or empty,
the resulting name becomes invalid, preventing pod scheduling. Restore the use
of the seaweedfs.componentName helper function in the serviceAccountName
assignment on line 10 while still incorporating the value-driven naming from
global.seaweedfs.serviceAccountName, ensuring the chart's defaulting contract is
preserved.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8c055c28-3f66-4aa2-907e-ecec2e882ccf

📥 Commits

Reviewing files that changed from the base of the PR and between 42ca3e6 and 484d73b.

📒 Files selected for processing (6)
  • packages/system/seaweedfs/Makefile
  • packages/system/seaweedfs/charts/seaweedfs/templates/cosi/cosi-deployment.yaml
  • packages/system/seaweedfs/charts/seaweedfs/templates/s3/s3-deployment.yaml
  • packages/system/seaweedfs/patches/cosi-provisioner-sa-name.patch
  • packages/system/seaweedfs/patches/s3-tls-main-port.patch
  • packages/system/seaweedfs/tests/s3_tls_cosi_sa_test.yaml

Comment on lines +9 to +10
- serviceAccountName: {{ include "seaweedfs.componentName" (list . "objectstorage-provisioner") }}
+ serviceAccountName: {{ .Values.global.seaweedfs.serviceAccountName }}-objectstorage-provisioner

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

ServiceAccount naming loses helper fallback default

At Line 10, serviceAccountName is built from a raw value. If global.seaweedfs.serviceAccountName is unset/empty, the rendered SA name can become invalid/unexpected and the Deployment won’t schedule pods. Keep the value-driven naming, but preserve the chart’s defaulting contract via the helper.

Suggested fix
-      serviceAccountName: {{ .Values.global.seaweedfs.serviceAccountName }}-objectstorage-provisioner
+      serviceAccountName: {{ include "seaweedfs.serviceAccountName" . }}-objectstorage-provisioner
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/system/seaweedfs/patches/cosi-provisioner-sa-name.patch` around
lines 9 - 10, The patch removes the seaweedfs.componentName helper function
which provides critical default fallback behavior for serviceAccountName. When
global.seaweedfs.serviceAccountName is unset or empty, the resulting name
becomes invalid, preventing pod scheduling. Restore the use of the
seaweedfs.componentName helper function in the serviceAccountName assignment on
line 10 while still incorporating the value-driven naming from
global.seaweedfs.serviceAccountName, ensuring the chart's defaulting contract is
preserved.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — both regressions are real, the patches are minimal and consistent with the chart's existing naming, and the new helm-unittest coverage fails without the fix.

Business context: The SeaweedFS 4.31 chart bump broke E2E on main for every PR (seaweedfs-system never becomes ready); this restores S3 TLS on the main port and fixes the COSI provisioner ServiceAccount reference so the release reconciles again.

Verified the mechanism end to end:

  • S3 TLS — with enableSecurity: true + httpsPort: 0 the pre-4.31 logic rendered -cert.file/-key.file on the main port; 4.31 gated them behind if .Values.s3.httpsPort, so s3 served plaintext while the readiness/liveness probes hit s3.port with scheme: HTTPS. Moving the tlsArgs include out of the httpsPort gate (still under enableSecurity) restores TLS on the main port; -port.https stays gated on httpsPort.
  • COSI SA — cosi-service-account.yaml and the ClusterRoleBinding subject both name the SA {{ .Values.global.seaweedfs.serviceAccountName }}-objectstorage-provisioner (raw value, no default), while the Deployment referenced seaweedfs.componentName (release-based). With serviceAccountName != release name the Deployment pointed at a non-existent SA. The patch aligns the Deployment with the SA object and the binding.
  • The new tests are non-vacuous: reverting both rendered templates to the base version fails both cases (-key.file missing; serviceAccountName renders seaweedfs-objectstorage-provisioner instead of the value-based name).

On the inline bot suggestion (cosi-provisioner-sa-name.patch): switching the Deployment to include "seaweedfs.serviceAccountName" . is not correct here. That helper defaults to "seaweedfs", but the SA object and the ClusterRoleBinding subject use the raw .Values.global.seaweedfs.serviceAccountName with no default. Routing only the Deployment through the helper would re-introduce a mismatch whenever serviceAccountName is empty (Deployment -> seaweedfs-..., SA object -> -...). The raw-value form is the consistent fix.

Non-blocking follow-ups

  1. Both are upstream chart issues (httpsPort-gated TLS args; Deployment using componentName while the SA and binding use the value). Worth an upstream PR so these vendored patches can eventually drop — the downstream copies are a fine interim.

@lexfrei
Aleksei Sviridkin (lexfrei) merged commit 547500f into main Jun 15, 2026
14 of 17 checks passed
@lexfrei
Aleksei Sviridkin (lexfrei) deleted the fix/seaweedfs-e2e-tls-cosi branch June 15, 2026 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/storage Issues or PRs related to storage (linstor, seaweedfs, bucket, velero, harbor) kind/bug Categorizes issue or PR as related to a bug kind/regression Categorizes issue or PR as related to a regression from a prior release size/L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants