小编use*_*872的帖子

Maven跳过部署并仅推送Docker映像

我的Maven项目中同时有deploy插件和dockerize插件。

部署插件

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-deploy</id>
                        <phase>deploy</phase>
                    </execution>
                </executions>
            </plugin>
Run Code Online (Sandbox Code Playgroud)

Dockerize插件,

<profiles>
        <profile>
            <id>docker</id>
            <properties>
                <assembly.skipAssembly>true</assembly.skipAssembly>
            </properties>
            <build>
                <finalName>${project.artifactId}</finalName>
                <plugins>
                    <plugin>
                        <groupId>com.spotify</groupId>
                        <artifactId>dockerfile-maven-plugin</artifactId>
                        <version>${version.docker.plugin}</version>
                        <executions>
                            <execution>
                                <id>dockerize-app</id>
                                <goals>
                                    <goal>build</goal>
                                    <goal>push</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <repository>${docker.image-prefix}${project.artifactId}</repository>
                            <tag>${project.version}</tag>
                            <useMavenSettingsForAuth>true</useMavenSettingsForAuth>
                            <buildArgs>
                                <JAR_FILE>${project.build.finalName}.jar</JAR_FILE>
                            </buildArgs>
                            <resources>
                                <resource>
                                    <targetPath>/</targetPath>
                                    <directory>${project.build.directory}</directory>
                                    <include>${project.artifactId}.war</include>
                                </resource>
                            </resources>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
Run Code Online (Sandbox Code Playgroud)

我有以下用例。

  1. 单独部署工件
  2. 单独部署Docker映像
  3. 部署工件和Docker映像

为此,我在配置文件下添加了Docker插件。因此,在通过配置文件名称时将部署Docker映像。

mvn部署

上面的命令将仅部署工件。

mvn deploy -P泊坞窗

上面的命令将部署工件和Docker映像。

但是,我无法仅部署Docker映像。

为了只部署Docker映像,我将以下配置添加到deploy插件中,

<configuration>
                    <skip>true</skip>
                </configuration>
Run Code Online (Sandbox Code Playgroud)

或者,将default-deploy设置为none。

<execution>
                        <id>default-deploy</id>
                        <phase>none</phase>
                    </execution>
Run Code Online (Sandbox Code Playgroud)

以上两种方法都需要更改pom。

  1. 另一种方法是也创建要部署的配置文件,以便我们可以传递所需的配置文件。

还有其他更好的方法吗?或者,是否可以使用Maven参数跳过部署?

maven docker

4
推荐指数
1
解决办法
1439
查看次数

Kafka 10-具有身份验证和授权的Python客户端

我有一个启用了SASL_SSL(身份验证(JAAS)和授权)的Kafka10集群。可以使用Java客户端和以下道具通过SASL进行连接。

ssl.keystore.location="client_keystore.jks"
ssl.keystore.password="password"
ssl.truststore.location="clienttruststore"
ssl.truststore.password="password" 
Run Code Online (Sandbox Code Playgroud)

and passing the JAAS conf file thru the JVM params.

-Djava.security.auth.login.config=/path/to/client_jaas.conf
Run Code Online (Sandbox Code Playgroud)

Is there anyway to achieve the same thing with the python client?

python apache-kafka kafka-python

3
推荐指数
1
解决办法
4084
查看次数

Kubernetes入口tls

我使用以下命令在本地生成密钥。

openssl genrsa -out测试vc.testns.ing.lb.xyz.io.key.pem 2048

然后使用下面的命令生成CSR(证书签名请求)。

openssl req -new -sha256 -key testsvc.testns.ing.lb.xyz.io.key.pem -subj“ /CN=testsvc.testns.ing.lb.xyz.io”

我使用上面的CSR文件生成了证书链文件,最后得到了下面的文件。

testsvc.testns.ing.lb.xyz.io.chain.pem

我正在尝试将它们用于入口tls,以下是入口tls的命令。

kubectl创建秘密tls custom-tls-cert --key /path/to/tls.key --cert /path/to/tls.crt

不确定,如何使用上述命令使用chain.pem文件和key.pem文件。试图从chain.pem生成crt并在kubectl上出错会创建秘密。

"error: failed to load key pair tls: failed to find any PEM data in certificate input"
Run Code Online (Sandbox Code Playgroud)

我想创建以下秘密。

apiVersion: v1
data:
  tls.crt: base64 encoded cert
  tls.key: base64 encoded key
kind: Secret
metadata:
  name: testsecret
  namespace: default
type: Opaque
Run Code Online (Sandbox Code Playgroud)

不确定如何使用chain.pem文件生成.crt和.key文件。

谢谢

ssl kubernetes

3
推荐指数
1
解决办法
3371
查看次数

Kubernetes日志 - 从一开始

我已经运行了一个多月的pod,并且自启动以来没有重启.但是,我仍然无法查看日志,因为它开始,它只提供过去2天的日志.是否有容器的日志轮换策略以及如何根据大小或日期控制旋转...

我尝试了以下命令,但只显示了最近2天的日志.

kubectl记录POD_NAME --since = 0

还有其他方法吗?

谢谢

kubernetes

3
推荐指数
1
解决办法
2031
查看次数

Kafka 幂等生产者

Kafka 文档说,同一个生产者会话可以使用幂等生产者,我无法理解这一点。

比如说,Kafka 为每条消息添加序列号,最后一个序列号在 Kafka 中维护(不确定它在哪里维护)。

它如何生成序列号以及它保存在哪里?

为什么生产者崩溃并再次出现时无法保持序列?

我怎样才能使它在生产者会话之间真正具有幂等性?

apache-kafka

3
推荐指数
1
解决办法
3414
查看次数

java.lang.ClassNotFoundException:com.sun.xml.internal.bind.v2.ContextFactory

\n

春季启动版本2.4.4

\n

Java版本15

\n
\n
@Bean\n    public WebClient webClient() {\n        return WebClient.builder().baseUrl(BASE_URL)\n                .defaultHeaders(header -> header.setBasicAuth("test",\n                        "testpwd"))\n                .clientConnector(new ReactorClientHttpConnector(HttpClient.newConnection()))\n                .exchangeStrategies(ExchangeStrategies.builder().codecs(configurer -> {\n                    configurer.defaultCodecs().jaxb2Encoder(new Jaxb2XmlEncoder());\n                    configurer.defaultCodecs().jaxb2Decoder(new Jaxb2XmlDecoder());\n                }).build()).build();\n        \n    }\n
Run Code Online (Sandbox Code Playgroud)\n

使用 Spring boot 2.4.4 webclient 并尝试使用 XML 响应来使用服务。

\n
public Mono<ServerResponse> retrieveServices() {\n\n        // Headers can be passed here or while building the client\n        Mono<DirectoryOfService> serviceMono = webClient\n             .get().uri("/api/v1/test/services")\n            .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_XML_VALUE)\n            .accept(MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML)\n            .retrieve().bodyToMono(DirectoryOfService.class);\n\n    }\n
Run Code Online (Sandbox Code Playgroud)\n

错误:-

\n
    org.springframework.core.codec.CodecException: Could not create JAXBContext for class [class com.test.model.DirectoryOfService]: Implementation of JAXB-API …
Run Code Online (Sandbox Code Playgroud)

java spring spring-boot spring-webflux spring-webclient

3
推荐指数
1
解决办法
2万
查看次数

Mesos任务 - 无法接受套接字:将来被丢弃

我只是想从1.0.3将mesos版本升级到1.3.1.

Chronos调度程序能够通过mesos安排JOB.工作运行正常,能够看到mesos stdout日志.但是,仍然在mesos stderr日志中看到以下内容.docker作业运行正常,但状态仍显示为以下日志失败.

I0905 22:05:00.824811   456 exec.cpp:162] Version: 1.3.1
I0905 22:05:00.829165   459 exec.cpp:237] Executor registered on agent c63c93dc-3d9f-4322-9f82-0553fd1324fe-S0
E0905 22:05:11.773236   465 process.cpp:956] Failed to accept socket: future discarded
Run Code Online (Sandbox Code Playgroud)

docker mesos mesos-chronos

2
推荐指数
1
解决办法
3364
查看次数

获取 kubernetes cronjob 历史记录

我有一个 CronJob 每 15 分钟运行一次。比如说,它运行了过去 1 年。是否可以使用 Kube API 获取完整的历史记录?或者,是否可以控制可以存储的最大历史记录?另外,我们可以获得每次运行的状态(成功/失败)以及总完成时间吗?POD 完成 Job 后会死吗?

kubernetes

2
推荐指数
1
解决办法
7239
查看次数

MongoDB - 更新字段的数据类型

数据插入如下。

{“键1”:20.05,“键2”:21.24 }

它应该存储为 Double,但该值存储为 String,并且当返回文档时,该值是,

{“key1”:“20.05”,“key2”:“21.24”}

是否有办法将数据类型更新为双倍而不扫描每个文档?

mongodb

2
推荐指数
1
解决办法
6397
查看次数

Gradle Spotbug 插件

我是 Gradle 新手,正在尝试为我的 Spring Boot 多模块项目配置 Spotbugs。

在我的父母 build.gradle 中,

buildscript {
    dependencies {
        classpath "org.springframework.boot:spring-boot-gradle-plugin:${versionSpringBoot}"
    }
}

plugins {
  id 'com.github.spotbugs' version '1.6.8'
}

allprojects {
    apply plugin: 'eclipse'
    apply plugin: 'idea'
}

subprojects {
    apply plugin: 'java'
    apply plugin: 'io.spring.dependency-management'
    apply plugin: 'pmd'
    apply plugin: 'jacoco'

    dependencyManagement {
        imports {
            
        }
    }

    configurations{
    }

    sourceCompatibility = '15'
    targetCompatibility = '15'

    dependencies {
    }

    pmd {
        consoleOutput = true
        toolVersion = "${versionPmd}"
        sourceSets = [sourceSets.main]
        ruleSets = ["category/java/errorprone.xml", "category/java/bestpractices.xml"] …
Run Code Online (Sandbox Code Playgroud)

gradle spotbugs

2
推荐指数
1
解决办法
5266
查看次数