Giter Club home page Giter Club logo

k8s's Introduction

k8s-gen

Code generator for the Jsonnet Kubernetes library.

Artifacts

Pre-generated artifacts of this software are provided at https://github.com/jsonnet-libs/k8s-alpha. Check that repo for usage instructions as well.

Usage

k8s-gen loads config.yml, which maps swagger.json files to their respective Kubernetes versions.

# Generate for all versions
$ k8s-gen
Generating ...

# Only a subset (e.g. for development)
$ k8s-gen 1.18 1.17

Customizing

Because the generator only creates the most minimal yet functional code, more sophisticated utilities like constructors (deployment.new(name, replicas, containers), etc) are not created.

For that, k8s-gen implements two methods for extending:

custom patches

The custom/ directory contains a set of .libsonnet files, that are automatically merged with the generated result in main.libsonnet, so they become part of the exported API.

Current Patches:

Name Description
core.libsonnet Constructors for core/v1, ported from ksonnet-gen
apps.libsonnet Constructors for apps/v1, apps/v1beta1, ported from ksonnet-gen
mapContainers.libsonnet Adds mapContainers functions for fields that support them
types.libsonnet Aliases some types as fields of others, to support ksonnet-gen assumptions. Subject to be removed

Extensions

Extensions serve a similar purpose as custom/ patches, but are not automatically applied. However they are still part of the final artifact, but need to added by the user themselves.

Extensions can be applied as so:

(import "github.com/jsonnet-libs/k8s/1.18/main.libsonnet")
+ (import "github.com/jsonnet-libs/k8s/extensions/<name>.libsonnet")
Name Description
kausal-shim.libsonnnet Implements some internals of the ksonnet-lib API, so that the ksonnet-util/kausal.libsonnet library continues to work without changes. Because this is very hacky, we should refactor kausal.libsonnnet as soon as possible instead.

k8s's People

Contributors

duologic avatar hamishforbes avatar sh0rez avatar xvzf avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.