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

Add Control Plane Helm Templates And Proxy Partials #3146

Merged
merged 43 commits into from
Aug 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
b22c449
Updated controller template with proxy partials
Jul 24, 2019
46a81b0
Declare dependency in requirements.yaml
Jul 25, 2019
242ed73
Add partial template for proxy's metadata
Jul 25, 2019
149cb46
Add proxy-init partial template
Jul 25, 2019
2ae82d3
Remove partials chart .tgz file
Jul 25, 2019
8a63620
Script to lint Helm charts and update their dependencies
Jul 25, 2019
fd2d2e4
Update partials chart Chart.yaml
Jul 25, 2019
fd2c048
Add proxy-init and resource partial templates
Jul 25, 2019
f42b053
Replace hard coded namespace variable in proxy env var
Jul 25, 2019
d72f17a
Ignore chart dependencies .tgz files
Jul 25, 2019
c32f62f
Add missing fields and re-order YAML elements to match CLI output
ihcsim Jul 26, 2019
3df9a03
Reuse control plane's resource partial template in 'partials' chart
ihcsim Jul 26, 2019
921e505
Set the proxy's destination service address env var
ihcsim Jul 26, 2019
d4ae6ff
Add Grafana's template
ihcsim Jul 26, 2019
27f76de
Update api version of controller RBAC
ihcsim Jul 26, 2019
e164da6
Add Heartbeat template
ihcsim Jul 26, 2019
d426b5e
Remove duplicated resources partial template
ihcsim Jul 26, 2019
48cd88d
Add remainder control plane components templates
ihcsim Jul 28, 2019
54ab996
Add template for the 'linkerd-config' config map
ihcsim Jul 29, 2019
667b7ce
Add debug container template
ihcsim Jul 30, 2019
e479a21
Update proxy partial with 'disable-identity' and 'disable-tap' variables
ihcsim Jul 30, 2019
f42de85
Add validation conditions to ensure identity and tap aren't disabled for
ihcsim Jul 30, 2019
5efe137
Add partials for service account token mount path and security contex…
ihcsim Jul 30, 2019
430d4ee
Change proxy and proxy-init templates to use global scope
ihcsim Jul 30, 2019
2b4d94e
Update templates and values file to match #3161
Jul 30, 2019
71b4fb2
Perform a dry run installation if there is a local Tiller
Jul 31, 2019
a21db05
Reorder JSON elements in linkerd-config
Jul 31, 2019
f7d1206
Bug fixes
Jul 31, 2019
e64c75f
Re-adjust nested partials indentation to work with inject 'patch' chart
Jul 31, 2019
f423e27
Trap the last fail command in the Helm shell script
Jul 31, 2019
dac0e3a
Add the identity trust anchor
Aug 1, 2019
0f629ef
Address Thomas' feedback on handling HA
Aug 1, 2019
9ddf87d
Convert ignore ports string to JSON list in linkerd-config
Aug 1, 2019
0c67528
Add values-ha.yaml
Aug 1, 2019
ecfb4ff
Include the service account token mount path only if identity is enabled
Aug 1, 2019
e4a7b99
Fixed malformed JSON in linkerd-config config map
Aug 1, 2019
bcbd0c9
Rename chart to 'linkerd2'
Aug 1, 2019
02be87f
Add NOTES.txt
Aug 1, 2019
8781d69
Fix incorrect variable path in proxy template
Aug 1, 2019
e8592de
Remove fake TLS assets
Aug 1, 2019
5236069
Add 'required' constraint to identity trust anchors variable
Aug 2, 2019
c79c414
Update tap templates per #3167
Aug 2, 2019
681a921
Bump default version to edge-19.8.1 due to dependency on RSA support
Aug 2, 2019
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ web/app/yarn-error.log
.golangci-lint*
**/*.gogen*
**/*.swp
charts/*/charts/
ihcsim marked this conversation as resolved.
Show resolved Hide resolved
23 changes: 23 additions & 0 deletions bin/helm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

set -e

# trap the last failed command
trap 'printf "Error on exit:\n Exit code: $?\n Failed command: \"$BASH_COMMAND\"\n"' ERR

bindir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
rootdir="$( cd $bindir/.. && pwd )"

helm lint $rootdir/charts/partials

helm dep up $rootdir/charts/linkerd2
helm lint --set Identity.TrustAnchorsPEM="fake-trust" --set Identity.Issuer.CrtPEM="fake-cert" --set Identity.Issuer.KeyPEM="fake-key" --set Identity.Issuer.CrtExpiry="fake-expiry-date" $rootdir/charts/linkerd2

# if tiller is deployed, perform a dry run installation to check for errors
if tiller=`kubectl get po -l app=helm,name=tiller --all-namespaces`; then
echo "Performing dry run installation"
helm install --name=linkerd --dry-run --set Identity.TrustAnchorsPEM="fake-trust" --set Identity.Issuer.CrtPEM="fake-cert" --set Identity.Issuer.KeyPEM="fake-key" --set Identity.Issuer.CrtExpiry="fake-expiry-date" $rootdir/charts/linkerd2 2> /dev/null

echo "Performing dry run installation (HA mode)"
helm install --name=linkerd --dry-run --set Identity.TrustAnchorsPEM="fake-trust" --set Identity.Issuer.CrtPEM="fake-cert" --set Identity.Issuer.KeyPEM="fake-key" --set Identity.Issuer.CrtExpiry="fake-expiry-date" -f $rootdir/charts/linkerd2/values.yaml -f $rootdir/charts/linkerd2/values-ha.yaml charts/linkerd2 2> /dev/null
fi
21 changes: 21 additions & 0 deletions charts/linkerd2/.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
11 changes: 11 additions & 0 deletions charts/linkerd2/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: "v1"
appVersion: edge-19.8.1
description: Linkerd gives you observability, reliability, and security for your microservices — with no code change required.
home: https://linkerd.io
keywords:
- service-mesh
kubeVersion: ">=1.12.0-0"
name: "linkerd2"
sources:
- https://github.com/linkerd/linkerd2/
version: 0.1.0
6 changes: 6 additions & 0 deletions charts/linkerd2/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:3a86b96a2966f03ba04518723838b49719a3277dfb9bea0b3f067e83d370e0b3
generated: 2019-07-24T19:51:15.04322926-07:00
4 changes: 4 additions & 0 deletions charts/linkerd2/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
14 changes: 14 additions & 0 deletions charts/linkerd2/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Linkerd was successfully installed 🎉

Add the linkerd CLI to your path with:

export PATH=\$PATH:\$HOME/.linkerd2/bin

Now run:

linkerd check --pre # validate that Linkerd can be installed
linkerd install | kubectl apply -f - # install the control plane into the 'linkerd' namespace
linkerd check # validate everything worked!
linkerd dashboard # launch the dashboard

Looking for more? Visit https://linkerd.io/2/next-steps
22 changes: 22 additions & 0 deletions charts/linkerd2/templates/_affinity.tpl
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 }}
80 changes: 80 additions & 0 deletions charts/linkerd2/templates/_config.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{{- define "linkerd.configs.global" -}}
{
"linkerdNamespace": "{{.Namespace}}",
"cniEnabled": false,
"version": "{{.LinkerdVersion}}",
"identityContext":{
"trustDomain": "{{.Identity.TrustDomain}}",
"trustAnchorsPem": "{{required "Please provide the identity trust anchors" .Identity.TrustAnchorsPEM | replace "\n" "\\n"}}",
"issuanceLifeTime": "{{.Identity.Issuer.IssuanceLifeTime}}",
"clockSkewAllowance": "{{.Identity.Issuer.ClockSkewAllowance}}"
},
"autoInjectContext": null,
"omitWebhookSideEffects": {{.OmitWebhookSideEffects}},
"clusterDomain": "{{.ClusterDomain}}"
}
{{- end -}}

{{- define "linkerd.configs.proxy" -}}
{
"proxyImage":{
"imageName":"{{.Proxy.Image.Name}}",
"pullPolicy":"{{.Proxy.Image.PullPolicy}}"
},
"proxyInitImage":{
"imageName":"{{.ProxyInit.Image.Name}}",
"pullPolicy":"{{.ProxyInit.Image.PullPolicy}}"
},
"controlPort":{
"port": {{.Proxy.Ports.Control}}
},
"ignoreInboundPorts":[
{{- $ports := splitList "," .ProxyInit.IgnoreInboundPorts -}}
{{- if gt (len $ports) 1}}
{{- $last := sub (len $ports) 1 -}}
{{- range $i,$port := $ports -}}
{"port":{{$port}}}{{ternary "," "" (ne $i $last)}}
{{- end -}}
{{- end -}}
],
"ignoreOutboundPorts":[
{{- $ports := splitList "," .ProxyInit.IgnoreOutboundPorts -}}
{{- if gt (len $ports) 1}}
{{- $last := sub (len $ports) 1 -}}
{{- range $i,$port := $ports -}}
{"port":{{$port}}}{{ternary "," "" (ne $i $last)}}
{{- end -}}
{{- end -}}
],
"inboundPort":{
"port": {{.Proxy.Ports.Inbound}}
},
"adminPort":{
"port": {{.Proxy.Ports.Admin}}
},
"outboundPort":{
"port": {{.Proxy.Ports.Outbound}}
},
"resource":{
"requestCpu": "{{.Proxy.Resources.CPU.Request}}",
"limitCpu": "{{.Proxy.Resources.CPU.Limit}}",
"requestMemory": "{{.Proxy.Resources.Memory.Request}}",
"limitMemory": "{{.Proxy.Resources.Memory.Limit}}"
},
"proxyUid": {{.Proxy.UID}},
"logLevel":{
"level": "{{.Proxy.LogLevel}}"
},
"disableExternalProfiles": {{not .Proxy.EnableExternalProfile}},
"proxyVersion": "{{.Proxy.Image.Version}}",
"proxyInitImageVersion": "{{.ProxyInit.Image.Version}}"
}
{{- end -}}

{{- define "linkerd.configs.install" -}}
{
"uuid":"{{ uuidv4 }}",
"cliVersion":"{{ .LinkerdVersion }}",
"flags":[]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This list is used by linkerd upgrade. Helm users may not need it, as they will be running helm upgrade (which is yet to be tested).

}
{{- end -}}
32 changes: 32 additions & 0 deletions charts/linkerd2/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{/* vim: set filetype=mustache: */}}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can ignore; auto-generated by Helm.

