kubernetes-client / c

Official C client library for Kubernetes
Apache License 2.0
144 stars 46 forks source link

The type of target_port of v1_service_port_t is invalid. #63

Closed clearday4 closed 2 years ago

clearday4 commented 3 years ago

The type of target_port in the v1_service_port_t structure is abnormal.

typedef struct v1_service_port_t {
    char *name; // string
    int node_port; //numeric
    int port; //numeric
    char *protocol; // string
    object_t *target_port; //object  <--- it is not an object type

} v1_service_port_t;

I think target_port should be an integer type like port and node_port. In the v1_service_port.c, target port is parsed from object_parseFromJSON() so it returns null. object_parseFromJSON() is always return NULL. when I changed target_port to integer type and got it with cJSON_GetObjectItemCaseSensitive() as sams as port, it works properly.

please consider about it. Thanks

brendandburns commented 3 years ago

targetPort is an IntOrString type in the swagger (https://raw.githubusercontent.com/kubernetes/kubernetes/master/api/openapi-spec/swagger.json)

We may very well not handle these correctly right now.

brendandburns commented 3 years ago

See: https://github.com/kubernetes-client/java/blob/master/kubernetes/src/main/java/io/kubernetes/client/custom/IntOrString.java For example.

There are a number of custom types we will need to add: https://github.com/kubernetes-client/java/tree/master/kubernetes/src/main/java/io/kubernetes/client/custom

clearday4 commented 3 years ago

See: https://github.com/kubernetes-client/java/blob/master/kubernetes/src/main/java/io/kubernetes/client/custom/IntOrString.java For example.

There are a number of custom types we will need to add: https://github.com/kubernetes-client/java/tree/master/kubernetes/src/main/java/io/kubernetes/client/custom

Thank you @brendandburns would you add the new custom type "IntOrString" ? It should be union.

brendandburns commented 3 years ago

Yes, I think that would be fine. We'll need to add custom serialize/deserialize code to handle that.

k8s-triage-robot commented 2 years ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

ityuhui commented 2 years ago

/remove-lifecycle stale

ityuhui commented 2 years ago

I'm working on this ticket now. First of all, I will add the support for IntOrString

ityuhui commented 2 years ago

I will deliver 3 pull requests to address the support for IntOrString

ityuhui commented 2 years ago

The type IntOrString is supported now.

Alough there are some custom types need support, no issue is reported so far. Can we close this ticket now ? @brendandburns

k8s-triage-robot commented 2 years ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot commented 2 years ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot commented 2 years ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

k8s-ci-robot commented 2 years ago

@k8s-triage-robot: Closing this issue.

In response to [this](https://github.com/kubernetes-client/c/issues/63#issuecomment-1160185078): >The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. > >This bot triages issues and PRs according to the following rules: >- After 90d of inactivity, `lifecycle/stale` is applied >- After 30d of inactivity since `lifecycle/stale` was applied, `lifecycle/rotten` is applied >- After 30d of inactivity since `lifecycle/rotten` was applied, the issue is closed > >You can: >- Reopen this issue or PR with `/reopen` >- Mark this issue or PR as fresh with `/remove-lifecycle rotten` >- Offer to help out with [Issue Triage][1] > >Please send feedback to sig-contributor-experience at [kubernetes/community](https://github.com/kubernetes/community). > >/close > >[1]: https://www.kubernetes.dev/docs/guide/issue-triage/ Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.