Skip to content

Commit

Permalink
Typos, handle collabora
Browse files Browse the repository at this point in the history
  • Loading branch information
ThisIsntTheWay committed Feb 7, 2025
1 parent 1998138 commit 9bda317
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pkg/comp-functions/functions/common/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ func IsSingleSubdomainOfRefDomain(fqdn string, reference string) bool {
}

noSuffix, _ := strings.CutSuffix(fqdn, reference)
return len(strings.Split(noSuffix, ".")) == 2 // Handles prefixed dot of reference domain<
return len(strings.Split(noSuffix, ".")) == 2 // Handles prefixed dot of reference domain
}
4 changes: 2 additions & 2 deletions pkg/comp-functions/functions/vshnkeycloak/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func AddIngress(_ context.Context, comp *vshnv1.VSHNKeycloak, svc *runtime.Servi
}

svc.Log.Info("Enable ingress for release")
enableIngresValues(svc, comp, values)
enableIngressValues(svc, comp, values)

release := &xhelmv1.Release{}
err = svc.GetDesiredComposedResourceByName(release, comp.GetName()+"-release")
Expand All @@ -57,7 +57,7 @@ func AddIngress(_ context.Context, comp *vshnv1.VSHNKeycloak, svc *runtime.Servi
return nil
}

func enableIngresValues(svc *runtime.ServiceRuntime, comp *vshnv1.VSHNKeycloak, values map[string]any) {
func enableIngressValues(svc *runtime.ServiceRuntime, comp *vshnv1.VSHNKeycloak, values map[string]any) {
fqdn := comp.Spec.Parameters.Service.FQDN

relPath := `'{{ tpl .Values.http.relativePath $ | trimSuffix " / " }}/'`
Expand Down
2 changes: 1 addition & 1 deletion pkg/comp-functions/functions/vshnkeycloak/ingress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func TestEnableIngresValues(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
svc := commontest.LoadRuntimeFromFile(t, "vshnkeycloak/01_default.yaml")
enableIngresValues(svc, tt.args.comp, tt.args.values)
enableIngressValues(svc, tt.args.comp, tt.args.values)
assert.Equal(t, tt.want, tt.args.values)
})
}
Expand Down
16 changes: 9 additions & 7 deletions pkg/comp-functions/functions/vshnnextcloud/collabora.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,13 @@ func AddCollaboraIngress(comp *vshnv1.VSHNNextcloud, svc *runtime.ServiceRuntime
annotations["haproxy.router.openshift.io/hsts_header"] = "max-age=31536000;preload"
}

fqdn := comp.Spec.Parameters.Service.Collabora.FQDN
tlsConfig := networkingv1.IngressTLS{}
if !common.IsSingleSubdomainOfRefDomain(fqdn, svc.Config.Data["ocpDefaultAppsDomain"]) {
tlsConfig.Hosts = []string{fqdn}
tlsConfig.SecretName = comp.GetName() + "-collabora-code-ingress-tls"
}

ingress := &networkingv1.Ingress{
ObjectMeta: metav1.ObjectMeta{
Name: comp.GetName() + "-collabora-code",
Expand All @@ -344,7 +351,7 @@ func AddCollaboraIngress(comp *vshnv1.VSHNNextcloud, svc *runtime.ServiceRuntime
Spec: networkingv1.IngressSpec{
Rules: []networkingv1.IngressRule{
{
Host: comp.Spec.Parameters.Service.Collabora.FQDN,
Host: fqdn,
IngressRuleValue: networkingv1.IngressRuleValue{
HTTP: &networkingv1.HTTPIngressRuleValue{
Paths: []networkingv1.HTTPIngressPath{
Expand All @@ -365,12 +372,7 @@ func AddCollaboraIngress(comp *vshnv1.VSHNNextcloud, svc *runtime.ServiceRuntime
},
},
},
TLS: []networkingv1.IngressTLS{
{
Hosts: []string{comp.Spec.Parameters.Service.Collabora.FQDN},
SecretName: comp.GetName() + "-collabora-code-ingress-tls",
},
},
TLS: []networkingv1.IngressTLS{tlsConfig},
},
}

Expand Down

0 comments on commit 9bda317

Please sign in to comment.