Jesus Vidal
Jesus Vidal

Reputation: 445

Helm template cannot use index along with if or statement

I have attributes that include dashes in their names, which I don't have any issue while using them along with index i.e:

{{ toYaml index .Values.myService "my-service-config" | b64enc }}

However, if I want to use an if or for multiple evaluations, I cannot successfully use index for them, i.e:

{{- if or index .Values.serviceA.appyml .Values.serviceB.log4j2xml .Values.serviceC "some-service-configyml" .Values.serviceC "another-serviceyml" }}

I receive the error message:

at <index>: wrong number of args for index: want at least 1 got 0

Upvotes: 1

Views: 1951

Answers (1)

Jesus Vidal
Jesus Vidal

Reputation: 445

I had to use index for each attribute name having dashes within parentheses:

{{- if or .Values.serviceA.appyml .Values.serviceB.log4j2xml ( index .Values.serviceC "some-service-configyml") ( index .Values.serviceD "another-serviceyml") }}

Upvotes: 1

Related Questions