gateway-api icon indicating copy to clipboard operation
gateway-api copied to clipboard

Group is not optional in LocalObjectReference

Open tamalsaha opened this issue 1 year ago • 11 comments

LocalObjectReference group field is not marked optional. So, it can't be left unspecified or set to empty string.

In BackendTLSPolicy, we try to ref to a Secret and CRD fails validation check as group is ""

Previous conv in Slack: https://kubernetes.slack.com/archives/CR0H13KGA/p1725096986532939

Screenshot 2024-08-31 at 2 35 20 AM

tamalsaha avatar Sep 06 '24 19:09 tamalsaha

Thanks for opening this, this is a relatively simple change that just needs +optional added to the Group field.

/good-first-issue

youngnick avatar Sep 11 '24 04:09 youngnick

@youngnick: This request has been marked as suitable for new contributors.

Guidelines

Please ensure that the issue body includes answers to the following questions:

  • Why are we solving this issue?
  • To address this issue, are there any code changes? If there are code changes, what needs to be done in the code and what places can the assignee treat as reference points?
  • Does this issue have zero to low barrier of entry?
  • How can the assignee reach out to you for help?

For more details on the requirements of such an issue, please see here and ensure that they are met.

If this request no longer meets these requirements, the label can be removed by commenting with the /remove-good-first-issue command.

In response to this:

Thanks for opening this, this is a relatively simple change that just needs +optional added to the Group field.

/good-first-issue

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

k8s-ci-robot avatar Sep 11 '24 04:09 k8s-ci-robot

Hi @youngnick Please assign me this issue. I'd like to fix this. Thanks

theBeginner86 avatar Sep 11 '24 06:09 theBeginner86

Though it is a simple change, it relaxes the constraints on an api already marked v1. Not sure that is halal with the maintainers? Should this struct be copied for the BackendTLSPolicy and only relaxed there or relaxed everywhere? @youngnick

tamalsaha avatar Sep 11 '24 16:09 tamalsaha

This is strange. I didn't have any issue with this in my PR for testing BackendTLSPolicy. caCertificateRefs should look something like this.

spec:
  targetRefs:
  - group: ""
    kind: Service
    name: "backendtlspolicy-test"
  validation:
    caCertificateRefs:
    - group: ""
      kind: Secret
      name: "backend-tls-checks-certificate"

candita avatar Sep 11 '24 23:09 candita

I guess there is nothing to fix here. I remember getting error from k8s but I can't reproduce this in k8s 1.31 anymore.

required just means something is set (even if that is empty ""). https://stackoverflow.com/a/45577763/244009

Sorry for the false alert.

tamalsaha avatar Sep 12 '24 00:09 tamalsaha

there's still a bug here, the doc string says when unspecified or empty , this can imply the field is optional, but rn its required

arkodg avatar Sep 12 '24 00:09 arkodg

@arkodg please see here: https://kubernetes.slack.com/archives/CR0H13KGA/p1726101749146929?thread_ts=1725096986.532939&cid=CR0H13KGA

tamalsaha avatar Sep 12 '24 00:09 tamalsaha

I've reopened because I agree that this field should be optional. Kind and Name still need to be required though.

This is a good-first-issue still, because it's a small, contained change.

youngnick avatar Sep 12 '24 00:09 youngnick

Hi @youngnick,

I hope you’re doing well! Could you please assign this task to me? I’d like to take it if it's still up for grabs :)

Thealisyed avatar Oct 02 '24 15:10 Thealisyed

/assign

Thealisyed avatar Oct 03 '24 20:10 Thealisyed

Thanks for opening this, this is a relatively simple change that just needs +optional added to the Group field.

/good-first-issue

Hey @youngnick would you be willing to remove this tag and the help-wanted one, if @tamalsaha is working on it, and it's on hold now? https://github.com/kubernetes-sigs/gateway-api/pull/3332#issuecomment-2345227715

candita avatar Oct 24 '24 23:10 candita

I am not working on it. I don't understand what is acceptable to the maintainers. If anyone wants to take over, please feel free to do so.

tamalsaha avatar Oct 25 '24 02:10 tamalsaha

As per the last comment on #3332 (https://github.com/kubernetes-sigs/gateway-api/pull/3332#issuecomment-2345227715), @robscott suggested that we instead change the doc string to just say "when empty string" instead of "when unspecified or empty string". On reflection, I probably tend to agree.

Let's drop this onto the community meeting agenda for this week and see if there can be some consensus.

youngnick avatar Dec 02 '24 02:12 youngnick

Hi @youngnick , is there still something to do here?

EyalPazz avatar Feb 05 '25 12:02 EyalPazz

The required change is to change "when unspecified or empty string" to "when set to the empty string"

youngnick avatar Feb 06 '25 08:02 youngnick

can i be assigned to this?

EyalPazz avatar Feb 06 '25 20:02 EyalPazz

/assign

EyalPazz avatar Feb 06 '25 20:02 EyalPazz