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

Maintain the order from the Gateway resource #689

Closed
kate-osborn opened this issue May 30, 2023 · 2 comments · Fixed by #1324
Closed

Maintain the order from the Gateway resource #689

kate-osborn opened this issue May 30, 2023 · 2 comments · Fixed by #1324
Assignees
Labels
area/gateway/core Relates to all Core features of Gateway enhancement New feature or request good first issue Good for newcomers refined Requirements are refined and the issue is ready to be implemented.
Milestone

Comments

@kate-osborn
Copy link
Contributor

kate-osborn commented May 30, 2023

When updating the status of the Gateway and setting the status for each listener (https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1beta1.GatewayStatus ), NKG doesn't preserve the order of the listeners as they appear in the spec https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1beta1.GatewaySpec

This is to a bug. However, preserving the order can help the user who reads the status to comprehend and navigate it more easily.

FIXME in the code https://github.com/nginxinc/nginx-gateway-kubernetes/blob/890fddb787ff3560b9b743647a36b649d498ae51/internal/status/gateway.go#L19

Examples:

Gateway:

apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
  name: gateway
  labels:
    domain: k8s-gateway.nginx.org
spec:
  gatewayClassName: nginx
  listeners:
  - name: first
    port: 80
    protocol: HTTP
    hostname: "*.example.com"
  - name: second
    port: 80
    protocol: HTTP
    hostname: "*.example.org"
  - name: third
    port: 80
    protocol: HTTP
    hostname: "*.example.co.uk"
  - name: fourth
    port: 80
    protocol: HTTP
    hostname: "*.nginx.org"
  - name: fifth
    port: 80
    protocol: HTTP
    hostname: "*.f5.com"

Status for listeners:

  Listeners:
    Attached Routes:  0
    Conditions:
      Last Transition Time:  2023-07-07T17:40:34Z
      Message:               Listener is accepted
      Observed Generation:   1
      Reason:                Accepted
      Status:                True
      Type:                  Accepted
      Last Transition Time:  2023-07-07T17:40:34Z
      Message:               Listener is programmed
      Observed Generation:   1
      Reason:                Programmed
      Status:                True
      Type:                  Programmed
      Last Transition Time:  2023-07-07T17:40:34Z
      Message:               All references are resolved
      Observed Generation:   1
      Reason:                ResolvedRefs
      Status:                True
      Type:                  ResolvedRefs
      Last Transition Time:  2023-07-07T17:40:34Z
      Message:               No conflicts
      Observed Generation:   1
      Reason:                NoConflicts
      Status:                False
      Type:                  Conflicted
    Name:                    fifth
    Supported Kinds:
      Group:          gateway.networking.k8s.io
      Kind:           HTTPRoute
    Attached Routes:  0
    Conditions:
      Last Transition Time:  2023-07-07T17:40:34Z
      Message:               Listener is accepted
      Observed Generation:   1
      Reason:                Accepted
      Status:                True
      Type:                  Accepted
      Last Transition Time:  2023-07-07T17:40:34Z
      Message:               Listener is programmed
      Observed Generation:   1
      Reason:                Programmed
      Status:                True
      Type:                  Programmed
      Last Transition Time:  2023-07-07T17:40:34Z
      Message:               All references are resolved
      Observed Generation:   1
      Reason:                ResolvedRefs
      Status:                True
      Type:                  ResolvedRefs
      Last Transition Time:  2023-07-07T17:40:34Z
      Message:               No conflicts
      Observed Generation:   1
      Reason:                NoConflicts
      Status:                False
      Type:                  Conflicted
    Name:                    first
   Supported Kinds:
      Group:          gateway.networking.k8s.io
      Kind:           HTTPRoute
    Attached Routes:  0
    Conditions:
      Last Transition Time:  2023-07-07T17:40:34Z
      Message:               Listener is accepted
      Observed Generation:   1
      Reason:                Accepted
      Status:                True
      Type:                  Accepted
      Last Transition Time:  2023-07-07T17:40:34Z
      Message:               Listener is programmed
      Observed Generation:   1
      Reason:                Programmed
      Status:                True
      Type:                  Programmed
      Last Transition Time:  2023-07-07T17:40:34Z
      Message:               All references are resolved
      Observed Generation:   1
      Reason:                ResolvedRefs
      Status:                True
      Type:                  ResolvedRefs
      Last Transition Time:  2023-07-07T17:40:34Z
      Message:               No conflicts
      Observed Generation:   1
      Reason:                NoConflicts
      Status:                False
      Type:                  Conflicted
    Name:                    fourth
    Supported Kinds:
      Group:          gateway.networking.k8s.io
      Kind:           HTTPRoute
    Attached Routes:  0
    Conditions:
      Last Transition Time:  2023-07-07T17:40:34Z
      Message:               Listener is accepted
      Observed Generation:   1
      Reason:                Accepted
      Status:                True
      Type:                  Accepted
      Last Transition Time:  2023-07-07T17:40:34Z
      Message:               Listener is programmed
      Observed Generation:   1
      Reason:                Programmed
      Status:                True
      Type:                  Programmed
      Last Transition Time:  2023-07-07T17:40:34Z
      Message:               All references are resolved
      Observed Generation:   1
      Reason:                ResolvedRefs
      Status:                True
      Type:                  ResolvedRefs
      Last Transition Time:  2023-07-07T17:40:34Z
      Message:               No conflicts
      Observed Generation:   1
      Reason:                NoConflicts
      Status:                False
      Type:                  Conflicted
    Name:                    second
    Supported Kinds:
      Group:          gateway.networking.k8s.io
      Kind:           HTTPRoute
    Attached Routes:  0
    Conditions:
      Last Transition Time:  2023-07-07T17:40:34Z
      Message:               Listener is accepted
      Observed Generation:   1
      Reason:                Accepted
      Status:                True
      Type:                  Accepted
      Last Transition Time:  2023-07-07T17:40:34Z
      Message:               Listener is programmed
      Observed Generation:   1
      Reason:                Programmed
      Status:                True
      Type:                  Programmed
      Last Transition Time:  2023-07-07T17:40:34Z
      Message:               All references are resolved
      Observed Generation:   1
      Reason:                ResolvedRefs
      Status:                True
      Type:                  ResolvedRefs
      Last Transition Time:  2023-07-07T17:40:34Z
      Message:               No conflicts
      Observed Generation:   1
      Reason:                NoConflicts
      Status:                False
      Type:                  Conflicted
    Name:                    third
    Supported Kinds:
      Group:  gateway.networking.k8s.io
      Kind:   HTTPRoute

