cloud66-oss / copper

A configuration file validator for Kubernetes.
https://help.cloud66.com/copper/
Apache License 2.0
274 stars 15 forks source link

Copper handles yaml files beginning with `---` incorrectly #16

Closed eyalzek closed 5 years ago

eyalzek commented 5 years ago

YAML files can optionally being with 3 dashes, e.g ---. Copper will parse that as a resource. For example, given the manifest:

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: busybox
spec:
  template:
    spec:
      containers:
      - image: busybox
        name: busybox

and rule:

rule DeploymentApiVersion ensure {
    fetch("$[?(@['kind'] == 'Deployment')].apiVersion").first == "apps/v1"
}

copper will fail for the opening dashes:

$ copper check --rules rule.cop --file deployment.yaml 
Validating part 0
    DeploymentApiVersion - FAIL
Validating part 1
    DeploymentApiVersion - PASS
khash commented 5 years ago

Hi @eyalzek

A new version of Copper was released today (the old version is still available under the ruby branch). This version is a rewrite of Copper, replacing the custom DSL with Javascript.

This version is in beta and is the one we will be actively developing going forward.

eyalzek commented 5 years ago

I think the new version handles this much better, so this can be closed.