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

Labels specified in the Gatway Infrastructure (i.e., .spec.infrastructure.labels) might be invalid #3197

Closed
snorwin opened this issue Jul 16, 2024 · 7 comments · Fixed by #3284
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Milestone

Comments

@snorwin
Copy link
Contributor

snorwin commented Jul 16, 2024

This enhancement request is related to GEP: In Cluster Gateway Deployments (#1762)

What would you like to be added:
Along with AnnotationValue (which was introduced in #886), a new type alias called LabelValue should be introduced. Label values follow a well-defined format that can be validated using a pattern:

Valid label value:

  • must be 63 characters or less (can be empty),
  • unless empty, must begin and end with an alphanumeric character ([a-z0-9A-Z]),
  • could contain dashes (-), underscores (_), dots (.), and alphanumerics between.

Reference: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/

Why this is needed:
If users can specify invalid label values in the Gateway resource, it may cause issues in the controllers if the values are not validated. The validation in the API schema eliminates the need for each controller to implement its own validation.

@snorwin snorwin added the kind/feature Categorizes issue or PR as related to a new feature. label Jul 16, 2024
@gauravkghildiyal
Copy link
Member

Thanks for the details and including relevant links. I have two thoughts regarding this:

  1. There's a possibility that the choice of not having any strict validation on the AnnotationValue type (which is used both within .spec.infrastructure.labels and .spec.infrastructure.annotations) may have been deliberate to cater to the needs of implementations that have some other form of "infrastructure" i.e. non Kubernetes resources:
    image This would imply that validating what is and is-not valid as a label value rests on the implementation to communicate.

  2. Disregarding the previous point, enforcing such a constraint now may be considered a breaking change (since we are tightening the validation).

We can wait and see what other's might feel regarding this, but my take here is to keep things as they are.

@snorwin
Copy link
Contributor Author

snorwin commented Jul 16, 2024

@gauravkghildiyal thanks for looking into the issue. I fully understand your perspective. I had assumed that the infrastructure section was more tightly integrated with Kubernetes, as it is part of the in-cluster deployment GEP.

@snorwin snorwin closed this as completed Jul 16, 2024
@robscott
Copy link
Member

Thanks @gauravkghildiyal and @snorwin! I think that's a reasonable explanation for why this might have happened, but especially as we're considering taking this API to GA, we likely want to make sure we have the validation as precise as we can.

@keithmattix or @howardjohn would it be problematic to tighten this validation to match k8s labels? We could theoretically loosen this in the future if needed.

@robscott robscott reopened this Jul 16, 2024
@howardjohn
Copy link
Contributor

From Istio POV we are fine with matching labels. I do see the valid point that it could be used for non-k8s, but I am not personally using it for that purpose at this time.

@youngnick
Copy link
Contributor

I agree that this should match the validation for Kubernetes labels, since most if not all implementations will be using those.

@robscott robscott added this to the v1.2.0 milestone Jul 24, 2024
@snorwin
Copy link
Contributor Author

snorwin commented Aug 12, 2024

@youngnick is the discussion still ongoing or should I prepare a PR?

@youngnick
Copy link
Contributor

I think a PR is a good next step, we'll make sure to mention it in the community meeting once it's opened, and leave it for folks to check out for a bit before merging.

This is a breaking change, so it's important we get this in as part of the 1.2 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants