Fix replicas value check for nil to work also with Terraform
-
Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA
What does this MR do?
Uses "quote" and "empty" function to check "replicas" value for nil.
Why was this MR needed?
This MR fixes the issue with provisioning using Terraform. When value is set, the expression "eq nil .Values.replicas" throws exception "template: gitlab-runner/templates/deployment.yaml:19:37: executing "gitlab-runner/templates/deployment.yaml" at <eq nil .Values.replicas>: error calling eq: incompatible types for comparison"
and will only work when "replicas" is nil, since "eq" checks for type.
What's the best way to test this MR?
Briefly showing with parameters required for this issue. Other required parameters can be specified for values file.
You have to create terraform project using hashicorp/helm
provider.
Create resource:
`resource "helm_release" "gitlab_runner" {
chart = "gitlab-runner"
name = "my-runner"
namespace = "my-namespace"
repository = "https://charts.gitlab.io/"
version = "0.65"
atomic = true
dependency_update = true
timeout = 300
values = [
templatefile(
"${path.module}/templates/values.yaml.tmpl",
{
replicas = 2
})]
}
Custom values template file:
---
replicas: ${replicas}
What are the relevant issue numbers?
Edited by Sabyrzhan Tynybayev