Skip to content

feat(ws): add spec.podTemplate.volumes.secrets[] to Workspace #240

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

Open
wants to merge 1 commit into
base: notebooks-v2
Choose a base branch
from

Conversation

thesuperzapper
Copy link
Member

related #239

This PR adds spec.podTemplate.volumes.secrets[] to the Workspace CRD, which lets users can mount secrets as volumes to their workspaces.

The Workspace CRD now has fields like this:

spec:
  podTemplate:
    volumes:
      secrets:
        - secretName: "workspace-secret"
          mountPath: "/secrets/my-secret"
          defaultMode: 420 # same as 0644 in octal

Because errors relating to missing secrets (which cause the pod to get stuck in "pending" state) are only surfaced through Pod events, we now extract Pod events when determining the Workspace state and stateMessage.

Additionally, because those events might not exist when we first reconcile the Workspace (and none of the current WS reconcile triggers would cause a reconciliation when a new event is raised), we simply always requeue every 15 seconds when a Workspace's Pod is in the Pending state (and hopefully pick up a Warning even which will break us out of this loop).

Copy link

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

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@vdksystem
Copy link

@thesuperzapper, why don't we check if secret exists as part of reconciliation process? Then we can set ConfigError status or similar right away.
Or may be we have validation webhook which will prevent user from creating workspace with wrong config.
Also I wold add backoff to delayed reconciliation.

@thesuperzapper
Copy link
Member Author

@thesuperzapper, why don't we check if secret exists as part of reconciliation process? Then we can set ConfigError status or similar right away. Or may be we have validation webhook which will prevent user from creating workspace with wrong config.

@vdksystem I think its safer to create the pod and see if it succeeds (e.g. eventual consistency). There are also some strange situations where a secret is only created when a pod tries to mount it.

I also want to avoid the validation webhook rejecting "potentially" valid configs (especially because a secret could be deleted after the Workspace, which would lead to an "update" being rejected on a previously acceptable manifest).

Also I wold add backoff to delayed reconciliation.

I think the only sensible way to achieve this would be to make the reconciliation loop "fail" in the case that we have a pending Pod with no events (that is, return non-nill err, but still update the Workspace state to Pending before doing that).

