Skip to content

feat: Add tolerations to WorkspaceKind Form#1044

Open
thaorell wants to merge 7 commits intokubeflow:notebooks-v2from
thaorell:1019_podconfig_tolerations
Open

feat: Add tolerations to WorkspaceKind Form#1044
thaorell wants to merge 7 commits intokubeflow:notebooks-v2from
thaorell:1019_podconfig_tolerations

Conversation

@thaorell
Copy link
Copy Markdown

@thaorell thaorell commented Apr 22, 2026

closes: #1019

Added:

  • Custom types
  • Refactored WorkspaceKind PodConfig Tables to have expandable rows
  • Add Toleration Modal and Table to PodConfig expanded section: The modal will automatically hide Value input if the operator is Exists and only render Toleration seconds field if the effect is NoExecute
  • Add tests

Before:
Screenshot 2026-04-30 at 1 47 07 PM

After:
Screenshot 2026-04-30 at 1 47 33 PM
Screenshot 2026-04-30 at 1 51 07 PM

@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 paulovmr 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

@google-oss-prow google-oss-prow Bot added area/frontend area - related to frontend components area/v2 area - version - kubeflow notebooks v2 labels Apr 22, 2026
@thaorell thaorell marked this pull request as draft April 22, 2026 18:37
@thaorell thaorell force-pushed the 1019_podconfig_tolerations branch from cf490af to 74ef428 Compare April 27, 2026 18:19
@thaorell thaorell marked this pull request as ready for review April 27, 2026 18:20
@thaorell
Copy link
Copy Markdown
Author

/ok-to-test

@thaorell thaorell force-pushed the 1019_podconfig_tolerations branch 2 times, most recently from 83f6d47 to 4fdc88e Compare April 30, 2026 17:43
@thaorell thaorell changed the title feat: Add tolerations feat: Add tolerations to WorkspaceKind Form Apr 30, 2026
@thaorell thaorell force-pushed the 1019_podconfig_tolerations branch from d2d6d5a to f2fbb62 Compare May 1, 2026 17:12
Copy link
Copy Markdown

@caponetto caponetto left a comment

Choose a reason for hiding this comment

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

Left a few comments, please check if they make sense.

Only one UI observation (not blocker): The Toleration modal has a state where Toleration Seconds is not shown, for instance:

Image

When the item is added, the column is displayed, though:

Image

This could confuse users about where that comes from. I would rather disable Toleration Seconds with a helper reason than hide it.

Comment on lines +102 to +107
const tolerationSettersCache = useRef(
new Map<number, React.Dispatch<React.SetStateAction<TolerationEntry[]>>>(),
);
const modalSettersCache = useRef(
new Map<number, React.Dispatch<React.SetStateAction<boolean>>>(),
);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

tolerationSettersCache and modalSettersCache are Map<number, ...> refs that grow monotonically; entries are never removed when pod configs are deleted. While functionally correct (the useMemo re-maps fresh indices), the caches accumulate stale closures over time. For a form with frequent add/remove cycles, consider clearing the caches when podConfig.values.length changes, or switching to a useMemo-based approach without manual caching.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I'm applying a fix to delete stale cache entries in handleDelete, so when a config is deleted, the config's tolerations will be deleted as well

Comment thread workspaces/frontend/src/app/types.ts Outdated
}

export enum TolerationOperator {
None = '',
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

TolerationOperator.None = '' and TolerationEffect.None = '' use empty strings as enum values. When these are serialized and sent to the backend (or eventually to the Kubernetes API), empty strings may behave differently from an omitted field. Please confirm that the backend handles empty-string operator/effect correctly, or consider using undefined/omission to represent "no selection" and making the field optional in TolerationEntry.

Copy link
Copy Markdown
Author

@thaorell thaorell May 5, 2026

Choose a reason for hiding this comment

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

After reading the Kubernetes docs in depth, I am setting the default Operator to Equal

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I also added a description for a None effect, which will be coerced to undefined upon submission

)}
{podConfig.values.length > 0 && (
<>
<div className="pf-v6-u-pl-xl pf-v6-u-pt-sm pf-v6-u-pb-sm">
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The descriptive text block uses raw <div> elements with PatternFly utility classes. Since Content is already imported, prefer <Content component="p"> for the description paragraph. This ensures consistent typography and spacing from PatternFly's design system rather than relying on utility classes alone.

@thaorell thaorell force-pushed the 1019_podconfig_tolerations branch 2 times, most recently from d40e9b2 to 6e099c5 Compare May 5, 2026 19:33
@thaorell thaorell requested a review from caponetto May 5, 2026 19:46
@caponetto
Copy link
Copy Markdown

/lgtm

thaorell added 3 commits May 7, 2026 09:07
Signed-off-by: Charles Thao <cthao@redhat.com>
Signed-off-by: Charles Thao <cthao@redhat.com>
Signed-off-by: Charles Thao <cthao@redhat.com>
thaorell added 4 commits May 7, 2026 09:07
Signed-off-by: Charles Thao <cthao@redhat.com>
Signed-off-by: Charles Thao <cthao@redhat.com>
Signed-off-by: Charles Thao <cthao@redhat.com>
Signed-off-by: Charles Thao <cthao@redhat.com>
@thaorell thaorell force-pushed the 1019_podconfig_tolerations branch from 6e099c5 to 5cc657d Compare May 7, 2026 14:40
@google-oss-prow google-oss-prow Bot removed the lgtm label May 7, 2026
@caponetto
Copy link
Copy Markdown

/lgtm

@google-oss-prow google-oss-prow Bot added the lgtm label May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/frontend area - related to frontend components area/v2 area - version - kubeflow notebooks v2 lgtm ok-to-test size/XXL

Projects

Status: Needs Triage

Development

Successfully merging this pull request may close these issues.

2 participants