Skip to content

Commit 57d1f0e

Browse files
committed
Merge branch 'update-migration-script' of https://github.com/opendevstack/ods-core into update-migration-script
2 parents 3e240e4 + 0f45c0f commit 57d1f0e

19 files changed

Lines changed: 569 additions & 2 deletions

CHANGELOG.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,18 @@
77

88
### Changed
99
- Nexus storage change ([#1341](https://github.com/opendevstack/ods-core/issues/1341))
10-
- Security improvements ([#1328](https://github.com/opendevstack/ods-core/pull/1328))
11-
- Update Aqua cli to 760 ([#1344](https://github.com/opendevstack/ods-core/pull/1344))
1210
- Update PVC migration script, adding threads to rsync execution ([#1345](https://github.com/opendevstack/ods-core/pull/1345))
11+
- Update Aqua cli to 760 ([#1344](https://github.com/opendevstack/ods-core/pull/1344))
12+
1313

1414
### Fixed
1515

1616

17+
## [4.9.0] - 2025-8-06
18+
19+
- Security improvements ([#1328](https://github.com/opendevstack/ods-core/pull/1328))
20+
- Added Helm Opentelemetry Collector Infrastructure configuration (([#1339](https://github.com/opendevstack/ods-core/issues/1339))
21+
1722
## [4.8.0] - 2025-4-10
1823

1924
### Added

Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,22 @@ configure-nexus:
163163
### configure-nexus is not part of install-nexus because it is not idempotent yet.
164164

165165

166+
# OPENTELEMETRY COLLECTOR
167+
## Install or update Opentelemetry Collector.
168+
install-opentelemetry-collector: apply-opentelemetry-collector-chart start-opentelemetry-collector-build
169+
.PHONY: opentelemetry-collector
170+
171+
## Apply OpenShift resources related to the Opentelemetry Collector.
172+
apply-opentelemetry-collector-chart:
173+
cd opentelemetry-collector/chart && envsubst < values.yaml.template > values.yaml && helm upgrade --install --namespace $(ODS_NAMESPACE) opentelemetry-collector . && rm values.yaml
174+
.PHONY: apply-opentelemetry-collector-chart
175+
176+
## Start build of BuildConfig "Opentelemetry Collector".
177+
start-opentelemetry-collector-build:
178+
ocp-scripts/start-and-follow-build.sh --namespace $(ODS_NAMESPACE) --build-config opentelemetry-collector
179+
.PHONY: start-opentelemetry-collector-build
180+
181+
166182
# BACKUP
167183
## Create a backup of the current state.
168184
backup: backup-sonarqube backup-ocp-config

configuration-sample/ods-core.env.sample

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,3 +426,31 @@ AQUA_ALERT_EMAILS=
426426

427427
# The name of a Nexus repository to store the reports generated by Aqua
428428
AQUA_NEXUS_REPOSITORY=leva-documentation
429+
430+
##########################
431+
# Opentelemety Collector #
432+
##########################
433+
# The docker image used to build the Opentelemetry Collector
434+
OPENTELEMETRY_COLLECTOR_IMAGE=otel/opentelemetry-collector-k8s
435+
436+
# The docker image tag used to build the Opentelemetry Collector
437+
OPENTELEMETRY_COLLECTOR_IMAGE_TAG=0.123.0-amd64
438+
439+
# The Go memory limit for the Opentelemetry Collector
440+
OPENTELEMETRY_COLLECTOR_GOMEMLIMIT=128MiB
441+
442+
# The endpoint to send telemetry data using the OpenTelemetry Protocol (OTLP)
443+
OPENTELEMETRY_COLLECTOR_OTLP_API_ENDPOINT=https://fake-jaeger/v1/traces
444+
445+
# The Authorization Token used to authenticate requests sent to the OTLP_API_ENDPOINT
446+
OPENTELEMETRY_COLLECTOR_OTLP_API_TOKEN=Api-Token fakeJaegerIDToken
447+
448+
# The Host of the Opentelemetry Collector
449+
OPENTELEMETRY_COLLECTOR_INGRESS_HOST=fake.opentelemetry-collector.com
450+
451+
# Resource requests and limits for the Opentelemetry Collector
452+
OPENTELEMETRY_COLLECTOR_CPU_REQUEST=200m
453+
OPENTELEMETRY_COLLECTOR_MEMORY_REQUEST=128Mi
454+
OPENTELEMETRY_COLLECTOR_CPU_LIMIT=1
455+
OPENTELEMETRY_COLLECTOR_MEMORY_LIMIT=256Mi
456+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

opentelemetry-collector/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Opentelemetry Collector
2+
3+
The OpenTelemetry Collector is a vendor-agnostic way to receive, process, and export telemetry data. It supports various data formats and protocols, making it easy to collect and distribute your observability data.
4+
5+
## Setup
6+
7+
The OpenShift templates are located in the chart directory and can be compared with the OC cluster using Helm. For example, run cd chart && helm secrets diff upgrade to see if there is any drift between the current and desired state.
8+
9+
To install the OpenTelemetry Collector, run:
10+
11+
`helm install opentelemetry-collector .`
12+
13+
## Configuration
14+
15+
All the relevant configuration of the Opentelemetry Collector is store in the config map named collector-config in the same namespace where is running the pod.
16+
17+
## Building a new image
18+
19+
Push to this repository, then go to the build config in OC and start a new build.
20+
21+
Aditionally you can run `make start-opentelemetry-collector-build`.
22+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
apiVersion: v2
2+
name: opentelemetry-collector
3+
description: A Helm chart for Kubernetes that defines a Opentelemetry Collector
4+
icon: https://opentelemetry.io/img/logos/opentelemetry-horizontal-color.svg
5+
6+
# A chart can be either an 'application' or a 'library' chart.
7+
#
8+
# Application charts are a collection of templates that can be packaged into versioned archives
9+
# to be deployed.
10+
#
11+
# Library charts provide useful utilities or functions for the chart developer. They're included as
12+
# a dependency of application charts to inject those utilities and functions into the rendering
13+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
14+
type: application
15+
16+
# This is the chart version. This version number should be incremented each time you make changes
17+
# to the chart and its templates, including the app version.
18+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
19+
version: 0.1.0
20+
21+
# This is the version number of the application being deployed. This version number should be
22+
# incremented each time you make changes to the application. Versions are not expected to
23+
# follow Semantic Versioning. They should reflect the version the application is using.
24+
# It is recommended to use it with quotes.
25+
appVersion: "0.123.0-amd64"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
1. Get the application URL by running these commands:
2+
{{- if .Values.ingress.enabled }}
3+
{{- range $host := .Values.ingress.hosts }}
4+
{{- range .paths }}
5+
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
6+
{{- end }}
7+
{{- end }}
8+
{{- else if contains "NodePort" .Values.service.type }}
9+
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "opentelemetry-collector.fullname" . }})
10+
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
11+
echo http://$NODE_IP:$NODE_PORT
12+
{{- else if contains "LoadBalancer" .Values.service.type }}
13+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
14+
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "opentelemetry-collector.fullname" . }}'
15+
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "opentelemetry-collector.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
16+
echo http://$SERVICE_IP:{{ .Values.service.port }}
17+
{{- else if contains "ClusterIP" .Values.service.type }}
18+
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "opentelemetry-collector.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
19+
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
20+
echo "Visit http://127.0.0.1:8080 to use your application"
21+
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
22+
{{- end }}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "opentelemetry-collector.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "opentelemetry-collector.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "opentelemetry-collector.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "opentelemetry-collector.labels" -}}
37+
helm.sh/chart: {{ include "opentelemetry-collector.chart" . }}
38+
{{ include "opentelemetry-collector.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "opentelemetry-collector.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "opentelemetry-collector.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "opentelemetry-collector.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "opentelemetry-collector.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
apiVersion: build.openshift.io/v1
2+
kind: BuildConfig
3+
metadata:
4+
labels:
5+
app: {{ .Values.collector.name }}
6+
name: {{ .Values.collector.name }}
7+
spec:
8+
failedBuildsHistoryLimit: 5
9+
nodeSelector: null
10+
output:
11+
to:
12+
kind: ImageStreamTag
13+
name: {{ printf "%s:%s" .Values.collector.name .Values.global.odsImageTag }}
14+
postCommit: {}
15+
resources:
16+
limits:
17+
cpu: {{ .Values.buildConfig.cpuLimit }}
18+
memory: {{ .Values.buildConfig.memLimit }}
19+
requests:
20+
cpu: {{ .Values.buildConfig.cpuRequest }}
21+
memory: {{ .Values.buildConfig.memRequest }}
22+
runPolicy: Serial
23+
source:
24+
contextDir: opentelemetry-collector/docker
25+
git:
26+
uri: {{ .Values.global.repoBase }}/{{ .Values.global.odsBitBucketProject }}/ods-core.git
27+
ref: {{ .Values.global.odsGitRef }}
28+
sourceSecret:
29+
name: cd-user-token
30+
type: Git
31+
strategy:
32+
type: Docker
33+
dockerStrategy:
34+
from:
35+
kind: DockerImage
36+
name: {{ .Values.collector.image }}:{{ .Values.collector.imageTag }}
37+
forcePull: true
38+
noCache: true
39+
successfulBuildsHistoryLimit: 5
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: collector-config
5+
data:
6+
otel-collector-config.yaml: |
7+
receivers:
8+
otlp:
9+
protocols:
10+
grpc:
11+
endpoint: 0.0.0.0:4317
12+
http:
13+
endpoint: 0.0.0.0:4318
14+
exporters:
15+
otlphttp:
16+
endpoint: ${OTLP_API_ENDPOINT}
17+
headers:
18+
Authorization: "${OTLP_API_TOKEN}"
19+
debug:
20+
verbosity: normal
21+
extensions:
22+
health_check:
23+
endpoint: ${env:MY_POD_IP}:13133
24+
processors:
25+
batch: {}
26+
memory_limiter:
27+
check_interval: 5s
28+
limit_percentage: 80
29+
spike_limit_percentage: 25
30+
service:
31+
extensions:
32+
- health_check
33+
pipelines:
34+
traces:
35+
receivers: [otlp]
36+
processors: []
37+
exporters: [debug, otlphttp]
38+
metrics:
39+
exporters: [debug]
40+
processors: [memory_limiter, batch]
41+
receivers: [otlp]
42+
logs:
43+
receivers: [otlp]
44+
processors: [memory_limiter, batch]
45+
exporters: [debug]
46+
telemetry:
47+
metrics:
48+
address: ${env:MY_POD_IP}:8888

0 commit comments

Comments
 (0)