Skip to content

Gateway CRD

The Gateway Custom Resource Definition registers a service in the application gateway.

Resource metadata

FieldValue
Groupfoomo.org
Versionv1
KindGateway
Pluralgateways
Short namegw
ScopeNamespaced

Spec fields

FieldTypeRequiredDescription
servicestringYesBackend service identifier (min length: 1).
sitemapstringNoURL to the service's sitemap.
addToRobotsstringNoContent to add to the gateway's robots.txt.
expose[]ExposeNoList of exposed path configurations.

Expose fields

FieldTypeDescription
descriptionstringDescription shown in the gateway API.
cmsAppstringNamed application in the CMS.
paths[]stringURL paths to register. Lookup is automatically ordered from longest to shortest.
cmsMimetypes[]stringContent server MIME types.
internalAccessGroups[]stringRestricts access to these internal groups.
stripBasePathboolWhen true, the base path is stripped from forwarded requests and set as the x-base-path header.

Example

yaml
apiVersion: foomo.org/v1
kind: Gateway
metadata:
  name: my-service
  namespace: default
spec:
  service: my-service
  sitemap: https://example.com/sitemap.xml
  addToRobots: "User-agent: *\nAllow: /api/"
  expose:
    - description: Public API
      paths:
        - /api/v1
      stripBasePath: true
    - description: CMS pages
      cmsApp: my-app
      paths:
        - /content
      cmsMimetypes:
        - text/html
      internalAccessGroups:
        - editors

Installation

The CRD manifest is located at config/crd/foomo.org_gateways.yaml and is auto-generated from Go types using controller-gen.

bash
kubectl apply -f config/crd/foomo.org_gateways.yaml

To regenerate the CRD after modifying the Go types:

bash
make generate