-
Notifications
You must be signed in to change notification settings - Fork 41
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
i32 for port number #136
Comments
Yes, you missed that this code is auto-generated from the OpenAPI spec. It's not like I made the conscious decision to represent port numbers as So, to that end, the OpenAPI spec says: "io.k8s.api.networking.v1.ServiceBackendPort": {
"description": "ServiceBackendPort is the service port being referenced.",
"properties": {
"name": {
"description": "name is the name of the port on the Service. This is a mutually exclusive setting with \"Number\".",
"type": "string"
},
"number": {
"description": "number is the numerical port number (e.g. 80) on the Service. This is a mutually exclusive setting with \"Name\".",
"format": "int32",
"type": "integer"
}
},
"type": "object"
}
At this point you might say it's a spec bug and would be resolved by specifying a better
🤷 Complain to upstream. |
Yes, you're right, just after create this issue I went to the OpenApi specs and found the same. I will scale the question to the openapi people. Thanks a lot man. |
Well, OpenAPI supports specifying integer ranges using |
Upstream issue: kubernetes/kubernetes#105533 |
👍🏻 |
Hi there, just a question about why does the struct that represent the
ServiceBackendPort
uses ani32
instead of anu16
for hold the port number; I've checked the definition for several versions of kubernetes and the definition is the same:k8s-openapi/src/v1_26/api/networking/v1/service_backend_port.rs
Line 10 in 0fdb6c6
Is there something that I missed?
I means whether the definition of the data wide for port number in the TCP/IP is 16 bits, It doesn't make sense that the port would be represented for an u16?
What would happens if someone don't pay attention to this, and ended passing a value over 65535 or a negative one? It will not be safe enough I assume.
The text was updated successfully, but these errors were encountered: