Red Hat Camel K is deprecated
Red Hat Camel K is deprecated and the End of Life date for this product is June 30, 2025. For help migrating to the current go-to solution, Red Hat build of Apache Camel, see the Migration Guide.2.3. 为 Camel K 配置 Maven 存储库
对于 Camel K operator,您可以在 ConfigMap
或 secret 中提供 Maven 设置。
流程
要从文件创建
ConfigMap
,请运行以下命令:Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc create configmap maven-settings --from-file=settings.xml
oc create configmap maven-settings --from-file=settings.xml
然后,创建的
ConfigMap
可以在IntegrationPlatform
资源中从spec.build.maven.settings
字段引用。示例
Copy to Clipboard Copied! Toggle word wrap Toggle overflow apiVersion: camel.apache.org/v1 kind: IntegrationPlatform metadata: name: camel-k spec: build: maven: settings: configMapKeyRef: key: settings.xml name: maven-settings
apiVersion: camel.apache.org/v1 kind: IntegrationPlatform metadata: name: camel-k spec: build: maven: settings: configMapKeyRef: key: settings.xml name: maven-settings
或者,您可以使用以下命令直接编辑
IntegrationPlatform
资源来引用包含 Maven 设置的 ConfigMap:Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc edit ip camel-k
oc edit ip camel-k
为远程 Maven 存储库配置 CA 证书
您可以在 Secret 中提供 CA 证书,供 Maven 命令用于连接远程 Maven 存储库。
流程
使用以下命令从文件创建 Secret:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc create secret generic maven-ca-certs --from-file=ca.crt
oc create secret generic maven-ca-certs --from-file=ca.crt
从
spec.build.maven.caSecret
字段中引用IntegrationPlatform
资源中创建的 Secret,如下所示。Copy to Clipboard Copied! Toggle word wrap Toggle overflow apiVersion: camel.apache.org/v1 kind: IntegrationPlatform metadata: name: camel-k spec: build: maven: caSecret: key: tls.crt name: tls-secret
apiVersion: camel.apache.org/v1 kind: IntegrationPlatform metadata: name: camel-k spec: build: maven: caSecret: key: tls.crt name: tls-secret