Skip to content

Commit

Permalink
prometheus: remove ui access
Browse files Browse the repository at this point in the history
Type: feature removal
Problem: We expose the full prometheus http api to authorized users
through a route, i.e. its externally available. We want to remove access
to the UI for a reduced support footprint, while maintaining access to
`/api` and `/federate`.
Solution: Alter the existing Route object to be limited to `/api` and
create a new Route object to expose `/federate`.
Another solution considered was to alter the oauth-proxy config. This is
discarded due to oauth-proxy feature not alligning as needed and any
change there also impacting the Service obhect that exposes the
deployment cluster-internal.
Issue: https://issues.redhat.com/browse/MON-1631

Signed-off-by: Jan Fajerski <[email protected]>
  • Loading branch information
jan--f committed Jan 13, 2022
1 parent b07ad32 commit 86d9e72
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ metadata:
name: prometheus-k8s
namespace: openshift-monitoring
spec:
path: /api
port:
targetPort: web
tls:
Expand Down
15 changes: 15 additions & 0 deletions assets/prometheus-k8s/federate-route.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Route
metadata:
name: prometheus-k8s-federate
namespace: openshift-monitoring
spec:
path: /federate
port:
targetPort: web
tls:
insecureEdgeTerminationPolicy: Redirect
termination: Reencrypt
to:
kind: Service
name: prometheus-k8s
29 changes: 27 additions & 2 deletions jsonnet/components/prometheus.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ function(params)
data: {},
},

// OpenShift route to access the Prometheus UI.
route: {
// OpenShift route to access the Prometheus api.
apiRoute: {
apiVersion: 'v1',
kind: 'Route',
metadata: {
Expand All @@ -35,6 +35,31 @@ function(params)
kind: 'Service',
name: 'prometheus-k8s',
},
path: '/api',
port: {
targetPort: 'web',
},
tls: {
termination: 'Reencrypt',
insecureEdgeTerminationPolicy: 'Redirect',
},
},
},

// OpenShift route to access the Prometheus federate endpoint.
federateRoute: {
apiVersion: 'v1',
kind: 'Route',
metadata: {
name: 'prometheus-k8s-federate',
namespace: cfg.namespace,
},
spec: {
to: {
kind: 'Service',
name: 'prometheus-k8s',
},
path: '/federate',
port: {
targetPort: 'web',
},
Expand Down

0 comments on commit 86d9e72

Please sign in to comment.