Skip to content

Commit

Permalink
Merge pull request #2102 from Nordix/kashif/remove-kube-rbac-proxy
Browse files Browse the repository at this point in the history
 ✨ Remove kube-rbac-proxy and use controller run-time provided WithAuthenticationAndAuthorization filter instead
  • Loading branch information
metal3-io-bot authored Dec 9, 2024
2 parents ca8e696 + fec32e4 commit a1a9cef
Show file tree
Hide file tree
Showing 11 changed files with 83 additions and 162 deletions.
13 changes: 4 additions & 9 deletions config/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ generatorOptions:
disableNameSuffixHash: true

patches:
# 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.
- path: manager_auth_proxy_patch.yaml

# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
# crd/kustomization.yaml
- path: manager_webhook_patch.yaml
Expand All @@ -53,15 +48,15 @@ replacements:
- select:
kind: ValidatingWebhookConfiguration
fieldPaths:
- metadata.annotations.[cert-manager.io/inject-ca-from]
- metadata.annotations.[cert-manager.io/inject-ca-from]
options:
delimiter: '/'
index: 0
- select:
kind: CustomResourceDefinition
name: baremetalhosts.metal3.io
fieldPaths:
- metadata.annotations.[cert-manager.io/inject-ca-from]
- metadata.annotations.[cert-manager.io/inject-ca-from]
options:
delimiter: '/'
index: 0
Expand All @@ -75,15 +70,15 @@ replacements:
- select:
kind: ValidatingWebhookConfiguration
fieldPaths:
- metadata.annotations.[cert-manager.io/inject-ca-from]
- metadata.annotations.[cert-manager.io/inject-ca-from]
options:
delimiter: '/'
index: 1
- select:
kind: CustomResourceDefinition
name: baremetalhosts.metal3.io
fieldPaths:
- metadata.annotations.[cert-manager.io/inject-ca-from]
- metadata.annotations.[cert-manager.io/inject-ca-from]
options:
delimiter: '/'
index: 1
Expand Down
25 changes: 0 additions & 25 deletions config/base/manager_auth_proxy_patch.yaml

This file was deleted.

9 changes: 0 additions & 9 deletions config/base/rbac/auth_proxy_client_clusterrole.yaml

This file was deleted.

17 changes: 0 additions & 17 deletions config/base/rbac/auth_proxy_role.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions config/base/rbac/auth_proxy_role_binding.yaml

This file was deleted.

14 changes: 0 additions & 14 deletions config/base/rbac/auth_proxy_service.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions config/base/rbac/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,3 @@ resources:
- role_binding.yaml
- leader_election_role.yaml
- leader_election_role_binding.yaml
# 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
68 changes: 1 addition & 67 deletions config/render/capm3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2435,34 +2435,6 @@ rules:
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: baremetal-operator-metrics-reader
rules:
- nonResourceURLs:
- /metrics
verbs:
- get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: baremetal-operator-proxy-role
rules:
- apiGroups:
- authentication.k8s.io
resources:
- tokenreviews
verbs:
- create
- apiGroups:
- authorization.k8s.io
resources:
- subjectaccessreviews
verbs:
- create
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: baremetal-operator-leader-election-rolebinding
Expand All @@ -2489,19 +2461,6 @@ subjects:
name: baremetal-operator-controller-manager
namespace: baremetal-operator-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: baremetal-operator-proxy-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: baremetal-operator-proxy-role
subjects:
- kind: ServiceAccount
name: baremetal-operator-controller-manager
namespace: baremetal-operator-system
---
apiVersion: v1
data:
CACHEURL: http://172.22.0.1/images
Expand All @@ -2518,21 +2477,6 @@ metadata:
---
apiVersion: v1
kind: Service
metadata:
labels:
control-plane: controller-manager
name: baremetal-operator-controller-manager-metrics-service
namespace: baremetal-operator-system
spec:
ports:
- name: https
port: 8443
targetPort: https
selector:
control-plane: controller-manager
---
apiVersion: v1
kind: Service
metadata:
name: baremetal-operator-webhook-service
namespace: baremetal-operator-system
Expand Down Expand Up @@ -2566,8 +2510,8 @@ spec:
spec:
containers:
- args:
- --metrics-addr=127.0.0.1:8085
- --enable-leader-election
- --tls-min-version=TLS13
command:
- /baremetal-operator
env:
Expand Down Expand Up @@ -2619,16 +2563,6 @@ spec:
- mountPath: /tmp/k8s-webhook-server/serving-certs
name: cert
readOnly: true
- args:
- --secure-listen-address=0.0.0.0:8443
- --upstream=http://127.0.0.1:8085/
- --logtostderr=true
- --v=10
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.16.0
name: kube-rbac-proxy
ports:
- containerPort: 8443
name: https
securityContext:
runAsNonRoot: true
seccompProfile:
Expand Down
23 changes: 23 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,33 @@ require (
)

require (
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-logr/zapr v1.3.0 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.4 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/cel-go v0.20.1 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
Expand All @@ -60,23 +68,38 @@ require (
github.com/prometheus/procfs v0.15.1 // indirect
github.com/spf13/cobra v1.8.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stoewer/go-strcase v1.2.0 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect
go.opentelemetry.io/otel v1.28.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0 // indirect
go.opentelemetry.io/otel/metric v1.28.0 // indirect
go.opentelemetry.io/otel/sdk v1.28.0 // indirect
go.opentelemetry.io/otel/trace v1.28.0 // indirect
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/net v0.30.0 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.26.0 // indirect
golang.org/x/term v0.25.0 // indirect
golang.org/x/text v0.19.0 // indirect
golang.org/x/time v0.3.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect
google.golang.org/grpc v1.65.0 // indirect
google.golang.org/protobuf v1.35.1 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.31.3 // indirect
k8s.io/apiserver v0.31.3 // indirect
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
)
Expand Down
Loading

0 comments on commit a1a9cef

Please sign in to comment.