kubernetes-client / gen

Common generator scripts for all client libraries
Apache License 2.0
148 stars 146 forks source link

Generated Ruby client has a few issues #240

Closed slithernix closed 3 months ago

slithernix commented 1 year ago

First off, I have to enable skipValidation to not validate the spec or I get a whole bunch of errors:

[WARNING] /output_dir/swagger.json [0:0]: unexpected error in Open-API generation
org.openapitools.codegen.SpecValidationException: There were issues with the specification. The option can be disabled via validateSpec (Maven/Gradle) or --skip-validate-spec (CLI).
 | Error count: 90, Warning count: 1

I am not going to paste all the errors, but most of them are like this snippet:

    -attribute paths.'/apis/events.k8s.io/v1/'(get).operationId is repeated
    -attribute paths.'/apis/internal.apiserver.k8s.io/'(get).operationId is repeated
    -attribute paths.'/apis/events.k8s.io/v1/namespaces/{namespace}/events'(post).operationId is repeated
    -attribute paths.'/apis/rbac.authorization.k8s.io/'(get).operationId is repeated
    -attribute paths.'/apis/certificates.k8s.io/v1alpha1/'(get).operationId is repeated
    -attribute paths.'/apis/coordination.k8s.io/'(get).operationId is repeated

Next up, this is small, but when you run a "gem build," on the resultant generated code, the gemspec issues a warning due to the license type:

WARNING:  license value 'Apache V2' is invalid.  Use a license identifier from
http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
Did you mean 'Apache-1.0', 'Apache-1.1', 'Apache-2.0'?

Now, the more severe issue i've run into so far, there appears to be a bug in URL construction in the base_url() or server_url() method in lib/kubernetes/configuration.rb. If I set up a connection and try to execute an API, I get:

[7] pry(main)> client.list_pod_for_all_namespaces()
Kubernetes::ApiError: URL using bad/illegal format or missing URL
HTTP status code: 0
from /var/lib/gems/3.0.0/gems/kubernetes-1.23.17/lib/kubernetes/api_client.rb:62:in `call_api'

So, I went into lib/kubernetes/configuration.rb, and I edited line 193 in the base_url method to be:

return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if index == nil or index == 0

instead of:

return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if index == nil

I'm not sure that's a proper fix, but after doing this I can execute APIs.

LMK if you need more info.

brendandburns commented 1 year ago

Thanks for the report!

I don't think the Ruby library is maintained by anyone currently. (we should perhaps delete it, or get an active maintainer)

You may be better off with one of the community maintained clients: https://kubernetes.io/docs/reference/using-api/client-libraries/#community-maintained-client-libraries

I'll leave this open as a reminder that we should figure out what we're doing here, but I don't think there will be rapid progress in the near term.

slithernix commented 1 year ago

would be a shame to delete it, ruby is a great language for ops scripting. the API seems to work fine so far in my usage. unfortunately i don't have the chops or the time to fix the generator.

k8s-triage-robot commented 1 year ago

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

This bot triages un-triaged issues according to the following rules:

You can:

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

/lifecycle stale

2rs2ts commented 9 months ago

Now, the more severe issue i've run into so far, there appears to be a bug in URL construction in the base_url() or server_url() method in lib/kubernetes/configuration.rb. If I set up a connection and try to execute an API, I get:

Possibly related? https://github.com/kubernetes-client/ruby/pull/64

Of course, it won't do much good to know whether that's related if there's no one to merge that PR and maintain the official client anyway.

k8s-triage-robot commented 8 months ago

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

This bot triages un-triaged issues according to the following rules:

You can:

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

/lifecycle rotten

slithernix commented 8 months ago

/remove-lifecycle rotten

slithernix commented 8 months ago

surely there is a competent ruby dev out there who wants to help the k8s project... i am just an absolute git-r-done hack with barely any temporal resources anyways...

k8s-triage-robot commented 5 months ago

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

This bot triages un-triaged issues according to the following rules:

You can:

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

/lifecycle stale

k8s-triage-robot commented 4 months ago

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

This bot triages un-triaged issues according to the following rules:

You can:

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

/lifecycle rotten

k8s-triage-robot commented 3 months ago

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

This bot triages issues according to the following rules:

You can:

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

/close not-planned

k8s-ci-robot commented 3 months ago

@k8s-triage-robot: Closing this issue, marking it as "Not Planned".

In response to [this](https://github.com/kubernetes-client/gen/issues/240#issuecomment-2198357836): >The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. > >This bot triages issues 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 with `/reopen` >- Mark this issue 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 not-planned > >[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-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
benoittgt commented 3 months ago

/remove-lifecycle rotten