---
# System prepended metadata

title: Argo CD design

---

# Argo CD design

argocd
    sync plolicy:
        empty|automated
argocd app sync xxx
UI sync

认证：单点登录（LDAP）

UI 权限，只有管理员

环境管理：开发、测试、（UAT、生产-运维管理）

环境管理：开发、（生产-运维管理）

## addon

```yaml
apiVersion: devops.kubesphere.io/v1alpha1
kind: addon
metadata:
  label: operator
  annotations:
    icon: 'xxxx'
spec:
  categoriy: ci
  externalAddress: xx.xx.xx.xx:9090
  version: v0.0.1 # kubectl apply -f
  strategy: operator|simple|helm|simple-operator
  selector:
    matchLabels:
      component: devops-jenkins-master
status:
  phase: running
```

## Webhook

```yaml
apiVersion: devops.kubesphere.io/v1alpha1
kind: webhook
metadata:
  name: xxx
spec:
  server: http://xx.xx/xx
  secretRef:
    name: xxx
    key: xxx|token
  events:
  - push
  sslVerify: false
```

## Git Repository

```yaml
apiVersion: devops.kubesphere.io/v1alpha1
kind: GitRepository
metadata:
  annotations:
    xxxx: xxx
spec:
  provider: github|gitlab|gitee
  url: https://github.com/xx/xx (http|ssh|git)
  secretRef:
    name: xx
    namespace: xx
  webhooks:
  - webook1
  watch:
    issues: is:open
    pullRequests: is:open
status:
  watchData:
    issues:
    - title: xxx
      status: xxx
      id: xxx
    pullRequets:
    - title: xxx
      status: xxx
      id: xxx
```

## Application

```yaml
apiVersion: devops.kubesphere.io/v1alpha1
kind: Application
metadata:
  name: xxx
spec:
    kind: argocd-app|fluxcd|argocd-appset|argocd-app-patch
    source:
      repoURL: https://xx
      path: "/"
      targetRevision: ""
    destination:
      server: xxx
      namespace: xxx
      name: xx
    syncPolicy:
      automated:
        prune: true
        allowEmpty: true
    resource:
      apiVersion: argoproj.io/v1alpha1
      kind: ApplicationSet
      metadata:
        name: ks-devops-appset
        namespace: argocd
      spec:
        generators:
```

## DevOpsProject

```yaml
apiVersion: devops.kubesphere.io/v1alpha4
kind: devopsproject
spec:
  kind: argo-project
  resource:
    apiVersion: argoproj.io/v1alpha1
    kind: appproject
    spec:
      xxx: xx
```

## 命令行设计

更新镜像：`ks app update --repo xx --path xxx --image xxx=v0.0.1 --set xx=xx --action commit|pr --message 'optional message'`

触发同步：`ks app sync --name app-name`
