Coder Social home page Coder Social logo

helm-tanka's Introduction

Helm Tanka plugin

A Helm plugin for rendering Jsonnet into Helm charts with Tanka.

Heavily inspired by https://github.com/technosophos/helm-ksonnet.

Installation

Prerequisites:

Install the Helm plugin:

$ helm plugin install https://github.com/Duologic/helm-tanka.git

Usage

After installation, the plugin is available at helm tanka.

$ helm tanka help

This plugin provides integration with the Tanka project.

It provides Tanka integration with Helm, generating Helm
templates from jsonnet source.

Available Commands:
  create    Create initial setup
  fetch   Fetch a Jsonnet library (on first setup)
  show    Show the generated Kubernetes manifests.
  build   Build the jsonnet files into a Kubernetes manifests, but don't package it.
  package Generated a packaged Helm chart.

Fetch usage:

   $ helm tanka fetch <url> <entrypoint>

Typical usage:

   $ helm tanka create prometheus
   $ helm tanka fetch prometheus github.com/grafana/jsonnet-libs/prometheus prometheus/prometheus.libsonnet
   $ helm tanka package prometheus
   $ helm install ./prometheus-0.1.0.tgz 

Writing Tanka Charts

Also see included example.

Get started by creating a standard chart:

$ helm tanka create prometheus

You can populate your values.yaml with the required data:

$ cat prometheus/values.yaml

namespace: 'mynamespace'

Then fetch the library you want to use in this Helm chart:

$ helm tanka fetch prometheus github.com/grafana/jsonnet-libs/prometheus prometheus/prometheus.libsonnet

After this you can edit the prometheus/jsonnet/main.jsonnet in case you crave more advanced use cases:

local yaml = std.native('parseYaml')(std.extVar('yaml'))[0];
{
  apiVersion: 'tanka.dev/v1alpha1',
  kind: 'Environment',
  metadata: {
    name: '.',
  },
  spec: {
    apiServer: '',
    namespace: yaml.namespace,
    resourceDefaults: {},
    expectVersions: {},
  },
  data:
    (import 'prometheus/prometheus.libsonnet')
    + { _config+: yaml },
}

Testing Your Chart

To test that your chart is working correctly, use the helm tanka show command:

$ helm tanka show ./prometheus/

apiVersion: v1
kind: ServiceAccount
metadata:
  name: prometheus
  namespace: mynamespace
---
apiVersion: v1
data:
  alerts.rules: |
    groups:

# ...

Packaging and Installing Your Chart

The first step is to create a chart package, and then install it:

$ helm tanka package ./prometheus
Successfully packaged chart and saved it to: ./prometheus-0.1.0.tgz

At this point, you can now easily install this package using the regular Helm commands:

$ helm install ./prometheus-0.1.0.tgz

TIP: You can also use helm install --dry-run --debug ./prometheus-0.1.0.tgz to run a test install.

Installing without Packaging

It is possible to install a chart without first packaging it. In this method, we build the Kubernetes manifests but do not package the chart:

$ helm tanka build ./prometheus
./prometheus/templates/apps-v1.StatefulSet-prometheus.yaml
./prometheus/templates/rbac.authorization.k8s.io-v1beta1.ClusterRoleBinding-prometheus.yaml
./prometheus/templates/rbac.authorization.k8s.io-v1beta1.ClusterRole-prometheus.yaml
./prometheus/templates/v1.ConfigMap-prometheus-alerts.yaml
./prometheus/templates/v1.ConfigMap-prometheus-config.yaml
./prometheus/templates/v1.ConfigMap-prometheus-recording.yaml
./prometheus/templates/v1.ServiceAccount-prometheus.yaml
./prometheus/templates/v1.Service-prometheus.yaml

This tells us that it has built the manifest, but has not packaged it. We can still use Helm to install it, though:

$ helm install ./prometheus

helm-tanka's People

Contributors

duologic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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