Skip to content

feat(suggestion): allow pod-level settings for the Suggestion deployment - #2744

Open
dipesh-svg wants to merge 1 commit into
kubeflow:masterfrom
dipesh-svg:suggestion-pod-level-settings
Open

dipesh-svg wants to merge 1 commit into
kubeflow:masterfrom
dipesh-svg:suggestion-pod-level-settings

Conversation

@dipesh-svg

Copy link
Copy Markdown

What this PR does / why we need it:

Since #2000, SuggestionConfig inlines corev1.Container, so container-level settings (command, args, env, resources, ...) can already be set in the Katib config. Pod-level settings still can't, because DesiredDeployment() only sets serviceAccountName and the resume volume on the Suggestion pod spec. That's why imagePullSecrets, the original ask in #1737, isn't possible today.

This PR adds four optional pod-level fields to SuggestionConfig and copies them to the Suggestion pod spec, as proposed in #1737 (comment):

  • imagePullSecrets
  • nodeSelector
  • tolerations
  • affinity

The simple image: setup stays the same, and existing configs behave exactly as before because the fields are only set when present.

Example:

suggestions:
  - algorithmName: random
    image: ghcr.io/kubeflow/katib/suggestion-hyperopt:latest
    imagePullSecrets:
      - name: my-registry-secret
    nodeSelector:
      kubernetes.io/os: linux

Changes:

  • pkg/apis/config/v1beta1/types.go: new fields on SuggestionConfig. zz_generated.deepcopy.go was regenerated with controller-gen v0.18.0 (CONTROLLER_GEN_VERSION in the Makefile); the diff only adds these fields.
  • pkg/controller.v1beta1/suggestion/composer/composer.go: set the fields on d.Spec.Template.Spec in DesiredDeployment().
  • composer_test.go: new TestDesiredDeployment case that sets all four fields and checks the resulting Deployment spec. I checked that the case fails without the composer.go change.

Tested locally with envtest (Kubernetes 1.34.0):

go test ./pkg/controller.v1beta1/suggestion/... ./pkg/util/v1beta1/katibconfig/... ./pkg/apis/config/...
ok  github.com/kubeflow/katib/pkg/controller.v1beta1/suggestion
ok  github.com/kubeflow/katib/pkg/controller.v1beta1/suggestion/composer
ok  github.com/kubeflow/katib/pkg/controller.v1beta1/suggestion/suggestionclient
ok  github.com/kubeflow/katib/pkg/util/v1beta1/katibconfig
ok  github.com/kubeflow/katib/pkg/apis/config/v1beta1

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

Checklist:

  • Docs included if any changes are user facing

I'll follow up with a docs PR for the Katib config page on kubeflow/website once the approach looks good.

Assisted-by: Claude

Add optional imagePullSecrets, nodeSelector, tolerations and affinity
fields to SuggestionConfig in the Katib config, and set them on the
Suggestion pod spec in DesiredDeployment. Container-level fields were
already configurable through the inlined corev1.Container (kubeflow#2000); these
are the remaining pod-level settings requested in kubeflow#1737.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: dipesh-svg <yadavdipesh2436@gmail.com>
@github-actions

Copy link
Copy Markdown

🎉 Welcome to the Kubeflow Katib repo! 🎉

Thanks for opening your first PR! We're excited to have you onboard 🚀

Next steps:

Feel free to ask questions in the comments. Thanks again for contributing! 🙏

@google-oss-prow

Copy link
Copy Markdown

[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 andreyvelich for approval. For more information see the Kubernetes Code Review Process.

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

Details 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

@dipesh-svg

Copy link
Copy Markdown
Author

Hi @andreyvelich, could you take a look at this when you have some time? It lets users set pod-level settings for the Suggestion deployment. Happy to change anything.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support users to set more fields in suggetion deployment

1 participant