You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using yedit to do a patch like operation on a kube ServiceAccount.
Command : kubectl patch serviceaccount default -n monitoring -p '{"imagePullSecrets": [{"name": "monitoring-de-icr-io"}]}'
When I run this twice, it tells me no change and I have what I aim for which means
kubectl get sa test -n monitoring -o yamlapiVersion: v1imagePullSecrets:
- name: monitoring-de-icr-iokind: ServiceAccountmetadata:
creationTimestamp: "2020-05-20T15:25:38Z"name: testnamespace: monitoringresourceVersion: "876792"selfLink: /api/v1/namespaces/monitoring/serviceaccounts/testuid: 48eedc79-3751-49e4-a519-7be8cea59ea2secrets:
- name: test-token-8v5v8
Now what am I doing with yedit is :
- name: Patch service account to use the image pull secret - Patchyedit:
content: "{{ monitoring_sa.resources[0] }}"key: imagePullSecretsvalue: "name: monitoring-de-icr-io"append: trueregister: msg
The whole ope is
- name: Patch service account to use the image pull secret - Getk8s_info:
api_version: v1kind: ServiceAccountname: testnamespace: monitoringregister: monitoring_sa
- debug: var=monitoring_sa
- name: Patch service account to use the image pull secret - Patchyedit:
content: "{{ monitoring_sa.resources[0] }}"key: imagePullSecretsvalue: "name: monitoring-de-icr-io"append: trueregister: msg
- debug: var=msg.result[0].edit
- name: Patch service account to use the image pull secret - Applyk8s:
state: presentdefinition: "{{ msg.result[0].edit }}"
But runing it twice gives me
kubectl get sa test -n monitoring -o yamlapiVersion: v1imagePullSecrets:
- name: monitoring-de-icr-io
- name: monitoring-de-icr-iokind: ServiceAccountmetadata:
creationTimestamp: "2020-05-20T15:25:38Z"name: testnamespace: monitoringresourceVersion: "876792"selfLink: /api/v1/namespaces/monitoring/serviceaccounts/testuid: 48eedc79-3751-49e4-a519-7be8cea59ea2secrets:
- name: test-token-8v5v8
the use of update gives empty result.
What is the best way to get this done please?
The text was updated successfully, but these errors were encountered:
ChapChap
changed the title
Ensure array contains element
Ensure array contains element (aka kubectl patch -p)
May 27, 2020
Hi you,
I am using yedit to do a patch like operation on a kube ServiceAccount.
Command :
kubectl patch serviceaccount default -n monitoring -p '{"imagePullSecrets": [{"name": "monitoring-de-icr-io"}]}'
When I run this twice, it tells me no change and I have what I aim for which means
Now what am I doing with yedit is :
The whole ope is
But runing it twice gives me
the use of
update
gives empty result.What is the best way to get this done please?
The text was updated successfully, but these errors were encountered: