-
Hi all, apiVersion: apps/v1
kind: Deployment
metadata:
labels:
control-plane: controller-manager
name: activemq-artemis-controller-manager
spec:
replicas: 1
selector:
matchLabels:
control-plane: controller-manager
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
labels:
control-plane: controller-manager
name: activemq-artemis-operator
spec:
containers:
- args:
- --zap-log-level=info
- --zap-encoder=console
- --zap-time-encoding=iso8601
- --leader-elect
command:
- /home/activemq-artemis-operator/bin/entrypoint
env:
- name: RELATED_IMAGE_ActiveMQ_Artemis_Broker_Init_2150
value: {{ include "test.activemqinitbroker.imageName" . }}:0.2.2
- name: RELATED_IMAGE_ActiveMQ_Artemis_Broker_Init_2160
value: {{ include "test.activemqinitbroker.imageName" . }}:0.2.4 I would like to add an imagePullsecret item with a list with one value to obtain this yaml apiVersion: apps/v1
kind: Deployment
metadata:
labels:
control-plane: controller-manager
name: activemq-artemis-controller-manager
spec:
replicas: 1
selector:
matchLabels:
control-plane: controller-manager
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
labels:
control-plane: controller-manager
name: activemq-artemis-operator
spec:
imagePullSecrets:
- name: "{{ include "test.imagePullSecrets" . }}"
containers:
- args:
- --zap-log-level=info
- --zap-encoder=console
- --zap-time-encoding=iso8601
- --leader-elect
command:
- /home/activemq-artemis-operator/bin/entrypoint
env:
- name: RELATED_IMAGE_ActiveMQ_Artemis_Broker_Init_2150
value: {{ include "test.activemqinitbroker.imageName" . }}:0.2.2
- name: RELATED_IMAGE_ActiveMQ_Artemis_Broker_Init_2160
value: {{ include "test.activemqinitbroker.imageName" . }}:0.2.4 I was not able to find an example covering this case but I'm pretty new to yq so I need some help. |
Beta Was this translation helpful? Give feedback.
Answered by
mikefarah
Mar 6, 2024
Replies: 1 comment
-
The helm template isn't valid yaml - because of helm template expressions using # etc
template:
metadata:
labels:
control-plane: controller-manager
name: activemq-artemis-operator
spec:
containers:
- args:
- --zap-log-level=info
- --zap-encoder=console
- --zap-time-encoding=iso8601
- --leader-elect
command:
- /home/activemq-artemis-operator/bin/entrypoint
env:
- name: RELATED_IMAGE_ActiveMQ_Artemis_Broker_Init_2150
value: '{{ include "test.activemqinitbroker.imageName" . }}:0.2.2'
- name: RELATED_IMAGE_ActiveMQ_Artemis_Broker_Init_2160
value: '{{ include "test.activemqinitbroker.imageName" . }}:0.2.4' Then you can use yq '.template.spec.imagePullSecrets[0].name = "{{ include \"test.imagePullSecrets\" . }}"' data1.yaml |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
mikefarah
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The helm template isn't valid yaml - because of helm template expressions using
{{ .. }}
. You will need to wrap that in quotes to get a valid yaml file first: