routesopenshift

How to change certificate to oc command in openshift?


How to change certificate to oc command in openshift?

Since there are several, I want to change them all at once.

How do I change the tls created below?

I want to change only cert and key.

oc create route edge test-route \
--service=test-service \
--insecure-policy=Redirect \
--cert=/data/test.crt.pem \
--key=/data/test.key.pem \
--ca-cert=/data/test/ca-chain-bundle.pem \
--hostname=test.aaaa.com \
--port 8080 \
-n test

Solution

  • This is possible through patch.

    However, you have to be careful about newlines.

    oc patch route test-route -p "{\"spec\":{\"tls\":{\"certificate\": \"-----BEGIN CERTIFICATE-----\n....\......\n-----END CERTIFICATE-----", \"key\": \"\"}}}" -n test