yaml-overlay-tool icon indicating copy to clipboard operation
yaml-overlay-tool copied to clipboard

feat: truthy statements and integers should have an override

Open scottd018 opened this issue 3 years ago • 6 comments

When using other systems like Kubernetes, there should be an override when using -S doubleQuoted to override that setting for integers and truthy statements:

error validating "STDIN": error validating data: ValidationError(Certificate.spec.isCA): invalid type for io.cert-manager.v1.Certificate.spec.isCA: got "string", expected "boolean"; if you choose to ignore these errors, turn validation off with --validate=false
Error from server (Invalid): error when creating "STDIN": Namespace "saas-watch" is invalid: metadata.labels: Invalid value: "us‑gov‑west‑1": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue',  or 'my_value',  or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?')
Error from server (NotFound): error when creating "STDIN": namespaces "saas-watch" not found
make: *** [deploy-backend] Error 1

scottd018 avatar Jan 25 '22 15:01 scottd018

@scottd018 Have you tried this out? https://docs.yaml-overlay-tool.io/sections/formatMarkers.html#forcing-types-with-yaml-tags

ahuffman avatar Jan 25 '22 16:01 ahuffman

@ahuffman I didn't but I just tried again with the same result:

Error:

Error from server (BadRequest): error when creating "STDIN": Secret in version "v1" cannot be handled as a Secret: v1.Secret.StringData: ReadString: expects " or n, but found t, error found in #10 byte of ...|ASSWORD":true,"RABBI|..., bigger context ...|_PASSWORD":"rabbitmq","RABBITMQ_SECURE_PASSWORD":true,"RABBITMQ_USERNAME":"rabbitmq"}}

Task:

      - name: "ensure the rabbitmq secure password is output as a string"
        query: stringData.RABBITMQ_SECURE_PASSWORD
        value: !!str "%v"

Output:

ENVIRONMENT=dev make overlay-backend | grep SECURE
  RABBITMQ_SECURE_PASSWORD: yes

Manifest:

stringData:
  RABBITMQ_SECURE_PASSWORD: "yes"

scottd018 avatar Jan 25 '22 16:01 scottd018

Thanks for the further details. Have you tried running without the extra formatting option -S?

ahuffman avatar Jan 25 '22 17:01 ahuffman

Yep. I've tried it with all available options. It's almost like truthy values are ignored when attempting to type convert

scottd018 avatar Jan 25 '22 17:01 scottd018

Interesting, what's the original manifest look like?

ahuffman avatar Jan 25 '22 19:01 ahuffman

@JefeDavis any thoughts on this one?

ahuffman avatar Jan 31 '22 20:01 ahuffman