This would kick us into the exponential failure backoff of controller-runtime (which is probably way to aggressive, as discussed in #245). However, this would also be quite noisy in the controller logs, because each of the failed reconciles will show as an error even though we are really "waiting" for Pod events to be created.

Another approach is not returning an error, but storing a "retry count" in the status of the Workspace. However, this will cause a whole bunch of updates to the Workspace resource during the retry (which will also trigger other resources to reconcile, e.g. the WorkspaceKind used by the Workspace).

Not sure which is "best", do you have any thoughts?

@vdksystem
Copy link

@thesuperzapper agree with eventual consistency. Optional - we can implement kinda soft check. Not sure if it make sense to adjust status, but at least emit warning event.

With retries, we can use creationTimestamp and implement backoff logic around time since created (e.g. retyInterval = 15s * minutes since created).

I think all of that would make sense only at scale, can be ignored for now.

andyatmiami added a commit to andyatmiami/kubeflow-notebooks that referenced this pull request May 13, 2025
related: kubeflow#239

This commit brings partial support for secrets to the backend API.  It enables the `frontend` component to successfully create a Workspace through the "wizard flow".

**HOWEVER**, it is important to note this secrets attribute is not supported within the `controller` component yet - as kubeflow#240 is not yet merged. To unblock the `frontend` - the logic contained in this commit simply adds the necessary scaffolding to accept the `secrets` attribute defined within `volumes`.  Once umarshalled, the backend essentially ignores this data.  Code to fully enable the end to end flow is included in this PR - but simply commented out with `TODO:` comments denoting what can be uncommented once kubeflow#240 is merged into `notebooks-v2`.  A test is also presently disabled with `XIt` - and can also be enabled when required code present.

Changes were initially coded against the branch provided on kubeflow#240 to verify full end-to-end behavior.  Once confirmed, commit was rebased onto `notebooks-v2`, relevant code commented out as described above, and behavior retested to ensure desired outcome.

In summary, with these changes:
- `backend` API accepts `volumes.secrets` in the _Create_ payload
- secrets data is **NOT USED** when programmatically constructing the Workspace CR
- Resultant workspace has no `secrets` data - irrespective of it if was provided in the payload or not.

Signed-off-by: Andy Stoneberg <[email protected]>
andyatmiami added a commit to andyatmiami/kubeflow-notebooks that referenced this pull request May 15, 2025
related: kubeflow#239

This commit brings partial support for secrets to the backend API.  It enables the `frontend` component to successfully create a Workspace through the "wizard flow".

**HOWEVER**, it is important to note this secrets attribute is not supported within the `controller` component yet - as kubeflow#240 is not yet merged. To unblock the `frontend` - the logic contained in this commit simply adds the necessary scaffolding to accept the `secrets` attribute defined within `volumes`.  Once umarshalled, the backend essentially ignores this data.  Code to fully enable the end to end flow is included in this PR - but simply commented out with `TODO:` comments denoting what can be uncommented once kubeflow#240 is merged into `notebooks-v2`.  A test is also presently disabled with `XIt` - and can also be enabled when required code present.

Changes were initially coded against the branch provided on kubeflow#240 to verify full end-to-end behavior.  Once confirmed, commit was rebased onto `notebooks-v2`, relevant code commented out as described above, and behavior retested to ensure desired outcome.

In summary, with these changes:
- `backend` API accepts `volumes.secrets` in the _Create_ payload
- secrets data is **NOT USED** when programmatically constructing the Workspace CR
- Resultant workspace has no `secrets` data - irrespective of it if was provided in the payload or not.

Signed-off-by: Andy Stoneberg <[email protected]>
andyatmiami added a commit to andyatmiami/kubeflow-notebooks that referenced this pull request May 15, 2025
related: kubeflow#239

This commit brings partial support for secrets to the backend API.  It enables the `frontend` component to successfully create a Workspace through the "wizard flow".

**HOWEVER**, it is important to note this secrets attribute is not supported within the `controller` component yet - as kubeflow#240 is not yet merged. To unblock the `frontend` - the logic contained in this commit simply adds the necessary scaffolding to accept the `secrets` attribute defined within `volumes`.  Once umarshalled, the backend essentially ignores this data.  Code to fully enable the end to end flow is included in this PR - but simply commented out with `TODO:` comments denoting what can be uncommented once kubeflow#240 is merged into `notebooks-v2`.  A test is also presently disabled with `XIt` - and can also be enabled when required code present.

Changes were initially coded against the branch provided on kubeflow#240 to verify full end-to-end behavior.  Once confirmed, commit was rebased onto `notebooks-v2`, relevant code commented out as described above, and behavior retested to ensure desired outcome.

In summary, with these changes:
- `backend` API accepts `volumes.secrets` in the _Create_ payload
- secrets data is **NOT USED** when programmatically constructing the Workspace CR
- Resultant workspace has no `secrets` data - irrespective of it if was provided in the payload or not.

Signed-off-by: Andy Stoneberg <[email protected]>
google-oss-prow bot pushed a commit that referenced this pull request May 15, 2025
related: #239

This commit brings partial support for secrets to the backend API.  It enables the `frontend` component to successfully create a Workspace through the "wizard flow".

**HOWEVER**, it is important to note this secrets attribute is not supported within the `controller` component yet - as #240 is not yet merged. To unblock the `frontend` - the logic contained in this commit simply adds the necessary scaffolding to accept the `secrets` attribute defined within `volumes`.  Once umarshalled, the backend essentially ignores this data.  Code to fully enable the end to end flow is included in this PR - but simply commented out with `TODO:` comments denoting what can be uncommented once #240 is merged into `notebooks-v2`.  A test is also presently disabled with `XIt` - and can also be enabled when required code present.

Changes were initially coded against the branch provided on #240 to verify full end-to-end behavior.  Once confirmed, commit was rebased onto `notebooks-v2`, relevant code commented out as described above, and behavior retested to ensure desired outcome.

In summary, with these changes:
- `backend` API accepts `volumes.secrets` in the _Create_ payload
- secrets data is **NOT USED** when programmatically constructing the Workspace CR
- Resultant workspace has no `secrets` data - irrespective of it if was provided in the payload or not.

Signed-off-by: Andy Stoneberg <[email protected]>
jenny-s51 pushed a commit to jenny-s51/notebooks that referenced this pull request May 16, 2025
related: kubeflow#239

This commit brings partial support for secrets to the backend API.  It enables the `frontend` component to successfully create a Workspace through the "wizard flow".

**HOWEVER**, it is important to note this secrets attribute is not supported within the `controller` component yet - as kubeflow#240 is not yet merged. To unblock the `frontend` - the logic contained in this commit simply adds the necessary scaffolding to accept the `secrets` attribute defined within `volumes`.  Once umarshalled, the backend essentially ignores this data.  Code to fully enable the end to end flow is included in this PR - but simply commented out with `TODO:` comments denoting what can be uncommented once kubeflow#240 is merged into `notebooks-v2`.  A test is also presently disabled with `XIt` - and can also be enabled when required code present.

Changes were initially coded against the branch provided on kubeflow#240 to verify full end-to-end behavior.  Once confirmed, commit was rebased onto `notebooks-v2`, relevant code commented out as described above, and behavior retested to ensure desired outcome.

In summary, with these changes:
- `backend` API accepts `volumes.secrets` in the _Create_ payload
- secrets data is **NOT USED** when programmatically constructing the Workspace CR
- Resultant workspace has no `secrets` data - irrespective of it if was provided in the payload or not.

Signed-off-by: Andy Stoneberg <[email protected]>
Signed-off-by: Jenny <[email protected]>

feat(ws): Add theme dependent components

Signed-off-by: Jenny <[email protected]>

fix linting errors

Signed-off-by: Jenny <[email protected]>

move button to toolbargroup to fix toolbar alignment

fix search input height

fix frontend tests

Signed-off-by: Jenny <[email protected]>

fix testing issues

Signed-off-by: Jenny <[email protected]>

add export default to ThemeAwareSearchInput

Signed-off-by: Jenny <[email protected]>

fix linting issues

fix import

add ID
jenny-s51 pushed a commit to jenny-s51/notebooks that referenced this pull request May 16, 2025
related: kubeflow#239

This commit brings partial support for secrets to the backend API.  It enables the `frontend` component to successfully create a Workspace through the "wizard flow".

**HOWEVER**, it is important to note this secrets attribute is not supported within the `controller` component yet - as kubeflow#240 is not yet merged. To unblock the `frontend` - the logic contained in this commit simply adds the necessary scaffolding to accept the `secrets` attribute defined within `volumes`.  Once umarshalled, the backend essentially ignores this data.  Code to fully enable the end to end flow is included in this PR - but simply commented out with `TODO:` comments denoting what can be uncommented once kubeflow#240 is merged into `notebooks-v2`.  A test is also presently disabled with `XIt` - and can also be enabled when required code present.

Changes were initially coded against the branch provided on kubeflow#240 to verify full end-to-end behavior.  Once confirmed, commit was rebased onto `notebooks-v2`, relevant code commented out as described above, and behavior retested to ensure desired outcome.

In summary, with these changes:
- `backend` API accepts `volumes.secrets` in the _Create_ payload
- secrets data is **NOT USED** when programmatically constructing the Workspace CR
- Resultant workspace has no `secrets` data - irrespective of it if was provided in the payload or not.

Signed-off-by: Andy Stoneberg <[email protected]>
Signed-off-by: Jenny <[email protected]>

feat(ws): Add theme dependent components

Signed-off-by: Jenny <[email protected]>

fix linting errors

Signed-off-by: Jenny <[email protected]>

move button to toolbargroup to fix toolbar alignment

fix search input height

fix frontend tests

Signed-off-by: Jenny <[email protected]>

fix testing issues

Signed-off-by: Jenny <[email protected]>

add export default to ThemeAwareSearchInput

Signed-off-by: Jenny <[email protected]>

fix linting issues

fix import

add ID
Noa-limoy pushed a commit to Noa-limoy/notebooks that referenced this pull request May 18, 2025
related: kubeflow#239

This commit brings partial support for secrets to the backend API.  It enables the `frontend` component to successfully create a Workspace through the "wizard flow".

**HOWEVER**, it is important to note this secrets attribute is not supported within the `controller` component yet - as kubeflow#240 is not yet merged. To unblock the `frontend` - the logic contained in this commit simply adds the necessary scaffolding to accept the `secrets` attribute defined within `volumes`.  Once umarshalled, the backend essentially ignores this data.  Code to fully enable the end to end flow is included in this PR - but simply commented out with `TODO:` comments denoting what can be uncommented once kubeflow#240 is merged into `notebooks-v2`.  A test is also presently disabled with `XIt` - and can also be enabled when required code present.

Changes were initially coded against the branch provided on kubeflow#240 to verify full end-to-end behavior.  Once confirmed, commit was rebased onto `notebooks-v2`, relevant code commented out as described above, and behavior retested to ensure desired outcome.

In summary, with these changes:
- `backend` API accepts `volumes.secrets` in the _Create_ payload
- secrets data is **NOT USED** when programmatically constructing the Workspace CR
- Resultant workspace has no `secrets` data - irrespective of it if was provided in the payload or not.

Signed-off-by: Andy Stoneberg <[email protected]>
mkoushni pushed a commit to mkoushni/notebooks that referenced this pull request May 28, 2025
related: kubeflow#239

This commit brings partial support for secrets to the backend API.  It enables the `frontend` component to successfully create a Workspace through the "wizard flow".

**HOWEVER**, it is important to note this secrets attribute is not supported within the `controller` component yet - as kubeflow#240 is not yet merged. To unblock the `frontend` - the logic contained in this commit simply adds the necessary scaffolding to accept the `secrets` attribute defined within `volumes`.  Once umarshalled, the backend essentially ignores this data.  Code to fully enable the end to end flow is included in this PR - but simply commented out with `TODO:` comments denoting what can be uncommented once kubeflow#240 is merged into `notebooks-v2`.  A test is also presently disabled with `XIt` - and can also be enabled when required code present.

Changes were initially coded against the branch provided on kubeflow#240 to verify full end-to-end behavior.  Once confirmed, commit was rebased onto `notebooks-v2`, relevant code commented out as described above, and behavior retested to ensure desired outcome.

In summary, with these changes:
- `backend` API accepts `volumes.secrets` in the _Create_ payload
- secrets data is **NOT USED** when programmatically constructing the Workspace CR
- Resultant workspace has no `secrets` data - irrespective of it if was provided in the payload or not.

Signed-off-by: Andy Stoneberg <[email protected]>
Signed-off-by: CI Bot <[email protected]>
Copy link

github-actions bot commented Jun 2, 2025

This pull request has been automatically marked as stale because it has not had recent activity.
It will be closed if no further activity occurs.
Thank you for your contributions.

Members may comment /lifecycle frozen to prevent this pull request from being marked as stale.

mkoushni pushed a commit to mkoushni/notebooks that referenced this pull request Jun 4, 2025
related: kubeflow#239

This commit brings partial support for secrets to the backend API.  It enables the `frontend` component to successfully create a Workspace through the "wizard flow".

**HOWEVER**, it is important to note this secrets attribute is not supported within the `controller` component yet - as kubeflow#240 is not yet merged. To unblock the `frontend` - the logic contained in this commit simply adds the necessary scaffolding to accept the `secrets` attribute defined within `volumes`.  Once umarshalled, the backend essentially ignores this data.  Code to fully enable the end to end flow is included in this PR - but simply commented out with `TODO:` comments denoting what can be uncommented once kubeflow#240 is merged into `notebooks-v2`.  A test is also presently disabled with `XIt` - and can also be enabled when required code present.

Changes were initially coded against the branch provided on kubeflow#240 to verify full end-to-end behavior.  Once confirmed, commit was rebased onto `notebooks-v2`, relevant code commented out as described above, and behavior retested to ensure desired outcome.

In summary, with these changes:
- `backend` API accepts `volumes.secrets` in the _Create_ payload
- secrets data is **NOT USED** when programmatically constructing the Workspace CR
- Resultant workspace has no `secrets` data - irrespective of it if was provided in the payload or not.

Signed-off-by: Andy Stoneberg <[email protected]>
Signed-off-by: CI Bot <[email protected]>
andyatmiami added a commit to andyatmiami/kubeflow-notebooks that referenced this pull request Jun 13, 2025
related: kubeflow#239

This commit brings partial support for secrets to the backend API.  It enables the `frontend` component to successfully create a Workspace through the "wizard flow".

**HOWEVER**, it is important to note this secrets attribute is not supported within the `controller` component yet - as kubeflow#240 is not yet merged. To unblock the `frontend` - the logic contained in this commit simply adds the necessary scaffolding to accept the `secrets` attribute defined within `volumes`.  Once umarshalled, the backend essentially ignores this data.  Code to fully enable the end to end flow is included in this PR - but simply commented out with `TODO:` comments denoting what can be uncommented once kubeflow#240 is merged into `notebooks-v2`.  A test is also presently disabled with `XIt` - and can also be enabled when required code present.

Changes were initially coded against the branch provided on kubeflow#240 to verify full end-to-end behavior.  Once confirmed, commit was rebased onto `notebooks-v2`, relevant code commented out as described above, and behavior retested to ensure desired outcome.

In summary, with these changes:
- `backend` API accepts `volumes.secrets` in the _Create_ payload
- secrets data is **NOT USED** when programmatically constructing the Workspace CR
- Resultant workspace has no `secrets` data - irrespective of it if was provided in the payload or not.

Signed-off-by: Andy Stoneberg <[email protected]>
Copy link

This pull request has been automatically closed because it has not had recent activity.
You can reopen the PR if you want.

@github-actions github-actions bot closed this Jun 23, 2025
@github-project-automation github-project-automation bot moved this from Needs Triage to Done in Kubeflow Notebooks Jun 23, 2025
@thesuperzapper
Copy link
Member Author

/reopen

@google-oss-prow google-oss-prow bot reopened this Jun 23, 2025
Copy link

@thesuperzapper: Reopened this PR.

In response to this:

/reopen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@yashpal2104
Copy link

Does this PR require help?

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

Successfully merging this pull request may close these issues.

3 participants