Skip to content

Commit aaf762f

Browse files
committed
Removed old metrics server image.
Enhanced Security: Using Controller-Runtime's built-in authentication provides better integration with Kubernetes RBAC and eliminates dependency on external kube-rbac-proxy. Signed-off-by: Rashed Kamal <[email protected]>
1 parent 5315e93 commit aaf762f

File tree

11 files changed

+135
-125
lines changed

11 files changed

+135
-125
lines changed

config/default/kustomization.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ bases:
2525
#- ../prometheus
2626

2727
patchesStrategicMerge:
28-
# Enable and protect the /metrics endpoint putting it behind auth.
29-
# - manager_auth_proxy_patch.yaml
28+
# Metrics endpoint is now secured using Controller-Runtime's built-in WithAuthenticationAndAuthorization feature
29+
# No longer need manager_auth_proxy_patch.yaml as kube-rbac-proxy is deprecated
3030

3131
# Mount the controller config file for loading manager configurations
3232
# through a ComponentConfig type

config/default/manager_auth_proxy_patch.yaml

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

config/manager/manager.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ spec:
2727
containers:
2828
- args:
2929
- --health-probe-bind-address=:8081
30+
- --metrics-bind-address=:8080
3031
- --leader-elect
3132
- --artifact-bind-address=:8082
3233
- --artifact-host=$(ARTIFACT_SERVICE_NAME).$(ARTIFACT_SERVICE_NAMESPACE).svc.cluster.local.
@@ -54,6 +55,10 @@ spec:
5455
port: 8081
5556
initialDelaySeconds: 5
5657
periodSeconds: 10
58+
ports:
59+
- containerPort: 8080
60+
name: metrics
61+
protocol: TCP
5762
resources:
5863
limits:
5964
cpu: 750m

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/auth_proxy_service.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ metadata:
88
spec:
99
ports:
1010
- name: https
11-
port: 8443
12-
targetPort: https
11+
port: 8080
12+
targetPort: metrics
1313
selector:
1414
control-plane: controller-manager

config/rbac/kustomization.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,8 @@ resources:
99
- role_binding.yaml
1010
- leader_election_role.yaml
1111
- leader_election_role_binding.yaml
12-
# Comment the following 4 lines if you want to disable
13-
# the auth proxy (https://github.com/brancz/kube-rbac-proxy)
14-
# which protects your /metrics endpoint.
12+
# Metrics service for secure metrics endpoint using Controller-Runtime's built-in authentication
1513
- auth_proxy_service.yaml
16-
- auth_proxy_role.yaml
17-
- auth_proxy_role_binding.yaml
14+
# Client cluster role for accessing metrics
1815
- auth_proxy_client_clusterrole.yaml
1916
- aggreagated_role.yaml

dist/source-controller.yaml

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -572,24 +572,6 @@ rules:
572572
- get
573573
---
574574
apiVersion: rbac.authorization.k8s.io/v1
575-
kind: ClusterRole
576-
metadata:
577-
name: source-proxy-role
578-
rules:
579-
- apiGroups:
580-
- authentication.k8s.io
581-
resources:
582-
- tokenreviews
583-
verbs:
584-
- create
585-
- apiGroups:
586-
- authorization.k8s.io
587-
resources:
588-
- subjectaccessreviews
589-
verbs:
590-
- create
591-
---
592-
apiVersion: rbac.authorization.k8s.io/v1
593575
kind: RoleBinding
594576
metadata:
595577
name: source-leader-election-rolebinding
@@ -616,19 +598,6 @@ subjects:
616598
name: source-controller-manager
617599
namespace: source-system
618600
---
619-
apiVersion: rbac.authorization.k8s.io/v1
620-
kind: ClusterRoleBinding
621-
metadata:
622-
name: source-proxy-rolebinding
623-
roleRef:
624-
apiGroup: rbac.authorization.k8s.io
625-
kind: ClusterRole
626-
name: source-proxy-role
627-
subjects:
628-
- kind: ServiceAccount
629-
name: source-controller-manager
630-
namespace: source-system
631-
---
632601
apiVersion: v1
633602
data:
634603
controller_manager_config.yaml: |
@@ -684,8 +653,8 @@ metadata:
684653
spec:
685654
ports:
686655
- name: https
687-
port: 8443
688-
targetPort: https
656+
port: 8080
657+
targetPort: metrics
689658
selector:
690659
control-plane: controller-manager
691660
---
@@ -721,6 +690,7 @@ spec:
721690
containers:
722691
- args:
723692
- --health-probe-bind-address=:8081
693+
- --metrics-bind-address=:8080
724694
- --leader-elect
725695
- --artifact-bind-address=:8082
726696
- --artifact-host=source-controller-manager-artifact-service.source-system.svc.cluster.local.
@@ -738,6 +708,9 @@ spec:
738708
- containerPort: 9443
739709
name: webhook-server
740710
protocol: TCP
711+
- containerPort: 8080
712+
name: metrics
713+
protocol: TCP
741714
readinessProbe:
742715
httpGet:
743716
path: /readyz

