Skip to content

Commit a349781

Browse files
committed
feat: redis TLS encryption enabled by default for all connections
Assisted-by: Cursor Signed-off-by: Rizwana777 <[email protected]>
1 parent e25ef42 commit a349781

File tree

28 files changed

+1148
-410
lines changed

28 files changed

+1148
-410
lines changed

Makefile

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,23 @@ endif
5959
@echo ""
6060
@echo "Configuring Redis TLS (required for E2E)..."
6161
./hack/dev-env/gen-redis-tls-certs.sh
62-
@echo "Step 1: Enabling TLS on Redis servers (creates secrets)..."
62+
@echo ""
63+
@echo "Configuring each cluster for Redis TLS (Redis + ArgoCD components together)"
64+
@echo "Note: Redis and ArgoCD components are configured together per-cluster to avoid"
65+
@echo " connection errors during the transition period."
66+
@echo ""
67+
@echo "=== Control Plane ==="
6368
./hack/dev-env/configure-redis-tls.sh vcluster-control-plane
64-
./hack/dev-env/configure-redis-tls.sh vcluster-agent-managed
65-
./hack/dev-env/configure-redis-tls.sh vcluster-agent-autonomous
66-
@echo "Step 2: Configuring Argo CD components for Redis TLS..."
6769
./hack/dev-env/configure-argocd-redis-tls.sh vcluster-control-plane
70+
@echo ""
71+
@echo "=== Agent Managed ==="
72+
./hack/dev-env/configure-redis-tls.sh vcluster-agent-managed
6873
./hack/dev-env/configure-argocd-redis-tls.sh vcluster-agent-managed
74+
@echo ""
75+
@echo "=== Agent Autonomous ==="
76+
./hack/dev-env/configure-redis-tls.sh vcluster-agent-autonomous
6977
./hack/dev-env/configure-argocd-redis-tls.sh vcluster-agent-autonomous
78+
@echo ""
7079
@echo " E2E environment ready with Redis TLS enabled (required)"
7180

7281
.PHONY: teardown-e2e

agent/agent.go

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ func NewAgent(ctx context.Context, client *kube.KubernetesClient, namespace stri
327327
MinVersion: tls.VersionTLS12,
328328
}
329329
if a.redisProxyMsgHandler.redisTLSInsecure {
330+
log().Warn("INSECURE: Not verifying Redis TLS certificate for cluster cache")
330331
clusterCacheTLSConfig.InsecureSkipVerify = true
331332
} else if a.redisProxyMsgHandler.redisTLSCAPath != "" {
332333
caCertPEM, err := os.ReadFile(a.redisProxyMsgHandler.redisTLSCAPath)
@@ -441,20 +442,22 @@ func (a *Agent) Start(ctx context.Context) error {
441442

442443
// Start the background process of periodic sync of cluster cache info.
443444
// This will send periodic updates of Application, Resource and API counts to principal.
444-
if a.mode == types.AgentModeManaged {
445-
go func() {
446-
ticker := time.NewTicker(a.cacheRefreshInterval)
447-
defer ticker.Stop()
448-
for {
449-
select {
450-
case <-ticker.C:
451-
a.addClusterCacheInfoUpdateToQueue()
452-
case <-a.context.Done():
453-
return
454-
}
445+
// Both managed and autonomous agents need to send cluster cache info updates
446+
go func() {
447+
// Send initial update immediately on startup (don't wait for first ticker)
448+
a.addClusterCacheInfoUpdateToQueue()
449+
450+
ticker := time.NewTicker(a.cacheRefreshInterval)
451+
defer ticker.Stop()
452+
for {
453+
select {
454+
case <-ticker.C:
455+
a.addClusterCacheInfoUpdateToQueue()
456+
case <-a.context.Done():
457+
return
455458
}
456-
}()
457-
}
459+
}
460+
}()
458461

459462
if a.remote != nil {
460463
a.remote.SetClientMode(a.mode)

cmd/argocd-agent/principal.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ func observer(interval time.Duration) {
468468
// The secret names where the certificates are stored in are hard-coded at the
469469
// moment.
470470
func getResourceProxyTLSConfigFromKube(kubeClient *kube.KubernetesClient, namespace, certName, caName string) (*tls.Config, error) {
471-
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
471+
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
472472
defer cancel()
473473
proxyCert, err := tlsutil.TLSCertFromSecret(ctx, kubeClient.Clientset, namespace, certName)
474474
if err != nil {

0 commit comments

Comments
 (0)