Skip to content

Commit

Permalink
Show all diffs
Browse files Browse the repository at this point in the history
  • Loading branch information
howardjohn committed Aug 11, 2023
1 parent eeb1fec commit 72e0d3f
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/grep.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,11 @@ func (d *Differ) Add(obj KubernetesObject, now string) string {
oy, _ := yamldiff.Load(old)
ny, _ := yamldiff.Load(now)
d := yamldiff.Do(oy, ny)
return d[0].Dump()
res := []string{}
for _, dd := range d {
res = append(res, dd.Dump())
}
return strings.Join(res, "---\n")
} else {
dmp := diffmatchpatch.New()
diffs := dmp.DiffMain(old, now, false)
Expand Down
106 changes: 106 additions & 0 deletions pkg/testdata/diff.json.out
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,40 @@ status:
- type: "ResolvedRefs"
- name: "mesh"
- supportedKinds:
---
+ apiVersion: "gateway.networking.k8s.io/v1beta1"
+ kind: "Gateway"
+ metadata:
+ creationTimestamp: "2023-08-11T18:14:11Z"
+ generation: 1
+ name: "namespace"
+ namespace: "default"
+ resourceVersion: "19148"
+ uid: "a9096e52-49a8-4fc3-bf26-39f8682b33eb"
+ spec:
+ gatewayClassName: "istio-waypoint"
+ listeners:
+ -
+ allowedRoutes:
+ namespaces:
+ from: "Same"
+ name: "mesh"
+ port: 15008
+ protocol: "HBONE"
+ status:
+ conditions:
+ -
+ lastTransitionTime: "1970-01-01T00:00:00Z"
+ message: "Waiting for controller"
+ reason: "Pending"
+ status: "Unknown"
+ type: "Accepted"
+ -
+ lastTransitionTime: "1970-01-01T00:00:00Z"
+ message: "Waiting for controller"
+ reason: "Pending"
+ status: "Unknown"
+ type: "Programmed"
---
apiVersion: "gateway.networking.k8s.io/v1beta1"
kind: "Gateway"
Expand Down Expand Up @@ -280,6 +314,78 @@ status:
- reason: "Pending"
- status: "Unknown"
- type: "Programmed"
---
+ apiVersion: "gateway.networking.k8s.io/v1beta1"
+ kind: "Gateway"
+ metadata:
+ annotations:
+ gateway.istio.io/controller-version: "5"
+ creationTimestamp: "2023-08-11T18:14:11Z"
+ generation: 1
+ name: "namespace"
+ namespace: "default"
+ resourceVersion: "19168"
+ uid: "a9096e52-49a8-4fc3-bf26-39f8682b33eb"
+ spec:
+ gatewayClassName: "istio-waypoint"
+ listeners:
+ -
+ allowedRoutes:
+ namespaces:
+ from: "Same"
+ name: "mesh"
+ port: 15008
+ protocol: "HBONE"
+ status:
+ conditions:
+ -
+ lastTransitionTime: "2023-08-11T18:14:11Z"
+ message: "Resource accepted"
+ observedGeneration: 1
+ reason: "Accepted"
+ status: "True"
+ type: "Accepted"
+ -
+ lastTransitionTime: "2023-08-11T18:14:11Z"
+ message: "Failed to assign to any requested addresses: no instances found for hostname "namespace-istio-waypoint.default.svc.cluster.local""
+ observedGeneration: 1
+ reason: "Invalid"
+ status: "False"
+ type: "Programmed"
+ listeners:
+ -
+ attachedRoutes: 0
+ conditions:
+ -
+ lastTransitionTime: "2023-08-11T18:14:11Z"
+ message: "No errors found"
+ observedGeneration: 1
+ reason: "Accepted"
+ status: "True"
+ type: "Accepted"
+ -
+ lastTransitionTime: "2023-08-11T18:14:11Z"
+ message: "No errors found"
+ observedGeneration: 1
+ reason: "NoConflicts"
+ status: "False"
+ type: "Conflicted"
+ -
+ lastTransitionTime: "2023-08-11T18:14:11Z"
+ message: "No errors found"
+ observedGeneration: 1
+ reason: "Programmed"
+ status: "True"
+ type: "Programmed"
+ -
+ lastTransitionTime: "2023-08-11T18:14:11Z"
+ message: "No errors found"
+ observedGeneration: 1
+ reason: "ResolvedRefs"
+ status: "True"
+ type: "ResolvedRefs"
+ name: "mesh"
+ supportedKinds:
---
apiVersion: "gateway.networking.k8s.io/v1beta1"
kind: "Gateway"
Expand Down

0 comments on commit 72e0d3f

Please sign in to comment.