Skip to content

Commit

Permalink
expose OTLP collector and allInOne ports
Browse files Browse the repository at this point in the history
Signed-off-by: Ruben Vargas <[email protected]>
  • Loading branch information
rubenvp8510 committed Jun 16, 2022
1 parent a1fa30b commit 0556041
Show file tree
Hide file tree
Showing 12 changed files with 260 additions and 163 deletions.
138 changes: 71 additions & 67 deletions pkg/deployment/all_in_one.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (a *AllInOne) Get() *appsv1.Deployment {
commonSpec.Annotations["sidecar.istio.io/inject"] = "false"
}

options := allArgs(a.jaeger.Spec.AllInOne.Options,
options := util.AllArgs(a.jaeger.Spec.AllInOne.Options,
a.jaeger.Spec.Storage.Options.Filter(a.jaeger.Spec.Storage.Type.OptionsPrefix()))

configmap.Update(a.jaeger, commonSpec, &options)
Expand Down Expand Up @@ -113,6 +113,71 @@ func (a *AllInOne) Get() *appsv1.Deployment {
strategy = *a.jaeger.Spec.AllInOne.Strategy
}

envVars := []corev1.EnvVar{
{
Name: "SPAN_STORAGE_TYPE",
Value: string(a.jaeger.Spec.Storage.Type),
},
{
Name: "METRICS_STORAGE_TYPE",
Value: string(a.jaeger.Spec.AllInOne.MetricsStorage.Type),
},
{
Name: "COLLECTOR_ZIPKIN_HOST_PORT",
Value: ":9411",
},
{
Name: "JAEGER_DISABLED",
Value: strconv.FormatBool(jaegerDisabled),
},
}

ports := []corev1.ContainerPort{
{
ContainerPort: 5775,
Name: "zk-compact-trft", // max 15 chars!
Protocol: corev1.ProtocolUDP,
},
{
ContainerPort: 5778,
Name: "config-rest",
},
{
ContainerPort: 6831,
Name: "jg-compact-trft",
Protocol: corev1.ProtocolUDP,
},
{
ContainerPort: 6832,
Name: "jg-binary-trft",
Protocol: corev1.ProtocolUDP,
},
{
ContainerPort: 9411,
Name: "zipkin",
},
{
ContainerPort: 14267,
Name: "c-tchan-trft", // for collector
},
{
ContainerPort: 14268,
Name: "c-binary-trft",
},
{
ContainerPort: 16686,
Name: "query",
},
{
ContainerPort: adminPort,
Name: "admin-http",
},
{
ContainerPort: 14250,
Name: "grpc",
},
}

return &appsv1.Deployment{
TypeMeta: metav1.TypeMeta{
APIVersion: "apps/v1",
Expand Down Expand Up @@ -144,74 +209,13 @@ func (a *AllInOne) Get() *appsv1.Deployment {
Spec: corev1.PodSpec{
ImagePullSecrets: commonSpec.ImagePullSecrets,
Containers: []corev1.Container{{
Image: util.ImageName(a.jaeger.Spec.AllInOne.Image, "jaeger-all-in-one-image"),
Name: "jaeger",
Args: options,
Env: []corev1.EnvVar{
{
Name: "SPAN_STORAGE_TYPE",
Value: string(a.jaeger.Spec.Storage.Type),
},
{
Name: "METRICS_STORAGE_TYPE",
Value: string(a.jaeger.Spec.AllInOne.MetricsStorage.Type),
},
{
Name: "COLLECTOR_ZIPKIN_HOST_PORT",
Value: ":9411",
},
{
Name: "JAEGER_DISABLED",
Value: strconv.FormatBool(jaegerDisabled),
},
},
Image: util.ImageName(a.jaeger.Spec.AllInOne.Image, "jaeger-all-in-one-image"),
Name: "jaeger",
Args: options,
Env: append(envVars, getOTLPEnvVars(options)...),
VolumeMounts: commonSpec.VolumeMounts,
EnvFrom: envFromSource,
Ports: []corev1.ContainerPort{
{
ContainerPort: 5775,
Name: "zk-compact-trft", // max 15 chars!
Protocol: corev1.ProtocolUDP,
},
{
ContainerPort: 5778,
Name: "config-rest",
},
{
ContainerPort: 6831,
Name: "jg-compact-trft",
Protocol: corev1.ProtocolUDP,
},
{
ContainerPort: 6832,
Name: "jg-binary-trft",
Protocol: corev1.ProtocolUDP,
},
{
ContainerPort: 9411,
Name: "zipkin",
},
{
ContainerPort: 14267,
Name: "c-tchan-trft", // for collector
},
{
ContainerPort: 14268,
Name: "c-binary-trft",
},
{
ContainerPort: 16686,
Name: "query",
},
{
ContainerPort: adminPort,
Name: "admin-http",
},
{
ContainerPort: 14250,
Name: "grpc",
},
},
Ports: append(ports, getOTLPContainePorts(options)...),
LivenessProbe: &corev1.Probe{
ProbeHandler: corev1.ProbeHandler{
HTTPGet: &corev1.HTTPGetAction{
Expand Down
4 changes: 4 additions & 0 deletions pkg/deployment/all_in_one_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ func TestDefaultAllInOneImage(t *testing.T) {
Name: "JAEGER_DISABLED",
Value: "false",
},
{
Name: "COLLECTOR_OTLP_ENABLED",
Value: "true",
},
}
assert.Equal(t, envvars, d.Spec.Template.Spec.Containers[0].Env)
}
Expand Down
13 changes: 0 additions & 13 deletions pkg/deployment/args.go

This file was deleted.

26 changes: 0 additions & 26 deletions pkg/deployment/args_test.go

This file was deleted.

76 changes: 40 additions & 36 deletions pkg/deployment/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (c *Collector) Get() *appsv1.Deployment {
})
}
}
options := allArgs(c.jaeger.Spec.Collector.Options,
options := util.AllArgs(c.jaeger.Spec.Collector.Options,
c.jaeger.Spec.Storage.Options.Filter(storageType.OptionsPrefix()))

sampling.Update(c.jaeger, commonSpec, &options)
Expand All @@ -111,6 +111,40 @@ func (c *Collector) Get() *appsv1.Deployment {
strategy = *c.jaeger.Spec.Collector.Strategy
}

envVars := []corev1.EnvVar{
{
Name: "SPAN_STORAGE_TYPE",
Value: string(storageType),
},
{
Name: "COLLECTOR_ZIPKIN_HOST_PORT",
Value: ":9411",
},
}

ports := []corev1.ContainerPort{
{
ContainerPort: 9411,
Name: "zipkin",
},
{
ContainerPort: 14267,
Name: "c-tchan-trft", // for collector
},
{
ContainerPort: 14268,
Name: "c-binary-trft",
},
{
ContainerPort: adminPort,
Name: "admin-http",
},
{
ContainerPort: 14250,
Name: "grpc",
},
}

return &appsv1.Deployment{
TypeMeta: metav1.TypeMeta{
APIVersion: "apps/v1",
Expand Down Expand Up @@ -143,43 +177,13 @@ func (c *Collector) Get() *appsv1.Deployment {
Spec: corev1.PodSpec{
ImagePullSecrets: c.jaeger.Spec.ImagePullSecrets,
Containers: []corev1.Container{{
Image: util.ImageName(c.jaeger.Spec.Collector.Image, "jaeger-collector-image"),
Name: "jaeger-collector",
Args: options,
Env: []corev1.EnvVar{
{
Name: "SPAN_STORAGE_TYPE",
Value: string(storageType),
},
{
Name: "COLLECTOR_ZIPKIN_HOST_PORT",
Value: ":9411",
},
},
Image: util.ImageName(c.jaeger.Spec.Collector.Image, "jaeger-collector-image"),
Name: "jaeger-collector",
Args: options,
Env: append(envVars, getOTLPEnvVars(options)...),
VolumeMounts: commonSpec.VolumeMounts,
EnvFrom: envFromSource,
Ports: []corev1.ContainerPort{
{
ContainerPort: 9411,
Name: "zipkin",
},
{
ContainerPort: 14267,
Name: "c-tchan-trft", // for collector
},
{
ContainerPort: 14268,
Name: "c-binary-trft",
},
{
ContainerPort: adminPort,
Name: "admin-http",
},
{
ContainerPort: 14250,
Name: "grpc",
},
},
Ports: append(ports, getOTLPContainePorts(options)...),
LivenessProbe: &corev1.Probe{
ProbeHandler: corev1.ProbeHandler{
HTTPGet: &corev1.HTTPGetAction{
Expand Down
16 changes: 16 additions & 0 deletions pkg/deployment/collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ func TestDefaultCollectorImage(t *testing.T) {
Name: "COLLECTOR_ZIPKIN_HOST_PORT",
Value: ":9411",
},
{
Name: "COLLECTOR_OTLP_ENABLED",
Value: "true",
},
}
assert.Equal(t, envvars, containers[0].Env)
}
Expand Down Expand Up @@ -379,6 +383,10 @@ func TestCollectorWithDirectStorageType(t *testing.T) {
Name: "COLLECTOR_ZIPKIN_HOST_PORT",
Value: ":9411",
},
{
Name: "COLLECTOR_OTLP_ENABLED",
Value: "true",
},
}
assert.Equal(t, envvars, dep.Spec.Template.Spec.Containers[0].Env)
assert.Len(t, dep.Spec.Template.Spec.Containers[0].Args, 2)
Expand Down Expand Up @@ -418,6 +426,10 @@ func TestCollectorWithKafkaStorageType(t *testing.T) {
Name: "COLLECTOR_ZIPKIN_HOST_PORT",
Value: ":9411",
},
{
Name: "COLLECTOR_OTLP_ENABLED",
Value: "true",
},
}
assert.Equal(t, envvars, dep.Spec.Template.Spec.Containers[0].Env)
assert.Len(t, dep.Spec.Template.Spec.Containers[0].Args, 3)
Expand Down Expand Up @@ -453,6 +465,10 @@ func TestCollectorWithIngesterNoOptionsStorageType(t *testing.T) {
Name: "COLLECTOR_ZIPKIN_HOST_PORT",
Value: ":9411",
},
{
Name: "COLLECTOR_OTLP_ENABLED",
Value: "true",
},
}
assert.Equal(t, envvars, dep.Spec.Template.Spec.Containers[0].Env)
assert.Len(t, dep.Spec.Template.Spec.Containers[0].Args, 2)
Expand Down
2 changes: 1 addition & 1 deletion pkg/deployment/ingester.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (i *Ingester) Get() *appsv1.Deployment {
})
}

options := allArgs(i.jaeger.Spec.Ingester.Options,
options := util.AllArgs(i.jaeger.Spec.Ingester.Options,
i.jaeger.Spec.Storage.Options.Filter(i.jaeger.Spec.Storage.Type.OptionsPrefix()))

ca.Update(i.jaeger, commonSpec)
Expand Down
Loading

0 comments on commit 0556041

Please sign in to comment.