Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Linkerd Add-Ons Model #3946

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile-proxy
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN (proxy=$(bin/fetch-proxy $(cat proxy-version)) && \
mv "$proxy" linkerd2-proxy)

## compile proxy-identity agent
FROM gcr.io/linkerd-io/go-deps:f6fda337 as golang
FROM gcr.io/linkerd-io/go-deps:bfb89c7f as golang
WORKDIR /linkerd-build
COPY pkg/flags pkg/flags
COPY pkg/tls pkg/tls
Expand Down
22 changes: 22 additions & 0 deletions charts/linkerd2/add-ons/grafana/.helmignore
Original file line number Diff line number Diff line change
@@ -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/
5 changes: 5 additions & 0 deletions charts/linkerd2/add-ons/grafana/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
appVersion: "1.0"
description: A Helm chart for Kubernetes
name: grafana
version: 0.1.0
Binary file not shown.
6 changes: 6 additions & 0 deletions charts/linkerd2/add-ons/grafana/requirements.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: partials
repository: file://../../../partials
version: 0.1.0
digest: sha256:5eedd268cf82aa72641060432d2edfd9b350a27e022d243e9b71ac34e1cd6f8d
generated: "2019-12-26T12:38:35.839386551+05:30"
4 changes: 4 additions & 0 deletions charts/linkerd2/add-ons/grafana/requirements.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dependencies:
- name: partials
version: 0.1.0
repository: file://../../../partials
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ spec:
---
{{ $_ := set .Values.global.proxy "workloadKind" "deployment" -}}
{{ $_ := set .Values.global.proxy "component" "linkerd-grafana" -}}
{{ include "linkerd.proxy.validation" .Values.global.proxy -}}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -115,12 +114,11 @@ spec:
{{.Values.global.controllerNamespaceLabel}}: {{.Values.global.namespace}}
{{- include "partials.proxy.labels" .Values.global.proxy | nindent 8}}
spec:
{{- include "linkerd.node-selector" . | nindent 6 }}
containers:
- env:
- name: GF_PATHS_DATA
value: /data
image: {{.Values.grafanaImage}}:{{default .Values.global.linkerdVersion .Values.controllerImageVersion}}
image: {{.Values.image}}:{{default .Values.global.linkerdVersion .Values.controllerImageVersion}}
imagePullPolicy: {{.Values.global.imagePullPolicy}}
livenessProbe:
httpGet:
Expand All @@ -135,8 +133,8 @@ spec:
httpGet:
path: /api/health
port: 3000
{{- if .Values.grafanaResources -}}
{{- include "partials.resources" .Values.grafanaResources | nindent 8 }}
{{- if .Values.resources -}}
{{- include "partials.resources" .Values.resources | nindent 8 }}
{{- end }}
securityContext:
runAsUser: 472
Expand All @@ -147,7 +145,7 @@ spec:
name: grafana-config
readOnly: true
- {{- include "partials.proxy" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ if not .Values.noInitContainer -}}
{{ if not .Values.global.noInitContainer -}}
initContainers:
- {{- include "partials.proxy-init" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end -}}
Expand Down
3 changes: 3 additions & 0 deletions charts/linkerd2/add-ons/grafana/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Config for grafana add-on
enabled: true
image: gcr.io/linkerd-io/grafana
22 changes: 22 additions & 0 deletions charts/linkerd2/add-ons/prometheus/.helmignore
Original file line number Diff line number Diff line change
@@ -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/
5 changes: 5 additions & 0 deletions charts/linkerd2/add-ons/prometheus/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
appVersion: "1.0"
description: A Helm chart for Kubernetes
name: prometheus
version: 0.1.0
Binary file not shown.
6 changes: 6 additions & 0 deletions charts/linkerd2/add-ons/prometheus/requirements.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: partials
repository: file://../../../partials
version: 0.1.0
digest: sha256:5eedd268cf82aa72641060432d2edfd9b350a27e022d243e9b71ac34e1cd6f8d
generated: "2020-01-02T21:27:59.919462049+05:30"
4 changes: 4 additions & 0 deletions charts/linkerd2/add-ons/prometheus/requirements.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dependencies:
- name: partials
version: 0.1.0
repository: file://../../../partials
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ spec:
{{ end -}}
{{ $_ := set .Values.global.proxy "workloadKind" "deployment" -}}
{{ $_ := set .Values.global.proxy "component" "linkerd-prometheus" -}}
{{ include "linkerd.proxy.validation" .Values.global.proxy -}}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -174,14 +173,13 @@ spec:
{{.Values.global.controllerNamespaceLabel}}: {{.Values.global.namespace}}
{{- include "partials.proxy.labels" .Values.global.proxy | nindent 8}}
spec:
{{- include "linkerd.node-selector" . | nindent 6 }}
containers:
- args:
- --storage.tsdb.path=/data
- --storage.tsdb.retention.time=6h
- --config.file=/etc/prometheus/prometheus.yml
- --log.level={{lower .Values.prometheusLogLevel}}
image: {{.Values.prometheusImage}}
- --log.level={{lower .Values.logLevel}}
image: {{.Values.image}}
imagePullPolicy: {{.Values.global.imagePullPolicy}}
livenessProbe:
httpGet:
Expand All @@ -199,8 +197,8 @@ spec:
port: 9090
initialDelaySeconds: 30
timeoutSeconds: 30
{{- if .Values.prometheusResources -}}
{{- include "partials.resources" .Values.prometheusResources | nindent 8 }}
{{- if .Values.resources -}}
{{- include "partials.resources" .Values.resources | nindent 8 }}
{{- end }}
securityContext:
runAsUser: 65534
Expand All @@ -211,7 +209,7 @@ spec:
name: prometheus-config
readOnly: true
- {{- include "partials.proxy" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ if not .Values.noInitContainer -}}
{{ if not .Values.global.noInitContainer -}}
initContainers:
- {{- include "partials.proxy-init" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end -}}
Expand Down
4 changes: 4 additions & 0 deletions charts/linkerd2/add-ons/prometheus/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Config for add-ons
enabled: true
image: prometheus/prom:v1.15.0
logLevel: info
10 changes: 8 additions & 2 deletions charts/linkerd2/requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,11 @@ dependencies:
- name: partials
repository: file://../partials
version: 0.1.0
digest: sha256:3a86b96a2966f03ba04518723838b49719a3277dfb9bea0b3f067e83d370e0b3
generated: 2019-07-24T19:51:15.04322926-07:00
- name: grafana
repository: file://../linkerd2/add-ons/grafana
version: 0.1.0
- name: prometheus
repository: file://../linkerd2/add-ons/prometheus
version: 0.1.0
digest: sha256:92e328557dbf69c48fa71be1f68d98c2a5702c64e01553048b6062a15df66ebe
generated: "2020-01-06T22:34:19.253434901+05:30"
8 changes: 8 additions & 0 deletions charts/linkerd2/requirements.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,11 @@ dependencies:
- name: partials
version: 0.1.0
repository: file://../partials
- name: grafana
version: 0.1.0
repository: file://../linkerd2/add-ons/grafana
condition: grafana.enabled
- name: prometheus
version: 0.1.0
repository: file://../linkerd2/add-ons/prometheus
condition: prometheus.enabled
2 changes: 2 additions & 0 deletions charts/linkerd2/templates/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ spec:
containers:
- args:
- public-api
{{ if .Values.prometheus.enabled -}}
- -prometheus-url=http://linkerd-prometheus.{{.Values.global.namespace}}.svc.{{.Values.global.clusterDomain}}:9090
{{ end -}}
- -destination-addr=linkerd-dst.{{.Values.global.namespace}}.svc.{{.Values.global.clusterDomain}}:8086
- -controller-namespace={{.Values.global.namespace}}
- -log-level={{.Values.controllerLogLevel}}
Expand Down
3 changes: 2 additions & 1 deletion charts/linkerd2/templates/heartbeat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ spec:
imagePullPolicy: {{.Values.global.imagePullPolicy}}
args:
- "heartbeat"
{{ if .Values.prometheus.enabled -}}
- "-prometheus-url=http://linkerd-prometheus.{{.Values.global.namespace}}.svc.{{.Values.global.clusterDomain}}:9090"
- "-controller-namespace={{.Values.global.namespace}}"
{{ end -}} - "-controller-namespace={{.Values.global.namespace}}"
- "-log-level={{.Values.controllerLogLevel}}"
{{- if .Values.heartbeatResources -}}
{{- include "partials.resources" .Values.heartbeatResources | nindent 12 }}
Expand Down
24 changes: 24 additions & 0 deletions charts/linkerd2/templates/linkerd-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
###
### linkerd values
###
---
kind: ConfigMap
apiVersion: v1
metadata:
name: linkerd-values
namespace: {{.Values.global.namespace}}
labels:
{{.Values.global.controllerComponentLabel}}: controller
{{.Values.global.controllerNamespaceLabel}}: {{.Values.global.namespace}}
annotations:
{{.Values.global.createdByAnnotation}}: {{default (printf "linkerd/helm %s" .Values.global.linkerdVersion) .Values.global.cliVersion}}
data:
values: |-
global:
{{- toYaml .Values.global | trim | nindent 6}}
grafana:
{{- toYaml .Values.grafana | trim | nindent 6}}
prometheus:
{{- toYaml .Values.prometheus | trim | nindent 6}}

