Skip to content

feat: Add EnableHttpMetrics option to Kueue Configuration API #4843

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions apis/config/v1beta1/configuration_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ type ControllerMetrics struct {
// metrics will be reported.
// +optional
EnableClusterQueueResources bool `json:"enableClusterQueueResources,omitempty"`

// EnableHTTPMetrics, if true the controller's metrics
// will be accessible via HTTP only.
// +optional
EnableHTTPMetrics bool `json:"enableHttpMetrics,omitempty"`
Comment on lines +172 to +176
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It lacks the note about the security risk and clear statement that is not recommended approach.

}

// ControllerHealth defines the health configs.
Expand Down
1 change: 1 addition & 0 deletions charts/kueue/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ managerConfig:
metrics:
bindAddress: :8443
# enableClusterQueueResources: true
# enableHttpMetrics: true
webhook:
port: 9443
leaderElection:
Expand Down
16 changes: 12 additions & 4 deletions cmd/kueue/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,18 @@ func main() {
// More info:
// - https://pkg.go.dev/sigs.k8s.io/[email protected]/pkg/metrics/server
// - https://book.kubebuilder.io/reference/metrics.html
metricsServerOptions := metricsserver.Options{
BindAddress: cfg.Metrics.BindAddress,
SecureServing: true,
FilterProvider: filters.WithAuthenticationAndAuthorization,
var metricsServerOptions metricsserver.Options
if cfg.Metrics.EnableHTTPMetrics {
metricsServerOptions = metricsserver.Options{
BindAddress: cfg.Metrics.BindAddress,
SecureServing: false,
}
} else {
metricsServerOptions = metricsserver.Options{
BindAddress: cfg.Metrics.BindAddress,
SecureServing: true,
FilterProvider: filters.WithAuthenticationAndAuthorization,
}
}

if cfg.InternalCertManagement == nil || !*cfg.InternalCertManagement.Enable {
Expand Down
1 change: 1 addition & 0 deletions config/components/manager/controller_manager_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ health:
metrics:
bindAddress: :8443
# enableClusterQueueResources: true
# enableHttpMetrics: true
webhook:
port: 9443
leaderElection:
Expand Down
1 change: 1 addition & 0 deletions site/content/en/docs/installation/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ data:
metrics:
bindAddress: :8443
# enableClusterQueueResources: true
# enableHttpMetrics: true
webhook:
port: 9443
manageJobsWithoutQueueName: true
Expand Down
9 changes: 8 additions & 1 deletion site/content/en/docs/reference/kueue-config.v1beta1.md
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,13 @@ It can be set to &quot;0&quot; to disable the metrics serving.</p>
<p>EnableClusterQueueResources, if true the cluster queue resource usage and quotas
metrics will be reported.</p>
</td>

<tr><td><code>enableHttpMetrics</code><br/>
<code>bool</code>
</td>
<td>
<p>EnableHttpMetrics, if true the controller's metrics will be accessible via HTTP only.</p>
</td>
</tr>
</tbody>
</table>
Expand Down Expand Up @@ -955,4 +962,4 @@ If not set, there is no timeout.</p>
</td>
</tr>
</tbody>
</table>
</table>