Skip to content

Commit 7e1e3dd

Browse files
committed
Report top-level owners for pods
For each pod, report the top-level owner resources for those pods, that is, the transitive owners which are not owned by any other resources. Note that a pod may have more than one owner, and therefore it can also have more than one top-level owner. Update the `kube` crate to version 1.1.0 and the `k8s-openapi` crate to version `0.25.0`. Use the "earliest" feature instead of "latest" to support most API server versions, though there is no significant difference in support regardless. Update the Rust version to 1.82.0 to be able to use a recent version of the `kube` crate. Implement a cache for ownership resolution and API discovery. The discovery results are kept between runs, but can be refreshed if resources from new APIs are referenced. The ownership cache is reset during each run, as the ownership relationships can change at any time. Improve trace logging. Do not `panic!` when AppSignal or Kubernetes are unreachable. Update the deployment YAML to provide read-only permissions to all API groups and resources -- this is necessary due to the owner traversal logic needing to be able to retrieve arbitrary resources. Update the deployment YAML for Helm as well, and fix the version updating script to update the version number on it as well.
1 parent f469c3d commit 7e1e3dd

9 files changed

Lines changed: 1299 additions & 343 deletions

File tree

Cargo.lock

Lines changed: 469 additions & 201 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ edition = "2021"
88
[dependencies]
99
tokio = { version = "1", default-features = false, features = ["macros", "rt-multi-thread", "time"] }
1010
serde_json = "1.0"
11-
kube = { version = "0.89", features = ["runtime", "derive"] }
12-
k8s-openapi = { version = "0.21", features = ["latest"] }
11+
kube = { version = "1.1.0", features = ["runtime", "derive"] }
12+
k8s-openapi = { version = "0.25", features = ["earliest"] }
1313
http = "1.0"
1414
serde = "*"
1515
protobuf = "=2.24.1"

charts/appsignal-kubernetes/templates/deployment.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ spec:
1515
serviceAccountName: appsignal-kubernetes-service-account
1616
containers:
1717
- name: appsignal-kubernetes
18-
image: appsignal/appsignal-kubernetes:1.0.0
18+
image: appsignal/appsignal-kubernetes:1.1.2
1919
imagePullPolicy: IfNotPresent
2020
env:
2121
- name: APPSIGNAL_API_KEY
2222
valueFrom:
2323
secretKeyRef:
2424
name: appsignal
2525
key: api-key
26+
- name: RUST_LOG
27+
value: info
2628
---
2729
apiVersion: v1
2830
kind: ServiceAccount
@@ -34,10 +36,8 @@ kind: ClusterRole
3436
metadata:
3537
name: appsignal-kubernetes-role
3638
rules:
37-
- apiGroups: [""]
38-
resources:
39-
- nodes
40-
- "nodes/proxy"
39+
- apiGroups: ["*"]
40+
resources: ["*"]
4141
verbs:
4242
- get
4343
- list

deployment.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,8 @@ kind: ClusterRole
3636
metadata:
3737
name: appsignal-kubernetes-role
3838
rules:
39-
- apiGroups: [""]
40-
resources:
41-
- nodes
42-
- "nodes/proxy"
43-
- pods
39+
- apiGroups: ["*"]
40+
resources: ["*"]
4441
verbs:
4542
- get
4643
- list

0 commit comments

Comments
 (0)