我使用以下命令在Openshift上部署了我的应用程序:
oc project <projectname>
然后,我导航至应用程序的目录并使用以下命令:
mvn fabric8:deploy -Popenshift
这完美地部署到了Openshift。
唯一的问题是它会自动命名我的应用程序,而且我不确定它从何处获得名称。我想将其更改为[app-name] -test,[app-name] -dev等
那么,它是从哪里获得应用程序名称的,我该如何更改?
答案 0 :(得分:2)
通常是在fabric8 XML配置(pom.xml
)中。例如:
<configuration>
<!-- Standard d-m-p configuration which defines how images are build, i.e. how the docker.tar is created -->
<images>
<image>
<name>${image.user}/${project.artifactId}:${project.version}</name>
<!-- "alias" is used to correlate to the containers in the pod spec -->
<alias>camel-service</alias>
<build>
<from>fabric8/java</from>
<assembly>
<basedir>/deployments</basedir>
<descriptorRef>artifact-with-dependencies</descriptorRef>
</assembly>
<env>
<JAVA_LIB_DIR>/deployments</JAVA_LIB_DIR>
<JAVA_MAIN_CLASS>org.apache.camel.cdi.Main</JAVA_MAIN_CLASS>
</env>
</build>
</image>
</images>
<!-- resources to be created -->
<resources>
<!-- Labels that are applied to all created objects -->
<labels>
<group>quickstarts</group>
</labels>
<!-- Definition of the ReplicationController / ReplicaSet. Any better name than "containers" ? -->
<deployment>
<!-- Name of the replication controller, which will have a sane default (container alisa, mvn coords, ..) -->
<!-- Override here -->
<name>${project.artifactId}</name>
...
默认值为${project.artifactId}
,但您可以用${project.artifactId}-dev
之类的内容替换。您还可以在Kubernetes中手动编辑部署:
$ kubectl edit deployment ${project.artifactId}