如何重命名通过Web控制台创建的路由?
我转到Applications>Routes
,选择路由名称,然后选择Action>Edit YAML
,我想要实现以下更改,从test.site
变为old.test.site
当前路线yml配置
...
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
尝试
...
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
我收到以下错误消息:
Failed to process the resource. Reason: Route "test" is invalid: spec.host: Invalid value: "old.test.site": field is immutable
最佳答案
正如Graham Dumpleton写道:
据我所知,您无法在现有路由中编辑主机。从命令行尝试
oc get route test -o yaml > route.yaml
然后编辑
route.yaml
并运行oc replace route test -f route.yaml
replace
操作可以允许您执行此操作。否则,在编辑本地副本后,尝试
oc delete route test
和
oc apply route test -f route.yaml
为此,在编辑文件时,可以删除整个
status
部分。但是请记住,存在一些必填字段,您不能删除它们。这就是为什么您在修改时遇到问题。
关于kubernetes - Openshift-重命名路线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51438773/