Introduce gl_workspace_reconciled_actual_state file var
Issue: Introduce gl_workspace_reconciled_actual_state ... (#520866 - closed) • Chad Woolley • 17.10
What does this MR do and why?
Introduce internal WorkspaceVariable for actual_state
- Introduce
gl_workspace_reconciled_actual_state
file
type variable to be sent in each Workspaces reconciliation response. - See Introduce gl_workspace_reconciled_actual_state ... (#520866 - closed) for issue
- See details in the High level overview of implementation plan section of epic Startup scripts for Remote Development workspac... (&15602) (item number
4
).
References
- Corresponding issue: Introduce gl_workspace_reconciled_actual_state ... (#520866 - closed)
- See details in the High level overview of implementation plan section of epic Startup scripts for Remote Development workspac... (&15602) (item number
4
).
Query Plan
The "Partial Reconciliation" query in workspaces_to_be_returned_finder.rb
was modified.
Generated query:
SELECT "workspaces"."id", "workspaces"."created_at", "workspaces"."updated_at", "workspaces"."user_id", "workspaces"."project_id", "workspaces"."cluster_agent_id", "workspaces"."desired_state_updated_at", "workspaces"."responded_to_agent_at", "workspaces"."name", "workspaces"."namespace", "workspaces"."desired_state", "workspaces"."actual_state", "workspaces"."devfile_path", "workspaces"."devfile", "workspaces"."processed_devfile", "workspaces"."url", "workspaces"."deployment_resource_version", "workspaces"."personal_access_token_id", "workspaces"."force_include_all_resources", "workspaces"."url_prefix", "workspaces"."url_query_string", "workspaces"."workspaces_agent_config_version", "workspaces"."desired_config_generator_version", "workspaces"."project_ref", "workspaces"."actual_state_updated_at" FROM "workspaces" WHERE "workspaces"."cluster_agent_id" = 10 AND (desired_state_updated_at > responded_to_agent_at OR "workspaces"."responded_to_agent_at" IS NULL OR actual_state_updated_at > responded_to_agent_at OR "workspaces"."responded_to_agent_at" IS NULL OR "workspaces"."desired_state" = 'Terminated' AND "workspaces"."actual_state" != 'Terminated' OR "workspaces"."id" = 27 OR "workspaces"."force_include_all_resources" = TRUE) ORDER BY "workspaces"."id" ASC
Query Plan:
https://console.postgres.ai/gitlab/gitlab-production-main/sessions/38426/commands/118170
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Output of two terminal commands below
Output in VS Code terminal
How to set up and validate locally
By directly reading secret value from kubernetes
- create a workspace
- kubens to pick namespace of current workspace
watch -n 0.5 "SECRET_NAME=\$(kubectl get secrets -o json | jq -r '.items[] | select(.data.\"gl_workspace_reconciled_actual_state.txt\" != null) | .metadata.name' | head -1) && kubectl get secret \$SECRET_NAME -o jsonpath='{.data.gl_workspace_reconciled_actual_state\\.txt}' | base64 --decode"
kubectl exec
By reading secret value from running container via - create a workspace
- kubens to pick namespace of current workspace
watch -n0.5 "kubectl exec $(kubectl get pods -o jsonpath='{.items[*].metadata.name}') -- cat /.workspace-data/variables/file/gl_workspace_reconciled_actual_state.txt"
By viewing secret in VS Code terminal
- Create a workspace, open the terminal in VS Code, and run the command to see the content of the file:
cat /.workspace-data/variables/file/gl_workspace_reconciled_actual_state.txt
Edited by Chad Woolley