-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(linkrule): add per-rule dedup ID
- Loading branch information
Showing
18 changed files
with
251 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
apiVersion: kelemetry.kubewharf.io/v1alpha1 | ||
kind: LinkRule | ||
metadata: | ||
name: pod-secret | ||
sourceFilter: | ||
resources: | ||
- group: "" | ||
resource: pods | ||
targetTemplate: | ||
group: "" | ||
version: v1 | ||
resource: secrets | ||
namespaceTemplate: "{{.metadata.namespace}}" | ||
nameTemplate: | | ||
{{- range .spec.volumes -}} | ||
{{- if .secret -}} | ||
{{- .secret.secretName -}}, | ||
{{- end -}} | ||
{{- end -}} | ||
link: | ||
targetRole: Child | ||
class: volumes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env bash | ||
|
||
kubectl create -f ${REPO_PATH}/crds/samples/pod-secret.yaml | ||
|
||
kubectl create secret generic content | ||
|
||
kubectl create -f - << EOF | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: reader | ||
labels: | ||
app: reader | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: reader | ||
replicas: 2 | ||
template: | ||
metadata: | ||
labels: | ||
app: reader | ||
spec: | ||
containers: | ||
- name: reader | ||
command: ["sleep", "infinity"] | ||
image: alpine:3.16 | ||
volumeMounts: | ||
- name: content | ||
mountPath: /mnt/content | ||
volumes: | ||
- name: content | ||
secret: | ||
secretName: content | ||
EOF | ||
sleep 10 | ||
|
||
kubectl delete deployment/reader secret/content | ||
sleep 20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
local TRACE_DISPLAY_NAME="Volume links" | ||
local TEST_DISPLAY_MODE="24100000" | ||
|
||
declare -A TRACE_SEARCH_TAGS | ||
TRACE_SEARCH_TAGS[cluster]=tracetest | ||
TRACE_SEARCH_TAGS[group]=apps | ||
TRACE_SEARCH_TAGS[resource]=deployments | ||
TRACE_SEARCH_TAGS[namespace]=default | ||
TRACE_SEARCH_TAGS[name]=reader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
include "assert"; | ||
include "graph"; | ||
|
||
.data[0] | ||
| ._ = ( | ||
# check tags | ||
.spans | ||
| root | ||
| .tags | from_entries | ||
| assertEq("root span is deployment"; .resource; "deployments") | ||
| assertEq("root span has the correct name"; .name; "reader") | ||
) | ._ = ( | ||
# check that secret is linked | ||
.spans | ||
| map(select(.tags | from_entries | .resource == "secrets" and .name == "content")) | ||
| assertEq("has content"; length; 1) | ||
) | null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.