4 changes: 4 additions & 0 deletions charts/linkerd2/templates/psp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,11 @@ subjects:
- kind: ServiceAccount
name: linkerd-destination
namespace: {{.Values.global.namespace}}
{{ if .Values.grafana.enabled -}}
- kind: ServiceAccount
name: linkerd-grafana
namespace: {{.Values.global.namespace}}
{{end -}}
{{ if not .Values.disableHeartBeat -}}
- kind: ServiceAccount
name: linkerd-heartbeat
Expand All @@ -101,9 +103,11 @@ subjects:
- kind: ServiceAccount
name: linkerd-identity
namespace: {{.Values.global.namespace}}
{{ if .Values.prometheus.enabled -}}
- kind: ServiceAccount
name: linkerd-prometheus
namespace: {{.Values.global.namespace}}
{{ end -}}
- kind: ServiceAccount
name: linkerd-proxy-injector
namespace: {{.Values.global.namespace}}
Expand Down
2 changes: 2 additions & 0 deletions charts/linkerd2/templates/web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ spec:
containers:
- args:
- -api-addr=linkerd-controller-api.{{.Values.global.namespace}}.svc.{{.Values.global.clusterDomain}}:8085
{{ if .Values.grafana.enabled -}}
- -grafana-addr=linkerd-grafana.{{.Values.global.namespace}}.svc.{{.Values.global.clusterDomain}}:3000
{{ end -}}
- -controller-namespace={{.Values.global.namespace}}
- -log-level={{.Values.controllerLogLevel}}
{{- $hostFull := replace "." "\\." (printf "linkerd-web.%s.svc.%s" .Values.global.namespace .Values.global.clusterDomain) }}
Expand Down
13 changes: 10 additions & 3 deletions charts/linkerd2/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,6 @@ identity:
# PEM-encoded ECDSA private key
keyPEM: |

# grafana configuration
grafanaImage: gcr.io/linkerd-io/grafana

# heartbeat configuration
disableHeartBeat: false
heartbeatSchedule: "0 0 * * *"
Expand Down Expand Up @@ -159,3 +156,13 @@ installNamespace: true
# https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector.
nodeSelector:
beta.kubernetes.io/os: linux

# Config for add-ons
grafana:
enabled: true
image: gcr.io/linkerd-io/grafana

prometheus:
enabled: true
logLevel: debug
image: prom/prometheus:v2.11.1
2 changes: 1 addition & 1 deletion cli/Dockerfile-bin
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## compile binaries
FROM gcr.io/linkerd-io/go-deps:f6fda337 as golang
FROM gcr.io/linkerd-io/go-deps:bfb89c7f as golang
WORKDIR /linkerd-build
COPY cli cli
COPY charts charts
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/install-cni-plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func renderCNIPlugin(w io.Writer, config *cniPluginOptions) error {
RawValues: rawValues,
Files: files,
}
buf, err := chart.RenderCNI()
buf, err := chart.RenderWithoutPartials()
if err != nil {
return err
}
Expand Down
Loading