-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: add missing protocols field to plugins #9525
Conversation
d220d70
to
0176833
Compare
@flrgh With your new powers, can you help us review this PR? |
0176833
to
d7ead09
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@GGabriele code changes LGTM, thanks 👍 can you please add a CHANGELOG entry for this? We'll be good to merge once that's done.
d7ead09
to
2cf97aa
Compare
All plugin entities are expected to have a `protocols` schema field, but some plugin schemas are missing it. From a functional point of view, this doesn't have any impact, since the `protocols` field is still injected in the overall schema. But when plugin schemas are retrieved via the Admin API using the `/schemas/plugins/<name>` endpoint, then the "original" schema is returned. For example: ``` $ http :8001/schemas/plugins/prometheus HTTP/1.1 200 OK Access-Control-Allow-Origin: * Connection: keep-alive Content-Length: 354 Content-Type: application/json; charset=utf-8 Date: Tue, 11 Oct 2022 06:42:47 GMT Server: kong/3.0.0 X-Kong-Admin-Latency: 6 { "fields": [ { "config": { "fields": [ { "per_consumer": { "default": false, "type": "boolean" } }, { "status_code_metrics": { "default": false, "type": "boolean" } }, { "latency_metrics": { "default": false, "type": "boolean" } }, { "bandwidth_metrics": { "default": false, "type": "boolean" } }, { "upstream_health_metrics": { "default": false, "type": "boolean" } } ], "required": true, "type": "record" } } ] } ``` This is problematic for decK, which uses this endpoint to inject schema defaults before doing a deployment, which can cause unnecessary/misleading diffs: ``` $ cat kong.yaml _format_version: "3.0" plugins: - name: prometheus $ deck sync updating plugin prometheus (global) { "config": { "bandwidth_metrics": false, "latency_metrics": false, "per_consumer": false, "status_code_metrics": false, "upstream_health_metrics": false }, "enabled": true, "id": "93aece4b-b813-4d9b-af28-f4c1c874f128", "name": "prometheus", - "protocols": [ - "grpc", - "grpcs", - "http", - "https" - ] } Summary: Created: 0 Updated: 1 Deleted: 0 ```
2cf97aa
to
abc8e08
Compare
Thanks for the review! |
Summary
All plugin entities are expected to have a
protocols
schema field, but some plugin schemas are missing it. From a functional point of view, this doesn't have any impact, since theprotocols
field is still injected in the overall schema. But when plugin schemas are retrieved via the Admin API using the/schemas/plugins/<name>
endpoint, then the "original" schema is returned. For example:This is problematic for decK, which uses this endpoint to inject schema defaults before doing a deployment, which can cause unnecessary/misleading diffs:
Full changelog
protocols
field to plugin schemas