k8s.cr v0.1.11
K8S.cr
A Kubernetes Binding lib for Crystal-lang forked from psykube/pyrite. Forked due to possibly destructive changes to change namespaces and adapt for use with Kube::Client
This library contains generated classes for Kubernetes resources for various Kubernetes API versions, as well as a Hashdiff
module for comparing hashes of Kubernetes resources.
Installation
Add this to your application's shard.yml
:
dependencies:
k8s:
github: spoved/k8s.cr
Documentation
View the Documentation for the version you are using:
https://spoved.github.io/k8s.cr/
Usage
K8S.cr should support Kubernetes API from 1.11.0 and beyond. In order to use the bindings, you will want to include the VERSION that best maps to your k8s api version. Requiring more than one version at this time will result in an error.
require "k8s/versions/v1.20"
Resources
Some examples on the easier methods to grab/set variables:
# Access a nested path
resource.spec![:template, :metadata, :labels, :app]
# Set a nested path
resource.spec![:template, :metadata, :labels, :app] = "myapp"
# Can use symbols or strings
resource.spec![:template]
resource.spec!["template"]
CRD Generation
To generate resources for a CRD, you can use the crd_gen.cr file.
# First dump the CRDs to a file
kubectl get crds -o yaml > crds.yaml
# Then generate the resources
./lib/k8s/bin/gen_crd.cr -- ./crds.yaml <output directory>
Contributing
- Fork it ( https://github.com/spoved/k8s.cr/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- [kalinon] Holden Omans - maintainer
- [jwaldrip] Jason Waldrip - psykube/pyrite
- [krzysiek1507] Krzysztof Rybka - Ruby Hashdiff
- [liufengyun] Fengyun Liu - Ruby Hashdiff
k8s.cr
- 7
- 0
- 1
- 1
- 4
- about 1 year ago
- December 8, 2021
MIT License
Thu, 07 Nov 2024 20:16:34 GMT