8000 Helm generator generates invalid Helm runner arguments for empty objects and arrays · Issue #663 · capactio/capact · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Helm generator generates invalid Helm runner arguments for empty objects and arrays #663

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’ 8000 ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pkosiec opened this issue Mar 14, 2022 · 0 comments · Fixed by #664
Closed

Helm generator generates invalid Helm runner arguments for empty objects and arrays #663

pkosiec opened this issue Mar 14, 2022 · 0 comments · Fixed by #664
Assignees
Labels
area/cli Relates to CLI area/hub-manifests Relates to Hub manifests bug Something isn't working
Milestone

Comments

@pkosiec
Copy link
Member
pkosiec commented Mar 14, 2022

Description

The command capact manifest generate implementation helm ..., as well as the interactive capact manifest generate commands, generate invalid input arguments for Helm runner, when there are empty objects and arrays inside values.yaml file.

Expected behavior

For the following values.yaml:

imagePullSecrets: []
podAnnotations: {}
podSecurityContext: {}
nodeSelector: {}

The result should be:

imagePullSecrets: <@ additionalinput.imagePullSecrets | default([]) | tojson @>
nodeSelector: <@ additionalinput.nodeSelector | default({}) @>
podAnnotations: <@ additionalinput.podAnnotations | default({}) @>
podSecurityContext: <@ additionalinput.podSecurityContext | default({}) @>

And for each object, we should include additionalParameters: true in JSON schema to highlight, that there might be custom properties to define.

Actual behavior

imagePullSecrets: <@ additionalinput.imagePullSecrets | default(None) | tojson @>
nodeSelector: {}
podAnnotations: {}
podSecurityContext: {}

where the default(None) | tojson jinja2 renders to null, and JSON schema says by default it is empty array:

"imagePullSecrets": {
    "type": "array",
    "title": "ImagePullSecrets",
    "default": [],
    "$id": "#/properties/imagePullSecrets"
},

Also, an empty object is rendered as:

"nodeSelector": {
    "properties": {},
    "type": "object",
    "title": "NodeSelector",
    "$id": "#/properties/nodeSelector"
},

so, according to JSON schema, you cannot define any properties.

Steps to reproduce

Generate manifests:

capact manifest generate implementation helm cap.implementation.secret-storage-backend.install ./deploy/kubernetes/charts/secret-storage-backend -o /tmp/generated

See the generated Implementation manifest:

cat /tmp/generated/implementation/secret-storage-backend/install.yaml

Observe the following:

imagePullSecrets: <@ additionalinput.imagePullSecrets | default(None) | tojson @>
nodeSelector: {}
podAnnotations: {}
podSecurityContext: {}

Instead of:

imagePullSecrets: <@ additionalinput.imagePullSecrets | default([]) | tojson @>
nodeSelector: <@ additionalinput.nodeSelector | default({}) @>
podAnnotations: <@ additionalinput.podAnnotations | default({}) @>
podSecurityContext: <@ additionalinput.podSecurityContext | default({}) @>
@pkosiec pkosiec added bug Something isn't working area/cli Relates to CLI area/hub-manifests Relates to Hub manifests labels Mar 14, 2022
@pkosiec pkosiec self-assigned this Mar 14, 2022
@pkosiec pkosiec added this to the 0.7.0 milestone Mar 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli Relates to CLI area/hub-manifests Relates to Hub manifests bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant
0