Skip to content

Commit

Permalink
add a cagateway
Browse files Browse the repository at this point in the history
  • Loading branch information
gilesknap committed Aug 23, 2024
1 parent 7af627a commit e580b66
Show file tree
Hide file tree
Showing 8 changed files with 176 additions and 1 deletion.
7 changes: 7 additions & 0 deletions services/cagateway/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# A Helm Chart for a ca-gateway service
# This is hard coded into the module right now TODO: make a oci chart for this
apiVersion: v2
name: ec-gateway
version: 1.0.0

type: application
59 changes: 59 additions & 0 deletions services/cagateway/compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# When deploying IOCs to a server with docker, the choice is:
#
# 1. Use host network so their PVs available on the subnet
# 2. Run a ca-gateway on each server and add all servers to client's
# EPICS_CA_ADDR_LIST
#
# at present the only available option for podman is to use host network

services:

# ca-gateway for development #################################################

ca-gateway: &ca-gateway

image: ghcr.io/epics-containers/docker-ca-gateway:2.1.3ec1

expose:
- 5064-5065/udp
- 5064-5065

ports:
# bind to localhost to isolate channel access to this host only
- 127.0.0.1:5064:5064/udp
- 127.0.0.1:5064-5065:5064-5065

restart: unless-stopped

networks:
channel_access:
ipv4_address: 172.20.255.254

configs:
- source: ca-gateway_config
target: /config

command: -cip 172.20.255.255 -pvlist /config/pvlist -access /config/access -log /dev/stdout -debug 1

profiles:
- develop

# per server ca-gateway for deployment #######################################
ca-gateway-deploy:

<<: *ca-gateway

ports:
# TODO - drop the IP address but also set up pvlist to make sure there
# are no loops - I need to look into safe config for per server ca-gateways
- 127.0.0.1:5064:5064/udp
- 127.0.0.1:5064-5065:5064-5065

command: -cip 172.20.255.255 -pvlist /config/pvlist -access /config/access -log /dev/stdout -debug 1

profiles:
- deploy

configs:
ca-gateway_config:
file: ./config
6 changes: 6 additions & 0 deletions services/cagateway/config/access
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# See /EPICS/extensions/src/gateway/GATEWAY.access for more detailed example

ASG(DEFAULT) {
RULE(1,READ)
RULE(1,WRITE)
}
9 changes: 9 additions & 0 deletions services/cagateway/config/pvlist
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# See /EPICS/extensions/src/gateway/GATEWAY.pvlist for more detailed example

EVALUATION ORDER ALLOW, DENY

BL47P.* ALLOW

# [0-9].* ALLOW
# [a-z].* ALLOW
# [A-Z].* ALLOW
10 changes: 10 additions & 0 deletions services/cagateway/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-config
labels:
app: {{ .Release.Name }}
data:

# contents of the ioc instance config folder
{{ (.Files.Glob "config/*").AsConfig | indent 2 }}
83 changes: 83 additions & 0 deletions services/cagateway/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: {{ .Release.Name }}
enabled: 'true'
ioc_group: p47
is_ioc: 'true'
location: bl47p
name: {{ .Release.Name }}
namespace: p47-beamline
spec:
replicas: 1
selector:
matchLabels:
app: {{ .Release.Name }}
template:
metadata:
creationTimestamp: null
labels:
app: {{ .Release.Name }}
ioc_group: p47
is_ioc: 'true'
location: bl47p
rollme: goWO0
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: beamline
operator: In
values:
- bl47p
containers:
- command:
- -sport 6064 -cip 172.23.255.255 -pvlist /config/pvlist -access /config/access -log /dev/stdout -debug 1
env:
- name: IOC_NAME
value: {{ .Release.Name }}
- name: IOC_LOCATION
value: bl47p
- name: IOC_GROUP
value: p47
image: {{ .Values.image }}
imagePullPolicy: Always
name: {{ .Release.Name }}
resources:
limits:
cpu: 500m
memory: 256Mi
requests:
cpu: 100m
memory: 64Mi
securityContext:
allowPrivilegeEscalation: false
stdin: true
tty: true
volumeMounts:
- mountPath: /config
name: config-volume
hostNetwork: true
restartPolicy: Always
terminationGracePeriodSeconds: 3
tolerations:
- effect: NoSchedule
key: beamline
operator: Equal
value: bl47p
- effect: NoSchedule
key: location
operator: Equal
value: bl47p
- effect: NoSchedule
key: nodetype
operator: Equal
value: training-rig
volumes:
- configMap:
defaultMode: 420
name: {{ .Release.Name }}-config
name: config-volume
1 change: 1 addition & 0 deletions services/cagateway/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
image: ghcr.io/epics-containers/docker-ca-gateway:2.1.3ec1
2 changes: 1 addition & 1 deletion services/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ global:
ioc-instance:
# useHostNetwork - use host network for IOC - required for Channel Access
# to work outside of the cluster
hostNetwork: true
hostNetwork: false

# affinity and tolerations to get the right nodes on pollux
securityContext:
Expand Down

0 comments on commit e580b66

Please sign in to comment.