以下文章来源于阿坡的OpenShift ,作者ragpo
在客户的已经准备好上线的OpenShift 3.9集群中提出修改域名需求,因此先在本人的自己测试环境进行了验证,过程如下,并且还有一些坑,并进行了记录;将ocp6修改为ocp7。
修改的方式有两种:
routingConfig:
subdomain: apps.test.ocp7.com
systemctl restart atomic-openshift-master-api.service atomic-openshift-master-controllers.service
[root@local2-ocp3.9-master1-test.com ~]# oc get route --all-namespaces
NAMESPACE NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD
default docker-registry docker-registry-default.apps.test.ocp6.com docker-registry <all> passthrough None
default registry-console registry-console-default.apps.test.ocp6.com registry-console <all> passthrough None
jenkins jenkins jenkins-jenkins.apps.test.ocp6.com jenkins <all> edge/Redirect None
logging logging-kibana kibana.apps.test.ocp6.com logging-kibana <all> reencrypt/Redirect None
openshift-infra hawkular-metrics hawkular-metrics.apps.test.ocp6.com hawkular-metrics <all> reencrypt None
172.16.37.43 registry-console-default.apps.test.ocp7.com
[root@local2-ocp3.9-master1-test.com ~]# oc edit oauthclient cockpit-oauth-client
oauthclient "cockpit-oauth-client" edited
[root@local2-ocp3.9-master1-test.com ~]# oc get oauthclient cockpit-oauth-client -o yaml
apiVersion: oauth.openshift.io/v1
kind: OAuthClient
metadata:
annotations:
openshift.io/generated-by: OpenShiftNewApp
creationTimestamp: 2018-06-17T00:56:08Z
labels:
app: registry-console
createdBy: registry-console-template
name: cockpit-oauth-client
resourceVersion: "31325"
selfLink: /apis/oauth.openshift.io/v1/oauthclients/cockpit-oauth-client
uid: 38adc129-71c9-11e8-ad8b-000c2906e131
redirectURIs:
- https://registry-console-default.apps.test.ocp6.com
- https://registry-console-default.apps.test.ocp7.com
secret: userKHwbcoPVQBTJDpiMKOC1BssLpw5Eq7SCKVS5TGC1BtWxbpsRIkj2uwdbhdCSkC7J
[root@local2-ocp3.9-master1-test.com ~]# oc get route
NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD
docker-registry docker-registry-default.apps.test.ocp6.com docker-registry <all> passthrough None
registry-console registry-console-default.apps.test.ocp7.com registry-console registry-console passthrough None
[root@local2-ocp3.9-master1-test.com ~]# oc get route registry-console -o yaml >> registry-console-2.yaml
[root@local2-ocp3.9-master1-test.com ~]# cat registry-console-2.yaml
apiVersion: route.openshift.io/v1
kind: Route
metadata:
annotations:
openshift.io/host.generated: "true"
creationTimestamp: 2018-06-17T03:45:24Z
name: registry-console
namespace: default
resourceVersion: "31000"
selfLink: /apis/route.openshift.io/v1/namespaces/default/routes/registry-console
uid: dde737e7-71e0-11e8-a3dd-000c2906e131
spec:
host: registry-console-default.apps.test.ocp7.com
port:
targetPort: registry-console
tls:
termination: passthrough
to:
kind: Service
name: registry-console
weight: 100
wildcardPolicy: None
status:
ingress:
- conditions:
- lastTransitionTime: 2018-06-17T05:33:31Z
status: "True"
type: Admitted
host: registry-console-default.apps.test.ocp7.com
routerName: router
wildcardPolicy: None
[root@local2-ocp3.9-master1-test.com ~]# oc create -f registry-console-2.yaml
openshift_master_default_subdomain=apps.test.ocp6.com
Is your jenkins instance deployed inside OpenShift using the Jenkins template or is it an external Jenkins instance? If it is deployed on OpenShift and configured from the Jenkins template, you should be able to set the JENKINS_ROOT_URL by navigating to the Deployments > jenkins > Actions > Edit YAML and adding a new environment variable and setting it's value to your Jenkins domain name. Please see the attached screenshot [1] for an example of where you can configure the JENKINS_ROOT_URL environment variable.