This commit adds a GHA workflow to support publishing a container image for the `workspaces/controller` component as well as some updates to the `Makefile` to establish reasonable (but overridable) defaults.
Key behavior:
- Publishes controller images on any workspaces/ directory change
- Builds images with commit SHA tags by default
- "release" images with use the tag as defined by the `VERSION` file
- a `-dirty` suffix is added to the tag if the codebase is not `porcelain`
- no `latest` tag is ever produced on images
- Uses `ghcr.io/kubeflow/notebooks` registry with configurable naming
example image name from "random" commit:
- `ghcr.io/kubeflow/notebooks/workspaces-controller:sha-3fa851ab3173942dbaa1a609468e7f9eadf5f4e4`
example image name from release:
- `ghcr.io/kubeflow/notebooks/workspaces-controller:v2.0.0`
Signed-off-by: Andy Stoneberg <astonebe@redhat.com>
This commit brings about various changes to improve naming consistency across the `workspaces/` components.
The original `controller/` manifests were generated by kubebuilder and were not aligned with the conventions we have established in the `backend` and `frontend` components. Changing the manifests also had a "trickle effect" of requiring minor modifications to the `Makefile` as well as some e2e tests and documentation.
Key manifest changes:
- dropped `namePrefix` transformation
- standardized on `kubeflow-workspaces` namespace
- leveraged name of `workspaces-controller` where sensible
- Standardized `app.kubernetes.io/*` labels across all resources
- leveraging `labels` transformation as much as possible
- selectively applied `includeSelectors: true` when appropriate
- Removed legacy control-plane=controller-manager labels
- replaced with appropriate `app.kubernetes.io/*` labels to keep behavioral parity
Signed-off-by: Andy Stoneberg <astonebe@redhat.com>
* chore(ws): comment workspace details logs tab while it is not supported
Signed-off-by: paulovmr <832830+paulovmr@users.noreply.github.com>
* chore(ws): comment workspace details pod template tab while it is not supported
Signed-off-by: paulovmr <832830+paulovmr@users.noreply.github.com>
---------
Signed-off-by: paulovmr <832830+paulovmr@users.noreply.github.com>
- Updated swaggo/swag from v1.16.4 to v1.16.6 in go.mod and Makefile.
- Added required fields to various OpenAPI definitions in docs.go and swagger.json for better validation via `--requiredByDefault` flag
- `swag` `v1.16.6` contains a commit we authored to treat `json:omitempty` as `required: false`. That, in conjunction with `--requiredByDefault` flag, allows us to generate models with proper _required-ness_
Signed-off-by: Andy Stoneberg <astonebe@redhat.com>
- added @ID annotations for all API routes to populate operationId Swagger attribute
- split GetWorkspacesHandler into 2 separate handlers to account for @ID needing to be unique-per-route
- GetAllWorkspacesHandler now services GET /workspaces
- GetWorkspacesByNamespaceHandler now services GET /workspaces/{namespace}
- non-exported getWorkspacesHandler function contains all business logic that existed in GetWorkspacesHandler
- Adjusted test cases to align with the new handler names.
Signed-off-by: Andy Stoneberg <astonebe@redhat.com>
Signed-off-by: Jenny <32821331+jenny-s51@users.noreply.github.com>
remove comment
fix(ws): remove set to first page when filters applied
Signed-off-by: Jenny <32821331+jenny-s51@users.noreply.github.com>
fix tests for filterWorkspacesTest
fix single filter test
Signed-off-by: Jenny <32821331+jenny-s51@users.noreply.github.com>
fix bug in ws kind table
related: #298
- Added PauseActionWorkspaceHandler to handle pausing or unpausing a given workspace
- Introduced single new route for starting and pausing workspaces in the API.
- `api/v1/workspaces/{namespace}/{name}/actions/pause`
- pausing or unpausing operation is specified in the request payload
- Created a new WorkspaceActionPauseEnvelope type for successful responses.
- Leveraging JSONPatch / client.RawPatch to ensure Workspace in "valid state" before attempting action
- for `start`: `spec.paused` must be `true`, and `status.state` must be `Paused`
- for `pause`: `spec.paused` must be `false`
- note: I would love to have a `status.state` check here of `status.state != Paused`, but that type of comparison is not supported in [JSONPatch](https://datatracker.ietf.org/doc/html/rfc6902#section-4.6)
- Added tests for the new API, including success and error cases.
- Updated README/OpenAPI documentation to include the new endpoints.
---
As an interesting "edge case" worth calling out, the following payload is currently honored by the API:
```
{
"data": {}
}
```
Given the `WorkspaceActionPause` struct is simply `{"paused": true|false}`, the "empty" Envelope presented above deserializes the JSON using the zero value of `bool` (which is `false`).
Our validation today is always performed against the **deserialized** object, and as such impossible to distinguish the following cases:
```
{
"data": {}
}
```
vs
```
{
"data": {
"paused": false
}
}
```
The effort and (relative) complexity to prevent this and return a `422` in this scenario was not deemed "worth it" for the time being. As a result, a test case has been added for this specific scenario to at minimum document this "strange" behavior.
- Clients, however, should **NOT** rely on this behavior and always provide a fully defined `WorkspaceActionPause` JSON object to ensure future compatibility.
Signed-off-by: Andy Stoneberg <astonebe@redhat.com>
Signed-off-by: Jenny <32821331+jenny-s51@users.noreply.github.com>
fix(ws): remove extra DrawerPanelBody
remove unused file
Signed-off-by: Jenny <32821331+jenny-s51@users.noreply.github.com>
fix(ws): remove comment and hide drawer on previousStep callback
Signed-off-by: Jenny <32821331+jenny-s51@users.noreply.github.com>
fix(ws): when navigating between wizard steps, show drawer for steps that have drawer content
Signed-off-by: Jenny <32821331+jenny-s51@users.noreply.github.com>
move formatLabel to separate util
add title, divider, and fix wizard buttons to align with PF design guidelines
Signed-off-by: Jenny <32821331+jenny-s51@users.noreply.github.com>
prevent wizard button from active state when no selection
Signed-off-by: Jenny <32821331+jenny-s51@users.noreply.github.com>
rebase
Signed-off-by: Jenny <32821331+jenny-s51@users.noreply.github.com>
handle standard infra resource types