Skip to content

refactor(helm): support crd upgrader#175

Merged
cheyang merged 5 commits intosgl-project:mainfrom
Syspretor:refactor/discouple-crd-and-helm
Mar 6, 2026
Merged

refactor(helm): support crd upgrader#175
cheyang merged 5 commits intosgl-project:mainfrom
Syspretor:refactor/discouple-crd-and-helm

Conversation

@Syspretor
Copy link
Copy Markdown
Collaborator

Ⅰ. Motivation

Ⅱ. Modifications

Ⅲ. Does this pull request fix one issue?

fixes #XXXX

Ⅳ. List the added test cases (unit test/integration test) if any, please explain if no tests are needed.

Ⅴ. Describe how to verify it

VI. Special notes for reviews

Checklist

  • Format your code make fmt.
  • Add unit tests or integration tests.
  • Update the documentation related to the change.

@Syspretor Syspretor requested a review from cheyang March 3, 2026 09:13
@gemini-code-assist
Copy link
Copy Markdown

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 refactors the Helm chart deployment process to provide more robust handling of Custom Resource Definitions (CRDs). It introduces a dedicated CRD Upgrader Job to manage CRD installation and upgrades, especially for large CRD files that might exceed Helm's secret size limits. The changes also include updated Makefile targets for better CRD lifecycle management and comprehensive documentation for the new deployment methods.

Highlights

  • CRD Upgrader Job: Introduced a Helm pre-install/pre-upgrade hook to manage CRD installation and upgrades, addressing Helm's 1MB secret limit for CRDs by running a dedicated job.
  • Makefile Enhancements: Added new make targets for building and pushing the CRD Upgrader image, and for explicitly installing/uninstalling CRDs.
  • Helm Deployment Workflow: Modified the helm-deploy target to leverage the new CRD installation process, either manually or via the upgrader job, by skipping CRD installation in the main chart.
  • CRD Upgrader Configuration: Exposed new Helm values for configuring the CRD Upgrader Job's image pull policy, tolerations, and node selectors.
  • Documentation Update: Revised the installation guide to reflect the new Helm deployment methods for CRDs, including manual and automatic upgrade options.

🧠 New Feature in Public Preview: You can now enable Memory 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.

Changelog
  • Makefile
    • Added docker-buildx-push-crd-upgrader target for building and pushing the CRD Upgrader image.
    • Modified helm-deploy to depend on install-crds and use --skip-crds for the main chart.
    • Introduced install-crds target for manual CRD installation.
    • Added uninstall-crds target for explicit CRD removal.
    • Updated helm-undeploy to include a note about CRD preservation.
  • deploy/helm/rbgs/templates/upgrade/crd-upgrade.yaml
    • Updated Helm hooks to trigger on pre-install in addition to pre-upgrade for the CRD upgrader job.
    • Added the patch verb to the CRD ClusterRole for broader update capabilities.
    • Included tolerations, nodeSelector, and imagePullPolicy options for the CRD Upgrader Job pod.
  • deploy/helm/rbgs/values.yaml
    • Added imagePullPolicy, tolerations, and nodeSelector parameters for the crdUpgrade section.
  • doc/install.md
    • Rewrote Helm installation instructions to differentiate between manual CRD installation and automatic CRD upgrade methods.
    • Included details on new Makefile targets and CRD Upgrader configuration options.
  • tools/crd-upgrade/Dockerfile
    • Updated the base image to alpine:3.20 for the CRD upgrader.
    • Streamlined package installation and added comments.
    • Ensured kubectl installation supports multi-architecture builds.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/e2e-test.yml
Activity
  • No human activity (comments, reviews, progress updates) was provided in the context for this pull request.
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
Copy Markdown

@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 CRD upgrader job for the Helm chart, which is a good strategy for managing large CRDs that can exceed Helm's storage limits. The changes are well-structured, including new Makefile targets, updates to Helm templates and values, and comprehensive documentation updates. My review includes suggestions to improve the robustness of the deployment scripts and enhance consistency within the Makefile.

Comment thread Makefile Outdated
Comment thread Makefile Outdated
Comment thread tools/crd-upgrade/Dockerfile Outdated
Comment thread Makefile Outdated
@Syspretor Syspretor force-pushed the refactor/discouple-crd-and-helm branch from 1ccefdb to 237456e Compare March 5, 2026 13:54
@cheyang
Copy link
Copy Markdown
Collaborator

