Skip to content

Commit 5e36c50

Browse files
authored
Merge pull request #1382 from kube-logging/chart-merge
Single chart for logging operator and a configurable logging resource
2 parents 912ea0e + 5281ded commit 5e36c50

File tree

64 files changed

+1033
-62030
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+1033
-62030
lines changed

Makefile

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ BIN := ${PWD}/bin
44

55
export PATH := $(BIN):$(PATH)
66

7-
OS = $(shell go env GOOS)
8-
ARCH = $(shell go env GOARCH)
7+
OS := $(shell go env GOOS)
8+
ARCH := $(shell go env GOARCH)
99

1010
DOCKER ?= docker
11-
GOVERSION = $(shell go env GOVERSION)
11+
GOVERSION := $(shell go env GOVERSION)
1212

1313
# Image name to use for building/pushing image targets
1414
IMG ?= controller:local
@@ -33,6 +33,9 @@ ENVTEST_BINARY_ASSETS := ${ENVTEST_BIN_DIR}/bin
3333
GOLANGCI_LINT := ${BIN}/golangci-lint
3434
GOLANGCI_LINT_VERSION := v1.51.2
3535

36+
HELM_DOCS := ${BIN}/helm-docs
37+
HELM_DOCS_VERSION = 1.11.0
38+
3639
KIND := ${BIN}/kind
3740
KIND_VERSION := v0.19.0
3841
KIND_IMAGE := kindest/node:v1.23.17@sha256:f77f8cf0b30430ca4128cc7cfafece0c274a118cd0cdb251049664ace0dee4ff
@@ -57,7 +60,7 @@ all: manager
5760
check: license-check lint test
5861

5962
.PHONY: check-diff
60-
check-diff: generate fmt manifests
63+
check-diff: generate fmt manifests helm-docs
6164
git diff --exit-code ':(exclude)./ADOPTERS.md' ':(exclude)./docs/*'
6265

