Skip to content

Commit 72e0d3f

Browse files
committed
Show all diffs
1 parent eeb1fec commit 72e0d3f

File tree

2 files changed

+111
-1
lines changed

2 files changed

+111
-1
lines changed

pkg/grep.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,11 @@ func (d *Differ) Add(obj KubernetesObject, now string) string {
136136
oy, _ := yamldiff.Load(old)
137137
ny, _ := yamldiff.Load(now)
138138
d := yamldiff.Do(oy, ny)
139-
return d[0].Dump()
139+
res := []string{}
140+
for _, dd := range d {
141+
res = append(res, dd.Dump())
142+
}
143+
return strings.Join(res, "---\n")
140144
} else {
141145
dmp := diffmatchpatch.New()
142146
diffs := dmp.DiffMain(old, now, false)

pkg/testdata/diff.json.out

+106
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,40 @@ status:
207207
- type: "ResolvedRefs"
208208
- name: "mesh"
209209
- supportedKinds:
210+
---
211+
+ apiVersion: "gateway.networking.k8s.io/v1beta1"
212+
+ kind: "Gateway"
213+
+ metadata:
214+
+ creationTimestamp: "2023-08-11T18:14:11Z"
215+
+ generation: 1
216+
+ name: "namespace"
217+
+ namespace: "default"
218+
+ resourceVersion: "19148"
219+
+ uid: "a9096e52-49a8-4fc3-bf26-39f8682b33eb"
220+
+ spec:
221+
+ gatewayClassName: "istio-waypoint"
222+
+ listeners:
223+
+ -
224+
+ allowedRoutes:
225+
+ namespaces:
226+
+ from: "Same"
227+
+ name: "mesh"
228+
+ port: 15008
229+
+ protocol: "HBONE"
230+
+ status:
231+
+ conditions:
232+
+ -
233+
+ lastTransitionTime: "1970-01-01T00:00:00Z"
234+
+ message: "Waiting for controller"
235+
+ reason: "Pending"
236+
+ status: "Unknown"
237+
+ type: "Accepted"
238+
+ -
239+
+ lastTransitionTime: "1970-01-01T00:00:00Z"
240+
+ message: "Waiting for controller"
241+
+ reason: "Pending"
242+
+ status: "Unknown"
243+
+ type: "Programmed"
210244
---
211245
apiVersion: "gateway.networking.k8s.io/v1beta1"
212246
kind: "Gateway"
@@ -280,6 +314,78 @@ status:
280314
- reason: "Pending"
281315
- status: "Unknown"
282316
- type: "Programmed"
317+
---
318+
+ apiVersion: "gateway.networking.k8s.io/v1beta1"
319+
+ kind: "Gateway"
320+
+ metadata:
321+
+ annotations:
322+
+ gateway.istio.io/controller-version: "5"
323+
+ creationTimestamp: "2023-08-11T18:14:11Z"
324+
+ generation: 1
325+
+ name: "namespace"
326+
+ namespace: "default"
327+
+ resourceVersion: "19168"
328+
+ uid: "a9096e52-49a8-4fc3-bf26-39f8682b33eb"
329+
+ spec:
330+
+ gatewayClassName: "istio-waypoint"
331+
+ listeners:
332+
+ -
333+
+ allowedRoutes:
334+
+ namespaces:
335+
+ from: "Same"
336+
+ name: "mesh"
337+
+ port: 15008
338+
+ protocol: "HBONE"
339+
+ status:
340+
+ conditions:
341+
+ -
342+
+ lastTransitionTime: "2023-08-11T18:14:11Z"
343+
+ message: "Resource accepted"
344+
+ observedGeneration: 1
345+
+ reason: "Accepted"
346+
+ status: "True"
347+
+ type: "Accepted"
348+
+ -
349+
+ lastTransitionTime: "2023-08-11T18:14:11Z"
350+
+ message: "Failed to assign to any requested addresses: no instances found for hostname "namespace-istio-waypoint.default.svc.cluster.local""
351+
+ observedGeneration: 1
352+
+ reason: "Invalid"
353+
+ status: "False"
354+
+ type: "Programmed"
355+
+ listeners:
356+
+ -
357+
+ attachedRoutes: 0
358+
+ conditions:
359+
+ -
360+
+ lastTransitionTime: "2023-08-11T18:14:11Z"
361+
+ message: "No errors found"
362+
+ observedGeneration: 1
363+
+ reason: "Accepted"
364+
+ status: "True"
365+
+ type: "Accepted"
366+
+ -
367+
+ lastTransitionTime: "2023-08-11T18:14:11Z"
368+
+ message: "No errors found"
369+
+ observedGeneration: 1
370+
+ reason: "NoConflicts"
371+
+ status: "False"
372+
+ type: "Conflicted"
373+
+ -
374+
+ lastTransitionTime: "2023-08-11T18:14:11Z"
375+
+ message: "No errors found"
376+
+ observedGeneration: 1
377+
+ reason: "Programmed"
378+
+ status: "True"
379+
+ type: "Programmed"
380+
+ -
381+
+ lastTransitionTime: "2023-08-11T18:14:11Z"
382+
+ message: "No errors found"
383+
+ observedGeneration: 1
384+
+ reason: "ResolvedRefs"
385+
+ status: "True"
386+
+ type: "ResolvedRefs"
387+
+ name: "mesh"
388+
+ supportedKinds:
283389
---
284390
apiVersion: "gateway.networking.k8s.io/v1beta1"
285391
kind: "Gateway"

0 commit comments

Comments
 (0)