Skip to content

Commit

Permalink
feat: add log-generator chart
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Sagi-Kazar <[email protected]>
  • Loading branch information
sagikazarmark committed Feb 15, 2023
1 parent b196a71 commit de8fbd8
Show file tree
Hide file tree
Showing 12 changed files with 391 additions and 0 deletions.
26 changes: 26 additions & 0 deletions charts/log-generator/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 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/

ci/
README.md.gotmpl
20 changes: 20 additions & 0 deletions charts/log-generator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: v2
type: application
name: logging-operator
version: 0.2.0
appVersion: 0.4.1
kubeVersion: ">=1.16.0-0"
description: A Helm chart for Log-generator
keywords:
- logging
home: https://kube-logging.github.io
sources:
- https://github.com/kube-logging/log-generator
- https://github.com/kube-logging/helm-charts/tree/main/charts/log-generator
annotations:
artifacthub.io/changes: |
- kind: changed
description: Moved to to location
artifacthub.io/images: |
- name: logging-operator
image: ghcr.io/kube-logging/log-generator:v0.4.1
51 changes: 51 additions & 0 deletions charts/log-generator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# logging-operator

![version: 0.2.0](https://img.shields.io/badge/version-0.2.0-informational?style=flat-square) ![type: application](https://img.shields.io/badge/type-application-informational?style=flat-square) ![app version: 0.4.1](https://img.shields.io/badge/app%20version-0.4.1-informational?style=flat-square) ![kube version: >=1.16.0-0](https://img.shields.io/badge/kube%20version->=1.16.0--0-informational?style=flat-square) [![artifact hub](https://img.shields.io/badge/artifact%20hub-logging--operator-informational?style=flat-square)](https://artifacthub.io/packages/helm/kube-logging/logging-operator)

A Helm chart for Log-generator

**Homepage:** <https://kube-logging.github.io>

## TL;DR;

```bash
helm repo add kube-logging https://kube-logging.github.io/helm-charts
helm install --generate-name --wait kube-logging/logging-operator
```

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| replicaCount | int | `1` | |
| image.repository | string | `"ghcr.io/kube-logging/log-generator"` | |
| image.tag | string | `"0.4.0"` | |
| image.pullPolicy | string | `"IfNotPresent"` | |
| imagePullSecrets | list | `[]` | |
| nameOverride | string | `""` | |
| fullnameOverride | string | `""` | |
| serviceAccount.create | bool | `true` | |
| serviceAccount.name | string | `nil` | |
| podSecurityContext | object | `{}` | |
| securityContext | object | `{}` | |
| app.minInterval | int | `100` | |
| app.maxInterval | int | `1` | |
| app.count | int | `0` | |
| app.randomise | bool | `true` | |
| app.eventPerSec | int | `1` | |
| app.bytePerSec | int | `0` | |
| app.golang | bool | `false` | |
| app.nginx | bool | `true` | |
| app.apache | bool | `false` | |
| api.addr | string | `"11000"` | |
| api.serviceName | string | `"log-generator-api"` | |
| api.basePath | string | `"/"` | |
| api.serviceMonitor.enabled | bool | `false` | |
| api.serviceMonitor.additionalLabels | object | `{}` | |
| api.serviceMonitor.namespace | string | `nil` | |
| api.serviceMonitor.interval | string | `nil` | |
| api.serviceMonitor.scrapeTimeout | string | `nil` | |
| resources | object | `{}` | |
| nodeSelector | object | `{}` | |
| tolerations | list | `[]` | |
| affinity | object | `{}` | |
1 change: 1 addition & 0 deletions charts/log-generator/README.md.gotmpl
Empty file.
56 changes: 56 additions & 0 deletions charts/log-generator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "log-generator.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 "log-generator.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 "log-generator.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Common labels
*/}}
{{- define "log-generator.labels" -}}
app.kubernetes.io/name: {{ include "log-generator.name" . }}
helm.sh/chart: {{ include "log-generator.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- 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 "log-generator.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "log-generator.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}
37 changes: 37 additions & 0 deletions charts/log-generator/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "log-generator.fullname" . }}
data:
config.toml: |-
[logging]
level = "debug"
[message]
# The amount of log message to emit. (default: 0)
count = {{ .Values.app.count }}
# Randomise log content (default: true)
randomise = {{ .Values.app.randomise }}
# The amount of log message to emit/s (default: 4)
event-per-sec = {{ .Values.app.eventPerSec }}
# The amount of bytes to emit/s (default: 0)
byte-per-sec = {{ .Values.app.bytePerSec }}
[api]
# Metrics server listen address (default: ":11000")
addr = ":{{ .Values.api.addr }}"
basePath = "{{ .Values.api.basePath }}"
[golang]
enabled = {{ .Values.app.golang }}
[nginx]
enabled = {{ .Values.app.nginx }}
[apache]
enabled = {{ .Values.app.apache }}
59 changes: 59 additions & 0 deletions charts/log-generator/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "log-generator.fullname" . }}
labels:
{{ include "log-generator.labels" . | indent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "log-generator.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "log-generator.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ template "log-generator.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- /loggen
ports:
- name: api
containerPort: {{ .Values.api.addr }}
protocol: TCP
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: config
mountPath: /conf/config.toml
subPath: config.toml
volumes:
- name: config
configMap:
name: {{ include "log-generator.fullname" . }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
16 changes: 16 additions & 0 deletions charts/log-generator/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.api.serviceName }}
labels:
{{ include "log-generator.labels" . | indent 4 }}
spec:
type: ClusterIP
ports:
- port: {{ .Values.api.addr }}
targetPort: api
protocol: TCP
name: api
selector:
app.kubernetes.io/name: {{ include "log-generator.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
8 changes: 8 additions & 0 deletions charts/log-generator/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template "log-generator.serviceAccountName" . }}
labels:
{{ include "log-generator.labels" . | indent 4 }}
{{- end -}}
33 changes: 33 additions & 0 deletions charts/log-generator/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{{- if .Values.api.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "log-generator.fullname" . }}-metrics
{{- if .Values.api.serviceMonitor.namespace }}
namespace: {{ .Values.api.serviceMonitor.namespace }}
{{- end }}
labels:
app.kubernetes.io/name: {{ include "log-generator.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Values.api.serviceMonitor.additionalLabels }}
{{ toYaml .Values.api.serviceMonitor.additionalLabels | indent 4 }}
{{- end }}
spec:
endpoints:
- port: api
{{- if .Values.api.serviceMonitor.interval }}
interval: {{ .Values.api.serviceMonitor.interval }}
{{- end }}
{{- if .Values.api.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.api.serviceMonitor.scrapeTimeout }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "log-generator.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}

{{- end }}

Loading

0 comments on commit de8fbd8

Please sign in to comment.