summaryrefslogtreecommitdiffstats
path: root/healthcheck-container/healthcheck.js
diff options
context:
space:
mode:
authorMichael Hwang <mhwang@research.att.com>2018-12-13 15:23:29 +0000
committerGerrit Code Review <gerrit@onap.org>2018-12-13 15:23:29 +0000
commitf3f9d04cfd325ac427d7a6a6f1596bc2d5c40970 (patch)
tree785958497ff375eab9889739c74a73210d08ffa2 /healthcheck-container/healthcheck.js
parent7d47977b5c7961d129613ebc16a376c56fda5b01 (diff)
parente60d88b5821a75754b60fd3b004da08f221a3fc6 (diff)
Merge "Add healthcheck for after-boot deployments"
Diffstat (limited to 'healthcheck-container/healthcheck.js')
-rw-r--r--healthcheck-container/healthcheck.js33
1 files changed, 8 insertions, 25 deletions
diff --git a/healthcheck-container/healthcheck.js b/healthcheck-container/healthcheck.js
index 159de1f..a1c45e9 100644
--- a/healthcheck-container/healthcheck.js
+++ b/healthcheck-container/healthcheck.js
@@ -14,8 +14,7 @@ CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
*/
-//Expect ONAP and DCAE namespaces and Helm "release" name to be passed via environment variables
-//
+// Expect ONAP and DCAE namespaces and Helm "release" name to be passed via environment variables
const ONAP_NS = process.env.ONAP_NAMESPACE || 'default';
const DCAE_NS = process.env.DCAE_NAMESPACE || process.env.ONAP_NAMESPACE || 'default';
const HELM_REL = process.env.HELM_RELEASE || '';
@@ -30,21 +29,6 @@ const helmDeps =
'dcae-cloudify-manager'
];
-// List of deployments expected to be created via Cloudify Manager
-const dcaeDeps =
- [
- 'dep-config-binding-service',
- 'dep-deployment-handler',
- 'dep-inventory',
- 'dep-service-change-handler',
- 'dep-policy-handler',
- 'dep-dcae-ves-collector',
- 'dep-dcae-tca-analytics',
- 'dep-dcae-prh',
- 'dep-dcae-hv-ves-collector',
- 'dep-dcae-datafile-collector'
- ];
-
const status = require('./get-status');
const http = require('http');
@@ -53,12 +37,6 @@ const helmList = helmDeps.map(function(name) {
return {namespace: ONAP_NS, deployment: HELM_REL.length > 0 ? HELM_REL + '-' + name : name};
});
-// DCAE deployments via CM don't have a release prefix and are in the DCAE namespace,
-// which can be the same as the ONAP namespace
-const dcaeList = dcaeDeps.map(function(name) {
- return {namespace: DCAE_NS, deployment: name};
-});
-
const isHealthy = function(summary) {
// Current healthiness criterion is simple--all deployments are ready
return summary.count && summary.ready && summary.count === summary.ready;
@@ -70,8 +48,13 @@ const checkHealth = function (callback) {
// If we get responses from k8s but don't find all deployments ready, health status is UNHEALTHY (503)
// If we get responses from k8s and all deployments are ready, health status is HEALTHY (200)
// This could be a lot more nuanced, but what's here should be sufficient for R2 OOM healthchecking
-
- status.getStatusListPromise(helmList.concat(dcaeList))
+
+ // Query k8s to find all the deployments launched by CM (they all have a 'cfydeployment' label)
+ status.getDCAEDeploymentsPromise(DCAE_NS)
+ .then(function(dcaeList) {
+ // Now get status for Helm deployments and CM deployments
+ return status.getStatusListPromise(helmList.concat(dcaeList));
+ })
.then(function(body) {
callback({status: isHealthy(body) ? HEALTHY : UNHEALTHY, body: body});
})