Skip to content
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

Fixes a bug where a VM ends up in a state where it does not have a "rendered_templates_archive" in the spec json #2595

Merged
merged 1 commit into from
Jan 8, 2025

Conversation

jpalermo
Copy link
Member

Steps to reproduce:

  • Deploy a VM
  • Redeploy the VM without making any changes (this updates the spec json in the instances table to no longer have the rendered_templates_archive data since no templates were rendered)
  • bosh restart vm/0 --no-converge

The restart action won't cause templates to be re-rendered, but will cause an update of the VM. Since rendered_templates_archive is no longer part of the spec json, the agent thinks it should not be starting any jobs and "monit summary" will be empty.

This fix makes two changes.

  • When sending rendered templates over the NATS bus to VMs, rather than through the blobstore, it will persist the entry into the "rendered_templates_archive" table. This seems a bit weird since the templates aren't actually in the blobstore, but this odd pattern is already in use. The spec json on the VM always has a "blobstore_id" even though the templates never went through the blobstore. So it's a bit odd, but it is consistent.
  • When constructing the instances in the deployment plan from existing instance models, it will check if the database has the existing rendered templates archive and will merge that into the instance plan model. During a normal deploy, this will simply get replaced after the templates are rendered as part of the deployment process. However, this makes the template archive details available for deploys that do not end up rendering templates.

…endered_templates_archive" in the spec json

Steps to reproduce:
- Deploy a VM
- Redeploy the VM without making any changes (this updates the spec json in the instances table to no longer have the rendered_templates_archive data since no templates were rendered)
- bosh restart vm/0 --no-converge

The restart action won't cause templates to be re-rendered, but will cause an update of the VM. Since rendered_templates_archive is no longer part of the spec json, the
agent thinks it should not be starting any jobs and "monit summary" will be empty.

This fix makes two changes.
- When sending rendered templates over the NATS bus to VMs, rather than through the blobstore, it will persist the entry into the "rendered_templates_archive" table. This seems
  a bit weird since the templates aren't actually in the blobstore, but this odd pattern is already in use. The spec json on the VM always has a "blobstore_id" even though the
  templates never went through the blobstore. So it's a bit odd, but it is consistent.
- When constructing the instances in the deployment plan from existing instance models, it will check if the database has the existing rendered templates archive and will merge
  that into the instance plan model. During a normal deploy, this will simply get replaced after the templates are rendered as part of the deployment process. However, this
  makes the template archive details available for deploys that do not end up rendering templates.
@beyhan
Copy link
Member

beyhan commented Jan 7, 2025

Good catch! IIRC I've been investigating this but never got until the root cause of it.

@ystros ystros merged commit 17d62e2 into main Jan 8, 2025
20 checks passed
@ystros ystros deleted the pr-fix-recreate-no-converge branch January 8, 2025 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

5 participants