diff --git a/.copier-answers.yml b/.copier-answers.yml new file mode 100644 index 0000000..b75dd85 --- /dev/null +++ b/.copier-answers.yml @@ -0,0 +1,13 @@ +# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY +_commit: 4.0.1 +_src_path: gh:epics-containers/services-template-helm +cluster_name: pollux +cluster_namespace: p45-beamline +cluster_type: dls_cluster +description: p45 IOC Instances and Services +git_platform: github.com +github_org: epics-containers +ioc_group: p45 +location: bl45p +logging_url: https://graylog2.diamond.ac.uk/search?rangetype=relative&fields=message%2Csource&width=1489&highlightMessage=&relative=172800&q=pod_name%3A{service_name}* +repo_uri: https://github.com/epics-containers/p45-services diff --git a/.github/workflows/ci_skip_checks b/.github/workflows/ci_skip_checks new file mode 100644 index 0000000..49dddfe --- /dev/null +++ b/.github/workflows/ci_skip_checks @@ -0,0 +1 @@ +daq-nexus diff --git a/.github/workflows/ci_verify.sh b/.github/workflows/ci_verify.sh index 2b71890..922c240 100755 --- a/.github/workflows/ci_verify.sh +++ b/.github/workflows/ci_verify.sh @@ -8,14 +8,45 @@ # other future services that don't use ibek, we will need to add a standard # entrypoint for validating the config folder mounted at /config. -ROOT=$(realpath $(dirname ${0})/../..) +HERE=$(realpath $(dirname ${0})) +ROOT=$(realpath ${HERE}/../..) set -xe +rm -rf ${ROOT}/.ci_work/ +mkdir -p ${ROOT}/.ci_work # use docker if available else use podman if ! docker version &>/dev/null; then docker=podman; else docker=docker; fi -for service in ${ROOT}/services/* +# copy the services to a temporary location to avoid dirtying the repo +cp -r ${ROOT}/services/* ${ROOT}/.ci_work/ + +for service in ${ROOT}/services/*/ # */ to skip files do + ### Lint each service chart and validate if schema given ### + service_name=$(basename $service) + + # skip services appearing in ci_skip_checks + checks=${HERE}/ci_skip_checks + if [[ -f ${checks} ]] && grep -q ${service_name} ${checks}; then + echo "Skipping ${service_name}" + continue + fi + + schema=$(cat ${service}/values.yaml | sed -rn 's/^# yaml-language-server: \$schema=(.*)/\1/p') + if [ -n "${schema}" ]; then + echo "{\"\$ref\": \"$schema\"}" > ${ROOT}/.ci_work/$service_name/values.schema.json + fi + + $docker run --rm --entrypoint bash \ + -v ${ROOT}/.ci_work:/services \ + alpine/helm:3.14.3 \ + -c " + helm lint /services/$service_name --values /services/values.yaml && + helm dependency update /services/$service_name && + rm -rf /services/$service_name/charts + " + + ### Valiate each ioc config ### # Skip if subfolder has no config to validate if [ ! -f "${service}/config/ioc.yaml" ]; then continue @@ -27,10 +58,20 @@ do if [ -n "${image}" ]; then echo "Validating ${service} with ${image}" + runtime=/tmp/ioc-runtime/$(basename ${service}) + mkdir -p ${runtime} + # This will fail and exit if the ioc.yaml is invalid $docker run --rm --entrypoint bash \ - -v ${service}/config:/config ${image} \ + -v ${service}/config:/config \ + -v ${runtime}:/epics/runtime \ + ${image} \ -c 'ibek runtime generate /config/ioc.yaml /epics/ibek-defs/*' + # show the startup script we just generated (and verify it exists) + cat ${runtime}/st.cmd fi + done + +rm -r ${ROOT}/.ci_work diff --git a/.gitignore b/.gitignore index 842d6fc..7777862 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ +**/*.tz +**/*.tgz .history -**/*.bob -edm/bobs -**/*copy -**/charts/*tgz +venv* +.venv* **/Chart.lock +**/charts +**/*copy +.ci_work \ No newline at end of file diff --git a/README.md b/README.md index e9297ce..f94e8b4 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,3 @@ -# beamline bl45p IOC Instances and Services - -This repository holds the a definition of beamline bl45p IOC Instances and services. Each sub folder of the `services` directory contains a helm chart for a specific service or IOC. - -The respository is deployed into the beamline cluster using Argo CD which keeps the cluster namespace bl45p in sync with the contents of this repo. - -See apps.yaml for the root app of apps description. +# p45 IOC Instances and Services +This repository holds the a definition of p45 IOC Instances and services. Each sub folder of the `services` directory contains a helm chart for a specific service or IOC. \ No newline at end of file diff --git a/environment.sh b/environment.sh index a1f6109..09096b4 100644 --- a/environment.sh +++ b/environment.sh @@ -1,7 +1,7 @@ #!/bin/bash # a bash script to source in order to set up your command line to in order -# to work with the bl45p IOCs and Services. +# to work with the p45 IOCs and Services. # check we are sourced if [ "$0" = "$BASH_SOURCE" ]; then @@ -9,28 +9,17 @@ if [ "$0" = "$BASH_SOURCE" ]; then exit 1 fi -echo "Loading environment for beamline bl45p IOC Instances and Services ..." +echo "Loading environment for p45 IOC Instances and Services ..." #### SECTION 1. Environment variables ########################################## -# a mapping between generic IOC repo roots and the related container registry -# use spaces or line breaks to separate multiple mappings by default this -# inlcudes mappings for github and DLS gitlab, add your own here. -export EC_REGISTRY_MAPPING_REGEX=' -.*github.com:(.*)\/(.*) ghcr.io/\1/\2 -.*gitlab.diamond.ac.uk.*\/(.*) gcr.io/diamond-privreg/controls/prod/ioc/\1 -' -# the namespace to use for kubernetes deployments - use local for local docker/podman -export EC_NAMESPACE=bl45p +export EC_CLI_BACKEND="K8S" +# the namespace to use for kubernetes deployments +export EC_TARGET=p45-beamline # the git repo for this project -export EC_SERVICES_REPO=git@github.com:epics-containers/bl45p.git +export EC_SERVICES_REPO=https://github.com/epics-containers/p45-services # declare your centralised log server Web UI -export EC_LOG_URL="https://graylog.diamond.ac.uk/search?rangetype=relative&fields=message%2Csource&width=1489&highlightMessage=&relative=172800&q=pod_name%3A{service_name}*" -# enforce a specific container cli - defaults to whatever is available -# export EC_CONTAINER_CLI=podman -# enable debug output in all 'ec' commands -# export EC_DEBUG=1 - +export EC_LOG_URL="https://graylog2.diamond.ac.uk/search?rangetype=relative&fields=message%2Csource&width=1489&highlightMessage=&relative=172800&q=pod_name%3A{service_name}*" #### SECTION 2. Install ec ##################################################### @@ -46,12 +35,13 @@ source <(ec --show-completion ${SHELL}) #### SECTION 3. Configure Kubernetes Cluster ################################### + # the following configures kubernetes inside DLS. module unload pollux > /dev/null module load pollux > /dev/null # set the default namespace for kubectl and helm (for convenience only) -kubectl config set-context --current --namespace=bl45p +kubectl config set-context --current --namespace=p45-beamline # make sure the user has provided credentials kubectl version @@ -59,4 +49,4 @@ kubectl version # enable shell completion for k8s tools if [ -n "$ZSH_VERSION" ]; then SHELL=zsh; fi source <(helm completion $(basename ${SHELL})) -source <(kubectl completion $(basename ${SHELL})) \ No newline at end of file +source <(kubectl completion $(basename ${SHELL})) diff --git a/services/bl45p-ea-dcam-01/Chart.yaml b/services/bl45p-ea-dcam-01/Chart.yaml index bd47eb5..f011ad8 100644 --- a/services/bl45p-ea-dcam-01/Chart.yaml +++ b/services/bl45p-ea-dcam-01/Chart.yaml @@ -7,7 +7,7 @@ type: application dependencies: - name: ioc-instance - version: 4.0.0 + version: 4.1.2 repository: "oci://ghcr.io/epics-containers" # dls-aravis is locally available via symlink in the charts directory - name: dls-aravis diff --git a/services/bl45p-ea-dcam-01/values.yaml b/services/bl45p-ea-dcam-01/values.yaml index 3ae5c10..b291c7f 100644 --- a/services/bl45p-ea-dcam-01/values.yaml +++ b/services/bl45p-ea-dcam-01/values.yaml @@ -1,10 +1,8 @@ -# Arguments to the shared ioc instance template dls-aravis -# This will make an IOC instance for an aravis camera with a standard set -# of Areadetector plugins. +# yaml-language-server: $schema=https://github.com/epics-containers/ec-helm-charts/releases/download/4.1.2/ioc-instance.schema.json dls-aravis: P: BL45P-EA-MAP-01 ID: bl45p-ea-detector-01 ioc-instance: - image: ghcr.io/epics-containers/ioc-adaravis-runtime:2024.7.1 + image: ghcr.io/epics-containers/ioc-adaravis-runtime:2024.11.1 diff --git a/services/bl45p-ea-dcam-02/Chart.yaml b/services/bl45p-ea-dcam-02/Chart.yaml index 17fd24d..ebc8b1c 100644 --- a/services/bl45p-ea-dcam-02/Chart.yaml +++ b/services/bl45p-ea-dcam-02/Chart.yaml @@ -7,7 +7,7 @@ type: application dependencies: - name: ioc-instance - version: 4.0.0 + version: 4.1.2 repository: "oci://ghcr.io/epics-containers" # dls-aravis is locally available via symlink in the charts directory - name: dls-aravis diff --git a/services/bl45p-ea-dcam-02/values.yaml b/services/bl45p-ea-dcam-02/values.yaml index 9dafe07..18d7f40 100644 --- a/services/bl45p-ea-dcam-02/values.yaml +++ b/services/bl45p-ea-dcam-02/values.yaml @@ -1,3 +1,5 @@ +# yaml-language-server: $schema=https://github.com/epics-containers/ec-helm-charts/releases/download/4.1.2/ioc-instance.schema.json + # Arguments to the shared ioc instance template dls-aravis # This will make an IOC instance for an aravis camera with a standard set # of Areadetector plugins. @@ -7,4 +9,5 @@ dls-aravis: ID: bl45p-ea-detector-02 ioc-instance: - image: ghcr.io/epics-containers/ioc-adaravis-runtime:2024.7.1 + image: ghcr.io/epics-containers/ioc-adaravis-runtime:2024.11.1 + location: bl45p # TODO remove me when schema is fixed diff --git a/services/bl45p-mo-brick-01/Chart.yaml b/services/bl45p-mo-brick-01/Chart.yaml index 5732737..2ed3edd 100644 --- a/services/bl45p-mo-brick-01/Chart.yaml +++ b/services/bl45p-mo-brick-01/Chart.yaml @@ -7,5 +7,5 @@ type: application dependencies: - name: ioc-instance - version: 4.0.0 - repository: "oci://ghcr.io/epics-containers" \ No newline at end of file + version: 4.1.2 + repository: "oci://ghcr.io/epics-containers" diff --git a/services/bl45p-mo-brick-01/config/ioc.yaml b/services/bl45p-mo-brick-01/config/ioc.yaml index 62b0723..c400edc 100644 --- a/services/bl45p-mo-brick-01/config/ioc.yaml +++ b/services/bl45p-mo-brick-01/config/ioc.yaml @@ -1,11 +1,14 @@ # yaml-language-server: $schema=https://github.com/epics-containers/ioc-pmac/releases/download/2024.3.1/ibek.ioc.schema.json -# todo update ioc-pmac to latest ibek (__utils__ is old) -ioc_name: "{{ __utils__.get_env('IOC_NAME') }}" +ioc_name: "{{ _global.get_env('IOC_NAME') }}" description: auto-generated by https://github.com/epics-containers/builder2ibek entities: + - type: epics.EpicsEnvSet + name: EPICS_TZ + value: "GMT0BST" + - type: epics.EpicsCaMaxArrayBytes max_bytes: 6000000 diff --git a/services/bl45p-mo-brick-01/values.yaml b/services/bl45p-mo-brick-01/values.yaml index eea6cd4..d4d84ba 100644 --- a/services/bl45p-mo-brick-01/values.yaml +++ b/services/bl45p-mo-brick-01/values.yaml @@ -1,7 +1,6 @@ -# yaml-language-server: $schema=https://github.com/marcelldls/ec-helm-charts/releases/download/3.4.4/ioc-instance.schema.json#/$defs/service +# yaml-language-server: $schema=https://github.com/epics-containers/ec-helm-charts/releases/download/4.1.2/ioc-instance.schema.json/#/$defs/service # latest container image for the pmac motion controller ioc-instance: - image: ghcr.io/epics-containers/ioc-pmac-runtime:2024.5.1 - - + image: ghcr.io/epics-containers/ioc-pmac-runtime:2024.9.1 + location: bl45p # TODO remove me when schema is fixed diff --git a/services/bl45p-mo-panda-01/Chart.yaml b/services/bl45p-mo-panda-01/Chart.yaml index 5732737..2ed3edd 100644 --- a/services/bl45p-mo-panda-01/Chart.yaml +++ b/services/bl45p-mo-panda-01/Chart.yaml @@ -7,5 +7,5 @@ type: application dependencies: - name: ioc-instance - version: 4.0.0 - repository: "oci://ghcr.io/epics-containers" \ No newline at end of file + version: 4.1.2 + repository: "oci://ghcr.io/epics-containers" diff --git a/services/bl45p-mo-panda-01/values.yaml b/services/bl45p-mo-panda-01/values.yaml index 0a0eb58..89cd342 100644 --- a/services/bl45p-mo-panda-01/values.yaml +++ b/services/bl45p-mo-panda-01/values.yaml @@ -1,10 +1,11 @@ -# yaml-language-server: $schema=https://github.com/marcelldls/ec-helm-charts/releases/download/3.4.4/ioc-instance.schema.json#/$defs/service +# yaml-language-server: $schema=https://github.com/epics-containers/ec-helm-charts/releases/download/4.1.2/ioc-instance.schema.json/#/$defs/service # latest container image for GigE cameras from the GitHub Container Registry ioc-instance: - image: ghcr.io/pandablocks/pandablocks-ioc:0.9.0 + image: ghcr.io/pandablocks/pandablocks-ioc:0.11.2 # this causes our config folder's start.sh to be mounted over the default # /epics/ioc/start.sh - thus making the pandaBlocks container image have # the same entrypoint as ioc-template based images iocConfig: /epics/ioc + location: bl45p # TODO remove me when schema is fixed diff --git a/services/bl45p-mo-panda-02/Chart.yaml b/services/bl45p-mo-panda-02/Chart.yaml index 5732737..2ed3edd 100644 --- a/services/bl45p-mo-panda-02/Chart.yaml +++ b/services/bl45p-mo-panda-02/Chart.yaml @@ -7,5 +7,5 @@ type: application dependencies: - name: ioc-instance - version: 4.0.0 - repository: "oci://ghcr.io/epics-containers" \ No newline at end of file + version: 4.1.2 + repository: "oci://ghcr.io/epics-containers" diff --git a/services/bl45p-mo-panda-02/values.yaml b/services/bl45p-mo-panda-02/values.yaml index 0a0eb58..89cd342 100644 --- a/services/bl45p-mo-panda-02/values.yaml +++ b/services/bl45p-mo-panda-02/values.yaml @@ -1,10 +1,11 @@ -# yaml-language-server: $schema=https://github.com/marcelldls/ec-helm-charts/releases/download/3.4.4/ioc-instance.schema.json#/$defs/service +# yaml-language-server: $schema=https://github.com/epics-containers/ec-helm-charts/releases/download/4.1.2/ioc-instance.schema.json/#/$defs/service # latest container image for GigE cameras from the GitHub Container Registry ioc-instance: - image: ghcr.io/pandablocks/pandablocks-ioc:0.9.0 + image: ghcr.io/pandablocks/pandablocks-ioc:0.11.2 # this causes our config folder's start.sh to be mounted over the default # /epics/ioc/start.sh - thus making the pandaBlocks container image have # the same entrypoint as ioc-template based images iocConfig: /epics/ioc + location: bl45p # TODO remove me when schema is fixed diff --git a/services/dls-aravis/config/ioc.yaml b/services/dls-aravis/config/ioc.yaml index b5a5070..ad00c37 100644 --- a/services/dls-aravis/config/ioc.yaml +++ b/services/dls-aravis/config/ioc.yaml @@ -5,6 +5,10 @@ ioc_name: "[[ _global.get_env('IOC_NAME') ]]" description: shared template for all Aravis cameras on p45 entities: + - type: epics.EpicsEnvSet + name: EPICS_TZ + value: "GMT0BST" + - type: epics.EpicsCaMaxArrayBytes max_bytes: 6000000 @@ -16,7 +20,7 @@ entities: IOC: "[[ ioc_name | upper ]]" - type: ADAravis.aravisCamera - CLASS: {{ .Values.CLASS}} + CLASS: {{ .Values.CLASS }} ID: {{ .Values.ID }} P: {{ .Values.P }} PORT: DET.DET diff --git a/services/p45-ea-test-01/Chart.yaml b/services/p45-ea-test-01/Chart.yaml index 5732737..2ed3edd 100644 --- a/services/p45-ea-test-01/Chart.yaml +++ b/services/p45-ea-test-01/Chart.yaml @@ -7,5 +7,5 @@ type: application dependencies: - name: ioc-instance - version: 4.0.0 - repository: "oci://ghcr.io/epics-containers" \ No newline at end of file + version: 4.1.2 + repository: "oci://ghcr.io/epics-containers" diff --git a/services/values.yaml b/services/values.yaml index dee3839..488935d 100644 --- a/services/values.yaml +++ b/services/values.yaml @@ -1,4 +1,5 @@ -# shared beamline values for all services +# yaml-language-server: $schema=https://github.com/epics-containers/ec-helm-charts/releases/download/4.1.2/ioc-instance.schema.json/#/$defs/service +# shared values for all services global: ioc_group: p45 @@ -9,6 +10,7 @@ ioc-instance: # useHostNetwork - use host network for IOC - required for Channel Access # to work outside of the cluster hostNetwork: true + location: bl45p # TODO remove me when schema is fixed # affinity and tolerations to get the right nodes on pollux securityContext: @@ -19,7 +21,15 @@ ioc-instance: pvc: false hostPath: /dls/p45/data - useAffinity: true + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: beamline + operator: In + values: + - bl45p tolerations: - key: beamline @@ -33,4 +43,4 @@ ioc-instance: - key: nodetype operator: Equal value: test-rig - effect: NoSchedule \ No newline at end of file + effect: NoSchedule