From c7bdccafc35452ae4cf6cf9c2109c305fab7cfa1 Mon Sep 17 00:00:00 2001 From: Vic Iglesias Date: Wed, 21 Dec 2016 10:21:59 -0800 Subject: [PATCH] Add linkerd chart (#200) * Add linkerd chart * Add prometheus config to linkerd * linkerd: Disambiguate NOTES wrt port name * linkerd: Add --namespace in NOTES * linkerd: Use resources * linkerd: Fix duplicate service type * Add docs to values file * linkerd: Bump to version 0.8.3 * linkerd: add README.md * Bump linkerd to version 0.8.4 * linkerd: Add metadata to Chart.yaml * linkerd: Remove YAML separator * linkderd: Added app label to confimap --- stable/linkerd/.helmignore | 21 +++++++++++ stable/linkerd/Chart.yaml | 10 ++++++ stable/linkerd/README.md | 30 ++++++++++++++++ stable/linkerd/templates/NOTES.txt | 31 ++++++++++++++++ stable/linkerd/templates/_helpers.tpl | 16 +++++++++ stable/linkerd/templates/config.yaml | 29 +++++++++++++++ stable/linkerd/templates/daemonset.yaml | 48 +++++++++++++++++++++++++ stable/linkerd/templates/service.yaml | 22 ++++++++++++ stable/linkerd/values.yaml | 34 ++++++++++++++++++ 9 files changed, 241 insertions(+) create mode 100644 stable/linkerd/.helmignore create mode 100755 stable/linkerd/Chart.yaml create mode 100644 stable/linkerd/README.md create mode 100644 stable/linkerd/templates/NOTES.txt create mode 100644 stable/linkerd/templates/_helpers.tpl create mode 100644 stable/linkerd/templates/config.yaml create mode 100644 stable/linkerd/templates/daemonset.yaml create mode 100644 stable/linkerd/templates/service.yaml create mode 100644 stable/linkerd/values.yaml diff --git a/stable/linkerd/.helmignore b/stable/linkerd/.helmignore new file mode 100644 index 0000000000..f0c1319444 --- /dev/null +++ b/stable/linkerd/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/stable/linkerd/Chart.yaml b/stable/linkerd/Chart.yaml new file mode 100755 index 0000000000..8fb3d376e9 --- /dev/null +++ b/stable/linkerd/Chart.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +description: Service mesh for cloud native apps +name: linkerd +version: 0.1.0 +home: https://linkerd.io/ +sources: +- https://github.com/BuoyantIO/linkerd +maintainers: +- name: Vic Iglesias + email: viglesias@google.com diff --git a/stable/linkerd/README.md b/stable/linkerd/README.md new file mode 100644 index 0000000000..ef221889cb --- /dev/null +++ b/stable/linkerd/README.md @@ -0,0 +1,30 @@ +# linkerd Chart + +[linkerd](https://linkerd.io/) is a resilient service mesh for cloud native apps + +## Chart Details +This chart will do the following: + +* Install a daemonset that provisions the linkerd [per-host architecture](https://linkerd.io/in-depth/deployment#per-host) + +## Installing the Chart + +To install the chart with the release name `my-release`: + +```bash +$ helm install --name my-release stable/linkerd +``` + +## Configuration + +Configurable values are documented in the `values.yaml`. + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. + +Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example, + +```bash +$ helm install --name my-release -f values.yaml stable/linkerd +``` + +> **Tip**: You can use the default [values.yaml](values.yaml) diff --git a/stable/linkerd/templates/NOTES.txt b/stable/linkerd/templates/NOTES.txt new file mode 100644 index 0000000000..73ba6b3676 --- /dev/null +++ b/stable/linkerd/templates/NOTES.txt @@ -0,0 +1,31 @@ +Add named ports to your services that have the name '{{ .Values.linkerd.portName }}' +and linkerd will act as a proxy for them. + +For example: +apiVersion: v1 +kind: Service +metadata: + name: my-http-service +spec: + type: ClusterIP + ports: + - name: {{ .Values.linkerd.portName }} + port: 8080 + selector: + app: my-http-service + +1. Get the linkerd admin interface URL by running these commands: +{{- if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT/login +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get svc --namespace= {{ .Release.Namespace }} -w {{ template "fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo http://$SERVICE_IP:9990 +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "fullname" . }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:9990 to use your application" + kubectl port-forward --namespace {{ .Release.Namespace }} $POD_NAME 9990:9990 4140:4140 +{{- end }} diff --git a/stable/linkerd/templates/_helpers.tpl b/stable/linkerd/templates/_helpers.tpl new file mode 100644 index 0000000000..234480de71 --- /dev/null +++ b/stable/linkerd/templates/_helpers.tpl @@ -0,0 +1,16 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 24 -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 24 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "fullname" -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- printf "%s-%s" .Release.Name $name | trunc 24 -}} +{{- end -}} diff --git a/stable/linkerd/templates/config.yaml b/stable/linkerd/templates/config.yaml new file mode 100644 index 0000000000..0349f469af --- /dev/null +++ b/stable/linkerd/templates/config.yaml @@ -0,0 +1,29 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "fullname" . }}-config + labels: + app: {{ template "fullname" . }} +data: + config.yaml: |- + admin: + port: 9990 + + namers: + - kind: io.l5d.k8s + # kubectl proxy forwards localhost:8001 to the Kubernetes master API + host: localhost + port: 8001 + routers: + - protocol: http + # Incoming requests to linkerd with a Host header of "hello" get assigned + # a name like /http/1.1/GET/hello. This dtab transforms that into + # /#/io.l5d.k8s/{{ .Release.Namespace }}/{{ .Values.linkerd.portName }}/hello which indicates that the kubernetes + # namer should query the API for ports named "{{ .Values.linkerd.portName }}" on pods in the + # "{{ .Release.Namespace }}" namespace named "hello". linkerd will then load balance over + # those pods. + baseDtab: | + /http/1.1/* => /#/io.l5d.k8s/{{ .Release.Namespace }}/{{ .Values.linkerd.portName }} + servers: + - ip: 0.0.0.0 + port: 4140 diff --git a/stable/linkerd/templates/daemonset.yaml b/stable/linkerd/templates/daemonset.yaml new file mode 100644 index 0000000000..aa594d16d0 --- /dev/null +++ b/stable/linkerd/templates/daemonset.yaml @@ -0,0 +1,48 @@ +apiVersion: extensions/v1beta1 +kind: DaemonSet +metadata: + labels: + app: {{ template "fullname" . }} + name: {{ template "fullname" . }} +spec: + template: + metadata: + labels: + app: {{ template "fullname" . }} + spec: + volumes: + - name: {{ template "fullname" . }}-config + configMap: + name: "{{ template "fullname" . }}-config" + containers: + - name: l5d + image: {{ .Values.image.linkerd.repository }}:{{ .Values.image.linkerd.tag }} + env: + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + args: + - /io.buoyant/linkerd/config/config.yaml + ports: + - name: incoming + containerPort: 4141 + hostPort: 4141 + - name: outgoing + containerPort: 4140 + hostPort: 4140 + - name: admin + containerPort: 9990 + hostPort: 9990 + resources: +{{ toYaml .Values.resources | indent 10 }} + volumeMounts: + - name: "{{ template "fullname" . }}-config" + mountPath: "/io.buoyant/linkerd/config" + readOnly: true + - name: kubectl + image: {{ .Values.image.kubectl.repository }}:{{ .Values.image.kubectl.tag }} + args: + - "proxy" + - "-p" + - "8001" diff --git a/stable/linkerd/templates/service.yaml b/stable/linkerd/templates/service.yaml new file mode 100644 index 0000000000..1ad1dc14dc --- /dev/null +++ b/stable/linkerd/templates/service.yaml @@ -0,0 +1,22 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "fullname" . }} + labels: + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + annotations: + prometheus.io/scrape: {{ .Values.prometheus.scrape | quote }} + prometheus.io/probe: {{ .Values.prometheus.probe | quote }} + prometheus.io/path: {{ .Values.prometheus.path | quote }} + prometheus.io/port: "9990" +spec: + type: {{ .Values.service.type }} + ports: + - name: outgoing + port: 4140 + - name: incoming + port: 4141 + - name: admin + port: 9990 + selector: + app: {{ template "fullname" . }} diff --git a/stable/linkerd/values.yaml b/stable/linkerd/values.yaml new file mode 100644 index 0000000000..bb227998be --- /dev/null +++ b/stable/linkerd/values.yaml @@ -0,0 +1,34 @@ +# Default values for linkerd. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +image: + linkerd: + # Image repository and tag to use for linkerd + repository: buoyantio/linkerd + tag: 0.8.4 + kubectl: + # Image repository and tag to use for kubectl sidecar + repository: buoyantio/kubectl + tag: v1.4.0 + pullPolicy: IfNotPresent +linkerd: + # Port name that linkerd will use for endpoint discovery + portName: http +prometheus: + # Enable Prometheus service metrics + scrape: true + # Enable Prometheus endpoint metrics + probe: true + # Path for Prometheus metrics + path: /admin/metrics/prometheus +service: + # Type of service to use for linkerd + type: ClusterIP +resources: + # Memory limits and requests for linkerd container + limits: + cpu: 500m + memory: 512Mi + requests: + cpu: 500m + memory: 512Mi