是否可以覆盖 jkube 中的默认部署命名?我想做一些类似于 docker 图像命名的事情,我可以在其中提供模式。
资源文档中的部署部分看起来很有希望,但插件中不存在这些选项。
默认命名似乎是 maven ${project.artifactId} 但我没有发现任何地方都有记录。挖掘代码我可以看到 ResourceConfig 与文档和示例不同步。
是否可以覆盖 jkube 中的默认部署命名?我想做一些类似于 docker 图像命名的事情,我可以在其中提供模式。
资源文档中的部署部分看起来很有希望,但插件中不存在这些选项。
默认命名似乎是 maven ${project.artifactId} 但我没有发现任何地方都有记录。挖掘代码我可以看到 ResourceConfig 与文档和示例不同步。
我来自 Eclipse JKube/FMP 的开发团队。我认为您应该能够通过使用属性或通过为(由插件 负责默认的 Enricher)jkube.enricher.jkube-controller.name
提供 XML 配置来覆盖默认控制器名称,如下所示:jkube-controller
Deployment
<plugin>
<groupId>org.eclipse.jkube</groupId>
<artifactId>kubernetes-maven-plugin</artifactId>
<version>1.0.0-alpha-1</version>
<configuration>
<enricher>
<config>
<jkube-controller>
<name>some-deployment</name>
</jkube-controller>
</config>
</enricher>
</configuration>
</plugin>
当我尝试这个时,我能够看到Deployment
根据我们的配置更改的名称:
~/work/repos/eclipse-jkube-demo-project : $ mvn k8s:resource k8s:apply
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< meetup:random-generator >-----------------------
[INFO] Building random-generator 0.0.1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- kubernetes-maven-plugin:1.0.0-alpha-1:resource (default-cli) @ random-generator ---
[INFO] k8s: Running generator spring-boot
[INFO] k8s: spring-boot: Using Docker image fabric8/java-centos-openjdk8-jdk:1.5 as base / builder
[INFO] k8s: jkube-controller: Adding a default Deployment
[INFO] k8s: jkube-service: Adding a default service 'random-generator' with ports [8080]
[INFO] k8s: jkube-healthcheck-spring-boot: Adding readiness probe on port 8080, path='/actuator/health', scheme='HTTP', with initial delay 10 seconds
[INFO] k8s: jkube-healthcheck-spring-boot: Adding liveness probe on port 8080, path='/actuator/health', scheme='HTTP', with initial delay 180 seconds
[INFO] k8s: jkube-revision-history: Adding revision history limit to 2
[INFO]
[INFO] --- kubernetes-maven-plugin:1.0.0-alpha-1:apply (default-cli) @ random-generator ---
[INFO] k8s: Using Kubernetes at https://192.168.39.93:8443/ in namespace default with manifest /home/rohaan/work/repos/eclipse-jkube-demo-project/target/classes/META-INF/jkube/kubernetes.yml
[INFO] k8s: Using namespace: default
[INFO] k8s: Creating a Service from kubernetes.yml namespace default name random-generator
[INFO] k8s: Created Service: target/jkube/applyJson/default/service-random-generator.json
[INFO] k8s: Creating a Deployment from kubernetes.yml namespace default name some-deployment
[INFO] k8s: Created Deployment: target/jkube/applyJson/default/deployment-some-deployment.json
[INFO] k8s: HINT: Use the command `kubectl get pods -w` to watch your pods start up
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.076 s
[INFO] Finished at: 2020-04-03T16:57:04+05:30
[INFO] ------------------------------------------------------------------------
~/work/repos/eclipse-jkube-demo-project : $ kubectl get deploy
NAME READY UP-TO-DATE AVAILABLE AGE
some-deployment 0/1 1 0 8s
~/work/repos/eclipse-jkube-demo-project : $ kubectl get pods
NAME READY STATUS RESTARTS AGE
some-deployment-97495447b-z9p48 0/1 Running 0 15s