@@ -23,36 +23,6 @@ deployment records to GitHub's artifact metadata API.
2323 API
24245 . Failed requests are automatically retried with exponential backoff
2525
26- ## Building
27-
28- ``` bash
29- go build -o deployment-tracker .
30- ```
31-
32- ## Usage
33-
34- ### Local Development (with kubeconfig)
35-
36- ``` bash
37- # Monitor all namespaces
38- ./deployment-tracker -kubeconfig ~ /.kube/config
39-
40- # Monitor specific namespace
41- ./deployment-tracker -kubeconfig ~ /.kube/config -namespace default
42-
43- # Use more workers
44- ./deployment-tracker -kubeconfig ~ /.kube/config -workers 4
45- ```
46-
47- ### In-Cluster Deployment
48-
49- When running inside Kubernetes, the controller automatically uses
50- in-cluster configuration:
51-
52- ``` bash
53- ./deployment-tracker
54- ```
55-
5626## Command Line Options
5727
5828| Flag | Description | Default |
@@ -73,6 +43,12 @@ in-cluster configuration:
7343| ` CLUSTER ` | Cluster name | ` "" ` |
7444| ` API_TOKEN ` | API authentication token | ` "" ` |
7545
46+ > [ !NOTE]
47+ > The provisioned API token must have ` artifact-metadata: write ` with
48+ > access to all relevant GitHub repositories (i.e all GitHub
49+ > repositories that produces container images that are loaded into the
50+ > cluster.
51+
7652### Template Variables
7753
7854The ` DN_TEMPLATE ` supports the following placeholders:
@@ -101,11 +77,7 @@ which includes:
10177
10278### Deploy to Kubernetes
10379
104- ``` bash
105- # Build and push the container image
106- docker build -t your-registry/deployment-tracker:latest .
107- docker push your-registry/deployment-tracker:latest
108-
80+ ```
10981# Update the image in the manifest, then apply
11082kubectl apply -f deploy/manifest.yaml
11183```
@@ -155,11 +127,11 @@ If you only need to monitor a single namespace, you can modify the manifest to u
155127┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
156128│ Kubernetes │ │ Controller │ │ GitHub API │
157129│ API Server │────▶│ │────▶│ │
158- │ │ │ ┌───────────┐ │ │ /orgs/{org}/ │
159- │ Pod Events │ │ │ Informer │ │ │ artifacts/ │
160- │ - Add │ │ └─────┬─────┘ │ │ metadata/ │
161- │ - Update │ │ │ │ │ deployment- │
162- │ - Delete │ │ ┌─────▼─────┐ │ │ record │
130+ │ │ │ ┌───────────┐ │ │ │
131+ │ Pod Events │ │ │ Informer │ │ │ │
132+ │ - Add │ │ └─────┬─────┘ │ │ │
133+ │ - Update │ │ │ │ │ │
134+ │ - Delete │ │ ┌─────▼─────┐ │ │ │
163135│ │ │ │ Workqueue │ │ │ │
164136│ │ │ └─────┬─────┘ │ │ │
165137│ │ │ │ │ │ │
@@ -168,22 +140,3 @@ If you only need to monitor a single namespace, you can modify the manifest to u
168140│ │ │ └───────────┘ │ │ │
169141└─────────────────┘ └─────────────────┘ └─────────────────┘
170142```
171-
172- ## API Payload
173-
174- The controller POSTs JSON payloads to ` {BASE_URL}/orgs/{ORG}/artifacts/metadata/deployment-record ` :
175-
176- ``` json
177- {
178- "name" : " nginx" ,
179- "digest" : " sha256:abc123..." ,
180- "version" : " 1.21" ,
181- "logical_environment" : " staging" ,
182- "physical_environment" : " us-east-1" ,
183- "cluster" : " prod-cluster" ,
184- "status" : " deployed" ,
185- "deployment_name" : " default/nginx/nginx"
186- }
187- ```
188-
189- The ` status ` field is either ` deployed ` (for pod creation) or ` decommissioned ` (for pod deletion).
0 commit comments