-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Solve "cannot download OTS" - by removing OTS for secrets #11112
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
Conversation
/werft run 👍 started the job as gitpod-build-cw-wsman-secrets.2 |
3d89372
to
25ea837
Compare
25ea837
to
0833bd4
Compare
@csweichel just one question, do we have limits for the length of the secrets? |
We do - env vars are limited to 32767 bytes. There is no limit on the total number of env vars though. I doubt this is a problem in practice, but will add validation on the ws-manager side. |
to introduce a benign failure mode compared to the Kubernetes provided message.
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.
Approving in case it helps to unblock the PR. Haven't looked at the PR in its entirety but changes in the content-service-api
are looking fabulous 😍 !
/werft run 👍 started the job as gitpod-build-cw-wsman-secrets.14 |
@csweichel can you please add admin flag to my user? I cannot enable it myself as by default you are the only admin. |
@@ -577,6 +590,28 @@ func (m *Manager) createDefiniteWorkspacePod(startContext *startWorkspaceContext | |||
gitpodGUID := int64(133332) | |||
pod.Spec.SecurityContext.FSGroup = &gitpodGUID | |||
|
|||
case api.WorkspaceFeatureFlag_PROTECTED_SECRETS: | |||
for _, c := range pod.Spec.Containers { | |||
if c.Name != "workspace" { |
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.
is this check necessary? this implies we have more then one container in the spec. Do we now?
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.
That's right - today we don't have multiple container, and it's not that likely we will in the future (we have had multiple containers in the past).
I'd be ok with removing the check, and equally with leaving it in.
IMHO it's a tad more complete, because the env vars of other containers (should we have them) would likely not be part of the secret.
I bet you thought about it, but: Are there any intermittent states (e.g., |
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.
WebApp code LGTM, tested and works. ✔️
@csweichel merging this closed the epic, was that intentional? I ask because my understanding is that |
Indeed - I don't believe such intermittent state exists because:
Mainly security, i.e. keeping that data around only when it's needed. One can still go to the pod and look at the env vars, but at least it's gone from the Kubernetes API server. |
That was not intentional - my bad for adding it as "fixes". |
Description
This PR works towards removing OTS from Gitpod. To this end it makes
ws-manager
use Kubernetes secrets to store sensitive workspace data (e.g. Git or Gitpod tokens, but also user env vars).This PR touches on two teams:
protected secrets
behaviour, where ws-manager creates one secret per workspace, and uses this secret to feed the pod environment variables as well as theInitializeWorkspace
call. Relevant commits are 4ca3b87, 69c5e82 and 53a064c.fixes #10134
How it works
When the
protected_secrets
workspace feature flag is enabled,ws-manager
creates a secret with the same name as workspace pod. In this secret are the user provided environment variables (this includes team env vars), as well as secrets extracted from the content initializer.For the former (user provided env vars), the env var entries in the secret use the sha256 hash of the env var name, because we have no guarantee that the env var name is actually a valid secret data name.
For the latter, this PR contains code which can extract and re-inject secrets from/to a content initializer. There are unit tests for this behaviour.
The secret is removed once the pod reaches the
running
phase, but latest when it'sstopping
orstopped
. Once the pod is running, there is no reason to keep the secret around. The secret also isn't part of theworkspaceObjects
to avoid dumping it in the event trace log.How to test
protected_secrets
feature flag for your user in the admin UI.*/*
as repository pattern to make sure you get that env var when starting a workspace.# list all workspace secrets $ kubectl get secret -l component=workspace -o yaml
FAQ
Because of the
content-service-api
change and the outdated CODEOWNERS fileYes, but then it is harder to try out. I hope that the commits are reviewable by themselves.
server
?Because it's still used for the additional content, e.g. for server generated
.gitpod.yml
files. That's for another day.Release Notes
Werft options: