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

fix(deps): update dependency inter-ui to v4 #221

Closed
wants to merge 11 commits into from
1 change: 1 addition & 0 deletions .helm/ecamp3-logging/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/deploy.sh
24 changes: 24 additions & 0 deletions .helm/ecamp3-logging/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: ecamp3-logging
description: Helm chart for deploying ecamp3-logging on Kubernetes
home: https://github.com/ecamp/ecamp3

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot 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
11 changes: 11 additions & 0 deletions .helm/ecamp3-logging/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# ecamp3-logging

This is a helm chart to deploy the logging stack of ecamp3.
It uses the EFK stack (Elasticsearch, Filebeat and Kibana).
There is currently no setup to deploy it in a continuous fashion.\
The [deploy.sh](deploy.sh) allows to deploy the chart if you have
a working [kubectl and helm setup](https://github.com/ecamp/ecamp3/wiki/Deployment-installation-Kubernetes#connecting-to-the-cluster).

The current setup of kibana is stored here: [kibana-objects.ndjson](files%2Fkibana%2Fkibana-objects.ndjson)\
It can be generated and restored with the scripts [dump-kibana-objects.sh](files%2Fkibana%2Fdump-kibana-objects.sh)
and [restore-kibana-objects.sh](files%2Fkibana%2Frestore-kibana-objects.sh)
7 changes: 7 additions & 0 deletions .helm/ecamp3-logging/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -e

SCRIPT_DIR=$(realpath "$(dirname "$0")")

helm upgrade --install ecamp3-logging --namespace=ecamp3-logging --create-namespace $SCRIPT_DIR
23 changes: 23 additions & 0 deletions .helm/ecamp3-logging/files/kibana/dump-kibana-objects.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

set -e

SCRIPT_DIR=$(realpath "$(dirname "$0")")

KIBANA_HOST=${KIBANA_HOST:-localhost:5601}

curl -X POST $KIBANA_HOST/api/saved_objects/_export \
-H 'kbn-xsrf: true' \
-H 'Content-Type: application/json' \
-d '
{
"type": [
"dashboard",
"index-pattern",
"search"
],
"excludeExportDetails": true
}' \
--silent \
| jq -S \
> $SCRIPT_DIR/kibana-objects.ndjson
135 changes: 135 additions & 0 deletions .helm/ecamp3-logging/files/kibana/kibana-objects.ndjson

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions .helm/ecamp3-logging/files/kibana/restore-kibana-objects.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

SCRIPT_DIR=$(realpath "$(dirname "$0")")

KIBANA_HOST=${KIBANA_HOST:-localhost:5601}

tmp_file=/tmp/$(uuidgen).ndjson

cat $SCRIPT_DIR/kibana-objects.ndjson | jq -c > $tmp_file

curl -X POST "$KIBANA_HOST/api/saved_objects/_import?createNewCopies=false&overwrite=true" \
-H "kbn-xsrf: true" \
--form file=@$tmp_file
18 changes: 18 additions & 0 deletions .helm/ecamp3-logging/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{/*
Common labels
*/}}
{{- define "app.commonLabels" -}}
helm.sh/chart: {{ .Chart.Name }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Common selector labels
*/}}
{{- define "app.commonSelectorLabels" -}}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/part-of: {{ .Chart.Name }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
kind: Service
apiVersion: v1
metadata:
name: elasticsearch
namespace: {{ .Release.Namespace }}
labels:
app: elasticsearch
{{- include "app.commonLabels" . | nindent 4 }}
{{- include "app.commonSelectorLabels" . | nindent 4 }}
spec:
selector:
app: elasticsearch
{{- include "app.commonSelectorLabels" . | nindent 4 }}
clusterIP: None
ports:
- port: 9200
name: rest
- port: 9300
name: inter-node
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{{- $minHeapSpace := .Values.elasticsearch.elasticNode.resources.requests.memory | replace "Mi" "" -}}
{{- $maxHeapSpace := .Values.elasticsearch.elasticNode.resources.requests.memory | replace "Mi" "" -}}

apiVersion: apps/v1
kind: StatefulSet
metadata:
name: es-cluster
namespace: {{ .Release.Namespace }}
labels:
{{- include "app.commonLabels" . | nindent 4 }}
{{- include "app.commonSelectorLabels" . | nindent 4 }}
spec:
serviceName: elasticsearch
replicas: 1
selector:
matchLabels:
app: elasticsearch
{{- include "app.commonSelectorLabels" . | nindent 6 }}
template:
metadata:
labels:
app: elasticsearch
{{- include "app.commonLabels" . | nindent 8 }}
{{- include "app.commonSelectorLabels" . | nindent 8 }}
spec:
containers:
- name: elasticsearch
image: docker.elastic.co/elasticsearch/elasticsearch:8.11.3
resources:
{{- toYaml .Values.elasticsearch.elasticNode.resources | nindent 12 }}
ports:
- containerPort: 9200
name: rest
protocol: TCP
- containerPort: 9300
name: inter-node
protocol: TCP
volumeMounts:
- name: data
mountPath: /usr/share/elasticsearch/data
env:
- name: cluster.name
value: ecamp3-logs
- name: xpack.security.enabled
value: "false"
- name: node.name
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: cluster.initial_master_nodes
value: "es-cluster-0"
- name: ES_JAVA_OPTS
value: "-Xms{{ $minHeapSpace }}m -Xmx{{ $maxHeapSpace }}m"
initContainers:
- name: fix-permissions
image: busybox
command: [ "sh", "-c", "chown -R 1000:1000 /usr/share/elasticsearch/data" ]
securityContext:
privileged: true
volumeMounts:
- name: data
mountPath: /usr/share/elasticsearch/data
- name: increase-vm-max-map
image: busybox
command: [ "sysctl", "-w", "vm.max_map_count=262144" ]
securityContext:
privileged: true
- name: increase-fd-ulimit
image: busybox
command: [ "sh", "-c", "ulimit -n 65536" ]
securityContext:
privileged: true
volumeClaimTemplates:
- metadata:
name: data
labels:
app: elasticsearch
{{- include "app.commonLabels" . | nindent 10 }}
{{- include "app.commonSelectorLabels" . | nindent 10 }}
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: do-block-storage
resources:
{{- toYaml .Values.elasticsearch.persistence.resources | nindent 10 }}
36 changes: 36 additions & 0 deletions .helm/ecamp3-logging/templates/filebeat/filebeat_cluster_role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: filebeat
# ClusterRole is a non-namespaces resource
# see https://kubernetes.io/docs/reference/access-authn-authz/rbac/#role-and-clusterrole
labels:
app: filebeat
k8s-app: filebeat
{{- include "app.commonLabels" . | nindent 4 }}
{{- include "app.commonSelectorLabels" . | nindent 4 }}
rules:
- apiGroups:
- ""
resources:
- pods
- namespaces
- nodes
verbs:
- get
- list
- watch
- apiGroups: [ "apps" ]
resources:
- replicasets
verbs:
- get
- list
- watch
- apiGroups: [ "batch" ]
resources:
- jobs
verbs:
- get
- list
- watch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: filebeat
labels:
{{- include "app.commonLabels" . | nindent 4 }}
{{- include "app.commonSelectorLabels" . | nindent 4 }}
roleRef:
kind: ClusterRole
name: filebeat
apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
name: filebeat
namespace: {{ .Release.Namespace }}
79 changes: 79 additions & 0 deletions .helm/ecamp3-logging/templates/filebeat/filebeat_config_map.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: filebeat-config
namespace: {{ .Release.Namespace }}
labels:
app: filebeat
k8s-app: filebeat
{{- include "app.commonLabels" . | nindent 4 }}
{{- include "app.commonSelectorLabels" . | nindent 4 }}
data:
filebeat.yml: |-
filebeat.inputs:
- type: container
paths:
- /var/log/containers/ecamp3-*.log
- /var/log/containers/ingress-nginx-controller*.log
processors:
- decode_json_fields:
fields: [ "message" ]
target: json
max_depth: 20
add_error_key: true

- add_kubernetes_metadata:
host: ${NODE_NAME}
matchers:
- logs_path:
logs_path: "/var/log/containers/"

- copy_fields:
fields:
- from: json.httpRequest.requestUrl
to: json.httpRequest.escapedUrl
fail_on_error: false
ignore_missing: true

- replace:
fields:
- field: json.httpRequest.escapedUrl
pattern: "/[0-9a-f]{6,}/?"
replacement: "/{id}/"
fail_on_error: false
ignore_missing: true

- replace:
fields:
- field: json.httpRequest.escapedUrl
pattern: "%2F[0-9a-f]{6,}(%2F)?"
replacement: "%2F{id}%2F"
fail_on_error: false
ignore_missing: true

- copy_fields:
fields:
- from: json.httpRequest.escapedUrl
to: json.httpRequest.escapedUrlWithoutQuery
fail_on_error: false
ignore_missing: true

- replace:
fields:
- field: json.httpRequest.escapedUrlWithoutQuery
pattern: "\\?.*$"
replacement: ""
fail_on_error: false
ignore_missing: true

processors:
- add_cloud_metadata:
- add_host_metadata:

cloud.id: ${ELASTIC_CLOUD_ID}
cloud.auth: ${ELASTIC_CLOUD_AUTH}

output.elasticsearch:
hosts: [ '${ELASTICSEARCH_HOST:elasticsearch}:${ELASTICSEARCH_PORT:9200}' ]
username: ${ELASTICSEARCH_USERNAME:-}
password: ${ELASTICSEARCH_PASSWORD:-}
Loading
Loading