go.mod

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,17 @@ require (
99
github.com/google/go-containerregistry v0.20.6
1010
github.com/google/go-containerregistry/pkg/authn/k8schain v0.0.0-20230517160804-b7ad3f13a62c
1111
go.uber.org/zap v1.27.0
12-
k8s.io/api v0.34.0
13-
k8s.io/apimachinery v0.34.0
14-
k8s.io/client-go v0.34.0
12+
k8s.io/api v0.33.4
13+
k8s.io/apimachinery v0.33.4
14+
k8s.io/client-go v0.33.4
1515
reconciler.io/dies v0.16.0
1616
reconciler.io/runtime v0.23.0
1717
sigs.k8s.io/controller-runtime v0.21.0
1818
sigs.k8s.io/yaml v1.6.0
1919
)
2020

2121
require (
22+
cel.dev/expr v0.19.1 // indirect
2223
cloud.google.com/go/compute/metadata v0.7.0 // indirect
2324
github.com/Azure/azure-sdk-for-go v68.0.0+incompatible // indirect
2425
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
@@ -30,6 +31,7 @@ require (
3031
github.com/Azure/go-autorest/logger v0.2.1 // indirect
3132
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
3233
github.com/VividCortex/ewma v1.2.0 // indirect
34+
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
3335
github.com/aws/aws-sdk-go-v2 v1.36.1 // indirect
3436
github.com/aws/aws-sdk-go-v2/config v1.29.6 // indirect
3537
github.com/aws/aws-sdk-go-v2/credentials v1.17.59 // indirect
@@ -47,6 +49,8 @@ require (
4749
github.com/aws/smithy-go v1.22.2 // indirect
4850
github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.9.1 // indirect
4951
github.com/beorn7/perks v1.0.1 // indirect
52+
github.com/blang/semver/v4 v4.0.0 // indirect
53+
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
5054
github.com/cespare/xxhash/v2 v2.3.0 // indirect
5155
github.com/cheggaaa/pb/v3 v3.1.7 // indirect
5256
github.com/chrismellard/docker-credential-acr-env v0.0.0-20230304212654-82a0ddb27589 // indirect
@@ -58,21 +62,26 @@ require (
5862
github.com/docker/cli v28.2.2+incompatible // indirect
5963
github.com/docker/distribution v2.8.3+incompatible // indirect
6064
github.com/docker/docker-credential-helpers v0.9.3 // indirect
61-
github.com/emicklei/go-restful/v3 v3.12.2 // indirect
65+
github.com/emicklei/go-restful/v3 v3.11.2 // indirect
6266
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
6367
github.com/fatih/color v1.18.0 // indirect
68+
github.com/felixge/httpsnoop v1.0.4 // indirect
6469
github.com/fsnotify/fsnotify v1.7.0 // indirect
6570
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
71+
github.com/go-logr/stdr v1.2.2 // indirect
6672
github.com/go-logr/zapr v1.3.0 // indirect
6773
github.com/go-openapi/jsonpointer v0.21.0 // indirect
6874
github.com/go-openapi/jsonreference v0.20.4 // indirect
6975
github.com/go-openapi/swag v0.23.0 // indirect
7076
github.com/gogo/protobuf v1.3.2 // indirect
7177
github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
7278
github.com/google/btree v1.1.3 // indirect
79+
github.com/google/cel-go v0.23.2 // indirect
7380
github.com/google/gnostic-models v0.7.0 // indirect
7481
github.com/google/go-containerregistry/pkg/authn/kubernetes v0.0.0-20230516205744-dbecb1de8cfa // indirect
7582
github.com/google/uuid v1.6.0 // indirect
83+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.24.0 // indirect
84+
github.com/inconshreveable/mousetrap v1.1.0 // indirect
7685
github.com/josharian/intern v1.0.0 // indirect
7786
github.com/json-iterator/go v1.1.12 // indirect
7887
github.com/klauspost/compress v1.18.0 // indirect
@@ -82,27 +91,38 @@ require (
8291
github.com/mattn/go-runewidth v0.0.16 // indirect
8392
github.com/mitchellh/go-homedir v1.1.0 // indirect
8493
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
85-
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
94+
github.com/modern-go/reflect2 v1.0.2 // indirect
8695
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
8796
github.com/onsi/ginkgo v1.16.4 // indirect
8897
github.com/opencontainers/go-digest v1.0.0 // indirect
8998
github.com/opencontainers/image-spec v1.1.1 // indirect
9099
github.com/pkg/errors v0.9.1 // indirect
91-
github.com/pmezard/go-difflib v1.0.0 // indirect
92100
github.com/prometheus/client_golang v1.22.0 // indirect
93101
github.com/prometheus/client_model v0.6.1 // indirect
94102
github.com/prometheus/common v0.62.0 // indirect
95103
github.com/prometheus/procfs v0.15.1 // indirect
96104
github.com/rivo/uniseg v0.4.7 // indirect
97105
github.com/sirupsen/logrus v1.9.3 // indirect
106+
github.com/spf13/cobra v1.9.1 // indirect
98107
github.com/spf13/pflag v1.0.6 // indirect
108+
github.com/stoewer/go-strcase v1.3.0 // indirect
99109
github.com/vbatts/tar-split v0.12.1 // indirect
100110
github.com/vito/go-interact v1.0.1 // indirect
101111
github.com/x448/float16 v0.8.4 // indirect
112+
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
113+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 // indirect
114+
go.opentelemetry.io/otel v1.36.0 // indirect
115+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.33.0 // indirect
116+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.33.0 // indirect
117+
go.opentelemetry.io/otel/metric v1.36.0 // indirect
118+
go.opentelemetry.io/otel/sdk v1.36.0 // indirect
119+
go.opentelemetry.io/otel/trace v1.36.0 // indirect
120+
go.opentelemetry.io/proto/otlp v1.4.0 // indirect
102121
go.uber.org/multierr v1.11.0 // indirect
103122
go.yaml.in/yaml/v2 v2.4.2 // indirect
104-
go.yaml.in/yaml/v3 v3.0.4 // indirect
123+
go.yaml.in/yaml/v3 v3.0.3 // indirect
105124
golang.org/x/crypto v0.36.0 // indirect
125+
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
106126
golang.org/x/net v0.38.0 // indirect
107127
golang.org/x/oauth2 v0.30.0 // indirect
108128
golang.org/x/sync v0.15.0 // indirect
@@ -113,16 +133,23 @@ require (
113133
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
114134
gomodules.xyz/jsonpatch/v3 v3.0.1 // indirect
115135
gomodules.xyz/orderedmap v0.1.0 // indirect
136+
google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576 // indirect
137+
google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 // indirect
138+
google.golang.org/grpc v1.68.1 // indirect
116139
google.golang.org/protobuf v1.36.5 // indirect
117140
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
118141
gopkg.in/inf.v0 v0.9.1 // indirect
119142
gopkg.in/yaml.v2 v2.4.0 // indirect
120143
gopkg.in/yaml.v3 v3.0.1 // indirect
121144
k8s.io/apiextensions-apiserver v0.33.0 // indirect
145+
k8s.io/apiserver v0.33.0 // indirect
146+
k8s.io/component-base v0.33.0 // indirect
122147
k8s.io/klog/v2 v2.130.1 // indirect
123148
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b // indirect
124149
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 // indirect
150+
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 // indirect
125151
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
126152
sigs.k8s.io/randfill v1.0.0 // indirect
127-
sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect
153+
sigs.k8s.io/structured-merge-diff/v4 v4.6.0 // indirect
154+
sigs.k8s.io/structured-merge-diff/v6 v6.2.0 // indirect
128155
)

0 commit comments

Comments
 (0)