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

Lagoon logging helm chart #1859

Merged
merged 7 commits into from
May 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 19 additions & 3 deletions charts/index.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
apiVersion: v1
entries:
lagoon-logging:
- apiVersion: v2
appVersion: 0.1.0
created: "2020-05-20T21:04:11.988795-04:00"
dependencies:
- name: logging-operator
repository: https://kubernetes-charts.banzaicloud.com
version: ~3.0.5
description: |
A Helm chart for Kubernetes which installs the lagoon container and router logs collection system.
digest: 974f04650815b54aacbafcd4539058f7ad4d3d384604b16236e78abe8b5935e1
name: lagoon-logging
type: application
urls:
- lagoon-logging-0.1.0.tgz
version: 0.1.0
lagoon-remote:
- apiVersion: v2
appVersion: 1.4.0
created: "2020-02-11T16:10:24.168348-06:00"
created: "2020-05-20T21:04:11.990249-04:00"
description: A Helm chart to run a lagoon-remote
digest: 96bc41bc9985cd6a7fbd85a32affea3bbbabdf4baa0cd829e7e3d33fb975ceeb
name: lagoon-remote
Expand All @@ -13,12 +29,12 @@ entries:
version: 0.1.3
- apiVersion: v2
appVersion: 1.4.0
created: "2020-02-11T16:10:24.164527-06:00"
created: "2020-05-20T21:04:11.989691-04:00"
description: A Helm chart to run a lagoon-remote
digest: 5756a3fbb46a11f2f43fdcadb41d709d90c70208b90fa0257d48dcacc4df3040
name: lagoon-remote
type: application
urls:
- lagoon-remote-0.1.2.tgz
version: 0.1.2
generated: "2020-02-11T16:10:24.162423-06:00"
generated: "2020-05-20T21:04:11.982298-04:00"
Binary file added charts/lagoon-logging-0.1.0.tgz
Binary file not shown.
91 changes: 91 additions & 0 deletions charts/lagoon-logging.values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Default values for lagoon-logging.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

nameOverride: ""
fullnameOverride: ""

logsDispatcher:

name: logs-dispatcher

replicaCount: 2

image:
repository: amazeeiolagoon/logs-dispatcher
pullPolicy: Always
# Overrides the image tag whose default is the chart version.
tag: v1-5-0

serviceAccount:
# Specifies whether a service account should be created
create: true
# Annotations to add to the service account
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname
# template
# If this value is set, the serviceAccount named must have clusterrole
# view.
name: ""

podAnnotations: {}

podSecurityContext: {}
# fsGroup: 2000

securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000

resources: {}
# If you want to specify resources, uncomment the following lines, adjust
# them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi

nodeSelector: {}

tolerations: []

affinity: {}

# Don't collect logs from these namespaces.
# Comment out this field to collect from all namespaces.
excludeNamespaces:
- cattle-prometheus
- kube-system
- syn
- syn-cert-manager
- syn-synsights
- syn-cluster-autoscaler

# Configure the cluster output buffer.
# This may require tweaking to handle high volumes of logs.
clusterOutputBuffer:
flush_thread_count: 256
timekey: 1m
timekey_wait: 10s
timekey_use_utc: true

# Elasticsearch output config.
elasticsearchHostPort: "443"
elasticsearchScheme: https
# The values below must be supplied during installation as they have no sane
# defaults.
elasticsearchAdminPassword: SOp1qe31Bb6jqIjjpPaqNURtMbBIo7Ah
elasticsearchHost: logs-db.ch2.amazee.io
clusterName: amazeeio-de3