{{/*
Expand the name of the chart.
*/}}
{{- define "linkerd.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "linkerd.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "linkerd.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
9 changes: 9 additions & 0 deletions charts/linkerd2/templates/_validate.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{- define "linkerd.proxy.validation" -}}
{{- if .DisableIdentity -}}
{{- fail (printf "Can't disable identity mTLS for %s. Set '.Values.Proxy.DisableIdentity' to 'false'" .Component) -}}
{{- end -}}

{{- if .DisableTap -}}
{{- fail (printf "Can't disable tap for %s. Set '.Values.Proxy.DisableTap' to 'false'" .Component) -}}
{{- end -}}
{{- end -}}
38 changes: 38 additions & 0 deletions charts/linkerd2/templates/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{{with .Values -}}
---
kind: ConfigMap
apiVersion: v1
metadata:
name: linkerd-config
namespace: {{.Namespace}}
labels:
{{.ControllerComponentLabel}}: controller
{{.ControllerNamespaceLabel}}: {{.Namespace}}
annotations:
{{.CreatedByAnnotation}}: {{default (printf "linkerd/helm %s" .LinkerdVersion) .CliVersion}}
data:
global: |
{{- if .Configs -}}
{{- if .Configs.Global -}}
{{.Configs.Global}}
{{- end }}
{{- else -}}
{{- include "linkerd.configs.global" . | nindent 4}}
{{- end }}
proxy: |
{{- if .Configs -}}
{{- if .Configs.Proxy -}}
{{.Configs.Proxy}}
{{- end }}
{{- else -}}
{{- include "linkerd.configs.proxy" . | nindent 4}}
{{- end }}
install: |
{{- if .Configs -}}
{{- if .Configs.Install -}}
{{.Configs.Instal}}
{{- end }}
{{- else -}}
{{- include "linkerd.configs.install" . | nindent 4}}
{{- end }}
{{- end -}}
55 changes: 55 additions & 0 deletions charts/linkerd2/templates/controller-rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{{with .Values -}}
---
###
### Controller RBAC
###
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: linkerd-{{.Namespace}}-controller
labels:
{{.ControllerComponentLabel}}: controller
{{.ControllerNamespaceLabel}}: {{.Namespace}}
rules:
- apiGroups: ["extensions", "apps"]
resources: ["daemonsets", "deployments", "replicasets", "statefulsets"]
verbs: ["list", "get", "watch"]
- apiGroups: ["extensions", "batch"]
resources: ["jobs"]
verbs: ["list" , "get", "watch"]
- apiGroups: [""]
resources: ["pods", "endpoints", "services", "replicationcontrollers", "namespaces"]
verbs: ["list", "get", "watch"]
- apiGroups: ["linkerd.io"]
resources: ["serviceprofiles"]
verbs: ["list", "get", "watch"]
- apiGroups: ["split.smi-spec.io"]
resources: ["trafficsplits"]
verbs: ["list", "get", "watch"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: linkerd-{{.Namespace}}-controller
labels:
{{.ControllerComponentLabel}}: controller
{{.ControllerNamespaceLabel}}: {{.Namespace}}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: linkerd-{{.Namespace}}-controller
subjects:
- kind: ServiceAccount
name: linkerd-controller
namespace: {{.Namespace}}
---
kind: ServiceAccount
apiVersion: v1
metadata:
name: linkerd-controller
namespace: {{.Namespace}}
labels:
{{.ControllerComponentLabel}}: controller
{{.ControllerNamespaceLabel}}: {{.Namespace}}
{{- end -}}
Loading