Skip to content

Commit

Permalink
Merge pull request #24 from teslamotors/fleet_telemetry_helm_chart
Browse files Browse the repository at this point in the history
fleet-telemetry helm chart
  • Loading branch information
nathwang authored Jun 8, 2023
2 parents 00f16e5 + 94b038c commit 2eb5ac8
Show file tree
Hide file tree
Showing 10 changed files with 442 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/fleet-telemetry/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
23 changes: 23 additions & 0 deletions charts/fleet-telemetry/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: v2
name: fleet-telemetry
description: An Open Source Helm chart for fleet-telemetry
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.0.3"
maintainers:
- name: nathwang
156 changes: 156 additions & 0 deletions charts/fleet-telemetry/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
# Fleet Telemetry Helm Chart
* Installs the fleet-telemetry system. [fleet-telemetry](https://github.com/teslamotors/fleet-telemetry)
## Get Repo Info
```console
helm repo add teslamotors https://teslamotors.github.io/helm-charts/
helm repo update
```
_See [helm repo](https://helm.sh/docs/helm/helm_repo/) for command documentation._

## Installing the Chart

To install the chart with the release name `fleet-telemetry`:

```console
helm install fleet-telemetry charts/fleet-telemetry -n fleet-telemetry
```

## Uninstalling the Chart

To uninstall/delete the fleet-telemetry deployment:

```console
helm uninstall fleet-telemetry -n fleet-telemetry
```
The command removes all the Kubernetes components associated with the chart and deletes the release.

## Upgrade the Chart
To upgrade the chart with the release name `fleet-telemetry`:
```console
helm upgrade fleet-telemetry charts/fleet-telemetry -n fleet-telemetry
```

## Configuration
| Parameter | Description | Default |
|-----------------------|-------------------------------------------------------------------------------------|-------------------------|
| `tlsSecret.name` | Name of existing secret, if this value is set `tlsCrt` and `tlsKey` will be ignored | `nil` |
| `tlsSecret.tlsCrt` | value of the certification | `nil` |
| `tlsSecret.tlsKey` | value of the encryption key | `nil` |
| `image.repository` | value of the docker image repo | `tesla/fleet-telemetry` |
| `image.tag` | value of the docker image tag | `v0.0.3` |
| `resources` | CPU/Memory resource requests/limits | {} |
| `nodeSelector` | Node labels for pod assignment | {} |
| `tolerations` | Toleration labels for pod assignment | {} |
| `replicas` | Number of pods | `1` |
| `service.annotations` | Service Annotations | {} |
| `service.type` | Service Type | ClusterIP |

## Example
* Set `config.data` in `values.yaml`
```yaml
service:
annotations:
service.beta.kubernetes.io/aws-load-balancer-scheme: "internet-facing"
service.beta.kubernetes.io/aws-load-balancer-type: "nlb-ip"
service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: "ip"
service.beta.kubernetes.io/aws-load-balancer-subnets: subnet-1, subnet-2, subnet-3
type: LoadBalancer
tlsSecret:
tlsCrt: |
value of the cert PEM
tlsKey: |
value the private key
config:
data: |
{
"host": "0.0.0.0",
"port": 8443,
"status_port": 8080,
"log_level": "info",
"json_log_enable": true,
"namespace": "tesla_telemetry",
"reliable_ack": false,
"monitoring": {
"prometheus_metrics_port": 9273,
"profiler_port": 4269,
"profiling_path": "/tmp/trace.out"
},
"rate_limit": {
"enabled": true,
"message_interval_time": 30,
"message_limit": 1000
},
"records": {
"alerts": [
"logger"
],
"errors": [
"logger"
],
"V": [
"logger"
]
},
"tls": {
"server_cert": "/etc/certs/server/tls.crt",
"server_key": "/etc/certs/server/tls.key"
}
}
```
```console
helm install fleet-telemetry teslamotors/fleet-telemetry -n fleet-telemetry -f values.yaml
```
* Set `config.data` by `--set-file`
```yaml
service:
annotations:
service.beta.kubernetes.io/aws-load-balancer-scheme: "internet-facing"
service.beta.kubernetes.io/aws-load-balancer-type: "nlb-ip"
service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: "ip"
service.beta.kubernetes.io/aws-load-balancer-subnets: subnet-1, subnet-2, subnet-3
type: LoadBalancer
tlsSecret:
tlsCrt: |
value of the cert PEM
tlsKey: |
value the private key
```
```json
{
"host": "0.0.0.0",
"port": 8443,
"status_port": 8080,
"log_level": "info",
"json_log_enable": true,
"namespace": "tesla_telemetry",
"reliable_ack": false,
"monitoring": {
"prometheus_metrics_port": 9273,
"profiler_port": 4269,
"profiling_path": "/tmp/trace.out"
},
"rate_limit": {
"enabled": true,
"message_interval_time": 30,
"message_limit": 1000
},
"records": {
"alerts": [
"logger"
],
"errors": [
"logger"
],
"V": [
"logger"
]
},
"tls": {
"server_cert": "/etc/certs/server/tls.crt",
"server_key": "/etc/certs/server/tls.key"
}
}
```
```console
helm install fleet-telemetry teslamotors/fleet-telemetry -n fleet-telemetry -f values.yaml --set-file config.data=config.json
```
9 changes: 9 additions & 0 deletions charts/fleet-telemetry/templates/0-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "fleet-telemetry.fullname" . }}
labels:
service: fleet-telemetry
{{- include "fleet-telemetry.labels" . | nindent 4 }}
data:
config.json: {{ .Values.config.data | toJson }}
16 changes: 16 additions & 0 deletions charts/fleet-telemetry/templates/1-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- if not .Values.tlsSecret.name -}}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "fleet-telemetry.fullname" . }}
labels:
{{- include "fleet-telemetry.labels" . | nindent 4 }}
data:
tls.crt: {{ required "tlsSecret.tlsCrt is required"
.Values.tlsSecret.tlsCrt | b64enc | quote
}}
tls.key: {{ required "tlsSecret.tlsKey is required"
.Values.tlsSecret.tlsKey | b64enc | quote
}}
type: kubernetes.io/tls
{{- end -}}
76 changes: 76 additions & 0 deletions charts/fleet-telemetry/templates/2-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "fleet-telemetry.fullname" . }}
labels:
role: api
service: fleet-telemetry
{{- include "fleet-telemetry.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicas }}
selector:
matchLabels:
role: api
service: fleet-telemetry
{{- include "fleet-telemetry.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
role: api
service: fleet-telemetry
{{- include "fleet-telemetry.selectorLabels" . | nindent 8 }}
spec:
containers:
- command:
- /fleet-telemetry
- -config=/etc/fleet-telemetry/config.json
env:
- name: KUBERNETES_CLUSTER_DOMAIN
value: {{ quote .Values.kubernetesClusterDomain }}
image: {{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}
livenessProbe:
failureThreshold: 5
httpGet:
path: /metrics
port: {{ .Values.config.metrics.port }}
scheme: HTTP
initialDelaySeconds: 5
timeoutSeconds: 10
readinessProbe:
failureThreshold: 5
httpGet:
path: /status
port: {{ .Values.config.status.port }}
scheme: HTTP
initialDelaySeconds: 5
timeoutSeconds: 10
name: fleet-telemetry
ports:
- containerPort: {{ .Values.config.profile.port }}
name: profile
protocol: TCP
- containerPort: {{ .Values.config.port }}
name: https
protocol: TCP
- containerPort: {{ .Values.config.metrics.port }}
name: metrics
protocol: TCP
resources: {{- toYaml .Values.resources | nindent 10 }}
volumeMounts:
- mountPath: /etc/fleet-telemetry/
name: config
- mountPath: /etc/certs/server
name: server-certs
nodeSelector: {{- toYaml .Values.nodeSelector | nindent 8 }}
tolerations: {{- toYaml .Values.tolerations | nindent 8 }}
volumes:
- name: config
projected:
sources:
- configMap:
name: {{ include "fleet-telemetry.fullname" . }}
- name: server-certs
projected:
sources:
- secret:
name: {{ .Values.tlsSecret.name | default (printf "%s" (include "fleet-telemetry.fullname" .)) }}
19 changes: 19 additions & 0 deletions charts/fleet-telemetry/templates/3-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "fleet-telemetry.fullname" . }}
labels:
prometheus_scrape: "true"
role: api
service: fleet-telemetry
{{- include "fleet-telemetry.labels" . | nindent 4 }}
annotations:
{{- .Values.service.annotations | toYaml | nindent 4 }}
spec:
type: {{ .Values.service.type }}
selector:
role: api
service: fleet-telemetry
{{- include "fleet-telemetry.selectorLabels" . | nindent 4 }}
ports:
{{- .Values.service.ports | toYaml | nindent 2 -}}
17 changes: 17 additions & 0 deletions charts/fleet-telemetry/templates/4-service-internal.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "fleet-telemetry.fullname" . }}-internal
labels:
prometheus_scrape: "true"
role: api
service: fleet-telemetry
{{- include "fleet-telemetry.labels" . | nindent 4 }}
spec:
type: {{ .Values.serviceInternal.type }}
selector:
role: api
service: fleet-telemetry
{{- include "fleet-telemetry.selectorLabels" . | nindent 4 }}
ports:
{{- .Values.serviceInternal.ports | toYaml | nindent 2 -}}
Loading

0 comments on commit 2eb5ac8

Please sign in to comment.