tracing: new jaeger independent helm chart (#5275)

Fixes #5230

This PR moves tracing into a jaeger chart with no proxy injection
templates. We still keep the dependency on partials, as we could use
common templates like resources, etc from there.

Signed-off-by: Tarun Pothulapati tarunpothulapati@outlook.com
This commit is contained in:
Alex Leong 2020-11-24 09:45:16 -08:00 committed by GitHub
parent e78cb0d445
commit 0f20b0572e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 324 additions and 1 deletions

2
.gitignore vendored
View File

@ -14,5 +14,5 @@ web/app/yarn-error.log
vendor
**/*.gogen*
**/*.swp
charts/**/charts
**/charts/**/charts
package-lock.json

View File

@ -28,6 +28,8 @@ rootdir=$( cd "$bindir"/.. && pwd )
"$bindir"/helm dep up "$rootdir"/charts/patch
"$bindir"/helm lint --set global.identityTrustAnchorsPEM="fake-trust" --set identity.issuer.tls.crtPEM="fake-cert" --set identity.issuer.tls.keyPEM="fake-key" --set identity.issuer.crtExpiry="fake-expiry-date" "$rootdir"/charts/linkerd2
"$bindir"/helm lint "$rootdir"/charts/linkerd2-cni
"$bindir"/helm dep up "$rootdir"/jaeger/charts/jaeger
"$bindir"/helm lint "$rootdir"/jaeger/charts/jaeger
# `bin/helm-build package` assumes the presence of "$rootdir"/target/helm/index-pre.yaml which is downloaded in the chart_deploy CI job
if [ "$1" = package ]; then
@ -52,6 +54,7 @@ if [ "$1" = package ]; then
"$bindir"/helm --version "$version" --app-version "$tag" -d "$rootdir"/target/helm package "$rootdir"/charts/linkerd2-cni
"$bindir"/helm --version "$version" --app-version "$tag" -d "$rootdir"/target/helm package "$rootdir"/charts/linkerd2-multicluster
"$bindir"/helm --version "$version" --app-version "$tag" -d "$rootdir"/target/helm package "$rootdir"/charts/linkerd2-multicluster-link
"$bindir"/helm --version "$version" --app-version "$tag" -d "$rootdir"/target/helm package "$rootdir"/jaeger/charts/jaeger
mv "$rootdir"/target/helm/index-pre.yaml "$rootdir"/target/helm/index-pre-"$version".yaml
"$bindir"/helm repo index --url "https://helm.linkerd.io/$repo/" --merge "$rootdir"/target/helm/index-pre-"$version".yaml "$rootdir"/target/helm

View File

@ -0,0 +1,22 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

View File

@ -0,0 +1,9 @@
apiVersion: v1
appVersion: "1.0"
description: A Helm chart for the jaeger add-on in Linkerd
name: jaeger
version: 0.1.0
maintainers:
- name: Linkerd authors
email: cncf-linkerd-dev@lists.cncf.io
url: https://linkerd.io/

View File

@ -0,0 +1,6 @@
dependencies:
- name: partials
repository: file://../../../charts/partials
version: 0.1.0
digest: sha256:e2c1d0d581afb33df46411df7a89fca2628328fc7bd0975167e7812bf128e27f
generated: "2020-11-23T13:26:23.790962-08:00"

View File

@ -0,0 +1,4 @@
dependencies:
- name: partials
version: 0.1.0
repository: file://../../../charts/partials

View File

@ -0,0 +1,7 @@
---
kind: Namespace
apiVersion: v1
metadata:
name: {{.Values.namespace}}
annotations:
linkerd.io/inject: enabled

View File

@ -0,0 +1,20 @@
---
###
### collector RBAC
###
---
kind: ServiceAccount
apiVersion: v1
metadata:
name: collector
namespace: {{.Values.namespace}}
---
###
### jaeger RBAC
###
---
kind: ServiceAccount
apiVersion: v1
metadata:
name: jaeger
namespace: {{.Values.namespace}}

View File

@ -0,0 +1,178 @@
---
###
### Tracing Collector Service
###
---
apiVersion: v1
kind: ConfigMap
metadata:
name: collector-config
namespace: {{.Values.namespace}}
labels:
component: collector
data:
collector-config: |
receivers:
opencensus:
port: 55678
zipkin:
port: 9411
jaeger:
jaeger-thrift-http-port: 14268
queued-exporters:
jaeger-all-in-one:
num-workers: 4
queue-size: 100
retry-on-failure: true
sender-type: jaeger-thrift-http
jaeger-thrift-http:
collector-endpoint: {{printf "http://%s.%s:14268/api/traces" "jaeger" .Values.namespace }}
timeout: 5s
---
apiVersion: v1
kind: Service
metadata:
name: collector
namespace: {{.Values.namespace}}
labels:
component: collector
spec:
type: ClusterIP
ports:
- name: opencensus
port: 55678
protocol: TCP
targetPort: 55678
- name: zipkin
port: 9411
protocol: TCP
targetPort: 9411
- name: jaeger
port: 14268
protocol: TCP
targetPort: 14268
selector:
component: collector
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/name: collector
app.kubernetes.io/part-of: Linkerd
component: collector
name: collector
namespace: {{.Values.namespace}}
spec:
replicas: 1
selector:
matchLabels:
component: collector
minReadySeconds: 5
progressDeadlineSeconds: 120
template:
metadata:
annotations:
prometheus.io/path: /metrics
prometheus.io/port: "8888"
prometheus.io/scrape: "true"
labels:
component: collector
spec:
containers:
- command:
- /occollector_linux
- --config=/conf/collector-config.yaml
env:
- name: GOGC
value: "80"
image: {{.Values.collector.image.name}}:{{.Values.collector.image.version}}
imagePullPolicy: {{.Values.collector.image.pullPolicy}}
livenessProbe:
httpGet:
path: /
port: 13133
name: oc-collector
ports:
- containerPort: 55678
- containerPort: 9411
- containerPort: 14268
readinessProbe:
httpGet:
path: /
port: 13133
{{- if .Values.collector.resources -}}
{{- include "partials.resources" .Values.collector.resources | nindent 8 }}
{{- end }}
volumeMounts:
- mountPath: /conf
name: collector-config-val
serviceAccountName: collector
volumes:
- configMap:
items:
- key: collector-config
path: collector-config.yaml
name: collector-config
name: collector-config-val
---
###
### Tracing Jaeger Service
###
---
apiVersion: v1
kind: Service
metadata:
name: jaeger
namespace: {{.Values.namespace}}
labels:
component: jaeger
spec:
type: ClusterIP
selector:
component: jaeger
ports:
- name: collection
port: 14268
- name: ui
port: 16686
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/name: jaeger
app.kubernetes.io/part-of: Linkerd
component: jaeger
name: jaeger
namespace: {{.Values.namespace}}
spec:
replicas: 1
selector:
matchLabels:
component: jaeger
template:
metadata:
annotations:
prometheus.io/path: /metrics
prometheus.io/port: "8888"
prometheus.io/scrape: "true"
labels:
component: jaeger
spec:
containers:
- args:
- --query.base-path=/jaeger
image: {{.Values.jaeger.image.name}}:{{.Values.jaeger.image.version}}
imagePullPolicy: {{.Values.jaeger.image.pullPolicy}}
name: jaeger
ports:
- containerPort: 14268
name: collection
- containerPort: 16686
name: ui
{{- if .Values.jaeger.resources -}}
{{- include "partials.resources" .Values.jaeger.resources | nindent 8 }}
{{- end }}
dnsPolicy: ClusterFirst
serviceAccountName: jaeger

View File

@ -0,0 +1,15 @@
# Default values for tracing.
namespace: linkerd-jaeger
collector:
image:
name: omnition/opencensus-collector
version: 0.1.11
pullPolicy: Always
# resources:
jaeger:
image:
name: jaegertracing/all-in-one
version: 1.19.2
pullPolicy: Always

59
jaeger/values/values.go Normal file
View File

@ -0,0 +1,59 @@
package values
import (
"fmt"
"github.com/linkerd/linkerd2/pkg/charts"
l5dcharts "github.com/linkerd/linkerd2/pkg/charts/linkerd2"
"helm.sh/helm/v3/pkg/chart/loader"
"helm.sh/helm/v3/pkg/chartutil"
"sigs.k8s.io/yaml"
)
// Values represents the values of jaeger template
type Values struct {
Namespace string `json:"namespace"`
Collector collector `json:"collector"`
Jaeger jaeger `json:"jaeger"`
}
type collector struct {
Resources l5dcharts.Resources `json:"resources"`
Image l5dcharts.Image `json:"image"`
}
type jaeger struct {
Resources l5dcharts.Resources `json:"resources"`
Image l5dcharts.Image `json:"image"`
}
// NewValues returns a new instance of the Values type.
// TODO: Add HA logic
func NewValues() (*Values, error) {
chartDir := fmt.Sprintf("%s/", "jaeger")
v, err := readDefaults(chartDir)
if err != nil {
return nil, err
}
return v, nil
}
// readDefaults read all the default variables from the values.yaml file.
// chartDir is the root directory of the Helm chart where values.yaml is.
func readDefaults(chartDir string) (*Values, error) {
valuesFile := &loader.BufferedFile{
Name: chartutil.ValuesfileName,
}
if err := charts.ReadFile(chartDir, valuesFile); err != nil {
return nil, err
}
var values Values
if err := yaml.Unmarshal(valuesFile.Data, &values); err != nil {
return nil, err
}
return &values, nil
}