Skip to content

Commit 7f8e5c1

Browse files
authored
Update k8s meta with additional namespace entity (#2167)
* update k8s meta with namespace links
1 parent c3f00a2 commit 7f8e5c1

10 files changed

+1168
-0
lines changed

Diff for: docs/cn/plugins/input/extended/service-kubernetesmeta-v2.md

+10
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@
4747
| Ingress2Service | string, 无默认值(可选) | Ingress到Service的关系名,不填则不生成关系。 |
4848
| Pod2PersistentVolumeClaim | string, 无默认值(可选) | Pod到PersistentVolumeClaim的关系名,不填则不生成关系。 |
4949
| Pod2Configmap | string, 无默认值(可选) | Pod到Configmap的关系名,不填则不生成关系。 |
50+
| Namespace2Pod | string, 无默认值(可选) | Namespace到Pod的关系名,不填则不生成关系。 |
51+
| Namespace2Service | string, 无默认值(可选) | Namespace到Service的关系名,不填则不生成关系。 |
52+
| Namespace2Deployment | string, 无默认值(可选) | Namespace到Deployment的关系名,不填则不生成关系。 |
53+
| Namespace2DaemonSet | string, 无默认值(可选) | Namespace到DaemonSet的关系名,不填则不生成关系。 |
54+
| Namespace2StatefulSet | string, 无默认值(可选) | Namespace到StatefulSet的关系名,不填则不生成关系。 |
55+
| Namespace2Configmap | string, 无默认值(可选) | Namespace到Configmap的关系名,不填则不生成关系。 |
56+
| Namespace2Job | string, 无默认值(可选) | Namespace到Job的关系名,不填则不生成关系。 |
57+
| Namespace2CronJob | string, 无默认值(可选) | Namespace到CronJob的关系名,不填则不生成关系。 |
58+
| Namespace2PersistentVolumeClaim | string, 无默认值(可选) | Namespace到PersistentVolumeClaim的关系名,不填则不生成关系。 |
59+
| Namespace2Ingress | string, 无默认值(可选) | Namespace到Ingress的关系名,不填则不生成关系。 |
5060

5161
## 环境变量
5262

Diff for: pkg/helper/k8smeta/k8s_meta_const.go

+64
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,20 @@ const (
4242
POD_CONTAINER = "pod->container"
4343
INGRESS_SERVICE = "ingress->service"
4444
//revive:enable:var-naming
45+
46+
// add namespace link
47+
//revive:disable:var-naming
48+
POD_NAMESPACE = "pod->namesapce"
49+
SERVICE_NAMESPACE = "service->namesapce"
50+
DEPLOYMENT_NAMESPACE = "deployment->namesapce"
51+
DAEMONSET_NAMESPACE = "daemonset->namesapce"
52+
STATEFULSET_NAMESPACE = "statefulset->namesapce"
53+
CONFIGMAP_NAMESPACE = "configmap->namesapce"
54+
JOB_NAMESPACE = "job->namesapce"
55+
CRONJOB_NAMESPACE = "cronjob->namesapce"
56+
PERSISTENTVOLUMECLAIM_NAMESPACE = "persistentvolumeclaim->namesapce"
57+
INGRESS_NAMESPACE = "ingress->namesapce"
58+
//revive:disable:var-naming
4559
)
4660

4761
var AllResources = []string{
@@ -127,6 +141,56 @@ type PodContainer struct {
127141
Container *v1.Container
128142
}
129143

144+
type PodNamespace struct {
145+
Pod *v1.Pod
146+
Namespace *v1.Namespace
147+
}
148+
149+
type ServiceNamespace struct {
150+
Service *v1.Service
151+
Namespace *v1.Namespace
152+
}
153+
154+
type DeploymentNamespace struct {
155+
Deployment *app.Deployment
156+
Namespace *v1.Namespace
157+
}
158+
159+
type DaemonSetNamespace struct {
160+
DaemonSet *app.DaemonSet
161+
Namespace *v1.Namespace
162+
}
163+
164+
type StatefulSetNamespace struct {
165+
StatefulSet *app.StatefulSet
166+
Namespace *v1.Namespace
167+
}
168+
169+
type ConfigMapNamespace struct {
170+
ConfigMap *v1.ConfigMap
171+
Namespace *v1.Namespace
172+
}
173+
174+
type JobNamespace struct {
175+
Job *batch.Job
176+
Namespace *v1.Namespace
177+
}
178+
179+
type CronJobNamespace struct {
180+
CronJob *batch.CronJob
181+
Namespace *v1.Namespace
182+
}
183+
184+
type PersistentVolumeClaimNamespace struct {
185+
PersistentVolumeClaim *v1.PersistentVolumeClaim
186+
Namespace *v1.Namespace
187+
}
188+
189+
type IngressNamespace struct {
190+
Ingress *networking.Ingress
191+
Namespace *v1.Namespace
192+
}
193+
130194
const (
131195
EventTypeAdd = "add"
132196
EventTypeUpdate = "update"

0 commit comments

Comments
 (0)