Skip to content

Commit 7547207

Browse files
committed
WIP
Signed-off-by: Pete Wall <[email protected]>
1 parent 50a84a2 commit 7547207

File tree

5 files changed

+136
-23
lines changed

5 files changed

+136
-23
lines changed

charts/k8s-monitoring/charts/feature-pod-logs/values.yaml

+18-2
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,32 @@ kubernetesApiGathering:
8989

9090
lokiReceiver:
9191
# -- Enable receiving logs using the Loki protocol.
92+
# @section -- Loki Receiver
9293
enabled: false
9394

9495
# -- The port to listen on for logs.
96+
# @section -- Loki Receiver
9597
port: 3100
9698

97-
openShiftClusterLogForwarder:
98-
enabled: false
9999

100+
openShiftClusterLogForwarder:
101+
# -- Enable receiving logs with the OpenShift ClusterLogForwarder.
102+
# @section -- OpenShift ClusterLogForwarder
103+
enabled: false
104+
105+
application:
106+
# -- Enable receiving application logs.
107+
# @section -- OpenShift ClusterLogForwarder: Application Logs
108+
enabled: true
109+
# -- The namespaces to receive application logs from.
110+
# @section -- OpenShift ClusterLogForwarder: Application Logs
100111
namespaces: []
101112

113+
infrastructure:
114+
# -- Enable receiving infrastructure logs.
115+
# @section -- OpenShift ClusterLogForwarder: Infrastructure Logs
116+
enabled: false
117+
102118
# -- Log labels to set with values copied from the Kubernetes Pod labels.
103119
# Format: `<log_label>: <kubernetes_label>`.
104120
# @section -- Log Processing
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,72 @@
1-
{{- if and (eq .Values.global.platform "openshift") .Values.podLogs.lokiReceiver.enabled .Values.podLogs.lokiReceiver.openShiftClusterLogForwarder.enabled }}
2-
{{/* https://docs.openshift.com/container-platform/4.17/observability/logging/logging-6.1/log6x-clf-6.1.html */}}
1+
{{- if and (eq .Values.global.platform "openshift") .Values.podLogs.lokiReceiver.enabled .Values.podLogs.openShiftClusterLogForwarder.enabled }}
2+
{{- /* https://docs.openshift.com/container-platform/4.17/observability/logging/logging-6.1/log6x-clf-6.1.html */}}
3+
---
4+
apiVersion: v1
5+
kind: ServiceAccount
6+
metadata:
7+
name: {{ include "helper.fullname" . }}-clf
8+
namespace: openshift-logging
9+
{{- if .Values.podLogs.openShiftClusterLogForwarder.application.enabled }}
10+
---
11+
kind: ClusterRoleBinding
12+
apiVersion: rbac.authorization.k8s.io/v1
13+
metadata:
14+
name: {{ include "helper.fullname" . }}-clf-application-logs
15+
roleRef:
16+
apiGroup: rbac.authorization.k8s.io
17+
kind: ClusterRole
18+
name: collect-application-logs
19+
subjects:
20+
- kind: ServiceAccount
21+
name: {{ include "helper.fullname" . }}-clf
22+
namespace: openshift-logging
23+
{{- end }}
24+
{{- if .Values.podLogs.openShiftClusterLogForwarder.infrastructure.enabled }}
25+
---
26+
kind: ClusterRoleBinding
27+
apiVersion: rbac.authorization.k8s.io/v1
28+
metadata:
29+
name: {{ include "helper.fullname" . }}-clf-infrastructure-logs
30+
roleRef:
31+
apiGroup: rbac.authorization.k8s.io
32+
kind: ClusterRole
33+
name: collect-infrastructure-logs
34+
subjects:
35+
- kind: ServiceAccount
36+
name: {{ include "helper.fullname" . }}-clf
37+
namespace: openshift-logging
38+
{{- end }}
339
---
440
apiVersion: logging.openshift.io/v1
541
kind: ClusterLogForwarder
642
metadata:
743
name: {{ include "helper.fullname" . }}
8-
namespace: {{ .Release.Namespace }}
44+
namespace: openshift-logging
945
spec:
10-
{{- if .Values.podLogs.lokiReceiver.openShiftClusterLogForwarder.namespaces }}
46+
serviceAccountName: {{ include "helper.fullname" . }}-clf
1147
inputs:
12-
- name: application-from-namespaces
48+
{{- if .Values.podLogs.openShiftClusterLogForwarder.application.enabled }}
49+
- name: application-logs
1350
application:
14-
namespaces: {{ .Values.podLogs.lokiReceiver.openShiftClusterLogForwarder.namespaces | toYaml | nindent 10 }}
51+
{{- if .Values.podLogs.openShiftClusterLogForwarder.application.namespaces }}
52+
namespaces: {{ .Values.podLogs.openShiftClusterLogForwarder.application.namespaces | toYaml | nindent 10 }}
53+
{{- end }}
1554
{{- end }}
1655
outputs:
1756
- name: {{ include "helper.fullname" . }}
1857
type: loki
19-
url: {{ include "features.podLogs.receiver.loki" . }}
58+
url: {{ include "features.podLogs.receiver.loki" . | trim }}
59+
labelKeys
60+
- log_type
2061
pipelines:
21-
- name: application-logs
62+
- name: {{ include "helper.fullname" . }}
2263
inputRefs:
23-
{{- if .Values.podLogs.lokiReceiver.openShiftClusterLogForwarder.namespaces }}
24-
- application-from-namespaces
25-
{{- else }}
26-
- application
64+
{{- if .Values.podLogs.openShiftClusterLogForwarder.applicationLogs.enabled }}
65+
- application-logs
2766
{{- end }}
67+
{{- if .Values.podLogs.openShiftClusterLogForwarder.infrastructureLogs.enabled }}
2868
- infrastructure
69+
{{- end }}
2970
outputRefs:
3071
- {{ include "helper.fullname" . }}
3172
{{- end }}

