Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly warn about invalid overriding of predefined variables #705

Open
benedikt-bartscher opened this issue Aug 6, 2023 · 2 comments
Open

Comments

@benedikt-bartscher
Copy link

benedikt-bartscher commented Aug 6, 2023

Operating system

Arch linux

Kluctl Version

2.20.8

Kubernetes Version

v1.26.6

kubectl Version

v1.27.4

Bug description

There are some predefined variables in kluctl like versionwhich take precedence over user defined variables. Kluctl should inform you if you try to overwrite a predefined variable.

Consider this example:

deployment.yaml

deployments:
  - path: deploy

vars:
  - file: vars/default.yaml
    noOverride: true

vars/default.yaml

version: "15"

deploy/pg.yaml

apiVersion: acid.zalan.do/v1
kind: postgresql
[...]
spec:
  postgresql:
    version: "{{ version }}"

version is a predefined variable which you cannot overwrite. This leads into strange errors, for example this CRD Validation error:

failed to patch *****: postgresql.acid.zalan.do "*****" is invalid: spec.postgresql.version: Unsupported value: "{'semver': <function ImagesExtension.build_images_vars.<locals>.semver at 0x7f712d71a290>, 'prefix': <function ImagesExtension.build_images_vars.<locals>.prefix at 0x7f712d71a320>, 'number': <function ImagesExtension.build_images_vars.<locals>.number at 0x7f712d71a560>, 'regex': <function ImagesExtension.build_images_vars.<locals>.regex at 0x7f712d719d80>}": supported values: "10", "11", "12", "13", "14", "15"
@codablock
Copy link
Collaborator

version is a reserved global variable. It's a leftover of an older feature that was deprecated some time ago. It's currently unclear if this variable will be re-introduced, so best thing for you is to use another name for now.

Let's keep this issue open and maybe rename it to "Properly warn about invalid overriding of predefined variables"?

@benedikt-bartscher
Copy link
Author

benedikt-bartscher commented Aug 7, 2023

Seems you are right, i will investigate further and report back. Thanks.

@benedikt-bartscher benedikt-bartscher changed the title CRD Validation fails Properly warn about invalid overriding of predefined variables Aug 7, 2023
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

No branches or pull requests

2 participants