Skip to content

Commit 031cdf8

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

11 files changed

+30
-90
lines changed

config/default/kustomization.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,15 @@ bases:
2525
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
2626
# - ../prometheus
2727

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

3438
# Mount the controller config file for loading manager configurations
3539
# through a ComponentConfig type

config/default/manager_auth_proxy_patch.yaml

Lines changed: 0 additions & 39 deletions
This file was deleted.

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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 7 additions & 1 deletion
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

Lines changed: 0 additions & 9 deletions
This file was deleted.

config/rbac/auth_proxy_role.yaml

Lines changed: 0 additions & 17 deletions
This file was deleted.

config/rbac/auth_proxy_role_binding.yaml

Lines changed: 0 additions & 12 deletions
This file was deleted.

config/rbac/kustomization.yaml

Lines changed: 0 additions & 7 deletions
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

Lines changed: 12 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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)