Uh oh!
There was an error while loading. Please reload this page.
Detect changes in automount resources and queue reconciles for started workspaces - #1017
Conversation
Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Watch for events related to automount resources (configmaps, secrets, pvcs) and queue reconciles for all running workspaces when detected. This ensures that changes to automount resources (e.g. updating a git-credential secret) are picked up and included in workspaces without requiring a manually triggered reconcile. Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Signed-off-by: Angel Misevski <amisevsk@redhat.com>
amisevsk
commented
Jan 13, 2023
/retest |
Codecov ReportBase: 49.98% // Head: 50.23% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@## main #1017 +/- ##
==========================================
+ Coverage 49.98% 50.23% +0.24%
==========================================
Files 69 70 +1 Lines 5968 6006 +38 ==========================================
+ Hits 2983 3017 +34 - Misses 2759 2762 +3 - Partials 226 227 +1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
dkwon17
commented
Jan 16, 2023
I was able to go through the testing steps successfully, but I have a couple of questions:
The devworkspace-merged-git-credentials secret was updated immediately, but the workspace did not restart, is this expected? Also, I was able to test this PR by mounting a PVC: After starting a workspace, I updated the PVC by changing the mount path, which automatically restarted my running workspaces. Just wanted to highlight this because changing a PVC seems to immediately restart workspaces, but changes in configmap/secret's data does not, is this expected? |
AObuchow
commented
Jan 16, 2023
Things seem to work well in my testing. The git credentials case worked as I expected: I created a git credentials secret, then modified it to change the credentials, and the mounted credential file was updated without restarting the workspace (which I imagine is intended?). I also saw the following in the controller logs: {
"level":"info",
"ts":1673904579.3065548,
"logger":"controllers.DevWorkspace",
"msg":"syncing merged git credentials secret: v1.Secret devworkspace-merged-git-credentials is not ready: Updated object",
"Request.Namespace":"devworkspace-controller",
"Request.Name":"plain-devworkspace",
"devworkspace_id":"workspace378ff1947b854bef"
}I also tried creating a configmap with the One small thing to note (that I think is outside the scope of this issue): I think this is more related to the way the per-workspace pvc size configmaps are handled. I guess in the per-workspace storage provisioner, there's no check to see if the existing PVC for the workspace is the correct size. Deleting the PVC could result in data loss, so the current behaviour is probably for the better until #875 is resolved. |
AObuchow
left a comment
There was a problem hiding this comment.
Code looks good to me & great work on adding more controller tests 😎 🙏
amisevsk
commented
Jan 16, 2023
This is expected -- the changes to the merged secret result in no changes to the workspace pod's spec, and so the pod is not restarted. Other changes (e.g. adding an automount PVC) change the pod spec (to mount the new object) and so the pod must be restarted to pick up the changes. For the merged-git-credentials secret in specific, restarting the pod is not necessary. As the secret is mounted as files in the workspace, any changes to the secret's data will eventually be propagated down into the mounted file within the pod. This allows for rotating PATs automatically without requiring workspace restarts. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: amisevsk, AObuchow, dkwon17 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What does this PR do?
Watches namespaces for changes to automounted resources (configmaps, secrets, PVCs -- including git credentials secrets) and queues reconciles for any started workspaces in the same namespace.
There is a new controller test to verify this functionality. To avoid erroneous passing tests, I had to reduce the timeout, which could potentially cause flakiness in the future.
What issues does this PR fix or reference?
Closes#914
Is it tested? How?
To test manually:
To verify the specific case in the issue:
devworkspace-merged-git-credentialssecret immediately.PR Checklist
/test v8-devworkspace-operator-e2e, v8-che-happy-pathto trigger)v8-devworkspace-operator-e2e: DevWorkspace e2e testv8-che-happy-path: Happy path for verification integration with Che