-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy path_tshoot-tech-detect-orphans.html.md.erb
79 lines (60 loc) · 2.57 KB
/
_tshoot-tech-detect-orphans.html.md.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
A service instance is defined as "orphaned" when the BOSH deployment for the
instance is still running, but the service is no longer registered in Cloud Foundry.
The `orphan-deployments` errand collates a list of service deployments that have
no matching service instances in Cloud Foundry and return the list to the operator.
It is then up to the operator to remove the orphaned BOSH deployments.
<br>
To run the errand, run the following command:
```
bosh -d DEPLOYMENT-NAME run-errand orphan-deployments
```
<br>
**If orphan deployments exist**---The errand script does the following:
* Exit with exit code 10
* Output a list of deployment names under a `[stdout]` header
* Provide a detailed error message under a `[stderr]` header
For example:
<pre class="terminal">
[stdout]
[{"deployment\_name":"service-instance\_80e3c5a7-80be-49f0-8512-44840f3c4d1b"}]
[stderr]
Orphan BOSH deployments detected with no corresponding service instance in Cloud Foundry. Before deleting any deployment it is recommended to verify the service instance no longer exists in Cloud Foundry and any data is safe to delete.
Errand 'orphan-deployments' completed with error (exit code 10)
</pre>
These details will also be available through the BOSH `/tasks/` API endpoint for use in scripting:
<pre class="terminal">
$ curl 'https<span>:</span>//bosh-user:bosh-password@bosh-url:25555/tasks/task-id/output?type=result' | jq .
{
"exit_code": 10,
"stdout": "[{"deployment_name":"service-instance_80e3c5a7-80be-49f0-8512-44840f3c4d1b"}]\n",
"stderr": "Orphan BOSH deployments detected with no corresponding service instance in Cloud Foundry. Before deleting any deployment it is recommended to verify the service instance no longer exists in Cloud Foundry and any data is safe to delete.\n",
"logs": {
"blobstore_id": "d830c4bf-8086-4bc2-8c1d-54d3a3c6d88d"
}
}
</pre>
<br>
**If no orphan deployments exist**---The errand script does the following:
* Exit with exit code 0
* Stdout will be an empty list of deployments
* Stderr will be `None`
<pre class="terminal">
[stdout]
[]
[stderr]
None
Errand 'orphan-deployments' completed successfully (exit code 0)
</pre>
<br>
**If the errand encounters an error during running**---The errand script does the following:
* Exit with exit 1
* Stdout will be empty
* Any error messages will be under stderr
<br>
To clean up orphaned instances, run the following command on each instance:
<p class="note warning">
<strong>WARNING: </strong> Running this command may leave IaaS resources in an unusable state.
</p>
```
bosh delete-deployment service-instance_SERVICE-INSTANCE-GUID
```