Skip to content

Commit 03b8db7

Browse files
committed
feat: Support Argo CD Agent's Agent Components in operator
Signed-off-by: Mike Ng <[email protected]>
1 parent 18184f2 commit 03b8db7

25 files changed

+5352
-55
lines changed

api/v1alpha1/argocd_types.go

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,6 +1014,9 @@ type ArgoCDAgentSpec struct {
10141014

10151015
// Principal defines configurations for the Principal component of Argo CD Agent.
10161016
Principal *PrincipalSpec `json:"principal,omitempty"`
1017+
1018+
// Agent defines configurations for the Agent component of Argo CD Agent.
1019+
Agent *AgentSpec `json:"agent,omitempty"`
10171020
}
10181021

10191022
type PrincipalSpec struct {
@@ -1121,6 +1124,79 @@ func (a *PrincipalSpec) IsEnabled() bool {
11211124
return a.Enabled != nil && *a.Enabled
11221125
}
11231126

1127+
type AgentSpec struct {
1128+
1129+
// Enabled is the flag to enable the Agent component during Argo CD installation. (optional, default `false`)
1130+
Enabled *bool `json:"enabled,omitempty"`
1131+
1132+
// Client defines the client options for the Agent component.
1133+
Client *AgentClientSpec `json:"client,omitempty"`
1134+
1135+
// TLS defines the TLS options for the Agent component.
1136+
TLS *AgentTLSSpec `json:"tls,omitempty"`
1137+
1138+
// Redis defines the Redis options for the Agent component.
1139+
Redis *AgentRedisSpec `json:"redis,omitempty"`
1140+
}
1141+
1142+
type AgentClientSpec struct {
1143+
1144+
// PrincipalServerAddress is the remote address of the principal server to connect to.
1145+
PrincipalServerAddress string `json:"principalServerAddress,omitempty"`
1146+
1147+
// PrincipalServerPort is the remote port of the principal server to connect to.
1148+
PrincipalServerPort string `json:"principalServerPort,omitempty"`
1149+
1150+
// Creds is the credential identifier for the agent authentication
1151+
Creds string `json:"creds,omitempty"`
1152+
1153+
// Mode is the operational mode for the agent (managed or autonomous)
1154+
Mode string `json:"mode,omitempty"`
1155+
1156+
// EnableWebSocket is the flag to enable WebSocket for event streaming
1157+
EnableWebSocket *bool `json:"enableWebSocket,omitempty"`
1158+
1159+
// EnableCompression is the flag to enable compression while sending data between Principal and Agent using gRPC
1160+
EnableCompression *bool `json:"enableCompression,omitempty"`
1161+
1162+
// LogLevel refers to the log level used by the Agent component.
1163+
LogLevel string `json:"logLevel,omitempty"`
1164+
1165+
// LogFormat refers to the log format used by the Agent component.
1166+
LogFormat string `json:"logFormat,omitempty"`
1167+
1168+
// KeepAliveInterval is the interval for keep-alive pings to the principal
1169+
KeepAliveInterval string `json:"keepAliveInterval,omitempty"`
1170+
1171+
// Image is the name of Argo CD Agent image
1172+
Image string `json:"image,omitempty"`
1173+
1174+
// Env lets you specify environment for agent pods
1175+
Env []corev1.EnvVar `json:"env,omitempty"`
1176+
}
1177+
1178+
type AgentTLSSpec struct {
1179+
1180+
// SecretName is the name of the secret containing the agent client TLS certificate
1181+
SecretName string `json:"secretName,omitempty"`
1182+
1183+
// RootCASecretName is the name of the secret containing the root CA certificate
1184+
RootCASecretName string `json:"rootCASecretName,omitempty"`
1185+
1186+
// Insecure is the flag to skip TLS certificate validation when connecting to the principal (insecure, for development only)
1187+
Insecure *bool `json:"insecure,omitempty"`
1188+
}
1189+
1190+
type AgentRedisSpec struct {
1191+
1192+
// ServerAddress is the address of the Redis server to be used by the PrincAgentipal component.
1193+
ServerAddress string `json:"serverAddress,omitempty"`
1194+
}
1195+
1196+
func (a *AgentSpec) IsEnabled() bool {
1197+
return a.Enabled != nil && *a.Enabled
1198+
}
1199+
11241200
// IsDeletionFinalizerPresent checks if the instance has deletion finalizer
11251201
func (argocd *ArgoCD) IsDeletionFinalizerPresent() bool {
11261202
for _, finalizer := range argocd.GetFinalizers() {

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 107 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1beta1/argocd_types.go

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,6 +1172,9 @@ type ArgoCDAgentSpec struct {
11721172

11731173
// Principal defines configurations for the Principal component of Argo CD Agent.
11741174
Principal *PrincipalSpec `json:"principal,omitempty"`
1175+
1176+
// Agent defines configurations for the Agent component of Argo CD Agent.
1177+
Agent *AgentSpec `json:"agent,omitempty"`
11751178
}
11761179

11771180
type PrincipalSpec struct {
@@ -1280,6 +1283,79 @@ func (a *PrincipalSpec) IsEnabled() bool {
12801283
return a.Enabled != nil && *a.Enabled
12811284
}
12821285

1286+
type AgentSpec struct {
1287+
1288+
// Enabled is the flag to enable the Agent component during Argo CD installation. (optional, default `false`)
1289+
Enabled *bool `json:"enabled,omitempty"`
1290+
1291+
// Client defines the client options for the Agent component.
1292+
Client *AgentClientSpec `json:"client,omitempty"`
1293+
1294+
// Redis defines the Redis options for the Agent component.
1295+
Redis *AgentRedisSpec `json:"redis,omitempty"`
1296+
1297+
// TLS defines the TLS options for the Agent component.
1298+
TLS *AgentTLSSpec `json:"tls,omitempty"`
1299+
}
1300+
1301+
type AgentClientSpec struct {
1302+
1303+
// PrincipalServerAddress is the remote address of the principal server to connect to.
1304+
PrincipalServerAddress string `json:"principalServerAddress,omitempty"`
1305+
1306+
// PrincipalServerPort is the remote port of the principal server to connect to.
1307+
PrincipalServerPort string `json:"principalServerPort,omitempty"`
1308+
1309+
// Creds is the credential identifier for the agent authentication
1310+
Creds string `json:"creds,omitempty"`
1311+
1312+
// Mode is the operational mode for the agent (managed or autonomous)
1313+
Mode string `json:"mode,omitempty"`
1314+
1315+
// EnableWebSocket is the flag to enable WebSocket for event streaming
1316+
EnableWebSocket *bool `json:"enableWebSocket,omitempty"`
1317+
1318+
// EnableCompression is the flag to enable compression while sending data between Principal and Agent using gRPC
1319+
EnableCompression *bool `json:"enableCompression,omitempty"`
1320+
1321+
// LogLevel refers to the log level used by the Agent component.
1322+
LogLevel string `json:"logLevel,omitempty"`
1323+
1324+
// LogFormat refers to the log format used by the Agent component.
1325+
LogFormat string `json:"logFormat,omitempty"`
1326+
1327+
// KeepAliveInterval is the interval for keep-alive pings to the principal
1328+
KeepAliveInterval string `json:"keepAliveInterval,omitempty"`
1329+
1330+
// Image is the name of Argo CD Agent image
1331+
Image string `json:"image,omitempty"`
1332+
1333+
// Env lets you specify environment for agent pods
1334+
Env []corev1.EnvVar `json:"env,omitempty"`
1335+
}
1336+
1337+
type AgentRedisSpec struct {
1338+
1339+
// ServerAddress is the address of the Redis server to be used by the PrincAgentipal component.
1340+
ServerAddress string `json:"serverAddress,omitempty"`
1341+
}
1342+
1343+
type AgentTLSSpec struct {
1344+
1345+
// SecretName is the name of the secret containing the agent client TLS certificate
1346+
SecretName string `json:"secretName,omitempty"`
1347+
1348+
// RootCASecretName is the name of the secret containing the root CA certificate
1349+
RootCASecretName string `json:"rootCASecretName,omitempty"`
1350+
1351+
// Insecure is the flag to skip TLS certificate validation when connecting to the principal (insecure, for development only)
1352+
Insecure *bool `json:"insecure,omitempty"`
1353+
}
1354+
1355+
func (a *AgentSpec) IsEnabled() bool {
1356+
return a.Enabled != nil && *a.Enabled
1357+
}
1358+
12831359
// IsDeletionFinalizerPresent checks if the instance has deletion finalizer
12841360
func (argocd *ArgoCD) IsDeletionFinalizerPresent() bool {
12851361
for _, finalizer := range argocd.GetFinalizers() {

0 commit comments

Comments
 (0)