Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

component: Add linkerd #690

Merged
merged 6 commits into from
Aug 27, 2020
Merged
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
22 changes: 22 additions & 0 deletions assets/charts/components/linkerd2/.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
OWNERS
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
17 changes: 17 additions & 0 deletions assets/charts/components/linkerd2/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
appVersion: stable-2.8.1
description: Linkerd gives you observability, reliability, and security for your microservices
— with no code change required.
home: https://linkerd.io
icon: https://linkerd.io/images/logo-only-200h.png
keywords:
- service-mesh
kubeVersion: '>=1.13.0-0'
maintainers:
- email: cncf-linkerd-dev@lists.cncf.io
name: Linkerd authors
url: https://linkerd.io/
name: linkerd2
sources:
- https://github.com/linkerd/linkerd2/
version: 2.8.1
230 changes: 230 additions & 0 deletions assets/charts/components/linkerd2/README.md

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions assets/charts/components/linkerd2/charts/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/
9 changes: 9 additions & 0 deletions assets/charts/components/linkerd2/charts/grafana/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
appVersion: "1.0"
description: A Helm chart for the grafana add-on in Linkerd
maintainers:
- email: cncf-linkerd-dev@lists.cncf.io
name: Linkerd authors
url: https://linkerd.io/
name: grafana
version: 0.1.0
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:2202cf6f3783f79e78414e7a94b651589f322f3724ab220f0ea3bf8f31954de4
generated: "2020-05-01T17:24:16.918227568+05:30"
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
@@ -0,0 +1,13 @@
---
###
### Grafana RBAC
###
---
kind: ServiceAccount
apiVersion: v1
metadata:
name: {{.Values.name}}
namespace: {{.Values.global.namespace}}
labels:
{{.Values.global.controllerComponentLabel}}: grafana
{{.Values.global.controllerNamespaceLabel}}: {{.Values.global.namespace}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
---
###
### Grafana
###
---
kind: ConfigMap
apiVersion: v1
metadata:
name: {{.Values.name}}-config
namespace: {{.Values.global.namespace}}
labels:
{{.Values.global.controllerComponentLabel}}: grafana
{{.Values.global.controllerNamespaceLabel}}: {{.Values.global.namespace}}
annotations:
{{.Values.global.createdByAnnotation}}: {{default (printf "linkerd/helm %s" .Values.global.linkerdVersion) .Values.global.cliVersion}}
data:
grafana.ini: |-
instance_name = {{.Values.name}}

[server]
root_url = %(protocol)s://%(domain)s:/grafana/

[auth]
disable_login_form = true

[auth.anonymous]
enabled = true
org_role = Editor

[auth.basic]
enabled = false

[analytics]
check_for_updates = false

[panels]
disable_sanitize_html = true

datasources.yaml: |-
apiVersion: 1
datasources:
- name: prometheus
type: prometheus
access: proxy
orgId: 1
url: http://linkerd-prometheus.{{.Values.global.namespace}}.svc.{{.Values.global.clusterDomain}}:9090
isDefault: true
jsonData:
timeInterval: "5s"
version: 1
editable: true

dashboards.yaml: |-
apiVersion: 1
providers:
- name: 'default'
orgId: 1
folder: ''
type: file
disableDeletion: true
editable: true
options:
path: /var/lib/grafana/dashboards
homeDashboardId: linkerd-top-line
---
kind: Service
apiVersion: v1
metadata:
name: {{.Values.name}}
namespace: {{.Values.global.namespace}}
labels:
{{.Values.global.controllerComponentLabel}}: grafana
{{.Values.global.controllerNamespaceLabel}}: {{.Values.global.namespace}}
annotations:
{{.Values.global.createdByAnnotation}}: {{default (printf "linkerd/helm %s" .Values.global.linkerdVersion) .Values.global.cliVersion}}
spec:
type: ClusterIP
selector:
{{.Values.global.controllerComponentLabel}}: grafana
ports:
- name: http
port: 3000
targetPort: 3000
---
{{ $_ := set .Values.global.proxy "workloadKind" "deployment" -}}
{{ $_ := set .Values.global.proxy "component" .Values.name -}}
{{ include "linkerd.proxy.validation" .Values.global.proxy -}}
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
{{.Values.global.createdByAnnotation}}: {{default (printf "linkerd/helm %s" .Values.global.linkerdVersion) .Values.global.cliVersion}}
labels:
app.kubernetes.io/name: grafana
app.kubernetes.io/part-of: Linkerd
app.kubernetes.io/version: {{default .Values.global.linkerdVersion .Values.global.controllerImageVersion}}
{{.Values.global.controllerComponentLabel}}: grafana
{{.Values.global.controllerNamespaceLabel}}: {{.Values.global.namespace}}
name: {{.Values.name}}
namespace: {{.Values.global.namespace}}
spec:
replicas: 1
selector:
matchLabels:
{{.Values.global.controllerComponentLabel}}: grafana
{{.Values.global.controllerNamespaceLabel}}: {{.Values.global.namespace}}
{{- include "partials.proxy.labels" .Values.global.proxy | nindent 6}}
template:
metadata:
annotations:
{{.Values.global.createdByAnnotation}}: {{default (printf "linkerd/helm %s" .Values.global.linkerdVersion) .Values.global.cliVersion}}
{{- include "partials.proxy.annotations" .Values.global.proxy| nindent 8}}
labels:
{{.Values.global.controllerComponentLabel}}: grafana
{{.Values.global.controllerNamespaceLabel}}: {{.Values.global.namespace}}
{{.Values.global.workloadNamespaceLabel}}: {{.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
# Force using the go-based DNS resolver instead of the OS' to avoid failures in some environments
# see https://github.com/grafana/grafana/issues/20096
- name: GODEBUG
value: netdns=go
image: {{.Values.image.name}}:{{default .Values.global.linkerdVersion .Values.global.controllerImageVersion}}
imagePullPolicy: {{.Values.global.imagePullPolicy}}
livenessProbe:
httpGet:
path: /api/health
port: 3000
initialDelaySeconds: 30
name: grafana
ports:
- containerPort: 3000
name: http
readinessProbe:
httpGet:
path: /api/health
port: 3000
{{- if .Values.resources -}}
{{- include "partials.resources" .Values.resources | nindent 8 }}
{{- end }}
securityContext:
runAsUser: 472
volumeMounts:
- mountPath: /data
name: data
- mountPath: /etc/grafana
name: grafana-config
readOnly: true
- {{- include "partials.proxy" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ if not .Values.global.cniEnabled -}}
initContainers:
- {{- include "partials.proxy-init" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end -}}
serviceAccountName: {{.Values.name}}
volumes:
- emptyDir: {}
name: data
- configMap:
items:
- key: grafana.ini
path: grafana.ini
- key: datasources.yaml
path: provisioning/datasources/datasources.yaml
- key: dashboards.yaml
path: provisioning/dashboards/dashboards.yaml
name: {{.Values.name}}-config
name: grafana-config
{{ if .Values.global.controlPlaneTracing -}}
- {{- include "partials.proxy.volumes.labels" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end -}}
- {{- include "partials.proxy.volumes.identity" . | indent 8 | trimPrefix (repeat 7 " ") }}
21 changes: 21 additions & 0 deletions assets/charts/components/linkerd2/charts/partials/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 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
5 changes: 5 additions & 0 deletions assets/charts/components/linkerd2/charts/partials/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
description: A Helm chart containing Linkerd partial templates, depended by the 'linkerd'
and 'patch' charts.
name: partials
version: 0.1.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{- /*
This function does the following functions for add-on fields:

- when an add-on is enabled, it removes the `partials` and `global` sub-fields which are automatically added
by helm to pass configuration to sub-charts, and returns the add-on fields.

- When the add-on is disabled, only the `enabled` flag is returned as we don't need to store the other configuration.
*/ -}}
{{- define "linkerd.addons.sanitize-config" -}}
{{- if .enabled -}}
{{ $dup := omit . "global" "partials" }}
{{- toYaml $dup | trim | nindent 6 }}
{{- else }}
enabled: false
{{- end -}}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{ define "linkerd.pod-affinity" -}}
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchExpressions:
- key: {{ .label }}
operator: In
values:
- {{ .component }}
topologyKey: failure-domain.beta.kubernetes.io/zone
weight: 100
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: {{ .label }}
operator: In
values:
- {{ .component }}
topologyKey: kubernetes.io/hostname
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- define "partials.proxy.capabilities" -}}
capabilities:
{{- if .Values.global.proxy.capabilities.add }}
add:
{{- toYaml .Values.global.proxy.capabilities.add | trim | nindent 4 }}
{{- end }}
{{- if .Values.global.proxy.capabilities.drop }}
drop:
{{- toYaml .Values.global.proxy.capabilities.drop | trim | nindent 4 }}
{{- end }}
{{- end -}}

{{- define "partials.proxy-init.capabilities.drop" -}}
drop:
{{ toYaml .Values.global.proxyInit.capabilities.drop | trim }}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{{- define "partials.debug" -}}
image: {{.image.name}}:{{.image.version}}
imagePullPolicy: {{.image.pullPolicy}}
name: linkerd-debug
terminationMessagePolicy: FallbackToLogsOnError
{{- end -}}
Loading