|
1 | | -GitOps connector Helm Chart template. |
| 1 | +# gitops-connector |
| 2 | + |
| 3 | +GitOps Connector integrates a GitOps operator with CI/CD orchestrator |
| 4 | + |
| 5 | +## Source Code |
| 6 | + |
| 7 | +* <https://github.com/azure/gitops-connector> |
| 8 | + |
| 9 | +## Installation |
| 10 | + |
| 11 | +### Install GitOps Connector with Helm |
| 12 | + |
| 13 | +Prepare **values.yaml** file and run the following command: |
| 14 | + |
| 15 | +```console |
| 16 | +helm repo add gitops-connector https://azure.github.io/gitops-connector |
| 17 | +helm upgrade gitops-connector gitops-connector \ |
| 18 | + --install \ |
| 19 | + --namespace gitops-connector \ |
| 20 | + --values values.yaml |
| 21 | +``` |
| 22 | + |
| 23 | +## Values |
| 24 | + |
| 25 | +### Single Instance vs Multiple Instances |
| 26 | + |
| 27 | +The gitops-connector supports operation in two different modes; Single Instance and Multiple Instances. |
| 28 | + |
| 29 | +### Single Instance Configuration |
| 30 | + |
| 31 | +This behaves in the same way as the original. Configuration is for one combination of gitops operator, respository and orchestrator, and config data is supplied via helm chart values as shown below. |
| 32 | + |
| 33 | +| Key | Type | Default | Description | |
| 34 | +|-----|------|---------|-------------| |
| 35 | +| singleInstance.gitRepositoryType | string | `""` | Git Repository Type (`AZDO` or `GITHUB`) | |
| 36 | +| singleInstance.ciCdOrchestratorType | string | `""` | CI/CD Orchestrator Type (`AZDO` or `GITHUB`) | |
| 37 | +| singleInstance.gitOpsOperatorType | string | `""` | GitOps Operator Type (`FLUX` or `ARGOCD`) | |
| 38 | +| singleInstance.gitOpsAppURL | string | `""` | Call back URL from the Commit Status Window e.g. `https://github.com/kaizentm/gitops-manifests/commit; https://github.com/microsoft/spektate` | |
| 39 | +| singleInstance.azdoGitOpsRepoName | string | `""` | Azure DevOps Mainifests repository name. Required if `gitRepositoryType` is `AZDO` | |
| 40 | +| singleInstance.azdoOrgUrl | string | `""` | Azure DevOps Organization URL. Required if `gitRepositoryType` or `ciCdOrchestratorType` is `AZDO`. e.g. `https://dev.azure.com/organization/project` | |
| 41 | +| singleInstance.azdoPrRepoName | string | `""` | If `ciCdOrchestratorType` is `AZDO` and when PRs are not issued to the manifests repo, but to a separate HLD repo. Optional. | |
| 42 | +| singleInstance.gitHubGitOpsManifestsRepoName | string | `""` | GitHub Mainifests repository name. Required if `gitRepositoryType` is `GITHUB` | |
| 43 | +| singleInstance.gitHubOrgUrl | string | `""` | GitHub Organization URL. Required if `gitRepositoryType` or `ciCdOrchestratorType` is `GITHUB`. e.g. `https://api.github.com/owner/repo` | |
| 44 | +| singleInstance.gitHubGitOpsRepoName | string | `""` | GitHub Actions repository name. Required if `ciCdOrchestratorType` is `GITHUB` | |
| 45 | +| singleInstance.subscribers | object | `{}` | Optional list of subscriber endpoints to send raw JSON to | |
| 46 | + |
| 47 | +### Multiple Instances Configuration |
| 48 | + |
| 49 | +Setting `singleInstance: null` in the helm chart's values file deploys a CRD for `gitopsconfig` resources and informs the gitops-connector to watch for these to automatically configure named instances of each combination of supported operator, repository and orchestrator. |
| 50 | + |
| 51 | +Each alert (Flux) or notification (ArgoCD) must send a `gitops_connector_config_name` property with a value that matches a named configuration defined by a gitsopsconfig manifest. See her for an example of a manifest: |
| 52 | + |
| 53 | +``` |
| 54 | +apiVersion: example.com/v1 |
| 55 | +kind: GitOpsConfig |
| 56 | +metadata: |
| 57 | + name: my-gitops-repo-stage-dev |
| 58 | +spec: |
| 59 | + gitRepositoryType: "AZDO" |
| 60 | + ciCdOrchestratorType: "AZDO" |
| 61 | + gitOpsOperatorType: "ARGOCD" |
| 62 | + gitOpsAppURL: "https://dev.azure.com/myorg/MyProject/_git/my-gitops-repo" |
| 63 | + azdoGitOpsRepoName: "my-gitops-repo" |
| 64 | + azdoPrRepoName: "my-gitops-repo" |
| 65 | + azdoOrgUrl: "https://dev.azure.com/myorg/MyProject" |
| 66 | +``` |
| 67 | + |
| 68 | +For this configuration to be used for processing a message from a gitop operator, setup the required Alert or Notification as follows. |
| 69 | + |
| 70 | +#### ArgoCD Notifications Setup |
| 71 | +``` |
| 72 | +data: |
| 73 | + trigger.sync-operation-status: | |
| 74 | + - when: app.status.operationState.phase in ['Error', 'Failed'] |
| 75 | + send: [sync-operation-status-change] |
| 76 | + - when: app.status.operationState.phase in ['Succeeded'] |
| 77 | + send: [sync-operation-status-change] |
| 78 | + - when: app.status.operationState.phase in ['Running'] |
| 79 | + send: [sync-operation-status-change] |
| 80 | + - when: app.status.health.status in ['Progressing'] |
| 81 | + send: [sync-operation-status-change] |
| 82 | + - when: app.status.health.status in ['Healthy'] && app.status.operationState.phase in ['Succeeded'] |
| 83 | + send: [sync-operation-status-change] |
| 84 | + - when: app.status.health.status in ['Unknown', 'Suspended', 'Degraded', 'Missing', 'Healthy'] |
| 85 | + send: [sync-operation-status-change] |
| 86 | + service.webhook.gitops-connector: | |
| 87 | + url: http://gitops-connector.gitops:8080/gitopsphase |
| 88 | + headers: |
| 89 | + - name: Content-Type |
| 90 | + value: application/json |
| 91 | + template.sync-operation-status-change: | |
| 92 | + webhook: |
| 93 | + gitops-connector: |
| 94 | + method: POST |
| 95 | + body: | |
| 96 | + { |
| 97 | + "commitid": "{{.app.status.operationState.operation.sync.revision}}", |
| 98 | + "phase": "{{.app.status.operationState.phase}}", |
| 99 | + "sync_status": "{{.app.status.sync.status}}", |
| 100 | + "health": "{{.app.status.health.status}}", |
| 101 | + "message": "{{.app.status.operationState.message}}", |
| 102 | + "resources": {{toJson .app.status.resources}}, |
| 103 | + "gitops_connector_config_name": "{{ index .app.metadata.annotations "gitops-connector-config-name" }}" |
| 104 | + } |
| 105 | +``` |
| 106 | + |
| 107 | +This config expects the monitored Application manifest to have an annotation of `gitops-connector-config-name` set with the value of the named configuration that should handle the notifications. |
| 108 | + |
| 109 | +#### FluxV2 Alert Setup |
| 110 | +``` |
| 111 | +apiVersion: notification.toolkit.fluxcd.io/v1beta2 |
| 112 | +kind: Provider |
| 113 | +metadata: |
| 114 | + name: my-gitops-repo-connector |
| 115 | + namespace: flux-system |
| 116 | +spec: |
| 117 | + type: generic |
| 118 | + address: http://gitops-connector:8080/gitopsphase |
| 119 | + |
| 120 | +apiVersion: notification.toolkit.fluxcd.io/v1beta2 |
| 121 | +kind: Alert |
| 122 | +metadata: |
| 123 | + name: my-gitops-repo-connector |
| 124 | + namespace: flux-system |
| 125 | +spec: |
| 126 | + eventMetadata: |
| 127 | + gitops_connector_config_name: my-gitops-repo-stage-dev |
| 128 | + eventSeverity: info |
| 129 | + providerRef: |
| 130 | + name: my-gitops-repo-connector |
| 131 | + eventSources: |
| 132 | + - kind: GitRepository |
| 133 | + name: my-gitops-repo-source |
| 134 | + - kind: Kustomization |
| 135 | + name: my-gitops-repo-kustomization |
| 136 | +``` |
| 137 | + |
| 138 | +### Common |
| 139 | + |
| 140 | +| Key | Type | Default | Description | |
| 141 | +|-----|------|---------|-------------| |
| 142 | +| orchestratorPAT | string | `""` | GitHub or Azure DevOps personal access token | |
| 143 | +| nameOverride | string | `""` | Partially override resource names (adds suffix) | |
| 144 | +| fullnameOverride | string | `""` | Fully override resource names | |
| 145 | +| extraObjects | tpl/list | `[]` | Array of extra objects to deploy with the release | |
| 146 | + |
| 147 | +### Parameters |
| 148 | + |
| 149 | +| Key | Type | Default | Description | |
| 150 | +|-----|------|---------|-------------| |
| 151 | +| image.repository | string | `"ghcr.io/azure/gitops-connector"` | Image repository | |
| 152 | +| image.pullPolicy | string | `"IfNotPresent"` | Image pull policy | |
| 153 | +| image.tag | string | `""` | Overrides the image tag whose default is the chart appVersion | |
| 154 | +| imagePullSecrets | list | `[]` | Image pull secrets | |
| 155 | +| env | tpl/list | `[]` | Additional environment variables | |
| 156 | +| envFrom | tpl/list | `[]` | Additional environment variables from a secret or configMap | |
| 157 | +| resources | object | `{}` | Container Resources requests and limits | |
| 158 | +| securityContext | object | `{}` | Container Security Context | |
| 159 | +| podAnnotations | tpl/object | `{}` | Additional annotations for pod | |
| 160 | +| podLabels | tpl/object | `{}` | Additional labels for pod | |
| 161 | +| podSecurityContext | object | `{}` | Pod Security Context | |
| 162 | +| affinity | object | `{}` | Pod Affinity configuration | |
| 163 | +| nodeSelector | object | `{}` | Pod Node Selector configuration | |
| 164 | +| tolerations | list | `[]` | Pod Tolerations configuration | |
| 165 | +| volumes | tpl/list | `[]` | Additional volumes to the pod | |
| 166 | +| volumeMounts | tpl/list | `[]` | Additional volumeMounts to the container | |
| 167 | +| service.type | string | `"ClusterIP"` | Service type | |
| 168 | +| service.port | int | `8080` | Port to expose | |
| 169 | +| serviceAccount.create | bool | `true` | Specifies whether a service account should be created | |
| 170 | +| serviceAccount.automount | bool | `true` | Specifies whether a service account token should be mounted | |
| 171 | +| serviceAccount.annotations | tpl/object | `{}` | Annotations to add to the service account | |
| 172 | +| serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template | |
| 173 | + |
0 commit comments