Skip to content

Commit

Permalink
create stub CR for KRP authorize access to Thanos Querier
Browse files Browse the repository at this point in the history
  • Loading branch information
raptorsun committed Nov 7, 2023
1 parent 7bd2eaf commit 6b96382
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 23 deletions.
8 changes: 8 additions & 0 deletions assets/cluster-monitoring-operator/cluster-role-view.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,11 @@ rules:
- namespaces
verbs:
- get
- apiGroups:
- monitoring.coreos.com
resources:
- prometheuses/query
verbs:
- get
- create
- update
10 changes: 5 additions & 5 deletions assets/thanos-querier/kube-rbac-proxy-web-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ stringData:
config.yaml: |-
"authorization":
"resourceAttributes":
"apiGroup": ""
"resource": "namespaces"
"apiGroup": "monitoring.coreos.com"
"resource": "prometheuses"
"subresource": "query"
"verbs":
- "get"
- "create"
- "update"
"static":
- "resourceRequest": true
"user":
"name": "system:serviceaccount:openshift-monitoring:prometheus-k8s"
- "resourceRequest": true
"user":
"name": "system:serviceaccount:openshift-user-workload-monitoring:thanos-ruler"
type: Opaque
17 changes: 12 additions & 5 deletions jsonnet/components/cluster-monitoring-operator.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -330,11 +330,18 @@ function(params) {
metadata: {
name: 'cluster-monitoring-view',
},
rules: [{
apiGroups: [''],
resources: ['namespaces'],
verbs: ['get'],
}],
rules: [
{
apiGroups: [''],
resources: ['namespaces'],
verbs: ['get'],
},
{
apiGroups: ['monitoring.coreos.com'],
resources: ['prometheuses/query'],
verbs: ['get', 'create', 'update'],
},
],
},

// This role enables read/write access to the platform Alertmanager API through OAuth proxy.
Expand Down
20 changes: 7 additions & 13 deletions jsonnet/components/thanos-querier.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,12 @@ function(params)
stringData: {
'config.yaml': std.manifestYamlDoc({
authorization: {
resourceAttributes:
{
apiGroup: '',
resource: 'namespaces',
verbs: ['get'],
},
resourceAttributes: {
apiGroup: 'monitoring.coreos.com',
resource: 'prometheuses',
subresource: 'query',
verbs: ['get', 'create', 'update'],
},
static: [
{
// allow prometheus-k8s to get/post queries from/to thanos querier
Expand All @@ -170,13 +170,6 @@ function(params)
},
resourceRequest: true,
},
{
// allow thanos ruler to get/post queries from/to thanos querier
user: {
name: 'system:serviceaccount:openshift-user-workload-monitoring:thanos-ruler',
},
resourceRequest: true,
},
],
},
}),
Expand Down Expand Up @@ -658,4 +651,5 @@ function(params)

},
},

}
8 changes: 8 additions & 0 deletions manifests/0000_50_cluster-monitoring-operator_02-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,14 @@ rules:
- namespaces
verbs:
- get
- apiGroups:
- monitoring.coreos.com
resources:
- prometheuses/query
verbs:
- get
- create
- update
- apiGroups:
- ""
resourceNames:
Expand Down

0 comments on commit 6b96382

Please sign in to comment.