Skip to content

Commit 9fcddcf

Browse files
authored
feat: Agent helm chart (#463)
Signed-off-by: Anand Kumar Singh <[email protected]>
1 parent c5d8972 commit 9fcddcf

23 files changed

+1552
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: v2
2+
name: argocd-agent-agent
3+
description: A Helm chart for Kubernetes
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
13+
type: application
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18+
version: 0.1.0
19+
20+
# This is the version number of the application being deployed. This version number should be
21+
# incremented each time you make changes to the application. Versions are not expected to
22+
# follow Semantic Versioning. They should reflect the version the application is using.
23+
# It is recommended to use it with quotes.
24+
appVersion: "1.16.0"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Thank you for installing {{ include "argocd-agent-agent.name" . }}!
2+
3+
Your application has been deployed to the {{ include "argocd-agent-agent.namespace" . }} namespace.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "argocd-agent-agent.name" -}}
5+
{{- default .Chart.Name .Values.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-agent.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.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+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "argocd-agent-agent.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "argocd-agent-agent.labels" -}}
37+
helm.sh/chart: {{ include "argocd-agent-agent.chart" . }}
38+
{{ include "argocd-agent-agent.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "argocd-agent-agent.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "argocd-agent-agent.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "argocd-agent-agent.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "argocd-agent-agent.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
63+
64+
65+
{{/*
66+
Expand the namespace of the release.
67+
*/}}
68+
{{- define "argocd-agent-agent.namespace" -}}
69+
{{- default .Release.Namespace .Values.namespaceOverride | trunc 63 | trimSuffix "-" -}}
70+
{{- end }}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRole
3+
metadata:
4+
labels:
5+
app.kubernetes.io/name: argocd-agent-agent
6+
app.kubernetes.io/part-of: argocd-agent
7+
app.kubernetes.io/component: agent
8+
name: argocd-agent-agent
9+
rules:
10+
- apiGroups:
11+
- ""
12+
resources:
13+
- namespaces
14+
verbs:
15+
- list
16+
- watch
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRoleBinding
3+
metadata:
4+
labels:
5+
app.kubernetes.io/name: argocd-agent-agent
6+
app.kubernetes.io/part-of: argocd-agent
7+
app.kubernetes.io/component: agent
8+
name: argocd-agent-agent
9+
roleRef:
10+
apiGroup: rbac.authorization.k8s.io
11+
kind: ClusterRole
12+
name: argocd-agent-agent
13+
subjects:
14+
- kind: ServiceAccount
15+
name: argocd-agent-agent
16+
namespace: {{ include "argocd-agent-agent.namespace" . }}
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
labels:
5+
app.kubernetes.io/name: argocd-agent-agent
6+
app.kubernetes.io/part-of: argocd-agent
7+
app.kubernetes.io/component: agent
8+
name: argocd-agent-agent
9+
namespace: {{ include "argocd-agent-agent.namespace" . }}
10+
spec:
11+
selector:
12+
matchLabels:
13+
app.kubernetes.io/name: argocd-agent-agent
14+
app.kubernetes.io/part-of: argocd-agent
15+
app.kubernetes.io/component: agent
16+
template:
17+
metadata:
18+
labels:
19+
app.kubernetes.io/name: argocd-agent-agent
20+
app.kubernetes.io/part-of: argocd-agent
21+
app.kubernetes.io/component: agent
22+
spec:
23+
containers:
24+
- args:
25+
- agent
26+
env:
27+
- name: ARGOCD_AGENT_REMOTE_SERVER
28+
valueFrom:
29+
configMapKeyRef:
30+
name: argocd-agent-params
31+
key: agent.server.address
32+
optional: true
33+
- name: ARGOCD_AGENT_REMOTE_PORT
34+
valueFrom:
35+
configMapKeyRef:
36+
name: argocd-agent-params
37+
key: agent.server.port
38+
optional: true
39+
- name: ARGOCD_AGENT_LOG_LEVEL
40+
valueFrom:
41+
configMapKeyRef:
42+
name: argocd-agent-params
43+
key: agent.log.level
44+
optional: true
45+
- name: ARGOCD_AGENT_NAMESPACE
46+
valueFrom:
47+
configMapKeyRef:
48+
name: argocd-agent-params
49+
key: agent.namespace
50+
optional: true
51+
- name: ARGOCD_AGENT_TLS_SECRET_NAME
52+
valueFrom:
53+
configMapKeyRef:
54+
name: argocd-agent-params
55+
key: agent.tls.secret-name
56+
optional: true
57+
- name: ARGOCD_AGENT_TLS_CLIENT_CERT_PATH
58+
valueFrom:
59+
configMapKeyRef:
60+
name: argocd-agent-params
61+
key: agent.tls.client.cert-path
62+
optional: true
63+
- name: ARGOCD_AGENT_TLS_CLIENT_KEY_PATH
64+
valueFrom:
65+
configMapKeyRef:
66+
name: argocd-agent-params
67+
key: agent.tls.client.key-path
68+
optional: true
69+
- name: ARGOCD_AGENT_TLS_INSECURE
70+
valueFrom:
71+
configMapKeyRef:
72+
name: argocd-agent-params
73+
key: agent.tls.client.insecure
74+
optional: true
75+
- name: ARGOCD_AGENT_TLS_ROOT_CA_SECRET_NAME
76+
valueFrom:
77+
configMapKeyRef:
78+
name: argocd-agent-params
79+
key: agent.tls.root-ca-secret-name
80+
optional: true
81+
- name: ARGOCD_AGENT_TLS_ROOT_CA_PATH
82+
valueFrom:
83+
configMapKeyRef:
84+
name: argocd-agent-params
85+
key: agent.tls.root-ca-path
86+
optional: true
87+
- name: ARGOCD_AGENT_MODE
88+
valueFrom:
89+
configMapKeyRef:
90+
name: argocd-agent-params
91+
key: agent.mode
92+
optional: true
93+
- name: ARGOCD_AGENT_CREDS
94+
valueFrom:
95+
configMapKeyRef:
96+
name: argocd-agent-params
97+
key: agent.creds
98+
optional: true
99+
- name: ARGOCD_AGENT_METRICS_PORT
100+
valueFrom:
101+
configMapKeyRef:
102+
name: argocd-agent-params
103+
key: agent.metrics.port
104+
optional: true
105+
- name: ARGOCD_AGENT_HEALTH_CHECK_PORT
106+
valueFrom:
107+
configMapKeyRef:
108+
name: argocd-agent-params
109+
key: agent.healthz.port
110+
optional: true
111+
name: argocd-agent-agent
112+
imagePullPolicy: Always
113+
image: "{{ .Values.image }}:{{ .Values.imageTag }}"
114+
ports:
115+
- containerPort: 8000
116+
name: metrics
117+
- containerPort: 8002
118+
name: healthz
119+
securityContext:
120+
capabilities:
121+
drop:
122+
- ALL
123+
allowPrivilegeEscalation: false
124+
readOnlyRootFilesystem: true
125+
runAsNonRoot: true
126+
seccompProfile:
127+
type: RuntimeDefault
128+
volumeMounts:
129+
- name: userpass-passwd
130+
mountPath: /app/config/creds
131+
serviceAccountName: argocd-agent-agent
132+
volumes:
133+
- name: userpass-passwd
134+
secret:
135+
secretName: {{ .Values.userPasswordSecretName }}
136+
items:
137+
- key: credentials
138+
path: userpass.creds
139+
optional: true
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
labels:
5+
app.kubernetes.io/name: argocd-agent-agent
6+
app.kubernetes.io/part-of: argocd-agent
7+
app.kubernetes.io/component: agent
8+
name: argocd-agent-agent-healthz
9+
namespace: {{ include "argocd-agent-agent.namespace" . }}
10+
spec:
11+
ports:
12+
- name: healthz
13+
protocol: TCP
14+
port: 8002
15+
targetPort: 8002
16+
selector:
17+
app.kubernetes.io/name: argocd-agent-agent
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
labels:
5+
app.kubernetes.io/name: argocd-agent-agent
6+
app.kubernetes.io/part-of: argocd-agent
7+
app.kubernetes.io/component: agent
8+
name: argocd-agent-agent-metrics
9+
namespace: {{ include "argocd-agent-agent.namespace" . }}
10+
spec:
11+
ports:
12+
- name: metrics
13+
protocol: TCP
14+
port: 8181
15+
targetPort: 8181
16+
selector:
17+
app.kubernetes.io/name: argocd-agent-agent
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: argocd-agent-params
5+
namespace: {{ include "argocd-agent-agent.namespace" . }}
6+
labels:
7+
app.kubernetes.io/name: argocd-agent-agent
8+
app.kubernetes.io/part-of: argocd-agent
9+
app.kubernetes.io/component: agent
10+
data:
11+
# agent.mode: The mode this agent should operate in. Valid values are
12+
# "autonomous" or "managed".
13+
# Default: "autonomous"
14+
agent.mode: {{ .Values.agentMode }}
15+
# agent.creds: Valid credential identifier for this agent. Must be in the
16+
# format <method>:<configuration>. Valid values are:
17+
# - "userpass:_path_to_encrypted_creds_" where _path_to_encrypted_creds_ is
18+
# the path to the file containing encrypted credential for authenticatiion.
19+
# - "mtls:_agent_id_regex_" where _agent_id_regex_ is the regex pattern for
20+
# extracting the agent ID from client cert subject.
21+
# Default: ""
22+
agent.creds: {{ .Values.auth }}
23+
# agent.tls.client.insecure: Whether to skip the validation of the remote TLS
24+
# credentials. Insecure. Do only use for development purposes.
25+
# Default: false
26+
agent.tls.client.insecure: {{ .Values.tlsClientInSecure | quote }}
27+
# agent.tls.root-ca-path: The path to a file containing the certificates for
28+
# the TLS root certificate authority used to validate the remote principal.
29+
# Default: ""
30+
agent.tls.root-ca-path: {{ .Values.tlsRootCAPath }}
31+
# agent.tls.client.cert-path: Path to a file containing the agent's TLS client
32+
# certificate.
33+
# Default: ""
34+
agent.tls.client.cert-path: {{ .Values.tlsClientCertPath }}
35+
# agent.tls.client.cert-path: Path to a file containing the agent's TLS client
36+
# private key.
37+
# Default: ""
38+
agent.tls.client.key-path: {{ .Values.tlsClientKeyPath }}
39+
# agent.log.level: The log level the agent should use. Valid values are
40+
# trace, debug, info, warn and error.
41+
# Default: "info"
42+
agent.log.level: {{ .Values.logLevel }}
43+
# agent.namespace: The namespace the agent should operate and manage the
44+
# Argo CD resources in.
45+
# Default: "argocd"
46+
agent.namespace: {{ include "argocd-agent-agent.namespace" . }}
47+
# agent.principal.address: The remote address of the principal to connect
48+
# to. Can be a DNS name, an IPv4 address or an IPv6 address.
49+
# Default: ""
50+
agent.server.address: {{ .Values.server}}
51+
# agent.server.port: The remote port of the principal to connect to.
52+
# Default: "443"
53+
agent.server.port: {{ .Values.serverPort | quote }}
54+
# agent.metrics.port: The port the metrics server should listen on.
55+
# Default: 8181
56+
agent.metrics.port: {{ .Values.metricsPort | quote }}
57+
# agent.healthz.port: The port the health check server should listen on.
58+
# Default: 8002
59+
agent.healthz.port: {{ .Values.healthzPort | quote }}

0 commit comments

Comments
 (0)