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

Add a --kube-version option to pass to helm template #24

Merged
merged 3 commits into from
Aug 30, 2023

Conversation

deriamis
Copy link
Contributor

@deriamis deriamis commented Aug 30, 2023

Currently, templates are only generated with the current Kubernetes version, but it is possible to validate against any schema. This means that it's not actually possible to generate what you intend to validate. This commit adds --kube-version option, which gets passed down to helm template. The option default is whatever --kubernetes-version is set to, if set.

This option is deliberately separate from --kubernetes-version because a) they are passed to two different commands and b) there may be reasons why a user might want to validate against a schema that doesn't match what the template was generated for, such as to validate cross-version compatibility.

Currently, templates are only generated with the current Kubernetes
version, but it is possible to validate against any schema. This
means that it's not actually possible to generate what you intend
to validate. This commit adds `--kube-version` option, which gets
passed down to `helm template`.

This option is deliberately separate from `--kubernetes-version`
because a) they are passed to two different commands and b) there
may be reasons why a user might want to validate against a schema
that doesn't match what the template was generated for, such as to
validate cross-version compatibility.
@jtyr
Copy link
Owner

jtyr commented Aug 30, 2023

Thanks for creating this PR, @deriamis. Please could you make the default value of kube-version the same like the value of kubernetes-version? Like this the two will be the same by default but if people want to change it, they still can.

@deriamis deriamis closed this Aug 30, 2023
@deriamis deriamis reopened this Aug 30, 2023
@deriamis
Copy link
Contributor Author

Thanks for creating this PR, @deriamis. Please could you make the default value of kube-version the same like the value of kubernetes-version? Like this the two will be the same by default but if people want to change it, they still can.

Sure, no problem. One moment and I'll push that change - once my keyboard stops being silly.

@deriamis
Copy link
Contributor Author

@jtyr I've made the change as requested. FYI, I have tested the change already in a Docker env as well:

bash-5.1# helm kubeconform --strict --summary -f ./template_settings.yaml --kubernetes-version "1.19.16" --schema-location default --schema-location 'https://raw.githubusercontent.com/kubernetes/kubernetes/master/api/openapi-spec/v3/apis__apiextensions.k8s.io__v1_openapi.json' --output json .
{
  "resources": [],
  "summary": {
    "valid": 150,
    "invalid": 0,
    "errors": 0,
    "skipped": 0
  }
}

@jtyr
Copy link
Owner

jtyr commented Aug 30, 2023

It looks good. Please bump the version and we can merge it.

@deriamis
Copy link
Contributor Author

It looks good. Please bump the version and we can merge it.

@jtyr Done!

@jtyr jtyr merged commit d8b1446 into jtyr:main Aug 30, 2023
2 checks passed
@jtyr
Copy link
Owner

jtyr commented Aug 30, 2023

Thanks for your contribution, @deriamis.

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

Successfully merging this pull request may close these issues.

2 participants