Skip to content

Commit

Permalink
get enable and beamline from global if defined
Browse files Browse the repository at this point in the history
  • Loading branch information
gilesknap committed Jul 11, 2024
1 parent 1fd8a0d commit ab1e2bf
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Charts/ioc-instance/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
apiVersion: v2
name: ioc-instance

version: 3.4.5
version: 3.5.4

type: application
20 changes: 13 additions & 7 deletions Charts/ioc-instance/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ Default the derivable substitution values.
This keeps the length of the values.txt file for each individual IOC
to a minimum
*/ -}}
{{- $location := default .Values.location .Values.beamline -}}
{{- $beamline := default .Values.global.beamline .Values.beamline -}}
{{- $enabled := default .Values.global.enable .Values.enabled -}}
{{- $location := default .Values.location $beamline -}}
{{- $ioc_group := default .Values.ioc_group $location -}}
{{- $opisClaim := default (print $ioc_group "-opi-claim") .Values.opisClaim -}}
{{- $runtimeClaim := default (print $ioc_group "-runtime-claim") .Values.runtimeClaim -}}
Expand All @@ -20,7 +22,11 @@ metadata:
ioc_group: {{ $ioc_group }}
is_ioc: "true"
spec:
{{ if ne $enabled false -}}
replicas: 1
{{- else -}}
replicas: 0
{{- end }}
podManagementPolicy: Parallel # force rollout from a failing state
selector:
matchLabels:
Expand Down Expand Up @@ -129,7 +135,7 @@ spec:
- name: IOC_LOCATION
value: {{ $location | quote }}
- name: BEAMLINE
value: {{ .Values.beamline | quote }}
value: {{ $beamline | quote }}
- name: IOC_GROUP
value: {{ $ioc_group | quote }}
{{- if .Values.globalEnv }}
Expand All @@ -145,12 +151,12 @@ spec:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
{{ if .Values.beamline -}}
{{ if $beamline -}}
- matchExpressions:
- key: beamline
operator: In
values:
- {{ .Values.beamline }}
- {{ $beamline }}
{{- else -}}
- matchExpressions:
- key: location
Expand All @@ -162,7 +168,7 @@ spec:
tolerations:
- key: beamline
operator: Equal
value: {{ .Values.beamline }}
value: {{ $beamline }}
effect: NoSchedule
- key: location
operator: Equal
Expand All @@ -181,8 +187,8 @@ metadata:
name: {{ .Release.Name }}-data
labels:
app: {{ .Release.Name }}
{{ if .Values.beamline -}}
beamline: {{ .Values.beamline }}
{{ if $beamline -}}
beamline: {{ $beamline }}
{{- else -}}
location: {{ .Values.location }}
{{- end }}
Expand Down
2 changes: 2 additions & 0 deletions Charts/ioc-instance/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ image: ""

# You MUST supply beamline for beamline IOCs or location for accelerator IOCs
# the beamline name - only set for beamlines
# NOTE: this value can also be set in global: instead on ioc-instance:
beamline: ""

# The location where the IOCs will run - same as beamline for beamlines
# For the accelerator this creates a label 'location' that should be used
# in taints and tolerances to limit the launch of this IOC to the desired
# servers.
# DEFAULT = $.Values.beamline
# NOTE: this value can also be set in global: instead on ioc-instance:
location: ""

################################################################################
Expand Down

0 comments on commit ab1e2bf

Please sign in to comment.