diff --git a/charts/priobike-predictor/.helmignore b/charts/priobike-predictor/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/priobike-predictor/.helmignore @@ -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/ diff --git a/charts/priobike-predictor/Chart.yaml b/charts/priobike-predictor/Chart.yaml new file mode 100644 index 0000000..062b8ee --- /dev/null +++ b/charts/priobike-predictor/Chart.yaml @@ -0,0 +1,30 @@ +apiVersion: v2 +name: priobike-predictor +description: A Helm chart for Kubernetes + +# 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: "v1.2" + +maintainers: + - name: Paul + email: paul_maximilian.pickhardt@tu-dresden.de + - name: Daniel + email: daniel.jeschor@tu-dresden.de diff --git a/charts/priobike-predictor/ci/example-values.yaml b/charts/priobike-predictor/ci/example-values.yaml new file mode 100644 index 0000000..1bc2eb1 --- /dev/null +++ b/charts/priobike-predictor/ci/example-values.yaml @@ -0,0 +1,4 @@ +namespace: example-namespace +priobikeImageRegistry: bikenow.vkw.tu-dresden.de/priobike + +predictionMqttPassword: test diff --git a/charts/priobike-predictor/templates/config-map.yaml b/charts/priobike-predictor/templates/config-map.yaml new file mode 100644 index 0000000..e6110fe --- /dev/null +++ b/charts/priobike-predictor/templates/config-map.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Values.configMapName }} +data: + PREDICTION_MQTT_URL: {{ required "A valid .Values.predictionMqttUrl entry is required!" .Values.predictionMqttUrl }} + + # The FROST server config. + SENSORTHINGS_URL_THINGS: {{ required "A valid .Values.sensorThingsUrlThings entry is required!" .Values.sensorThingsUrlThings }} + SENSORTHINGS_URL_OBSERVATIONS: {{ required "A valid .Values.sensorThingsUrlObservations entry is required!" .Values.sensorThingsUrlObservations }} + SENSORTHINGS_MQTT_URL: {{ required "A valid .Values.sensorThingsMqttUrl entry is required!" .Values.sensorThingsMqttUrl }} + + # The path under which all resources will be stored for the web API. + STATIC_PATH: {{ required "A valid .Values.staticPath entry is required!" .Values.staticPath }} diff --git a/charts/priobike-predictor/templates/deployment.yaml b/charts/priobike-predictor/templates/deployment.yaml new file mode 100644 index 0000000..3debe25 --- /dev/null +++ b/charts/priobike-predictor/templates/deployment.yaml @@ -0,0 +1,34 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Values.deploymentName }} +spec: + replicas: 1 + selector: + matchLabels: + app: {{ .Values.labels.app }} + template: + metadata: + labels: + app: {{ .Values.labels.app }} + spec: + imagePullSecrets: + - name: regcred + + containers: + - name: {{ .Values.containerName }} + image: |- + {{ (.Values.global).priobikeImageRegistry | default .Values.priobikeImageRegistry | required "A valid .Values.priobikeImageRegistry or .Values.global.priobikeImageRegistry entry is required!" -}} + /{{ .Values.imageName }}:v1.2 + envFrom: + - configMapRef: + name: {{ .Values.configMapName }} + - secretRef: + name: {{ .Values.secretName }} + volumeMounts: + - mountPath: {{ .Values.staticPath }} + name: {{ .Values.volumeName }} + volumes: + - name: {{ .Values.volumeName }} + persistentVolumeClaim: + claimName: {{ .Values.volumeClaimName }} diff --git a/charts/priobike-predictor/templates/nginx-deployment.yaml b/charts/priobike-predictor/templates/nginx-deployment.yaml new file mode 100644 index 0000000..a91e031 --- /dev/null +++ b/charts/priobike-predictor/templates/nginx-deployment.yaml @@ -0,0 +1,30 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Values.nginx.deploymentName }} +spec: + replicas: 1 + selector: + matchLabels: + app: {{ .Values.nginx.labels.app }} + template: + metadata: + labels: + app: {{ .Values.nginx.labels.app }} + spec: + imagePullSecrets: + - name: regcred + + containers: + - name: {{ .Values.nginx.containerName }} + image: |- + {{ (.Values.global).priobikeImageRegistry | default .Values.priobikeImageRegistry | required "A valid .Values.priobikeImageRegistry or .Values.global.priobikeImageRegistry entry is required!" -}} + /{{ .Values.nginx.imageName }}:v1.0 + volumeMounts: + - mountPath: {{ .Values.staticPath }} + name: {{ .Values.volumeName }} + volumes: + - name: {{ .Values.volumeName }} + persistentVolumeClaim: + claimName: {{ .Values.volumeClaimName }} + readOnly: true diff --git a/charts/priobike-predictor/templates/nginx-service.yaml b/charts/priobike-predictor/templates/nginx-service.yaml new file mode 100644 index 0000000..2b6cb41 --- /dev/null +++ b/charts/priobike-predictor/templates/nginx-service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.nginx.serviceName }} +spec: + selector: + app: {{ .Values.nginx.labels.app }} + ports: + - protocol: TCP + port: 80 + targetPort: 80 + type: ClusterIP diff --git a/charts/priobike-predictor/templates/persistent-volume-claim.yaml b/charts/priobike-predictor/templates/persistent-volume-claim.yaml new file mode 100644 index 0000000..299829b --- /dev/null +++ b/charts/priobike-predictor/templates/persistent-volume-claim.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .Values.volumeClaimName }} +spec: + storageClassName: {{ .Values.storageClassName }} + accessModes: + - ReadWriteOnce + resources: + requests: + storage: {{ .Values.storageSize }} diff --git a/charts/priobike-predictor/templates/secret.yaml b/charts/priobike-predictor/templates/secret.yaml new file mode 100644 index 0000000..4ea1e37 --- /dev/null +++ b/charts/priobike-predictor/templates/secret.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ .Values.secretName }} +data: + PREDICTION_MQTT_USERNAME: {{ required "A valid .Values.predictionMqttUsername entry is required!" .Values.predictionMqttUsername | b64enc }} + PREDICTION_MQTT_PASSWORD: {{ required "A valid .Values.predictionMqttPassword entry is required!" .Values.predictionMqttPassword | b64enc }} diff --git a/charts/priobike-predictor/values.yaml b/charts/priobike-predictor/values.yaml new file mode 100644 index 0000000..2593144 --- /dev/null +++ b/charts/priobike-predictor/values.yaml @@ -0,0 +1,29 @@ +imageName: priobike-predictor + +labels: + app: priobike-predictor-app +configMapName: priobike-predictor-config +deploymentName: priobike-predictor-deployment +containerName: priobike-predictor-container +volumeClaimName: priobike-predictor-volume-claim +storageClassName: standard +storageSize: 1Gi +volumeName: priobike-predictor-volume +secretName: priobike-predictor-secret + +# The path under which all resources will be stored for the web API. +staticPath: /usr/share/nginx/html + +predictionMqttUrl: tcp://priobike-mqtt-service.example-namespace.svc.cluster.local:1883 +predictionMqttUsername: backend +sensorThingsUrlThings: https://tld.iot.hamburg.de/v1.1/ # For priobike frost mirror: ..svc.cluster.local//FROST-Server/v1.1/ +sensorThingsUrlObservations: https://tld.iot.hamburg.de/v1.1/ +sensorThingsMqttUrl: tcp://tld.iot.hamburg.de:1883 + +nginx: + labels: + app: priobike-predictor-nginx-app + imageName: priobike-nginx + deploymentName: priobike-predictor-nginx-deployment + containerName: priobike-predictor-nginx-container + serviceName: priobike-predictor-nginx-service