blob: 50c31845e1f3245edbaf5663c1553539bc8b64ea [file] [log] [blame]
Jack Lucasec09fd52021-11-01 16:54:12 -04001{{/*
2 ============LICENSE_START========================================================
3 =================================================================================
4 Copyright (c) 2021 J. F. Lucas. All rights reserved.
5 =================================================================================
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17 =============LICENSE_END=========================================================
18*/}}
19
20{{/*
21
22 This template generates a JSON file with an array containing the names of the
23 components that the healthcheck container always expects to see--that is, the
24 components that are enabled in the top-level values.yaml file.
25
26 The code loops through the list of components ($components) and checks each component's
27 entry in the values.yaml file is set to "enabled". It adds the name of each enabled
28 component to the list.
29
30 There is a bit of Helm trickery here--the code uses a dict ($enabled), because that's
31 apparently the only way to create a variable outside of a range loop that can be updated
32 from within the range loop. The code here generates a list of the components that are
33 enabled in values.yaml, and stores it into the list called "enabled" in the dictionary
34 $enabled.
35
36 Note also the assignment to an otherwise unused variable ($x) in the loop. Without that
37 assignment, the updated value of the $enabled.enabled list would be rendered into the
38 file each time an enabled component is found.
39
40*/}}
41
42{{- $ctx := . -}}
43{{- $components := list "dcae-cloudify-manager" "dcae-config-binding-service" "dcae-dashboard" "dcae-deployment-handler" "dcae-inventory-api" "dcae-policy-handler" "dcae-servicechange-handler" "dcae-ves-openapi-manager" -}}
44{{- $enabled := dict "enabled" list -}}
45{{- range $components -}}
46 {{- if index $ctx.Values . "enabled" -}}
47 {{- $x:= . | append $enabled.enabled | set $enabled "enabled" -}}
48 {{- end -}}
Jack Lucas8c3463e2020-06-12 18:36:55 -040049{{- end -}}
Jack Lucasec09fd52021-11-01 16:54:12 -040050{{- $enabled.enabled | toJson }}
51