@@ -112,7 +112,7 @@ func DefaultEnv(cfg *config.Config) []corev1.EnvVar {
112
112
)
113
113
}
114
114
115
- func WorkspaceTracingEnv (context * RenderContext ) (res []corev1.EnvVar ) {
115
+ func WorkspaceTracingEnv (context * RenderContext , component string ) (res []corev1.EnvVar ) {
116
116
var tracing * experimental.Tracing
117
117
118
118
_ = context .WithExperimental (func (cfg * experimental.Config ) error {
@@ -122,10 +122,10 @@ func WorkspaceTracingEnv(context *RenderContext) (res []corev1.EnvVar) {
122
122
return nil
123
123
})
124
124
125
- return tracingEnv (context , tracing )
125
+ return tracingEnv (context , component , tracing )
126
126
}
127
127
128
- func WebappTracingEnv (context * RenderContext ) (res []corev1.EnvVar ) {
128
+ func WebappTracingEnv (context * RenderContext , component string ) (res []corev1.EnvVar ) {
129
129
var tracing * experimental.Tracing
130
130
131
131
_ = context .WithExperimental (func (cfg * experimental.Config ) error {
@@ -135,10 +135,10 @@ func WebappTracingEnv(context *RenderContext) (res []corev1.EnvVar) {
135
135
return nil
136
136
})
137
137
138
- return tracingEnv (context , tracing )
138
+ return tracingEnv (context , component , tracing )
139
139
}
140
140
141
- func tracingEnv (context * RenderContext , tracing * experimental.Tracing ) (res []corev1.EnvVar ) {
141
+ func tracingEnv (context * RenderContext , component string , tracing * experimental.Tracing ) (res []corev1.EnvVar ) {
142
142
if context .Config .Observability .Tracing == nil {
143
143
res = append (res , corev1.EnvVar {Name : "JAEGER_DISABLED" , Value : "true" })
144
144
return
@@ -154,6 +154,41 @@ func tracingEnv(context *RenderContext, tracing *experimental.Tracing) (res []co
154
154
// but would make env var composition more cumbersome.
155
155
}
156
156
157
+ if context .Config .Observability .Tracing .SecretName != nil {
158
+ res = append (res , corev1.EnvVar {
159
+ Name : "JAEGER_USER" ,
160
+ ValueFrom : & corev1.EnvVarSource {SecretKeyRef : & corev1.SecretKeySelector {
161
+ LocalObjectReference : corev1.LocalObjectReference {Name : * context .Config .Observability .Tracing .SecretName },
162
+ Key : "JAEGER_USER" ,
163
+ }},
164
+ })
165
+
166
+ res = append (res , corev1.EnvVar {
167
+ Name : "JAEGER_PASSWORD" ,
168
+ ValueFrom : & corev1.EnvVarSource {SecretKeyRef : & corev1.SecretKeySelector {
169
+ LocalObjectReference : corev1.LocalObjectReference {Name : * context .Config .Observability .Tracing .SecretName },
170
+ Key : "JAEGER_PASSWORD" ,
171
+ }},
172
+ })
173
+ }
174
+
175
+ res = append (res , corev1.EnvVar {Name : "JAEGER_SERVICE_NAME" , Value : component })
176
+
177
+ jaegerTags := []string {}
178
+ if context .Config .Metadata .InstallationShortname != "" {
179
+ jaegerTags = append (jaegerTags , fmt .Sprintf ("cluster=%v" , context .Config .Metadata .InstallationShortname ))
180
+ }
181
+
182
+ if context .Config .Metadata .Region != "" {
183
+ jaegerTags = append (jaegerTags , fmt .Sprintf ("region=%v" , context .Config .Metadata .Region ))
184
+ }
185
+
186
+ if len (jaegerTags ) > 0 {
187
+ res = append (res ,
188
+ corev1.EnvVar {Name : "JAEGER_TAGS" , Value : strings .Join (jaegerTags , "," )},
189
+ )
190
+ }
191
+
157
192
samplerType := experimental .TracingSampleTypeConst
158
193
samplerParam := "1"
159
194
0 commit comments