Skip to content

[FEATURE_REQUEST] Add support for using a non-default clientSchema #141

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

Closed
aiyengar2 opened this issue Mar 26, 2021 · 3 comments
Closed

Comments

@aiyengar2
Copy link
Contributor

aiyengar2 commented Mar 26, 2021

Description of the problem/feature request
A clear and concise description of the problem, or the proposed new feature.

Currently, the scheme used to unmarshall the JSON objects from the manifest is hard-coded to scheme.Scheme here:

clientSchema = scheme.Scheme

This scheme is used to deserialize the k8s manifests, so any valid k8s objects that are not recognized by the default scheme (e.g. CustomResources) are unable to be deserialized.

Instead, would it be possible to modify the function signature for CreateContexts to optionally take in a *runtime.Scheme?

func CreateContexts(filesOrDirs ...string) ([]LintContext, error) {

From a CLI context, this would probably be set to nil or scheme.Scheme, but this would be helpful for other packages consuming this code.

Additional context

Probably a followup for #119.

I've been trying to consume kube-linter to create a Helm chart testing framework and I hope to upstream it at some point. Making a one-line change to the code linked above seems to be the only blocker, but if this issue is resolved I can go back to consuming upstream directly instead of forking.

@viswajithiii
Copy link
Contributor

@aiyengar2 This makes sense to me. Would you be able to send a PR?

aiyengar2 pushed a commit to aiyengar2/kube-linter that referenced this issue Mar 26, 2021
This will allow consumers of this package to provide non-default schemes to deserialize from.

Related Issue: stackrox#141

Signed-off-by: Arvind Iyengar <[email protected]>
@aiyengar2
Copy link
Contributor Author

@viswajithiii done! #144

aiyengar2 pushed a commit to aiyengar2/kube-linter that referenced this issue Mar 26, 2021
This will allow consumers of this package to provide non-default schemes to deserialize from.

Related Issue: stackrox#141

Signed-off-by: Arvind Iyengar <[email protected]>
aiyengar2 pushed a commit to aiyengar2/kube-linter that referenced this issue Mar 26, 2021
This will allow consumers of this package to provide non-default schemes to deserialize from.

Related Issue: stackrox#141

Signed-off-by: Arvind Iyengar <[email protected]>
aiyengar2 pushed a commit to aiyengar2/kube-linter that referenced this issue Mar 27, 2021
Allows users to provide options for creating lint context.

Related Issue: stackrox#141

Signed-off-by: Arvind Iyengar <[email protected]>
aiyengar2 pushed a commit to aiyengar2/kube-linter that referenced this issue Mar 27, 2021
Allows users to provide options for creating lint context.

Related Issue: stackrox#141

Signed-off-by: Arvind Iyengar <[email protected]>
aiyengar2 pushed a commit to aiyengar2/kube-linter that referenced this issue Mar 27, 2021
Allows users to provide options for creating lint context.

Related Issue: stackrox#141

Signed-off-by: Arvind Iyengar <[email protected]>
aiyengar2 pushed a commit to aiyengar2/kube-linter that referenced this issue Mar 27, 2021
Allows users to provide options for creating lint context.

Related Issue: stackrox#141

Signed-off-by: Arvind Iyengar <[email protected]>
aiyengar2 pushed a commit to aiyengar2/kube-linter that referenced this issue Mar 27, 2021
Allows users to provide options for creating lint context.

Related Issue: stackrox#141

Signed-off-by: Arvind Iyengar <[email protected]>
@viswajithiii
Copy link
Contributor

Closing since this is done.

aiyengar2 pushed a commit to aiyengar2/kube-linter that referenced this issue May 13, 2021
Allows users to provide options for creating lint context.

Related Issue: stackrox#141

Signed-off-by: Arvind Iyengar <[email protected]>
aiyengar2 pushed a commit to aiyengar2/kube-linter that referenced this issue May 13, 2021
Allows users to provide options for creating lint context.

Related Issue: stackrox#141

Signed-off-by: Arvind Iyengar <[email protected]>
aiyengar2 pushed a commit to aiyengar2/kube-linter that referenced this issue May 13, 2021
Allows users to provide options for creating lint context.

Related Issue: stackrox#141

Signed-off-by: Arvind Iyengar <[email protected]>
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

No branches or pull requests

2 participants