Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions .github/workflows/lint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v3
uses: azure/setup-helm@v4.2.0
with:
version: v3.10.0
version: v3.17.0

# Python is required because `ct lint` runs Yamale (https://github.com/23andMe/Yamale) and
# yamllint (https://github.com/adrienverge/yamllint) which require Python
Expand All @@ -24,18 +24,19 @@ jobs:
check-latest: true

- name: Set up chart-testing
uses: helm/chart-testing-action@v2.3.1
uses: helm/chart-testing-action@v2.7.0

- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --config ct.yaml)
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
echo "changed=true" >> "$GITHUB_OUTPUT"
fi

- name: Run chart-testing (lint)
run: ct lint --config ct.yaml
if: steps.list-changed.outputs.changed == 'true'
run: ct lint --target-branch ${{ github.event.repository.default_branch }}

# - name: Create kind cluster
# uses: helm/kind-action@v1.1.0
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

Expand All @@ -20,9 +20,9 @@ jobs:
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"

- name: Set up Helm
uses: azure/setup-helm@v3
uses: azure/setup-helm@v4.2.0
with:
version: v3.10.0
version: v3.17.0

# # Optional step if GPG signing is used
# - name: Prepare GPG key
Expand Down
23 changes: 23 additions & 0 deletions charts/ocp-otel/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
11 changes: 11 additions & 0 deletions charts/ocp-otel/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v2
name: ocp-otel
description: A Helm chart for Kubernetes

type: application

version: 0.1.0

maintainers:
- name: paulczar
home: https://github.com/rh-mobb/helm-charts
55 changes: 55 additions & 0 deletions charts/ocp-otel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# MOBB OpenShift OpenTelemetry Helm Chart

This Helm Chart is designed to deploy the OTEL Operator and an OTEL Collector that will emulate the Cluster Log Forwarder operator in OpenShift.

It can be configured to collect Audit, Infra, and App logs from the cluster, as well as receive OTLP and FluentForward (Fluent,Vector) protocols.

It currently supports the debug exporter to validate logs are flowing as well as the S3 and Loki exporters to send logs directly to S3, or to an OpenShift LokiStack.

See the `./values.yaml` file for configurable options.

> Note if you want to export to S3, you'll need to configure IRSA or add the credentials as environment variables. Documentation for doing these will be added later.

1. Deploy the OTEL Operator

```bash
oc create namespace openshift-telemetry-operator
helm upgrade -n openshift-telemetry-operator otel-operator \
mobb/operatorhub --install \
--values ./files/otel-operator.yaml
```

1. Deploy the OpenShift Cluster Observability Operator (If wanting to install the UIPlugin for viewing Loki logs from the OpenShift Console). If you skip this step set `uiPlugin.enabled` to `false`.

```bash
oc create namespace openshift-cluster-observability-operator
helm upgrade -n openshift-cluster-observability-operator ocoo-operators \
mobb/operatorhub --install \
--values ./files/ocoo-operator.yaml
```

1. Wait a few moments and then validate the operator is installed

```bash
oc -n openshift-telemetry-operator rollout status \
deployment/opentelemetry-operator-controller-manager
```

```
deployment "opentelemetry-operator-controller-manager" successfully rolled out
```

1. Create the OpenTelemetry Collector

```bash
oc create namespace opentelemetry-logging
helm upgrade -n opentelemetry-logging ocp-otel . --install
```

1. fix needing this

```
oc adm policy add-scc-to-user opentelemetry-logging-scc \
-z ocp-otel-logging-collector

```
10 changes: 10 additions & 0 deletions charts/ocp-otel/files/ocoo-operator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
subscriptions:
- channel: stable
installPlanApproval: Automatic
name: cluster-observability-operator
source: redhat-operators
sourceNamespace: openshift-marketplace

operatorGroups:
- name: openshift-cluster-observability-operator-og
targetNamespace: all
10 changes: 10 additions & 0 deletions charts/ocp-otel/files/otel-operator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
subscriptions:
- channel: stable
installPlanApproval: Automatic
name: opentelemetry-product
source: redhat-operators
sourceNamespace: openshift-marketplace

operatorGroups:
- name: openshift-opentelemetry-og
targetNamespace: all
1 change: 1 addition & 0 deletions charts/ocp-otel/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.
62 changes: 62 additions & 0 deletions charts/ocp-otel/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "ocp-otel.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 "ocp-otel.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 "ocp-otel.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "ocp-otel.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "ocp-otel.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
34 changes: 34 additions & 0 deletions charts/ocp-otel/templates/cluster-role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: opentelemetry-logging
rules:
- apiGroups: ["config.openshift.io"]
resources: ["infrastructures", "infrastructures/status"]
verbs: ["get", "watch", "list"]
- apiGroups: [""]
resources: ["pods", "nodes", "namespaces"]
verbs: ["get", "list", "watch"]
- apiGroups: ["apps"]
resources: ["deployments", "replicasets", "statefulsets"]
verbs: ["get", "list", "watch"]
- apiGroups: ["config.openshift.io"]
resources: ["infrastructures", "infrastructures/status"]
verbs: ["get", "list", "watch"]
- apiGroups: ["loki.grafana.com"]
resourceNames: ["logs"]
resources: ["application","audit","infrastructure"]
verbs: ["create"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "ocp-otel.serviceAccountName" . }}-logging-collector
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: opentelemetry-logging
subjects:
- kind: ServiceAccount
name: {{ include "ocp-otel.serviceAccountName" . }}-logging-collector
namespace: {{ .Release.Namespace }}
Loading