-
Notifications
You must be signed in to change notification settings - Fork 733
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
base: master
Are you sure you want to change the base?
Config API for Kubeflow Trainer controller manager #2428
Conversation
Signed-off-by: chahatsagarmain <[email protected]>
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
Signed-off-by: chahatsagarmain <[email protected]>
There was a problem hiding this 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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
) | ||
|
||
// TrainerControllerConfig represents the configuration for the training operator. | ||
type TrainerControllerConfig struct { |
There was a problem hiding this comment.
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
type TrainerControllerConfig struct { | |
type Configuration struct { |
|
||
ControllerManager *ControllerManager `json:"controllerManager,omitempty"` | ||
CertGeneration *CertGeneration `json:"certGeneration,omitempty"` | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to run make fmt
in the terminal, just FYI @chahatsagarmain :)
WebhookServerPort int `json:"webhookServerPort,omitempty"` | ||
WebhookServiceName string `json:"webhookServiceName,omitempty"` | ||
WebhookSecretName string `json:"webhookSecretName,omitempty"` |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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 ?
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"` | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to split these values, similar to Kueue: https://github.com/kubernetes-sigs/kueue/blob/main/apis/config/v1beta1/configuration_types.go#L110-L125.
"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.") |
There was a problem hiding this comment.
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
/ok-to-test |
Here is an example on how to validate and read config: https://github.com/kubernetes-sigs/jobset/tree/main/pkg/config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chahatsagarmain Thanks for this. I also have some comments for you:)
flag.IntVar(&webhookServerPort, "webhook-server-port", 9443, "Endpoint port for the webhook server.") | ||
flag.StringVar(&webhookServiceName, "webhook-service-name", "kubeflow-trainer-controller-manager", "Name of the Service used as part of the DNSName") | ||
flag.StringVar(&webhookSecretName, "webhook-secret-name", "kubeflow-trainer-webhook-cert", "Name of the Secret to store CA and server certs") | ||
flag.IntVar(&trainerCfg.CertGeneration.WebhookServerPort, "webhook-server-port", 9443, "Endpoint port for the webhook server.") | ||
flag.StringVar(&trainerCfg.CertGeneration.WebhookServiceName, "webhook-service-name", "training-operator-v2", "Name of the Service used as part of the DNSName") | ||
flag.StringVar(&trainerCfg.CertGeneration.WebhookSecretName, "webhook-secret-name", "training-operator-v2-webhook-cert", "Name of the Secret to store CA and server certs") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not change the default values of WebhookServiceName
and WebhookSecretName
.
@@ -0,0 +1,50 @@ | |||
// Copyright 2024 The Kubeflow Authors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also check the name convention in the Katib. We'd better maintain the consistency between Trainer and Kaitb.
https://github.com/kubeflow/katib/blob/master/pkg/apis/config/v1beta1/types.go
|
||
ControllerManager *ControllerManager `json:"controllerManager,omitempty"` | ||
CertGeneration *CertGeneration `json:"certGeneration,omitempty"` | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to run make fmt
in the terminal, just FYI @chahatsagarmain :)
What this PR does / why we need it:
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: