用kustomize修补多个资源

发布于 2025-01-30 10:43:05 字数 714 浏览 1 评论 0原文

我有一个kustomization.yaml文件,定义了该文件由从git存储库下载的两个资源组成。这两种资源都想用相同名称创建一个命名空间,当我尝试构建最终的kustomization文件时会产生错误:可能不会使用已注册的ID添加资源:〜g_v1_namespace | 〜x |兔子系统'。我尝试使用补丁来摆脱这个不需要的名称空间,但是,只有在定义一个资源时,它似乎有效。一旦添加其他资源,它就会停止工作。

bases:
  - ../../base
namespace: test

resources:
- https://github.com/rabbitmq/cluster-operator/releases/download/v1.13.0/cluster-operator.yml
- https://github.com/rabbitmq/messaging-topology-operator/releases/download/v1.6.0/messaging-topology-operator.yaml

patchesStrategicMerge:
  - |-
    apiVersion: v1
    kind: Namespace
    metadata:
      name: rabbitmq-system
    $patch: delete

我认为正在发生的是首先加载资源,并找到两个相同的名称空间,并且没有考虑补丁。我可以以某种方式解决此行为吗?

I have a kustomization.yaml file defined which consists of two resources that are downloaded from a git repo. Both of these resources want to create a Namespace with the same name, which creates an error when I try to build the final kustomization file: may not add resource with an already registered id: ~G_v1_Namespace|~X|rabbitmq-system'. I tried using patches to get rid of this unwanted namespace however, it looks like that works only if ONE resource is defined. As soon as I add the other resource, it stops working.

bases:
  - ../../base
namespace: test

resources:
- https://github.com/rabbitmq/cluster-operator/releases/download/v1.13.0/cluster-operator.yml
- https://github.com/rabbitmq/messaging-topology-operator/releases/download/v1.6.0/messaging-topology-operator.yaml

patchesStrategicMerge:
  - |-
    apiVersion: v1
    kind: Namespace
    metadata:
      name: rabbitmq-system
    $patch: delete

What I think is happening is Kustomize loads the resources first and finds two identical Namespaces defined and it doesn't take patches into consideration. Can I fix this behavior somehow?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文