Skip to content

Commit ae55497

Browse files
committed
Create Ingress2gateway version annotation and attach it to Gateway.
* 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 during print since this is an output-only translation, and we can avoid interfering with existing Gateway translation tests.
1 parent c626d14 commit ae55497

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

RELEASE.md

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ a PR. This must go through the regular PR review process and get merged into the
2323
`main` branch. Approval of the PR indicates community consensus for a new
2424
release.
2525

26+
### Update ingress2gateway version in annotation
27+
1. Once the new release version is determined, update `CurrentVersion` in [pkg/i2gw/ingress2gateway.go](pkg/i2gw/ingress2gateway.go) so the translated Gateways will the correct ingress2gateway tool version that generated them.
28+
2629
### Patch a release
2730

2831
1. Create a new branch in your fork named something like `<githubuser>/release-x.x.x`. Use the new branch

cmd/print.go

+4
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ func (pr *PrintRunner) outputResult(gatewayResources []i2gw.GatewayResources) {
117117
resourceCount += len(r.Gateways)
118118
for _, gateway := range r.Gateways {
119119
gateway := gateway
120+
if gateway.Annotations == nil {
121+
gateway.Annotations = make(map[string]string)
122+
}
123+
gateway.Annotations[i2gw.GeneratorAnnotationKey] = fmt.Sprintf("ingress2gateway-%s", i2gw.CurrentVersion)
120124
err := pr.resourcePrinter.PrintObj(&gateway, os.Stdout)
121125
if err != nil {
122126
fmt.Printf("# Error printing %s Gateway: %v\n", gateway.Name, err)

pkg/i2gw/ingress2gateway.go

+4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ import (
3131
gatewayv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1"
3232
)
3333

34+
const GeneratorAnnotationKey = "gateway.networking.k8s.io/generator"
35+
36+
var CurrentVersion = "0.3.0"
37+
3438
func ToGatewayAPIResources(ctx context.Context, namespace string, inputFile string, providers []string, providerSpecificFlags map[string]map[string]string) ([]GatewayResources, map[string]string, error) {
3539
var clusterClient client.Client
3640

0 commit comments

Comments
 (0)