6366
.PHONY: debug
@@ -135,8 +138,10 @@ manager: generate fmt vet ## Build manager binary
135138
manifests: ${CONTROLLER_GEN} ## Generate manifests e.g. CRD, RBAC etc.
136139
cd pkg/sdk && $(CONTROLLER_GEN) $(CRD_OPTIONS) webhook paths="./..." output:crd:artifacts:config=../../config/crd/bases output:webhook:artifacts:config=../../config/webhook
137140
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role paths="./controllers/..." output:rbac:artifacts:config=./config/rbac
138-
cp config/crd/bases/* e2e/charts/logging-operator/crds/
139-
echo "{{- if .Values.rbac.enabled }}" > ./e2e/charts/logging-operator/templates/clusterrole.yaml && cat config/rbac/role.yaml |sed -e 's@manager-role@{{ template "logging-operator.fullname" . }}@' | cat >> ./e2e/charts/logging-operator/templates/clusterrole.yaml && echo "{{- end }}" >> ./e2e/charts/logging-operator/templates/clusterrole.yaml
141+
cp config/crd/bases/* charts/logging-operator/crds/
142+
echo "{{- if .Values.rbac.enabled }}" > ./charts/logging-operator/templates/clusterrole.yaml
143+
cat config/rbac/role.yaml | sed -e 's@manager-role@{{ template "logging-operator.fullname" . }}@' | sed -e '/creationTimestamp/d' | cat >> ./charts/logging-operator/templates/clusterrole.yaml
144+
echo "{{- end }}" >> ./charts/logging-operator/templates/clusterrole.yaml
140145

141146
.PHONY: run
142147
run: generate fmt vet ## Run against the configured Kubernetes cluster in ~/.kube/config
@@ -171,6 +176,10 @@ vet: ## Run go vet against code
171176
kind-cluster: ${KIND}
172177
kind create cluster --name $(KIND_CLUSTER) --image $(KIND_IMAGE)
173178

179+
.PHONY: helm-docs
180+
helm-docs: ${HELM_DOCS}
181+
${HELM_DOCS} -s file -c charts/ -t ../charts-docs/templates/overrides.gotmpl -t README.md.gotmpl
182+
174183
## =========================
175184
## == Tool dependencies ==
176185
## =========================
@@ -238,6 +247,12 @@ stern: | ${BIN}
238247
${ENVTEST_BIN_DIR}: | ${BIN}
239248
mkdir -p $@
240249

250+
${HELM_DOCS}: ${HELM_DOCS}-${HELM_DOCS_VERSION}
251+
@ln -sf ${HELM_DOCS}-${HELM_DOCS_VERSION} ${HELM_DOCS}
252+
${HELM_DOCS}-${HELM_DOCS_VERSION}:
253+
@mkdir -p bin
254+
curl -L https://github.com/norwoodj/helm-docs/releases/download/v${HELM_DOCS_VERSION}/helm-docs_${HELM_DOCS_VERSION}_$(shell uname)_x86_64.tar.gz | tar -zOxf - helm-docs > ${HELM_DOCS}-${HELM_DOCS_VERSION} && chmod +x ${HELM_DOCS}-${HELM_DOCS_VERSION}
255+
241256
${BIN}:
242257
mkdir -p bin
243258

charts-docs/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Helm chart documentation
2+
3+
README files for Helm charts are generated using [helm-docs](https://github.com/norwoodj/helm-docs).
4+
5+
Each chart should contain a `README.md.gotmpl` file that describes how
6+
the `README.md` of the chart should be generated.
7+
8+
Normally, this file can be the same as the primary template in [docs/templates/README.md.gotmpl] or a symlink pointing to it:
9+
10+
```bash
11+
cd charts/CHART
12+
ln -s ../../charts-docs/templates/README.md.gotmpl
13+
```
14+
15+
Copy the file to the chart directory if you want to customize the template.
16+
17+
**Note:** Don't forget to add `README.md.gotmpl` to `.helmignore`.
18+
19+
Then run `make docs` in the repository root.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{{ template "chart.header" . }}
2+
3+
{{ template "chart.typeBadge" . }} {{ template "chart.kubeVersionBadge" . }} {{ template "chart.artifactHubBadge" . }}
4+
5+
{{ template "chart.description" . }}
6+
7+
{{ template "chart.homepageLine" . }}
8+
9+
{{ template "tldr" . }}
10+
11+
{{ template "chart.valuesSection" . }}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{{- define "chart.typeBadge" -}}
2+
{{- if .Type -}}![type: {{ .Type }}](https://img.shields.io/badge/type-{{ .Type }}-informational?style=flat-square){{- end -}}
3+
{{- end -}}
4+
5+
{{- define "chart.kubeVersionBadge" -}}
6+
{{- if .KubeVersion -}}![kube version: {{ .KubeVersion }}](https://img.shields.io/badge/kube%20version-{{ .KubeVersion | replace "-" "--" }}-informational?style=flat-square){{- end -}}
7+
{{- end -}}
8+
9+
{{- define "chart.artifactHubBadge" -}}
10+
[![artifact hub](https://img.shields.io/badge/artifact%20hub-{{ .Name | replace "-" "--" }}-informational?style=flat-square)](https://artifacthub.io/packages/helm/kube-logging/{{ .Name }})
11+
{{- end -}}
12+
13+
{{- define "tldr" -}}
14+
## TL;DR;
15+
16+
```bash
17+
helm install --generate-name --wait oci://ghcr.io/kube-logging/helm-charts/{{ .Name }}
18+
```
19+
20+
or to install with a specific version:
21+
22+
```bash
23+
helm install --generate-name --wait oci://ghcr.io/kube-logging/helm-charts/{{ .Name }} --version $VERSION
24+
```
25+
{{- end -}}
26+
27+
{{- define "chart.badges" -}}
28+
{{ template "chart.typeBadge" . }} {{ template "chart.kubeVersionBadge" . }} {{ template "chart.artifactHubBadge" . }}
29+
{{- end -}}
30+
31+
{{- define "chart.baseHead" -}}
32+
{{ template "chart.header" . }}
33+
34+
{{ template "chart.badges" . }}
35+
36+
{{ template "chart.description" . }}
37+
38+
{{ template "chart.homepageLine" . }}
39+
40+
{{ template "tldr" . }}
41+
{{- end -}}
42+
43+
{{- define "chart.base" -}}
44+
{{ template "chart.baseHead" . }}
45+
46+
{{ template "chart.valuesSection" . }}
47+
{{- end -}}

charts/logging-operator-logging/README.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

charts/logging-operator/README.md

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# logging-operator
22

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

55
Logging operator for Kubernetes based on Fluentd and Fluentbit.
66

@@ -9,8 +9,13 @@ Logging operator for Kubernetes based on Fluentd and Fluentbit.
99
## TL;DR;
1010

1111
```bash
12-
helm repo add kube-logging https://kube-logging.github.io/helm-charts
13-
helm install --generate-name --wait kube-logging/logging-operator
12+
helm install --generate-name --wait oci://ghcr.io/kube-logging/helm-charts/logging-operator
13+
```
14+
15+
or to install with a specific version:
16+
17+
```bash
18+
helm install --generate-name --wait oci://ghcr.io/kube-logging/helm-charts/logging-operator --version $VERSION
1419
```
1520

1621
## Introduction
@@ -62,8 +67,45 @@ Use `createCustomResource=false` with Helm v3 to avoid trying to create CRDs fro
6267
| tolerations | list | `[]` | Node Tolerations |
6368
| affinity | object | `{}` | Node Affinity |
6469
| podLabels | object | `{}` | Define which Nodes the Pods are scheduled on. |
70+
| logging | object | `{"allowClusterResourcesFromAllNamespaces":false,"clusterDomain":"cluster.local","clusterFlows":[],"clusterOutputs":[],"controlNamespace":"","defaultFlow":{},"enableRecreateWorkloadOnImmutableFieldChange":false,"enabled":false,"errorOutputRef":"","eventTailer":{},"flowConfigCheckDisabled":false,"flowConfigOverride":"","fluentbit":{},"fluentbitDisabled":false,"fluentd":{},"fluentdDisabled":false,"globalFilters":[],"hostTailer":{},"loggingRef":"","nodeAgents":{},"skipInvalidResources":false,"syslogNG":{},"watchNamespaces":[]}` | Logging resources configuration. |
71+
| logging.enabled | bool | `false` | Logging resources are disabled by default |
72+
| logging.loggingRef | string | `""` | Reference to the logging system. Each of the loggingRefs can manage a fluentbit daemonset and a fluentd statefulset. |
73+
| logging.flowConfigCheckDisabled | bool | `false` | Disable configuration check before applying new fluentd configuration. |
74+
| logging.skipInvalidResources | bool | `false` | Whether to skip invalid Flow and ClusterFlow resources |
75+
| logging.flowConfigOverride | string | `""` | Override generated config. This is a raw configuration string for troubleshooting purposes. |
76+
| logging.fluentbitDisabled | bool | `false` | Flag to disable fluentbit completely |
77+
| logging.fluentbit | object | `{}` | Fluent-bit configurations https://kube-logging.github.io/docs/configuration/crds/v1beta1/fluentbit_types/ |
78+
| logging.fluentdDisabled | bool | `false` | Flag to disable fluentd completely |
79+
| logging.fluentd | object | `{}` | Fluentd configurations https://kube-logging.github.io/docs/configuration/crds/v1beta1/fluentd_types/ |
80+
| logging.syslogNG | object | `{}` | Syslog-NG statefulset configuration |
81+
| logging.defaultFlow | object | `{}` | Default flow for unmatched logs. This Flow configuration collects all logs that didn’t match any other Flow. |
82+
| logging.errorOutputRef | string | `""` | GlobalOutput name to flush ERROR events to |
83+
| logging.globalFilters | list | `[]` | Global filters to apply on logs before any match or filter mechanism. |
84+
| logging.watchNamespaces | list | `[]` | Limit namespaces to watch Flow and Output custom resources. |
85+
| logging.clusterDomain | string | `"cluster.local"` | Cluster domain name to be used when templating URLs to services |
86+
| logging.controlNamespace | string | `""` | Namespace for cluster wide configuration resources like ClusterFlow and ClusterOutput. This should be a protected namespace from regular users. Resources like fluentbit and fluentd will run in this namespace as well. |
87+
| logging.allowClusterResourcesFromAllNamespaces | bool | `false` | Allow configuration of cluster resources from any namespace. Mutually exclusive with ControlNamespace restriction of Cluster resources |
88+
| logging.nodeAgents | object | `{}` | NodeAgent Configuration |
89+
| logging.enableRecreateWorkloadOnImmutableFieldChange | bool | `false` | EnableRecreateWorkloadOnImmutableFieldChange enables the operator to recreate the fluentbit daemonset and the fluentd statefulset (and possibly other resource in the future) in case there is a change in an immutable field that otherwise couldn’t be managed with a simple update. |
90+
| logging.clusterFlows | list | `[]` | ClusterFlows to deploy |
91+
| logging.clusterOutputs | list | `[]` | ClusterOutputs to deploy |
92+
| logging.eventTailer | object | `{}` | EventTailer config |
93+
| logging.hostTailer | object | `{}` | HostTailer config |
94+
| testReceiver.enabled | bool | `false` | |
95+
| testReceiver.image | string | `"fluent/fluent-bit"` | |
96+
| testReceiver.port | int | `8080` | |
97+
| testReceiver.args[0] | string | `"-i"` | |
98+
| testReceiver.args[1] | string | `"http"` | |
99+
| testReceiver.args[2] | string | `"-p"` | |
100+
| testReceiver.args[3] | string | `"port=8080"` | |
101+
| testReceiver.args[4] | string | `"-o"` | |
102+
| testReceiver.args[5] | string | `"stdout"` | |
103+
| testReceiver.resources.limits.cpu | string | `"100m"` | |
104+
| testReceiver.resources.limits.memory | string | `"50Mi"` | |
105+
| testReceiver.resources.requests.cpu | string | `"20m"` | |
106+
| testReceiver.resources.requests.memory | string | `"25Mi"` | |
65107

66108
## Installing Fluentd and Fluent-bit via logging
67109

68-
The previous chart does **not** install `logging` resource to deploy Fluentd and Fluent-bit on cluster.
69-
To install them please use the [Logging Operator Logging](https://github.com/kube-logging/helm-charts/tree/main/charts/logging-operator-logging) chart.
110+
The chart does **not** install `logging` resource to deploy Fluentd (or Syslog-ng) and Fluent-bit on the cluster by default, but
111+
it can be enabled by setting the `logging.enabled` value to true.

charts/logging-operator/README.md.gotmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ Use `createCustomResource=false` with Helm v3 to avoid trying to create CRDs fro
1616

1717
## Installing Fluentd and Fluent-bit via logging
1818

19-
The previous chart does **not** install `logging` resource to deploy Fluentd and Fluent-bit on cluster.
20-
To install them please use the [Logging Operator Logging](https://github.com/kube-logging/helm-charts/tree/main/charts/logging-operator-logging) chart.
19+
The chart does **not** install `logging` resource to deploy Fluentd (or Syslog-ng) and Fluent-bit on the cluster by default, but
20+
it can be enabled by setting the `logging.enabled` value to true.

charts/logging-operator/crds/logging-extensions.banzaicloud.io_eventtailers.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,31 @@ spec:
447447
type: string
448448
type: object
449449
type: object
450+
secret:
451+
properties:
452+
defaultMode:
453+
format: int32
454+
type: integer
455+
items:
456+
items:
457+
properties:
458+
key:
459+
type: string
460+
mode:
461+
format: int32
462+
type: integer
463+
path:
464+
type: string
465+
required:
466+
- key
467+
- path
468+
type: object
469+
type: array
470+
optional:
471+
type: boolean
472+
secretName:
473+
type: string
474+
type: object
450475
type: object
451476
workloadMetaOverrides:
452477
properties:

charts/logging-operator/crds/logging.banzaicloud.io_fluentbitagents.yaml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,31 @@ spec:
539539
type: string
540540
type: object
541541
type: object
542+
secret:
543+
properties:
544+
defaultMode:
545+
format: int32
546+
type: integer
547+
items:
548+
items:
549+
properties:
550+
key:
551+
type: string
552+
mode:
553+
format: int32
554+
type: integer
555+
path:
556+
type: string
557+
required:
558+
- key
559+
- path
560+
type: object
561+
type: array
562+
optional:
563+
type: boolean
564+
secretName:
565+
type: string
566+
type: object
542567
type: object
543568
bufferVolumeArgs:
544569
items:
@@ -1643,6 +1668,31 @@ spec:
16431668
type: string
16441669
type: object
16451670
type: object
1671+
secret:
1672+
properties:
1673+
defaultMode:
1674+
format: int32
1675+
type: integer
1676+
items:
1677+
items:
1678+
properties:
1679+
key:
1680+
type: string
1681+
mode:
1682+
format: int32
1683+
type: integer
1684+
path:
1685+
type: string
1686+
required:
1687+
- key
1688+
- path
1689+
type: object
1690+
type: array
1691+
optional:
1692+
type: boolean
1693+
secretName:
1694+
type: string
1695+
type: object
16461696
type: object
16471697
positiondb:
16481698
properties:
@@ -1780,6 +1830,31 @@ spec:
17801830
type: string
17811831
type: object
17821832
type: object
1833+
secret:
1834+
properties:
1835+
defaultMode:
1836+
format: int32
1837+
type: integer
1838+
items:
1839+
items:
1840+
properties:
1841+
key:
1842+
type: string
1843+
mode:
1844+
format: int32
1845+
type: integer
1846+
path:
1847+
type: string
1848+
required:
1849+
- key
1850+
- path
1851+
type: object
1852+
type: array
1853+
optional:
1854+
type: boolean
1855+
secretName:
1856+
type: string
1857+
type: object
17831858
type: object
17841859
readinessProbe:
17851860
properties:

0 commit comments

Comments
 (0)