Skip to content

Commit 8112fb4

Browse files
svghadianandrkskd
authored andcommitted
feat: Cache transform for Secrets and ConfigMaps to reduce memory (#1866)
* WIP Signed-off-by: Siddhesh Ghadi <[email protected]> * Code clenup and commenting Signed-off-by: Siddhesh Ghadi <[email protected]> * Add proposal doc Signed-off-by: Siddhesh Ghadi <[email protected]> * merge transform func, add tests for configmap and secret Signed-off-by: Anand Kumar Singh <[email protected]> * add env var to disable optimization, update docs Signed-off-by: Anand Kumar Singh <[email protected]> * fix CI lint failure Signed-off-by: Anand Kumar Singh <[email protected]> * incorporate PR review Signed-off-by: Anand Kumar Singh <[email protected]> * update IsTrackedByOperator func to take in runtime.Object Signed-off-by: Anand Kumar Singh <[email protected]> * Fix minor issues Signed-off-by: Siddhesh Ghadi <[email protected]> * Minor code comment updates Signed-off-by: Siddhesh Ghadi <[email protected]> * Add unit test for client Signed-off-by: Siddhesh Ghadi <[email protected]> * Fix linting Signed-off-by: Siddhesh Ghadi <[email protected]> * Use positive notion for env Signed-off-by: Siddhesh Ghadi <[email protected]> * Remove space and return patch error to caller Signed-off-by: Siddhesh Ghadi <[email protected]> * Add unit test for patch error Signed-off-by: Siddhesh Ghadi <[email protected]> * Move trackedby check out of referesh check func Signed-off-by: Siddhesh Ghadi <[email protected]> --------- Signed-off-by: Siddhesh Ghadi <[email protected]> Signed-off-by: Anand Kumar Singh <[email protected]> Co-authored-by: Anand Kumar Singh <[email protected]> Signed-off-by: Mike Ng <[email protected]>
1 parent 38b9581 commit 8112fb4

37 files changed

+7186
-25
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ COPY cmd/main.go cmd/main.go
1414
COPY api/ api/
1515
COPY common/ common/
1616
COPY controllers/ controllers/
17+
COPY pkg/ pkg/
1718
COPY version/ version/
1819

1920
# Build

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ e2e: ## Run operator e2e tests
177177

178178

179179
start-e2e:
180-
ARGOCD_CLUSTER_CONFIG_NAMESPACES="argocd-e2e-cluster-config, argocd-test-impersonation-1-046, argocd-agent-principal-1-051" make run
180+
ARGOCD_CLUSTER_CONFIG_NAMESPACES="argocd-e2e-cluster-config, argocd-test-impersonation-1-046, argocd-agent-principal-1-051, argocd-agent-agent-1-052" make run
181181

182182
all: test install run e2e ## UnitTest, Run the operator locally and execute e2e tests.
183183

api/v1alpha1/argocd_types.go

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

10211021
// Principal defines configurations for the Principal component of Argo CD Agent.
10221022
Principal *PrincipalSpec `json:"principal,omitempty"`
1023+
1024+
// Agent defines configurations for the Agent component of Argo CD Agent.
1025+
Agent *AgentSpec `json:"agent,omitempty"`
10231026
}
10241027