# chart dependency on logging-operator
logging-operator:
enabled: true
createCustomResource: false
1 change: 1 addition & 0 deletions charts/lagoon-logging/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/charts/*.tgz
23 changes: 23 additions & 0 deletions charts/lagoon-logging/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
6 changes: 6 additions & 0 deletions charts/lagoon-logging/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: logging-operator
repository: https://kubernetes-charts.banzaicloud.com
version: 3.0.5
digest: sha256:b5f1e93500944b39e9f49083594eaecdb4e584ec94dfcd8a38ef4c4835377e35
generated: "2020-05-07T22:37:40.078678817+08:00"
26 changes: 26 additions & 0 deletions charts/lagoon-logging/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: v2
name: lagoon-logging
description: >
A Helm chart for Kubernetes which installs the lagoon container and router
logs collection system.

# Application charts are a collection of templates that can be packaged into
# versioned archives to be deployed.
type: application

# This is the chart version. This version number should be incremented each
# time you make changes to the chart and its templates, including the app
# version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version
# number should be incremented each time you make changes to the application.
# Versions are not expected to follow Semantic Versioning. They should reflect
# the version the application is using.
appVersion: 0.1.0

dependencies:
- name: logging-operator
repository: https://kubernetes-charts.banzaicloud.com
version: ~3.0.5
79 changes: 79 additions & 0 deletions charts/lagoon-logging/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Lagoon Logging Helm Chart

This chart installs a logging system that will send logs to elasticsearch.

Logs are collated into a single index per lagoon project.

## Requirements

- Helm 3.2.1 or newer

## How to install

Run these commands in the `charts/` directory (above `lagoon-logging/`).

0. Obtain dependency.

```
helm repo add banzaicloud-stable https://kubernetes-charts.banzaicloud.com
helm dependency build lagoon-logging
```

1. Create a `lagoon-logging.values.yaml` file inside `charts/` directory containing these fields with the
relevant values added.

```
elasticsearchHost: ...
elasticsearchAdminPassword: ...
clusterName: ...
```

2. Test installation.

```
helm template --debug --namespace lagoon-logging -f ./lagoon-logging.values.yaml lagoon-logging lagoon-logging
```

```
helm upgrade --dry-run --install --debug --create-namespace --namespace lagoon-logging -f ./lagoon-logging.values.yaml lagoon-logging lagoon-logging
```

2. Run installation.

```
helm upgrade --install --debug --create-namespace --namespace lagoon-logging -f ./lagoon-logging.values.yaml lagoon-logging lagoon-logging
```

## View logs

### For namespaces without a lagoon.sh/project label

Logs will appear in indices matching these patterns:

```
container-logs-*_$CLUSTERNAME-*
router-logs-*_$CLUSTERNAME-*
```

e.g. if `clusterName: test1`

```
container-logs-*_test1-*
router-logs-*_test1-*
```

### For namespaces with a lagoon.sh/project label

Logs will appear in indices matching these patterns:

```
container-logs-$PROJECT-*
router-logs-$PROJECT-*
```

e.g. if `lagoon.sh/project: drupal-example`

```
container-logs-drupal-example-*
router-logs-drupal-example-*
```
5 changes: 5 additions & 0 deletions charts/lagoon-logging/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Thank you for installing {{ .Chart.Name }}.

Your release is named {{ .Release.Name }}.

Your logs are now being sent to {{ .Values.elasticsearchScheme }}://{{ .Values.elasticsearchHost }}:{{ .Values.elasticsearchHostPort }}
94 changes: 94 additions & 0 deletions charts/lagoon-logging/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "lagoon-logging.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).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "lagoon-logging.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "lagoon-logging.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "lagoon-logging.selectorLabels" -}}
app.kubernetes.io/name: {{ include "lagoon-logging.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "lagoon-logging.labels" -}}
helm.sh/chart: {{ include "lagoon-logging.chart" . }}
{{ include "lagoon-logging.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Create a default fully qualified app name for logs-dispatcher.
We truncate at 63 chars because some Kubernetes name fields are limited to this
(by the DNS naming spec).
*/}}
{{- define "lagoon-logging.logsDispatcher.fullname" -}}
{{- include "lagoon-logging.fullname" . }}-{{ .Values.logsDispatcher.name }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "lagoon-logging.logsDispatcher.selectorLabels" -}}
app.kubernetes.io/name: {{ include "lagoon-logging.name" . }}
app.kubernetes.io/component: {{ include "lagoon-logging.logsDispatcher.fullname" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "lagoon-logging.logsDispatcher.labels" -}}
helm.sh/chart: {{ include "lagoon-logging.chart" . }}
{{ include "lagoon-logging.logsDispatcher.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "lagoon-logging.logsDispatcher.serviceAccountName" -}}
{{- if .Values.logsDispatcher.serviceAccount.create }}
{{- default (include "lagoon-logging.logsDispatcher.fullname" .) .Values.logsDispatcher.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.logsDispatcher.serviceAccount.name }}
{{- end }}
{{- end }}
21 changes: 21 additions & 0 deletions charts/lagoon-logging/templates/clusterflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: logging.banzaicloud.io/v1beta1
kind: ClusterFlow
metadata:
namespace: {{ .Release.Namespace | quote }}
name: {{ include "lagoon-logging.fullname" . }}
labels:
{{- include "lagoon-logging.labels" . | nindent 4 }}
spec:
# match entries are considered in order
# the empty "select: {}" indicates all namespaces/labels
match:
{{- with .Values.excludeNamespaces }}
- exclude:
namespaces:
{{- toYaml . | nindent 6 }}
{{- end }}
- select: {}
filters:
- tag_normaliser: {}
outputRefs:
- {{ include "lagoon-logging.fullname" . }}