Skip to content

Commit

Permalink
chore: expand on originAnnotation build metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
adityathebe committed Jun 25, 2024
1 parent e4e1ad1 commit d260a2a
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions mission-control/docs/playbooks/Actions/gitops.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -126,23 +126,38 @@ GitOps action receives a set of commonly used [env vars](../../reference/playboo
They are

<Fields rows={[
{field: "git.file", description: `Name of the file that created the config resource the playbook is run against. It is extracted from the \`config.kubernetes.io/origin\` annotation. The annotation
must be present in the config resource. You can set \`buildMetadata: [originAnnotations]\` in the kustomization file.`, scheme: "string"},
{field: "git.file", description: `Name of the file that created the config resource the playbook is run against.`, scheme: "string"},
{field: "git.url", description: "URL of the git repository", scheme: "string"},
{field: "git.branch", description: "The primary branch", scheme: "string"},
{field: "kustomize.path", description: "Path of the kustomization file that created the config resource the playbook is run against. This comes from the spec of the kustomization.", scheme: "string"},
]}/>

<details summary="Origin Annotation">

In order for `git.file` to work, the `config.kubernetes.io/origin` annotation must be present in the config resource. You can set `buildMetadata: [originAnnotations]` in the kustomization file and the kustomization will
add the annotation with the correct path.

```yaml title='kustomization.yaml'
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
// highlight-next-line
buildMetadata: [originAnnotations]
resources:
- namespaces
- helmrepositories
- kustomizations
- monitoring
```

The above kustomization would add the following annotation to the config resource:

```yaml title="monitoring/alertmanager.yaml"
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
config.kubernetes.io/origin: |
path: monitoring/alertmanager.yaml
...
```
</details>

## Templating

Expand Down

0 comments on commit d260a2a

Please sign in to comment.