kube-sdk.cr
kube-sdk
A toolkit for Kubernetes development in Crystal.
Installation
TODO: Write installation instructions here
Usage
Specify the kubernetes api version of the client to use before requiring the sdk:
require "kube-sdk/v1.23"
require "kube-sdk"
Or you can specify the kubernetes api version at compile time via the -Dk8s_v{major}.{minor}
flag:
require "kube-sdk"
client = Kube::Client.autoconfig
Generate the CLI using shards build:
shards build -Dk8s_v1.23
If no version is specified the latest version will be used.
CRD Generation
CRDs can be defined using the Kube::SDK.define_crd
method.
Kube::SDK.define_crd(
group: "examples.spoved.io",
version: "v1alpha1",
kind: TestObject,
plural: "testobjects",
scope: :namespaced,
namespace: ::Spoved::Examples::V1alpha1,
properties: {
spec: {
kind: TestObjectSpec,
required: true,
subresource: true,
description: "Defines the specification of TestObject",
properties: {
created: Bool,
healthy: Bool,
},
}
}
)
A more complex example can be seen in the plex-controller/crd.cr file.
CRD Manafests can be generated using the cli command.
./bin/kube-sdk controller gen --file ./examples/plex-controller/main.cr --out-dir ./tmp
This will generate manifests into the output directory under config/crd/bases/
.
Development
TODO: Write development instructions here
Contributing
- Fork it (https://github.com/spoved/kube-sdk.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
- Holden Omans - creator and maintainer
kube-sdk.cr
- 1
- 0
- 0
- 0
- 6
- over 2 years ago
- January 4, 2022
MIT License
Thu, 07 Nov 2024 13:24:11 GMT