From 0a9e98a3832f5f771fb94cf01f5b8e31d0a3dd4c Mon Sep 17 00:00:00 2001 From: pierreozoux Date: Fri, 30 Jun 2017 16:47:51 +0100 Subject: [PATCH] Add scalyr --- stable/scalyr/Chart.yaml | 14 ++++++ stable/scalyr/README.md | 67 ++++++++++++++++++++++++++ stable/scalyr/templates/NOTES.txt | 23 +++++++++ stable/scalyr/templates/_helpers.tpl | 16 ++++++ stable/scalyr/templates/cm-agent.yaml | 21 ++++++++ stable/scalyr/templates/daemonset.yaml | 47 ++++++++++++++++++ stable/scalyr/templates/secrets.yaml | 12 +++++ stable/scalyr/values.yaml | 21 ++++++++ 8 files changed, 221 insertions(+) create mode 100755 stable/scalyr/Chart.yaml create mode 100755 stable/scalyr/README.md create mode 100755 stable/scalyr/templates/NOTES.txt create mode 100755 stable/scalyr/templates/_helpers.tpl create mode 100644 stable/scalyr/templates/cm-agent.yaml create mode 100755 stable/scalyr/templates/daemonset.yaml create mode 100755 stable/scalyr/templates/secrets.yaml create mode 100755 stable/scalyr/values.yaml diff --git a/stable/scalyr/Chart.yaml b/stable/scalyr/Chart.yaml new file mode 100755 index 000000000000..6aec48fa460e --- /dev/null +++ b/stable/scalyr/Chart.yaml @@ -0,0 +1,14 @@ +description: Scalyr Agent +home: https://www.scalyr.com +icon: https://www.scalyr.com/s2/src/img/logo-reverse.png +keywords: +- monitoring +- alerting +- logging +maintainers: +- email: pierre@ozoux.net + name: Pierre Ozoux +name: scalyr +sources: +- https://www.scalyr.com/help/install-agent-docker +version: 0.1.0 diff --git a/stable/scalyr/README.md b/stable/scalyr/README.md new file mode 100755 index 000000000000..fab981993d95 --- /dev/null +++ b/stable/scalyr/README.md @@ -0,0 +1,67 @@ +# Scalyr + +[Scalyr](https://www.scalyr.com/) is a hosted infrastructure logging platform. + +## Introduction + +This chart adds the Scalyr Agent to all nodes in your cluster via a DaemonSet. + +## Prerequisites + +- Kubernetes 1.2+ with Beta APIs enabled + +## Installing the Chart + +To install the chart with the release name `my-release`, retrieve your Scalyr API key from your account and run: + +```bash +$ helm install --name my-release \ + --set scalyr.apiKey=YOUR-KEY-HERE stable/scalyr +``` + +After a few minutes, you should see hosts and logs being reported in scalyr. + +> **Tip**: List all releases using `helm list` + +## Uninstalling the Chart + +To uninstall/delete the `my-release` deployment: + +```bash +$ helm delete my-release +``` + +The command removes all the Kubernetes components associated with the chart and deletes the release. + +## Configuration + +The following tables lists the configurable parameters of the Datadog chart and their default values. + +| Parameter | Description | Default | +|-----------------------------|------------------------------------|-------------------------------------------| +| `scalyr.apiKey` | Your Scalyr API key | `Nil` You must provide your own key | +| `scalyr.config.reportContainerMetrics` | Report container metrics. | `false` | +| `image.repository` | The image repository to pull from | `datadog/docker-dd-agent` | +| `image.tag` | The image tag to pull | `latest` | +| `imagePullPolicy` | Image pull policy | `IfNotPresent` | +| `resources.requests.cpu` | CPU resource requests | 128M | +| `resources.limits.cpu` | CPU resource limits | 512Mi | +| `resources.requests.memory` | Memory resource requests | 50m | +| `resources.limits.memory` | Memory resource limits | 256m | + + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, + +```bash +$ helm install --name my-release \ + --set scalyr.apiKey=YOUR-KEY-HERE \ + stable/scalyr +``` + +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/scalyr +``` + +> **Tip**: You can use the default [values.yaml](values.yaml) diff --git a/stable/scalyr/templates/NOTES.txt b/stable/scalyr/templates/NOTES.txt new file mode 100755 index 000000000000..b3dfb80386be --- /dev/null +++ b/stable/scalyr/templates/NOTES.txt @@ -0,0 +1,23 @@ +{{- if .Values.scalyr.apiKey -}} +Scalyr agents are spinning up on each node in your cluster. After a few +minutes, you should see your agents starting in your event stream: + + https://www.scalyr.com/logStart + +No further action should be required. + +{{- else -}} +############################################################################## +#### ERROR: You did not set a scalyr.apiKey. #### +############################################################################## + +This deployment will be incomplete until you get your API key from Scalyr. +Once registered you can request an API key at: + + https://www.scalyr.com/ + +Then run: + + helm upgrade {{ .Release.Name }} \ + --set scalyr.apiKey=YOUR-KEY-HERE stable/scalyr +{{- end }} diff --git a/stable/scalyr/templates/_helpers.tpl b/stable/scalyr/templates/_helpers.tpl new file mode 100755 index 000000000000..f0d83d2edba6 --- /dev/null +++ b/stable/scalyr/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 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 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 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/stable/scalyr/templates/cm-agent.yaml b/stable/scalyr/templates/cm-agent.yaml new file mode 100644 index 000000000000..1cbacf9e41d3 --- /dev/null +++ b/stable/scalyr/templates/cm-agent.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "name" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +data: + agent.json: |- + { + implicit_metric_monitor: false, + implicit_agent_process_metrics_monitor: false, + import_vars: [ "API_KEY" ], + api_key: "$API_KEY", + monitors: [{ + module: "scalyr_agent.builtin_monitors.docker_monitor", + report_container_metrics: {{ .Values.scalyr.config.reportContainerMetrics }} + }] + } diff --git a/stable/scalyr/templates/daemonset.yaml b/stable/scalyr/templates/daemonset.yaml new file mode 100755 index 000000000000..66d6cd82cd73 --- /dev/null +++ b/stable/scalyr/templates/daemonset.yaml @@ -0,0 +1,47 @@ +{{- if .Values.scalyr.apiKey }} +apiVersion: extensions/v1beta1 +kind: DaemonSet +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "name" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + heritage: "{{ .Release.Service }}" + release: "{{ .Release.Name }}" +spec: + template: + metadata: + labels: + app: {{ template "fullname" . }} + release: "{{ .Release.Name }}" + name: {{ template "fullname" . }} + spec: + tolerations: + - operator: "Exists" + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + resources: +{{ toYaml .Values.resources | indent 12 }} + ports: + env: + - name: API_KEY + valueFrom: + secretKeyRef: + name: {{ template "fullname" . }} + key: api-key + volumeMounts: + - name: dockersocket + mountPath: /var/scalyr/docker.sock + readOnly: true + - name: configuration + mountPath: /etc/scalyr-agent-2 + volumes: + - name: dockersocket + hostPath: + path: /var/run/docker.sock + - name: configuration + configMap: + name: {{ template "fullname" . }} +{{ end }} diff --git a/stable/scalyr/templates/secrets.yaml b/stable/scalyr/templates/secrets.yaml new file mode 100755 index 000000000000..fe868b704063 --- /dev/null +++ b/stable/scalyr/templates/secrets.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "name" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +type: Opaque +data: + api-key: {{ required "A valid .Values.scalyr.apiKey entry required!" .Values.scalyr.apiKey | b64enc | quote }} diff --git a/stable/scalyr/values.yaml b/stable/scalyr/values.yaml new file mode 100755 index 000000000000..5706d8be6f58 --- /dev/null +++ b/stable/scalyr/values.yaml @@ -0,0 +1,21 @@ +# Default values for scalyr. +image: + repository: scalyr/scalyr-docker-agent + tag: 2.0.27 + pullPolicy: IfNotPresent + +scalyr: + ## You'll need to set this to your Scalyr API key before the agent will run. + ## ref: https://www.scalyr.com + ## + # apiKey: + config: + reportContainerMetrics: false + +# resources: +# requests: +# cpu: 50m +# memory: 128Mi +# limits: +# cpu: 256m +# memory: 512Mi