-
Notifications
You must be signed in to change notification settings - Fork 65
feat: Add dry-run functionality for WorkspaceKind creation #598
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
base: notebooks-v2
Are you sure you want to change the base?
Conversation
Signed-off-by: Bhakti Narvekar <[email protected]>
Signed-off-by: paulovmr <[email protected]>
Signed-off-by: paulovmr <[email protected]>
) Signed-off-by: Jenny <[email protected]> add icon to workspaceKindsColumns interface fix actions cell alignment move card title to fix spacing
…flow#419) Signed-off-by: Jenny <[email protected]>
Signed-off-by: paulovmr <[email protected]>
Signed-off-by: paulovmr <[email protected]>
…nd it (kubeflow#415) * Minor refactorings and initial work for the Workspace Kind summary page Signed-off-by: Guilherme Caponetto <[email protected]> * feat(ws): added links from workspace kind details drawer to workspace kinds details page (kubeflow#1) Signed-off-by: Paulo Rego <[email protected]> * Enable workspace filtering by namespace in the WorkspaceKind summary page Signed-off-by: Guilherme Caponetto <[email protected]> * Update Pause/Start action response types according to backend Signed-off-by: Guilherme Caponetto <[email protected]> * Fix WorkspaceKind logo href Signed-off-by: Guilherme Caponetto <[email protected]> * Replace placeholders for GPU data with real values in WorkspaceKind summary page Signed-off-by: Guilherme Caponetto <[email protected]> * Allow columns to be hidden in the WorkspaceTable Signed-off-by: Guilherme Caponetto <[email protected]> * feat(ws): added links from workspace kind details drawer namespace tab to workspace kinds details page (kubeflow#2) Signed-off-by: Paulo Rego <[email protected]> * Improve types around Filter component Signed-off-by: Guilherme Caponetto <[email protected]> * feat: Add Workspace Actions Context and related components - Introduced WorkspaceActionsContext to manage workspace actions such as view, edit, delete, start, restart, and stop. - Created WorkspaceActionsContextProvider to encapsulate the context logic and provide it to child components. - Implemented WorkspaceKindSummary and Workspaces components to utilize the new context for handling workspace actions. - Added polling for refreshing workspaces at a default interval. - Enhanced WorkspaceTable to support row actions for workspaces. - Updated various components to include sortable and filterable data fields. - Refactored WorkspaceStartActionModal and WorkspaceStopActionModal to handle optional onActionDone callback. - Added loading and error handling components for better user experience. Signed-off-by: Guilherme Caponetto <[email protected]> * feat: Add buildWorkspaceList function and integrate into mockAllWorkspaces Signed-off-by: Guilherme Caponetto <[email protected]> * refactor: Update mock data and formatting for workspace activity timestamps Signed-off-by: Guilherme Caponetto <[email protected]> * feat: Implement usePolling hook and refactor workspace actions in Workspaces and WorkspaceKindSummary components Signed-off-by: Guilherme Caponetto <[email protected]> * refactor: Update column key usage in ExpandedWorkspaceRow and adjust workspace actions visibility in Workspaces component Signed-off-by: Guilherme Caponetto <[email protected]> * Make mocked workspace list deterministic Signed-off-by: Guilherme Caponetto <[email protected]> * feat: Enhance WorkspaceTable with additional columns and filtering capabilities - Added 'namespace', 'gpu', and 'idleGpu' columns to WorkspaceTable. - Updated filtering logic to support new columns in WorkspaceTable. - Refactored useWorkspaces hook to remove unnecessary parameters related to idle and GPU filtering. - Modified WorkspaceKindSummary and its expandable card to utilize new filtering functionality. - Updated WorkspaceUtils to include a method for formatting workspace idle state. - Adjusted Filter component to support generic filtered column types. - Updated Workspaces page to hide new columns as needed. Signed-off-by: Guilherme Caponetto <[email protected]> * refactor: Improve sorting functionality in WorkspaceTable by utilizing specific types for sortable columns Signed-off-by: Guilherme Caponetto <[email protected]> * Adjustments after rebase Signed-off-by: Guilherme Caponetto <[email protected]> * Format with prettier Signed-off-by: Guilherme Caponetto <[email protected]> --------- Signed-off-by: Guilherme Caponetto <[email protected]> Signed-off-by: Paulo Rego <[email protected]> Co-authored-by: Paulo Rego <[email protected]>
…w#438) Signed-off-by: paulovmr <[email protected]>
* Add routes for Workspace Kind Create Signed-off-by: Charles Thao <[email protected]> * Implement method selection step for Workspace Kind Create wizard Signed-off-by: Charles Thao <[email protected]> * Add styling Signed-off-by: Charles Thao <[email protected]> * Add type guards for yaml file upload Signed-off-by: Charles Thao <[email protected]> * Add properties step to WorkspaceKindForm Signed-off-by: Charles Thao <[email protected]> * Add image step to WorkspaceKindForm Signed-off-by: Charles Thao <[email protected]> * Add empty steps and switch Method step to radio buttons Signed-off-by: Charles Thao <[email protected]> * Add step description to Workspace Kind Form Signed-off-by: Charles Thao <[email protected]> * Migrate Workspace Kind Form to utilize Toggle Group Signed-off-by: Charles Thao <[email protected]> * Disable Form View when YAML is not uploaded or valid Signed-off-by: Charles Thao <[email protected]> * Allow VScode to discover local ESLint rules Signed-off-by: Charles Thao <[email protected]> * Styling organization improvements + Refactor types Signed-off-by: Charles Thao <[email protected]> --------- Signed-off-by: Charles Thao <[email protected]>
Signed-off-by: Guilherme Caponetto <[email protected]>
Signed-off-by: Guilherme Caponetto <[email protected]>
Signed-off-by: Mathew Wicks <[email protected]>
…w#424) * feat(ws): Clean and fix swagger warnings and errors Signed-off-by: Liav Weiss (EXT-Nokia) <[email protected]> * feat(ws): Clean and fix swagger warnings and errors Signed-off-by: Liav Weiss (EXT-Nokia) <[email protected]> --------- Signed-off-by: Liav Weiss (EXT-Nokia) <[email protected]> Co-authored-by: Liav Weiss (EXT-Nokia) <[email protected]>
…flow#396) Signed-off-by: Jiri Daněk <[email protected]>
Given we have migrated all our images from docker.io to ghcr.io - our `notebooks-v2` branch should reference the "proper" container registry. This commit updates the code to use: - `ghcr.io/kubeflow/kubeflow/notebook-servers` Affected areas: - `jupyterlab_scipy_180` and `jupyterlab_scipy_190` `imageConfig` entries - various test files Signed-off-by: Andy Stoneberg <[email protected]>
Signed-off-by: Mathew Wicks <[email protected]>
* feat(ws): Properly containerize backend component kubeflow#323 Signed-off-by: Liav Weiss (EXT-Nokia) <[email protected]> * feat(ws): Properly containerize backend component kubeflow#323 Signed-off-by: Liav Weiss (EXT-Nokia) <[email protected]> * feat(ws): Properly containerize backend component kubeflow#323 Signed-off-by: Liav Weiss (EXT-Nokia) <[email protected]> * mathew: revert typo Signed-off-by: Mathew Wicks <[email protected]> --------- Signed-off-by: Liav Weiss (EXT-Nokia) <[email protected]> Signed-off-by: Mathew Wicks <[email protected]> Co-authored-by: Liav Weiss (EXT-Nokia) <[email protected]> Co-authored-by: Mathew Wicks <[email protected]>
Signed-off-by: Guilherme Caponetto <[email protected]>
Signed-off-by: Charles Thao <[email protected]>
Signed-off-by: Charles Thao <[email protected]>
…w#452) Signed-off-by: Jenny <[email protected]> Changes to step descriptions based on feedback
* Add Pod Config to WorkspaceKind form Signed-off-by: Charles Thao <[email protected]> * Add resource section for PodConfig Signed-off-by: Charles Thao <[email protected]> * Use refactored types Signed-off-by: Charles Thao <[email protected]> * Improve Resource input Signed-off-by: Charles Thao <[email protected]> * Move form view to edit mode only Signed-off-by: Charles Thao <[email protected]> * Bug fix and improvements Signed-off-by: Charles Thao <[email protected]> --------- Signed-off-by: Charles Thao <[email protected]>
Signed-off-by: DominikKawka <[email protected]>
* feat(ws): Notebooks 2.0 // Backend // API that allows frontend to upload a YAML file containing a full new WorkspaceKind definition Signed-off-by: Asaad Balum <[email protected]> * mathew: 1 Signed-off-by: Mathew Wicks <[email protected]> --------- Signed-off-by: Asaad Balum <[email protected]> Signed-off-by: Mathew Wicks <[email protected]> Co-authored-by: Mathew Wicks <[email protected]>
… creation (kubeflow#471) * feat(ws): prepare frontend for validation errors during WorkspaceKind creation Signed-off-by: Guilherme Caponetto <[email protected]> * feat(ws): extract validation alert to its own component Signed-off-by: Guilherme Caponetto <[email protected]> * fix(ws): use error icon for helper text Signed-off-by: Guilherme Caponetto <[email protected]> --------- Signed-off-by: Guilherme Caponetto <[email protected]>
Signed-off-by: paulovmr <[email protected]>
Signed-off-by: paulovmr <[email protected]>
…flow#432) Signed-off-by: Jenny <[email protected]> add icon to workspaceKindsColumns interface fix(ws): Update table with expandable variant and fix styles fix secondary border in menu toggle fix menu toggle expanded text color and update icon to use status prop remove unused files add cluster storage description list group Signed-off-by: Jenny <[email protected]> Add title and packages revert form label styling, revert homeVol column fix linting fix lint Signed-off-by: Jenny <[email protected]> Add PR code suggestions, remove unused interfaces Signed-off-by: Jenny <[email protected]> remove unused import Signed-off-by: Jenny <[email protected]> fix filterWorkspacesTest Signed-off-by: Jenny <[email protected]> fix(ws): apply feedback to fix Cypress tests Signed-off-by: Jenny <[email protected]> Update tests, add width to defineDataFields, remove duplicate WorkspaceTableColumnKeys type Signed-off-by: Jenny <[email protected]> fix wrapping behavior Signed-off-by: Jenny <[email protected]> Replace Th values with mapped instance Signed-off-by: Jenny <[email protected]> revert column order Signed-off-by: Jenny <[email protected]> remove hardcoded package label instances Signed-off-by: Jenny <[email protected]> delete cursor rule
) Signed-off-by: paulovmr <[email protected]>
…kubeflow#517) * Make Frontend Basepath Configurable via APP_PREFIX env variable Signed-off-by: Charles Thao <[email protected]> * Fix Cypress tests Signed-off-by: Charles Thao <[email protected]> --------- Signed-off-by: Charles Thao <[email protected]>
kubeflow#516) Signed-off-by: Charles Thao <[email protected]>
Signed-off-by: Guilherme Caponetto <[email protected]>
Signed-off-by: Charles Thao <[email protected]>
Signed-off-by: paulovmr <[email protected]>
Signed-off-by: Guilherme Caponetto <[email protected]>
Signed-off-by: Jenny <[email protected]>
Signed-off-by: paulovmr <[email protected]>
* feat(ws): Define k8s workload manifest for backend component kubeflow#324 Signed-off-by: Liav Weiss (EXT-Nokia) <[email protected]> * feat(ws): Define k8s workload manifest for backend component kubeflow#324 Signed-off-by: Liav Weiss (EXT-Nokia) <[email protected]> * feat(ws): add Istio AuthorizationPolicy for nb-backend kubeflow#324 Signed-off-by: Liav Weiss (EXT-Nokia) <[email protected]> * feat(ws): Define k8s workload manifest for backend component + istio - kubeflow#324 Signed-off-by: Liav Weiss (EXT-Nokia) <[email protected]> --------- Signed-off-by: Liav Weiss (EXT-Nokia) <[email protected]> Co-authored-by: Liav Weiss (EXT-Nokia) <[email protected]>
* feat(ws): Define k8s workload manifest for frontend component kubeflow#404 Signed-off-by: Noa <[email protected]> * fix: virtual-service tweaks from review Signed-off-by: Andy Stoneberg <[email protected]> --------- Signed-off-by: Noa <[email protected]> Signed-off-by: Andy Stoneberg <[email protected]> Co-authored-by: Andy Stoneberg <[email protected]>
Signed-off-by: Guilherme Caponetto <[email protected]>
…for frontend changes (kubeflow#549) Signed-off-by: Guilherme Caponetto <[email protected]>
* feat(ws): frontend Makefile to support deploy Signed-off-by: CI Bot <[email protected]> * mathew: fix 1 Signed-off-by: Mathew Wicks <[email protected]> --------- Signed-off-by: CI Bot <[email protected]> Signed-off-by: Mathew Wicks <[email protected]> Co-authored-by: Mathew Wicks <[email protected]>
Signed-off-by: Guilherme Caponetto <[email protected]>
- Implement dry-run parameter handling in workspacekinds handler - Update repository layer to support dry-run - Add comprehensive test cases for dry-run functionality Fixes kubeflow#417
Signed-off-by: bhaktinarvekar <[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 |
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.
This is a good start - so I appreciate your contributions! But we have a little work to do in order to unlock the desired functionality.
Feel free to reach out to me in Slack if you need/want to discuss further.
if !strings.EqualFold(r.Header.Get("Content-Type"), MediaTypeYaml) { | ||
a.unsupportedMediaTypeResponse(w, r, fmt.Errorf("Only application/yaml is supported")) |
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 you explain your rationale for making this change to NOT call ValidateContentType
? I'm assuming its a desire to outright fail in the presence of additionally parameters declared in Content-Type
header ?
i.e. application/yaml; charset=utf-8
- passes in
ValidateContentType
- fails in your custom implementation
If that is the primary motivation - I would opt to not deviate from the common helper function we have created and used consistently throughout the codebase. So, I would recommend undoing this change and leaving this particular piece of logic as-is.
If I am misunderstanding the motivation behind the change - or you feel its critical to implement something like this - lets talk about it - but ideally with the goal of supporting this in the common helper function and not fragmenting the codebase w.r.t. content type validation.
dryRun := r.URL.Query().Get("dry_run") | ||
if dryRun != "" && dryRun != "true" && dryRun != "false" { | ||
a.badRequestResponse(w, r, fmt.Errorf("Invalid dry_run value. Must be 'true' or 'false'")) | ||
return | ||
} | ||
isDryRun := dryRun == "true" |
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 appreciate this is the first time we are supporting a query parameter across any of our APIs - but it won't be the last! As such - I think its warranted to consider adding a helper function to workspaces/backend/api/helpers.go
.
admittedly, I'm not immediately sure how to structure this for proper abstraction - presently leaning towards:
func (a *App) GetBooleanQueryParameter(w http.ResponseWriter, r *http.Request, paramName string) (bool, error) {
value := r.URL.Query().Get(paramName)
if value == "" {
return false, nil // parameter not present, default to false
}
if value != "true" && value != "false" {
err := fmt.Errorf("Invalid query parameter '%s' value '%s'. Must be 'true' or 'false'", paramName, value)
a.badRequestResponse(w, r, err)
return false, err
}
return value == "true", nil
}
calling code would then look like:
isDryRun, err := a.GetBooleanQueryParameter(w, r, "dry_run")
if err != nil {
return
}
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.
ℹ️ Note: strconv.ParseBool(...)
not being leveraged here (which I agree with) - as it will also properly parse 0
, 1
, etc as boolean values - which feels wrong to support in an API.
// Set response Content-Type header | ||
w.Header().Set("Content-Type", "application/json") |
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.
The a.dataResponse
and a.createdResponse
helper functions already handle setting this Content-Type
header..
Was there something you observed that made it necessary to explicitly set this here? I would imagine we should remove this logic as its redundant.. but please correct me if I am wrong!
if dryRun { | ||
// For dry-run, just convert to model and return without creating | ||
workspaceKindModel := models.NewWorkspaceKindModelFromWorkspaceKind(workspaceKind) | ||
return &workspaceKindModel, nil | ||
} |
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.
As implemented - this is NOT achieving the desired outcome as written in the issue... primarly:
a dry_run is performed at the kubernetes layer (see: CreateOptions , UpdateOptions )
This code simply "echoes back" what was provided on the request - which won't inform the user if there were issues in the provided payload.
Even when dryRun
is true - we STILL want to call r.client.Create
- but we want to invoke it in such a way that the controller-runtime
will evaluate it with dry_run
semantics..
Something like the following is what I would expect to see in the implementation
var createOptions []client.CreateOption
if dryRun {
// Add dry-run option to the Kubernetes client call
createOptions = append(createOptions, client.DryRunAll)
}
// Always call the Kubernetes client, with or without dry-run options
if err := r.client.Create(ctx, workspaceKind, createOptions...); err != nil {
and then in testing this against a live cluster.. you should be able to see errors returned from k8s itself in the event you provided an invalid YAML
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.
// | ||
// TODO: this function should return the WorkspaceKindUpdate model, once the update WSK api is implemented | ||
// |
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 should preserve this TODO
comment as it will still hold true even with the merge of this PR
i.e. once available - we would want a WorkspaceKindUpdate
being returned from this function
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.
This file should not be included in this PR - as none of the actual changes implemented affect the workspaces/frontend
directory.
I am guessing this is a side effect of the extreme amount of commits that are erroneously getting included in the PR. Feel free to reach out to me in Slack if you need help getting your source branch cleaned up!
No description provided.