andrenth / kubecaml Goto Github PK
View Code? Open in Web Editor NEWKubernetes API client for OCaml
Kubernetes API client for OCaml
Hi there,
Thanks very much for the lib, it's saving me a whole lot of manual generating so far!
I'm currently seeing an issue when trying to list pods:
Kubecaml.Kubernetes.Definitions.Apimachinery.Pkg.Util.Intstr.Int_or_string.t
returned during the JSON response parsing.
I think it corresponds to the port
field in the response - if the port
field is specified as string (referring to a labelled port), the decoding works ok, e.g.:
"readinessProbe": {
"failureThreshold": 3,
"httpGet": {
"path": "/healthz",
**"port": "http",**
"scheme": "HTTP"
}
}
But if the port is referred to as a number, the decoding fails, e.g.:
"readinessProbe": {
"failureThreshold": 3,
"httpGet": {
"path": "/healthz",
**"port": 10254,**
"scheme": "HTTP"
}
}
This seems to be encapsulated by the io.k8s.apimachinery.pkg.util.intstr.IntOrString
swagger type, which marks the type
as string
- so I guess Yojson doesn't like it when it sees a number in the response.
I'll have a look at ocaml-swagger and see if I can figure out a way of making this work - there's an [@encoding `string]
option in ppx_deriving_yojson that might help, but I'm not sure how I'd target the ref in question and apply it, so any suggestions would be gratefully received ๐
The signature of the Kubecaml.Kubernetes.Definitions.Api.Core.V1.Container_port.create
function does not include the unit argument needed to force the application. This means that all labeled arguments need to be supplied to actually create the value. If only some of the arguments are provided the call results in a partial application.
Here's the demonstration:
# #require "kubecaml";;
# Kubecaml.Kubernetes.Definitions.Api.Core.V1.Container_port.create
~name:"xxx"
~container_port:8080;;
- : ?protocol:string ->
?host_port:int ->
?host_ip:string ->
Kubecaml.Kubernetes.Definitions.Api.Core.V1.Container_port.t
= <fun>
# Kubecaml.Kubernetes.Definitions.Api.Core.V1.Container_port.create
~name:"xxx"
~container_port:8080
?protocol:None
?host_port:None
?host_ip:None;;
- : Kubecaml.Kubernetes.Definitions.Api.Core.V1.Container_port.t = <abstr>
I'm not sure if this should be reported in the swagger generator library.
Do you have an example how to handle certificates and tokens for authentication?
Currently this library doesn't support Jane Street's Async library. It would probably require repackaging.
EDIT: See included pull request:
#5
See title.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.