Skip to content

Add HTTPRoute as alternative to ingress#645

Open
mikeshootzz wants to merge 2 commits intodevelopfrom
feat/http-gateway
Open

Add HTTPRoute as alternative to ingress#645
mikeshootzz wants to merge 2 commits intodevelopfrom
feat/http-gateway

Conversation

@mikeshootzz
Copy link
Copy Markdown
Contributor

@mikeshootzz mikeshootzz commented Apr 17, 2026

Summary

Adds HTTPRoute (Gateway API) as an alternative to Ingress for Forgejo, Keycloak, and Nextcloud (incl. Collabora). Shared helper lives in pkg/comp-functions/functions/common/httproute.go. Enables Servala clusters to route via Gateway API.

Component PR: vshn/component-appcat#1147

Checklist

  • Update tests.
  • Link this PR to related issues.
  • Merge with /merge comment.

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions
Copy link
Copy Markdown
Contributor

@mikeshootzz mikeshootzz force-pushed the feat/http-gateway branch 2 times, most recently from cd7489c to ac82d2b Compare April 22, 2026 12:19
@github-actions
Copy link
Copy Markdown
Contributor

@github-actions
Copy link
Copy Markdown
Contributor

@mikeshootzz mikeshootzz marked this pull request as ready for review April 22, 2026 14:51
@mikeshootzz mikeshootzz requested review from a team, Kidswiss, TheBigLee, mdnix and zugao and removed request for a team April 22, 2026 14:51
@github-actions
Copy link
Copy Markdown
Contributor

Comment thread config/controller/webhooks.yaml Outdated
return nil
}

func addNextcloudHTTPRoute(comp *vshnv1.VSHNNextcloud, svc *runtime.ServiceRuntime) *xfnproto.Result {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is basically redefined 4 times in the PR. And not even consistently:

  • Some pass AllowDeletion and some don't.
  • Some return fatals and some only warnings.

I'd suggest to move it to common and have it accept a common.HTTPRouteConfig.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactored this.

}

func addNextcloudHTTPRoute(comp *vshnv1.VSHNNextcloud, svc *runtime.ServiceRuntime) *xfnproto.Result {
gatewayName := svc.Config.Data["httpGatewayName"]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking if it's set would be nice. If not set we should probably do a fatal.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@github-actions
Copy link
Copy Markdown
Contributor

@mikeshootzz mikeshootzz requested a review from Kidswiss April 23, 2026 11:04
ServiceNameSuffix: svcNameSuffix,
ServicePortNumber: 3000,
},
}, runtime.KubeOptionAllowDeletion); err != nil {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about the AllowDeletion TBH.

On one hand we'd need it to seamlessly switch from gateway to ingress. The thing is, the other way around would currently probably not work, because we don't have the allow deletion on the ingress objects as far as I know.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid point. I'll remove AllowDeletion for the gateway related resources.

This allows HTTPRoutes to be used instead of ingress on servala
clusters.
@mikeshootzz mikeshootzz requested a review from Kidswiss April 24, 2026 11:17
@github-actions
Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown
Member

@mdnix mdnix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looking good.

Also we will have to add a redirect http -> https.
But I will take care of that on infra side.

svc.Log.Info("Adding HTTPRoute for Collabora")

return common.ApplyHTTPRoute(comp, svc, common.HTTPRouteConfig{
FQDNs: []string{comp.Spec.Parameters.Service.Collabora.FQDN},
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should check if this FQDN is even set before doing ApplyHTTPRoute

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, thanks!


err = AddCollaboraIngress(comp, svc)
if errors.Is(err, common.ErrHTTPGatewayNotConfigured) {
return runtime.NewFatalResult(fmt.Errorf("Failed to add Collabora Ingress: %w", err))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return runtime.NewFatalResult(fmt.Errorf("Failed to add Collabora Ingress: %w", err))
return runtime.NewFatalResult(fmt.Errorf("failed to add Collabora Ingress: %w", err))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair but actually have multiple occurrences of this being capitalized already xD

}
func AddCollaboraIngress(comp *vshnv1.VSHNNextcloud, svc *runtime.ServiceRuntime) error {

if svc.Config.Data["routeType"] == "HTTPRoute" {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a const in common/httproute.go

const RouteTypeHTTPRoute = "HTTPRoute"`

and hide the check behind

func IsHTTPRouteMode(svc *runtime.ServiceRuntime) bool {
      return svc.Config.Data["routeType"] == RouteTypeHTTPRoute
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

})
}

annotations := getIngressAnnotations(svc, nil)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are not necessary on the XLS since we don't use the certmanager shim?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh darn this was a leftover from my annotation shenanigans

// HTTP upstream, so attach a BackendConfigPolicy that originates TLS to
// the keycloakx-http Service, validating against the CA secret created
// by common.CreateTLSCerts ("tls-ca-certificate" in the instance ns).
svcName := comp.GetName() + "-keycloakx-http"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that we don't react to the relativePath field in the VSHNKeycloak claim

k explain vshnkeycloak.spec.parameters.service.relativePath
GROUP:      vshn.appcat.vshn.io
KIND:       VSHNKeycloak
VERSION:    v1

FIELD: relativePath <string>


DESCRIPTION:
    RelativePath on which Keycloak will listen.

If a user sets that it completely gets ignored and we always set path to /

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true I didnt consider that. should be fixed now.

@github-actions
Copy link
Copy Markdown
Contributor

@mikeshootzz mikeshootzz requested a review from mdnix April 24, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants