Skip to content

Commit 5eb82c8

Browse files
committed
wip
Signed-off-by: Davide Briani <davide.briani@secomind.com>
1 parent 13dd951 commit 5eb82c8

14 files changed

+343
-0
lines changed

deprovision.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
# Uninstall root CA so that it isn't trusted by the local system and browsers
4+
mkcert -uninstall
5+
6+
# Delete the kubernetes cluster
7+
minikube delete

helm-infra/Chart.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: v2
2+
name: astarte-infra
3+
description: A Helm chart for Kubernetes
4+
type: application
5+
version: 0.1.0
6+
appVersion: "0.1.0"

helm-infra/templates/_helpers.tpl

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "astarte.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "astarte.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "astarte.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "astarte.labels" -}}
37+
helm.sh/chart: {{ include "astarte.chart" . }}
38+
{{ include "astarte.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "astarte.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "astarte.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "astarte.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "astarte.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: cert-manager.io/v1
2+
kind: Certificate
3+
metadata:
4+
name: astarte-default-ingress-certificate
5+
namespace: astarte
6+
spec:
7+
dnsNames:
8+
- {{ .Values.ingress.astarteApiHost }}
9+
- {{ .Values.ingress.astarteVernemqHost }}
10+
- {{ .Values.ingress.astarteDashboardHost }}
11+
secretName: astarte-tls-cert-secret
12+
issuerRef:
13+
name: cluster-issuer
14+
kind: ClusterIssuer
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: cert-manager.io/v1
2+
kind: ClusterIssuer
3+
metadata:
4+
name: cluster-issuer
5+
namespace: cert-manager
6+
spec:
7+
ca:
8+
secretName: cluster-issuer-ca-key-pair
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: astarte

helm-infra/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ingress:
2+
astarteApiHost: api.astarte.192.168.49.2.nip.io
3+
astarteVernemqHost: vernemq.astarte.192.168.49.2.nip.io
4+
astarteDashboardHost: dashboard.astarte.192.168.49.2.nip.io

helm/Chart.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: v2
2+
name: astarte
3+
description: A Helm chart for Kubernetes
4+
type: application
5+
version: 0.1.0
6+
appVersion: "0.1.0"
7+
# dependencies:
8+
# - name: ingress-nginx
9+
# version: "4.12.0-beta.0"
10+
# repository: "https://kubernetes.github.io/ingress-nginx"
11+
# - name: cert-manager
12+
# version: "v1.16.1"
13+
# repository: "https://charts.jetstack.io"
14+
# - name: astarte-operator
15+
# version: "24.5.0"
16+
# repository: "https://helm.astarte-platform.org"

helm/templates/_helpers.tpl

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "astarte.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "astarte.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "astarte.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "astarte.labels" -}}
37+
helm.sh/chart: {{ include "astarte.chart" . }}
38+
{{ include "astarte.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "astarte.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "astarte.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "astarte.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "astarte.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
apiVersion: ingress.astarte-platform.org/v1alpha1
2+
kind: AstarteDefaultIngress
3+
metadata:
4+
name: adi
5+
namespace: astarte
6+
labels:
7+
{{- include "astarte.labels" . | nindent 4 }}
8+
spec:
9+
### Astarte Default Ingress CRD
10+
astarte: astarte
11+
tlsSecret: astarte-tls-cert-secret
12+
api:
13+
exposeHousekeeping: true
14+
dashboard:
15+
deploy: true
16+
ssl: true
17+
host: {{ .Values.ingress.astarteDashboardHost }}
18+
broker:
19+
deploy: true
20+
serviceType: LoadBalancer

0 commit comments

Comments
 (0)