cheyang commented Mar 5, 2026

/gemini review

Copy link
Copy Markdown

@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 refactors the Custom Resource Definition (CRD) management for Helm installations by introducing a dedicated CRD Upgrader Job. This job, configured as a Helm hook, is now responsible for applying CRDs using kubectl apply --server-side during both install and upgrade operations. The changes include updating the Makefile to build the upgrader image, modifying the Helm chart to deploy the job with configurable parameters such as tolerations, node selectors, and image pull policy, and updating the installation documentation to reflect the new CRD management approach and provide options for manual CRD handling. Review comments highlight security concerns regarding the Helm hook delete policies for the CRD Upgrader Job, its associated ClusterRole, ClusterRoleBinding, and ServiceAccount, suggesting that these resources should be cleaned up on both success and failure to prevent orphaned privileged resources. Additionally, a supply chain risk was identified in the Dockerfile for the CRD upgrader image, as the kubectl binary is downloaded without integrity verification, and a recommendation was made to use an official Alpine package or verify checksums.

Comment thread deploy/helm/rbgs/templates/upgrade/crd-upgrade.yaml Outdated
Comment thread deploy/helm/rbgs/templates/upgrade/crd-upgrade.yaml Outdated
Comment thread deploy/helm/rbgs/templates/upgrade/crd-upgrade.yaml Outdated
Comment thread deploy/helm/rbgs/templates/upgrade/crd-upgrade.yaml Outdated
Comment thread tools/crd-upgrade/Dockerfile Outdated
Copy link
Copy Markdown
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

Adds a Helm-managed CRD upgrade mechanism by introducing a CRD Upgrader image + hook Job, moving CRD ownership away from the chart’s crds/ directory and updating docs/CI accordingly.

Changes:

  • Add a CRD upgrader container image (kubectl + packaged CRDs) and a script to install/upgrade CRDs.
  • Update the Helm chart to run a pre-install/pre-upgrade hook Job with configurable scheduling options (tolerations/nodeSelector).
  • Update installation docs and e2e workflow to rely on the CRD upgrader flow instead of manually applying CRDs.

Reviewed changes

Copilot reviewed 9 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tools/crd-upgrade/ensure-crds-up-to-date.sh New CRD upgrade script executed by the upgrader Job image.
tools/crd-upgrade/Dockerfile Builds the CRD upgrader image (copies CRDs + downloads kubectl).
deploy/helm/rbgs/templates/upgrade/crd-upgrade.yaml Helm hook Job + RBAC updated to run on install and upgrade; adds pod scheduling knobs.
deploy/helm/rbgs/values.yaml Exposes CRD upgrader image/pod config in chart values.
deploy/helm/rbgs/crds/workloads.x-k8s.io_rolebasedgroupscalingadapters.yaml Removes CRD from Helm chart packaging (now handled by upgrader).
deploy/helm/rbgs/crds/workloads.x-k8s.io_instancesets.yaml Removes CRD from Helm chart packaging (now handled by upgrader).
deploy/helm/rbgs/crds/workloads.x-k8s.io_instances.yaml Removes CRD from Helm chart packaging (now handled by upgrader).
deploy/helm/rbgs/crds/workloads.x-k8s.io_clusterengineruntimeprofiles.yaml Removes CRD from Helm chart packaging (now handled by upgrader).
Makefile Stops copying CRDs into the Helm chart and adds CRD upgrader build/push + CRD install/uninstall helpers.
doc/install.md Documents Helm CRD upgrader behavior and configuration; adds manual CRD management alternative.
.github/workflows/e2e-test.yml Removes explicit CRD apply step and builds/loads the CRD upgrader image for Helm-based installs.

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

Comment thread tools/crd-upgrade/Dockerfile Outdated
Comment thread deploy/helm/rbgs/templates/upgrade/crd-upgrade.yaml
Comment thread doc/install.md Outdated
Comment thread tools/crd-upgrade/Dockerfile Outdated
@Syspretor Syspretor requested a review from cheyang March 6, 2026 06:48
Copy link
Copy Markdown
Collaborator

@cheyang cheyang left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@cheyang cheyang merged commit b039fc6 into sgl-project:main Mar 6, 2026
8 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.

3 participants