Skip to content

Commit

Permalink
Merge pull request #695 from 3scale/backport-692-remove-metrics-rbac-…
Browse files Browse the repository at this point in the history
…auth-proxy

[Backport 692] remove metrics rbac auth proxy
  • Loading branch information
eguzki authored Nov 22, 2021
2 parents 12b3603 + a587e24 commit 7524dd4
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 48 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ bundle-custom-updates: $(YQ)
sed -E -i 's/(operators\.operatorframework\.io\.bundle\.package\.v1=).+/\1$(BUNDLE_PREFIX)-3scale-operator/' $(PROJECT_PATH)/bundle.Dockerfile
@echo "Update operator image reference URL"
$(YQ) w --inplace $(PROJECT_PATH)/bundle/manifests/3scale-operator.clusterserviceversion.yaml metadata.annotations.containerImage $(IMG)
$(YQ) w --inplace $(PROJECT_PATH)/bundle/manifests/3scale-operator.clusterserviceversion.yaml spec.install.spec.deployments[0].spec.template.spec.containers[1].image $(IMG)
$(YQ) w --inplace $(PROJECT_PATH)/bundle/manifests/3scale-operator.clusterserviceversion.yaml spec.install.spec.deployments[0].spec.template.spec.containers[0].image $(IMG)

.PHONY: bundle-restore
bundle-restore:
Expand Down
28 changes: 4 additions & 24 deletions bundle/manifests/3scale-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -316,18 +316,6 @@ spec:
- delete
- get
- update
- apiGroups:
- authentication.k8s.io
resources:
- tokenreviews
verbs:
- create
- apiGroups:
- authorization.k8s.io
resources:
- subjectaccessreviews
verbs:
- create
serviceAccountName: 3scale-operator
deployments:
- name: threescale-operator-controller-manager
Expand All @@ -351,18 +339,7 @@ spec:
spec:
containers:
- args:
- --secure-listen-address=0.0.0.0:8443
- --upstream=http://127.0.0.1:8080/
- --logtostderr=true
- --v=10
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.5.0
name: kube-rbac-proxy
ports:
- containerPort: 8443
name: https
resources: {}
- args:
- --metrics-addr=127.0.0.1:8080
- --metrics-addr=0.0.0.0:8080
- --enable-leader-election
command:
- /manager
Expand Down Expand Up @@ -395,6 +372,9 @@ spec:
value: quay.io/openshift/origin-cli:4.2
image: quay.io/3scale/3scale-operator:master
name: manager
ports:
- containerPort: 8080
name: metrics
resources:
limits:
cpu: 100m
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ metadata:
spec:
endpoints:
- path: /metrics
port: https
port: metrics
selector:
matchLabels:
control-plane: controller-manager
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ metadata:
name: threescale-operator-controller-manager-metrics-service
spec:
ports:
- name: https
port: 8443
targetPort: https
- name: metrics
port: 8080
targetPort: metrics
selector:
app: 3scale-api-management
control-plane: controller-manager
Expand Down

This file was deleted.

3 changes: 2 additions & 1 deletion config/default/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ patchesStrategicMerge:
# Protect the /metrics endpoint by putting it behind auth.
# If you want your controller-manager to expose the /metrics
# endpoint w/o any authn/z, please comment the following line.
- manager_auth_proxy_patch.yaml
#- manager_auth_proxy_patch.yaml

# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
# crd/kustomization.yaml
Expand All @@ -38,6 +38,7 @@ patchesStrategicMerge:
# Uncomment 'CERTMANAGER' sections in crd/kustomization.yaml to enable the CA injection in the admission webhooks.
# 'CERTMANAGER' needs to be enabled to use ca injection
#- webhookcainjection_patch.yaml
- manager_metrics_patch.yaml

# the following config is for teaching kustomize how to do var substitution
vars:
Expand Down
18 changes: 18 additions & 0 deletions config/default/manager_metrics_patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# This patch exposes metrics endpoint in plain HTTP 8080 port
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: controller-manager
namespace: system
spec:
template:
spec:
containers:
- name: manager
args:
- "--metrics-addr=0.0.0.0:8080"
- "--enable-leader-election"
ports:
- containerPort: 8080
name: metrics
1 change: 1 addition & 0 deletions config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
resources:
- manager.yaml
- metrics_service.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
Expand Down
15 changes: 15 additions & 0 deletions config/manager/metrics_service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
apiVersion: v1
kind: Service
metadata:
labels:
control-plane: controller-manager
name: controller-manager-metrics-service
namespace: system
spec:
ports:
- name: metrics
port: 8080
targetPort: metrics
selector:
control-plane: controller-manager
4 changes: 2 additions & 2 deletions config/prometheus/monitor.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# Prometheus Monitor Service (Metrics)
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
Expand All @@ -10,7 +10,7 @@ metadata:
spec:
endpoints:
- path: /metrics
port: https
port: metrics
selector:
matchLabels:
control-plane: controller-manager
8 changes: 4 additions & 4 deletions config/rbac/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ resources:
# Comment the following 4 lines if you want to disable
# the auth proxy (https://github.com/brancz/kube-rbac-proxy)
# which protects your /metrics endpoint.
- auth_proxy_service.yaml
- auth_proxy_role.yaml
- auth_proxy_role_binding.yaml
- auth_proxy_client_clusterrole.yaml
#- auth_proxy_service.yaml
#- auth_proxy_role.yaml
#- auth_proxy_role_binding.yaml
#- auth_proxy_client_clusterrole.yaml

0 comments on commit 7524dd4

Please sign in to comment.