generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 182
Adding a flag to control whether auth is added to the EPP metrics server #1639
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
k8s-ci-robot
merged 10 commits into
kubernetes-sigs:main
from
Frapschen:add-model-server-metrics-auth-flag
Oct 16, 2025
+78
−55
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ba537f7
Adding a flag to control whether auth is added to the EPP metrics server
Frapschen d7080f8
Update cmd/epp/runner/runner.go
Frapschen 320b5b7
update
Frapschen 73c0434
apply review's suggestion
Frapschen 56a60d3
apply reviewer's suggestion
Frapschen 9462683
rollback interval
Frapschen 73a2434
update
Frapschen 626cc34
update README.md
Frapschen d5450ab
revert gke
Frapschen dce3327
update
Frapschen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,7 @@ import ( | |
healthPb "google.golang.org/grpc/health/grpc_health_v1" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
"k8s.io/apimachinery/pkg/types" | ||
"k8s.io/client-go/rest" | ||
ctrl "sigs.k8s.io/controller-runtime" | ||
"sigs.k8s.io/controller-runtime/pkg/log" | ||
"sigs.k8s.io/controller-runtime/pkg/log/zap" | ||
|
@@ -91,17 +92,18 @@ var flowControlConfig = flowcontrol.Config{ | |
} | ||
|
||
var ( | ||
grpcPort = flag.Int("grpc-port", runserver.DefaultGrpcPort, "The gRPC port used for communicating with Envoy proxy") | ||
grpcHealthPort = flag.Int("grpc-health-port", runserver.DefaultGrpcHealthPort, "The port used for gRPC liveness and readiness probes") | ||
metricsPort = flag.Int("metrics-port", runserver.DefaultMetricsPort, "The metrics port") | ||
enablePprof = flag.Bool("enable-pprof", runserver.DefaultEnablePprof, "Enables pprof handlers. Defaults to true. Set to false to disable pprof handlers.") | ||
poolName = flag.String("pool-name", runserver.DefaultPoolName, "Name of the InferencePool this Endpoint Picker is associated with.") | ||
poolGroup = flag.String("pool-group", runserver.DefaultPoolGroup, "group of the InferencePool this Endpoint Picker is associated with.") | ||
poolNamespace = flag.String("pool-namespace", "", "Namespace of the InferencePool this Endpoint Picker is associated with.") | ||
logVerbosity = flag.Int("v", logging.DEFAULT, "number for the log level verbosity") | ||
secureServing = flag.Bool("secure-serving", runserver.DefaultSecureServing, "Enables secure serving. Defaults to true.") | ||
healthChecking = flag.Bool("health-checking", runserver.DefaultHealthChecking, "Enables health checking") | ||
certPath = flag.String("cert-path", runserver.DefaultCertPath, "The path to the certificate for secure serving. The certificate and private key files "+ | ||
grpcPort = flag.Int("grpc-port", runserver.DefaultGrpcPort, "The gRPC port used for communicating with Envoy proxy") | ||
grpcHealthPort = flag.Int("grpc-health-port", runserver.DefaultGrpcHealthPort, "The port used for gRPC liveness and readiness probes") | ||
metricsPort = flag.Int("metrics-port", runserver.DefaultMetricsPort, "The metrics port") | ||
metricsEndpointAuth = flag.Bool("metrics-endpoint-auth", true, "Enables authentication and authorization of the metrics endpoint") | ||
enablePprof = flag.Bool("enable-pprof", runserver.DefaultEnablePprof, "Enables pprof handlers. Defaults to true. Set to false to disable pprof handlers.") | ||
poolName = flag.String("pool-name", runserver.DefaultPoolName, "Name of the InferencePool this Endpoint Picker is associated with.") | ||
poolGroup = flag.String("pool-group", runserver.DefaultPoolGroup, "group of the InferencePool this Endpoint Picker is associated with.") | ||
poolNamespace = flag.String("pool-namespace", "", "Namespace of the InferencePool this Endpoint Picker is associated with.") | ||
logVerbosity = flag.Int("v", logging.DEFAULT, "number for the log level verbosity") | ||
secureServing = flag.Bool("secure-serving", runserver.DefaultSecureServing, "Enables secure serving. Defaults to true.") | ||
healthChecking = flag.Bool("health-checking", runserver.DefaultHealthChecking, "Enables health checking") | ||
certPath = flag.String("cert-path", runserver.DefaultCertPath, "The path to the certificate for secure serving. The certificate and private key files "+ | ||
"are assumed to be named tls.crt and tls.key, respectively. If not set, and secureServing is enabled, "+ | ||
"then a self-signed certificate is used.") | ||
// metric flags | ||
|
@@ -211,8 +213,14 @@ func (r *Runner) Run(ctx context.Context) error { | |
// - https://pkg.go.dev/sigs.k8s.io/[email protected]/pkg/metrics/server | ||
// - https://book.kubebuilder.io/reference/metrics.html | ||
metricsServerOptions := metricsserver.Options{ | ||
BindAddress: fmt.Sprintf(":%d", *metricsPort), | ||
FilterProvider: filters.WithAuthenticationAndAuthorization, | ||
BindAddress: fmt.Sprintf(":%d", *metricsPort), | ||
FilterProvider: func() func(c *rest.Config, httpClient *http.Client) (metricsserver.Filter, error) { | ||
if *metricsEndpointAuth { | ||
return filters.WithAuthenticationAndAuthorization | ||
Frapschen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
return nil | ||
}(), | ||
} | ||
|
||
// Determine pool namespace: if --pool-namespace is non-empty, use it; else NAMESPACE env var; else default | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.