charts/k8s-monitoring/tests/platform/openshift/Makefile

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
.PHONY: all clean run-test
2-
all: deployments/test-variables.yaml deployments/grafana-cloud-credentials.yaml flux-manifest.yaml
1+
.PHONY: all clean run-test console
2+
all: deployments/okderators.yaml deployments/test-variables.yaml deployments/grafana-cloud-credentials.yaml flux-manifest.yaml
33
clean:
4-
rm -f deployments/test-variables.yaml deployments/grafana-cloud-credentials.yaml flux-manifest.yaml
4+
rm -f deployments/okderators.yaml deployments/test-variables.yaml deployments/grafana-cloud-credentials.yaml flux-manifest.yaml
5+
6+
deployments/okderators.yaml:
7+
echo "---" > $@
8+
curl https://raw.githubusercontent.com/okd-project/okderators-catalog-index/refs/heads/main/install/okderators.catalogsource.yml >> $@
59

610
deployments/test-variables.yaml:
711
echo "---" > $@
@@ -31,3 +35,10 @@ flux-manifest.yaml:
3135

3236
run-test:
3337
../../../../../scripts/run-cluster-test.sh .
38+
39+
CLUSTER_NAME_PREFIX := $(shell yq eval '.cluster.name' values.yaml)
40+
CLUSTER_NAME := $(CLUSTER_NAME_PREFIX)-$(shell echo $$RANDOM_NUMBER)
41+
console:
42+
@echo "URL: $(shell grep --color=never 'Access the OpenShift web-console here' "$(CLUSTER_NAME)-installer-files/.openshift_install.log" | sed -e 's/.*Access the OpenShift web-console here: \(https:.*\)"/\1/')"
43+
@echo "Username: $(shell grep --color=never 'Login to the console with user:' "$(CLUSTER_NAME)-installer-files/.openshift_install.log" | sed -e 's/.*Login to the console with user: \\"\([-a-zA-Z0-9]*\)\\", and password: \\"\([-a-zA-Z0-9]*\)\\""/\1/')"
44+
@echo "Password: $(shell grep --color=never 'Login to the console with user:' "$(CLUSTER_NAME)-installer-files/.openshift_install.log" | sed -e 's/.*Login to the console with user: \\"\([-a-zA-Z0-9]*\)\\", and password: \\"\([-a-zA-Z0-9]*\)\\""/\2/')"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
apiVersion: operators.coreos.com/v1alpha1
3+
kind: CatalogSource
4+
metadata:
5+
name: okderators
6+
namespace: openshift-marketplace
7+
spec:
8+
displayName: OKDerators
9+
image: 'quay.io/okderators/catalog-index:latest'
10+
publisher: OKD Community
11+
updateStrategy:
12+
registryPoll:
13+
interval: 10m
14+
priority: -100 # Prefer default/manual CatalogSources
15+
sourceType: grpc
16+
grpcPodConfig:
17+
nodeSelector:
18+
kubernetes.io/os: linux
19+
node-role.kubernetes.io/master: ''
20+
priorityClassName: system-cluster-critical
21+
securityContextConfig: restricted
22+
tolerations:
23+
- effect: NoSchedule
24+
key: node-role.kubernetes.io/master
25+
operator: Exists
26+
- effect: NoExecute
27+
key: node.kubernetes.io/unreachable
28+
operator: Exists
29+
tolerationSeconds: 120
30+
- effect: NoExecute
31+
key: node.kubernetes.io/not-ready
32+
operator: Exists
33+
tolerationSeconds: 120

charts/k8s-monitoring/tests/platform/openshift/values.yaml

+18-6
Original file line numberDiff line numberDiff line change
@@ -49,23 +49,35 @@ clusterEvents:
4949

5050
podLogs:
5151
enabled: true
52+
collector: alloy-receiver
53+
volumeGathering:
54+
enabled: false
55+
lokiReceiver:
56+
enabled: true
57+
openShiftClusterLogForwarder:
58+
enabled: true
5259

5360
integrations:
5461
alloy:
5562
instances:
5663
- name: alloy
5764
labelSelectors:
58-
app.kubernetes.io/name: [alloy-metrics, alloy-singleton, alloy-logs]
65+
app.kubernetes.io/name: [alloy-metrics, alloy-singleton, alloy-receiver]
5966

6067
alloy-metrics:
6168
enabled: true
6269

6370
alloy-singleton:
6471
enabled: true
6572

66-
alloy-logs:
73+
alloy-receiver:
6774
enabled: true
68-
global:
69-
podSecurityContext:
70-
seLinuxOptions:
71-
type: container_logreader_t
75+
liveDebugging:
76+
enabled: true
77+
alloy:
78+
stabilityLevel: experimental
79+
extraPorts:
80+
- name: loki
81+
port: 3100
82+
targetPort: 3100
83+
protocol: TCP

0 commit comments

Comments
 (0)