Skip to content

Commit c1af741

Browse files
committed
Add installation instructions
Signed-off-by: Matias Pan <matipan@hey.com>
1 parent 1d97835 commit c1af741

7 files changed

Lines changed: 90 additions & 171 deletions

File tree

LICENSE

Lines changed: 0 additions & 73 deletions
This file was deleted.

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# argocd-github-release-generator
2+
`argocd-github-release-generator` is an [ArgoCD Plugin Generator](https://argo-cd.readthedocs.io/en/stable/operator-manual/applicationset/Generators-Plugin/) for `ApplicationSet`s that generates an ArgoCD application for each Github Release on a given repository.
3+
4+
## Installing
5+
> [!NOTE]
6+
> For installing this project we assume that you have a k8s cluster with ArgoCD installed up and running.
7+
8+
This project is composed of 4 components:
9+
- [Secret](k8s/install.yaml#L1): stores the ArgoCD Token (used to authorize requests coming from ArgoCD) and an optional GITHUB_PAT (used to access private repositories and/or have a bigger rate limit).
10+
- [ConfigMap](k8s/install.yaml#L13): contains the plugin configuration that ArgoCD reads to know how to communicate and authenticate with it.
11+
- [Deployment](k8s/install.yaml#L22): deploys the actual plugin that responds to HTTP requests coming from ArgoCD.
12+
- [Service](k8s/install.yaml#L69): exposes the deployment internally for ArgoCD to reach it.
13+
14+
To install it in your cluster you can run:
15+
```terminal
16+
$ ARGOCD_TOKEN="$(echo -n '<strong_password>' | base64)" envsubst < [URL] | k apply -f -
17+
```
18+
19+
> [!TIP]
20+
> If you plan to watch private repositories or have a refresh interval lower than 1 per minute then you must specify a GITHUB_PAT.
21+
> `$ GITHUB_PAT=<YOUR_PAT> ARGOCD_TOKEN="$(echo -n '<strong_password>' | base64)" envsubst < [URL] | k apply -f -`
22+
23+
## Setting up your ApplicationSet
24+
25+
The plugin receives two parameters that you must configure:
26+
- `repository`: specify the repository that should be used to look for releases.
27+
- `min_release`: specify the starting point for the releases. This value is useful to control how many applications you generate and remove applications related to old releases.
28+
29+
> [!NOTE]
30+
> At the moment this project only supports releases that follow `semver` (e.g `v0.1.0`)
31+
32+
With plugin generators you also configure the interval with which ArgoCD polls this plugin. Keep this interval in mind given that each request to the plugin will make a request to Github's API. If you have not configured a GITHUB_PAT then you have a rate limit of 60 requests per hour (one per minute).
33+
34+
An example ApplicationSet that watches the [dagger/dagger](https://github.com/dagger/dagger) repository every minute and creates applications for releases starting at `v0.9.8`:
35+
```
36+
apiVersion: argoproj.io/v1alpha1
37+
kind: ApplicationSet
38+
metadata:
39+
name: <YOUR_APPLICATION_SET_NAME>
40+
spec:
41+
generators:
42+
- plugin:
43+
configMapRef:
44+
# Specify argocd where the configuration of this plugin can be found
45+
name: argocd-github-release-generator
46+
input:
47+
parameters:
48+
repository: "dagger/dagger"
49+
min_release: v0.9.8
50+
requeueAfterSeconds: 60
51+
52+
template:
53+
[Your application configuration]
54+
```

k8s/appset.yaml

Lines changed: 0 additions & 69 deletions
This file was deleted.
Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: argocd-github-release-generator
5+
namespace: argocd
6+
labels:
7+
app.kubernetes.io/part-of: argocd
8+
type: Opaque
9+
data:
10+
plugin.argocd-github-release-generator.token: ${ARGOCD_TOKEN}
11+
plugin.argocd-github-release-generator.github_pat: ${GITHUB_PAT}
12+
---
13+
apiVersion: v1
14+
kind: ConfigMap
15+
metadata:
16+
name: argocd-github-release-generator
17+
namespace: argocd
18+
data:
19+
token: "$argocd-github-release-generator:plugin.argocd-github-release-generator.token"
20+
baseUrl: "http://argocd-github-release-generator.argocd.svc.cluster.local:8080"
21+
---
122
apiVersion: apps/v1
223
kind: Deployment
324
metadata:
@@ -33,7 +54,7 @@ spec:
3354
key: plugin.argocd-github-release-generator.github_pat
3455
name: argocd-github-release-generator
3556
image: ghcr.io/matipan/argocd-github-release-generator:test
36-
imagePullPolicy: Always
57+
imagePullPolicy: IfNotPresent
3758
name: argocd-github-release-generator
3859
ports:
3960
- containerPort: 8080
@@ -44,3 +65,17 @@ spec:
4465
requests:
4566
cpu: 150m
4667
memory: 100Mi
68+
---
69+
apiVersion: v1
70+
kind: Service
71+
metadata:
72+
name: argocd-github-release-generator
73+
namespace: argocd
74+
spec:
75+
type: ClusterIP
76+
selector:
77+
app: argocd-github-release-generator
78+
ports:
79+
- port: 8080
80+
name: http
81+
targetPort: 8080

k8s/manifests/kustomization.yaml

Lines changed: 0 additions & 4 deletions
This file was deleted.

k8s/manifests/secret.yaml

Lines changed: 0 additions & 11 deletions
This file was deleted.

k8s/manifests/service.yaml

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)