Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Openshift - rename route

How can I rename route that has been created via web console? I go to Applications>Routes, selected route name, then Action>Edit YAML and I want to achieve the following change, from test.site into old.test.site

Current route yml config

...
metadata:
  name: test
  selfLink: /oapi/v1/namespaces/keycloak/routes/test
...
spec:
  host: test.site
...
status:
  ingress:
    - conditions:
        - lastTransitionTime: '2017-12-13T02:19:22Z'
          status: 'True'
          type: Admitted
      host: test.site

Attempt

...
metadata:
  name: test
  selfLink: /oapi/v1/namespaces/keycloak/routes/test
...
spec:
  host: old.test.site
...
status:
  ingress:
    - conditions:
        - lastTransitionTime: '2017-12-13T02:19:22Z'
          status: 'True'
          type: Admitted
      host: old.test.site

I get the following error messages:

Failed to process the resource. Reason: Route "test" is invalid: spec.host: Invalid value: "old.test.site": field is immutable

like image 548
johntanquinco Avatar asked Nov 24 '25 11:11

johntanquinco


1 Answers

As Graham Dumpleton wrote:

As far as I know you can't edit the host in place for an existing route. From the command line try

oc get route test -o yaml > route.yaml

Then edit the route.yaml and run

oc replace route test -f route.yaml 

The replace action may allow you to do it. Else after editing local copy, try

oc delete route test

and

oc apply route test -f route.yaml

In doing this, when edit the file, you can delete the whole status section.

But keep in mind there are exist some fields which are required and you cannot delete them. That's why you had a problem with modification.

like image 157
Nick Rak Avatar answered Nov 27 '25 09:11

Nick Rak



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!