覆盖默认的 jkube 部署名称

Override default jkube deployment name

是否可以覆盖 jkube 中的默认部署命名?我想做一些类似于 docker 图片命名的事情,我可以在其中提供一个模式。

resources documentation 中的部署部分看起来很有希望,但插件中没有这些选项。

默认命名似乎是 maven ${project.artifactId} 但我没有在任何地方找到它的记录。深入研究代码,我发现 ResourceConfig 与文档和示例不同步。

我来自 Eclipse JKube/FMP 的开发团队。我认为您应该能够通过使用 jkube.enricher.jkube-controller.name 属性 或为 jkube-controller 提供 XML 配置来覆盖默认控制器名称(Enricher 负责默认 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