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

Provide a schema for values for the Helm chart #10838

Open
hamjo opened this issue Jan 10, 2024 · 5 comments · May be fixed by #11295
Open

Provide a schema for values for the Helm chart #10838

hamjo opened this issue Jan 10, 2024 · 5 comments · May be fixed by #11295
Assignees
Labels
kind/documentation Categorizes issue or PR as related to documentation. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. needs-priority triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@hamjo
Copy link

hamjo commented Jan 10, 2024

It would be great to have a schema values file available for the Helm chart.

Artifact Hub seems to be supporting it, making values configuration more searchable.

This would enable auto completion for IDEs supporting it when writing values file.

/kind documentation
/remove-kind feature

@hamjo hamjo added the kind/feature Categorizes issue or PR as related to a new feature. label Jan 10, 2024
@k8s-ci-robot k8s-ci-robot added kind/documentation Categorizes issue or PR as related to documentation. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority and removed kind/feature Categorizes issue or PR as related to a new feature. labels Jan 10, 2024
@strongjz
Copy link
Member

This would be a great first PR @hamjo

@strongjz
Copy link
Member

/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jan 22, 2024
Copy link

This is stale, but we won't close it automatically, just bare in mind the maintainers may be busy with other tasks and will reach your issue ASAP. If you have any question or request to prioritize this, please reach #ingress-nginx-dev on Kubernetes Slack.

@github-actions github-actions bot added the lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. label Feb 22, 2024
@ubergesundheit
Copy link
Contributor

Totally agree with @hamjo! Supplying a helm schema would also help against misconfigurations even before installing.

I could see me work on this ticket. My general plan is to utilize helm-schema to auto-generate the helm values.schema.json file from the charts existing values.yaml. helm-schema allows one to specify additional JSON schema annotations in yaml comments directly in values.yaml. This allows to enhance the inferred schema with additional validations like enums or length/pattern validations. This can be useful especially for things already defined in external kubernetes json schemas like yannh/kubernetes-json-schema.

I already started to work a little on this to see if it is feasible and it seems that a rudimentary schema can be generated almost as is.

helm-schema uses # @schema lines as delimiters for additional JSON schema properties. Below is an abbreviated example of an additional schema annotations in values.yaml. Note the # @schema enclosed additional JSON schema properties and the resulting schema below the values.

Executing helm-schema against these values:

controller:
  image:
    chroot: false
    image: ingress-nginx/controller
    tag: "v1.10.0"
    digest: sha256:42b3f0e5d0846876b1791cd3afeb5f1cbbe4259d6f35651dcc1b5c980925379c
    # @schema
    # enum: [IfNotPresent, Always, Never]
    # @schema
    pullPolicy: IfNotPresent
    # @schema
    # type: integer
    # minimum: 0
    # @schema
    # www-data -> uid 101
    runAsUser: 101

results in this schema:

{
  "properties": {
    "controller": {
      "properties": {
        "image": {
          "properties": {
            "chroot": { "type": "boolean" },
            "digest": { "type": "string" },
            "image": { "type": "string" },
            "pullPolicy": {
              "enum": [ "IfNotPresent", "Always", "Never" ]
            },
            "runAsUser": {
              "type": "integer",
              "minimum": 0
            },
            "tag": { "type": "string" }
          },
          "type": "object"
        }
      },
      "type": "object"
    },
    "global": {
      "type": "object"
    }
  },
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object"
}

Any thoughts @strongjz @Gacko @cpanato

@Gacko
Copy link
Member

Gacko commented Mar 26, 2024

/assign

@ubergesundheit ubergesundheit linked a pull request Apr 22, 2024 that will close this issue
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/documentation Categorizes issue or PR as related to documentation. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. needs-priority triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Development

Successfully merging a pull request may close this issue.

5 participants