Skip to content

Commit

Permalink
Revert the edge termination policy back to Redirect
Browse files Browse the repository at this point in the history
Signed-off-by: Chetan Banavikalmutt <chetanrns1997@gmail.com>
  • Loading branch information
chetan-rns committed May 20, 2024
1 parent 26be68b commit 7509196
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
8 changes: 5 additions & 3 deletions api/v1alpha1/argocd_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -960,10 +960,12 @@ func (argocd *ArgoCD) IsDeletionFinalizerPresent() bool {
return false
}

// WantsAutoTLS returns true if user configured a route with reencryption
// termination policy.
// WantsAutoTLS returns true if:
// 1. user has configured a route with reencrypt.
// 2. user has not configured TLS and we default to reencrypt.
func (s *ArgoCDServerSpec) WantsAutoTLS() bool {
return s.Route.TLS != nil && s.Route.TLS.Termination == routev1.TLSTerminationReencrypt
return s.Route.TLS == nil ||
(s.Route.TLS != nil && s.Route.TLS.Termination == routev1.TLSTerminationReencrypt)
}

// WantsAutoTLS returns true if the repository server configuration has set
Expand Down
6 changes: 3 additions & 3 deletions api/v1beta1/argocd_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -991,10 +991,10 @@ func (argocd *ArgoCD) IsDeletionFinalizerPresent() bool {
return false
}

// WantsAutoTLS returns true if user configured a route with reencryption
// termination policy.
// WantsAutoTLS returns true if the user has configured a route with reencrypt or we default to reencrypt.
func (s *ArgoCDServerSpec) WantsAutoTLS() bool {
return s.Route.TLS != nil && s.Route.TLS.Termination == routev1.TLSTerminationReencrypt
return s.Route.TLS == nil ||
(s.Route.TLS != nil && s.Route.TLS.Termination == routev1.TLSTerminationReencrypt)
}

// WantsAutoTLS returns true if the repository server configuration has set
Expand Down
2 changes: 1 addition & 1 deletion controllers/argocd/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ func (r *ReconcileArgoCD) reconcileServerRoute(cr *argoproj.ArgoCD) error {
TargetPort: intstr.FromString("https"),
}
route.Spec.TLS = &routev1.TLSConfig{
InsecureEdgeTerminationPolicy: routev1.InsecureEdgeTerminationPolicyNone,
InsecureEdgeTerminationPolicy: routev1.InsecureEdgeTerminationPolicyRedirect,
Termination: routev1.TLSTerminationReencrypt,
}
}
Expand Down
8 changes: 4 additions & 4 deletions controllers/argocd/route_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func TestReconcileRouteSetsInsecure(t *testing.T) {

wantTLSConfig := &routev1.TLSConfig{
Termination: routev1.TLSTerminationReencrypt,
InsecureEdgeTerminationPolicy: routev1.InsecureEdgeTerminationPolicyNone,
InsecureEdgeTerminationPolicy: routev1.InsecureEdgeTerminationPolicyRedirect,
}
if diff := cmp.Diff(wantTLSConfig, loaded.Spec.TLS); diff != "" {
t.Fatalf("failed to reconcile route:\n%s", diff)
Expand Down Expand Up @@ -203,7 +203,7 @@ func TestReconcileRouteUnsetsInsecure(t *testing.T) {

wantTLSConfig = &routev1.TLSConfig{
Termination: routev1.TLSTerminationReencrypt,
InsecureEdgeTerminationPolicy: routev1.InsecureEdgeTerminationPolicyNone,
InsecureEdgeTerminationPolicy: routev1.InsecureEdgeTerminationPolicyRedirect,
}
if diff := cmp.Diff(wantTLSConfig, loaded.Spec.TLS); diff != "" {
t.Fatalf("failed to reconcile route:\n%s", diff)
Expand Down Expand Up @@ -281,7 +281,7 @@ func TestReconcileRouteApplicationSetTlsTermination(t *testing.T) {
Enabled: true,
TLS: &routev1.TLSConfig{
Termination: routev1.TLSTerminationPassthrough,
InsecureEdgeTerminationPolicy: routev1.InsecureEdgeTerminationPolicyNone,
InsecureEdgeTerminationPolicy: routev1.InsecureEdgeTerminationPolicyRedirect,
},
},
},
Expand Down Expand Up @@ -312,7 +312,7 @@ func TestReconcileRouteApplicationSetTlsTermination(t *testing.T) {
fatalIfError(t, err, "failed to load route %q: %s", testArgoCDName+"-server", err)

wantTLSConfig := &routev1.TLSConfig{
InsecureEdgeTerminationPolicy: routev1.InsecureEdgeTerminationPolicyNone,
InsecureEdgeTerminationPolicy: routev1.InsecureEdgeTerminationPolicyRedirect,
Termination: routev1.TLSTerminationPassthrough,
}
if diff := cmp.Diff(wantTLSConfig, loaded.Spec.TLS); diff != "" {
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/routes.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ $ kubectl get secret argocd-cluster -n argocd -ojsonpath='{.data.admin\.password

## Setting TLS modes for routes

You can parameterize the route's TLS configuration by setting appropriate values in the `.spec.server.route.tls` field of the `ArgoCD` CR.
By default, the operator creates the Argo CD server route with `reencrypt` termination policy. You can parameterize the route's TLS configuration by setting appropriate values in the `.spec.server.route.tls` field of the `ArgoCD` CR.

### TLS edge termination mode

Expand Down

0 comments on commit 7509196

Please sign in to comment.