Skip to content

Commit

Permalink
Manually generate missing Loki Operator metrics token
Browse files Browse the repository at this point in the history
  • Loading branch information
simu committed Apr 2, 2024
1 parent f1e3641 commit 1c06ea9
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
18 changes: 18 additions & 0 deletions component/loki.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,31 @@ local aggregate_loki_log_access = kube.ClusterRole('syn:loki:cluster-reader') {
],
};

// Generate missing metrics SA token for Loki Operator
local operator_metrics_sa_token =
kube.Secret('loki-operator-controller-manager-metrics-token') {
metadata+: {
// Loki operator is deployed in openshift-operators-redhat
namespace: 'openshift-operators-redhat',
annotations+: {
'kubernetes.io/service-account.name': 'loki-operator-controller-manager-metrics-reader',
// disable argocd prune/delete so removing the workaround should be
// fairly easy in case the Loki Operator OLM install fixes the issue.
'argocd.argoproj.io/sync-options': 'Prune=false,Delete=false',
},
},
data:: {},
type: 'kubernetes.io/service-account-token',
};

// Define outputs below
if loki.enabled then
{
'50_loki_stack': lokistack,
'50_loki_logstore': logstore,
'50_loki_netpol': [ netpol_viewplugin, netpol_lokigateway ],
'50_loki_rbac': [ aggregate_loki_log_access ],
'50_loki_operator_metrics_token': [ operator_metrics_sa_token ],
}
else
std.trace(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Secret
metadata:
annotations:
argocd.argoproj.io/sync-options: Prune=false,Delete=false
kubernetes.io/service-account.name: loki-operator-controller-manager-metrics-reader
labels:
name: loki-operator-controller-manager-metrics-token
name: loki-operator-controller-manager-metrics-token
namespace: openshift-operators-redhat
type: kubernetes.io/service-account-token
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Secret
metadata:
annotations:
argocd.argoproj.io/sync-options: Prune=false,Delete=false
kubernetes.io/service-account.name: loki-operator-controller-manager-metrics-reader
labels:
name: loki-operator-controller-manager-metrics-token
name: loki-operator-controller-manager-metrics-token
namespace: openshift-operators-redhat
type: kubernetes.io/service-account-token
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Secret
metadata:
annotations:
argocd.argoproj.io/sync-options: Prune=false,Delete=false
kubernetes.io/service-account.name: loki-operator-controller-manager-metrics-reader
labels:
name: loki-operator-controller-manager-metrics-token
name: loki-operator-controller-manager-metrics-token
namespace: openshift-operators-redhat
type: kubernetes.io/service-account-token

0 comments on commit 1c06ea9

Please sign in to comment.