@@ -112,7 +112,7 @@ func DefaultEnv(cfg *config.Config) []corev1.EnvVar {
112112 )
113113}
114114
115- func WorkspaceTracingEnv (context * RenderContext ) (res []corev1.EnvVar ) {
115+ func WorkspaceTracingEnv (context * RenderContext , component string ) (res []corev1.EnvVar ) {
116116 var tracing * experimental.Tracing
117117
118118 _ = context .WithExperimental (func (cfg * experimental.Config ) error {
@@ -122,10 +122,10 @@ func WorkspaceTracingEnv(context *RenderContext) (res []corev1.EnvVar) {
122122 return nil
123123 })
124124
125- return tracingEnv (context , tracing )
125+ return tracingEnv (context , component , tracing )
126126}
127127
128- func WebappTracingEnv (context * RenderContext ) (res []corev1.EnvVar ) {
128+ func WebappTracingEnv (context * RenderContext , component string ) (res []corev1.EnvVar ) {
129129 var tracing * experimental.Tracing
130130
131131 _ = context .WithExperimental (func (cfg * experimental.Config ) error {
@@ -135,10 +135,10 @@ func WebappTracingEnv(context *RenderContext) (res []corev1.EnvVar) {
135135 return nil
136136 })
137137
138- return tracingEnv (context , tracing )
138+ return tracingEnv (context , component , tracing )
139139}
140140
141- func tracingEnv (context * RenderContext , tracing * experimental.Tracing ) (res []corev1.EnvVar ) {
141+ func tracingEnv (context * RenderContext , component string , tracing * experimental.Tracing ) (res []corev1.EnvVar ) {
142142 if context .Config .Observability .Tracing == nil {
143143 res = append (res , corev1.EnvVar {Name : "JAEGER_DISABLED" , Value : "true" })
144144 return
@@ -154,6 +154,41 @@ func tracingEnv(context *RenderContext, tracing *experimental.Tracing) (res []co
154154 // but would make env var composition more cumbersome.
155155 }
156156
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+
157192 samplerType := experimental .TracingSampleTypeConst
158193 samplerParam := "1"
159194
0 commit comments