Giter Site home page Giter Site logo

i32 for port number about k8s-openapi HOT 5 CLOSED

sombralibre avatar sombralibre commented on August 28, 2024
i32 for port number

from k8s-openapi.

Comments (5)

Arnavion avatar Arnavion commented on August 28, 2024

Is there something that I missed?

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 i32. :)

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"
    }

"format": "int32"

At this point you might say it's a spec bug and would be resolved by specifying a better format. But even the API server code says:

https://github.com/kubernetes/kubernetes/blob/9b09d0600a69a2eb36b0d136465ccc3c179dacdb/pkg/apis/networking/types.go#L624-L636

Number int32

🤷 Complain to upstream.

from k8s-openapi.

sombralibre avatar sombralibre commented on August 28, 2024

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.

from k8s-openapi.

Arnavion avatar Arnavion commented on August 28, 2024

Well, OpenAPI supports specifying integer ranges using minimum and maximum, but the Kubernetes OpenAPI spec is downstream of their golang code so they'd have to invent new annotations to express that. Besides, ServiceBackendPort::number is far from the only field that has this problem; searching for : Option<i32>, in this repo reveals all sorts of time durations and replica counts and percentages, and upstream would have to fix all of them for completeness.

from k8s-openapi.

Arnavion avatar Arnavion commented on August 28, 2024

Upstream issue: kubernetes/kubernetes#105533

from k8s-openapi.

sombralibre avatar sombralibre commented on August 28, 2024

Upstream issue: kubernetes/kubernetes#105533

👍🏻

from k8s-openapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.