-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
273 additions
and
2,277 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +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 | ||
name: ec-gateways | ||
version: 1.0.0 | ||
|
||
type: application |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# gateways | ||
|
||
PVA and CA gateway services running in two containers in a single pod, with single service exposing both on different ports. | ||
|
||
To deploy this (for now - eventually we should have a oci helm chart for these): | ||
|
||
```bash | ||
helm upgrade --install gateways services/gateways | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Default configuration for the gateways. | ||
|
||
Mount this folder as a configMap over /config to override these defaults. |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/usr/bin/env python | ||
|
||
""" | ||
Prints a list of cluster IPs of IOCs running in the current namespace. | ||
""" | ||
|
||
import argparse | ||
|
||
from kubernetes import client, config | ||
|
||
|
||
def get_ioc_ips(v1: client.CoreV1Api): | ||
"""Get the list cluster IPs of IOCs running in a namespace | ||
Args: | ||
v1: kubernetes client | ||
namespace: namespace to get the IOCs from | ||
""" | ||
ips = set() | ||
|
||
# get the current namespace | ||
ns_path = "/var/run/secrets/kubernetes.io/serviceaccount/namespace" | ||
with open(ns_path) as f: | ||
current_namespace = f.read().strip() | ||
|
||
# get the pods in the namespace | ||
ret = v1.list_namespaced_pod(current_namespace) | ||
for pod in ret.items: | ||
if "is_ioc" in pod.metadata.labels: | ||
ips.add(pod.status.pod_ip) | ||
|
||
return ips | ||
|
||
|
||
def main(): | ||
args = parse_args() | ||
|
||
# configure K8S and make a Core API client | ||
config.load_incluster_config() | ||
v1 = client.CoreV1Api() | ||
|
||
ips = get_ioc_ips(v1) | ||
ip_str = args.sep.join(ips) | ||
|
||
print(ip_str) | ||
|
||
|
||
def parse_args(): | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("--sep", type=str, default=" ") | ||
return parser.parse_args() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* pvagw configuration template | ||
* | ||
* requires replacement of IOC server address list for gw client side | ||
* and SERVER PORT for gw server side | ||
* | ||
*/ | ||
{ | ||
"version":2, | ||
"readOnly":false, | ||
"clients":[ | ||
{ | ||
"name":"theclient", | ||
"provider":"pva", | ||
"addrlist":"PVA_ADDR_LIST", | ||
"autoaddrlist":false, | ||
"serverport":5075, | ||
"bcastport":5076 | ||
} | ||
], | ||
"servers":[ | ||
{ | ||
"name":"theserver", | ||
"clients":["theclient"], | ||
/* "interface":["127.0.0.1"], */ | ||
/* "addrlist":"127.255.255.255", */ | ||
"autoaddrlist":false, | ||
"serverport":PVA_SERVER_PORT, | ||
/* "bcastport":5076, */ | ||
"statusprefix":"sts:" | ||
/* "access":"some.acf", */ | ||
/* "pvlist":"some.pvlist", */ | ||
} | ||
] | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
# IP lists for IOCS (blank if get_ioc_ips.py fails) | ||
export IPS="$(python3 /config/get_ioc_ips.py)" | ||
export EPICS_CA_ADDR_LIST=${IPS:-127.0.0.1} | ||
|
||
# PORTS for CA and PVA | ||
export CA_SERVER_PORT=${CA_SERVER_PORT:-5064} | ||
export PVA_SERVER_PORT=${PVA_SERVER_PORT:-5075} | ||
|
||
# DEBUGGING | ||
CA_DEBUG=${CA_DEBUG:-0} | ||
PVA_DEBUG=${PVA_DEBUG:-0} | ||
|
||
# don't pass -cip if EPICS_CA_AUTO_ADDR_LIST is YES | ||
if [[ EPICS_CA_AUTO_ADDR_LIST == "NO" ]]; then | ||
cip="-cip ${EPICS_CA_ADDR_LIST}" | ||
fi | ||
|
||
# start the CA Gateway | ||
/epics/ca-gateway/bin/linux-x86_64/gateway -sport ${CA_SERVER_PORT} $cip \ | ||
-pvlist /config/pvlist -access /config/access \ | ||
-log /dev/stdout -debug ${CA_DEBUG:-0} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
# IP lists for IOCS (blank if get_ioc_ips.py fails) | ||
export IPS="$(python3 /config/get_ioc_ips.py)" | ||
export EPICS_PVA_ADDR_LIST=${IPS:-127.0.0.1} | ||
export EPICS_CA_ADDR_LIST=${IPS:-127.0.0.1} | ||
|
||
# PORTS for CA and PVA | ||
export CA_SERVER_PORT=${CA_SERVER_PORT:-5064} | ||
export PVA_SERVER_PORT=${PVA_SERVER_PORT:-5075} | ||
|
||
# DEBUGGING | ||
CA_DEBUG=${CA_DEBUG:-0} | ||
PVA_DEBUG=${PVA_DEBUG:-0} | ||
|
||
# fix up the templated pva gateway config | ||
cat /config/pvagw.template | | ||
sed \ | ||
-e "s/PVA_ADDR_LIST/${EPICS_PVA_ADDR_LIST}/" \ | ||
-e "s/PVA_SERVER_PORT/${PVA_SERVER_PORT}/" \ | ||
> /tmp/pvagw.config | ||
|
||
# background the PVA Gateway | ||
pvagw /tmp/pvagw.config |
File renamed without changes.
Oops, something went wrong.