Skip to content

Commit 2b698c7

Browse files
committed
Add helpers and charts
Signed-off-by: navin <[email protected]>
1 parent d1cd1dc commit 2b698c7

22 files changed

+1315
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: v2
2+
name: argocd-agent-principal
3+
description: A Helm chart for ArgoCD Agent Principal
4+
type: application
5+
version: 0.3.1
6+
appVersion: "0.3.1"
7+
home: https://github.com/argoproj-labs/argocd-agent
8+
sources:
9+
- https://github.com/argoproj-labs/argocd-agent
10+
maintainers:
11+
- name: ArgoCD Agent Team
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
1. Get the application URL by running these commands:
2+
{{- if eq .Values.service.type "NodePort" }}
3+
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "argocd-agent-principal.serviceName" . }})
4+
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
5+
echo https://$NODE_IP:$NODE_PORT
6+
{{- else if eq .Values.service.type "LoadBalancer" }}
7+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
8+
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "argocd-agent-principal.serviceName" . }}'
9+
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "argocd-agent-principal.serviceName" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
10+
echo https://$SERVICE_IP:{{ .Values.service.port }}
11+
{{- else if eq .Values.service.type "ClusterIP" }}
12+
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "argocd-agent-principal.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
13+
echo "Visit https://127.0.0.1:8443 to use your application"
14+
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8443:{{ .Values.principal.listen.port }}
15+
{{- end }}
16+
17+
2. The ArgoCD Agent Principal is now running with the following configuration:
18+
- Listen Port: {{ .Values.principal.listen.port }}
19+
- Metrics Port: {{ .Values.principal.metrics.port }}
20+
- Health Check Port: {{ .Values.principal.healthz.port }}
21+
- Operating Namespace: {{ .Values.principal.namespace }}
22+
{{- if .Values.principal.allowedNamespaces }}
23+
- Allowed Namespaces: {{ .Values.principal.allowedNamespaces }}
24+
{{- end }}
25+
26+
3. To view the logs:
27+
kubectl logs -f deployment/{{ include "argocd-agent-principal.fullname" . }} -n {{ .Release.Namespace }}
28+
29+
{{- if .Values.metricsService.enabled }}
30+
4. Metrics are available at:
31+
kubectl port-forward svc/{{ include "argocd-agent-principal.metricsServiceName" . }} {{ .Values.metricsService.port }}:{{ .Values.metricsService.port }} -n {{ .Release.Namespace }}
32+
Then visit http://localhost:{{ .Values.metricsService.port }}/metrics
33+
{{- end }}
34+
35+
{{- if .Values.healthzService.enabled }}
36+
5. Health check is available at:
37+
kubectl port-forward svc/{{ include "argocd-agent-principal.healthzServiceName" . }} {{ .Values.healthzService.port }}:{{ .Values.healthzService.port }} -n {{ .Release.Namespace }}
38+
Then visit http://localhost:{{ .Values.healthzService.port }}/healthz
39+
{{- end }}
40+
41+
{{- if not .Values.secrets.userpass.passwd }}
42+
43+
WARNING: You have not set a password for user authentication.
44+
Please update the userpass secret or set principal.auth to use mTLS authentication.
45+
46+
To set a password:
47+
kubectl create secret generic {{ include "argocd-agent-principal.userpassSecretName" . }} \
48+
--from-literal=passwd="your-encrypted-password" \
49+
-n {{ .Release.Namespace }}
50+
{{- end }}
51+
52+
{{- if and .Values.principal.tls.server.allowGenerate (eq .Values.principal.tls.server.allowGenerate "true") }}
53+
54+
WARNING: TLS certificate generation is enabled. This is insecure and should only be used for development.
55+
For production, please provide proper TLS certificates.
56+
{{- end }}
57+
58+
{{- if and .Values.principal.jwt.allowGenerate (eq .Values.principal.jwt.allowGenerate "true") }}
59+
60+
WARNING: JWT key generation is enabled. This is insecure and should only be used for development.
61+
For production, please provide a proper JWT signing key.
62+
{{- end }}
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
# ArgoCD Agent Principal
2+
3+
This Helm chart installs the ArgoCD Agent Principal component, which is part of the ArgoCD Agent system that enables multi-cluster application deployment and management.
4+
5+
## Prerequisites
6+
7+
- Kubernetes 1.19+
8+
- Helm 3.2+
9+
- ArgoCD installed in the cluster
10+
- Redis instance for agent communication
11+
12+
## Installing the Chart
13+
14+
To install the chart with the release name `argocd-agent-principal`:
15+
16+
```bash
17+
helm install argocd-agent-principal . -n argocd
18+
```
19+
20+
To install with custom values:
21+
22+
```bash
23+
helm install argocd-agent-principal . -n argocd -f values.yaml
24+
```
25+
26+
## Uninstalling the Chart
27+
28+
To uninstall/delete the `argocd-agent-principal` deployment:
29+
30+
```bash
31+
helm uninstall argocd-agent-principal -n argocd
32+
```
33+
34+
## Configuration
35+
36+
The following table lists the configurable parameters of the ArgoCD Agent Principal chart and their default values.
37+
38+
### Basic Configuration
39+
40+
| Parameter | Description | Default |
41+
|-----------|-------------|---------|
42+
| `namespace` | Target namespace for deployment | `argocd` |
43+
| `replicaCount` | Number of replicas | `1` |
44+
45+
### Image Configuration
46+
47+
| Parameter | Description | Default |
48+
|-----------|-------------|---------|
49+
| `image.repository` | Image repository | `ghcr.io/argoproj-labs/argocd-agent/argocd-agent` |
50+
| `image.tag` | Image tag | `"d7ee8580"` |
51+
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
52+
53+
### Resource Configuration
54+
55+
| Parameter | Description | Default |
56+
|-----------|-------------|---------|
57+
| `resources.limits.cpu` | CPU limit | `2` |
58+
| `resources.limits.memory` | Memory limit | `4Gi` |
59+
| `resources.requests.cpu` | CPU request | `2` |
60+
| `resources.requests.memory` | Memory request | `4Gi` |
61+
62+
### Service Configuration
63+
64+
| Parameter | Description | Default |
65+
|-----------|-------------|---------|
66+
| `service.type` | Service type | `LoadBalancer` |
67+
| `service.port` | Service port | `443` |
68+
| `service.targetPort` | Target port | `8443` |
69+
| `service.annotations` | Service annotations | `networking.gke.io/load-balancer-type: "Internal"` |
70+
71+
### Metrics Service
72+
73+
| Parameter | Description | Default |
74+
|-----------|-------------|---------|
75+
| `metricsService.enabled` | Enable metrics service | `true` |
76+
| `metricsService.type` | Metrics service type | `ClusterIP` |
77+
| `metricsService.port` | Metrics service port | `8000` |
78+
79+
### Health Check Service
80+
81+
| Parameter | Description | Default |
82+
|-----------|-------------|---------|
83+
| `healthzService.enabled` | Enable health check service | `true` |
84+
| `healthzService.type` | Health check service type | `ClusterIP` |
85+
| `healthzService.port` | Health check service port | `8003` |
86+
87+
### Principal Configuration
88+
89+
| Parameter | Description | Default |
90+
|-----------|-------------|---------|
91+
| `principal.listen.port` | gRPC server listen port | `8443` |
92+
| `principal.listen.host` | gRPC server listen host | `""` (all interfaces) |
93+
| `principal.log.level` | Log level (trace, debug, info, warn, error) | `info` |
94+
| `principal.log.format` | Log format (text, json) | `text` |
95+
| `principal.metrics.port` | Metrics server port | `8000` |
96+
| `principal.healthz.port` | Health check server port | `8003` |
97+
| `principal.namespace` | Principal operation namespace | `"argocd"` |
98+
| `principal.allowedNamespaces` | Allowed namespaces for agents | `"argocd,argocd-apps,default"` |
99+
100+
### Namespace Management
101+
102+
| Parameter | Description | Default |
103+
|-----------|-------------|---------|
104+
| `principal.namespaceCreate.enable` | Allow namespace creation | `true` |
105+
| `principal.namespaceCreate.pattern` | Namespace creation pattern | `"-agent"` |
106+
| `principal.namespaceCreate.labels` | Labels for created namespaces | `"managed-by=argocd-agent,environment=production"` |
107+
108+
### TLS Configuration
109+
110+
| Parameter | Description | Default |
111+
|-----------|-------------|---------|
112+
| `principal.tls.secretName` | TLS secret name | `"argocd-agent-principal-tls"` |
113+
| `principal.tls.server.allowGenerate` | Allow TLS cert generation | `false` |
114+
| `principal.tls.server.rootCaSecretName` | Root CA secret name | `"argocd-agent-ca"` |
115+
| `principal.tls.clientCert.require` | Require client certificates | `true` |
116+
| `principal.tls.clientCert.matchSubject` | Match subject to agent name | `true` |
117+
118+
### Redis Configuration
119+
120+
| Parameter | Description | Default |
121+
|-----------|-------------|---------|
122+
| `principal.redis.compressionType` | Redis compression type | `"gzip"` |
123+
| `principal.redis.server.address` | Redis server address | `"argocd-redis:6379"` |
124+
125+
### Resource Proxy
126+
127+
| Parameter | Description | Default |
128+
|-----------|-------------|---------|
129+
| `principal.redisProxy.enabled` | Enable Redis proxy | `true` |
130+
| `principal.resourceProxy.enabled` | Enable resource proxy | `true` |
131+
| `principal.resourceProxy.secretName` | Resource proxy TLS secret | `"argocd-agent-resource-proxy-tls"` |
132+
| `principal.resourceProxy.ca.secretName` | Resource proxy CA secret | `"argocd-agent-ca"` |
133+
134+
### JWT Configuration
135+
136+
| Parameter | Description | Default |
137+
|-----------|-------------|---------|
138+
| `principal.jwt.allowGenerate` | Allow JWT key generation | `false` |
139+
| `principal.jwt.secretName` | JWT secret name | `"argocd-agent-jwt"` |
140+
141+
### Advanced Configuration
142+
143+
| Parameter | Description | Default |
144+
|-----------|-------------|---------|
145+
| `principal.websocket.enable` | Enable WebSocket streaming | `false` |
146+
| `principal.keepAlive.minInterval` | Keep-alive minimum interval | `"0"` |
147+
| `principal.pprof.port` | pprof server port | `"0"` (disabled) |
148+
149+
### Secrets Configuration
150+
151+
| Parameter | Description | Default |
152+
|-----------|-------------|---------|
153+
| `secrets.ca.tls.create` | Create CA TLS secret | `true` |
154+
| `secrets.ca.tls.key` | CA private key (base64) | `<provided>` |
155+
| `secrets.ca.tls.crt` | CA certificate (base64) | `<provided>` |
156+
157+
## Usage
158+
159+
The principal component should be installed in the management cluster where ArgoCD is running. It will coordinate with the agent components installed in remote clusters.
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "argocd-agent-principal.name" -}}
5+
{{- default .Chart.Name .Values.global.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "argocd-agent-principal.fullname" -}}
14+
{{- if .Values.global.fullnameOverride }}
15+
{{- .Values.global.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.global.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
27+
{{/*
28+
Common labels
29+
*/}}
30+
{{- define "argocd-agent-principal.labels" -}}
31+
{{ include "argocd-agent-principal.selectorLabels" . }}
32+
{{- if .Chart.AppVersion }}
33+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
34+
{{- end }}
35+
app.kubernetes.io/managed-by: {{ .Release.Service }}
36+
app.kubernetes.io/part-of: argocd-agent
37+
app.kubernetes.io/component: principal
38+
{{- with .Values.labels }}
39+
{{ toYaml . }}
40+
{{- end }}
41+
{{- end }}
42+
43+
{{/*
44+
Selector labels
45+
*/}}
46+
{{- define "argocd-agent-principal.selectorLabels" -}}
47+
app.kubernetes.io/name: {{ include "argocd-agent-principal.name" . }}
48+
app.kubernetes.io/instance: {{ .Release.Name }}
49+
{{- end }}
50+
51+
{{/*
52+
Create the name of the service account to use
53+
*/}}
54+
{{- define "argocd-agent-principal.serviceAccountName" -}}
55+
{{- if .Values.serviceAccount.create }}
56+
{{- default (include "argocd-agent-principal.fullname" .) .Values.serviceAccount.name }}
57+
{{- else }}
58+
{{- default "default" .Values.serviceAccount.name }}
59+
{{- end }}
60+
{{- end }}
61+
62+
{{/*
63+
Create the name of the config map
64+
*/}}
65+
{{- define "argocd-agent-principal.configMapName" -}}
66+
{{- printf "%s-params" (include "argocd-agent-principal.fullname" .) }}
67+
{{- end }}
68+
69+
{{/*
70+
Create the name of the main service
71+
*/}}
72+
{{- define "argocd-agent-principal.serviceName" -}}
73+
{{- include "argocd-agent-principal.fullname" . }}
74+
{{- end }}
75+
76+
{{/*
77+
Create the name of the metrics service
78+
*/}}
79+
{{- define "argocd-agent-principal.metricsServiceName" -}}
80+
{{- printf "%s-metrics" (include "argocd-agent-principal.fullname" .) }}
81+
{{- end }}
82+
83+
{{/*
84+
Create the name of the healthz service
85+
*/}}
86+
{{- define "argocd-agent-principal.healthzServiceName" -}}
87+
{{- printf "%s-healthz" (include "argocd-agent-principal.fullname" .) }}
88+
{{- end }}
89+
90+
{{/*
91+
Create the name of the cluster role
92+
*/}}
93+
{{- define "argocd-agent-principal.clusterRoleName" -}}
94+
{{- include "argocd-agent-principal.fullname" . }}
95+
{{- end }}
96+
97+
{{/*
98+
Create the name of the role
99+
*/}}
100+
{{- define "argocd-agent-principal.roleName" -}}
101+
{{- include "argocd-agent-principal.fullname" . }}
102+
{{- end }}
103+
104+
{{/*
105+
Create the name of the cluster role binding
106+
*/}}
107+
{{- define "argocd-agent-principal.clusterRoleBindingName" -}}
108+
{{- include "argocd-agent-principal.fullname" . }}
109+
{{- end }}
110+
111+
{{/*
112+
Create the name of the role binding
113+
*/}}
114+
{{- define "argocd-agent-principal.roleBindingName" -}}
115+
{{- include "argocd-agent-principal.fullname" . }}
116+
{{- end }}
117+
118+
119+
{{/*
120+
Create the name of the userpass secret
121+
*/}}
122+
{{- define "argocd-agent-principal.userpassSecretName" -}}
123+
{{- printf "%s-userpass" (include "argocd-agent-principal.fullname" .) }}
124+
{{- end }}
125+
126+
127+
{{/*
128+
Common annotations
129+
*/}}
130+
{{- define "argocd-agent-principal.annotations" -}}
131+
{{- with .Values.annotations }}
132+
{{ toYaml . }}
133+
{{- end }}
134+
{{- end }}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{{- if .Values.secrets.ca.tls.create }}
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
name: argocd-agent-ca
6+
namespace: {{ .Values.namespace }}
7+
labels:
8+
{{- include "argocd-agent-principal.labels" . | nindent 4 }}
9+
type: kubernetes.io/tls
10+
data:
11+
tls.crt: {{ .Values.secrets.ca.tls.crt | quote }}
12+
tls.key: {{ .Values.secrets.ca.tls.key | quote }}
13+
{{ end }}

0 commit comments

Comments
 (0)