Skip to content

Commit 182ff45

Browse files
rdiscalaclaude
andcommitted
CNF-14592: add LokiStack configuration CRs
Add Loki Operator installation and LokiStack log storage CRs for the telco-core optional logging configuration: - LokiStack CR with 1x.extra-small sizing, S3 storage, v13 schema, and 5-day retention - Loki Operator Namespace, OperatorGroup, Subscription, and installation status verification CR - S3 object storage Secret template - Update ClusterLogForwarder to enable local Loki storage by default with audit and infrastructure log forwarding, plus commented examples for external system integration (Kafka, Splunk, etc.) - Update core-overlay.yaml PolicyGenerator to demonstrate adding external forwarding to the base Loki configuration - Add kube-compare reference templates for validation This implements "optional but enabled by default" pattern: CRs are in the optional/ folder and commented in PolicyGenerators, but when enabled provide a complete working Loki configuration that supports both local CNF vendor troubleshooting and external OSS/BSS forwarding. Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 9d52c48 commit 182ff45

16 files changed

Lines changed: 246 additions & 40 deletions

telco-core/configuration/core-baseline.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ policies:
4747
status: "True"
4848
reason: InstallSucceeded
4949

50+
# Loki operator (optional component)
51+
# - path: reference-crs/optional/logging/LokiOperatorNS.yaml
52+
# - path: reference-crs/optional/logging/LokiOperatorGroup.yaml
53+
# - path: reference-crs/optional/logging/LokiSubscription.yaml
54+
# - path: reference-crs/optional/logging/LokiOperatorStatus.yaml
55+
5056
# Cert-manager operator (optional component)
5157
# - path: reference-crs/optional/cert-manager/certManagerNS.yaml
5258
# - path: reference-crs/optional/cert-manager/certManagerOperatorgroup.yaml
@@ -93,6 +99,10 @@ policies:
9399
- path: reference-crs/optional/logging/ClusterLogServiceAccountAuditBinding.yaml
94100
- path: reference-crs/optional/logging/ClusterLogServiceAccountInfrastructureBinding.yaml
95101

102+
# LokiStack log storage (optional component)
103+
# - path: reference-crs/optional/logging/LokiSecret.yaml
104+
# - path: reference-crs/optional/logging/LokiStack.yaml
105+
96106
- path: reference-crs/required/networking/sriov/SriovOperatorConfig.yaml
97107
patches:
98108
- spec:

telco-core/configuration/core-overlay.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,14 @@ policies:
174174
# profile: custom-worker-profile
175175

176176
# Cluster Logging
177+
# The base ClusterLogForwarder.yaml includes local Loki storage by default.
178+
# This example patch adds external Kafka forwarding with custom labels.
177179
- path: reference-crs/optional/logging/ClusterLogForwarder.yaml
178180
patches:
179181
- spec:
180182
outputs:
183+
# Loki output is already configured in the base CR
184+
# Add external output for OSS/BSS systems
181185
- type: "kafka"
182186
name: kafka-open
183187
kafka:
@@ -190,7 +194,9 @@ policies:
190194
siteuuid: '{{hub fromConfigMap "" .ManagedClusterName "logging-uuid" | toLiteral hub}}'
191195
label3: 'other data'
192196
pipelines:
193-
- name: all-to-default
197+
# Loki pipeline is already configured in the base CR
198+
# Add pipeline for external forwarding
199+
- name: all-to-external
194200
inputRefs:
195201
- audit
196202
- infrastructure

telco-core/configuration/reference-crs-kube-compare/compare_ignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ required/machine-config/container-runtime.yaml
1313
ClusterLogging5Cleanup.yaml
1414
ClusterLogOperatorStatus.yaml
1515

16+
# Utility object for Loki Operator installation verification
17+
LokiOperatorStatus.yaml
18+
1619
# Utility objects to wait for and acknowledge cluster ugprades
1720
ClusterVersion.yaml
1821
upgrade-ack.yaml

