Commit fea179c
authored
Replace custom JSON hook with is_document for DashboardBody (#67)
## Summary
Replaces the custom delta_pre_compare hook and hand-written JSON comparison code with the standard is_document: true generator annotation for Dashboard.DashboardBody.
## Problem
The DashboardBody field accepts a JSON document. Previously this was handled by a custom delta_pre_compare hook with a compareDashboardBody function that performed JSON unmarshal + reflect.DeepEqual. This worked but duplicated functionality that the runtime already provides via the is_document annotation.
## Changes
- Added is_document: true to Dashboard.DashboardBody in generator.yaml
- Removed compare.is_ignored: true (no longer needed since the annotation handles comparison)
- Removed templates/hooks/dashboard/delta_pre_compare.go.tpl
- Removed pkg/resource/dashboard/hooks.go (custom compareDashboardBody and compareJSONObjects functions)
- Regenerated controller code — delta.go now uses the runtime's DocumentEqual function
## Testing
- go build ./cmd/controller — compiles cleanly
- Existing e2e test (dashboard.yaml fixture) already exercises dashboardBody with JSON content
- Behavior is unchanged: both approaches perform semantic JSON comparison
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.1 parent 7088c4b commit fea179c
6 files changed
Lines changed: 9 additions & 51 deletions
File tree
- apis/v1alpha1
- pkg/resource/dashboard
- templates/hooks/dashboard
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
68 | | - | |
| 67 | + | |
69 | 68 | | |
70 | 69 | | |
71 | 70 | | |
72 | 71 | | |
73 | 72 | | |
74 | | - | |
75 | | - | |
76 | 73 | | |
77 | 74 | | |
78 | 75 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
68 | | - | |
| 67 | + | |
69 | 68 | | |
70 | 69 | | |
71 | 70 | | |
72 | 71 | | |
73 | 72 | | |
74 | | - | |
75 | | - | |
76 | 73 | | |
77 | 74 | | |
78 | 75 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
This file was deleted.
This file was deleted.
0 commit comments