Argo CD 应用程序集


Red Hat OpenShift GitOps 1.16

在非 control plane 命名空间中管理应用程序设置资源

Red Hat OpenShift Documentation Team

摘要

本文档提供有关如何在非 control plane 命名空间中启用和管理应用程序设置资源的信息。

第 1 章 在非 control plane 命名空间中管理应用程序设置资源

重要

非 control plane 命名空间中的 Argo CD 应用程序设置只是一个技术预览功能。技术预览功能不受红帽产品服务等级协议(SLA)支持,且功能可能并不完整。红帽不推荐在生产环境中使用它们。这些技术预览功能可以使用户提早试用新的功能,并有机会在开发阶段提供反馈意见。

有关红帽技术预览功能支持范围的更多信息,请参阅技术预览功能支持范围

通过使用应用程序集,您可以一次自动和管理多个 Argo CD 应用程序的部署,并一次从一个 mono-repository 变为多个集群,并具有更大的灵活性。

在 Red Hat OpenShift GitOps 1.12 及之后的版本中,作为集群管理员,您可以通过在非 control plane 命名空间中声明(除 openshift-gitops control plane 命名空间外)中创建和管理 ApplicationSet 资源,根据您的要求明确启用和配置 ArgoCDApplicationSet 自定义资源(CR)。当您要为隔离团队管理 Argo CD 应用程序时,此功能在多租户环境中特别有用。此功能在 Argo CD 开源项目的任何命名空间功能 中称为 ApplicationSet

注意

生成的 Argo CD 应用程序可以在任何非 control plane 命名空间中创建资源。但是,应用程序本身将处于与应用程序设置资源相同的命名空间中。

1.1. 先决条件

1.2. 在非 control plane 命名空间中启用应用程序设置资源

作为集群管理员,您可以定义一组特定的非 control plane 命名空间,用户可以在其中创建、更新和协调 ApplicationSet 资源。您必须根据您的要求显式启用并配置 ArgoCDApplicationSet 自定义资源(CR)。

流程

  1. applicationSet spec 的 sourceNamespaces 参数设置为包含非 control plane 命名空间:

    Argo CD 自定义资源示例

    apiVersion: argoproj.io/v1beta1
    kind: ArgoCD
    metadata:
      name: example
      namespace: spring-petclinic
    spec:
      applicationSet:
        sourceNamespaces: 1
          - dev 2

    1
    用于创建和管理 ApplicationSet 资源的非 control plane 命名空间列表。
    2
    Argo CD 服务器的目标命名空间名称,用于创建和管理 ApplicationSet 资源。
    注意

    目前,.spec.applicationSet.sourceNamespaces 字段中不支持使用通配符(*)。

  2. 验证 GitOps Operator 是否已创建或修改以下基于角色的访问控制(RBAC)资源:

    NameKind用途

    <argocd_name>-<argocd_namespace>-argocd-applicationset-controller

    ClusterRoleClusterRoleBinding

    对于 Argo CD ApplicationSet Controller,在集群级别监视和列出 ApplicationSet 资源

    <argocd_name>-<argocd_namespace>-applicationset

    RoleRoleBinding

    对于 Argo CD ApplicationSet Controller,管理目标命名空间中的 ApplicationSet 资源

    <argocd_name>-<target_namespace>

    RoleRoleBinding

    对于 Argo CD 服务器,通过 UI、API 或 CLI 管理目标命名空间中的 ApplicationSet 资源

    注意

    Operator 将 argocd.argoproj.io/applicationset-managed-by-cluster-argocd 标签添加到目标命名空间中。

1.3. 允许源代码管理器供应商

重要

请仔细阅读本节。错误配置可能会导致出现潜在的安全问题。

在非 control plane 命名空间中允许 ApplicationSet 资源可以通过 Source Code Manager (SCM) Provider 或 Pull Request (PR)生成器中的恶意 API 端点来破坏 secret。为了防止未经授权访问敏感信息,Operator 默认禁用 SCM 提供程序和 PR 生成器作为预防措施。

流程

  • 要使用 SCM 提供程序和 PR 生成器,请明确定义允许的 SCM 提供程序列表:

    Argo CD 自定义资源示例

    apiVersion: argoproj.io/v1beta1
    kind: ArgoCD
    metadata:
      name: example-argocd
    spec:
      applicationSet:
        sourceNamespaces:
          - dev
        scmProviders: 1
          - https://git.mydomain.com/
          - https://gitlab.mydomain.com/

    1
    允许 SCM 提供者的 URL 列表。
注意

如果您使用不在允许的 SCM 供应商列表中的 URL,Argo CD ApplicationSet Controller 将拒绝它。

1.4. 其他资源

法律通告

Copyright © 2025 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.