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

Create Ingress2gateway version annotation and attach it to all Gateway resources #187

Merged
merged 1 commit into from
Sep 4, 2024

Conversation

sawsa307
Copy link
Contributor

@sawsa307 sawsa307 commented Aug 26, 2024

  • Ingress2gateway annotation will track the current version of the ingress2gateway tool. The version is currently a string that needs to be updated manually before release.
  • This annotation will be attached to the resulting Gateway resources during print since this is an output-only translation, and we can avoid interfering with existing Gateway translation tests.

Example output:

apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
  annotations:
    gateway.networking.k8s.io/generator: ingress2gateway-0.3.0
  creationTimestamp: null
  name: ...
  namespace: default
spec:
  gatewayClassName: ...
  listeners:
  - name: http
    port: 80
    protocol: HTTP
status: {}

What type of PR is this?
/kind feature

What this PR does / why we need it:
Create a dedicated annotation for Gateways translated via ingress2gateway tool to keep track of resources that we're generated with ingress2gatewa

Which issue(s) this PR fixes:

Fixes #179

Does this PR introduce a user-facing change?:

Gateways translated via ingress2gateway will be attached with a new annotation `gateway.networking.k8s.io/generator` to track resources generated with ingress2gateway tool and its version.

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Aug 26, 2024
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 26, 2024
@sawsa307
Copy link
Contributor Author

/assign @LiorLieberman
/assign @robscott

@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Aug 26, 2024
@sawsa307
Copy link
Contributor Author

Would like some suggestion on the preferred format of this kind of annotation. I created the current one based on how ingressnginx specify proxy http version https://github.com/kubernetes/ingress-nginx/blob/main/docs/user-guide/nginx-configuration/annotations.md#proxy-http-version.
Two alternatives I can think of are:

  1. gateway.kubernetes.io/ingress2gateway.version
  2. ingress2gateway.gateway.kubernetes.io/version

Copy link
Member

@robscott robscott left a comment

Choose a reason for hiding this comment

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

Thanks @sawsa307!

pkg/i2gw/ingress2gateway.go Outdated Show resolved Hide resolved
cmd/print.go Outdated Show resolved Hide resolved
@robscott
Copy link
Member

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: robscott, sawsa307

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 26, 2024
Copy link
Member

@levikobi levikobi left a comment

Choose a reason for hiding this comment

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

Hi @sawsa307!
Thank you for your contribution!
I have one small comment in case we are going for this change. Since this feature requires manual version modification upon a new release, please update the RELEASE.md file with the appropriate steps.

@sawsa307 sawsa307 force-pushed the create-i2gw-annotation branch from 6241bd5 to ae55497 Compare September 3, 2024 20:37
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Sep 3, 2024
@sawsa307
Copy link
Contributor Author

sawsa307 commented Sep 3, 2024

Hi @sawsa307! Thank you for your contribution! I have one small comment in case we are going for this change. Since this feature requires manual version modification upon a new release, please update the RELEASE.md file with the appropriate steps.

Thanks for the comment Kobi! I've just added a section in RELEASE.md. Let me know if you have any suggestions on it, thank you!

@LiorLieberman
Copy link
Member

Is there a reason we do it only for gateway?
Whats the rationale behind it?

@sawsa307
Copy link
Contributor Author

sawsa307 commented Sep 4, 2024

Is there a reason we do it only for gateway? Whats the rationale behind it?

We could attach this in other resources like HTTPRoute, but I don't think we can gain any information with it since we can find all translated HTTPRoute based on the Gateways link to them.

@robscott
Copy link
Member

robscott commented Sep 4, 2024

Is there a reason we do it only for gateway? Whats the rationale behind it?

Actually I think this is a good point - might as well add this annotation to all generated resources so it's both more consistent and easier to keep track of where and GW API resource came from.

@sawsa307 sawsa307 force-pushed the create-i2gw-annotation branch from 357037b to 909ec9d Compare September 4, 2024 17:29
@k8s-ci-robot k8s-ci-robot removed the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Sep 4, 2024
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 4, 2024
@sawsa307 sawsa307 force-pushed the create-i2gw-annotation branch from 909ec9d to 75098fe Compare September 4, 2024 17:30
@sawsa307
Copy link
Contributor Author

sawsa307 commented Sep 4, 2024

Is there a reason we do it only for gateway? Whats the rationale behind it?

Actually I think this is a good point - might as well add this annotation to all generated resources so it's both more consistent and easier to keep track of where and GW API resource came from.

Sure, just attaches this annotation on all translated Gateway resources.

@sawsa307 sawsa307 changed the title Create Ingress2gateway version annotation and attach it to Gateway. Create Ingress2gateway version annotation and attach it to all Gateway resources Sep 4, 2024
@LiorLieberman
Copy link
Member

@sawsa307 The release note mention kubernetes.io/ingress2gateway.version and the code "gateway.networking.k8s.io/generator" can you align them please?

resources.

* Ingress2gateway annotation will track the current version of the
  ingress2gateway tool. The version is currently a string that needs to
  be updated manually before release.
* This annotation will be attached to the resulting Gateway resources
  during print since this is an output-only translation, and we can
  avoid interfering with existing Gateway translation tests.
@LiorLieberman
Copy link
Member

LiorLieberman commented Sep 4, 2024

@sawsa307 The release note mention kubernetes.io/ingress2gateway.version and the code "gateway.networking.k8s.io/generator" can you align them please?

I updated the release note myself to unblock.

/lgtm
Thanks David!

@sawsa307
Copy link
Contributor Author

sawsa307 commented Sep 4, 2024

It should be updated now @LiorLieberman.

Gateways translated via ingress2gateway will be attached with a new annotation `gateway.networking.k8s.io/generator` to track resources generated with ingress2gateway tool and its version.

@LiorLieberman
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 4, 2024
@k8s-ci-robot k8s-ci-robot merged commit 7556614 into kubernetes-sigs:main Sep 4, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Find a way to attribute Gateways converted via Ingress2Gateway.
5 participants