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

Missing list-v1 validation #15

Open
bredmond5 opened this issue Jul 31, 2022 · 2 comments
Open

Missing list-v1 validation #15

bredmond5 opened this issue Jul 31, 2022 · 2 comments

Comments

@bredmond5
Copy link

bredmond5 commented Jul 31, 2022

for example manifest:

apiVersion: v1
items:
- apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: nginx-deployment
    labels:
      app: nginx
  spec:
    replicas: 3
    selector:
      matchLabels:
        app: nginx
    template:
      metadata:
        labels:
          app: nginx
      spec:
        containers:
        - name: nginx
          image: nginx:1.14.2
          ports:
          - containerPort: 80
- apiVersion: v1
  kind: Service
  metadata:
    labels:
      app: nginx
    name: nginx
  spec:
    ports:
    - port: 80
      protocol: TCP
      targetPort: 80
    selector:
      app: nginx
kind: List

running the python linekubernetes_validate.validate(rendered_yaml, '1.22', strict=False) results in the error:
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.9/site-packages/kubernetes_validate/kubernetes-json-schema/v1.22.0-local/list-v1.json'

It seems like the list-v1.json file is missing in https://github.com/willthames/kubernetes-validate/tree/main/src/kubernetes_validate/kubernetes-json-schema/v1.22.0-local.

What are the steps to add that? I can assist here if needed. Thanks

@willthames
Copy link
Owner

Hi, the schema come from https://github.com/willthames/kubernetes-json-schema

I'm not 100% sure whether a list-v1.json would be helpful (I don't know if it would validate the individual items) compared to special casing it and validating each item in the list

@bredmond5
Copy link
Author

Ok you're right. I split it out into individual items and validated each of those in turn. That should be good enough for my use case. Thanks

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