summaryrefslogtreecommitdiffstats
path: root/healthcheck-container/healthcheck.js
diff options
context:
space:
mode:
authorJack Lucas <jflucas@research.att.com>2018-12-12 16:48:41 -0500
committerJack Lucas <jflucas@research.att.com>2018-12-12 17:21:29 -0500
commite60d88b5821a75754b60fd3b004da08f221a3fc6 (patch)
tree7b3fa9a1591eea59533a631644e96e31c5ef5a04 /healthcheck-container/healthcheck.js
parent8ad4f6db9865a9a9fb9076c9ce9e07e91a1519ea (diff)
Add healthcheck for after-boot deployments
Update node to v 10.14.1 Remove dependency on 'request' package Issue-ID: DCAEGEN2-988 Change-Id: Icc68f8271d22b5ffbdac124e109c0273c05682c2 Signed-off-by: Jack Lucas <jflucas@research.att.com>
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});
})