parkhausradar

by it@M

Helm chartv0.2.0App 1.0.0Verified publisher

Helm chart for deploying Parkhausradar, the live occupancy of Munich's parking garages

About this chart

Parkhausradar chart

Helm chart for Parkhausradar, the live occupancy of the parking garages in Munich's city center.

It deploys:

  • frontend: the web app (nginx), as a module of refarch-templates
  • refarch-gateway: the refarch-gateway included by refarch-templates. It gives read-only access to the Things of FROST under /api/frost/v1.1/Things (GET and HEAD, otherwise 405), limited to global.frost.projectId if set. Everything else under /api/frost answers 404
  • collector: writes the occupancy to FROST every minute, using BasicAuth and optionally a proxy. It has its own Deployment, because it serves no HTTP and therefore does not fit the probes and tests of refarch-templates

The FROST-Server is not part of this chart, it runs separately.

The frontend and the gateway each get an ingress on the same host: / for the frontend and /api for the gateway. The frontend calls /api/frost on its own host, so the chart fails if the hosts of both differ.

Installing the Chart

helm install parkhausradar it-at-m/parkhausradar --values my-values.yaml

Then fill in the BasicAuth credentials of the collector in the Secret <release>-frost (keys USERNAME and PASSWORD) and restart the collector. The chart creates the Secret only once with empty values and keeps it on upgrades and uninstalls.

Configuration

ValueDescription
global.frost.baseUrlScheme and host of the FROST-Server, e.g. https://frost.example.com. Required.
global.frost.pathPath of the service root without API version. Defaults to /FROST-Server.
global.frost.projectIdId of the project the collector links its Things, Locations and Sensors to and the gateway limits reading to, if FROST runs the Projects plugin. The project has to be public, because the gateway reads without credentials. Empty for none.
collector.image.*Image of the collector. Defaults to ghcr.io/it-at-m/parkhausradar/collector:1.0.0.
collector.proxyProxy of the collector for the data source and FROST, e.g. http://proxy.example.com:8080. Empty for none.
collector.noProxyComma separated hosts the collector reaches without the proxy.
collector.caCerts.enabledMount a CA bundle in PEM format into the collector and set SSL_CERT_FILE. Defaults to false.
collector.caCerts.existingSecretExisting Secret holding the CA bundle.
collector.caCerts.existingConfigmapExisting ConfigMap holding the CA bundle, alternative to existingSecret.
collector.caCerts.keyKey of the bundle in the Secret or ConfigMap. Defaults to ca-bundle.crt.
collector.caCerts.mountPathDirectory the bundle is mounted to. Defaults to /etc/pki/ca-trust/extracted/pem.
collector.resourcesResources of the collector.
refarch-templates.modules.frontend.*Configuration of the frontend, see refarch-templates.
refarch-templates.refarch-gateway.*Configuration of the gateway, see refarch-gateway.

global.frost is global, because the collector and the gateway in the subchart both need it.

The image tags default to the released version with pullPolicy: IfNotPresent. For the latest build of main set image.tag: dev and image.pullPolicy: Always for the collector and the frontend.

Private CAs

If FROST has a certificate of a private CA, the collector and the gateway have to trust it.

The collector replaces the CA bundle of its image with collector.caCerts, so the bundle has to contain the public CAs as well, because the collector also fetches the public data source. On OpenShift, a ConfigMap labeled with config.openshift.io/inject-trusted-cabundle=true is filled with such a bundle under the key ca-bundle.crt:

oc create configmap trusted-ca
oc label configmap trusted-ca config.openshift.io/inject-trusted-cabundle=true
collector:
  caCerts:
    enabled: true
    existingConfigmap: trusted-ca

The gateway is a Java application and needs a Java truststore instead, mounted as in the refarch-templates example:

refarch-templates:
  refarch-gateway:
    volumes:
      - name: cacerts-volume
        secret:
          secretName: cacerts-lhm
          items:
            - key: cacerts-lhm
              path: cacerts
    volumeMounts:
      - name: cacerts-volume
        mountPath: /etc/pki/ca-trust/extracted/java
        readOnly: true

Example

Example for an environment:

global:
  frost:
    baseUrl: https://frost.example.com

collector:
  proxy: http://proxy.example.com:8080
  noProxy: frost.example.com

refarch-templates:
  modules:
    frontend:
      ingress:
        className: openshift-default
        annotations:
          route.openshift.io/termination: edge
        hosts:
          - host: parkhausradar.example.com
            paths:
              - path: /
                pathType: Prefix
  refarch-gateway:
    envAppend:
      - name: ALLOWED_ORIGINS_PUBLIC
        value: https://parkhausradar.example.com
    ingress:
      enabled: true
      className: openshift-default
      annotations:
        route.openshift.io/termination: edge
      hosts:
        - host: parkhausradar.example.com
          paths:
            - path: /api
              pathType: Prefix

Deploy parkhausradar with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has parkhausradar on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartparkhausradar is pinned at v0.2.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply