VMware Cloud Foundation APIs: Upgrading VCF Management
Performing an upgrade of your VMware Cloud Foundation platform involves multiple steps which include running a precheck of the component before commencing the upgrade itself. I've broken these steps down into sections as you have some optionality.
- Authenticating to the VCF Fleet Lifcycle Service
- Configure the Upgrade Plan
- Perform Prechecks Before Upgrading
- Perform Component Upgrades
Authenticating to the VCF Fleet Lifcycle Service
VCF Fleet Lifecycle Service APIs Used
- POST /api/v1/identity/token
Connect to a system that has access to the infrastructure and is capable of running CURL.
Replace the values in the sample code with values for your VCF Fleet Lifecycle Service and paste the commands in the console. If your not sure which endpoint this FQDN should be log into VCF Operations, go to Build > Lifecycle > VCF Management and select the Components tab and locate the component named Fleet lifecycle the FQDN is shown in the FQDN column.
1export vcfFleetLifecycleFqdn='flt-fc01.rainpole.io'
2export vcfFleetLifecycleUser='[email protected]'
3export vcfFleetLifecyclePass='VMw@re1!VMw@re1!'
- Authenticate to the VCF Fleet Lifecycle service and obtain a token by running the following command:
1vcfFleetLifecycleToken=$(curl -k -X POST "https://$vcfFleetLifecycleFqdn/api/v1/identity/token" \
2 --header 'Content-Type: application/x-www-form-urlencoded' \
3 --data "grant_type=password" \
4 --data "username=$vcfFleetLifecycleUser" \
5 --data "password=$vcfFleetLifecyclePass" \
6 | jq -r '.access_token')
- Verify you successfully obtained an authentication token by running the following command:
1echo $vcfFleetLifecycleToken
Example Output:
1eyJhbGciOiJFZERTQSIsImtpZCI6Ilg4Mk5veGNJRlVCVEFiY0xPM1NUdU12UTF6Qlo4d01xeUxDTGNuOGZYdFUiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL2ZsdC1mYzAxLnJhaW5wb2xlLmlvIiwic3ViIjoiYWRtaW5AdnNwLmxvY2FsIiwiYXVkIjpbInZzcCJdLCJleHAiOjE3ODUyNTE2NDIsImlhdCI6MTc4NTIzNzI0MiwianRpIjoiNTg1NTliYmItNTZlOS00ZWE2LWI2ZDgtNTY0ZjNkYWQwMGRlIiwiYXpwIjoicGFzc3dvcmRfZ3JhbnRfY2xpZW50IiwiYWNjdCI6ImFkbWluQHZzcC5sb2NhbCIsImF1dGhvcml6YXRpb25fZGV0YWlscyI6bnVsbH0.hGXyWeet4RPMvnhbjHs6JtPYTCYcbGFFfsN9toOSMiJca0xXOU2r4rU7OY9hTsmh9h1RzPpAxh-GUZTUMADMCg
Configure the Upgrade Plan
VCF Fleet Lifecycle Service APIs Used
- GET /fleet-lcm/v1/upgrade-plans
- GET /fleet-lcm/v1/release-versions/target-versions
- PATCH /fleet-lcm/v1/upgrade-plans/
- Retrieve the current upgrade plan ID by running the following command:
1upgradePlanId=$(curl -ks -X GET "https://$vcfFleetLifecycleFqdn/fleet-lcm/v1/upgrade-plans" \
2 --header "Authorization: Bearer ${vcfFleetLifecycleToken}" \
3 --header "Accept: application/json" \
4 --header "Content-Type: application/json" \
5 | jq -r '.elements[] .id')
- Verify you successfully obtained the upgrade plan ID by running the following command:
1echo $upgradePlanId
Example Output:
1019f1e4d-a527-79e4-a7ff-bf3797ee6eff
- Obtain the known target versions by the system and extract to the target-versions.json file by running the following command:
1curl -ks -X GET "https://$vcfFleetLifecycleFqdn/fleet-lcm/v1/release-versions/target-versions" \
2 --header "Authorization: Bearer ${vcfFleetLifecycleToken}" \
3 --header "Accept: application/json" \
4 --header "Content-Type: application/json" \
5 | jq -r '.elements[]' > target-versions.json
- Verify the contents of the target-versions.json file by running the following command:
1cat target-versions.json
Example Output:
1{
2 "version": "9.1.0.0",
3 "components": [
4 {
5 "type": "OPS",
6 "publicName": "VCF Operations",
7 "versions": [
8 "9.1.0.0400.25541561",
9 "9.1.0.0300.25531073",
10 "9.1.0.0200.25500350",
11 "9.1.0.0100.25435105",
12 "9.1.0.0.25346025"
13 ]
14 },
15 {
16 "type": "OPS_DATA_PLATFORM",
17 "publicName": "Real-time metrics",
18 "versions": [
19 "9.1.0.0400.25544944",
20 "9.1.0.0100.25435036",
21 "9.1.0.0.25346020"
22 ]
23 },
24 {
25 "type": "OPS_LOGS",
26 "publicName": "Log management",
27 "versions": [
28 "9.1.0.0400.25544947",
29 "9.1.0.0100.25435121",
30 "9.1.0.0.25346055"
31 ]
32 },
33 {
34 "type": "OPS_NETWORKS",
35 "publicName": "VCF Operations for networks",
36 "versions": [
37 "9.1.0.0200.25517220",
38 "9.1.0.0100.25427421",
39 "9.1.0.0.25318550"
40 ]
41 },
42 {
43 "type": "SALT",
44 "publicName": "Salt master",
45 "versions": [
46 "9.1.0.0400.25544946",
47 "9.1.0.0100.25434834",
48 "9.1.0.0.25346036"
49 ]
50 },
51 {
52 "type": "SALT_RAAS",
53 "publicName": "Salt RaaS",
54 "versions": [
55 "9.1.0.0400.25544946",
56 "9.1.0.0100.25434834",
57 "9.1.0.0.25346036"
58 ]
59 },
60 {
61 "type": "TELEMETRY_ACCEPTOR",
62 "publicName": "Telemetry",
63 "versions": [
64 "9.1.0.0.25181946"
65 ]
66 },
67 {
68 "type": "VCD_MIGRATOR",
69 "publicName": "Migration service engine",
70 "versions": [
71 "9.1.0.0200.25556825",
72 "9.1.0.0.25370929"
73 ]
74 },
75 {
76 "type": "VCFA",
77 "publicName": "VCF Automation",
78 "versions": [
79 "9.1.0.0200.25556825",
80 "9.1.0.0100.25429499",
81 "9.1.0.0.25370929"
82 ]
83 },
84 {
85 "type": "VCFMS_METRICS_STORE",
86 "publicName": "Real-time metrics store",
87 "versions": [
88 "9.1.0.0200.25555874",
89 "9.1.0.0.25370367"
90 ]
91 },
92 {
93 "type": "VCF_FLEET_DEPOT",
94 "publicName": "Software depot",
95 "versions": [
96 "9.1.0.0400.25570105",
97 "9.1.0.0.25371105"
98 ]
99 },
100 {
101 "type": "VCF_OPS_CLOUD_PROXY",
102 "publicName": "Cloud proxy",
103 "versions": [
104 "9.1.0.0400.25541562",
105 "9.1.0.0300.25531074",
106 "9.1.0.0200.25500351",
107 "9.1.0.0100.25434833",
108 "9.1.0.0.25346033"
109 ]
110 },
111 {
112 "type": "VCF_SDDC_LCM",
113 "publicName": "SDDC lifecycle",
114 "versions": [
115 "9.1.0.0400.25570103",
116 "9.1.0.0300.25536194",
117 "9.1.0.0200.25495903",
118 "9.1.0.0100.25423352",
119 "9.1.0.0.25371107"
120 ]
121 },
122 {
123 "type": "VIDB",
124 "publicName": "Identity broker",
125 "versions": [
126 "9.1.0.0100.25522734",
127 "9.1.0.0.25368698"
128 ]
129 },
130 {
131 "type": "VSP",
132 "publicName": "VCF services runtime",
133 "versions": [
134 "9.1.0.0200.25555874",
135 "9.1.0.0.25370367"
136 ]
137 }
138 ]
139}
- Extract the most current version from the target-versions.json file and create the desired-state.json payload to configure the upgrade plan by running the following command:
1jq '{
2 spec: {
3 desiredSoftware: {
4 version: "9.1.0.0",
5 components: [.components[] | {type: .type, version: .versions[0]}]
6 }
7 }
8}' target-versions.json > desired-state.json
- Verify the contents of the desired-state.json file by running the following command:
1cat desired-state.json
Example Output:
1{
2 "spec": {
3 "desiredSoftware": {
4 "version": "9.1.0.0",
5 "components": [
6 {
7 "type": "OPS",
8 "version": "9.1.0.0300.25531073"
9 },
10 {
11 "type": "OPS_DATA_PLATFORM",
12 "version": "9.1.0.0400.25544944"
13 },
14 {
15 "type": "OPS_LOGS",
16 "version": "9.1.0.0400.25544947"
17 },
18 {
19 "type": "OPS_NETWORKS",
20 "version": "9.1.0.0200.25517220"
21 },
22 {
23 "type": "SALT",
24 "version": "9.1.0.0400.25544946"
25 },
26 {
27 "type": "SALT_RAAS",
28 "version": "9.1.0.0400.25544946"
29 },
30 {
31 "type": "TELEMETRY_ACCEPTOR",
32 "version": "9.1.0.0.25181946"
33 },
34 {
35 "type": "VCD_MIGRATOR",
36 "version": "9.1.0.0200.25556825"
37 },
38 {
39 "type": "VCFA",
40 "version": "9.1.0.0200.25556825"
41 },
42 {
43 "type": "VCFMS_METRICS_STORE",
44 "version": "9.1.0.0200.25555874"
45 },
46 {
47 "type": "VCF_FLEET_DEPOT",
48 "version": "9.1.0.0400.25570105"
49 },
50 {
51 "type": "VCF_OPS_CLOUD_PROXY",
52 "version": "9.1.0.0400.25541562"
53 },
54 {
55 "type": "VCF_SDDC_LCM",
56 "version": "9.1.0.0400.25570103"
57 },
58 {
59 "type": "VIDB",
60 "version": "9.1.0.0100.25522734"
61 },
62 {
63 "type": "VSP",
64 "version": "9.1.0.0200.25555874"
65 }
66 ]
67 }
68 }
69}
- Update the upgrade plan with the new target releases by running the following command:
1curl -ks -X PATCH "https://$vcfFleetLifecycleFqdn/fleet-lcm/v1/upgrade-plans/${upgradePlanId}" \
2 --header "Authorization: Bearer ${vcfFleetLifecycleToken}" \
3 --header "Accept: application/json" \
4 --header "Content-Type: application/json" \
5 -d @desired-state.json \
6 | jq
Perform Prechecks Before Upgrading
Perform Prechecks For All Components
VCF Fleet Lifecycle Service APIs Used
- POST /fleet-lcm/v1/upgrade-plans/
?action=precheck - GET /fleet-lcm/v1/tasks/
- You can perform the prechecks for all components at once by running the following command:
1taskId=$(curl -ks -X POST "https://$vcfFleetLifecycleFqdn/fleet-lcm/v1/upgrade-plans/${upgradePlanId}?action=precheck" \
2 --header "Authorization: Bearer ${vcfFleetLifecycleToken}" \
3 --header "Accept: application/json" \
4 --header "Content-Type: application/json" \
5 | jq -r ".id")
- Check the status of the precheck task by running the following command:
1curl -k -X GET "https://$vcfFleetLifecycleFqdn/fleet-lcm/v1/tasks/$taskId" \
2 --header "Authorization: Bearer ${vcfFleetLifecycleToken}" \
3 --header "Accept: application/json" \
4 --header "Content-Type: application/json" \
5 | jq
- The command in previous step will need to be run multiple times, you can run the command over and over by running the following command:
1while curl -s -k -X GET "https://$vcfFleetLifecycleFqdn/fleet-lcm/v1/tasks/${taskId}" \
2 --header "Authorization: Bearer ${vcfFleetLifecycleToken}" \
3 --header "Accept: application/json" \
4 --header "Content-Type: application/json" \
5 | jq '{status: .status}' \
6 | grep -q "RUNNING"; do
7 echo "Still in 'RUNNING' state... waiting 60 seconds."
8 sleep 60
9done
Perform Prechecks for a Single Component
- GET /fleet-lcm/v1/components
- POST /fleet-lcm/v1/upgrade-plans/
?action=precheck - GET /fleet-lcm/v1/tasks/
Alternatively you can perform prechecks on an individual components by passing in the component ID.
- Obtain a list of components and their component IDs by running the following command:
1curl -ks -X GET "https://$vcfFleetLifecycleFqdn/fleet-lcm/v1/components" \
2 --header "Authorization: Bearer ${vcfFleetLifecycleToken}" \
3 --header "Accept: application/json" \
4 --header "Content-Type: application/json" \
5 | jq -r '["ID", "COMPONENT TYPE", "DESCRIPTION"], (.components[] | [.id, .componentType, .componentTypeDescription]) | @tsv' \
6 | column -t -s $'\t'
- Replace the values in the sample code with your value and paste the commands in the console.
1export componentId='868ec4ec-a583-4462-9469-9960bfa5c95d'
- Perform a prechecks on an individual component by running the following command:
1taskId=$(curl -ks -X POST "https://$vcfFleetLifecycleFqdn/fleet-lcm/v1/upgrade-plans/${upgradePlanId}?action=precheck" \
2 --header "Authorization: Bearer ${vcfFleetLifecycleToken}" \
3 --header "Accept: application/json" \
4 --header "Content-Type: application/json" \
5 -d "{\"componentsFilter\": [{\"id\": \"${componentId}\"}]}" \
6 | jq -r ".id")
- Check the status of the precheck task by running the following command:
1curl -g -k -X GET "https://$vcfFleetLifecycleFqdn/fleet-lcm/v1/tasks/${taskId}" \
2 --header "Authorization: Bearer ${vcfFleetLifecycleToken}" \
3 --header "Accept: application/json" \
4 --header "Content-Type: application/json" \
5 | jq
- The command in previous step will need to be run multiple times, you can run the command over and over by running the following command:
1while curl -s -k -X GET "https://$vcfFleetLifecycleFqdn/fleet-lcm/v1/tasks/${taskId}" \
2 --header "Authorization: Bearer ${vcfFleetLifecycleToken}" \
3 --header "Accept: application/json" \
4 --header "Content-Type: application/json" \
5 | jq '{status: .status}' \
6 | grep -q "RUNNING"; do
7 echo "Still in 'RUNNING' state... waiting 60 seconds."
8 sleep 60
9done
Perform Component Upgrades
Perform an Upgrade of All Components
- POST /fleet-lcm/v1/upgrade-plans/
?action=apply - GET /fleet-lcm/v1/tasks/
- You can perform the upgrade for all components at once by running the following command:
1taskId=$(curl -ks -X POST "https://$vcfFleetLifecycleFqdn/fleet-lcm/v1/upgrade-plans/${upgradePlanId}?action=apply" \
2 --header "Authorization: Bearer ${vcfFleetLifecycleToken}" \
3 --header "Accept: application/json" \
4 --header "Content-Type: application/json" \
5 | jq -r ".id")
- Check the status of the upgrade task by running the following command:
1curl -k -X GET "https://$vcfFleetLifecycleFqdn/fleet-lcm/v1/tasks/$taskId" \
2 --header "Authorization: Bearer ${vcfFleetLifecycleToken}" \
3 --header "Accept: application/json" \
4 --header "Content-Type: application/json" \
5 | jq
- The command in previous step will need to be run multiple times, you can run the command over and over by running the following command:
1while curl -s -k -X GET "https://$vcfFleetLifecycleFqdn/fleet-lcm/v1/tasks/${taskId}" \
2 --header "Authorization: Bearer ${vcfFleetLifecycleToken}" \
3 --header "Accept: application/json" \
4 --header "Content-Type: application/json" \
5 | jq '{status: .status}' \
6 | grep -q "RUNNING"; do
7 echo "Still in 'RUNNING' state... waiting 60 seconds."
8 sleep 60
9done
Perform Upgrade of a Single Component
- GET /fleet-lcm/v1/components
- POST /fleet-lcm/v1/upgrade-plans/
?action=apply - GET /fleet-lcm/v1/tasks/
- Obtain a list of components and their component IDs by running the following command:
1curl -ks -X GET "https://$vcfFleetLifecycleFqdn/fleet-lcm/v1/components" \
2 --header "Authorization: Bearer ${vcfFleetLifecycleToken}" \
3 --header "Accept: application/json" \
4 --header "Content-Type: application/json" \
5 | jq -r '["ID", "COMPONENT TYPE", "DESCRIPTION"], (.components[] | [.id, .componentType, .componentTypeDescription]) | @tsv' \
6 | column -t -s $'\t'
- Replace the values in the sample code with your value and paste the commands in the console.
1export componentId='ace00e3c-8c03-46a0-a043-2945426776ee'
- Perform the upgrade of a single component by running the following command:
1taskId=$(curl -ks -X POST "https://$vcfFleetLifecycleFqdn/fleet-lcm/v1/upgrade-plans/${upgradePlanId}?action=apply" \
2 --header "Authorization: Bearer ${vcfFleetLifecycleToken}" \
3 --header "Accept: application/json" \
4 --header "Content-Type: application/json" \
5 -d "{\"componentsFilter\": [{\"id\": \"${componentId}\"}]}" \
6 | jq -r ".id")
- Check the status of the upgrade task by running the following command:
1curl -k -X GET "https://$vcfFleetLifecycleFqdn/fleet-lcm/v1/tasks/$taskId" \
2 --header "Authorization: Bearer ${vcfFleetLifecycleToken}" \
3 --header "Accept: application/json" \
4 --header "Content-Type: application/json" \
5 | jq
- The command in previous step will need to be run multiple times, you can run the command over and over by running the following command:
1while curl -s -k -X GET "https://$vcfFleetLifecycleFqdn/fleet-lcm/v1/tasks/${taskId}" \
2 --header "Authorization: Bearer ${vcfFleetLifecycleToken}" \
3 --header "Accept: application/json" \
4 --header "Content-Type: application/json" \
5 | jq '{status: .status}' \
6 | grep -q "RUNNING"; do
7 echo "Still in 'RUNNING' state... waiting 60 seconds."
8 sleep 60
9done