10251028
type PrincipalSpec struct {
@@ -1149,6 +1152,79 @@ func (a *PrincipalSpec) IsEnabled() bool {
11491152
return a.Enabled != nil && *a.Enabled
11501153
}
11511154

1155+
type AgentSpec struct {
1156+
1157+
// Enabled is the flag to enable the Agent component during Argo CD installation. (optional, default `false`)
1158+
Enabled *bool `json:"enabled,omitempty"`
1159+
1160+
// Client defines the client options for the Agent component.
1161+
Client *AgentClientSpec `json:"client,omitempty"`
1162+
1163+
// TLS defines the TLS options for the Agent component.
1164+
TLS *AgentTLSSpec `json:"tls,omitempty"`
1165+
1166+
// Redis defines the Redis options for the Agent component.
1167+
Redis *AgentRedisSpec `json:"redis,omitempty"`
1168+
}
1169+
1170+
type AgentClientSpec struct {
1171+
1172+
// PrincipalServerAddress is the remote address of the principal server to connect to.
1173+
PrincipalServerAddress string `json:"principalServerAddress,omitempty"`
1174+
1175+
// PrincipalServerPort is the remote port of the principal server to connect to.
1176+
PrincipalServerPort string `json:"principalServerPort,omitempty"`
1177+
1178+
// Creds is the credential identifier for the agent authentication
1179+
Creds string `json:"creds,omitempty"`
1180+
1181+
// Mode is the operational mode for the agent (managed or autonomous)
1182+
Mode string `json:"mode,omitempty"`
1183+
1184+
// EnableWebSocket is the flag to enable WebSocket for event streaming
1185+
EnableWebSocket *bool `json:"enableWebSocket,omitempty"`
1186+
1187+
// EnableCompression is the flag to enable compression while sending data between Principal and Agent using gRPC
1188+
EnableCompression *bool `json:"enableCompression,omitempty"`
1189+
1190+
// LogLevel refers to the log level used by the Agent component.
1191+
LogLevel string `json:"logLevel,omitempty"`
1192+
1193+
// LogFormat refers to the log format used by the Agent component.
1194+
LogFormat string `json:"logFormat,omitempty"`
1195+
1196+
// KeepAliveInterval is the interval for keep-alive pings to the principal
1197+
KeepAliveInterval string `json:"keepAliveInterval,omitempty"`
1198+
1199+
// Image is the name of Argo CD Agent image
1200+
Image string `json:"image,omitempty"`
1201+
1202+
// Env lets you specify environment for agent pods
1203+
Env []corev1.EnvVar `json:"env,omitempty"`
1204+
}
1205+
1206+
type AgentTLSSpec struct {
1207+
1208+
// SecretName is the name of the secret containing the agent client TLS certificate
1209+
SecretName string `json:"secretName,omitempty"`
1210+
1211+
// RootCASecretName is the name of the secret containing the root CA certificate
1212+
RootCASecretName string `json:"rootCASecretName,omitempty"`
1213+
1214+
// Insecure is the flag to skip TLS certificate validation when connecting to the principal (insecure, for development only)
1215+
Insecure *bool `json:"insecure,omitempty"`
1216+
}
1217+
1218+
type AgentRedisSpec struct {
1219+
1220+
// ServerAddress is the address of the Redis server to be used by the PrincAgentipal component.
1221+
ServerAddress string `json:"serverAddress,omitempty"`
1222+
}
1223+
1224+
func (a *AgentSpec) IsEnabled() bool {
1225+
return a.Enabled != nil && *a.Enabled
1226+
}
1227+
11521228
// IsDeletionFinalizerPresent checks if the instance has deletion finalizer
11531229
func (argocd *ArgoCD) IsDeletionFinalizerPresent() bool {
11541230
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
@@ -1178,6 +1178,9 @@ type ArgoCDAgentSpec struct {
11781178

11791179
// Principal defines configurations for the Principal component of Argo CD Agent.
11801180
Principal *PrincipalSpec `json:"principal,omitempty"`
1181+
1182+
// Agent defines configurations for the Agent component of Argo CD Agent.
1183+
Agent *AgentSpec `json:"agent,omitempty"`
11811184
}
11821185

11831186
type PrincipalSpec struct {
@@ -1308,6 +1311,79 @@ func (a *PrincipalSpec) IsEnabled() bool {
13081311
return a.Enabled != nil && *a.Enabled
13091312
}
13101313

1314+
type AgentSpec struct {
1315+
1316+
// Enabled is the flag to enable the Agent component during Argo CD installation. (optional, default `false`)
1317+
Enabled *bool `json:"enabled,omitempty"`
1318+
1319+
// Client defines the client options for the Agent component.
1320+
Client *AgentClientSpec `json:"client,omitempty"`
1321+
1322+
// Redis defines the Redis options for the Agent component.
1323+
Redis *AgentRedisSpec `json:"redis,omitempty"`
1324+
1325+
// TLS defines the TLS options for the Agent component.
1326+
TLS *AgentTLSSpec `json:"tls,omitempty"`
1327+
}
1328+
1329+
type AgentClientSpec struct {
1330+
1331+
// PrincipalServerAddress is the remote address of the principal server to connect to.
1332+
PrincipalServerAddress string `json:"principalServerAddress,omitempty"`
1333+
1334+
// PrincipalServerPort is the remote port of the principal server to connect to.
1335+
PrincipalServerPort string `json:"principalServerPort,omitempty"`
1336+
1337+
// Creds is the credential identifier for the agent authentication
1338+
Creds string `json:"creds,omitempty"`
1339+
1340+
// Mode is the operational mode for the agent (managed or autonomous)
1341+
Mode string `json:"mode,omitempty"`
1342+
1343+
// EnableWebSocket is the flag to enable WebSocket for event streaming
1344+
EnableWebSocket *bool `json:"enableWebSocket,omitempty"`
1345+
1346+
// EnableCompression is the flag to enable compression while sending data between Principal and Agent using gRPC
1347+
EnableCompression *bool `json:"enableCompression,omitempty"`
1348+
1349+
// LogLevel refers to the log level used by the Agent component.
1350+
LogLevel string `json:"logLevel,omitempty"`
1351+
1352+
// LogFormat refers to the log format used by the Agent component.
1353+
LogFormat string `json:"logFormat,omitempty"`
1354+
1355+
// KeepAliveInterval is the interval for keep-alive pings to the principal
1356+
KeepAliveInterval string `json:"keepAliveInterval,omitempty"`
1357+
1358+
// Image is the name of Argo CD Agent image
1359+
Image string `json:"image,omitempty"`
1360+
1361+
// Env lets you specify environment for agent pods
1362+
Env []corev1.EnvVar `json:"env,omitempty"`
1363+
}
1364+
1365+
type AgentRedisSpec struct {
1366+
1367+
// ServerAddress is the address of the Redis server to be used by the PrincAgentipal component.
1368+
ServerAddress string `json:"serverAddress,omitempty"`
1369+
}
1370+
1371+
type AgentTLSSpec struct {
1372+
1373+
// SecretName is the name of the secret containing the agent client TLS certificate
1374+
SecretName string `json:"secretName,omitempty"`
1375+
1376+
// RootCASecretName is the name of the secret containing the root CA certificate
1377+
RootCASecretName string `json:"rootCASecretName,omitempty"`
1378+
1379+
// Insecure is the flag to skip TLS certificate validation when connecting to the principal (insecure, for development only)
1380+
Insecure *bool `json:"insecure,omitempty"`
1381+
}
1382+
1383+
func (a *AgentSpec) IsEnabled() bool {
1384+
return a.Enabled != nil && *a.Enabled
1385+
}
1386+
13111387
// IsDeletionFinalizerPresent checks if the instance has deletion finalizer
13121388
func (argocd *ArgoCD) IsDeletionFinalizerPresent() bool {
13131389
for _, finalizer := range argocd.GetFinalizers() {

0 commit comments

Comments
 (0)