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

Generated Ruby client has a few issues #240

Open
slithernix opened this issue Apr 12, 2023 · 8 comments
Open

Generated Ruby client has a few issues #240

slithernix opened this issue Apr 12, 2023 · 8 comments
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@slithernix
Copy link

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
Copy link
Contributor

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
Copy link
Author

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
Copy link

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

This bot triages un-triaged 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:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

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

/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 Jul 15, 2023
@2rs2ts
Copy link

2rs2ts commented Dec 27, 2023

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? kubernetes-client/ruby#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
Copy link

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:

  • 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:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

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

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jan 26, 2024
@slithernix
Copy link
Author

/remove-lifecycle rotten

@k8s-ci-robot k8s-ci-robot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Jan 31, 2024
@slithernix
Copy link
Author

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
Copy link

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

This bot triages un-triaged 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:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

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

/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 Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

5 participants