Skip to content

Commit f5adcf8

Browse files
Remove kube-rbac-proxy and open metrics endpoint
1 parent c9929bd commit f5adcf8

11 files changed

+28
-94
lines changed

config/default/kustomization.yaml

+3-5
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,9 @@ bases:
2525
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
2626
# - ../prometheus
2727

28-
patchesStrategicMerge:
29-
# Protect the /metrics endpoint by putting it behind auth.
30-
# If you want your controller-manager to expose the /metrics
31-
# endpoint w/o any authn/z, please comment the following line.
32-
- manager_auth_proxy_patch.yaml
28+
resources:
29+
# Add metrics service
30+
- metrics_service.yaml
3331

3432
# Mount the controller config file for loading manager configurations
3533
# through a ComponentConfig type

config/default/manager_auth_proxy_patch.yaml

-39
This file was deleted.

config/rbac/auth_proxy_service.yaml renamed to config/default/metrics_service.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ metadata:
55
namespace: system
66
spec:
77
ports:
8-
- name: https
9-
port: 8443
8+
- name: metrics
9+
port: 8080
1010
protocol: TCP
11-
targetPort: 8080
11+
targetPort: metrics
1212
selector:
1313
app.kubernetes.io/name: codeflare-operator
1414
app.kubernetes.io/part-of: codeflare

config/manager/controller_manager_config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kind: ControllerManagerConfig
33
health:
44
healthProbeBindAddress: :8081
55
metrics:
6-
bindAddress: 127.0.0.1:8080
6+
bindAddress: 0.0.0.0:8080
77
webhook:
88
port: 9443
99
leaderElection:

config/manager/manager.yaml

+7-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ spec:
3535
- command:
3636
- /manager
3737
args:
38-
- --leader-elect
38+
- "--health-probe-bind-address=:8081"
39+
- "--metrics-bind-address=0.0.0.0:8080"
40+
- "--leader-elect"
3941
image: controller:latest
4042
imagePullPolicy: Always
4143
name: manager
@@ -44,6 +46,10 @@ spec:
4446
capabilities:
4547
drop:
4648
- "ALL"
49+
ports:
50+
- containerPort: 8080
51+
protocol: TCP
52+
name: metrics
4753
livenessProbe:
4854
httpGet:
4955
path: /healthz

config/rbac/auth_proxy_client_clusterrole.yaml

-9
This file was deleted.

config/rbac/auth_proxy_role.yaml

-17
This file was deleted.

config/rbac/auth_proxy_role_binding.yaml

-12
This file was deleted.

config/rbac/kustomization.yaml

-7
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,3 @@ resources:
1010
- edit_role_binding.yaml # We are using this binding as mcad requires this role
1111
- leader_election_role.yaml
1212
- leader_election_role_binding.yaml
13-
# Comment the following 4 lines if you want to disable
14-
# the auth proxy (https://github.com/brancz/kube-rbac-proxy)
15-
# which protects your /metrics endpoint.
16-
- auth_proxy_service.yaml
17-
- auth_proxy_role.yaml
18-
- auth_proxy_role_binding.yaml
19-
- auth_proxy_client_clusterrole.yaml

config/rbac/role.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,18 @@ rules:
4444
- patch
4545
- update
4646
- watch
47+
- apiGroups:
48+
- authentication.k8s.io
49+
resources:
50+
- tokenreviews
51+
verbs:
52+
- create
53+
- apiGroups:
54+
- authorization.k8s.io
55+
resources:
56+
- subjectaccessreviews
57+
verbs:
58+
- create
4759
- apiGroups:
4860
- codeflare.codeflare.dev
4961
resources:

controllers/mcad_controller.go

+2
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ func (r *MCADReconciler) DeleteResource(params *MCADParams, template string, fns
124124
// +kubebuilder:rbac:groups=extensions,resources=replicasets,verbs=get;list;watch
125125
// +kubebuilder:rbac:groups=policy,resources=poddisruptionbudgets,verbs=get;list;watch
126126
// +kubebuilder:rbac:groups=storage.k8s.io,resources=csidrivers;csinodes;csistoragecapacities,verbs=get;list;watch
127+
// +kubebuilder:rbac:groups=authentication.k8s.io,resources=tokenreviews,verbs=create
128+
// +kubebuilder:rbac:groups=authorization.k8s.io,resources=subjectaccessreviews,verbs=create
127129

128130
func (r *MCADReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
129131
log := r.Log.WithValues("namespace", req.Namespace)

0 commit comments

Comments
 (0)