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

Feature Request: Ignore certain fields #80

Open
EsDmitrii opened this issue Nov 13, 2023 · 6 comments
Open

Feature Request: Ignore certain fields #80

EsDmitrii opened this issue Nov 13, 2023 · 6 comments
Labels
lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.

Comments

@EsDmitrii
Copy link

Hi!
I have started using this great tool and have encountered some problems that need to be solved:

  1. I am using ArgoCD with some plugins, for example the Vault plugin. Argocd before deployment, when it templates manifests, it accesses the vault to get the secrets in the path described in the manifest.
    When the manifest is checked by the kubectl-validate tool, it triggers the error like this:
Secret.core "secretnamehere" is invalid: [<nil>: Invalid value: "": "data.pass" must validate at least one schema (anyOf), data.pass: Invalid value: "<path:projects/data/path/to/secret/in/vault/#pass>": data.pass in body must be of type byte: "<path:projects/data/path/to/secret/in/vault/#pass>", <nil>: Invalid value: "": "data.pass" must validate all the schemas (allOf). None validated]

Because manifests are not yet rendered by ArgoCD and they contain paths to the Vault secret like in Helm scheme.
Is there any way to skip checks with magic comment like in kics or any other ways:)
I ask this because now I get a lot invalid errors in CI.

  1. Is there any way to create reports for integrate with CI? For example SAST, xml, etc (I use GitlabCI).
    This is nice to have to track issues
@alexzielenski
Copy link
Contributor

Making sure I understand this issue correctly:

  1. Seems like you have some fields which are post-processed by ArgoCD, you want to skip validation of these fields. Would it render the files locally?
  2. The tool does have an option --output json which may be helpful for this use case

@EsDmitrii
Copy link
Author

EsDmitrii commented Nov 16, 2023 via email

@alexzielenski
Copy link
Contributor

alexzielenski commented Dec 12, 2023

Im hesitant to add support in the tool for this use case without seeing how others are using preprocessors. I'm changing the issue title to better reflect this use case of ignoring certain fields, so otheres can post their usage stories. For now I believe this can be worked around by post processing the errors to remove errors for such fields, (or preprocessing the input with dummy secrets)

@alexzielenski alexzielenski changed the title Issues when use ArgoCD and kubectl-validate Feature Request: Ignore certain fields Dec 12, 2023
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 12, 2024
@alexzielenski
Copy link
Contributor

/remove-lifecycle stale
/lifecycle frozen

@k8s-ci-robot k8s-ci-robot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Apr 1, 2024
@alexzielenski
Copy link
Contributor

It should be possible to augment desired schemas to add opaque fields using --overlay-schemas. Inject a subschema for the field you want to ignore using x-kubernetes-preserve-unknown-fields

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.
Projects
None yet
Development

No branches or pull requests

4 participants