kustomize-controller icon indicating copy to clipboard operation
kustomize-controller copied to clipboard

"yes" and "no" cannot be used as values in postBuild.substitute variables in kustomization

Open jeevankuduvaravindran opened this issue 4 months ago • 6 comments

Describe the bug

When postBuild.substitute variables containing value of "yes" or "no", the variable is substituted gets the value of "true" and "false" respectively throwing the below error.

expected string, got &value.valueUnstructured{Value:true}

I don't understand why does a string datatype gets parsed to a boolean value?

Steps to reproduce

  • Create a flux kustomization with a postBuild.substitute variable set to "true" or "false"
postBuild:
    substitute:
      isNecessary: "yes"
  • Create any kubernetes yaml (like helmrelease ) with the same variable provided in the yaml (simplified yaml)
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
  name: test-helm-release
  namespace: flux-config
spec:
  chart:
    spec:
      chart: ...
      version: "1.0.0" 
  values:
    isNecessary: ${isNecessary}
  • Describing the kustomization using kubectl shows that the value of the isNecessary variable set to "yes". But the value of the isNecessary variable in helmrelease is set to true.

Expected behavior

isNecessary variable in helmrelease spec.values should be set to "yes" instead of parsing it to true

Screenshots and recordings

No response

OS / Distro

N/A

Flux version

v2.1.0

Flux check

► checking prerequisites ✗ flux 2.1.0 <2.2.3 (new version is available, please upgrade) ✔ Kubernetes 1.27.3 >=1.25.0-0 ► checking controllers ✔ fluxconfig-agent: deployment ready ► mcr.microsoft.com/azurek8sflux/fluxconfig-agent:1.8.2 ► mcr.microsoft.com/azurek8sflux/fluent-bit-mdm:1.8.2 ✔ fluxconfig-controller: deployment ready ► mcr.microsoft.com/azurek8sflux/fluxconfig-controller:1.8.2 ► mcr.microsoft.com/azurek8sflux/fluent-bit-mdm:1.8.2 ✔ helm-controller: deployment ready ► mcr.microsoft.com/oss/fluxcd/helm-controller:v0.36.2 ✔ image-automation-controller: deployment ready ► mcr.microsoft.com/oss/fluxcd/image-automation-controller:v0.36.1 ✔ image-reflector-controller: deployment ready ► mcr.microsoft.com/oss/fluxcd/image-reflector-controller:v0.30.0 ✔ kustomize-controller: deployment ready ► mcr.microsoft.com/oss/fluxcd/kustomize-controller:v1.1.1 ✔ notification-controller: deployment ready ► mcr.microsoft.com/oss/fluxcd/notification-controller:v1.1.0 ✔ source-controller: deployment ready ► mcr.microsoft.com/oss/fluxcd/source-controller:v1.1.2 ► checking crds ✔ alerts.notification.toolkit.fluxcd.io/v1beta2 ✔ buckets.source.toolkit.fluxcd.io/v1beta2 ✔ fluxconfigs.clusterconfig.azure.com/v1alpha1 ✔ gitrepositories.source.toolkit.fluxcd.io/v1 ✔ helmcharts.source.toolkit.fluxcd.io/v1beta2 ✔ helmreleases.helm.toolkit.fluxcd.io/v2beta1 ✔ helmrepositories.source.toolkit.fluxcd.io/v1beta2 ✔ imagepolicies.image.toolkit.fluxcd.io/v1beta2 ✔ imagerepositories.image.toolkit.fluxcd.io/v1beta2 ✔ imageupdateautomations.image.toolkit.fluxcd.io/v1beta1 ✔ kustomizations.kustomize.toolkit.fluxcd.io/v1 ✔ ocirepositories.source.toolkit.fluxcd.io/v1beta2 ✔ providers.notification.toolkit.fluxcd.io/v1beta2 ✔ receivers.notification.toolkit.fluxcd.io/v1 ✔ all checks passed

Git provider

No response

Container Registry provider

No response

Additional context

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

jeevankuduvaravindran avatar Feb 13 '24 18:02 jeevankuduvaravindran