Skip to content

Commit

Permalink
Merge branch 'master' into custom-labels-annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
enriqueav99 authored Oct 3, 2024
2 parents 9b9ca0a + 14032c7 commit 228e376
Show file tree
Hide file tree
Showing 30 changed files with 2,766 additions and 138 deletions.
10 changes: 10 additions & 0 deletions .gitleaks.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[allowlist]
description = "Global Allowlist"

# Ignore based on any subset of the file path
paths = [

# Ignore anything with the word anywhere in the path
'''1-005_validate_route_tls''',

]
28 changes: 18 additions & 10 deletions api/v1alpha1/argocd_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var conversionLogger = ctrl.Log.WithName("conversion-webhook")

// ConvertTo converts this (v1alpha1) ArgoCD to the Hub version (v1beta1).
func (src *ArgoCD) ConvertTo(dstRaw conversion.Hub) error {
conversionLogger.Info("v1alpha1 to v1beta1 conversion requested.")
conversionLogger.V(1).Info("v1alpha1 to v1beta1 conversion requested.")
dst := dstRaw.(*v1beta1.ArgoCD)

// ObjectMeta conversion
Expand Down Expand Up @@ -105,7 +105,7 @@ func (src *ArgoCD) ConvertTo(dstRaw conversion.Hub) error {

// ConvertFrom converts from the Hub version (v1beta1) to this (v1alpha1) version.
func (dst *ArgoCD) ConvertFrom(srcRaw conversion.Hub) error {
conversionLogger.Info("v1beta1 to v1alpha1 conversion requested.")
conversionLogger.V(1).Info("v1beta1 to v1alpha1 conversion requested.")

src := srcRaw.(*v1beta1.ArgoCD)

Expand Down Expand Up @@ -263,10 +263,14 @@ func ConvertAlphaToBetaGrafana(src *ArgoCDGrafanaSpec) *v1beta1.ArgoCDGrafanaSpe
var dst *v1beta1.ArgoCDGrafanaSpec
if src != nil {
dst = &v1beta1.ArgoCDGrafanaSpec{
Enabled: src.Enabled,
Host: src.Host,
Image: src.Image,
Ingress: v1beta1.ArgoCDIngressSpec(src.Ingress),
Enabled: src.Enabled,
Host: src.Host,
Image: src.Image,
Ingress: v1beta1.ArgoCDIngressSpec(src.Ingress),
Resources: src.Resources,
Route: v1beta1.ArgoCDRouteSpec(src.Route),
Size: src.Size,
Version: src.Version,
}
}
return dst
Expand Down Expand Up @@ -483,10 +487,14 @@ func ConvertBetaToAlphaGrafana(src *v1beta1.ArgoCDGrafanaSpec) *ArgoCDGrafanaSpe
var dst *ArgoCDGrafanaSpec
if src != nil {
dst = &ArgoCDGrafanaSpec{
Enabled: src.Enabled,
Host: src.Host,
Image: src.Image,
Ingress: ArgoCDIngressSpec(src.Ingress),
Enabled: src.Enabled,
Host: src.Host,
Image: src.Image,
Ingress: ArgoCDIngressSpec(src.Ingress),
Resources: src.Resources,
Route: ArgoCDRouteSpec(src.Route),
Size: src.Size,
Version: src.Version,
}
}
return dst
Expand Down
65 changes: 65 additions & 0 deletions api/v1alpha1/argocd_conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package v1alpha1
import (
"testing"

routev1 "github.com/openshift/api/route/v1"
"github.com/stretchr/testify/assert"
corev1 "k8s.io/api/core/v1"
v1 "k8s.io/api/networking/v1"
Expand Down Expand Up @@ -443,6 +444,70 @@ func TestAlphaToBetaConversion(t *testing.T) {
}
}),
},
{
name: "ArgoCD Example - Route TLS",
input: makeTestArgoCDAlpha(func(cr *ArgoCD) {
cr.Spec.Server.Route = ArgoCDRouteSpec{
Enabled: true,
TLS: &routev1.TLSConfig{
Termination: routev1.TLSTerminationEdge,
},
}
cr.Spec.Prometheus.Route = ArgoCDRouteSpec{
Enabled: true,
TLS: &routev1.TLSConfig{
Termination: routev1.TLSTerminationEdge,
},
}
cr.Spec.Grafana.Route = ArgoCDRouteSpec{
Enabled: true,
TLS: &routev1.TLSConfig{
Termination: routev1.TLSTerminationEdge,
},
}
cr.Spec.ApplicationSet = &ArgoCDApplicationSet{
WebhookServer: WebhookServerSpec{
Route: ArgoCDRouteSpec{
Enabled: true,
TLS: &routev1.TLSConfig{
Termination: routev1.TLSTerminationEdge,
},
},
},
}
}),
expectedOutput: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {
cr.Spec.Server.Route = v1beta1.ArgoCDRouteSpec{
Enabled: true,
TLS: &routev1.TLSConfig{
Termination: routev1.TLSTerminationEdge,
},
}
cr.Spec.Prometheus.Route = v1beta1.ArgoCDRouteSpec{
Enabled: true,
TLS: &routev1.TLSConfig{
Termination: routev1.TLSTerminationEdge,
},
}
//nolint:staticcheck
cr.Spec.Grafana.Route = v1beta1.ArgoCDRouteSpec{
Enabled: true,
TLS: &routev1.TLSConfig{
Termination: routev1.TLSTerminationEdge,
},
}
cr.Spec.ApplicationSet = &v1beta1.ArgoCDApplicationSet{
WebhookServer: v1beta1.WebhookServerSpec{
Route: v1beta1.ArgoCDRouteSpec{
Enabled: true,
TLS: &routev1.TLSConfig{
Termination: routev1.TLSTerminationEdge,
},
},
},
}
}),
},
}

for _, test := range tests {
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions api/v1beta1/argocd_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1134,3 +1134,11 @@ func (p SSOProviderType) ToLower() SSOProviderType {
str := string(p)
return SSOProviderType(strings.ToLower(str))
}

// UseExternalCertificate return true if .route.tls.externalCertificate is set
func (r *ArgoCDRouteSpec) UseExternalCertificate() bool {
if r != nil && r.TLS != nil && r.TLS.ExternalCertificate != nil {
return true
}
return false
}
2 changes: 1 addition & 1 deletion api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 228e376

Please sign in to comment.