From c27b687a11dceb0a15f2483e2f2a04b07fe41dd7 Mon Sep 17 00:00:00 2001 From: ChrsMark Date: Mon, 15 Jul 2024 13:30:10 +0300 Subject: [PATCH] Add k8s.volume.{name,type} attributes Signed-off-by: ChrsMark --- .chloggen/add_k8s_volume_type.yaml | 22 +++++++++++++ docs/attributes-registry/k8s.md | 16 ++++++++++ model/registry/k8s.yaml | 50 ++++++++++++++++++++++++++++++ model/resource/k8s.yaml | 9 ++++++ 4 files changed, 97 insertions(+) create mode 100755 .chloggen/add_k8s_volume_type.yaml diff --git a/.chloggen/add_k8s_volume_type.yaml b/.chloggen/add_k8s_volume_type.yaml new file mode 100755 index 0000000000..0e3c71bfeb --- /dev/null +++ b/.chloggen/add_k8s_volume_type.yaml @@ -0,0 +1,22 @@ +# Use this changelog template to create an entry for release notes. +# +# If your change doesn't affect end users you should instead start +# your pull request title with [chore] or use the "Skip Changelog" label. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the area of concern in the attributes-registry, (e.g. http, cloud, db) +component: k8s + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Adds k8s.volume.name and k8s.volume.type + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +# The values here must be integers. +issues: [1164] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: diff --git a/docs/attributes-registry/k8s.md b/docs/attributes-registry/k8s.md index 34d2e64c88..829c5bf0d0 100644 --- a/docs/attributes-registry/k8s.md +++ b/docs/attributes-registry/k8s.md @@ -39,6 +39,8 @@ Kubernetes resource attributes. | `k8s.replicaset.uid` | string | The UID of the ReplicaSet. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | `k8s.statefulset.name` | string | The name of the StatefulSet. | `opentelemetry` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | `k8s.statefulset.uid` | string | The UID of the StatefulSet. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `k8s.volume.name` | string | The name of the K8s volume. | `volume0` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `k8s.volume.type` | string | The type of the K8s volume. | `emptyDir`; `persistentVolumeClaim` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | **[1]:** K8s doesn't have support for obtaining a cluster ID. If this is ever added, we will recommend collecting the `k8s.cluster.uid` through the @@ -63,6 +65,20 @@ Which states: Therefore, UIDs between clusters should be extremely unlikely to conflict. +`k8s.volume.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used. + +| Value | Description | Stability | +| ----------------------- | ----------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | +| `awsElasticBlockStore` | An [awsElasticBlockStore](https://v1-29.docs.kubernetes.io/docs/concepts/storage/volumes/#awselasticblockstore) volume | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `configMap` | A [configMap](https://v1-29.docs.kubernetes.io/docs/concepts/storage/volumes/#configmap) volume | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `downwardAPI` | A [downwardAPI](https://v1-29.docs.kubernetes.io/docs/concepts/storage/volumes/#downwardapi) volume | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `emptyDir` | An [emptyDir](https://v1-29.docs.kubernetes.io/docs/concepts/storage/volumes/#emptydir) volume | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `gcePersistentDisk` | A [gcePersistentDisk](https://v1-29.docs.kubernetes.io/docs/concepts/storage/volumes/#gcepersistentdisk) volume | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `glusterfs` | A [glusterfs](https://v1-29.docs.kubernetes.io/docs/concepts/storage/volumes/#glusterfs) volume | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `local` | A [local](https://v1-29.docs.kubernetes.io/docs/concepts/storage/volumes/#local) volume | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `persistentVolumeClaim` | A [persistentVolumeClaim](https://v1-29.docs.kubernetes.io/docs/concepts/storage/volumes/#persistentvolumeclaim) volume | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `secret` | A [secret](https://v1-29.docs.kubernetes.io/docs/concepts/storage/volumes/#secret) volume | ![Experimental](https://img.shields.io/badge/-experimental-blue) | + ## Deprecated Kubernetes Attributes Describes deprecated k8s attributes. diff --git a/model/registry/k8s.yaml b/model/registry/k8s.yaml index 50f38b3132..e6fe47ccda 100644 --- a/model/registry/k8s.yaml +++ b/model/registry/k8s.yaml @@ -178,3 +178,53 @@ groups: brief: > The name of the CronJob. examples: ['opentelemetry'] + - id: volume.name + type: string + stability: experimental + brief: > + The name of the K8s volume. + examples: [ 'volume0' ] + - id: volume.type + stability: experimental + brief: > + The type of the K8s volume. + examples: [ "emptyDir", "persistentVolumeClaim" ] + type: + allow_custom_values: true + members: + - id: persistentvolumeclaim + value: 'persistentVolumeClaim' + brief: "A [persistentVolumeClaim](https://v1-29.docs.kubernetes.io/docs/concepts/storage/volumes/#persistentvolumeclaim) volume" + stability: experimental + - id: configmap + value: 'configMap' + brief: "A [configMap](https://v1-29.docs.kubernetes.io/docs/concepts/storage/volumes/#configmap) volume" + stability: experimental + - id: downwardapi + value: 'downwardAPI' + brief: "A [downwardAPI](https://v1-29.docs.kubernetes.io/docs/concepts/storage/volumes/#downwardapi) volume" + stability: experimental + - id: emptydir + value: 'emptyDir' + brief: "An [emptyDir](https://v1-29.docs.kubernetes.io/docs/concepts/storage/volumes/#emptydir) volume" + stability: experimental + - id: secret + value: 'secret' + brief: "A [secret](https://v1-29.docs.kubernetes.io/docs/concepts/storage/volumes/#secret) volume" + stability: experimental + - id: local + value: 'local' + brief: "A [local](https://v1-29.docs.kubernetes.io/docs/concepts/storage/volumes/#local) volume" + stability: experimental + - id: awselasticblockstore + value: 'awsElasticBlockStore' + brief: "An [awsElasticBlockStore](https://v1-29.docs.kubernetes.io/docs/concepts/storage/volumes/#awselasticblockstore) volume" + stability: experimental + - id: gcepersistentdisk + value: 'gcePersistentDisk' + brief: "A [gcePersistentDisk](https://v1-29.docs.kubernetes.io/docs/concepts/storage/volumes/#gcepersistentdisk) volume" + stability: experimental + - id: glusterfs + value: 'glusterfs' + brief: "A [glusterfs](https://v1-29.docs.kubernetes.io/docs/concepts/storage/volumes/#glusterfs) volume" + stability: experimental diff --git a/model/resource/k8s.yaml b/model/resource/k8s.yaml index d94425e007..e95003db76 100644 --- a/model/resource/k8s.yaml +++ b/model/resource/k8s.yaml @@ -100,3 +100,12 @@ groups: attributes: - ref: k8s.cronjob.uid - ref: k8s.cronjob.name + + - id: k8s.volume + prefix: k8s.volume + type: resource + brief: > + A Kubernetes Volume. + attributes: + - ref: k8s.volume.name + - ref: k8s.volume.type