Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix application-log-reader ClusterRole not aggregating to admin Clust… #151

Merged
merged 1 commit into from
Aug 15, 2024
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
1 change: 1 addition & 0 deletions component/loki.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ if loki.enabled then
'50_loki_rbac': [ aggregate_loki_log_access ],
'50_loki_operator_metrics_token': workaround.missing_metrics_token,
'50_loki_ingester_fix': workaround.ingester_stuck,
'50_loki_logreader_fix': workaround.app_logs_reader,
}
else
std.trace(
Expand Down
18 changes: 17 additions & 1 deletion component/loki_workaround.libsonnet
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
local com = import 'lib/commodore.libjsonnet';
local kap = import 'lib/kapitan.libjsonnet';
local kube = import 'lib/kube.libjsonnet';
local po = import 'lib/patch-operator.libsonnet';

// The hiera parameters for the component
local inv = kap.inventory();
Expand Down Expand Up @@ -30,6 +29,22 @@ local missing_metrics_token =
type: 'kubernetes.io/service-account-token',
};

// ClusterRole to aggregate to `admin`.
local app_logs_reader =
kube.ClusterRole('logging-application-logs-reader-aggregate') {
metadata+: {
labels+: {
'rbac.authorization.k8s.io/aggregate-to-admin': 'true',
},
},
rules: [ {
apiGroups: [ 'loki.grafana.com' ],
resourceNames: [ 'logs' ],
resources: [ 'application' ],
verbs: [ 'get' ],
} ],
};


// Workaround for stuck loki-ingester.
// To be removed, once upstream is fixed.
Expand Down Expand Up @@ -134,4 +149,5 @@ local ingester_stuck = [
{
missing_metrics_token: [ missing_metrics_token ],
ingester_stuck: ingester_stuck,
app_logs_reader: app_logs_reader,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
annotations: {}
labels:
name: logging-application-logs-reader-aggregate
rbac.authorization.k8s.io/aggregate-to-admin: 'true'
name: logging-application-logs-reader-aggregate
rules:
- apiGroups:
- loki.grafana.com
resourceNames:
- logs
resources:
- application
verbs:
- get
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
annotations: {}
labels:
name: logging-application-logs-reader-aggregate
rbac.authorization.k8s.io/aggregate-to-admin: 'true'
name: logging-application-logs-reader-aggregate
rules:
- apiGroups:
- loki.grafana.com
resourceNames:
- logs
resources:
- application
verbs:
- get
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
annotations: {}
labels:
name: logging-application-logs-reader-aggregate
rbac.authorization.k8s.io/aggregate-to-admin: 'true'
name: logging-application-logs-reader-aggregate
rules:
- apiGroups:
- loki.grafana.com
resourceNames:
- logs
resources:
- application
verbs:
- get
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
annotations: {}
labels:
name: logging-application-logs-reader-aggregate
rbac.authorization.k8s.io/aggregate-to-admin: 'true'
name: logging-application-logs-reader-aggregate
rules:
- apiGroups:
- loki.grafana.com
resourceNames:
- logs
resources:
- application
verbs:
- get
Loading