Acceptance criteria:

  • Preserve the order
@kate-osborn kate-osborn changed the title PH: Maintain the order from the Gateway resource FIXME: Maintain the order from the Gateway resource May 30, 2023
@mpstefan mpstefan added the tech-debt Short-term pain, long-term benefit label Jun 9, 2023
@pleshakov pleshakov removed the tech-debt Short-term pain, long-term benefit label Jul 7, 2023
@pleshakov pleshakov removed their assignment Jul 7, 2023
@pleshakov pleshakov changed the title FIXME: Maintain the order from the Gateway resource Maintain the order from the Gateway resource Jul 7, 2023
@mpstefan mpstefan added this to the v1.0.0 milestone Jul 12, 2023
@mpstefan mpstefan added enhancement New feature or request area/gateway/core Relates to all Core features of Gateway labels Jul 12, 2023
@mpstefan mpstefan modified the milestones: v1.0.0, v1.0.1 Aug 11, 2023
@sjberman sjberman added the good first issue Good for newcomers label Sep 6, 2023
@mpstefan mpstefan modified the milestones: v1.0.1, v1.2.0 Sep 22, 2023
@kevin85421
Copy link
Contributor

Is there anyone working on this issue? If not, could I take it? Thanks! The related function seems to be buildGatewayStatus.

@mpstefan
Copy link
Collaborator

Hey @kevin85421 !

Absolutely, I'll go ahead and assign the ticket to you. Let us know here if you need any help with the solution!

@mpstefan mpstefan added the refined Requirements are refined and the issue is ready to be implemented. label Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/gateway/core Relates to all Core features of Gateway enhancement New feature or request good first issue Good for newcomers refined Requirements are refined and the issue is ready to be implemented.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants