跳转至

argocdapp 插件

该插件会创建一个在 Kubernetes 上 Argo CD Application 的自定义资源。

注意:

  • 在使用该插件前需要先安装 Argocd CD。你可以使用 helm-installer 插件 来安装它。
  • 目前该插件只支持 Helm chart 的配置方式。

用例

以下内容是该插件的示例配置文件。

YAML
tools:
# name of the tool
- name: argocdapp
  # id of the tool instance
  instanceID: default
  # format: name.instanceID; If specified, dtm will make sure the dependency is applied first before handling this tool.
  dependsOn: [ "argocd.ARGOCD_INSTANCE_NAME" ]
  # options for the plugin
  options:
    # information on the ArgoCD Application
    app:
      # name of the ArgoCD Application
      name: hello
      # where the ArgoCD Application custom resource will be created
      namespace: argocd
    # destination of the ArgoCD Application
    destination:
      # on which server to deploy
      server: https://kubernetes.default.svc
      # in which namespace to deploy
      namespace: default
    # source of the application
    source:
      # which values file to use in the Helm chart
      valuefile: values.yaml
      # path of the Helm chart
      path: charts/go-hello-http
      # Helm chart repo URL, this is only an example, do not use this
      repoURL: YOUR_CHART_REPO_URL
      # Helm chart repo branch
      repoBranch: YOUR_CHART_REPO_BRANCH
    # if repo doesn't contain path, use imageRepo to create a helm config
    imageRepo:
      # imageRepo address
      url: IMAGE_REPO_ADDRESS
      user: IMAGE_REPO_OWNER
      # config inital image tag
      initalTag: IMAGE_REPO_TAG

自动创建 Helm 配置

如果你不想要自己创建 Helm 配置,该插件支持把 Devstream 提供的默认 Helm 配置上传到 source.path 的配置路径上,这样你就可以直接使用该插件。配置示例如下:

YAML
---
tools:
- name: go-webapp-argocd-deploy
  plugin: argocdapp
  dependsOn: ["repo-scaffolding.golang-github"]
  options:
    app:
      name: hello
      namespace: argocd
    destination:
      server: https://kubernetes.default.svc
      namespace: default
    source:
      valuefile: values.yaml
      path: charts/go-hello-http
      repoURL: https://github.com/devstream-io/testrepo.git
    imageRepo:
      url: http://test.barbor.com/library
      user: test_owner
      tag: "1.0.0"

这个示例配置将会把 Helm 配置 上传到 testrepo 仓库中,生成的 Helm 配置会使用 http://test.barbor.com/library/test_owner/hello:1.0.0 作为 Helm 应用的启动镜像。