Skip to content

Commit

Permalink
feat: Add support in helm for ds-modbus
Browse files Browse the repository at this point in the history
Signed-off-by: Kyle Morton <[email protected]>
  • Loading branch information
Kyle Morton committed Nov 29, 2022
1 parent b8e113c commit caa80d5
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Copyright (C) 2022 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
org.edgexfoundry.service: {{.Values.edgex.app.device.modbus}}
name: {{.Values.edgex.app.device.modbus}}
spec:
replicas: {{.Values.edgex.replicas.device.modbus}}
selector:
matchLabels:
org.edgexfoundry.service: {{.Values.edgex.app.device.modbus}}
strategy:
type: Recreate
template:
metadata:
labels:
org.edgexfoundry.service: {{.Values.edgex.app.device.modbus}}
spec:
{{- if and (eq .Values.edgex.security.enabled true) (or (eq .Values.edgex.storage.sharedVolumesAccessMode "ReadWriteOnce") (eq .Values.edgex.storage.useHostPath true))}}
affinity:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchLabels:
org.edgexfoundry.service: {{ .Values.edgex.app.secretstoresetup}}
topologyKey: "kubernetes.io/hostname"
{{- end}}
automountServiceAccountToken: false
containers:
- name: {{.Values.edgex.app.device.modbus}}
image: {{.Values.edgex.image.device.modbus.repository}}:{{.Values.edgex.image.device.modbus.tag}}
imagePullPolicy: {{.Values.edgex.image.device.modbus.pullPolicy}}
{{- if .Values.edgex.security.enabled }}
command: ["/edgex-init/ready_to_run_wait_install.sh"]
args: ["/device-modbus", "-cp=consul.http://edgex-core-consul:8500", "--registry", "--confdir=/res"]
{{- end}}
ports:
- containerPort: {{.Values.edgex.port.device.modbus}}
{{- if not .Values.edgex.security.enabled }}
hostPort: {{.Values.edgex.port.device.modbus}}
hostIP: {{.Values.edgex.hostPortInternalBind}}
{{- end}}
env:
- name: SERVICE_HOST
value: {{.Values.edgex.app.device.modbus}}
envFrom:
- configMapRef:
name: edgex-common-variables
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
startupProbe:
tcpSocket:
port: {{.Values.edgex.port.device.modbus}}
periodSeconds: 1
failureThreshold: 120
livenessProbe:
tcpSocket:
port: {{.Values.edgex.port.device.modbus}}
{{- if .Values.edgex.security.enabled }}
volumeMounts:
- mountPath: /edgex-init
name: edgex-init
- mountPath: /tmp/edgex/secrets
name: edgex-secrets
{{- end }}
{{- if .Values.edgex.resources.device.modbus.enforceLimits }}
resources:
limits:
memory: {{ .Values.edgex.resources.device.modbus.limits.memory }}
cpu: {{ .Values.edgex.resources.device.modbus.limits.cpu }}
requests:
memory: {{ .Values.edgex.resources.device.modbus.requests.memory }}
cpu: {{ .Values.edgex.resources.device.modbus.requests.cpu }}
{{- end}}
hostname: {{.Values.edgex.app.device.modbus}}
restartPolicy: Always
securityContext:
runAsNonRoot: true
runAsUser: {{ .Values.edgex.security.runAsUser }}
runAsGroup: {{ .Values.edgex.security.runAsGroup }}
{{- if .Values.edgex.security.enabled }}
volumes:
- name: edgex-init
persistentVolumeClaim:
claimName: edgex-init
- name: edgex-secrets
persistentVolumeClaim:
claimName: edgex-secrets
{{- end}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (C) 2022 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
apiVersion: v1
kind: Service
metadata:
labels:
org.edgexfoundry.service: {{.Values.edgex.app.device.modbus}}
name: {{.Values.edgex.app.device.modbus}}
spec:
ports:
- name: "{{.Values.edgex.port.device.modbus}}"
port: {{.Values.edgex.port.device.modbus}}
selector:
org.edgexfoundry.service: {{.Values.edgex.app.device.modbus}}
type: {{.Values.expose.type}}

21 changes: 18 additions & 3 deletions deployment/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ edgex:
onvifcamera: edgex-device-onvif-camera
usbcamera: edgex-device-usb-camera
mqtt: edgex-device-mqtt
modbus: edgex-device-modbus
ui: edgex-ui
system: edgex-sys-mgmt-agent
consul: edgex-core-consul
Expand Down Expand Up @@ -92,6 +93,10 @@ edgex:
repository: edgexfoundry/device-mqtt
tag: "2.3.0"
pullPolicy: IfNotPresent
modbus:
repository: edgexfoundry/device-modbus
tag: "2.3.0"
pullPolicy: IfNotPresent
ui:
repository: edgexfoundry/edgex-ui
tag: "2.3.0"
Expand Down Expand Up @@ -149,6 +154,7 @@ edgex:
usbcamera: 59983
onvifcamera: 59984
mqtt: 59982
modbus: 59901
system: 58890
ui: 4000
consul: 8500
Expand Down Expand Up @@ -188,6 +194,7 @@ edgex:
usbcamera: 0
onvifcamera: 0
mqtt: 0
modbus: 0
ui: 1
system: 1
consul: 1
Expand All @@ -202,9 +209,9 @@ edgex:
runAsUser: 2002
runAsGroup: 2001
tlsHost: edgex
addConsulRoles: "device-onvif-camera,device-usb-camera,device-mqtt"
addServiceTokens: "device-rest, device-virtual, device-onvif-camera, device-usb-camera, device-mqtt"
addKnownSecrets: "redisdb[app-rules-engine],redisdb[device-rest],redisdb[device-virtual],redisdb[device-onvif-camera],redisdb[device-usb-camera],redisdb[device-mqtt]"
addConsulRoles: "device-onvif-camera,device-usb-camera,device-mqtt,device-modbus"
addServiceTokens: "device-rest, device-virtual, device-onvif-camera, device-usb-camera, device-mqtt, device-modbus"
addKnownSecrets: "redisdb[app-rules-engine],redisdb[device-rest],redisdb[device-virtual],redisdb[device-onvif-camera],redisdb[device-usb-camera],redisdb[device-mqtt],redisdb[device-modbus]"

# resources defines the cpu and memory limits and requests for the respective application
resources:
Expand Down Expand Up @@ -300,6 +307,14 @@ edgex:
requests:
cpu: 0.5
memory: 256Mi
modbus:
enforceLimits: false
limits:
cpu: 1
memory: 512Mi
requests:
cpu: 0.5
memory: 256Mi
ui:
enforceLimits: false
limits:
Expand Down

0 comments on commit caa80d5

Please sign in to comment.