Skip to content

Commit b72cd2e

Browse files
Provide CertManager certificates for the metrics service.
If certificates are not provided, the metrics service offered by controller-runtime will default to using its own self-signed certificates. While functional, relying on those self-signed certs is not recommended for production environments due to security reasons.
1 parent 99d4973 commit b72cd2e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cmd/manager/main.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,14 @@ func main() {
186186
// These configurations ensure that only authorized users and service accounts
187187
// can access the metrics endpoint.
188188
FilterProvider: filters.WithAuthenticationAndAuthorization,
189+
190+
// Ensure that metrics is protected with certs managed by cert-manager
191+
// If not informed, the metrics service provided by controller-runtime will use
192+
// self-assigned certs which is not recommended as a good practice aiming
193+
// security for productions envinroments.
194+
CertDir: "/var/certs/",
195+
CertName: "olm-ca.crt",
196+
KeyName: "ca.crt",
189197
}
190198

191199
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{

0 commit comments

Comments
 (0)