Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Deployment config from shell

I need to vary the deployment config of an application, by adding an extra YAML section within it (in the example the section name: ping and its two attributes)

containers:
- name: openshift-wf-cluster
image: 172.30.1.1:5000/demo/openshift-wf@sha256:5d7e13e981f25b8933d54c8716d169fadf1c4b9c03468a5b6a7170492d5b9d93
ports:
- containerPort: 8080
  protocol: TCP
- name: ping
  containerPort: 8888
  protocol: TCP

Is it possible to do it from the oc shell command ?(without manually editing the file) A sort of adding an extra node to one section of the YAML ?

like image 501
Carla Avatar asked Oct 17 '25 00:10

Carla


1 Answers

You can use the oc patch command to achieve this. See oc patch --help for more info. Try the following with your own deployment config name:

oc patch dc/YOURDC -p '[{"op": "replace", "path": "/spec/template/spec/containers/0/ports/1", "value":{"name":"ping","containerPort":8888,"protocol":"TCP"}}]' --type=json

like image 103
PhilipGough Avatar answered Oct 19 '25 04:10

PhilipGough



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!