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 konnect.entityID to allow adopting existing entities from Konnect #232

Open
4 tasks
randmonkey opened this issue Jan 17, 2025 · 6 comments
Open
4 tasks

Comments

@randmonkey
Copy link
Contributor

Problem Statement

From Kong/gateway-operator#460 to adopt existing entities in Konnect.
We should define a spec.konnect.entityID to enable users to adopt an existing entity in Konnect with the specified ID. Based on the field, we should also define validation rules (present only controlled by Konnect Entity controller; immutable after progammed; ...).

Proposed Solution

Define a KonnectAttributes type including the EntityID field, and add the field in the spec of all CRDs supported in the Konnect entity controller.
Also we need to add at least the following rules on the field:

  • Can only be present when its controlPlaneRef is pointing to a Konnect Control plane
  • Be immutable when the resource is "Programmed", which means that the resource is already associated with a Konnect entity

Additional Information

Acceptance Criteria

  • konnect.entityID is present in each CRD we support in Konnect entity controller
  • Have the validation rules (CELs) to check the field
    • Can only be present when its controlPlaneRef is pointing to a Konnect Control plane
    • Cannot be added, modified or unset when the resource is "Programmed" (pointing to a Konnect entity)
@pmalek
Copy link
Member

pmalek commented Jan 17, 2025

konnect.entityID might be a bit ambiguous: users might take it as "when creating this resource, set this ID".

How about:

spec:
  konnect:
    adopt:
      by: id # to allow interface extension in the future 
      id: <id_to_adopt>

or


spec:
  konnect:
    adoptId: <id_to_adopt>

WDYT?

@randmonkey
Copy link
Contributor Author

I think the former one

spec:
  konnect:
    adopt:
      by: id # to allow interface extension in the future 
      id: <id_to_adopt>

would make more sense, since @czeslavo has some thoughts of options of not changing the Konnect entity when it is not the same as the spec. This provides room for extensions.

@czeslavo
Copy link
Contributor

How about making the strategy a parameter so it's clear what will be the behavior?

spec:
  konnect:
    adoption: # to use nouns instead of verbs
      strategy: OverrideKonnectConfig # possible alternatives could be 'HaltOnKonnectConfigMismatch' or 'AdoptKonnectConfig'
      id: <id_to_adopt>

@pmalek
Copy link
Member

pmalek commented Jan 17, 2025

Looks good for me 👍

I'm not sure about the usability of AdoptKonnectConfig strategy there (but that's a separate discussion I reckon).

@czeslavo
Copy link
Contributor

Generally, I think we should hold on with merging this API until we reach a consensus in the design doc.

@lahabana
Copy link
Collaborator

Current decision is that this is no longer required for kgo 1.5

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

No branches or pull requests

4 participants