Skip to content

Commit

Permalink
[ws-manager] Ensure values are not overwritten
Browse files Browse the repository at this point in the history
If a variable is already sourced from a reference do not overwrite it.
  • Loading branch information
Furisto authored and roboquat committed Oct 24, 2022
1 parent da10c12 commit 9fd3e3b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions components/ws-manager/pkg/manager/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,11 @@ func setProtectedSecrets(pod *corev1.Pod, req *api.StartWorkspaceRequest) {
continue
}

// already sourced from somewhere else
if env.ValueFrom != nil {
continue
}

env.Value = ""
env.ValueFrom = &corev1.EnvVarSource{
SecretKeyRef: &corev1.SecretKeySelector{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@
"name": "one_from_a_secret",
"valueFrom": {
"secretKeyRef": {
"name": "ws-test",
"key": "31ba5230e08a8d69893703c936aaf570c76246cac7a2f7d4cfd28b8ab180631b"
"name": "some-secret",
"key": "some-key"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@
"name": "one_from_a_secret",
"valueFrom": {
"secretKeyRef": {
"name": "ws-test",
"key": "31ba5230e08a8d69893703c936aaf570c76246cac7a2f7d4cfd28b8ab180631b"
"name": "some-secret",
"key": "some-key"
}
}
},
Expand Down

0 comments on commit 9fd3e3b

Please sign in to comment.