From f3ea767140004c8fce9b878dc72c5e56c2f78771 Mon Sep 17 00:00:00 2001 From: Attila Szakacs Date: Tue, 11 Apr 2023 15:42:52 +0200 Subject: [PATCH 01/51] chart: initial version Signed-off-by: Attila Szakacs --- .helmignore | 23 +++++++++ Chart.yaml | 6 +++ templates/NOTES.txt | 22 +++++++++ templates/_helpers.tpl | 62 ++++++++++++++++++++++++ templates/config.yaml | 8 ++++ templates/deployment.yaml | 72 ++++++++++++++++++++++++++++ templates/hpa.yaml | 28 +++++++++++ templates/ingress.yaml | 61 +++++++++++++++++++++++ templates/service.yaml | 19 ++++++++ templates/serviceaccount.yaml | 12 +++++ templates/tests/test-connection.yaml | 16 +++++++ values.yaml | 72 ++++++++++++++++++++++++++++ 12 files changed, 401 insertions(+) create mode 100644 .helmignore create mode 100644 Chart.yaml create mode 100644 templates/NOTES.txt create mode 100644 templates/_helpers.tpl create mode 100644 templates/config.yaml create mode 100644 templates/deployment.yaml create mode 100644 templates/hpa.yaml create mode 100644 templates/ingress.yaml create mode 100644 templates/service.yaml create mode 100644 templates/serviceaccount.yaml create mode 100644 templates/tests/test-connection.yaml create mode 100644 values.yaml diff --git a/.helmignore b/.helmignore new file mode 100644 index 0000000000..0e8a0eb36f --- /dev/null +++ b/.helmignore @@ -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/ diff --git a/Chart.yaml b/Chart.yaml new file mode 100644 index 0000000000..dc5abe65d6 --- /dev/null +++ b/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: syslog-ng-chart +description: A Helm chart for the Axoflow packaged syslog-ng image +type: application +version: 0.1.0 +appVersion: "4.1.1" diff --git a/templates/NOTES.txt b/templates/NOTES.txt new file mode 100644 index 0000000000..2fb35809bb --- /dev/null +++ b/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "syslog-ng-chart.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- 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 --namespace {{ .Release.Namespace }} svc -w {{ include "syslog-ng-chart.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "syslog-ng-chart.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "syslog-ng-chart.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT +{{- end }} diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl new file mode 100644 index 0000000000..b3968e5543 --- /dev/null +++ b/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "syslog-ng-chart.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 "syslog-ng-chart.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 "syslog-ng-chart.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "syslog-ng-chart.labels" -}} +helm.sh/chart: {{ include "syslog-ng-chart.chart" . }} +{{ include "syslog-ng-chart.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "syslog-ng-chart.selectorLabels" -}} +app.kubernetes.io/name: {{ include "syslog-ng-chart.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "syslog-ng-chart.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "syslog-ng-chart.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/templates/config.yaml b/templates/config.yaml new file mode 100644 index 0000000000..828c27d623 --- /dev/null +++ b/templates/config.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + labels: + {{- include "syslog-ng-chart.labels" . | nindent 4 }} + name: {{ include "syslog-ng-chart.fullname" . }} +data: + syslog-ng.conf: {{ tpl (toYaml .Values.config) . | indent 4 }} diff --git a/templates/deployment.yaml b/templates/deployment.yaml new file mode 100644 index 0000000000..4996addfba --- /dev/null +++ b/templates/deployment.yaml @@ -0,0 +1,72 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "syslog-ng-chart.fullname" . }} + labels: + {{- include "syslog-ng-chart.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "syslog-ng-chart.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "syslog-ng-chart.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "syslog-ng-chart.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + volumeMounts: + - name: config + mountPath: /etc/syslog-ng/syslog-ng.conf + subPath: syslog-ng.conf + - name: var-log-containers + mountPath: /var/log/containers + - name: var-log-pods + mountPath: /var/log/pods + - name: var-lib-docker-containers + mountPath: /var/lib/docker/containers + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumes: + - name: config + configMap: + name: {{ include "syslog-ng-chart.fullname" . }} + - name: var-log-containers + hostPath: + path: /var/log/containers + - name: var-log-pods + hostPath: + path: /var/log/pods + - name: var-lib-docker-containers + hostPath: + path: /var/lib/docker/containers + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/templates/hpa.yaml b/templates/hpa.yaml new file mode 100644 index 0000000000..82af1e0733 --- /dev/null +++ b/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "syslog-ng-chart.fullname" . }} + labels: + {{- include "syslog-ng-chart.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "syslog-ng-chart.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/templates/ingress.yaml b/templates/ingress.yaml new file mode 100644 index 0000000000..c79aa5bc8e --- /dev/null +++ b/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "syslog-ng-chart.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "syslog-ng-chart.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/templates/service.yaml b/templates/service.yaml new file mode 100644 index 0000000000..841b1622ea --- /dev/null +++ b/templates/service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "syslog-ng-chart.fullname" . }} + labels: + {{- include "syslog-ng-chart.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: # TODO: We do not use these, but leaving this empty makes helm install fail. + - name: udp-port + port: 514 + targetPort: 514 + protocol: UDP + - name: tcp-port + port: 601 + targetPort: 601 + protocol: TCP + selector: + {{- include "syslog-ng-chart.selectorLabels" . | nindent 4 }} diff --git a/templates/serviceaccount.yaml b/templates/serviceaccount.yaml new file mode 100644 index 0000000000..9c1ab76362 --- /dev/null +++ b/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "syslog-ng-chart.serviceAccountName" . }} + labels: + {{- include "syslog-ng-chart.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/templates/tests/test-connection.yaml b/templates/tests/test-connection.yaml new file mode 100644 index 0000000000..3ac73550d9 --- /dev/null +++ b/templates/tests/test-connection.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "syslog-ng-chart.fullname" . }}-test-connection" + labels: + {{- include "syslog-ng-chart.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: {} + # ctl healtcheck + # - name: wget + # image: busybox + # command: ['wget'] + # args: ['{{ include "syslog-ng-chart.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/values.yaml b/values.yaml new file mode 100644 index 0000000000..d5234d825f --- /dev/null +++ b/values.yaml @@ -0,0 +1,72 @@ +replicaCount: 1 + +image: + repository: ghcr.io/axoflow/syslog-ng + pullPolicy: IfNotPresent + tag: "4.1.1" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +config: | + @version: 4.1 + @include "scl.conf" + + options { + stats( + level(1) + ); + }; + + source s_kubernetes { + kubernetes(); + }; + + destination d_local { # TODO: where should we send our logs? + file("/tmp/out.log"); + }; + + log { + source(s_kubernetes); + destination(d_local); + }; + +# TODO: kubernetes src should have a toggle +# TODO: syslog-ng-ctl healthcheck should be called somewhere + +serviceAccount: + create: true + annotations: {} + name: "" + +podAnnotations: {} + +podSecurityContext: {} + +securityContext: {} + +service: + type: ClusterIP + +ingress: + enabled: false + className: "" + annotations: {} + hosts: {} + tls: [] + +resources: {} + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} From b009dd72074d2708d4602c9243040d2a8bcb2a36 Mon Sep 17 00:00:00 2001 From: Attila Szakacs Date: Tue, 11 Apr 2023 16:08:44 +0200 Subject: [PATCH 02/51] github-actions: add linter CI job Signed-off-by: Attila Szakacs --- .github/workflows/ci.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..e5ba676e8b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,14 @@ +on: + push: + pull_request: + +jobs: + CI: + runs-on: ubuntu-latest + steps: + - name: Checkout source + uses: actions/checkout@v3 + + - name: Linter + run: | + docker run -v${PWD}:${PWD} alpine/helm lint ${PWD} From ab6389ea91614ee4454cf6e66e5ab79ddac5cc57 Mon Sep 17 00:00:00 2001 From: Attila Szakacs Date: Sat, 15 Apr 2023 15:06:00 +0200 Subject: [PATCH 03/51] hpa,ingress,service: remove They are not what we are shooting for. Signed-off-by: Attila Szakacs --- templates/hpa.yaml | 28 ------------------- templates/ingress.yaml | 61 ------------------------------------------ templates/service.yaml | 19 ------------- 3 files changed, 108 deletions(-) delete mode 100644 templates/hpa.yaml delete mode 100644 templates/ingress.yaml delete mode 100644 templates/service.yaml diff --git a/templates/hpa.yaml b/templates/hpa.yaml deleted file mode 100644 index 82af1e0733..0000000000 --- a/templates/hpa.yaml +++ /dev/null @@ -1,28 +0,0 @@ -{{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2beta1 -kind: HorizontalPodAutoscaler -metadata: - name: {{ include "syslog-ng-chart.fullname" . }} - labels: - {{- include "syslog-ng-chart.labels" . | nindent 4 }} -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: {{ include "syslog-ng-chart.fullname" . }} - minReplicas: {{ .Values.autoscaling.minReplicas }} - maxReplicas: {{ .Values.autoscaling.maxReplicas }} - metrics: - {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} - - type: Resource - resource: - name: cpu - targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} - {{- end }} - {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} - - type: Resource - resource: - name: memory - targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} - {{- end }} -{{- end }} diff --git a/templates/ingress.yaml b/templates/ingress.yaml deleted file mode 100644 index c79aa5bc8e..0000000000 --- a/templates/ingress.yaml +++ /dev/null @@ -1,61 +0,0 @@ -{{- if .Values.ingress.enabled -}} -{{- $fullName := include "syslog-ng-chart.fullname" . -}} -{{- $svcPort := .Values.service.port -}} -{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} - {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} - {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} - {{- end }} -{{- end }} -{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1 -{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1beta1 -{{- else -}} -apiVersion: extensions/v1beta1 -{{- end }} -kind: Ingress -metadata: - name: {{ $fullName }} - labels: - {{- include "syslog-ng-chart.labels" . | nindent 4 }} - {{- with .Values.ingress.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -spec: - {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} - ingressClassName: {{ .Values.ingress.className }} - {{- end }} - {{- if .Values.ingress.tls }} - tls: - {{- range .Values.ingress.tls }} - - hosts: - {{- range .hosts }} - - {{ . | quote }} - {{- end }} - secretName: {{ .secretName }} - {{- end }} - {{- end }} - rules: - {{- range .Values.ingress.hosts }} - - host: {{ .host | quote }} - http: - paths: - {{- range .paths }} - - path: {{ .path }} - {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} - pathType: {{ .pathType }} - {{- end }} - backend: - {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} - service: - name: {{ $fullName }} - port: - number: {{ $svcPort }} - {{- else }} - serviceName: {{ $fullName }} - servicePort: {{ $svcPort }} - {{- end }} - {{- end }} - {{- end }} -{{- end }} diff --git a/templates/service.yaml b/templates/service.yaml deleted file mode 100644 index 841b1622ea..0000000000 --- a/templates/service.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "syslog-ng-chart.fullname" . }} - labels: - {{- include "syslog-ng-chart.labels" . | nindent 4 }} -spec: - type: {{ .Values.service.type }} - ports: # TODO: We do not use these, but leaving this empty makes helm install fail. - - name: udp-port - port: 514 - targetPort: 514 - protocol: UDP - - name: tcp-port - port: 601 - targetPort: 601 - protocol: TCP - selector: - {{- include "syslog-ng-chart.selectorLabels" . | nindent 4 }} From 36982c82fd09c5c8590c4724f191fcabc3e2b62a Mon Sep 17 00:00:00 2001 From: Attila Szakacs Date: Sat, 15 Apr 2023 15:08:12 +0200 Subject: [PATCH 04/51] syslog-ng-chart: rename to syslog-ng-collector Signed-off-by: Attila Szakacs --- Chart.yaml | 4 ++-- templates/NOTES.txt | 8 ++++---- templates/_helpers.tpl | 20 ++++++++++---------- templates/config.yaml | 4 ++-- templates/deployment.yaml | 12 ++++++------ templates/serviceaccount.yaml | 4 ++-- templates/tests/test-connection.yaml | 6 +++--- 7 files changed, 29 insertions(+), 29 deletions(-) diff --git a/Chart.yaml b/Chart.yaml index dc5abe65d6..650136458f 100644 --- a/Chart.yaml +++ b/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 -name: syslog-ng-chart -description: A Helm chart for the Axoflow packaged syslog-ng image +name: syslog-ng-collector +description: syslog-ng kubernetes log collector type: application version: 0.1.0 appVersion: "4.1.1" diff --git a/templates/NOTES.txt b/templates/NOTES.txt index 2fb35809bb..1c86d22936 100644 --- a/templates/NOTES.txt +++ b/templates/NOTES.txt @@ -6,16 +6,16 @@ {{- end }} {{- end }} {{- else if contains "NodePort" .Values.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "syslog-ng-chart.fullname" . }}) + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "syslog-ng-collector.fullname" . }}) export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") echo http://$NODE_IP:$NODE_PORT {{- 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 --namespace {{ .Release.Namespace }} svc -w {{ include "syslog-ng-chart.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "syslog-ng-chart.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "syslog-ng-collector.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "syslog-ng-collector.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") echo http://$SERVICE_IP:{{ .Values.service.port }} {{- else if contains "ClusterIP" .Values.service.type }} - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "syslog-ng-chart.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "syslog-ng-collector.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") echo "Visit http://127.0.0.1:8080 to use your application" kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index b3968e5543..c39cde8075 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -1,7 +1,7 @@ {{/* Expand the name of the chart. */}} -{{- define "syslog-ng-chart.name" -}} +{{- define "syslog-ng-collector.name" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} {{- end }} @@ -10,7 +10,7 @@ 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 "syslog-ng-chart.fullname" -}} +{{- define "syslog-ng-collector.fullname" -}} {{- if .Values.fullnameOverride }} {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} {{- else }} @@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name. {{/* Create chart name and version as used by the chart label. */}} -{{- define "syslog-ng-chart.chart" -}} +{{- define "syslog-ng-collector.chart" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} {{- end }} {{/* Common labels */}} -{{- define "syslog-ng-chart.labels" -}} -helm.sh/chart: {{ include "syslog-ng-chart.chart" . }} -{{ include "syslog-ng-chart.selectorLabels" . }} +{{- define "syslog-ng-collector.labels" -}} +helm.sh/chart: {{ include "syslog-ng-collector.chart" . }} +{{ include "syslog-ng-collector.selectorLabels" . }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} @@ -45,17 +45,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }} {{/* Selector labels */}} -{{- define "syslog-ng-chart.selectorLabels" -}} -app.kubernetes.io/name: {{ include "syslog-ng-chart.name" . }} +{{- define "syslog-ng-collector.selectorLabels" -}} +app.kubernetes.io/name: {{ include "syslog-ng-collector.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} {{/* Create the name of the service account to use */}} -{{- define "syslog-ng-chart.serviceAccountName" -}} +{{- define "syslog-ng-collector.serviceAccountName" -}} {{- if .Values.serviceAccount.create }} -{{- default (include "syslog-ng-chart.fullname" .) .Values.serviceAccount.name }} +{{- default (include "syslog-ng-collector.fullname" .) .Values.serviceAccount.name }} {{- else }} {{- default "default" .Values.serviceAccount.name }} {{- end }} diff --git a/templates/config.yaml b/templates/config.yaml index 828c27d623..17aefa5405 100644 --- a/templates/config.yaml +++ b/templates/config.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: ConfigMap metadata: labels: - {{- include "syslog-ng-chart.labels" . | nindent 4 }} - name: {{ include "syslog-ng-chart.fullname" . }} + {{- include "syslog-ng-collector.labels" . | nindent 4 }} + name: {{ include "syslog-ng-collector.fullname" . }} data: syslog-ng.conf: {{ tpl (toYaml .Values.config) . | indent 4 }} diff --git a/templates/deployment.yaml b/templates/deployment.yaml index 4996addfba..3f539b6c6d 100644 --- a/templates/deployment.yaml +++ b/templates/deployment.yaml @@ -1,16 +1,16 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "syslog-ng-chart.fullname" . }} + name: {{ include "syslog-ng-collector.fullname" . }} labels: - {{- include "syslog-ng-chart.labels" . | nindent 4 }} + {{- include "syslog-ng-collector.labels" . | nindent 4 }} spec: {{- if not .Values.autoscaling.enabled }} replicas: {{ .Values.replicaCount }} {{- end }} selector: matchLabels: - {{- include "syslog-ng-chart.selectorLabels" . | nindent 6 }} + {{- include "syslog-ng-collector.selectorLabels" . | nindent 6 }} template: metadata: {{- with .Values.podAnnotations }} @@ -18,13 +18,13 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} labels: - {{- include "syslog-ng-chart.selectorLabels" . | nindent 8 }} + {{- include "syslog-ng-collector.selectorLabels" . | nindent 8 }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} - serviceAccountName: {{ include "syslog-ng-chart.serviceAccountName" . }} + serviceAccountName: {{ include "syslog-ng-collector.serviceAccountName" . }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: @@ -48,7 +48,7 @@ spec: volumes: - name: config configMap: - name: {{ include "syslog-ng-chart.fullname" . }} + name: {{ include "syslog-ng-collector.fullname" . }} - name: var-log-containers hostPath: path: /var/log/containers diff --git a/templates/serviceaccount.yaml b/templates/serviceaccount.yaml index 9c1ab76362..f6d6df3a80 100644 --- a/templates/serviceaccount.yaml +++ b/templates/serviceaccount.yaml @@ -2,9 +2,9 @@ apiVersion: v1 kind: ServiceAccount metadata: - name: {{ include "syslog-ng-chart.serviceAccountName" . }} + name: {{ include "syslog-ng-collector.serviceAccountName" . }} labels: - {{- include "syslog-ng-chart.labels" . | nindent 4 }} + {{- include "syslog-ng-collector.labels" . | nindent 4 }} {{- with .Values.serviceAccount.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/templates/tests/test-connection.yaml b/templates/tests/test-connection.yaml index 3ac73550d9..203b3a2b1e 100644 --- a/templates/tests/test-connection.yaml +++ b/templates/tests/test-connection.yaml @@ -1,9 +1,9 @@ apiVersion: v1 kind: Pod metadata: - name: "{{ include "syslog-ng-chart.fullname" . }}-test-connection" + name: "{{ include "syslog-ng-collector.fullname" . }}-test-connection" labels: - {{- include "syslog-ng-chart.labels" . | nindent 4 }} + {{- include "syslog-ng-collector.labels" . | nindent 4 }} annotations: "helm.sh/hook": test spec: @@ -12,5 +12,5 @@ spec: # - name: wget # image: busybox # command: ['wget'] - # args: ['{{ include "syslog-ng-chart.fullname" . }}:{{ .Values.service.port }}'] + # args: ['{{ include "syslog-ng-collector.fullname" . }}:{{ .Values.service.port }}'] restartPolicy: Never From 500eb77254a84a25614d98e18751520623778eda Mon Sep 17 00:00:00 2001 From: Attila Szakacs Date: Sat, 15 Apr 2023 15:14:08 +0200 Subject: [PATCH 05/51] syslog-ng-collector: move to charts/syslog-ng-collector Signed-off-by: Attila Szakacs --- .github/workflows/{ci.yml => syslog-ng-collector.yml} | 6 +++++- .helmignore => charts/syslog-ng-collector/.helmignore | 0 Chart.yaml => charts/syslog-ng-collector/Chart.yaml | 0 .../syslog-ng-collector/templates}/NOTES.txt | 0 .../syslog-ng-collector/templates}/_helpers.tpl | 0 .../syslog-ng-collector/templates}/config.yaml | 0 .../syslog-ng-collector/templates}/deployment.yaml | 0 .../syslog-ng-collector/templates}/serviceaccount.yaml | 0 .../templates}/tests/test-connection.yaml | 0 values.yaml => charts/syslog-ng-collector/values.yaml | 0 10 files changed, 5 insertions(+), 1 deletion(-) rename .github/workflows/{ci.yml => syslog-ng-collector.yml} (72%) rename .helmignore => charts/syslog-ng-collector/.helmignore (100%) rename Chart.yaml => charts/syslog-ng-collector/Chart.yaml (100%) rename {templates => charts/syslog-ng-collector/templates}/NOTES.txt (100%) rename {templates => charts/syslog-ng-collector/templates}/_helpers.tpl (100%) rename {templates => charts/syslog-ng-collector/templates}/config.yaml (100%) rename {templates => charts/syslog-ng-collector/templates}/deployment.yaml (100%) rename {templates => charts/syslog-ng-collector/templates}/serviceaccount.yaml (100%) rename {templates => charts/syslog-ng-collector/templates}/tests/test-connection.yaml (100%) rename values.yaml => charts/syslog-ng-collector/values.yaml (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/syslog-ng-collector.yml similarity index 72% rename from .github/workflows/ci.yml rename to .github/workflows/syslog-ng-collector.yml index e5ba676e8b..1fb306e785 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/syslog-ng-collector.yml @@ -2,8 +2,12 @@ on: push: pull_request: +defaults: + run: + working-directory: charts/syslog-ng-collector + jobs: - CI: + syslog-ng-collector: runs-on: ubuntu-latest steps: - name: Checkout source diff --git a/.helmignore b/charts/syslog-ng-collector/.helmignore similarity index 100% rename from .helmignore rename to charts/syslog-ng-collector/.helmignore diff --git a/Chart.yaml b/charts/syslog-ng-collector/Chart.yaml similarity index 100% rename from Chart.yaml rename to charts/syslog-ng-collector/Chart.yaml diff --git a/templates/NOTES.txt b/charts/syslog-ng-collector/templates/NOTES.txt similarity index 100% rename from templates/NOTES.txt rename to charts/syslog-ng-collector/templates/NOTES.txt diff --git a/templates/_helpers.tpl b/charts/syslog-ng-collector/templates/_helpers.tpl similarity index 100% rename from templates/_helpers.tpl rename to charts/syslog-ng-collector/templates/_helpers.tpl diff --git a/templates/config.yaml b/charts/syslog-ng-collector/templates/config.yaml similarity index 100% rename from templates/config.yaml rename to charts/syslog-ng-collector/templates/config.yaml diff --git a/templates/deployment.yaml b/charts/syslog-ng-collector/templates/deployment.yaml similarity index 100% rename from templates/deployment.yaml rename to charts/syslog-ng-collector/templates/deployment.yaml diff --git a/templates/serviceaccount.yaml b/charts/syslog-ng-collector/templates/serviceaccount.yaml similarity index 100% rename from templates/serviceaccount.yaml rename to charts/syslog-ng-collector/templates/serviceaccount.yaml diff --git a/templates/tests/test-connection.yaml b/charts/syslog-ng-collector/templates/tests/test-connection.yaml similarity index 100% rename from templates/tests/test-connection.yaml rename to charts/syslog-ng-collector/templates/tests/test-connection.yaml diff --git a/values.yaml b/charts/syslog-ng-collector/values.yaml similarity index 100% rename from values.yaml rename to charts/syslog-ng-collector/values.yaml From 5c17c4f872579874b4b5834bb5cdf5a4ac17b3b1 Mon Sep 17 00:00:00 2001 From: Attila Szakacs Date: Mon, 17 Apr 2023 11:05:52 +0200 Subject: [PATCH 06/51] collector: remove leftovers from unneeded templates Signed-off-by: Attila Szakacs --- .../syslog-ng-collector/templates/NOTES.txt | 24 ++----------------- charts/syslog-ng-collector/values.yaml | 23 ------------------ 2 files changed, 2 insertions(+), 45 deletions(-) diff --git a/charts/syslog-ng-collector/templates/NOTES.txt b/charts/syslog-ng-collector/templates/NOTES.txt index 1c86d22936..8fd3b29fa7 100644 --- a/charts/syslog-ng-collector/templates/NOTES.txt +++ b/charts/syslog-ng-collector/templates/NOTES.txt @@ -1,22 +1,2 @@ -1. Get the application URL by running these commands: -{{- if .Values.ingress.enabled }} -{{- range $host := .Values.ingress.hosts }} - {{- range .paths }} - http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} - {{- end }} -{{- end }} -{{- else if contains "NodePort" .Values.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "syslog-ng-collector.fullname" . }}) - export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") - echo http://$NODE_IP:$NODE_PORT -{{- 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 --namespace {{ .Release.Namespace }} svc -w {{ include "syslog-ng-collector.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "syslog-ng-collector.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") - echo http://$SERVICE_IP:{{ .Values.service.port }} -{{- else if contains "ClusterIP" .Values.service.type }} - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "syslog-ng-collector.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") - export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") - echo "Visit http://127.0.0.1:8080 to use your application" - kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT -{{- end }} +1. Watch the {{ template "syslog-ng-collector.fullname" . }} container start. + $ kubectl get pods --namespace={{ .Release.Namespace }} -l app={{ template "syslog-ng-collector.fullname" . }} -w diff --git a/charts/syslog-ng-collector/values.yaml b/charts/syslog-ng-collector/values.yaml index d5234d825f..008799b61f 100644 --- a/charts/syslog-ng-collector/values.yaml +++ b/charts/syslog-ng-collector/values.yaml @@ -41,32 +41,9 @@ serviceAccount: name: "" podAnnotations: {} - podSecurityContext: {} - securityContext: {} - -service: - type: ClusterIP - -ingress: - enabled: false - className: "" - annotations: {} - hosts: {} - tls: [] - resources: {} - -autoscaling: - enabled: false - minReplicas: 1 - maxReplicas: 100 - targetCPUUtilizationPercentage: 80 - targetMemoryUtilizationPercentage: 80 - nodeSelector: {} - tolerations: [] - affinity: {} From 7dcf240548e67dccb42730284e5001b751d10f79 Mon Sep 17 00:00:00 2001 From: Attila Szakacs Date: Mon, 17 Apr 2023 11:06:57 +0200 Subject: [PATCH 07/51] collector: change deployment to daemonset Signed-off-by: Attila Szakacs --- .../templates/daemonset.yaml | 123 ++++++++++++++++++ .../templates/deployment.yaml | 72 ---------- charts/syslog-ng-collector/values.yaml | 22 ++++ 3 files changed, 145 insertions(+), 72 deletions(-) create mode 100644 charts/syslog-ng-collector/templates/daemonset.yaml delete mode 100644 charts/syslog-ng-collector/templates/deployment.yaml diff --git a/charts/syslog-ng-collector/templates/daemonset.yaml b/charts/syslog-ng-collector/templates/daemonset.yaml new file mode 100644 index 0000000000..ffa0f13a19 --- /dev/null +++ b/charts/syslog-ng-collector/templates/daemonset.yaml @@ -0,0 +1,123 @@ +{{- if .Values.daemonset.enabled }} +--- +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: {{ template "syslog-ng-collector.fullname" . }} + labels: + app: "{{ template "syslog-ng-collector.fullname" . }}" + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + heritage: {{ .Release.Service | quote }} + release: {{ .Release.Name | quote }} + {{- if .Values.daemonset.labels }} + {{- range $key, $value := .Values.daemonset.labels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- end }} + {{- if .Values.daemonset.annotations }} + annotations: + {{- range $key, $value := .Values.daemonset.annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- end }} +spec: + selector: + matchLabels: + app: "{{ template "syslog-ng-collector.fullname" . }}" + release: {{ .Release.Name | quote }} + updateStrategy: + {{- if eq .Values.updateStrategy "RollingUpdate" }} + rollingUpdate: + maxUnavailable: {{ .Values.daemonset.maxUnavailable }} + {{- end }} + type: {{ .Values.updateStrategy }} + template: + metadata: + {{- if .Values.podAnnotation }} + annotations: + {{- range $key, $value := .Values.podAnnotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- end }} + name: "{{ template "syslog-ng-collector.fullname" . }}" + labels: + app: "{{ template "syslog-ng-collector.fullname" . }}" + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + heritage: {{ .Release.Service | quote }} + release: {{ .Release.Name | quote }} + {{- if .Values.daemonset.labels }} + {{- range $key, $value := .Values.daemonset.labels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- end }} + spec: + tolerations: {{ toYaml ( .Values.tolerations | default .Values.daemonset.tolerations ) | nindent 8 }} + nodeSelector: {{ toYaml ( .Values.nodeSelector | default .Values.daemonset.nodeSelector ) | nindent 8 }} + {{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName }} + {{- end }} + affinity: {{ toYaml ( .Values.affinity | default .Values.daemonset.affinity ) | nindent 8 }} + terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }} + {{- if .Values.daemonset.hostNetworking }} + hostNetwork: true + dnsPolicy: ClusterFirstWithHostNet + {{- end }} + {{- if .Values.dnsConfig }} + dnsConfig: {{ toYaml .Values.dnsConfig | nindent 8 }} + {{- end }} + {{- if .Values.hostAliases | default .Values.daemonset.hostAliases }} + hostAliases: {{ toYaml ( .Values.hostAliases | default .Values.daemonset.hostAliases ) | nindent 8 }} + {{- end }} + volumes: + {{- range .Values.secretMounts | default .Values.daemonset.secretMounts }} + - name: {{ .name }} + secret: + secretName: {{ .secretName }} + {{- end }} + - name: config + configMap: + name: {{ include "syslog-ng-collector.fullname" . }} + - name: var-log + hostPath: + path: /var/log + - name: var-lib-docker-containers + hostPath: + path: /var/lib/docker/containers + - name: var-run-docker-sock + hostPath: + path: /var/run/docker.sock + {{- if .Values.extraVolumes | default .Values.daemonset.extraVolumes }} +{{ toYaml ( .Values.extraVolumes | default .Values.daemonset.extraVolumes ) | indent 8 }} + {{- end }} + {{- if .Values.imagePullSecrets }} + imagePullSecrets: +{{ toYaml .Values.imagePullSecrets | indent 8 }} + {{- end }} + containers: + - name: "syslog-ng-collector" + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: "{{ .Values.image.pullPolicy }}" + resources: +{{ toYaml ( .Values.resources | default .Values.daemonset.resources ) | indent 12 }} + securityContext: {{ toYaml ( .Values.podSecurityContext | default .Values.daemonset.securityContext ) | nindent 12 }} + volumeMounts: + {{- range .Values.secretMounts | default .Values.daemonset.secretMounts }} + - name: {{ .name }} + mountPath: {{ .path }} + {{- if .subPath }} + subPath: {{ .subPath }} + {{- end }} + {{- end }} + - name: config + mountPath: /etc/syslog-ng/syslog-ng.conf + subPath: syslog-ng.conf + - name: var-log + mountPath: /var/log + - name: var-lib-docker-containers + mountPath: /var/lib/docker/containers + - name: var-run-docker-sock + mountPath: /var/run/docker.sock + {{- if .Values.extraVolumeMounts | default .Values.daemonset.extraVolumeMounts }} +{{ toYaml (.Values.extraVolumeMounts | default .Values.daemonset.extraVolumeMounts ) | indent 12 }} + {{- end }} +{{- end }} diff --git a/charts/syslog-ng-collector/templates/deployment.yaml b/charts/syslog-ng-collector/templates/deployment.yaml deleted file mode 100644 index 3f539b6c6d..0000000000 --- a/charts/syslog-ng-collector/templates/deployment.yaml +++ /dev/null @@ -1,72 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "syslog-ng-collector.fullname" . }} - labels: - {{- include "syslog-ng-collector.labels" . | nindent 4 }} -spec: - {{- if not .Values.autoscaling.enabled }} - replicas: {{ .Values.replicaCount }} - {{- end }} - selector: - matchLabels: - {{- include "syslog-ng-collector.selectorLabels" . | nindent 6 }} - template: - metadata: - {{- with .Values.podAnnotations }} - annotations: - {{- toYaml . | nindent 8 }} - {{- end }} - labels: - {{- include "syslog-ng-collector.selectorLabels" . | nindent 8 }} - spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - serviceAccountName: {{ include "syslog-ng-collector.serviceAccountName" . }} - securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} - containers: - - name: {{ .Chart.Name }} - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - volumeMounts: - - name: config - mountPath: /etc/syslog-ng/syslog-ng.conf - subPath: syslog-ng.conf - - name: var-log-containers - mountPath: /var/log/containers - - name: var-log-pods - mountPath: /var/log/pods - - name: var-lib-docker-containers - mountPath: /var/lib/docker/containers - resources: - {{- toYaml .Values.resources | nindent 12 }} - volumes: - - name: config - configMap: - name: {{ include "syslog-ng-collector.fullname" . }} - - name: var-log-containers - hostPath: - path: /var/log/containers - - name: var-log-pods - hostPath: - path: /var/log/pods - - name: var-lib-docker-containers - hostPath: - path: /var/lib/docker/containers - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} diff --git a/charts/syslog-ng-collector/values.yaml b/charts/syslog-ng-collector/values.yaml index 008799b61f..717d327217 100644 --- a/charts/syslog-ng-collector/values.yaml +++ b/charts/syslog-ng-collector/values.yaml @@ -9,6 +9,21 @@ imagePullSecrets: [] nameOverride: "" fullnameOverride: "" +daemonset: + enabled: true + labels: {} + annotations: {} + affinity: {} + nodeSelector: {} + resources: {} + tolerations: [] + hostAliases: [] + secretMounts: [] + extraVolumes: [] + securityContext: {} + maxUnavailable: 1 + hostNetworking: false + config: | @version: 4.1 @include "scl.conf" @@ -47,3 +62,10 @@ resources: {} nodeSelector: {} tolerations: [] affinity: {} +updateStrategy: RollingUpdate +priorityClassName: "" +dnsConfig: {} +hostAliases: [] +secretMounts: [] +extraVolumes: [] +terminationGracePeriodSeconds: 30 From be8691ab9dc403c78c821ab74693fa46b6c2eafa Mon Sep 17 00:00:00 2001 From: Attila Szakacs Date: Mon, 17 Apr 2023 11:08:01 +0200 Subject: [PATCH 08/51] collector: remove tests We will introduce it later with proper checks Signed-off-by: Attila Szakacs --- .../templates/tests/test-connection.yaml | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 charts/syslog-ng-collector/templates/tests/test-connection.yaml diff --git a/charts/syslog-ng-collector/templates/tests/test-connection.yaml b/charts/syslog-ng-collector/templates/tests/test-connection.yaml deleted file mode 100644 index 203b3a2b1e..0000000000 --- a/charts/syslog-ng-collector/templates/tests/test-connection.yaml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: v1 -kind: Pod -metadata: - name: "{{ include "syslog-ng-collector.fullname" . }}-test-connection" - labels: - {{- include "syslog-ng-collector.labels" . | nindent 4 }} - annotations: - "helm.sh/hook": test -spec: - containers: {} - # ctl healtcheck - # - name: wget - # image: busybox - # command: ['wget'] - # args: ['{{ include "syslog-ng-collector.fullname" . }}:{{ .Values.service.port }}'] - restartPolicy: Never From 745f32a6c814eb4a47b61fb4e9877d93eb1cbeca Mon Sep 17 00:00:00 2001 From: Attila Szakacs Date: Mon, 17 Apr 2023 11:16:25 +0200 Subject: [PATCH 09/51] LICENSE: add Apache 2 license Signed-off-by: Attila Szakacs --- LICENSE | 201 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. From b6c1ca524d9d41380c2ca8f3e3edc66f9998626c Mon Sep 17 00:00:00 2001 From: Attila Szakacs Date: Mon, 17 Apr 2023 13:34:34 +0200 Subject: [PATCH 10/51] collector: add RBAC for serviceAccount Signed-off-by: Attila Szakacs --- .../templates/daemonset.yaml | 3 +++ .../templates/serviceaccount.yaml | 24 +++++++++++++++++++ charts/syslog-ng-collector/values.yaml | 3 ++- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/charts/syslog-ng-collector/templates/daemonset.yaml b/charts/syslog-ng-collector/templates/daemonset.yaml index ffa0f13a19..3fe0796354 100644 --- a/charts/syslog-ng-collector/templates/daemonset.yaml +++ b/charts/syslog-ng-collector/templates/daemonset.yaml @@ -51,6 +51,9 @@ spec: {{- end }} {{- end }} spec: + {{- if .Values.serviceAccount.create }} + serviceAccountName: {{ template "syslog-ng-collector.serviceAccountName" . }} + {{- end}} tolerations: {{ toYaml ( .Values.tolerations | default .Values.daemonset.tolerations ) | nindent 8 }} nodeSelector: {{ toYaml ( .Values.nodeSelector | default .Values.daemonset.nodeSelector ) | nindent 8 }} {{- if .Values.priorityClassName }} diff --git a/charts/syslog-ng-collector/templates/serviceaccount.yaml b/charts/syslog-ng-collector/templates/serviceaccount.yaml index f6d6df3a80..4ee70208c6 100644 --- a/charts/syslog-ng-collector/templates/serviceaccount.yaml +++ b/charts/syslog-ng-collector/templates/serviceaccount.yaml @@ -9,4 +9,28 @@ metadata: annotations: {{- toYaml . | nindent 4 }} {{- end }} +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ include "syslog-ng-collector.serviceAccountName" . }} +rules: + - apiGroups: [""] + resources: ["pods"] + verbs: ["get", "watch", "list"] + {{- if .Values.serviceAccount.extraRules }} +{{ toYaml ( .Values.serviceAccount.extraRules ) | indent 2 }} + {{- end }} +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: {{ include "syslog-ng-collector.serviceAccountName" . }} +subjects: + - kind: ServiceAccount + name: {{ include "syslog-ng-collector.serviceAccountName" . }} + namespace: {{ .Values.namespace | default .Release.Namespace | quote }} +roleRef: + kind: ClusterRole + name: {{ include "syslog-ng-collector.serviceAccountName" . }} {{- end }} diff --git a/charts/syslog-ng-collector/values.yaml b/charts/syslog-ng-collector/values.yaml index 717d327217..68d621e7a1 100644 --- a/charts/syslog-ng-collector/values.yaml +++ b/charts/syslog-ng-collector/values.yaml @@ -53,8 +53,9 @@ config: | serviceAccount: create: true annotations: {} - name: "" + extraRules: [] +namespace: "" podAnnotations: {} podSecurityContext: {} securityContext: {} From 7aec9cfb0acbbe1eb88ff9bc64a80a3489936ff4 Mon Sep 17 00:00:00 2001 From: Attila Szakacs Date: Mon, 17 Apr 2023 13:46:36 +0200 Subject: [PATCH 11/51] collector: use .Values.namespace everywhere Signed-off-by: Attila Szakacs --- charts/syslog-ng-collector/templates/_helpers.tpl | 4 ++++ charts/syslog-ng-collector/templates/daemonset.yaml | 1 + charts/syslog-ng-collector/templates/serviceaccount.yaml | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/charts/syslog-ng-collector/templates/_helpers.tpl b/charts/syslog-ng-collector/templates/_helpers.tpl index c39cde8075..f143ace4e0 100644 --- a/charts/syslog-ng-collector/templates/_helpers.tpl +++ b/charts/syslog-ng-collector/templates/_helpers.tpl @@ -60,3 +60,7 @@ Create the name of the service account to use {{- default "default" .Values.serviceAccount.name }} {{- end }} {{- end }} + +{{- define "syslog-ng-collector.namespace" -}} +{{ .Values.namespace | default .Release.Namespace }} +{{- end -}} diff --git a/charts/syslog-ng-collector/templates/daemonset.yaml b/charts/syslog-ng-collector/templates/daemonset.yaml index 3fe0796354..f27e36afd8 100644 --- a/charts/syslog-ng-collector/templates/daemonset.yaml +++ b/charts/syslog-ng-collector/templates/daemonset.yaml @@ -4,6 +4,7 @@ apiVersion: apps/v1 kind: DaemonSet metadata: name: {{ template "syslog-ng-collector.fullname" . }} + namespace: {{ include "syslog-ng-collector.namespace" . }} labels: app: "{{ template "syslog-ng-collector.fullname" . }}" chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" diff --git a/charts/syslog-ng-collector/templates/serviceaccount.yaml b/charts/syslog-ng-collector/templates/serviceaccount.yaml index 4ee70208c6..bf14d7e011 100644 --- a/charts/syslog-ng-collector/templates/serviceaccount.yaml +++ b/charts/syslog-ng-collector/templates/serviceaccount.yaml @@ -3,6 +3,7 @@ apiVersion: v1 kind: ServiceAccount metadata: name: {{ include "syslog-ng-collector.serviceAccountName" . }} + namespace: {{ include "syslog-ng-collector.namespace" . }} labels: {{- include "syslog-ng-collector.labels" . | nindent 4 }} {{- with .Values.serviceAccount.annotations }} @@ -29,7 +30,7 @@ metadata: subjects: - kind: ServiceAccount name: {{ include "syslog-ng-collector.serviceAccountName" . }} - namespace: {{ .Values.namespace | default .Release.Namespace | quote }} + namespace: {{ include "syslog-ng-collector.namespace" . }} roleRef: kind: ClusterRole name: {{ include "syslog-ng-collector.serviceAccountName" . }} From 0ce5c0781e63d1957e13cb98198fadd128c9383b Mon Sep 17 00:00:00 2001 From: Attila Szakacs Date: Tue, 18 Apr 2023 10:07:36 +0200 Subject: [PATCH 12/51] collector: add option to set srcs and dests in yaml format Signed-off-by: Attila Szakacs --- .../syslog-ng-collector/templates/config.yaml | 23 +++++++++++- charts/syslog-ng-collector/values.yaml | 36 ++++++------------- 2 files changed, 33 insertions(+), 26 deletions(-) diff --git a/charts/syslog-ng-collector/templates/config.yaml b/charts/syslog-ng-collector/templates/config.yaml index 17aefa5405..b51af715d4 100644 --- a/charts/syslog-ng-collector/templates/config.yaml +++ b/charts/syslog-ng-collector/templates/config.yaml @@ -5,4 +5,25 @@ metadata: {{- include "syslog-ng-collector.labels" . | nindent 4 }} name: {{ include "syslog-ng-collector.fullname" . }} data: - syslog-ng.conf: {{ tpl (toYaml .Values.config) . | indent 4 }} +{{- if .Values.config.raw }} + syslog-ng.conf: {{ tpl (toYaml .Values.config.raw) . | indent 4 }} +{{- else }} + syslog-ng.conf: | + @version: {{ regexFind "^[0-9]+\\.[0-9]+" .Chart.AppVersion }} + @include "scl.conf" + + options { + stats( + level(1) + ); + }; + + log { +{{- if .Values.config.sources.kubernetes.enabled }} + source { kubernetes(); }; +{{- end }} +{{- range .Values.config.destinations.network }} + destination { network({{ .address | quote }} port({{ .port }}) transport({{ .transport }})); }; +{{- end }} + }; +{{- end }} diff --git a/charts/syslog-ng-collector/values.yaml b/charts/syslog-ng-collector/values.yaml index 68d621e7a1..859c89baf9 100644 --- a/charts/syslog-ng-collector/values.yaml +++ b/charts/syslog-ng-collector/values.yaml @@ -24,31 +24,17 @@ daemonset: maxUnavailable: 1 hostNetworking: false -config: | - @version: 4.1 - @include "scl.conf" - - options { - stats( - level(1) - ); - }; - - source s_kubernetes { - kubernetes(); - }; - - destination d_local { # TODO: where should we send our logs? - file("/tmp/out.log"); - }; - - log { - source(s_kubernetes); - destination(d_local); - }; - -# TODO: kubernetes src should have a toggle -# TODO: syslog-ng-ctl healthcheck should be called somewhere +config: + raw: "" # Use this to manually set the contents of the syslog-ng.conf file. + sources: + kubernetes: + enabled: true + destinations: + network: [] +# E.g.: +# - transport: tcp +# address: localhost +# port: 12345 serviceAccount: create: true From 1276878f582831afcd400d9e8fe544f94115aa47 Mon Sep 17 00:00:00 2001 From: Attila Szakacs Date: Tue, 18 Apr 2023 14:21:07 +0200 Subject: [PATCH 13/51] collector: add opensearch destination option Signed-off-by: Attila Szakacs --- .../syslog-ng-collector/templates/config.yaml | 36 +++++++++++++++++++ charts/syslog-ng-collector/values.yaml | 12 +++++++ 2 files changed, 48 insertions(+) diff --git a/charts/syslog-ng-collector/templates/config.yaml b/charts/syslog-ng-collector/templates/config.yaml index b51af715d4..37136c454e 100644 --- a/charts/syslog-ng-collector/templates/config.yaml +++ b/charts/syslog-ng-collector/templates/config.yaml @@ -24,6 +24,42 @@ data: {{- end }} {{- range .Values.config.destinations.network }} destination { network({{ .address | quote }} port({{ .port }}) transport({{ .transport }})); }; +{{- end }} +{{- range .Values.config.destinations.opensearch }} + destination { + elasticsearch-http( + url("https://{{ .address }}:9200/_bulk") + index({{ .index | quote }}) + type("") + {{- if .user }} + user({{ .user | quote }}) + {{- end }} + {{- if .password }} + password({{ .password | quote }}) + {{- end }} + {{- if .tls }} + tls( + {{- if .tls.CAFile }} + ca-file({{ .tls.CAFile }}) + {{- end }} + {{- if .tls.CADir }} + ca-dir({{ .tls.CADir }}) + {{- end }} + {{- if .tls.Cert }} + cert-file({{ .tls.Cert }}) + {{- end }} + {{- if .tls.Key }} + key-file({{ .tls.Key }}) + {{- end }} + {{- if .tls.peerVerify }} + peer-verify(yes) + {{- else }} + peer-verify(no) + {{- end }} + ) + {{- end }} + ); + }; {{- end }} }; {{- end }} diff --git a/charts/syslog-ng-collector/values.yaml b/charts/syslog-ng-collector/values.yaml index 859c89baf9..149ce11bc0 100644 --- a/charts/syslog-ng-collector/values.yaml +++ b/charts/syslog-ng-collector/values.yaml @@ -35,6 +35,18 @@ config: # - transport: tcp # address: localhost # port: 12345 + opensearch: [] +# E.g.: +# - address: 10.104.232.94 +# index: "test-axoflow-index" +# user: "admin" +# password: "admin" +# tls: +# CAFile: "/path/to/CAFile.pem" +# CADir: "/path/to/CADir/" +# Cert: "/path/to/Cert.pem" +# Key: "/path/to/Key.pem" +# peerVerify: false serviceAccount: create: true From 7deaef108a1b0fe7beca14bab438cc4dbeb7cbe4 Mon Sep 17 00:00:00 2001 From: Attila Szakacs Date: Tue, 18 Apr 2023 15:18:09 +0200 Subject: [PATCH 14/51] collector: add template option to destinations Signed-off-by: Attila Szakacs --- charts/syslog-ng-collector/templates/config.yaml | 14 +++++++++++++- charts/syslog-ng-collector/values.yaml | 2 ++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/charts/syslog-ng-collector/templates/config.yaml b/charts/syslog-ng-collector/templates/config.yaml index 37136c454e..12fd524919 100644 --- a/charts/syslog-ng-collector/templates/config.yaml +++ b/charts/syslog-ng-collector/templates/config.yaml @@ -23,7 +23,16 @@ data: source { kubernetes(); }; {{- end }} {{- range .Values.config.destinations.network }} - destination { network({{ .address | quote }} port({{ .port }}) transport({{ .transport }})); }; + destination { + network( + {{ .address | quote }} + port({{ .port }}) + transport({{ .transport }}) + {{- if .template }} + template({{ .template | quote }}) + {{- end }} + ); + }; {{- end }} {{- range .Values.config.destinations.opensearch }} destination { @@ -31,6 +40,9 @@ data: url("https://{{ .address }}:9200/_bulk") index({{ .index | quote }}) type("") + {{- if .template }} + template({{ .template | quote }}) + {{- end }} {{- if .user }} user({{ .user | quote }}) {{- end }} diff --git a/charts/syslog-ng-collector/values.yaml b/charts/syslog-ng-collector/values.yaml index 149ce11bc0..7413b2ce6b 100644 --- a/charts/syslog-ng-collector/values.yaml +++ b/charts/syslog-ng-collector/values.yaml @@ -35,6 +35,7 @@ config: # - transport: tcp # address: localhost # port: 12345 +# template: "$(format-json .*)" opensearch: [] # E.g.: # - address: 10.104.232.94 @@ -47,6 +48,7 @@ config: # Cert: "/path/to/Cert.pem" # Key: "/path/to/Key.pem" # peerVerify: false +# template: "$(format-json .*)" serviceAccount: create: true From a778f55f74c005073230a14d96c6b977cf7d8c84 Mon Sep 17 00:00:00 2001 From: Ferenc HERNADI Date: Tue, 18 Apr 2023 23:27:51 +0200 Subject: [PATCH 15/51] rbac separation, readme small fjxes --- charts/syslog-ng-collector/README.md | 51 +++++++++++++++++++ .../templates/clusterrole.yaml | 23 +++++++++ .../templates/clusterrolebinding.yaml | 13 +++++ charts/syslog-ng-collector/templates/scc.yaml | 37 ++++++++++++++ charts/syslog-ng-collector/values.yaml | 22 ++++++-- 5 files changed, 143 insertions(+), 3 deletions(-) create mode 100644 charts/syslog-ng-collector/README.md create mode 100644 charts/syslog-ng-collector/templates/clusterrole.yaml create mode 100644 charts/syslog-ng-collector/templates/clusterrolebinding.yaml create mode 100644 charts/syslog-ng-collector/templates/scc.yaml diff --git a/charts/syslog-ng-collector/README.md b/charts/syslog-ng-collector/README.md new file mode 100644 index 0000000000..3af9ab97ba --- /dev/null +++ b/charts/syslog-ng-collector/README.md @@ -0,0 +1,51 @@ +# Syslog-ng Collector + +Syslog-ng kubernetes log collector. + +## Prerequisites + +- Kubernetes 1.16+ +- Helm 3.0+ + + +## Configuration +The following table lists the configurable parameters of the Syslog-ng Collector chart and their default values: + + +| Parameter | Description | Default | +| --------- | ----------- | ------- | +| image.repository | The container image repository | ghcr.io/axoflow/syslog-ng | +| image.pullPolicy | The container image pull policy | IfNotPresent | +| image.tag | The container image tag | 4.1.1 | +| imagePullSecrets | The names of secrets containing private registry credentials | [] | +| nameOverride | Override the chart name | "" | +| fullnameOverride | Override the full chart name | "" | +| daemonset.enabled | Deploy Syslog-ng as a DaemonSet | true | +| daemonset.labels | Additional labels to apply to the DaemonSet | {} | +| daemonset.annotations | Additional annotations to apply to the DaemonSet | {} | +| daemonset.affinity | Pod affinity | {} | +| daemonset.nodeSelector | Node labels for pod assignment | {} | +| daemonset.resources | Resource requests and limits | {} | +| daemonset.tolerations | Tolerations for pod assignment | [] | +| daemonset.hostAliases | Add host aliases | [] | +| daemonset.secretMounts | Mount additional secrets as volumes | [] | +| daemonset.extraVolumes | Additional volumes to mount | [] | +| daemonset.securityContext | Security context for the pod | {} | +| daemonset.maxUnavailable | The maximum number of unavailable pods during a rolling update | 1 | +| daemonset.hostNetworking | Whether to enable host networking | false | +| rbac.create | Whether to create RBAC resources | false | +| rbac.extraRules | Additional RBAC rules | [] | +| openShift.enabled | Whether to deploy on OpenShift | false | +| openShift.securityContextConstraints.create | Whether to create SecurityContextConstraints on OpenShift | true | +| openShift.securityContextConstraints.annotations | Annotations to apply to SecurityContextConstraints | {} | +| serviceAccount.create | Whether to create a service account | false | +| serviceAccount.annotations | Annotations to apply to the service account | {} | +| namespace | The Kubernetes namespace to deploy to | "" | +| podAnnotations | Additional annotations to apply to the pod | {} | +| podSecurityContext | Security context for the pod | {} | +| securityContext | Security context for the container | {} | +| resources | Resource requests and limits for the container | {} | +| nodeSelector | Node labels for pod assignment | {} | +| tolerations | Tolerations for pod assignment | [] | +| affinity | Pod affinity | {} | +| updateStrategy | Update strategy for the DaemonSet | RollingUpdate | diff --git a/charts/syslog-ng-collector/templates/clusterrole.yaml b/charts/syslog-ng-collector/templates/clusterrole.yaml new file mode 100644 index 0000000000..5dca177f04 --- /dev/null +++ b/charts/syslog-ng-collector/templates/clusterrole.yaml @@ -0,0 +1,23 @@ +{{- if .Values.rbac.create -}} +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ include "syslog-ng-collector.serviceAccountName" . }} +rules: + - apiGroups: [""] + resources: ["pods"] + verbs: ["get", "watch", "list"] + {{- if .Values.rbac.extraRules }} +{{ toYaml ( .Values.rbac.extraRules ) | indent 2 }} + {{- end }} + {{- if and .Values.openShift.enabled .Values.openShift.securityContextConstraints.create }} + - apiGroups: + - security.openshift.io + resources: + - securitycontextconstraints + resourceNames: + - {{ template "syslog-ng-collector.fullname" . }} + verbs: + - use + {{- end }} +{{- end -}} diff --git a/charts/syslog-ng-collector/templates/clusterrolebinding.yaml b/charts/syslog-ng-collector/templates/clusterrolebinding.yaml new file mode 100644 index 0000000000..365b3f9344 --- /dev/null +++ b/charts/syslog-ng-collector/templates/clusterrolebinding.yaml @@ -0,0 +1,13 @@ +{{- if .Values.rbac.create -}} +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: {{ include "syslog-ng-collector.serviceAccountName" . }} +subjects: + - kind: ServiceAccount + name: {{ include "syslog-ng-collector.serviceAccountName" . }} + namespace: {{ include "syslog-ng-collector.namespace" . }} +roleRef: + kind: ClusterRole + name: {{ include "syslog-ng-collector.serviceAccountName" . }} +{{- end -}} diff --git a/charts/syslog-ng-collector/templates/scc.yaml b/charts/syslog-ng-collector/templates/scc.yaml new file mode 100644 index 0000000000..4a8f87786d --- /dev/null +++ b/charts/syslog-ng-collector/templates/scc.yaml @@ -0,0 +1,37 @@ +{{- if and .Values.openShift.enabled .Values.openShift.securityContextConstraints.create }} +apiVersion: security.openshift.io/v1 +kind: SecurityContextConstraints +metadata: + name: {{ template "syslog-ng-collector.fullname" . }} +{{- if .Values.openShift.securityContextConstraints.annotations }} + annotations: + {{- toYaml .Values.openShift.securityContextConstraints.annotations | nindent 4 }} +{{- end }} +allowPrivilegedContainer: true +allowPrivilegeEscalation: true +allowHostDirVolumePlugin: true +defaultAllowPrivilegeEscalation: false +# forbid host namespaces +allowHostNetwork: false +allowHostIPC: false +allowHostPorts: false +allowHostPID: false +allowedCapabilities: [] +forbiddenSysctls: +- "*" +readOnlyRootFilesystem: false +requiredDropCapabilities: +- MKNOD +runAsUser: + type: RunAsAny +seLinuxContext: + type: MustRunAs +supplementalGroups: + type: RunAsAny +volumes: + - configMap + - emptyDir + - hostPath + - persistentVolumeClaim + - secret +{{- end }} \ No newline at end of file diff --git a/charts/syslog-ng-collector/values.yaml b/charts/syslog-ng-collector/values.yaml index 68d621e7a1..06a099913b 100644 --- a/charts/syslog-ng-collector/values.yaml +++ b/charts/syslog-ng-collector/values.yaml @@ -1,5 +1,3 @@ -replicaCount: 1 - image: repository: ghcr.io/axoflow/syslog-ng pullPolicy: IfNotPresent @@ -50,16 +48,32 @@ config: | # TODO: kubernetes src should have a toggle # TODO: syslog-ng-ctl healthcheck should be called somewhere +rbac: + create: true + extraRules: [] + +openShift: + enabled: false + securityContextConstraints: + create: true + annotations: {} + serviceAccount: create: true annotations: {} - extraRules: [] namespace: "" podAnnotations: {} podSecurityContext: {} +# fsGroup: 2000 securityContext: {} resources: {} +# limits: +# cpu: 100m +# memory: 128Mi +# requests: +# cpu: 100m +# memory: 128Mi nodeSelector: {} tolerations: [] affinity: {} @@ -69,4 +83,6 @@ dnsConfig: {} hostAliases: [] secretMounts: [] extraVolumes: [] +## How long (in seconds) a pod may take to exit (useful with lifecycle hooks to ensure lb deregistration is done) +## terminationGracePeriodSeconds: 30 From 4604d8c1f08c588633a7e125759be29a1bd0e79d Mon Sep 17 00:00:00 2001 From: Attila Szakacs Date: Wed, 19 Apr 2023 13:00:50 +0200 Subject: [PATCH 16/51] collector: add liveness probe Signed-off-by: Attila Szakacs --- charts/syslog-ng-collector/templates/daemonset.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/charts/syslog-ng-collector/templates/daemonset.yaml b/charts/syslog-ng-collector/templates/daemonset.yaml index f27e36afd8..4c32c386d3 100644 --- a/charts/syslog-ng-collector/templates/daemonset.yaml +++ b/charts/syslog-ng-collector/templates/daemonset.yaml @@ -124,4 +124,7 @@ spec: {{- if .Values.extraVolumeMounts | default .Values.daemonset.extraVolumeMounts }} {{ toYaml (.Values.extraVolumeMounts | default .Values.daemonset.extraVolumeMounts ) | indent 12 }} {{- end }} + livenessProbe: + exec: + command: ["syslog-ng-ctl", "healthcheck", "--timeout", "1"] {{- end }} From c3ffe9eb08cec54670d3e8c93ccfa9cfa08ac48d Mon Sep 17 00:00:00 2001 From: Attila Szakacs Date: Wed, 19 Apr 2023 13:08:55 +0200 Subject: [PATCH 17/51] collector: make it possible to set config version Signed-off-by: Attila Szakacs --- charts/syslog-ng-collector/templates/config.yaml | 2 +- charts/syslog-ng-collector/templates/daemonset.yaml | 2 +- charts/syslog-ng-collector/values.yaml | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/charts/syslog-ng-collector/templates/config.yaml b/charts/syslog-ng-collector/templates/config.yaml index 12fd524919..a7e3ba465d 100644 --- a/charts/syslog-ng-collector/templates/config.yaml +++ b/charts/syslog-ng-collector/templates/config.yaml @@ -9,7 +9,7 @@ data: syslog-ng.conf: {{ tpl (toYaml .Values.config.raw) . | indent 4 }} {{- else }} syslog-ng.conf: | - @version: {{ regexFind "^[0-9]+\\.[0-9]+" .Chart.AppVersion }} + @version: {{ regexFind "^[0-9]+\\.[0-9]+" (.Values.config.version | default .Values.image.tag | default .Chart.AppVersion ) }} @include "scl.conf" options { diff --git a/charts/syslog-ng-collector/templates/daemonset.yaml b/charts/syslog-ng-collector/templates/daemonset.yaml index 4c32c386d3..c6fe60bc3a 100644 --- a/charts/syslog-ng-collector/templates/daemonset.yaml +++ b/charts/syslog-ng-collector/templates/daemonset.yaml @@ -99,7 +99,7 @@ spec: {{- end }} containers: - name: "syslog-ng-collector" - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: "{{ .Values.image.pullPolicy }}" resources: {{ toYaml ( .Values.resources | default .Values.daemonset.resources ) | indent 12 }} diff --git a/charts/syslog-ng-collector/values.yaml b/charts/syslog-ng-collector/values.yaml index 7413b2ce6b..6df6363d2a 100644 --- a/charts/syslog-ng-collector/values.yaml +++ b/charts/syslog-ng-collector/values.yaml @@ -3,7 +3,7 @@ replicaCount: 1 image: repository: ghcr.io/axoflow/syslog-ng pullPolicy: IfNotPresent - tag: "4.1.1" + tag: "" imagePullSecrets: [] nameOverride: "" @@ -26,6 +26,7 @@ daemonset: config: raw: "" # Use this to manually set the contents of the syslog-ng.conf file. + version: "" sources: kubernetes: enabled: true From 2798e665e273f9fca6e12027a4d4af23f4c2b212 Mon Sep 17 00:00:00 2001 From: Ferenc HERNADI Date: Wed, 19 Apr 2023 14:23:19 +0200 Subject: [PATCH 18/51] SA definition update --- .../templates/serviceaccount.yaml | 24 ------------------- 1 file changed, 24 deletions(-) diff --git a/charts/syslog-ng-collector/templates/serviceaccount.yaml b/charts/syslog-ng-collector/templates/serviceaccount.yaml index bf14d7e011..303b4bbf70 100644 --- a/charts/syslog-ng-collector/templates/serviceaccount.yaml +++ b/charts/syslog-ng-collector/templates/serviceaccount.yaml @@ -10,28 +10,4 @@ metadata: annotations: {{- toYaml . | nindent 4 }} {{- end }} ---- -kind: ClusterRole -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: {{ include "syslog-ng-collector.serviceAccountName" . }} -rules: - - apiGroups: [""] - resources: ["pods"] - verbs: ["get", "watch", "list"] - {{- if .Values.serviceAccount.extraRules }} -{{ toYaml ( .Values.serviceAccount.extraRules ) | indent 2 }} - {{- end }} ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: {{ include "syslog-ng-collector.serviceAccountName" . }} -subjects: - - kind: ServiceAccount - name: {{ include "syslog-ng-collector.serviceAccountName" . }} - namespace: {{ include "syslog-ng-collector.namespace" . }} -roleRef: - kind: ClusterRole - name: {{ include "syslog-ng-collector.serviceAccountName" . }} {{- end }} From 3a60b63f124c6c799b39ae16afbbd62ad2999208 Mon Sep 17 00:00:00 2001 From: Attila Szakacs Date: Thu, 20 Apr 2023 11:41:18 +0200 Subject: [PATCH 19/51] README: add global readme Signed-off-by: Attila Szakacs --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000000..5090e3ef82 --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ +# Helm Charts + +Various Helm [charts](https://helm.sh/docs/topics/charts/) for syslog-ng. + + +## Usage + +[Helm](https://helm.sh) must be installed to use these charts. +Please refer to the [official documentation](https://helm.sh/docs/intro/install/) to get started. + +Currently the charts are only available through this git repositoy. +You can install charts using the following commands: + +```bash +$ git clone git@github.com:axoflow/syslog-ng-charts.git +$ cd syslog-ng-charts +$ helm install --generate-name charts/syslog-ng-collector +``` + +> **Tip**: List all installed releases using `helm list`. + +To uninstall a chart release: + +```bash +$ helm delete my-release +``` From baf3fce6b3e1f5fa0b5edbde3154c513138317ec Mon Sep 17 00:00:00 2001 From: Robert Fekete Date: Thu, 20 Apr 2023 19:50:12 +0200 Subject: [PATCH 20/51] Update README.md --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 5090e3ef82..096b3bef89 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Helm Charts -Various Helm [charts](https://helm.sh/docs/topics/charts/) for syslog-ng. +Various [Helm charts](https://helm.sh/docs/topics/charts/) for syslog-ng. ## Usage @@ -12,15 +12,15 @@ Currently the charts are only available through this git repositoy. You can install charts using the following commands: ```bash -$ git clone git@github.com:axoflow/syslog-ng-charts.git -$ cd syslog-ng-charts -$ helm install --generate-name charts/syslog-ng-collector +git clone git@github.com:axoflow/syslog-ng-charts.git +cd syslog-ng-charts +helm install --generate-name charts/syslog-ng-collector ``` > **Tip**: List all installed releases using `helm list`. -To uninstall a chart release: +To uninstall a chart release, run: ```bash -$ helm delete my-release +helm delete my-release ``` From 45d93d695ff2e1894873233cdbf05bd715f2c047 Mon Sep 17 00:00:00 2001 From: Robert Fekete Date: Sat, 22 Apr 2023 16:57:26 +0200 Subject: [PATCH 21/51] Update README.md --- README.md | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 096b3bef89..80a61e3d68 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,14 @@ -# Helm Charts +

+ + + + Axoflow + +

-Various [Helm charts](https://helm.sh/docs/topics/charts/) for syslog-ng. +# Helm Charts +This repository contains various [Helm charts](https://helm.sh/docs/topics/charts/) for syslog-ng. You can use these charts to install the [cloud-ready syslog-ng images](https://github.com/axoflow/syslog-ng-docker) created and maintained by [Axoflow](https://axoflow.com). ## Usage @@ -24,3 +31,17 @@ To uninstall a chart release, run: ```bash helm delete my-release ``` + +## Contact and support + +In case you need help or want to contact us, open a [GitHub issue](https://github.com/axoflow/syslog-ng-charts/issues), or come chat with us in the [syslog-ng channel of the Axoflow Discord server](https://discord.gg/4Fzy7D66Qq). + +## Contribution + +If you have fixed a bug or would like to contribute your improvements to these charts, [open a pull request](https://github.com/axoflow/syslog-ng-charts/pulls). We truly appreciate your help. + +## About Axoflow + +The [Axoflow](https://axoflow.com) founder team consists of successful entrepreneurs with a vast knowledge and hands-on experience about observability, log management, and how to apply these technologies in the enterprise security context. We also happen to be the creators of wide-spread open source technologies in this area, like syslog-ng and the [Logging operator for Kubernetes](https://github.com/kube-logging/logging-operator). + +To learn more about our products and our open-source projects, visit the [Axoflow blog](https://axoflow.com/blog/), or [subscribe to the Axoflow newsletter](https://axoflow.com/#newsletter-subscription). From c3cffc6c6094fb5474ab2510cfb7c203277e0086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20V=C3=A1rady?= Date: Mon, 1 May 2023 16:58:09 +0200 Subject: [PATCH 22/51] syslog-ng-collector: update syslog-ng image location MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: László Várady --- charts/syslog-ng-collector/README.md | 2 +- charts/syslog-ng-collector/values.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/syslog-ng-collector/README.md b/charts/syslog-ng-collector/README.md index 3af9ab97ba..ef9ecb0910 100644 --- a/charts/syslog-ng-collector/README.md +++ b/charts/syslog-ng-collector/README.md @@ -14,7 +14,7 @@ The following table lists the configurable parameters of the Syslog-ng Collector | Parameter | Description | Default | | --------- | ----------- | ------- | -| image.repository | The container image repository | ghcr.io/axoflow/syslog-ng | +| image.repository | The container image repository | ghcr.io/axoflow/axosyslog | | image.pullPolicy | The container image pull policy | IfNotPresent | | image.tag | The container image tag | 4.1.1 | | imagePullSecrets | The names of secrets containing private registry credentials | [] | diff --git a/charts/syslog-ng-collector/values.yaml b/charts/syslog-ng-collector/values.yaml index 6368f3aed0..de64ef4e76 100644 --- a/charts/syslog-ng-collector/values.yaml +++ b/charts/syslog-ng-collector/values.yaml @@ -1,5 +1,5 @@ image: - repository: ghcr.io/axoflow/syslog-ng + repository: ghcr.io/axoflow/axosyslog pullPolicy: IfNotPresent tag: "" From 9d59349c54ffe8f1c4c7be1b4171dc99b343506f Mon Sep 17 00:00:00 2001 From: Attila Szakacs Date: Tue, 2 May 2023 08:47:06 +0200 Subject: [PATCH 23/51] README: AxoSyslog rename Signed-off-by: Attila Szakacs --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 80a61e3d68..5936df4af6 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,16 @@

- - - Axoflow + + + Axoflow

-# Helm Charts +# AxoSyslog Helm Charts - a cloud-native distribution of syslog-ng by Axoflow -This repository contains various [Helm charts](https://helm.sh/docs/topics/charts/) for syslog-ng. You can use these charts to install the [cloud-ready syslog-ng images](https://github.com/axoflow/syslog-ng-docker) created and maintained by [Axoflow](https://axoflow.com). +This repository contains various [Helm charts](https://helm.sh/docs/topics/charts/) for syslog-ng. You can use these charts to install the [AxoSyslog - cloud-ready syslog-ng images](https://github.com/axoflow/axosyslog-docker) created and maintained by [Axoflow](https://axoflow.com). -## Usage +## How to use [Helm](https://helm.sh) must be installed to use these charts. Please refer to the [official documentation](https://helm.sh/docs/intro/install/) to get started. @@ -19,8 +19,8 @@ Currently the charts are only available through this git repositoy. You can install charts using the following commands: ```bash -git clone git@github.com:axoflow/syslog-ng-charts.git -cd syslog-ng-charts +git clone git@github.com:axoflow/axosyslog-charts.git +cd axosyslog-charts helm install --generate-name charts/syslog-ng-collector ``` @@ -34,11 +34,11 @@ helm delete my-release ## Contact and support -In case you need help or want to contact us, open a [GitHub issue](https://github.com/axoflow/syslog-ng-charts/issues), or come chat with us in the [syslog-ng channel of the Axoflow Discord server](https://discord.gg/4Fzy7D66Qq). +In case you need help or want to contact us, open a [GitHub issue](https://github.com/axoflow/axosyslog-charts/issues), or come chat with us in the [syslog-ng channel of the Axoflow Discord server](https://discord.gg/4Fzy7D66Qq). ## Contribution -If you have fixed a bug or would like to contribute your improvements to these charts, [open a pull request](https://github.com/axoflow/syslog-ng-charts/pulls). We truly appreciate your help. +If you have fixed a bug or would like to contribute your improvements to these charts, [open a pull request](https://github.com/axoflow/axosyslog-charts/pulls). We truly appreciate your help. ## About Axoflow From 47ecde0cc6d65acb1b0b0a90821d71fb2fa271e0 Mon Sep 17 00:00:00 2001 From: Attila Szakacs Date: Wed, 3 May 2023 08:42:30 +0200 Subject: [PATCH 24/51] collector: rename to axosyslog-collector Signed-off-by: Attila Szakacs --- ...-collector.yml => axosyslog-collector.yml} | 6 +++-- README.md | 2 +- .../.helmignore | 0 charts/axosyslog-collector/Chart.yaml | 6 +++++ .../README.md | 0 .../axosyslog-collector/templates/NOTES.txt | 2 ++ .../templates/_helpers.tpl | 22 +++++++++---------- .../templates/clusterrole.yaml | 4 ++-- .../templates/clusterrolebinding.yaml | 13 +++++++++++ .../templates/config.yaml | 4 ++-- .../templates/daemonset.yaml | 18 +++++++-------- .../templates/scc.yaml | 2 +- .../templates/serviceaccount.yaml | 6 ++--- .../values.yaml | 0 charts/syslog-ng-collector/Chart.yaml | 6 ----- .../syslog-ng-collector/templates/NOTES.txt | 2 -- .../templates/clusterrolebinding.yaml | 13 ----------- 17 files changed, 54 insertions(+), 52 deletions(-) rename .github/workflows/{syslog-ng-collector.yml => axosyslog-collector.yml} (71%) rename charts/{syslog-ng-collector => axosyslog-collector}/.helmignore (100%) create mode 100644 charts/axosyslog-collector/Chart.yaml rename charts/{syslog-ng-collector => axosyslog-collector}/README.md (100%) create mode 100644 charts/axosyslog-collector/templates/NOTES.txt rename charts/{syslog-ng-collector => axosyslog-collector}/templates/_helpers.tpl (71%) rename charts/{syslog-ng-collector => axosyslog-collector}/templates/clusterrole.yaml (81%) create mode 100644 charts/axosyslog-collector/templates/clusterrolebinding.yaml rename charts/{syslog-ng-collector => axosyslog-collector}/templates/config.yaml (93%) rename charts/{syslog-ng-collector => axosyslog-collector}/templates/daemonset.yaml (89%) rename charts/{syslog-ng-collector => axosyslog-collector}/templates/scc.yaml (94%) rename charts/{syslog-ng-collector => axosyslog-collector}/templates/serviceaccount.yaml (53%) rename charts/{syslog-ng-collector => axosyslog-collector}/values.yaml (100%) delete mode 100644 charts/syslog-ng-collector/Chart.yaml delete mode 100644 charts/syslog-ng-collector/templates/NOTES.txt delete mode 100644 charts/syslog-ng-collector/templates/clusterrolebinding.yaml diff --git a/.github/workflows/syslog-ng-collector.yml b/.github/workflows/axosyslog-collector.yml similarity index 71% rename from .github/workflows/syslog-ng-collector.yml rename to .github/workflows/axosyslog-collector.yml index 1fb306e785..3cb81ad766 100644 --- a/.github/workflows/syslog-ng-collector.yml +++ b/.github/workflows/axosyslog-collector.yml @@ -1,13 +1,15 @@ +name: AxoSyslog Collector + on: push: pull_request: defaults: run: - working-directory: charts/syslog-ng-collector + working-directory: charts/axosyslog-collector jobs: - syslog-ng-collector: + axosyslog-collector: runs-on: ubuntu-latest steps: - name: Checkout source diff --git a/README.md b/README.md index 5936df4af6..6a855e3c6b 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ You can install charts using the following commands: ```bash git clone git@github.com:axoflow/axosyslog-charts.git cd axosyslog-charts -helm install --generate-name charts/syslog-ng-collector +helm install --generate-name charts/axosyslog-collector ``` > **Tip**: List all installed releases using `helm list`. diff --git a/charts/syslog-ng-collector/.helmignore b/charts/axosyslog-collector/.helmignore similarity index 100% rename from charts/syslog-ng-collector/.helmignore rename to charts/axosyslog-collector/.helmignore diff --git a/charts/axosyslog-collector/Chart.yaml b/charts/axosyslog-collector/Chart.yaml new file mode 100644 index 0000000000..ef33ad086b --- /dev/null +++ b/charts/axosyslog-collector/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: axosyslog-collector +description: AxoSyslog kubernetes log collector +type: application +version: 0.1.0 +appVersion: "4.1.1" diff --git a/charts/syslog-ng-collector/README.md b/charts/axosyslog-collector/README.md similarity index 100% rename from charts/syslog-ng-collector/README.md rename to charts/axosyslog-collector/README.md diff --git a/charts/axosyslog-collector/templates/NOTES.txt b/charts/axosyslog-collector/templates/NOTES.txt new file mode 100644 index 0000000000..c04d7116c6 --- /dev/null +++ b/charts/axosyslog-collector/templates/NOTES.txt @@ -0,0 +1,2 @@ +1. Watch the {{ template "axosyslog-collector.fullname" . }} container start. + $ kubectl get pods --namespace={{ .Release.Namespace }} -l app={{ template "axosyslog-collector.fullname" . }} -w diff --git a/charts/syslog-ng-collector/templates/_helpers.tpl b/charts/axosyslog-collector/templates/_helpers.tpl similarity index 71% rename from charts/syslog-ng-collector/templates/_helpers.tpl rename to charts/axosyslog-collector/templates/_helpers.tpl index f143ace4e0..1867d83496 100644 --- a/charts/syslog-ng-collector/templates/_helpers.tpl +++ b/charts/axosyslog-collector/templates/_helpers.tpl @@ -1,7 +1,7 @@ {{/* Expand the name of the chart. */}} -{{- define "syslog-ng-collector.name" -}} +{{- define "axosyslog-collector.name" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} {{- end }} @@ -10,7 +10,7 @@ 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 "syslog-ng-collector.fullname" -}} +{{- define "axosyslog-collector.fullname" -}} {{- if .Values.fullnameOverride }} {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} {{- else }} @@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name. {{/* Create chart name and version as used by the chart label. */}} -{{- define "syslog-ng-collector.chart" -}} +{{- define "axosyslog-collector.chart" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} {{- end }} {{/* Common labels */}} -{{- define "syslog-ng-collector.labels" -}} -helm.sh/chart: {{ include "syslog-ng-collector.chart" . }} -{{ include "syslog-ng-collector.selectorLabels" . }} +{{- define "axosyslog-collector.labels" -}} +helm.sh/chart: {{ include "axosyslog-collector.chart" . }} +{{ include "axosyslog-collector.selectorLabels" . }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} @@ -45,22 +45,22 @@ app.kubernetes.io/managed-by: {{ .Release.Service }} {{/* Selector labels */}} -{{- define "syslog-ng-collector.selectorLabels" -}} -app.kubernetes.io/name: {{ include "syslog-ng-collector.name" . }} +{{- define "axosyslog-collector.selectorLabels" -}} +app.kubernetes.io/name: {{ include "axosyslog-collector.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} {{/* Create the name of the service account to use */}} -{{- define "syslog-ng-collector.serviceAccountName" -}} +{{- define "axosyslog-collector.serviceAccountName" -}} {{- if .Values.serviceAccount.create }} -{{- default (include "syslog-ng-collector.fullname" .) .Values.serviceAccount.name }} +{{- default (include "axosyslog-collector.fullname" .) .Values.serviceAccount.name }} {{- else }} {{- default "default" .Values.serviceAccount.name }} {{- end }} {{- end }} -{{- define "syslog-ng-collector.namespace" -}} +{{- define "axosyslog-collector.namespace" -}} {{ .Values.namespace | default .Release.Namespace }} {{- end -}} diff --git a/charts/syslog-ng-collector/templates/clusterrole.yaml b/charts/axosyslog-collector/templates/clusterrole.yaml similarity index 81% rename from charts/syslog-ng-collector/templates/clusterrole.yaml rename to charts/axosyslog-collector/templates/clusterrole.yaml index 5dca177f04..3e54a11614 100644 --- a/charts/syslog-ng-collector/templates/clusterrole.yaml +++ b/charts/axosyslog-collector/templates/clusterrole.yaml @@ -2,7 +2,7 @@ kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1 metadata: - name: {{ include "syslog-ng-collector.serviceAccountName" . }} + name: {{ include "axosyslog-collector.serviceAccountName" . }} rules: - apiGroups: [""] resources: ["pods"] @@ -16,7 +16,7 @@ rules: resources: - securitycontextconstraints resourceNames: - - {{ template "syslog-ng-collector.fullname" . }} + - {{ template "axosyslog-collector.fullname" . }} verbs: - use {{- end }} diff --git a/charts/axosyslog-collector/templates/clusterrolebinding.yaml b/charts/axosyslog-collector/templates/clusterrolebinding.yaml new file mode 100644 index 0000000000..f22447e5f5 --- /dev/null +++ b/charts/axosyslog-collector/templates/clusterrolebinding.yaml @@ -0,0 +1,13 @@ +{{- if .Values.rbac.create -}} +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: {{ include "axosyslog-collector.serviceAccountName" . }} +subjects: + - kind: ServiceAccount + name: {{ include "axosyslog-collector.serviceAccountName" . }} + namespace: {{ include "axosyslog-collector.namespace" . }} +roleRef: + kind: ClusterRole + name: {{ include "axosyslog-collector.serviceAccountName" . }} +{{- end -}} diff --git a/charts/syslog-ng-collector/templates/config.yaml b/charts/axosyslog-collector/templates/config.yaml similarity index 93% rename from charts/syslog-ng-collector/templates/config.yaml rename to charts/axosyslog-collector/templates/config.yaml index a7e3ba465d..38f7d3e080 100644 --- a/charts/syslog-ng-collector/templates/config.yaml +++ b/charts/axosyslog-collector/templates/config.yaml @@ -2,8 +2,8 @@ apiVersion: v1 kind: ConfigMap metadata: labels: - {{- include "syslog-ng-collector.labels" . | nindent 4 }} - name: {{ include "syslog-ng-collector.fullname" . }} + {{- include "axosyslog-collector.labels" . | nindent 4 }} + name: {{ include "axosyslog-collector.fullname" . }} data: {{- if .Values.config.raw }} syslog-ng.conf: {{ tpl (toYaml .Values.config.raw) . | indent 4 }} diff --git a/charts/syslog-ng-collector/templates/daemonset.yaml b/charts/axosyslog-collector/templates/daemonset.yaml similarity index 89% rename from charts/syslog-ng-collector/templates/daemonset.yaml rename to charts/axosyslog-collector/templates/daemonset.yaml index c6fe60bc3a..613334fd7e 100644 --- a/charts/syslog-ng-collector/templates/daemonset.yaml +++ b/charts/axosyslog-collector/templates/daemonset.yaml @@ -3,10 +3,10 @@ apiVersion: apps/v1 kind: DaemonSet metadata: - name: {{ template "syslog-ng-collector.fullname" . }} - namespace: {{ include "syslog-ng-collector.namespace" . }} + name: {{ template "axosyslog-collector.fullname" . }} + namespace: {{ include "axosyslog-collector.namespace" . }} labels: - app: "{{ template "syslog-ng-collector.fullname" . }}" + app: "{{ template "axosyslog-collector.fullname" . }}" chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" heritage: {{ .Release.Service | quote }} release: {{ .Release.Name | quote }} @@ -24,7 +24,7 @@ metadata: spec: selector: matchLabels: - app: "{{ template "syslog-ng-collector.fullname" . }}" + app: "{{ template "axosyslog-collector.fullname" . }}" release: {{ .Release.Name | quote }} updateStrategy: {{- if eq .Values.updateStrategy "RollingUpdate" }} @@ -40,9 +40,9 @@ spec: {{ $key }}: {{ $value | quote }} {{- end }} {{- end }} - name: "{{ template "syslog-ng-collector.fullname" . }}" + name: "{{ template "axosyslog-collector.fullname" . }}" labels: - app: "{{ template "syslog-ng-collector.fullname" . }}" + app: "{{ template "axosyslog-collector.fullname" . }}" chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" heritage: {{ .Release.Service | quote }} release: {{ .Release.Name | quote }} @@ -53,7 +53,7 @@ spec: {{- end }} spec: {{- if .Values.serviceAccount.create }} - serviceAccountName: {{ template "syslog-ng-collector.serviceAccountName" . }} + serviceAccountName: {{ template "axosyslog-collector.serviceAccountName" . }} {{- end}} tolerations: {{ toYaml ( .Values.tolerations | default .Values.daemonset.tolerations ) | nindent 8 }} nodeSelector: {{ toYaml ( .Values.nodeSelector | default .Values.daemonset.nodeSelector ) | nindent 8 }} @@ -80,7 +80,7 @@ spec: {{- end }} - name: config configMap: - name: {{ include "syslog-ng-collector.fullname" . }} + name: {{ include "axosyslog-collector.fullname" . }} - name: var-log hostPath: path: /var/log @@ -98,7 +98,7 @@ spec: {{ toYaml .Values.imagePullSecrets | indent 8 }} {{- end }} containers: - - name: "syslog-ng-collector" + - name: "axosyslog-collector" image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: "{{ .Values.image.pullPolicy }}" resources: diff --git a/charts/syslog-ng-collector/templates/scc.yaml b/charts/axosyslog-collector/templates/scc.yaml similarity index 94% rename from charts/syslog-ng-collector/templates/scc.yaml rename to charts/axosyslog-collector/templates/scc.yaml index 4a8f87786d..140d53442d 100644 --- a/charts/syslog-ng-collector/templates/scc.yaml +++ b/charts/axosyslog-collector/templates/scc.yaml @@ -2,7 +2,7 @@ apiVersion: security.openshift.io/v1 kind: SecurityContextConstraints metadata: - name: {{ template "syslog-ng-collector.fullname" . }} + name: {{ template "axosyslog-collector.fullname" . }} {{- if .Values.openShift.securityContextConstraints.annotations }} annotations: {{- toYaml .Values.openShift.securityContextConstraints.annotations | nindent 4 }} diff --git a/charts/syslog-ng-collector/templates/serviceaccount.yaml b/charts/axosyslog-collector/templates/serviceaccount.yaml similarity index 53% rename from charts/syslog-ng-collector/templates/serviceaccount.yaml rename to charts/axosyslog-collector/templates/serviceaccount.yaml index 303b4bbf70..6d52ac7ffc 100644 --- a/charts/syslog-ng-collector/templates/serviceaccount.yaml +++ b/charts/axosyslog-collector/templates/serviceaccount.yaml @@ -2,10 +2,10 @@ apiVersion: v1 kind: ServiceAccount metadata: - name: {{ include "syslog-ng-collector.serviceAccountName" . }} - namespace: {{ include "syslog-ng-collector.namespace" . }} + name: {{ include "axosyslog-collector.serviceAccountName" . }} + namespace: {{ include "axosyslog-collector.namespace" . }} labels: - {{- include "syslog-ng-collector.labels" . | nindent 4 }} + {{- include "axosyslog-collector.labels" . | nindent 4 }} {{- with .Values.serviceAccount.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/charts/syslog-ng-collector/values.yaml b/charts/axosyslog-collector/values.yaml similarity index 100% rename from charts/syslog-ng-collector/values.yaml rename to charts/axosyslog-collector/values.yaml diff --git a/charts/syslog-ng-collector/Chart.yaml b/charts/syslog-ng-collector/Chart.yaml deleted file mode 100644 index 650136458f..0000000000 --- a/charts/syslog-ng-collector/Chart.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: v2 -name: syslog-ng-collector -description: syslog-ng kubernetes log collector -type: application -version: 0.1.0 -appVersion: "4.1.1" diff --git a/charts/syslog-ng-collector/templates/NOTES.txt b/charts/syslog-ng-collector/templates/NOTES.txt deleted file mode 100644 index 8fd3b29fa7..0000000000 --- a/charts/syslog-ng-collector/templates/NOTES.txt +++ /dev/null @@ -1,2 +0,0 @@ -1. Watch the {{ template "syslog-ng-collector.fullname" . }} container start. - $ kubectl get pods --namespace={{ .Release.Namespace }} -l app={{ template "syslog-ng-collector.fullname" . }} -w diff --git a/charts/syslog-ng-collector/templates/clusterrolebinding.yaml b/charts/syslog-ng-collector/templates/clusterrolebinding.yaml deleted file mode 100644 index 365b3f9344..0000000000 --- a/charts/syslog-ng-collector/templates/clusterrolebinding.yaml +++ /dev/null @@ -1,13 +0,0 @@ -{{- if .Values.rbac.create -}} -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: {{ include "syslog-ng-collector.serviceAccountName" . }} -subjects: - - kind: ServiceAccount - name: {{ include "syslog-ng-collector.serviceAccountName" . }} - namespace: {{ include "syslog-ng-collector.namespace" . }} -roleRef: - kind: ClusterRole - name: {{ include "syslog-ng-collector.serviceAccountName" . }} -{{- end -}} From bd9899d8131f17b72f989a7a8bb0ffc6cf7b013f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20V=C3=A1rady?= Date: Wed, 3 May 2023 19:22:55 +0200 Subject: [PATCH 25/51] charts: rename to AxoSyslog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: László Várady --- charts/axosyslog-collector/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/charts/axosyslog-collector/README.md b/charts/axosyslog-collector/README.md index ef9ecb0910..afa5a6836b 100644 --- a/charts/axosyslog-collector/README.md +++ b/charts/axosyslog-collector/README.md @@ -1,6 +1,6 @@ -# Syslog-ng Collector +# AxoSyslog Collector -Syslog-ng kubernetes log collector. +AxoSyslog Kubernetes log collector. ## Prerequisites @@ -9,7 +9,7 @@ Syslog-ng kubernetes log collector. ## Configuration -The following table lists the configurable parameters of the Syslog-ng Collector chart and their default values: +The following table lists the configurable parameters of the AxoSyslog Collector chart and their default values: | Parameter | Description | Default | @@ -20,7 +20,7 @@ The following table lists the configurable parameters of the Syslog-ng Collector | imagePullSecrets | The names of secrets containing private registry credentials | [] | | nameOverride | Override the chart name | "" | | fullnameOverride | Override the full chart name | "" | -| daemonset.enabled | Deploy Syslog-ng as a DaemonSet | true | +| daemonset.enabled | Deploy AxoSyslog as a DaemonSet | true | | daemonset.labels | Additional labels to apply to the DaemonSet | {} | | daemonset.annotations | Additional annotations to apply to the DaemonSet | {} | | daemonset.affinity | Pod affinity | {} | From ae244f7cfa4531b8cd38cb0c828cf7be39bd546d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20V=C3=A1rady?= Date: Wed, 3 May 2023 19:24:45 +0200 Subject: [PATCH 26/51] charts: release packages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: László Várady --- .github/workflows/release.yml | 25 +++++++++++++++++++++++++ README.md | 27 +++++++++++++-------------- 2 files changed, 38 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..25146598e9 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,25 @@ +name: Release Charts + +on: + push: + branches: + - master + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Configure Git + run: | + git config user.name "$GITHUB_ACTOR" + git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + + - name: Run chart-releaser + uses: helm/chart-releaser-action@v1.5.0 + env: + CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" diff --git a/README.md b/README.md index 6a855e3c6b..e25120f0b7 100644 --- a/README.md +++ b/README.md @@ -12,25 +12,24 @@ This repository contains various [Helm charts](https://helm.sh/docs/topics/chart ## How to use -[Helm](https://helm.sh) must be installed to use these charts. -Please refer to the [official documentation](https://helm.sh/docs/intro/install/) to get started. +[Helm](https://helm.sh) must be installed to use the charts. Please refer to +Helm's [documentation](https://helm.sh/docs) to get started. -Currently the charts are only available through this git repositoy. -You can install charts using the following commands: +Once Helm has been set up correctly, add the repo as follows: -```bash -git clone git@github.com:axoflow/axosyslog-charts.git -cd axosyslog-charts -helm install --generate-name charts/axosyslog-collector -``` + helm repo add axosyslog https://axoflow.github.io/axosyslog-charts -> **Tip**: List all installed releases using `helm list`. +If you had already added this repo earlier, run `helm repo update` to retrieve +the latest versions of the packages. You can then run `helm search repo +axosyslog` to see the charts. -To uninstall a chart release, run: +To install the axosyslog-collector chart: -```bash -helm delete my-release -``` + helm install my-axosyslog-collector axosyslog/axosyslog-collector + +To uninstall the chart: + + helm delete my-axosyslog-collector ## Contact and support From 3c9fcf5af253a44b0f1f9882376ef1fd9de18250 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20V=C3=A1rady?= Date: Thu, 4 May 2023 16:43:06 +0200 Subject: [PATCH 27/51] axosyslog-collector: relax livenessProbe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: László Várady --- charts/axosyslog-collector/templates/daemonset.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/charts/axosyslog-collector/templates/daemonset.yaml b/charts/axosyslog-collector/templates/daemonset.yaml index 613334fd7e..34f4d4c38d 100644 --- a/charts/axosyslog-collector/templates/daemonset.yaml +++ b/charts/axosyslog-collector/templates/daemonset.yaml @@ -125,6 +125,10 @@ spec: {{ toYaml (.Values.extraVolumeMounts | default .Values.daemonset.extraVolumeMounts ) | indent 12 }} {{- end }} livenessProbe: + initialDelaySeconds: 5 + periodSeconds: 30 + timeoutSeconds: 5 + failureThreshold: 3 exec: - command: ["syslog-ng-ctl", "healthcheck", "--timeout", "1"] + command: ["syslog-ng-ctl", "healthcheck", "--timeout", "5"] {{- end }} From ae6162f0e42029a095ce87ff5579b411c50a60f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20V=C3=A1rady?= Date: Thu, 4 May 2023 16:43:46 +0200 Subject: [PATCH 28/51] axosyslog-collector: use "current" config version as a default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: László Várady --- charts/axosyslog-collector/templates/config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/axosyslog-collector/templates/config.yaml b/charts/axosyslog-collector/templates/config.yaml index 38f7d3e080..bc58d521c6 100644 --- a/charts/axosyslog-collector/templates/config.yaml +++ b/charts/axosyslog-collector/templates/config.yaml @@ -9,7 +9,7 @@ data: syslog-ng.conf: {{ tpl (toYaml .Values.config.raw) . | indent 4 }} {{- else }} syslog-ng.conf: | - @version: {{ regexFind "^[0-9]+\\.[0-9]+" (.Values.config.version | default .Values.image.tag | default .Chart.AppVersion ) }} + @version: {{ regexFind "^[0-9]+\\.[0-9]+" .Values.config.version | default "current" }} @include "scl.conf" options { From d35f436852cd3a252858f0a0e38cf2001e8f3542 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20V=C3=A1rady?= Date: Thu, 4 May 2023 16:46:06 +0200 Subject: [PATCH 29/51] axosyslog-collector: use nightly until v4.2 is released MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The healthcheck syslog-ng-ctl command is not released yet. Signed-off-by: László Várady --- charts/axosyslog-collector/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/axosyslog-collector/values.yaml b/charts/axosyslog-collector/values.yaml index de64ef4e76..2922a6594a 100644 --- a/charts/axosyslog-collector/values.yaml +++ b/charts/axosyslog-collector/values.yaml @@ -1,7 +1,7 @@ image: repository: ghcr.io/axoflow/axosyslog pullPolicy: IfNotPresent - tag: "" + tag: "nightly" # until releasing v4.2 imagePullSecrets: [] nameOverride: "" From 94646b8729658165df6fd8f157bc1471a95bb37f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20V=C3=A1rady?= Date: Thu, 4 May 2023 16:47:31 +0200 Subject: [PATCH 30/51] axosyslog-collector: bump version to 0.1.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: László Várady --- charts/axosyslog-collector/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/axosyslog-collector/Chart.yaml b/charts/axosyslog-collector/Chart.yaml index ef33ad086b..45a1e0b814 100644 --- a/charts/axosyslog-collector/Chart.yaml +++ b/charts/axosyslog-collector/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: axosyslog-collector description: AxoSyslog kubernetes log collector type: application -version: 0.1.0 +version: 0.1.1 appVersion: "4.1.1" From 317c521cbcdc22e1d4de46d34194a9bce556c639 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20V=C3=A1rady?= Date: Sat, 6 May 2023 22:37:28 +0200 Subject: [PATCH 31/51] axosyslog-collector: add image.extraArgs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For example, for moving the syslog-ng.ctl socket to a shared volume. Signed-off-by: László Várady --- charts/axosyslog-collector/templates/daemonset.yaml | 4 ++++ charts/axosyslog-collector/values.yaml | 1 + 2 files changed, 5 insertions(+) diff --git a/charts/axosyslog-collector/templates/daemonset.yaml b/charts/axosyslog-collector/templates/daemonset.yaml index 34f4d4c38d..d1ad4ace81 100644 --- a/charts/axosyslog-collector/templates/daemonset.yaml +++ b/charts/axosyslog-collector/templates/daemonset.yaml @@ -101,6 +101,10 @@ spec: - name: "axosyslog-collector" image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: "{{ .Values.image.pullPolicy }}" + {{- if .Values.image.extraArgs }} + args: +{{ toYaml .Values.image.extraArgs | indent 12 }} + {{- end }} resources: {{ toYaml ( .Values.resources | default .Values.daemonset.resources ) | indent 12 }} securityContext: {{ toYaml ( .Values.podSecurityContext | default .Values.daemonset.securityContext ) | nindent 12 }} diff --git a/charts/axosyslog-collector/values.yaml b/charts/axosyslog-collector/values.yaml index 2922a6594a..9bea1cdb7e 100644 --- a/charts/axosyslog-collector/values.yaml +++ b/charts/axosyslog-collector/values.yaml @@ -2,6 +2,7 @@ image: repository: ghcr.io/axoflow/axosyslog pullPolicy: IfNotPresent tag: "nightly" # until releasing v4.2 + extraArgs: [] imagePullSecrets: [] nameOverride: "" From 088d7a33576eec3add9437537954d0b5359b4e8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20V=C3=A1rady?= Date: Sat, 6 May 2023 22:38:10 +0200 Subject: [PATCH 32/51] axosyslog-collector: bump version to 0.2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: László Várady --- charts/axosyslog-collector/Chart.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/axosyslog-collector/Chart.yaml b/charts/axosyslog-collector/Chart.yaml index 45a1e0b814..dd54eca250 100644 --- a/charts/axosyslog-collector/Chart.yaml +++ b/charts/axosyslog-collector/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: axosyslog-collector -description: AxoSyslog kubernetes log collector +description: AxoSyslog Kubernetes log collector type: application -version: 0.1.1 +version: 0.2.0 appVersion: "4.1.1" From 43a825d8dfedfca7a989da1de7c721fea671a74c Mon Sep 17 00:00:00 2001 From: Attila Szakacs Date: Wed, 10 May 2023 17:14:27 +0200 Subject: [PATCH 33/51] collector: use axosyslog 4.2.0 Signed-off-by: Attila Szakacs --- charts/axosyslog-collector/Chart.yaml | 4 ++-- charts/axosyslog-collector/values.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/charts/axosyslog-collector/Chart.yaml b/charts/axosyslog-collector/Chart.yaml index dd54eca250..fedb04de12 100644 --- a/charts/axosyslog-collector/Chart.yaml +++ b/charts/axosyslog-collector/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: axosyslog-collector description: AxoSyslog Kubernetes log collector type: application -version: 0.2.0 -appVersion: "4.1.1" +version: 0.3.0 +appVersion: "4.2.0" diff --git a/charts/axosyslog-collector/values.yaml b/charts/axosyslog-collector/values.yaml index 9bea1cdb7e..33c07fa3ab 100644 --- a/charts/axosyslog-collector/values.yaml +++ b/charts/axosyslog-collector/values.yaml @@ -1,7 +1,7 @@ image: repository: ghcr.io/axoflow/axosyslog pullPolicy: IfNotPresent - tag: "nightly" # until releasing v4.2 + tag: "" extraArgs: [] imagePullSecrets: [] From 556695eb65096d28caa3e73ae0f0114b4183b50f Mon Sep 17 00:00:00 2001 From: Mate Ory Date: Tue, 8 Aug 2023 15:46:46 +0200 Subject: [PATCH 34/51] axosyslog-collector: make stats.level=2 configurable --- charts/axosyslog-collector/templates/config.yaml | 2 +- charts/axosyslog-collector/values.yaml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/charts/axosyslog-collector/templates/config.yaml b/charts/axosyslog-collector/templates/config.yaml index bc58d521c6..5aa75809a1 100644 --- a/charts/axosyslog-collector/templates/config.yaml +++ b/charts/axosyslog-collector/templates/config.yaml @@ -14,7 +14,7 @@ data: options { stats( - level(1) + level({{ .Values.config.stats.level }}) ); }; diff --git a/charts/axosyslog-collector/values.yaml b/charts/axosyslog-collector/values.yaml index 33c07fa3ab..ab04945579 100644 --- a/charts/axosyslog-collector/values.yaml +++ b/charts/axosyslog-collector/values.yaml @@ -26,6 +26,8 @@ daemonset: config: raw: "" # Use this to manually set the contents of the syslog-ng.conf file. version: "" + stats: + level: 2 sources: kubernetes: enabled: true From 142545ca7813d442ed04c3cfa56b5251245b7e16 Mon Sep 17 00:00:00 2001 From: Mate Ory Date: Tue, 8 Aug 2023 15:47:51 +0200 Subject: [PATCH 35/51] axosyslog-collector: add optional metricsExporter sidecar --- .../templates/daemonset.yaml | 20 +++++++++++++++++++ charts/axosyslog-collector/values.yaml | 9 +++++++++ 2 files changed, 29 insertions(+) diff --git a/charts/axosyslog-collector/templates/daemonset.yaml b/charts/axosyslog-collector/templates/daemonset.yaml index d1ad4ace81..8c67b43fee 100644 --- a/charts/axosyslog-collector/templates/daemonset.yaml +++ b/charts/axosyslog-collector/templates/daemonset.yaml @@ -90,6 +90,8 @@ spec: - name: var-run-docker-sock hostPath: path: /var/run/docker.sock + - name: var-lib-syslog-ng + emptyDir: {} {{- if .Values.extraVolumes | default .Values.daemonset.extraVolumes }} {{ toYaml ( .Values.extraVolumes | default .Values.daemonset.extraVolumes ) | indent 8 }} {{- end }} @@ -125,6 +127,8 @@ spec: mountPath: /var/lib/docker/containers - name: var-run-docker-sock mountPath: /var/run/docker.sock + - name: var-lib-syslog-ng + mountPath: /var/lib/syslog-ng {{- if .Values.extraVolumeMounts | default .Values.daemonset.extraVolumeMounts }} {{ toYaml (.Values.extraVolumeMounts | default .Values.daemonset.extraVolumeMounts ) | indent 12 }} {{- end }} @@ -135,4 +139,20 @@ spec: failureThreshold: 3 exec: command: ["syslog-ng-ctl", "healthcheck", "--timeout", "5"] + {{- if .Values.metricsExporter.enabled }} + - name: "metrics-exporter" + image: "{{ .Values.metricsExporter.image.repository }}:{{ .Values.metricsExporter.image.tag }}" + imagePullPolicy: "{{ .Values.metricsExporter.image.pullPolicy }}" + args: + - --socket.path=/var/lib/syslog-ng/syslog-ng.ctl + volumeMounts: + - name: var-lib-syslog-ng + mountPath: /var/lib/syslog-ng + ports: + - containerPort: 9577 + name: exporter + protocol: TCP + resources: {{ toYaml ( .Values.metricsExporter.resources ) | nindent 12 }} + securityContext: {{ toYaml ( .Values.metricsExporter.securityContext | default .Values.daemonset.securityContext ) | nindent 12 }} + {{- end }} {{- end }} diff --git a/charts/axosyslog-collector/values.yaml b/charts/axosyslog-collector/values.yaml index ab04945579..ec84192d04 100644 --- a/charts/axosyslog-collector/values.yaml +++ b/charts/axosyslog-collector/values.yaml @@ -23,6 +23,15 @@ daemonset: maxUnavailable: 1 hostNetworking: false +metricsExporter: + enabled: false # deploy the axosyslog Deamonset with the axosyslog-metrics-exporter sidecar + image: + repository: ghcr.io/axoflow/axosyslog-metrics-exporter + tag: latest + pullPolicy: ~ # use k8s default behavior (Always for :latest, IfNotPresent otherwise) + resources: {} + securityContext: {} + config: raw: "" # Use this to manually set the contents of the syslog-ng.conf file. version: "" From 6611f134a4a8ff3f2357c5dbdd12ed3fdd3a75c4 Mon Sep 17 00:00:00 2001 From: Mate Ory Date: Thu, 10 Aug 2023 09:29:15 +0200 Subject: [PATCH 36/51] axosyslog-collector: add optional PodMonitor CR --- .../templates/podmonitor.yaml | 30 +++++++++++++++++++ charts/axosyslog-collector/values.yaml | 5 ++++ 2 files changed, 35 insertions(+) create mode 100644 charts/axosyslog-collector/templates/podmonitor.yaml diff --git a/charts/axosyslog-collector/templates/podmonitor.yaml b/charts/axosyslog-collector/templates/podmonitor.yaml new file mode 100644 index 0000000000..7663042103 --- /dev/null +++ b/charts/axosyslog-collector/templates/podmonitor.yaml @@ -0,0 +1,30 @@ +{{- if .Values.podMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + name: {{ template "axosyslog-collector.fullname" . }} + namespace: {{ include "axosyslog-collector.namespace" . }} + labels: + app: "{{ template "axosyslog-collector.fullname" . }}" + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + heritage: {{ .Release.Service | quote }} + release: {{ .Release.Name | quote }} + {{- with .Values.podMonitor.labels }} + {{- range $key, $value := . }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- end }} + {{- with .Values.podMonitor.annotations }} + annotations: + {{- range $key, $value := . }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- end }} +spec: + selector: + matchLabels: + app: "{{ template "axosyslog-collector.fullname" . }}" + release: {{ .Release.Name | quote }} + podMetricsEndpoints: + - port: exporter +{{- end }} diff --git a/charts/axosyslog-collector/values.yaml b/charts/axosyslog-collector/values.yaml index ec84192d04..f916bd0fbb 100644 --- a/charts/axosyslog-collector/values.yaml +++ b/charts/axosyslog-collector/values.yaml @@ -32,6 +32,11 @@ metricsExporter: resources: {} securityContext: {} +podMonitor: + enabled: false # deploy the PodMonitor CR for Prometheus Operator (requires metricsExporter.enabled) + labels: {} + annotations: {} + config: raw: "" # Use this to manually set the contents of the syslog-ng.conf file. version: "" From 403387bc42f042b54d0d3e9ad04dc031d2acaaea Mon Sep 17 00:00:00 2001 From: Attila Szakacs Date: Thu, 10 Aug 2023 15:43:39 +0200 Subject: [PATCH 37/51] collector: use AxoSyslog 4.3.1 Signed-off-by: Attila Szakacs --- charts/axosyslog-collector/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/axosyslog-collector/Chart.yaml b/charts/axosyslog-collector/Chart.yaml index fedb04de12..2390190351 100644 --- a/charts/axosyslog-collector/Chart.yaml +++ b/charts/axosyslog-collector/Chart.yaml @@ -3,4 +3,4 @@ name: axosyslog-collector description: AxoSyslog Kubernetes log collector type: application version: 0.3.0 -appVersion: "4.2.0" +appVersion: "4.3.1" From bc84881531e10e2438be007d560497d1d6644606 Mon Sep 17 00:00:00 2001 From: Attila Szakacs Date: Thu, 10 Aug 2023 15:44:07 +0200 Subject: [PATCH 38/51] collector: add opentelemetry() source and dest Signed-off-by: Attila Szakacs --- charts/axosyslog-collector/templates/config.yaml | 16 ++++++++++++++++ charts/axosyslog-collector/values.yaml | 6 ++++++ 2 files changed, 22 insertions(+) diff --git a/charts/axosyslog-collector/templates/config.yaml b/charts/axosyslog-collector/templates/config.yaml index bc58d521c6..84c3f11796 100644 --- a/charts/axosyslog-collector/templates/config.yaml +++ b/charts/axosyslog-collector/templates/config.yaml @@ -22,6 +22,15 @@ data: {{- if .Values.config.sources.kubernetes.enabled }} source { kubernetes(); }; {{- end }} +{{- range .Values.config.sources.opentelemetry }} + source { + opentelemetry( + {{- if .port }} + port({{ .port }}) + {{- end }} + ); + }; +{{- end }} {{- range .Values.config.destinations.network }} destination { network( @@ -72,6 +81,13 @@ data: {{- end }} ); }; +{{- end }} +{{- range .Values.config.destinations.opentelemetry }} + destination { + opentelemetry( + url({{ tpl .url $ | quote }}) + ); + }; {{- end }} }; {{- end }} diff --git a/charts/axosyslog-collector/values.yaml b/charts/axosyslog-collector/values.yaml index 33c07fa3ab..c2909c18f3 100644 --- a/charts/axosyslog-collector/values.yaml +++ b/charts/axosyslog-collector/values.yaml @@ -29,6 +29,9 @@ config: sources: kubernetes: enabled: true + opentelemetry: [] +# E.g.: +# - port: 4317 destinations: network: [] # E.g.: @@ -49,6 +52,9 @@ config: # Key: "/path/to/Key.pem" # peerVerify: false # template: "$(format-json .*)" + opentelemetry: [] +# E.g.: +# - url: "10.104.232.95:4317" rbac: create: true From 5b625922b12177116f6dacf665fab62604e26560 Mon Sep 17 00:00:00 2001 From: Attila Szakacs Date: Thu, 10 Aug 2023 15:44:35 +0200 Subject: [PATCH 39/51] collector: add service For receiving opentelemetry messages. Signed-off-by: Attila Szakacs --- .../templates/service.yaml | 19 +++++++++++++++++++ charts/axosyslog-collector/values.yaml | 4 ++++ 2 files changed, 23 insertions(+) create mode 100644 charts/axosyslog-collector/templates/service.yaml diff --git a/charts/axosyslog-collector/templates/service.yaml b/charts/axosyslog-collector/templates/service.yaml new file mode 100644 index 0000000000..434e9cc223 --- /dev/null +++ b/charts/axosyslog-collector/templates/service.yaml @@ -0,0 +1,19 @@ +{{- if .Values.service.create }} +--- +apiVersion: v1 +kind: Service +metadata: + name: "{{ template "axosyslog-collector.fullname" . }}" +spec: + selector: + app: "{{ template "axosyslog-collector.fullname" . }}" + release: {{ .Release.Name | quote }} + ports: +{{ if .Values.service.extraPorts }} +{{ toYaml ( .Values.service.extraPorts ) | nindent 4 }} +{{ end }} +{{ range .Values.config.sources.opentelemetry }} + - protocol: TCP + port: {{ .port | default 4317 }} +{{ end }} +{{- end }} diff --git a/charts/axosyslog-collector/values.yaml b/charts/axosyslog-collector/values.yaml index c2909c18f3..5711876368 100644 --- a/charts/axosyslog-collector/values.yaml +++ b/charts/axosyslog-collector/values.yaml @@ -66,6 +66,10 @@ openShift: create: true annotations: {} +service: + create: false + extraPorts: [] + serviceAccount: create: true annotations: {} From 8f887cb8409049aeffad703d1a9cc6e33d43633a Mon Sep 17 00:00:00 2001 From: Attila Szakacs Date: Thu, 10 Aug 2023 15:59:58 +0200 Subject: [PATCH 40/51] collector: bump version to 0.4.0 Signed-off-by: Attila Szakacs --- charts/axosyslog-collector/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/axosyslog-collector/Chart.yaml b/charts/axosyslog-collector/Chart.yaml index 2390190351..90fc179c62 100644 --- a/charts/axosyslog-collector/Chart.yaml +++ b/charts/axosyslog-collector/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: axosyslog-collector description: AxoSyslog Kubernetes log collector type: application -version: 0.3.0 +version: 0.4.0 appVersion: "4.3.1" From ebcce32b38bb71aa9485c050c4bae88f591883c2 Mon Sep 17 00:00:00 2001 From: Attila Szakacs Date: Fri, 11 Aug 2023 10:50:58 +0200 Subject: [PATCH 41/51] collector: add opentelemetry() parser Signed-off-by: Attila Szakacs --- charts/axosyslog-collector/templates/config.yaml | 5 +++++ charts/axosyslog-collector/values.yaml | 3 +++ 2 files changed, 8 insertions(+) diff --git a/charts/axosyslog-collector/templates/config.yaml b/charts/axosyslog-collector/templates/config.yaml index 730b9bc757..230c29d74a 100644 --- a/charts/axosyslog-collector/templates/config.yaml +++ b/charts/axosyslog-collector/templates/config.yaml @@ -31,6 +31,11 @@ data: ); }; {{- end }} +{{- if .Values.config.parsers.opentelemetry.enabled }} + parser { + opentelemetry(); + }; +{{- end }} {{- range .Values.config.destinations.network }} destination { network( diff --git a/charts/axosyslog-collector/values.yaml b/charts/axosyslog-collector/values.yaml index e238cdf413..abd03a6065 100644 --- a/charts/axosyslog-collector/values.yaml +++ b/charts/axosyslog-collector/values.yaml @@ -48,6 +48,9 @@ config: opentelemetry: [] # E.g.: # - port: 4317 + parsers: + opentelemetry: + enabled: false destinations: network: [] # E.g.: From b502ad96ed830ba0f6ff19fca0cdf6e4ccc4f86d Mon Sep 17 00:00:00 2001 From: Attila Szakacs Date: Fri, 11 Aug 2023 10:51:19 +0200 Subject: [PATCH 42/51] collector: add file() destination Signed-off-by: Attila Szakacs --- charts/axosyslog-collector/templates/config.yaml | 10 ++++++++++ charts/axosyslog-collector/values.yaml | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/charts/axosyslog-collector/templates/config.yaml b/charts/axosyslog-collector/templates/config.yaml index 230c29d74a..591ecf0ee6 100644 --- a/charts/axosyslog-collector/templates/config.yaml +++ b/charts/axosyslog-collector/templates/config.yaml @@ -36,6 +36,16 @@ data: opentelemetry(); }; {{- end }} +{{- range .Values.config.destinations.file }} + destination { + file( + {{ .path | quote }} + {{- if .template }} + template({{ .template | quote }}) + {{- end }} + ); + }; +{{- end }} {{- range .Values.config.destinations.network }} destination { network( diff --git a/charts/axosyslog-collector/values.yaml b/charts/axosyslog-collector/values.yaml index abd03a6065..f1ec73079a 100644 --- a/charts/axosyslog-collector/values.yaml +++ b/charts/axosyslog-collector/values.yaml @@ -52,6 +52,10 @@ config: opentelemetry: enabled: false destinations: + file: [] +# E.g.: +# - path: "/dev/stdout" +# template: "$(format-json .*)" network: [] # E.g.: # - transport: tcp From d3b5af7d89706aed6fba45e5be2b6050cc6cd825 Mon Sep 17 00:00:00 2001 From: Attila Szakacs Date: Fri, 11 Aug 2023 12:40:09 +0200 Subject: [PATCH 43/51] collector: add extraOptionsRaw for destinations Signed-off-by: Attila Szakacs --- charts/axosyslog-collector/templates/config.yaml | 12 ++++++++++++ charts/axosyslog-collector/values.yaml | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/charts/axosyslog-collector/templates/config.yaml b/charts/axosyslog-collector/templates/config.yaml index 591ecf0ee6..6f045b42ef 100644 --- a/charts/axosyslog-collector/templates/config.yaml +++ b/charts/axosyslog-collector/templates/config.yaml @@ -42,6 +42,9 @@ data: {{ .path | quote }} {{- if .template }} template({{ .template | quote }}) + {{- end }} + {{- if .extraOptionsRaw }} + {{ .extraOptionsRaw }} {{- end }} ); }; @@ -54,6 +57,9 @@ data: transport({{ .transport }}) {{- if .template }} template({{ .template | quote }}) + {{- end }} + {{- if .extraOptionsRaw }} + {{ .extraOptionsRaw }} {{- end }} ); }; @@ -93,6 +99,9 @@ data: peer-verify(no) {{- end }} ) + {{- end }} + {{- if .extraOptionsRaw }} + {{ .extraOptionsRaw }} {{- end }} ); }; @@ -101,6 +110,9 @@ data: destination { opentelemetry( url({{ tpl .url $ | quote }}) + {{- if .extraOptionsRaw }} + {{ .extraOptionsRaw }} + {{- end }} ); }; {{- end }} diff --git a/charts/axosyslog-collector/values.yaml b/charts/axosyslog-collector/values.yaml index f1ec73079a..d3f3917c03 100644 --- a/charts/axosyslog-collector/values.yaml +++ b/charts/axosyslog-collector/values.yaml @@ -56,12 +56,14 @@ config: # E.g.: # - path: "/dev/stdout" # template: "$(format-json .*)" +# extraOptionsRaw: "create-dirs(yes)" network: [] # E.g.: # - transport: tcp # address: localhost # port: 12345 # template: "$(format-json .*)" +# extraOptionsRaw: "time-reopen(10)" opensearch: [] # E.g.: # - address: 10.104.232.94 @@ -75,9 +77,11 @@ config: # Key: "/path/to/Key.pem" # peerVerify: false # template: "$(format-json .*)" +# extraOptionsRaw: "time-reopen(10)" opentelemetry: [] # E.g.: # - url: "10.104.232.95:4317" +# extraOptionsRaw: "time-reopen(10)" rbac: create: true From 77deb8088da22c8c63af42852a4ff349b7f20b54 Mon Sep 17 00:00:00 2001 From: Attila Szakacs Date: Fri, 11 Aug 2023 11:42:26 +0200 Subject: [PATCH 44/51] collector: bump version to 0.5.0 Signed-off-by: Attila Szakacs --- charts/axosyslog-collector/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/axosyslog-collector/Chart.yaml b/charts/axosyslog-collector/Chart.yaml index 90fc179c62..5cfa54303e 100644 --- a/charts/axosyslog-collector/Chart.yaml +++ b/charts/axosyslog-collector/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: axosyslog-collector description: AxoSyslog Kubernetes log collector type: application -version: 0.4.0 +version: 0.5.0 appVersion: "4.3.1" From 792b7cd6c1bfbbbfc12906ab356fe951e36c16cd Mon Sep 17 00:00:00 2001 From: Kristof Gyuracz Date: Thu, 23 Nov 2023 13:56:36 +0100 Subject: [PATCH 45/51] feat(k8s-source): add configurable fields for json paramaters --- charts/axosyslog-collector/README.md | 4 ++++ charts/axosyslog-collector/templates/config.yaml | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/charts/axosyslog-collector/README.md b/charts/axosyslog-collector/README.md index afa5a6836b..56d2987193 100644 --- a/charts/axosyslog-collector/README.md +++ b/charts/axosyslog-collector/README.md @@ -49,3 +49,7 @@ The following table lists the configurable parameters of the AxoSyslog Collector | tolerations | Tolerations for pod assignment | [] | | affinity | Pod affinity | {} | | updateStrategy | Update strategy for the DaemonSet | RollingUpdate | +| kubernetes.enabled | Enable kubernetes log collection | true | +| kubernetes.prefix | Set JSON prefix for logs collected from the k8s cluster | "" | +| kubernetes.keyDelimiter | Set JSON key delimiter for logs collected from the k8s cluster | "" | + diff --git a/charts/axosyslog-collector/templates/config.yaml b/charts/axosyslog-collector/templates/config.yaml index 6f045b42ef..3d7f144783 100644 --- a/charts/axosyslog-collector/templates/config.yaml +++ b/charts/axosyslog-collector/templates/config.yaml @@ -20,7 +20,14 @@ data: log { {{- if .Values.config.sources.kubernetes.enabled }} - source { kubernetes(); }; + source { kubernetes( + {{- if .Values.config.sources.kubernetes.prefix }} + prefix("{{ .Values.config.sources.kubernetes.prefix }}") + {{- end }} + {{- if .Values.config.sources.kubernetes.keyDelimiter }} + key-delimiter("{{ .Values.config.sources.kubernetes.keyDelimiter }}") + {{- end }} + ); }; {{- end }} {{- range .Values.config.sources.opentelemetry }} source { From 45f2be0f7ff08741493beec0cd6584e5c47136d2 Mon Sep 17 00:00:00 2001 From: Kristof Gyuracz Date: Thu, 23 Nov 2023 14:43:05 +0100 Subject: [PATCH 46/51] fixes for review --- charts/axosyslog-collector/templates/config.yaml | 4 ++-- charts/axosyslog-collector/values.yaml | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/charts/axosyslog-collector/templates/config.yaml b/charts/axosyslog-collector/templates/config.yaml index 3d7f144783..7f1c762b1c 100644 --- a/charts/axosyslog-collector/templates/config.yaml +++ b/charts/axosyslog-collector/templates/config.yaml @@ -22,10 +22,10 @@ data: {{- if .Values.config.sources.kubernetes.enabled }} source { kubernetes( {{- if .Values.config.sources.kubernetes.prefix }} - prefix("{{ .Values.config.sources.kubernetes.prefix }}") + prefix({{ .Values.config.sources.kubernetes.prefix | quote }}) {{- end }} {{- if .Values.config.sources.kubernetes.keyDelimiter }} - key-delimiter("{{ .Values.config.sources.kubernetes.keyDelimiter }}") + key-delimiter({{ .Values.config.sources.kubernetes.keyDelimiter | quote }}) {{- end }} ); }; {{- end }} diff --git a/charts/axosyslog-collector/values.yaml b/charts/axosyslog-collector/values.yaml index d3f3917c03..ebd2a378da 100644 --- a/charts/axosyslog-collector/values.yaml +++ b/charts/axosyslog-collector/values.yaml @@ -45,6 +45,9 @@ config: sources: kubernetes: enabled: true +# E.g.: +# prefix: "k8s~" +# keyDelimiter: "~" opentelemetry: [] # E.g.: # - port: 4317 From 2cbfab9bf7d98e1784d6c0b0c58874589ea22aa5 Mon Sep 17 00:00:00 2001 From: Kristof Gyuracz Date: Thu, 23 Nov 2023 15:34:52 +0100 Subject: [PATCH 47/51] bump chart version --- charts/axosyslog-collector/Chart.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/axosyslog-collector/Chart.yaml b/charts/axosyslog-collector/Chart.yaml index 5cfa54303e..6b9481ef97 100644 --- a/charts/axosyslog-collector/Chart.yaml +++ b/charts/axosyslog-collector/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: axosyslog-collector description: AxoSyslog Kubernetes log collector type: application -version: 0.5.0 -appVersion: "4.3.1" +version: 0.6.0 +appVersion: "4.4.0" From e9e7c3d6309d6bfb111c66ff317fe66ba0727371 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20V=C3=A1rady?= Date: Fri, 24 Nov 2023 17:14:16 +0100 Subject: [PATCH 48/51] axosyslog-collector: update AxoSyslog to v4.5.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: László Várady --- charts/axosyslog-collector/Chart.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/axosyslog-collector/Chart.yaml b/charts/axosyslog-collector/Chart.yaml index 6b9481ef97..ea4f60e02d 100644 --- a/charts/axosyslog-collector/Chart.yaml +++ b/charts/axosyslog-collector/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: axosyslog-collector description: AxoSyslog Kubernetes log collector type: application -version: 0.6.0 -appVersion: "4.4.0" +version: 0.7.0 +appVersion: "4.5.0" From 4357b92748a1e6e9d7a631d26dd1b74e46b84c9b Mon Sep 17 00:00:00 2001 From: Attila Szakacs Date: Mon, 11 Dec 2023 13:06:38 +0100 Subject: [PATCH 49/51] collector: add set rewrites configurability Signed-off-by: Attila Szakacs --- charts/axosyslog-collector/templates/config.yaml | 7 +++++++ charts/axosyslog-collector/values.yaml | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/charts/axosyslog-collector/templates/config.yaml b/charts/axosyslog-collector/templates/config.yaml index 7f1c762b1c..70a7368083 100644 --- a/charts/axosyslog-collector/templates/config.yaml +++ b/charts/axosyslog-collector/templates/config.yaml @@ -43,6 +43,13 @@ data: opentelemetry(); }; {{- end }} +{{- with .Values.config.rewrites.set }} + rewrite { +{{- range $k, $v := . }} + set({{ $v | quote }} value({{ $k | quote }})); +{{- end }} + }; +{{- end }} {{- range .Values.config.destinations.file }} destination { file( diff --git a/charts/axosyslog-collector/values.yaml b/charts/axosyslog-collector/values.yaml index ebd2a378da..8d983b6e89 100644 --- a/charts/axosyslog-collector/values.yaml +++ b/charts/axosyslog-collector/values.yaml @@ -54,6 +54,11 @@ config: parsers: opentelemetry: enabled: false + rewrites: + set: {} +# E.g.: +# foo: "${foovalue}" +# bar: "${barvalue}" destinations: file: [] # E.g.: From a2e1b0f0cf7c6deb1b2619b8b9a7a3b7fd39eb1f Mon Sep 17 00:00:00 2001 From: Attila Szakacs Date: Mon, 11 Dec 2023 13:08:27 +0100 Subject: [PATCH 50/51] collector: bump to version 0.8.0 Signed-off-by: Attila Szakacs --- charts/axosyslog-collector/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/axosyslog-collector/Chart.yaml b/charts/axosyslog-collector/Chart.yaml index ea4f60e02d..9f5f1eef46 100644 --- a/charts/axosyslog-collector/Chart.yaml +++ b/charts/axosyslog-collector/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: axosyslog-collector description: AxoSyslog Kubernetes log collector type: application -version: 0.7.0 +version: 0.8.0 appVersion: "4.5.0" From 756e23a5086009e668e2b47f20825e8163ad496d Mon Sep 17 00:00:00 2001 From: Balazs Scheidler Date: Fri, 22 Dec 2023 13:32:59 +0100 Subject: [PATCH 51/51] .github/workflows: rename chart release workflow and reference main branch Signed-off-by: Balazs Scheidler --- .github/workflows/{release.yml => release-charts.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{release.yml => release-charts.yml} (97%) diff --git a/.github/workflows/release.yml b/.github/workflows/release-charts.yml similarity index 97% rename from .github/workflows/release.yml rename to .github/workflows/release-charts.yml index 25146598e9..baabbd78ce 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release-charts.yml @@ -3,7 +3,7 @@ name: Release Charts on: push: branches: - - master + - main jobs: release: