vmware-archive / kubecfg

A tool for managing complex enterprise Kubernetes environments as code.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

diff should skip empty config values, as api won't return them

jjo opened this issue · comments

Example from creating a pod from scratch (note empty env):

$ cat nginx.pod.yaml 
apiVersion: v1
kind: Pod
metadata:
  labels:
    run: nginx
  name: nginx
spec:
  containers:
  - image: nginx
    env: []
    name: nginx
  restartPolicy: Never

$ kubecfg update -v nginx.pod.yaml
INFO  Updating pods nginx  
INFO  Creating non-existent pods nginx

$ kubecfg diff --diff-strategy subset nginx.pod.yaml
---
- live pods nginx
+ config pods nginx
 {
   "apiVersion": "v1",
   "kind": "Pod",
   "metadata": {
     "labels": {
       "run": "nginx"
     },
     "name": "nginx"
   },
   "spec": {
     "containers": [
       {
         "image": "nginx",
         "imagePullPolicy": "IfNotPresent",
         "name": "nginx",  
         "resources": {
         }
+        "env": [
+        ]
       }
     ],
     "dnsPolicy": "ClusterFirst",
     "restartPolicy": "Never"
   }
 }
ERROR Differences found.  

FYI using kubecfg built from PR #180:

$ ./kubecfg diff --diff-strategy subset nginx.pod.yaml
---
- live pods nginx
+ config pods nginx
pods nginx unchanged