Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

helm plugin #55

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

helm plugin #55

wants to merge 2 commits into from

Conversation

dlespiau
Copy link
Member

@dlespiau dlespiau commented Nov 22, 2019

This PR works on top of jkcfg/jk#288 and provides a way for jk to render helm charts and import the result as js objects.

TODO:

  • Merge Plugin system and "renderers" jk#288
  • Remove the github.com/jkcfg/jk replace rule
  • publish a multi-arch docker image for the plugin
  • Add a e2e test in @jkcfg/kubernetes
  • how to be explicit about a script depending on having a chart as a dependency, how to download it and package it for distribution
  • what happens when a chart has deps?
  • make sure the helm plugin is isolated and doesn't touch files owned by regular helm running on the user machine
  • find a way to reduce the plugin size (currently 40MB!)
  • Think about the Chart API a bit more

Example:

import * as std from '@jkcfg/std';
import * as helm from '@jkcfg/kubernetes/helm';

const memcached = new helm.Chart('helm/memcached');

memcached.render({
    name: 'myrelease',
    namespace: 'myns',
  }, {
    memcached: {
      maxItemMemory: 1024,
    },
  }).then(chart => std.write(chart.objects(), '', { format: std.Format.YAMLStream }));
$ helm pull stable/memcached --untar --untardir helm
$ jk run helm.js
apiVersion: v1
kind: Service
metadata:
  annotations: {}
  labels:
    app: myrelease-memcached
    chart: memcached-3.2.0
    heritage: Helm
    release: myrelease
  name: myrelease-memcached
  namespace: myns
spec:
  clusterIP: None
  ports:
  - name: memcache
    port: 11211
    targetPort: memcache
  selector:
    app: myrelease-memcached
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  labels:
    app: myrelease-memcached
    chart: memcached-3.2.0
    heritage: Helm
    release: myrelease
  name: myrelease-memcached
  namespace: myns
spec:
  replicas: 3
  selector:
    matchLabels:
      app: myrelease-memcached
      release: myrelease
  serviceName: myrelease-memcached
  template:
    metadata:
      labels:
        app: myrelease-memcached
        chart: memcached-3.2.0
        heritage: Helm
        release: myrelease
    spec:
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchLabels:
                app: myrelease-memcached
                release: myrelease
            topologyKey: kubernetes.io/hostname
      containers:
      - command:
        - memcached
        - -m 1024
        - -o
        - modern
        - -v
        image: memcached:1.5.19-alpine
        imagePullPolicy: ""
        livenessProbe:
          initialDelaySeconds: 30
          tcpSocket:
            port: memcache
          timeoutSeconds: 5
        name: myrelease-memcached
        ports:
        - containerPort: 11211
          name: memcache
        readinessProbe:
          initialDelaySeconds: 5
          tcpSocket:
            port: memcache
          timeoutSeconds: 1
        resources:
          requests:
            cpu: 50m
            memory: 64Mi
        securityContext:
          runAsUser: 1001
      securityContext:
        fsGroup: 1001
  updateStrategy:
    type: RollingUpdate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant