Unable to access HelmRelease resources from environment due to Flux HelmRelease v2beta1 being hardcoded
Summary
The GitLab agent has a cluster admin role and therefore can access all resources in the Kubernetes cluster.
Since Flux 2.2.0 the helm.toolkit.fluxcd.io/v2beta1 apiVersion has been deprecated.
- Flux 2.0.x
- Flux 2.1.x
- Flux releases before February 2024
- Flux 2.2.0 and later
(v2beta1CRDs were fully removed)
However, we hard code the helmRelease apiVersion in the code to v2beta1. This results in the following error when a customer uses flux version 2.2.0+
In the Environment page, select a namespace and then notice the error in the field "Select Flux resource (optional)"
Unable to access the following resources from this environment. Check your authorization on the following and try again:
• HelmRelease
Steps to reproduce
Download the latest flux. Bootstrap flux and set up the agent connection.
Deploy a HelmRelease in your clusters/testing/apps directory. Example
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: test-gitlab-runner
namespace: flux-test
spec:
interval: 10m
chart:
spec:
chart: gitlab-runner
version: '0.76.1' # or your desired version
sourceRef:
kind: HelmRepository
name: gitlab-charts
namespace: flux-system
values:
gitlabUrl: https://<example.gitlab.com>
runnerRegistrationToken: "glrt-xxxxxx"
rbac:
create: true
In the Environment page, select a namespace and then notice the error in the field "Select Flux resource (optional)"
Unable to access the following resources from this environment. Check your authorization on the following and try again:
• HelmRelease
Example Project
What is the current bug behavior?
Cannot access the HelmRelease resource due to the apiVersion used by flux
helm.toolkit.fluxcd.io/v2
What is the expected correct behavior?
All apiVersions for HelmRelease should be supported.
Relevant logs and/or screenshots
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: \\\`sudo gitlab-rake gitlab:env:info\\\`) (For installations from source run and paste the output of: \\\`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production\\\`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of: \`sudo gitlab-rake gitlab:check SANITIZE=true\`) (For installations from source run and paste the output of: \`sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true\`) (we will only investigate if the tests are passing)
Possible fixes
Patch release information for backports
If the bug fix needs to be backported in a patch release to a version under the maintenance policy, please follow the steps on the patch release runbook for GitLab engineers.
Refer to the internal "Release Information" dashboard for information about the next patch release, including the targeted versions, expected release date, and current status.
High-severity bug remediation
To remediate high-severity issues requiring an internal release for single-tenant SaaS instances, refer to the internal release process for engineers.
