-
Notifications
You must be signed in to change notification settings - Fork 72
Pull request for FH helm charts #75
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| apiVersion: v2 | ||
| appVersion: 2.6.0-GA | ||
| description: A helm-chart for deploying FogHorn Lightning Edge | ||
| name: foghorn-edge | ||
| type: application | ||
| version: 2.6.0-GA | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| # edge-helm-chart | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. License and Copyright information is missing. |
||
|
|
||
| Helm chart for edge | ||
|
|
||
| ## Sample command with no edgeml: | ||
| `helm install edge . --set fhm.endpoint=192.168.56.142 --set edgeName=lightning-edge --namespace foghorn --create-namespace` | ||
|
|
||
| ## Sample command with ADVANCED3 edgeml: | ||
| `helm install edge . --set fhm.endpoint=192.168.56.142 --set edgeName=lightning-edge --set edgeml.type=ADVANCED3 --namespace foghorn --create-namespace` | ||
|
|
||
| ## Sample command with ADVANCED3 edgeml and arm32 architecture: | ||
| `helm install edge . --set fhm.endpoint=192.168.56.142 --set edgeName=lightning-edge --set edgeml.type=ADVANCED3 --set image.arch=-armv7l --namespace foghorn --create-namespace` | ||
|
|
||
| ## Sample command dry run: | ||
| `helm install edge . --set fhm.endpoint=192.168.56.142 --set edgeName=lightning-edge --dry-run --namespace foghorn --create-namespace` | ||
|
|
||
| ## Sample command to cleanup leftover resources manually | ||
| `kubectl delete service,deployment,job,pod,configmap,secret,pvc,pv,rolebinding,clusterrolebinding,role,clusterrole,sa -ledge.foghorn.io/managed-by=edge --namespace foghorn` | ||
|
|
||
| ## Sample command to cleanup pv and pvc that are stuck in terminating state | ||
| `kubectl patch pvc foghorn -p '{"metadata":{"finalizers":null}} --namespace foghorn` | ||
|
|
||
| ## Create Local Persistent Volumes(Not recommended in Production - workaround for test deployments) | ||
| Most deployments have default storageclass and provisioner already set like k3s, aks, gke etc. Incase it is not, please request cluster administrator to do so. A default storageclass and dynamic provisioner would make it easier to create and bind persistentvolumes to persistentvolumeclaims automatically. In case, a cluster does not have provisioner, the following yaml snippet can be applied to create perisistentvolumes manually. Add the snippet to a file and apply it using `kubectl apply -f <file name>`. | ||
|
|
||
|
|
||
| --- | ||
| apiVersion: v1 | ||
| kind: PersistentVolume | ||
| metadata: | ||
| name: influx-data | ||
| namespace: foghorn | ||
| labels: | ||
| type: local | ||
| spec: | ||
| storageClassName: manual | ||
| capacity: | ||
| storage: 10Gi | ||
| accessModes: | ||
| - ReadWriteOnce | ||
| hostPath: | ||
| path: "/opt/influx-data" | ||
|
|
||
| --- | ||
| apiVersion: v1 | ||
| kind: PersistentVolume | ||
| metadata: | ||
| name: foghorn | ||
| namespace: foghorn | ||
| labels: | ||
| type: local | ||
| spec: | ||
| storageClassName: manual | ||
| capacity: | ||
| storage: 10Gi | ||
| accessModes: | ||
| - ReadWriteOnce | ||
| hostPath: | ||
| path: "/opt/foghorn-data" | ||
| --- | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. License and Copyright information is missing. |
||
| "edgeProductVersion": "{{ .Values.image.tag }}", | ||
| "initiator": "{{ required "FHM endpoint is required" .Values.fhm.endpoint }}/ecm", | ||
| "registration": { | ||
| "edgeName": "{{ required "Edge name is required" .Values.edgeName }}" | ||
| }, | ||
| "perpetual": { | ||
| "edgeType": "{{ if eq .Values.edgeml.type "NONE"}}CEP{{ else }}STANDARD{{ end }}", | ||
| "edgeMLType": "{{ required "EdgeML type is required" .Values.edgeml.type }}", | ||
| "containerPlatform": "{{ required "ContainerPlatform type is required" .Values.containerPlatform.type }}" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| message-bus | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. License and Copyright information is missing. |
||
| edgemanager | ||
| mqtt-agent | ||
| mqtt-client | ||
| opc-agent | ||
| av-agent | ||
| modbus-agent | ||
| data-publisher | ||
| analytics-engine | ||
| logger | ||
| influxdb | ||
| opcda-agent | ||
| {{ if not (eq .Values.edgeml.type "NONE") }} | ||
| edgeml | ||
| {{ end }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| /fh_vol/fh/logs/*log | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. License and Copyright information is missing. |
||
| /fh_vol/fh/apps/*/logs/* | ||
| /fh_vol/fh/apps/*/log/* | ||
| { | ||
| rotate 2 | ||
| size 2M | ||
| compress | ||
| dateext | ||
| dateformat -%Y%m%d-%s | ||
| notifempty | ||
| copytruncate | ||
| missingok | ||
| su root root | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| #!/bin/sh | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. License and Copyright information is missing. |
||
|
|
||
| # this file is largely the default cron shell script for logrotate | ||
|
|
||
| THIS=$(basename $0) | ||
| cd $(dirname $0) | ||
| HERE=$(pwd) | ||
|
|
||
| # Configurable values | ||
| SAVE_CORES=3 | ||
| CORE_LOCATION=/fh_vol/fh/logs/cores | ||
|
|
||
| # Clean non existent log file entries from status file | ||
| test -e status || touch status | ||
| head -1 status > status.clean | ||
| sed 's/"//g' status | while read logfile date | ||
| do | ||
| [ -e "$logfile" ] && echo "\"$logfile\" $date" | ||
| done >> status.clean | ||
| mv status.clean status | ||
|
|
||
| # logrotate requires go-w; let's force it to be sure it never breaks | ||
| chmod 640 fh-log-rotate | ||
|
|
||
| if test -x /usr/sbin/logrotate; then | ||
| echo $(date -Iseconds) $THIS: running /usr/bin/logrotate fh-log-rotate | ||
| /usr/sbin/logrotate fh-log-rotate -s ./status | ||
| else | ||
| echo $THIS: ERROR: /usr/bin/logrotate does not exist. | ||
| fi | ||
|
|
||
| if test -d /fh_vol/fh/logs/cores; then | ||
| echo $(date -Iseconds) $THIS: removing core files from $CORE_LOCATION to not greater than $SAVE_CORES | ||
| ls -dA1t $CORE_LOCATION/* | tail -n +$(($SAVE_CORES + 1)) | xargs rm -f | ||
| fi | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| #!/bin/sh | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. License and Copyright information is missing. |
||
|
|
||
| # assume the following file exists, i.e., when run in a docker image, proper | ||
| # mounts exists: | ||
| # $LOGROTATE: see variable below | ||
|
|
||
| # docker stops containers with TERM so make sure we respond to it nicely | ||
| trap exit TERM | ||
|
|
||
| THIS=$(basename $0) | ||
| HERE=$(dirname $0) | ||
| cd $HERE | ||
|
|
||
| LOGROTATE=/fh_vol/fh/assets/logrotate/logrotate.sh | ||
|
|
||
| PERIOD_S=$((60*60)) # hourly | ||
|
|
||
| main() { | ||
| while [ 1 -eq 1 ]; do | ||
| $LOGROTATE | ||
| sleep $PERIOD_S & | ||
| wait $! | ||
| done | ||
| } | ||
|
|
||
| main | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| yes n | cp -i /fh_vol/fh/tmp/certs/license-ca.crt /fh_vol/fh/certs/ca/ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. License and Copyright information is missing. |
||
| yes n | cp -i /fh_vol/fh/tmp/certs/key.pem /fh_vol/fh/license/edge/ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These commands execution requires root privilege? Can you change to non-root user execution? |
||
| yes n | cp -i /fh_vol/fh/tmp/certs/cert.pem /fh_vol/fh/license/edge/ | ||
| yes n | cp -i /fh_vol/fh/tmp/certs/ca-cert.pem /fh_vol/fh/license/edge/ | ||
| yes n | cp -i /fh_vol/fh/tmp/configs/edge_properties.json /fh_vol/fh/configs/ | ||
| yes n | cp -i /fh_vol/fh/tmp/configs/em-container-list.txt /fh_vol/fh/configs/ | ||
| yes n | cp -i /fh_vol/fh/tmp/logrotate/fh-log-rotate /fh_vol/fh/assets/logrotate/ | ||
| yes n | cp -i /fh_vol/fh/tmp/logrotate/logrotate /fh_vol/fh/assets/logrotate/logrotate.sh | ||
| yes n | cp -i /fh_vol/fh/tmp/logrotate/logrotate-daemon /fh_vol/fh/assets/logrotate/logrotate_daemon.sh | ||
| chmod +x /fh_vol/fh/assets/logrotate/logrotate_daemon.sh | ||
| chmod +x /fh_vol/fh/assets/logrotate/logrotate.sh | ||
| echo n | cp -iR /fh_vol/fh/tmp/logger/. /fh_vol/fh/configs/logger/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. License and Copyright information is missing. |
||
| mkdir -p /fh_vol/fh/certs/ca | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Following commands are execute in root user ? OpenNESS 21.03 support non-root user execution. |
||
| mkdir -p /fh_vol/fh/tmp/certs | ||
| mkdir -p /fh_vol/fh/tmp/configs | ||
| mkdir -p /fh_vol/fh/tmp/logger | ||
| mkdir -p /fh_vol/fh/tmp/logrotate | ||
| mkdir -p /fh_vol/fh/downloads | ||
| mkdir -p /fh_vol/fh/configs | ||
| mkdir -p /fh_vol/fh/logs | ||
| mkdir -p /fh_vol/fh/apps | ||
| mkdir -p /fh_vol/fh/license/edge | ||
| mkdir -p /fh_vol/fh/license/edge/sol_bundle | ||
| mkdir -p /fh_vol/fh_host/downloads | ||
| mkdir -p /fh_vol/fh/vel | ||
| mkdir -p /fh_vol/fh/assets/logrotate | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Foghorn lightning edge installed successfully! | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. License and Copyright information is missing. |
||
|
|
||
| You can manage this edge using Foghorn Manager running at https://{{ .Values.fhm.endpoint }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| {{/* | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. License and Copyright information is missing. |
||
| Expand the name of the chart. | ||
| */}} | ||
| {{- define "foghorn-edge.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 "foghorn-edge.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 "foghorn-edge.chart" -}} | ||
| {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Common labels | ||
| */}} | ||
| {{- define "foghorn-edge.labels" -}} | ||
| helm.sh/chart: {{ include "foghorn-edge.chart" . }} | ||
| {{ include "foghorn-edge.selectorLabels" . }} | ||
| {{- if .Chart.AppVersion }} | ||
| app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
| {{- end }} | ||
| app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
| edge.foghorn.io/managed-by: {{ .Release.Name }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Selector labels | ||
| */}} | ||
| {{- define "foghorn-edge.selectorLabels" -}} | ||
| app.kubernetes.io/name: {{ include "foghorn-edge.name" . }} | ||
| app.kubernetes.io/instance: {{ .Release.Name }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Create the name of the service account to use | ||
| */}} | ||
| {{- define "foghorn-edge.serviceAccountName" -}} | ||
| {{- if .Values.serviceAccount.create }} | ||
| {{- default (include "foghorn-edge.fullname" .) .Values.serviceAccount.name }} | ||
| {{- else }} | ||
| {{- default "default" .Values.serviceAccount.name }} | ||
| {{- end }} | ||
| {{- end }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| apiVersion: v1 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. License and Copyright information is missing. |
||
| kind: Secret | ||
| metadata: | ||
| annotations: | ||
| "helm.sh/hook": "pre-install" | ||
| "helm.sh/hook-weight": "-14" | ||
| name: address-secret-file | ||
| namespace: {{ .Release.Namespace }} | ||
| labels: | ||
| {{- include "foghorn-edge.labels" . | nindent 4 }} | ||
| type: Opaque | ||
| data: | ||
| address: {{ uuidv4 | b64enc }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| apiVersion: apps/v1 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. License and Copyright information is missing. |
||
| kind: Deployment | ||
| metadata: | ||
| labels: | ||
| {{- include "foghorn-edge.labels" . | nindent 4 }} | ||
| service.name: {{ .Values.analyticsEngine.serviceName }} | ||
| name: {{ .Values.analyticsEngine.serviceName }} | ||
| namespace: {{ .Release.Namespace }} | ||
| spec: | ||
| replicas: {{ .Values.analyticsEngine.replicaCount }} | ||
| selector: | ||
| matchLabels: | ||
| service.name: {{ .Values.analyticsEngine.serviceName }} | ||
| strategy: | ||
| type: Recreate | ||
| template: | ||
| metadata: | ||
| labels: | ||
| {{- include "foghorn-edge.labels" . | nindent 8 }} | ||
| service.name: {{ .Values.analyticsEngine.serviceName }} | ||
| edge.foghorn.io/app-name: {{ .Values.analyticsEngine.serviceName }} | ||
| spec: | ||
| affinity: | ||
| podAffinity: | ||
| requiredDuringSchedulingIgnoredDuringExecution: | ||
| - labelSelector: | ||
| matchExpressions: | ||
| - key: edge.foghorn.io/app-name | ||
| operator: In | ||
| values: | ||
| - {{ .Values.messageBus.serviceName }} | ||
| topologyKey: "kubernetes.io/hostname" | ||
| imagePullSecrets: | ||
| - name: {{ .Values.image.pullSecret }} | ||
| containers: | ||
| - env: | ||
| - name: AE_COLLECTOR_LIMIT | ||
| value: "{{ .Values.analyticsEngine.collectorLimit }}" | ||
| - name: AE_MEMORY_WATERMARK_HIGH | ||
| value: "{{ .Values.analyticsEngine.memoryWaterMarkHigh }}" | ||
| - name: AE_MEMORY_WATERMARK_LOW | ||
| value: "{{ .Values.analyticsEngine.memoryWaterMarkLow }}" | ||
| - name: COMPONENT_NAME | ||
| value: {{ .Values.analyticsEngine.componentName }} | ||
| - name: MESSAGE_BUS_HOST | ||
| value: {{ .Values.messageBus.componentName }} | ||
| - name: WORKERS | ||
| value: "{{ .Values.messageBus.workers }}" | ||
| image: {{ .Values.image.repository }}/{{ .Values.image.releasesSubRepository }}{{ .Values.analyticsEngine.imageName }}{{ .Values.image.arch }}:{{ .Values.image.tag }} | ||
| imagePullPolicy: {{ .Values.image.imagePullPolicy }} | ||
| name: {{ .Values.analyticsEngine.componentName }} | ||
| resources: {} | ||
| volumeMounts: | ||
| - mountPath: /fh_vol | ||
| name: {{ .Values.volume.foghorn.name }} | ||
| restartPolicy: Always | ||
| serviceAccountName: "" | ||
| volumes: | ||
| - name: {{ .Values.volume.foghorn.name }} | ||
| persistentVolumeClaim: | ||
| claimName: {{ .Values.volumeClaim.foghorn.name }} | ||
| status: {} | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
License and Copyright information is missing.
open-ness/edgeapps repo hosts the open source edge applications. The license must be open source License.