yannh / kubeconform

A FAST Kubernetes manifests validator, with support for Custom Resources!
Apache License 2.0
2.15k stars 121 forks source link

request/limit invalid values pass kubeconform #181

Closed zapman449 closed 1 year ago

zapman449 commented 1 year ago
kind: Deployment
metadata:
  name: service
spec:
  selector:
    matchLabels:
      app: service
  template:
    metadata:
      labels:
        app: service
    spec:
      containers:
      - name: service
        image: kubernetes/pause
        resources:
          requests:
            cpu: "100Mi"                      # invalid. should be `m`
            memory: "128Mi"
          limits:
            cpu: "500Mi"                      # invalid. should be `m`
            memory: "2560Mi"
        ports:
          - name: http
            containerPort: 8080

This should fail the test because the values for cpu are invalid.

I suspect this might be similar to #132 but wanted to validate.

eyarz commented 1 year ago

yes, this is not part of the schema definition. there are many other validations that are not included (you can find more info here)

yannh commented 1 year ago

Closing as indeed - this can unfortunately not be validated using the JSON schema validation Kubeconform is doing, as suggested by @eyarz .