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 dedicated types for KongIngress #1778

Closed
1 of 6 tasks
rainest opened this issue Aug 27, 2021 · 1 comment · Fixed by #1971
Closed
1 of 6 tasks

Add dedicated types for KongIngress #1778

rainest opened this issue Aug 27, 2021 · 1 comment · Fixed by #1971

Comments

@rainest
Copy link
Contributor

rainest commented Aug 27, 2021

Is there an existing issue for this?

  • I have searched the existing issues

Problem Statement

Post #1757 follow up for #1749

KongIngress currently includes go-kong Route, Service, and Upstream structs within its struct. Kubebuilder-generated CRDs include all fields in these child structs, including those that you cannot actually change (and often probably shouldn't try to change) with a KongIngress. The KongIngress CRD should only expose fields that you can actually change.

KongIngress further uses internal hidden validation logic. CRD-level validation is better, since it can reject resources at creation time rather than discarding them and/or emitting warnings during controller configuration build.

Though KongIngress includes go-kong Route and Service types, it limits the fields you can actually use through this validation. The Upstream, by comparison, is copied more or less as-is into the struct passed to Kong.

Proposed Solution

  • Implement new dedicated types for the proxy (service), upstream, and route fields within KongIngress.
  • Update the configuration builder to populate go-kong structs from the new type structs.
  • Where possible, move validation from the KongIngress override functions into standard CRD OAS validation.
  • Evaluate which fields the KongIngress Upstream should actually expose (e.g. probably do not expose created/updated timestamps) for the new type. Excluding some is breaking, since we are removing functionality that was previously available, even though fields we remove should have no obvious use.

Additional information

No response

Acceptance Criteria

  • KongIngress child types expose all fields that you can currently set on Routes and Services.
  • The KongIngress Upstream type exposes fields we expect users will need to set on Upstreams (generally, anything that provides functionality and is not pure metadata).
  • The KongIngress CRD applies validation criteria at least equivalent to the internal configuration build validation for routes and services.
  • The KongIngress CRD includes validation criteria from the original CRD, with the exception of redundant type assertions (e.g. a struct field whose type is a Go string does not need an explicit type: string validation rule.
  • re-enable the Kustomization override in 8ae7e29, also described in Manually manage Kong<TYPE> CRDs #1763 (review).
@rainest
Copy link
Contributor Author

rainest commented Aug 31, 2021

When we start work on this again, we need to re-enable the Kustomization override in 8ae7e29, also described in #1763 (review).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants