Skip to content

Conversation

@chrislusf
Copy link
Collaborator

@chrislusf chrislusf commented Oct 30, 2025

fix #157

webhook-related resources (jobs, service account, roles, webhooks, and service) are only created when webhook.enabled=true.

Summary by CodeRabbit

  • New Features
    • Webhook resources can now be toggled on or off via configuration, enabling flexible deployments and easier environment-specific management without code changes.

…d service) are only created when webhook.enabled=true.

fix #157
@chrislusf chrislusf requested a review from Copilot October 30, 2025 23:34
@coderabbitai
Copy link

coderabbitai bot commented Oct 30, 2025

Caution

Review failed

The pull request is closed.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Adds a Helm conditional around webhook-related Kubernetes resources in the job-update-webhook-certificates template so those resources are rendered only when .Values.webhook.enabled is true.

Changes

Cohort / File(s) Summary
Webhook Conditional Wrapping
deploy/helm/templates/webhook/job-update-webhook-certificates.yaml
Adds {{- if .Values.webhook.enabled }} at the start and a matching {{- end }} at the end to conditionally include all webhook-related resources only when webhooks are enabled.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Helm as Helm renderer
    participant Template as job-update-webhook-certificates.yaml
    participant K8s as Kubernetes API

    Helm->>Template: render template
    alt .Values.webhook.enabled == true
        Template-->>Helm: include webhook resources
        Helm->>K8s: create/update webhook Jobs/ServiceAccount/Secrets
        note right of K8s #DFF2BF: webhook resources created
    else .Values.webhook.enabled == false
        Template-->>Helm: skip webhook resources
        note right of Helm #FEE4CB: no webhook resources rendered
    end
Loading

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Verify the conditional encloses the entire template and that there are no stray resources outside the block.
  • Confirm Helm templating syntax is balanced and linting passes.

Possibly related PRs

Poem

🐰
I tucked the webhooks into a gentle nest,
A tiny flag decides if they may rest.
When disabled, no jobs clatter or leap,
Helm sleeps soundly, and the cluster keeps.
— your rabbit reviewer 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "Conditionally create webhook-related resources" accurately and concisely describes the main change in the pull request. According to the summary, the modification wraps webhook-related Kubernetes resources in a Helm conditional that gates them based on .Values.webhook.enabled. The title is specific, clear, and directly related to the core change, allowing reviewers to quickly understand the primary modification without being vague or misleading.
Linked Issues Check ✅ Passed The pull request directly addresses the core requirement from issue #157 [#157]. The issue reports that webhook resources (particularly jobs referencing a service account) are being created even when webhook.enabled=false, causing installation failures. The PR's changes wrap all webhook-related resources in a Helm conditional that ensures they are only created when .Values.webhook.enabled is true. This directly resolves the root cause identified in the issue by preventing the creation of webhook-dependent resources that would reference the missing service account when webhooks are disabled.
Out of Scope Changes Check ✅ Passed The changes in this pull request are appropriately scoped to the stated objectives. The modification wraps webhook-related Kubernetes resources (jobs, service accounts, roles, webhooks, and services) in a Helm conditional based on webhook.enabled, which directly addresses the requirement to conditionally create these resources. No unrelated functional changes are introduced, and the scope remains focused on enabling/disabling webhook resources as a cohesive unit, which aligns precisely with the issue requirements [#157].

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 078488c and faf1726.

📒 Files selected for processing (1)
  • deploy/helm/templates/webhook/job-update-webhook-certificates.yaml (2 hunks)

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

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @chrislusf, 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 resolves issue #157 by introducing conditional deployment for webhook-related Kubernetes resources. It specifically modifies the Helm chart to ensure that the job responsible for updating webhook certificates is only created when webhooks are explicitly enabled via the webhook.enabled value, thereby preventing the deployment of unnecessary resources when webhooks are not in use.

Highlights

  • Conditional Resource Creation: The Helm template for job-update-webhook-certificates.yaml has been updated to conditionally create the webhook certificate update job. This job will now only be deployed if the .Values.webhook.enabled flag is set to true in the Helm chart.
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-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 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 counter productive. You can react with 👍 and 👎 on @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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds conditional rendering to the webhook certificate update job based on the webhook.enabled configuration value. This prevents unnecessary Kubernetes resources from being created when the webhook functionality is disabled.

  • Wraps the entire webhook certificate update job YAML template with {{- if .Values.webhook.enabled }} conditional blocks

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

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

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 introduces a condition to create webhook-related resources only when .Values.webhook.enabled is true. The change is implemented by wrapping the contents of deploy/helm/templates/webhook/job-update-webhook-certificates.yaml in an if block, which correctly makes the creation of jobs, service accounts, and roles conditional. My review includes suggestions to improve whitespace handling in the Helm template, which is a best practice for producing clean and predictable YAML output. The PR description also mentions a webhook Service. As I cannot see its definition in the changed files, please ensure it is also conditionally created to fully resolve the issue.

@@ -1,3 +1,4 @@
{{- if .Values.webhook.enabled }}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

To prevent rendering an extra newline at the beginning of the file and to ensure the output is completely empty when webhook.enabled is false, it's a good practice to use whitespace control. Adding a hyphen to the closing brace will chomp the trailing newline after this directive.

{{- if .Values.webhook.enabled -}}

- kind: ServiceAccount
name: {{ include "seaweedfs-operator.fullname" . }}-update-webhook-certificates
namespace: {{ .Release.Namespace }}
{{- end }}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Similarly to the opening if block, adding a hyphen here will ensure no unnecessary whitespace is rendered. This makes the template's output cleaner and more predictable. Using {{- end -}} will consume the newline before it, and combined with the change at the start of the file, will result in a completely empty file when the condition is not met.

{{- end -}}

@chrislusf chrislusf merged commit 9c93b21 into master Oct 30, 2025
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Installation with helm failed due to serviceaccount "seaweedfs-operator-update-webhook-certificates" not found

2 participants