telco-core/configuration/reference-crs-kube-compare/optional/logging/ClusterLogForwarder.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ metadata:
66
spec:
77
{{- if .spec.outputs }}
88
outputs:
9-
- name: {{ (index .spec.outputs 0).name }}
10-
type: kafka
11-
kafka:
12-
url: {{ (index .spec.outputs 0).kafka.url }}
9+
{{- .spec.outputs | toYaml | nindent 2 }}
1310
{{- end }}
1411
{{- if .spec.filters }}
1512
filters:
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: operators.coreos.com/v1
2+
kind: OperatorGroup
3+
metadata:
4+
name: loki-operator
5+
namespace: openshift-operators-redhat
6+
annotations:
7+
operatorframework.io/bundle-unpack-min-retry-interval: 10m
8+
spec:
9+
{{- if .spec.upgradeStrategy }}
10+
upgradeStrategy: Default
11+
{{- end }}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: openshift-operators-redhat
5+
labels:
6+
openshift.io/cluster-monitoring: "true"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: logging-loki-s3
5+
namespace: openshift-logging
6+
stringData:
7+
access_key_id: {{ .stringData.access_key_id }}
8+
access_key_secret: {{ .stringData.access_key_secret }}
9+
bucketnames: {{ .stringData.bucketnames }}
10+
endpoint: {{ .stringData.endpoint }}
11+
region: {{ .stringData.region }}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
apiVersion: loki.grafana.com/v1
2+
kind: LokiStack
3+
metadata:
4+
name: logging-loki
5+
namespace: openshift-logging
6+
spec:
7+
managementState: Managed
8+
limits:
9+
global:
10+
retention:
11+
days: {{ .spec.limits.global.retention.days }}
12+
size: {{ .spec.size }}
13+
storage:
14+
schemas:
15+
- version: v13
16+
effectiveDate: {{ (index .spec.storage.schemas 0).effectiveDate }}
17+
secret:
18+
name: logging-loki-s3
19+
type: s3
20+
storageClassName: {{ .spec.storageClassName }}
21+
tenants:
22+
mode: openshift-logging
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: operators.coreos.com/v1alpha1
2+
kind: Subscription
3+
metadata:
4+
name: loki-operator
5+
namespace: openshift-operators-redhat
6+
spec:
7+
channel: "stable-6.5"
8+
name: loki-operator
9+
source: {{ .spec.source }}
10+
sourceNamespace: openshift-marketplace
11+
installPlanApproval: Manual
12+
status:
13+
state: AtLatestKnown

telco-core/configuration/reference-crs/optional/logging/ClusterLogForwarder.yaml

Lines changed: 41 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,54 @@
11
---
2-
apiVersion: "observability.openshift.io/v1"
2+
apiVersion: observability.openshift.io/v1
33
kind: ClusterLogForwarder
44
metadata:
55
name: instance
66
namespace: openshift-logging
77
spec:
8-
# outputs: $outputs
9-
# pipelines: $pipelines
8+
outputs:
9+
# Local Loki storage for troubleshooting
10+
- name: loki-local
11+
type: lokiStack
12+
lokiStack:
13+
target:
14+
name: logging-loki
15+
namespace: openshift-logging
16+
authentication:
17+
token:
18+
from: serviceAccount
19+
tls:
20+
ca:
21+
key: service-ca.crt
22+
configMapName: openshift-service-ca.crt
23+
24+
# External log aggregation (OSS/BSS systems)
25+
# Uncomment and configure for external forwarding
26+
# - name: external-logs
27+
# type: kafka # or splunk, syslog, etc.
28+
# kafka:
29+
# url: tcp://10.11.12.13:9092/test
30+
31+
pipelines:
32+
# Infrastructure and audit logs to local Loki
33+
- name: infra-audit-to-local-loki
34+
inputRefs:
35+
- audit
36+
- infrastructure
37+
outputRefs:
38+
- loki-local
39+
40+
# Optional: Forward to external system (uncomment if needed)
41+
# - name: infra-audit-to-external
42+
# inputRefs:
43+
# - audit
44+
# - infrastructure
45+
# outputRefs:
46+
# - external-logs
47+
1048
serviceAccount:
1149
name: collector
1250
status:
1351
# Verify that the configuration is correct
1452
conditions:
1553
- type: observability.openshift.io/Valid
1654
status: "True"
17-
18-
# apiVersion: "observability.openshift.io/v1"
19-
# kind: ClusterLogForwarder
20-
# metadata:
21-
# name: instance
22-
# namespace: openshift-logging
23-
# spec:
24-
# outputs:
25-
# - type: "kafka"
26-
# name: kafka-open
27-
# # below url is an example
28-
# kafka:
29-
# url: tcp://10.11.12.13:9092/test
30-
# filters:
31-
# - name: test-labels
32-
# type: openshiftLabels
33-
# openshiftLabels:
34-
# label1: test1
35-
# label2: test2
36-
# label3: test3
37-
# label4: test4
38-
# pipelines:
39-
# - name: all-to-default
40-
# inputRefs:
41-
# - audit
42-
# - infrastructure
43-
# filterRefs:
44-
# - test-labels
45-
# outputRefs:
46-
# - kafka-open
47-
# serviceAccount:
48-
# name: collector

0 commit comments

Comments
 (0)