Skip to content

Commit d254cf7

Browse files
authored
Merge pull request #340 from Fedosin/remove_kube_rbac_proxy
⚠️ Remove kube-rbac-proxy and expose metrics on localhost:8080
2 parents d0f318d + 50b7f2f commit d254cf7

11 files changed

+2
-245
lines changed

cmd/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func init() {
7878

7979
// InitFlags initializes the flags.
8080
func InitFlags(fs *pflag.FlagSet) {
81-
fs.StringVar(&metricsBindAddr, "metrics-bind-addr", ":8080",
81+
fs.StringVar(&metricsBindAddr, "metrics-bind-addr", "localhost:8080",
8282
"The address the metric endpoint binds to.")
8383

8484
fs.BoolVar(&enableLeaderElection, "leader-elect", false,

config/default/kustomization.yaml

-4
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ bases:
2626
- ../namespace
2727

2828
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
3329
# Provide customizable hook for make targets.
3430
- manager_image_patch.yaml
3531
- manager_pull_policy.yaml

config/default/manager_auth_proxy_patch.yaml

-54
This file was deleted.

config/rbac/auth_proxy_client_clusterrole.yaml

-7
This file was deleted.

config/rbac/auth_proxy_role.yaml

-13
This file was deleted.

config/rbac/auth_proxy_role_binding.yaml

-12
This file was deleted.

config/rbac/auth_proxy_service.yaml

-14
This file was deleted.

config/rbac/kustomization.yaml

-7
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,3 @@ resources:
33
- role_binding.yaml
44
- leader_election_role.yaml
55
- leader_election_role_binding.yaml
6-
# Comment the following 4 lines if you want to disable
7-
# the auth proxy (https://github.com/brancz/kube-rbac-proxy)
8-
# which protects your /metrics endpoint.
9-
- auth_proxy_service.yaml
10-
- auth_proxy_role.yaml
11-
- auth_proxy_role_binding.yaml
12-
- auth_proxy_client_clusterrole.yaml

hack/charts/cluster-api-operator/templates/deployment.yaml

-24
Original file line numberDiff line numberDiff line change
@@ -101,30 +101,6 @@ spec:
101101
volumeMounts:
102102
{{- toYaml . | nindent 12 }}
103103
{{- end }}
104-
- args:
105-
- --secure-listen-address=0.0.0.0:8443
106-
- --upstream=http://127.0.0.1:8080/
107-
- --logtostderr=true
108-
{{- if .Values.logLevel }}
109-
- --v={{ .Values.logLevel }}
110-
{{- end }}
111-
{{- with .Values.image.kubeRBACProxy }}
112-
image: "{{- if .registry -}}{{ .registry }}/{{- end -}}{{ .repository }}{{- if (.digest) -}} @{{ .digest }}{{- else -}}:{{ default $.Chart.AppVersion .tag }} {{- end -}}"
113-
{{- end }}
114-
imagePullPolicy: {{ .Values.image.kubeRBACProxy.pullPolicy }}
115-
name: kube-rbac-proxy
116-
ports:
117-
- containerPort: 8443
118-
name: https
119-
protocol: TCP
120-
{{- with .Values.resources.kubeRBACProxy }}
121-
resources:
122-
{{- toYaml . | nindent 12 }}
123-
{{- end }}
124-
{{- with .Values.containerSecurityContext.kubeRBACProxy }}
125-
securityContext:
126-
{{- toYaml . | nindent 12 }}
127-
{{- end }}
128104
terminationGracePeriodSeconds: 10
129105
{{- with .Values.volumes }}
130106
volumes:

hack/charts/cluster-api-operator/values.yaml

+1-17
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ image:
2626
repository: gcr.io/k8s-staging-capi-operator/cluster-api-operator
2727
tag: dev
2828
pullPolicy: IfNotPresent
29-
kubeRBACProxy:
30-
repository: gcr.io/kubebuilder/kube-rbac-proxy
31-
tag: v0.14.1
32-
pullPolicy: IfNotPresent
3329
healthAddr: ":8081"
3430
metricsBindAddr: "127.0.0.1:8080"
3531
imagePullSecrets: {}
@@ -41,19 +37,7 @@ resources:
4137
requests:
4238
cpu: 100m
4339
memory: 100Mi
44-
kubeRBACProxy:
45-
limits:
46-
cpu: 500m
47-
memory: 128Mi
48-
requests:
49-
cpu: 5m
50-
memory: 64Mi
51-
containerSecurityContext:
52-
kubeRBACProxy:
53-
allowPrivilegeEscalation: false
54-
capabilities:
55-
drop:
56-
- ALL
40+
containerSecurityContext: {}
5741
affinity:
5842
nodeAffinity:
5943
requiredDuringSchedulingIgnoredDuringExecution:

test/e2e/resources/full-chart-install.yaml

-92
Original file line numberDiff line numberDiff line change
@@ -13961,40 +13961,6 @@ rules:
1396113961
---
1396213962
# Source: cluster-api-operator/templates/operator-components.yaml
1396313963
apiVersion: rbac.authorization.k8s.io/v1
13964-
kind: ClusterRole
13965-
metadata:
13966-
labels:
13967-
clusterctl.cluster.x-k8s.io/core: capi-operator
13968-
name: capi-operator-metrics-reader
13969-
rules:
13970-
- nonResourceURLs:
13971-
- /metrics
13972-
verbs:
13973-
- get
13974-
---
13975-
# Source: cluster-api-operator/templates/operator-components.yaml
13976-
apiVersion: rbac.authorization.k8s.io/v1
13977-
kind: ClusterRole
13978-
metadata:
13979-
labels:
13980-
clusterctl.cluster.x-k8s.io/core: capi-operator
13981-
name: capi-operator-proxy-role
13982-
rules:
13983-
- apiGroups:
13984-
- authentication.k8s.io
13985-
resources:
13986-
- tokenreviews
13987-
verbs:
13988-
- create
13989-
- apiGroups:
13990-
- authorization.k8s.io
13991-
resources:
13992-
- subjectaccessreviews
13993-
verbs:
13994-
- create
13995-
---
13996-
# Source: cluster-api-operator/templates/operator-components.yaml
13997-
apiVersion: rbac.authorization.k8s.io/v1
1399813964
kind: ClusterRoleBinding
1399913965
metadata:
1400013966
labels:
@@ -14011,22 +13977,6 @@ subjects:
1401113977
---
1401213978
# Source: cluster-api-operator/templates/operator-components.yaml
1401313979
apiVersion: rbac.authorization.k8s.io/v1
14014-
kind: ClusterRoleBinding
14015-
metadata:
14016-
labels:
14017-
clusterctl.cluster.x-k8s.io/core: capi-operator
14018-
name: capi-operator-proxy-rolebinding
14019-
roleRef:
14020-
apiGroup: rbac.authorization.k8s.io
14021-
kind: ClusterRole
14022-
name: capi-operator-proxy-role
14023-
subjects:
14024-
- kind: ServiceAccount
14025-
name: default
14026-
namespace: 'default'
14027-
---
14028-
# Source: cluster-api-operator/templates/operator-components.yaml
14029-
apiVersion: rbac.authorization.k8s.io/v1
1403013980
kind: Role
1403113981
metadata:
1403213982
labels:
@@ -14093,24 +14043,6 @@ subjects:
1409314043
# Source: cluster-api-operator/templates/operator-components.yaml
1409414044
apiVersion: v1
1409514045
kind: Service
14096-
metadata:
14097-
labels:
14098-
clusterctl.cluster.x-k8s.io/core: capi-operator
14099-
control-plane: controller-manager
14100-
name: capi-operator-controller-manager-metrics-service
14101-
namespace: 'default'
14102-
spec:
14103-
ports:
14104-
- name: https
14105-
port: 8443
14106-
targetPort: https
14107-
selector:
14108-
clusterctl.cluster.x-k8s.io/core: capi-operator
14109-
control-plane: controller-manager
14110-
---
14111-
# Source: cluster-api-operator/templates/operator-components.yaml
14112-
apiVersion: v1
14113-
kind: Service
1411414046
metadata:
1411514047
labels:
1411614048
clusterctl.cluster.x-k8s.io/core: capi-operator
@@ -14182,30 +14114,6 @@ spec:
1418214114
- mountPath: /tmp/k8s-webhook-server/serving-certs
1418314115
name: cert
1418414116
readOnly: true
14185-
- args:
14186-
- --secure-listen-address=0.0.0.0:8443
14187-
- --upstream=http://127.0.0.1:8080/
14188-
- --logtostderr=true
14189-
- --v=2
14190-
image: "gcr.io/kubebuilder/kube-rbac-proxy:v0.14.1"
14191-
imagePullPolicy: IfNotPresent
14192-
name: kube-rbac-proxy
14193-
ports:
14194-
- containerPort: 8443
14195-
name: https
14196-
protocol: TCP
14197-
resources:
14198-
limits:
14199-
cpu: 500m
14200-
memory: 128Mi
14201-
requests:
14202-
cpu: 5m
14203-
memory: 64Mi
14204-
securityContext:
14205-
allowPrivilegeEscalation: false
14206-
capabilities:
14207-
drop:
14208-
- ALL
1420914117
terminationGracePeriodSeconds: 10
1421014118
volumes:
1421114119
- name: cert

0 commit comments

Comments
 (0)