Giter Club home page Giter Club logo

rekube's Introduction

RE:KUBE PROJECT

React renderer for Kubernetes configurations.
JSX instead of clumsy YAML, declarative and type-safe configurations.

Why Rekube?

  1. Leverage programming:
    Use variables, functions, type-safety, conditional rendering, etc.

  2. Leverage React:
    Context aware configurations, Reusable components, Package ecosystem

Before you start

Install node if you don't have it already.

As option, install one of the following package managers:

Getting started

  1. Init the project

    mkdir /your/project
    cd /your/project
    npm init # You could use pnpm or yarn if you prefer
  2. Add Rekube base components package to the project:

    npm install -D rekube @rekube/base

    or

    pnpm install -D rekube @rekube/base
    yarn add -D rekube @rekube/base
  3. Create a file k8s.tsx with the following content:

    import { Deployment } from "@rekube/base/apps/v1";
    import { Container, ContainerPort, PodTemplateSpec, Service, ServicePort } from "@rekube/base/core/v1";
    
    export default function App() {
        const labels = { app: "nginx" };
    
        return (
            <>
                <Deployment
                    meta:name="nginx"
                    replicas={3}
                    selector={{ matchLabels: labels }}
                >
                    <PodTemplateSpec meta:labels={labels}>
                        <Container name="nginx" image="nginx:1.14.2">
                            <ContainerPort containerPort={80} />
                        </Container>
                    </PodTemplateSpec>
                </Deployment>
    
                <Service meta:name="nginx-svc" selector={{ labels }}>
                    <ServicePort port={80} targetPort={80} protocol="TCP" />
                </Service>
            </>
        );
    }
  4. Run rekube cli in the project directory.

    It will render the k8s.tsx file to stdout:

    npx rekube
    npx rekube ./other/file.tsx
    npx rekube > k8s.yaml

    or pipe it directly to kubectl:

    npx rekube | kubectl apply -f -

Publishing your Rekube packages on npm

Rekube utilizes the npm ecosystem.
You can publish your Rekube components just like any other npm package.
Moreover, Rebuke includes a built-in transpiler that enables you to directly publish tsx/jsx files.

Generating Rekube Components out of yaml file

Rekube includes a built-in transpiler that enables you to directly convert yaml files to tsx files.

npx rekube convert ./path/to/your/file.yaml

Contributing

Any contribution is welcome. Either it's a bug report, a feature request, or a pull request. Reach me out if you have any questions or need help with anything.

rekube's People

Contributors

cah4a 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.