Skip to content
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

Add missing Service/Route annotations #3121

Merged
merged 6 commits into from
Nov 3, 2022
Merged

Add missing Service/Route annotations #3121

merged 6 commits into from
Nov 3, 2022

Conversation

rainest
Copy link
Contributor

@rainest rainest commented Nov 1, 2022

What this PR does / why we need it:

Adds annotations for connect/write/read timeouts and retries to Services. These were available in KongIngress but not via annotations.

Adds annotations for headers and path handling to Routes. Ditto KongIngress/annotation split.

Which issue this PR fixes:
Fix #3017

Special notes

headers is more complicated than most fields. It is a string->string array map and cannot really be handled by a single key/value pair without compromises.

The design presented here, where part of the value we give to Kong is embedded in the annotation name, seems reasonable to me, but it is novel, so I'm calling it out. It's also handled a bit differently in the code. The annotations package functions usually return the value with minimal parsing, if any, and the kongstate functions are responsible for most complex logic. This doesn't work with the name-embedded value, so the headers function does a lot more work in the annotations function.

PR Readiness Checklist:

Complete these before marking the PR as ready to review:

  • the CHANGELOG.md release notes have been updated to reflect any significant (and particularly user-facing) changes introduced by this PR

@rainest rainest temporarily deployed to Configure ci November 1, 2022 23:17 Inactive
Add annotations for connect, write, and read timeouts to Services.
@rainest rainest temporarily deployed to Configure ci November 1, 2022 23:19 Inactive
@rainest rainest marked this pull request as ready for review November 1, 2022 23:19
@rainest rainest requested a review from a team as a code owner November 1, 2022 23:19
@rainest rainest temporarily deployed to Configure ci November 1, 2022 23:42 Inactive
@rainest rainest temporarily deployed to Configure ci November 1, 2022 23:42 Inactive
@rainest rainest temporarily deployed to Configure ci November 2, 2022 00:17 Inactive
Add annotation support for headers. The annotation is in the form
"konghq.com/headers/example: value1,value2", where the portion of the
annoation name after "konghq.com/headers" ("example") is the
header name and the value is a CSV of header values.
@rainest rainest temporarily deployed to Configure ci November 2, 2022 00:19 Inactive
@rainest rainest temporarily deployed to Configure ci November 2, 2022 00:29 Inactive
@rainest rainest temporarily deployed to Configure ci November 2, 2022 00:52 Inactive
@rainest rainest temporarily deployed to Configure ci November 2, 2022 00:52 Inactive
internal/annotations/annotations.go Outdated Show resolved Hide resolved
internal/dataplane/kongstate/route.go Show resolved Hide resolved
internal/annotations/annotations_test.go Show resolved Hide resolved
internal/annotations/annotations_test.go Show resolved Hide resolved
internal/dataplane/kongstate/route_test.go Show resolved Hide resolved
Copy link
Member

@pmalek pmalek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly nits, overall 👍

internal/annotations/annotations.go Outdated Show resolved Hide resolved
internal/annotations/annotations_test.go Outdated Show resolved Hide resolved
internal/annotations/annotations_test.go Outdated Show resolved Hide resolved
internal/annotations/annotations_test.go Outdated Show resolved Hide resolved
internal/dataplane/kongstate/route_test.go Outdated Show resolved Hide resolved
Co-authored-by: Patryk Małek <patryk.malek@konghq.com>
@rainest rainest temporarily deployed to Configure ci November 2, 2022 16:10 Inactive
@rainest rainest temporarily deployed to Configure ci November 2, 2022 16:34 Inactive
@rainest rainest temporarily deployed to Configure ci November 2, 2022 18:33 Inactive
@rainest rainest changed the title Add missing Service annotations Add missing Service/Route annotations Nov 2, 2022
@rainest rainest enabled auto-merge (squash) November 2, 2022 18:53
@rainest rainest temporarily deployed to Configure ci November 2, 2022 19:00 Inactive
@rainest rainest temporarily deployed to Configure ci November 2, 2022 19:00 Inactive
@pmalek pmalek added this to the KIC v2.8.0 milestone Nov 3, 2022
@rainest rainest merged commit 551528e into main Nov 3, 2022
@rainest rainest deleted the feat/timeout-anns branch November 3, 2022 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Each non-Upstream KongIngress field has an equivalent annotation
3 participants