Skip to content
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

Config API for Kubeflow Trainer controller manager #2428

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

chahatsagarmain
Copy link

What this PR does / why we need it:

  • Adds Config api for flags defined for traininig operator

Which issue(s) this PR fixes (optional, in Fixes #<issue number>, #<issue number>, ... format, will close the issue(s) when PR gets merged):
Fixes #2420

Checklist:

  • Docs included if any changes are user facing

Signed-off-by: chahatsagarmain <[email protected]>
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign jeffwan for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Signed-off-by: chahatsagarmain <[email protected]>
@google-oss-prow google-oss-prow bot added size/L and removed size/M labels Feb 9, 2025
Copy link
Member

@andreyvelich andreyvelich left a comment

Choose a reason for hiding this comment

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

Thank you for this @chahatsagarmain!
/assign @Electronic-Waste @kubeflow/wg-training-leads @astefanutti Please can you also take a look ?

@@ -0,0 +1,50 @@
// Copyright 2024 The Kubeflow Authors
Copy link
Member

Choose a reason for hiding this comment

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

Can we have dedicate directory for Config APIs and place it in /apis/config/v1alpha1/configuration_types.go ?
Similar to Kueue: https://github.com/kubernetes-sigs/kueue/tree/main/apis/config/v1beta1

)

// TrainerControllerConfig represents the configuration for the training operator.
type TrainerControllerConfig struct {
Copy link
Member

Choose a reason for hiding this comment

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

Let's call it type Configuration struct

Suggested change
type TrainerControllerConfig struct {
type Configuration struct {

Comment on lines +31 to +34

ControllerManager *ControllerManager `json:"controllerManager,omitempty"`
CertGeneration *CertGeneration `json:"certGeneration,omitempty"`
}
Copy link
Member

Choose a reason for hiding this comment

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

You might need to fix Go formatting here.

Comment on lines +47 to +49
WebhookServerPort int `json:"webhookServerPort,omitempty"`
WebhookServiceName string `json:"webhookServiceName,omitempty"`
WebhookSecretName string `json:"webhookSecretName,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

We might need to explain what does each value mean and add the Defaults values:
https://github.com/kubeflow/katib/blob/master/pkg/apis/config/v1beta1/types.go#L55

}

// CertGeneration holds configuration related to webhook server certificate generation.
type CertGeneration struct {
Copy link
Member

Choose a reason for hiding this comment

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

Should we also have flag to enable/disable Cert Generator ?

Comment on lines +37 to +43
type ControllerManager struct {
MetricsBindAddress string `json:"metricsBindAddress,omitempty"`
HealthProbeBindAddress string `json:"healthProbeBindAddress,omitempty"`
LeaderElect bool `json:"leaderElect,omitempty"`
MetricsSecure bool `json:"metricsSecure,omitempty"`
EnableHTTP2 bool `json:"enableHttp2,omitempty"`
}
Copy link
Member

Choose a reason for hiding this comment

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

"Use :8443 for HTTPS or :8080 for HTTP, or leave as 0 to disable the metrics service.")
flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
flag.BoolVar(&enableLeaderElection, "leader-elect", false,
flag.StringVar(&trainerCfg.ControllerManager.HealthProbeBindAddress, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
Copy link
Member

Choose a reason for hiding this comment

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

I think, you should read this config from the file, similar to this: https://github.com/kubernetes-sigs/jobset/blob/main/main.go#L84C18-L87
We might also want to have the default config which enables the internal Cert Generator:
https://github.com/kubernetes-sigs/jobset/blob/main/config/components/manager/controller_manager_config.yaml#L2-L3

@andreyvelich
Copy link
Member

/ok-to-test

@andreyvelich
Copy link
Member

Here is an example on how to validate and read config: https://github.com/kubernetes-sigs/jobset/tree/main/pkg/config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add the Config API for Kubeflow Trainer controller manager
2 participants