From 6a3935e5f4f42251979a403b8e9bbe61ed67214a Mon Sep 17 00:00:00 2001 From: Tobias Johansson Date: Wed, 11 Apr 2018 12:30:01 +0200 Subject: [PATCH] Add support for k8s StatefulSet Currently collector doesn't recognize k8s StatefulSet. Change-Id: If111279dc204704ac5e73d9f880eb4ecdd925297 Story: 2001757 Task: 12155 (cherry picked from commit 52643b7a7cae0f0017e6267dd155f46c215a8d02) --- docs/Plugins.md | 1 + monasca_agent/collector/checks/utils.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/docs/Plugins.md b/docs/Plugins.md index 2feb6f6a..f8e54a8a 100644 --- a/docs/Plugins.md +++ b/docs/Plugins.md @@ -1769,6 +1769,7 @@ There is also additional Kubernetes dimensions for the Container and Pod metrics | ReplicationController | replication_controller | | ReplicaSet | replica_set | | DaemonSet | daemon_set | +| StatefulSet | stateful_set | | Deployment| deployment | Only will be set if derive_host is set to true as it needs to connect to the API to see if the ReplicaSet is under a deployment | Job | job | diff --git a/monasca_agent/collector/checks/utils.py b/monasca_agent/collector/checks/utils.py index 25aea681..ea55cb29 100644 --- a/monasca_agent/collector/checks/utils.py +++ b/monasca_agent/collector/checks/utils.py @@ -1,5 +1,6 @@ # (C) Copyright 2015,2017-2018 Hewlett Packard Enterprise Development LP # (C) Copyright 2017 KylinCloud +# Copyright 2018 OP5 AB import base64 import json @@ -815,6 +816,8 @@ def _get_pod_owner_pair(kubernetes_connector, pod_owner_type, pod_owner_name, po return 'deployment', deployment_name elif pod_owner_type == "DaemonSet": return 'daemon_set', pod_owner_name + elif pod_owner_type == "StatefulSet": + return 'stateful_set', pod_owner_name elif pod_owner_type == "Job": if not kubernetes_connector: log.info("Can not set cronjob name as connection information to API is not set. "