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

V1ServicePort.targetPort type changed from any to object in 0.10.3 #349

Open
zen0wu opened this issue Sep 27, 2019 · 11 comments
Open

V1ServicePort.targetPort type changed from any to object in 0.10.3 #349

zen0wu opened this issue Sep 27, 2019 · 11 comments
Labels
lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.

Comments

@zen0wu
Copy link

zen0wu commented Sep 27, 2019

An issue I noticed while upgrading.

It used to be any, which works fine. Now it's object, where giving a number would cause a type error.

https://github.com/kubernetes-client/javascript/blob/master/src/gen/model/v1ServicePort.ts#L37

@brendandburns
Copy link
Contributor

Thanks for pointing this out. I'm not sure where that came from... I will dig in and see what we need to do to fix it.

Note that you can always pass the number as a string (e.g. "123") the code will do the right thing.

@zen0wu
Copy link
Author

zen0wu commented Oct 3, 2019

Thanks for responding. Passing as string doesn't pass the type check too, string doesn't conform to object. Probably need to use any.

@xogeny
Copy link

xogeny commented Oct 25, 2019

I found a similar issue with ExtensionsV1beta1IngressBackend. In that type definition, servicePort is listed as object but it should really be number | string. You can see where the confusion may be coming from if you look at the swagger.json code found here:

...
    "io.k8s.api.networking.v1beta1.IngressBackend": {
      "description": "IngressBackend describes all endpoints for a given service and port.",
      "properties": {
        "serviceName": {
          "description": "Specifies the name of the referenced service.",
          "type": "string"
        },
        "servicePort": {
          "$ref": "#/definitions/io.k8s.apimachinery.pkg.util.intstr.IntOrString",
          "description": "Specifies the port of the referenced service."
        }
      },
      "required": [
        "serviceName",
        "servicePort"
      ],
      "type": "object"
    },
...

Specifically, note the "$ref": "#/definitions/io.k8s.apimachinery.pkg.util.intstr.IntOrString",. I suspect that what ever automatic process is used to generate the TypeScript definitions, it gets confused by the $ref here and doesn't translate it into the correct type.

@cwardcode
Copy link

This is preventing me from being able to upgrade to 0.11.0 as well. Are there any updates as to when this will be resolved?

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 18, 2020
@brendandburns
Copy link
Contributor

/lifecycle frozen

@k8s-ci-robot k8s-ci-robot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Feb 24, 2020
@FreakyTurtle
Copy link

This issue is essentially making the node client unusable, cannot set an ingress because servicePort is incorrectly typed as object, cannot use a clusterIP because targetPort is incorrectly typed as object. Is there any update on this?🙏

@nicholascapo
Copy link

nicholascapo commented Jul 14, 2020

I am seeing the same problem with V1RollingUpdateDaemonSet.maxUnavailable
Neither string nor number are assignable to object.

'maxUnavailable'?: object;

@ccravens
Copy link

For any others reading this, this is how I hacked my way around this issue:

port.targetPort = (8000 as unknown) as object;

@polaroi8d
Copy link

For any others reading this, this is how I hacked my way around this issue:

port.targetPort = (8000 as unknown) as object;

You are a real herooo 👍

@alex-bezek
Copy link
Contributor

@brendandburns I noticed this issue linked in my teams code. I think it should be resolved now that #666 is merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.
Projects
None yet
Development

No branches or pull requests