-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tracing enabled annotation (#5643)
This change adds the `jaeger.linkerd.io/tracing-enabled` annotation which is automatically added by the Jaeger extension's `jaeger-injector`. All pods that receive this annotation have also had the required environment variables and volume/volume mounts add by the injector. The purpose of this annotation is that it will allow `jaeger check` to check for the presence of this annotation instead of needing to look at the proxy containers directly. If this annotation is not present on pods, `jaeger check` can warn users that tracing is not configured for those pods. This is similar to `viz check` warning users that tap is not configured—recenlty added in #5602. Closes #5632 Signed-off-by: Kevin Leimkuhler <kevin@kleimkuhler.com>
- Loading branch information
1 parent
b521091
commit 228d8e9
Showing
5 changed files
with
41 additions
and
38 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,29 @@ | ||
package pkg | ||
|
||
import ( | ||
"strconv" | ||
|
||
corev1 "k8s.io/api/core/v1" | ||
) | ||
|
||
const ( | ||
// JaegerAnnotationsPrefix is the prefix of all jaeger-related annotations | ||
JaegerAnnotationsPrefix = "jaeger.linkerd.io" | ||
|
||
// JaegerTracingEnabled is set by the jaeger-injector component when | ||
// tracing has been enabled on a pod. | ||
JaegerTracingEnabled = JaegerAnnotationsPrefix + "/tracing-enabled" | ||
) | ||
|
||
// IsTracingEnabled returns true if a pod has an annotation indicating that | ||
// tracing is enabled. | ||
func IsTracingEnabled(pod *corev1.Pod) bool { | ||
valStr := pod.GetAnnotations()[JaegerTracingEnabled] | ||
if valStr != "" { | ||
valBool, err := strconv.ParseBool(valStr) | ||
if err == nil && valBool { | ||
return true | ||
} | ||
} | ||
return false | ||
} |