thoth-station.argo_workflows

Ansible 角色:Argo 工作流

Node CI   Release

这是一个设置 Argo Workflows 的 Ansible 角色,用于单个命名空间。

关于

查看 Medium 上的博客文章,了解详细步骤。

要求

  1. 具有集群管理员权限的 OpenShift 集群。

为什么需要集群管理员访问权限?

Argo 创建一个 CRD,此操作需要(除非另行配置)集群管理员权限。

  1. 安装 k8s Ansible 模块的依赖项
pip install kubernetes openshift
  1. 安装 kubectl(请参见 https://kubernetes.io/docs/tasks/tools/install-kubectl/)

从 Ansible Galaxy 安装角色

ansible-galaxy install thoth-station.argo_workflows

角色变量

defaults:
  # Argo 应该被部署到的命名空间
  namespace: argo

  # 这假设具有某些权限并相应地修改资源
  # 例如,假设开发人员无法创建 CRD。
  # 因此,这些资源预计在集群中已存在。
  role: cluster-admin  # 选项:developer, cluster-admin

  # 通过 kustomize 应用到基础 Argo 安装的自定义覆盖。
  # 覆盖必须存在于 [/templates/overlays/](/templates/overlays/) 文件夹中,并且必须包含有效的 `kustomization.yaml`
  overlay: ""       # 选项:openshift

  # Argo 容器运行时执行器
  executor: docker   # 选项:docker, kubelet, k8sapi, pns

  # 提交命令时是否验证 Kubernetes 模板
  validate: true

  # metricsConfig 控制 Prometheus 指标的路径和端口
  metricsEnabled: true
  metricsPath: /metrics
  metricsPort: 8080

  # telemetryConfig 控制 Prometheus 远程监控的路径和端口
  telemetryEnabled: true
  telemetryPath: /telemetry
  telemetryPort: 8080

  # 物品
  # ---------

  # 要配置的物品库种类(如果不为空)
  artifactRepository: ""

  # archiveLogs 将主容器日志归档为物品
  # 仅适用于 artifactRepository != ""
  archiveLogs: {{ archiveLogs }}

  # s3 物品库配置
  # 仅适用于 artifactRepository == "s3"
  AWS_S3_BUCKET_PREFIX: ""  # s3 存储桶前缀
  AWS_S3_ARTIFACT_PATH: ""  # 在前缀中物品目录的路径
extra:
  # 要使用的 Argo 参考
  # 可以是分支、标签或特定提交(默认为最新发布)
  - ref

  # 允许覆盖执行器和工作流控制器镜像
  - executor_image
  - workflow_controller_image

  # 如果选择了 s3 物品库,需要主机(端点)和凭据
  - AWS_S3_HOST
  - AWS_S3_BUCKET_NAME
  - AWS_S3_ACCESS_KEY_ID
  - AWS_S3_SECRET_ACCESS_KEY

示例剧本

---
- name: "基础剧本,提供 Argo 进入单个命名空间。"

  hosts: localhost
  connection: local

  roles:
  - role: thoth-station.argo_workflows
    tags:
      - argo
      - argo-workflows
    namespace: argo
    ref: v2.4.0

该角色提供了通过 Kustomize 添加自定义覆盖的选项,目前有一个现有的用于 OpenShift 环境的覆盖。使用如下:

---
- name: "基础剧本,提供 Argo 进入单个命名空间。"

  hosts: localhost
  connection: local

  roles:
  - role: thoth-station.argo_workflows
    tags:
      - argo
      - argo-workflows
    namespace: argo
    # 修补基础安装以在 OpenShift 命名空间中运行
    # 这也为 argo-ui 添加 routes
    overlay: openshift

在 minishift 和 OpenShift 3.11 中进行了测试。


许可证

MIT

作者信息

Marek Cermak macermak@redhat.com

安装
ansible-galaxy install thoth-station.argo_workflows
许可证
mit
下载
129
拥有者
Using Artificial Intelligence to analyse and recommend Software Stacks for the Python Ecosystem.