Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

Diff results are order-dependent #801

@shomron

Description

@shomron

When running ks diff <env>, the results seem to depend on the relationship between the order of the generated components, as well as the order of query results from k8s.

Reproduction

ks init diff-test && cd diff-test
cd diff-test/components

cat <<EOF >00-pod.yaml
apiVersion: v1
kind: Pod
metadata:
  name: oren-test
  labels:
    app: oren-test
spec:
  containers:
  - name: nginx
    image: nginx:1.15.2-alpine
    ports:
    - containerPort: 8888
    imagePullPolicy: Always
EOF

cat <<EOF >01-service.yaml
---
kind: Service
apiVersion: v1
metadata:
  name: nginx
spec:
  selector:
    app: nginx
  ports:
  - protocol: TCP
    port: 80
    targetPort: 8888
EOF

ks apply default

ks diff default

## SHOULD BE NO OUTPUT

# Flip order and diff again
mv {00,99}-pod.yaml

ks diff default

## OUTPUT
@@ -1,3 +1,18 @@
+---
+apiVersion: v1
+kind: Pod
+metadata:
+  labels:
+    app: oren-test
+    ksonnet.io/component: 99-pod
+  name: oren-test
+spec:
+  containers:
+  - image: nginx:1.15.2-alpine
+    imagePullPolicy: Always
+    name: nginx
+    ports:
+    - containerPort: 8888
 ---
 apiVersion: v1
 kind: Service
@@ -12,19 +27,4 @@
     targetPort: 8888
   selector:
     app: nginx
----
-apiVersion: v1
-kind: Pod
-metadata:
-  labels:
-    app: oren-test
-    ksonnet.io/component: 00-pod
-  name: oren-test
-spec:
-  containers:
-  - image: nginx:1.15.2-alpine
-    imagePullPolicy: Always
-    name: nginx
-    ports:
-    - containerPort: 8888

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions