Skip to content

Commit 0be5edf

Browse files
authored
fix: Redis server address is hardcoded for principal deployment (#1888)
Signed-off-by: Jayendra Parsai <[email protected]>
1 parent 0210a93 commit 0be5edf

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

controllers/argocdagent/deployment.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ func getPrincipalRedisServerAddress(cr *argoproj.ArgoCD) string {
503503
if hasRedis(cr) && cr.Spec.ArgoCDAgent.Principal.Redis.ServerAddress != "" {
504504
return cr.Spec.ArgoCDAgent.Principal.Redis.ServerAddress
505505
}
506-
return "argocd-redis:6379"
506+
return fmt.Sprintf("%s-%s:%d", cr.Name, "redis", common.ArgoCDDefaultRedisPort)
507507
}
508508

509509
func getPrincipalRedisCompressionType(cr *argoproj.ArgoCD) string {

tests/ginkgo/sequential/1-051_validate_argocd_agent_principal_test.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"crypto/x509"
2424
"crypto/x509/pkix"
2525
"encoding/pem"
26+
"fmt"
2627
"math/big"
2728
"net"
2829
"strings"
@@ -39,6 +40,7 @@ import (
3940
"sigs.k8s.io/controller-runtime/pkg/client"
4041

4142
argov1beta1api "github.com/argoproj-labs/argocd-operator/api/v1beta1"
43+
"github.com/argoproj-labs/argocd-operator/common"
4244
"github.com/argoproj-labs/argocd-operator/controllers/argocdagent"
4345
"github.com/argoproj-labs/argocd-operator/tests/ginkgo/fixture"
4446
argocdFixture "github.com/argoproj-labs/argocd-operator/tests/ginkgo/fixture/argocd"
@@ -51,8 +53,8 @@ import (
5153
var _ = Describe("GitOps Operator Sequential E2E Tests", func() {
5254

5355
const (
54-
argoCDName = "argocd"
55-
argoCDAgentPrincipalName = "argocd-agent-principal"
56+
argoCDName = "example"
57+
argoCDAgentPrincipalName = "example-agent-principal" // argoCDName + "-agent-principal"
5658
)
5759

5860
Context("1-051_validate_argocd_agent_principal", func() {
@@ -142,13 +144,13 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() {
142144

143145
clusterRole = &rbacv1.ClusterRole{
144146
ObjectMeta: metav1.ObjectMeta{
145-
Name: "argocd-argocd-agent-principal-1-051-agent-principal",
147+
Name: fmt.Sprintf("%s-%s-agent-principal", argoCDName, ns.Name),
146148
},
147149
}
148150

149151
clusterRoleBinding = &rbacv1.ClusterRoleBinding{
150152
ObjectMeta: metav1.ObjectMeta{
151-
Name: "argocd-argocd-agent-principal-1-051-agent-principal",
153+
Name: fmt.Sprintf("%s-%s-agent-principal", argoCDName, ns.Name),
152154
},
153155
}
154156

@@ -160,8 +162,8 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() {
160162
"argocd-agent-resource-proxy-tls",
161163
}
162164

163-
serviceNames = []string{argoCDAgentPrincipalName, "argocd-agent-principal-metrics", "argocd-redis", "argocd-repo-server", "argocd-server", "argocd-agent-principal-resource-proxy", "argocd-agent-principal-healthz"}
164-
deploymentNames = []string{"argocd-redis", "argocd-repo-server", "argocd-server"}
165+
serviceNames = []string{argoCDAgentPrincipalName, fmt.Sprintf("%s-agent-principal-metrics", argoCDName), fmt.Sprintf("%s-redis", argoCDName), fmt.Sprintf("%s-repo-server", argoCDName), fmt.Sprintf("%s-server", argoCDName), fmt.Sprintf("%s-agent-principal-resource-proxy", argoCDName), fmt.Sprintf("%s-agent-principal-healthz", argoCDName)}
166+
deploymentNames = []string{fmt.Sprintf("%s-redis", argoCDName), fmt.Sprintf("%s-repo-server", argoCDName), fmt.Sprintf("%s-server", argoCDName)}
165167

166168
principalDeployment = &appsv1.Deployment{
167169
ObjectMeta: metav1.ObjectMeta{
@@ -183,7 +185,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() {
183185
argocdagent.EnvArgoCDPrincipalAuth: "mtls:CN=([^,]+)",
184186
argocdagent.EnvArgoCDPrincipalEnableResourceProxy: "true",
185187
argocdagent.EnvArgoCDPrincipalKeepAliveMinInterval: "30s",
186-
argocdagent.EnvArgoCDPrincipalRedisServerAddress: "argocd-redis:6379",
188+
argocdagent.EnvArgoCDPrincipalRedisServerAddress: fmt.Sprintf("%s-%s:%d", argoCDName, "redis", common.ArgoCDDefaultRedisPort),
187189
argocdagent.EnvArgoCDPrincipalRedisCompressionType: "gzip",
188190
argocdagent.EnvArgoCDPrincipalLogFormat: "text",
189191
argocdagent.EnvArgoCDPrincipalEnableWebSocket: "false",
@@ -392,7 +394,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() {
392394
Eventually(clusterRoleBinding).Should(k8sFixture.NotExistByName())
393395
Eventually(principalDeployment).Should(k8sFixture.NotExistByName())
394396

395-
for _, serviceName := range []string{argoCDAgentPrincipalName, "argocd-agent-principal-metrics"} {
397+
for _, serviceName := range []string{argoCDAgentPrincipalName, fmt.Sprintf("%s-agent-principal-metrics", argoCDName)} {
396398
service := &corev1.Service{
397399
ObjectMeta: metav1.ObjectMeta{
398400
Name: serviceName,

0 commit comments

Comments
 (0)