This topic tells you how to configure a custom Spring Cloud Gateway Trait on Tanzu Platform for Kubernetes.
The api-gateway.spring.tanzu.vmware.com
Trait provides a Spring Cloud Gateway resource to enable application HTTP traffic routing by default. The resource is backed by the latest Spring Cloud Gateway for Kubernetes. For more information, see Spring Cloud Gateway for Kubernetes.
By default, api-gateway.spring.tanzu.vmware.com
does not add any requirement to the workloads in the namespace. However, you can add the following configurations:
VMware Tanzu provides the spring-dev.tanzu.vmware.com
and spring-prod.tanzu.vmware.com
Profiles that use the api-gateway.spring.tanzu.vmware.com
Trait. However, the Profiles have minimal configurations. To take full advantage of the api-gateway.spring.tanzu.vmware.com
Trait, you will have to create a custom Profile.
For information about the configurable properties in the Spring Gateway Trait, see Spring Gateway Trait configurable properties.
The following provides the steps for creating a custom Profile that uses the Spring Cloud Gateway Trait.
my-custom-gateway
and click Next.api-gateway.spring.tanzu.vmware.com
. When you select a trait, the configuration for the trait displays below the grid table.Update the configuration as needed.
For example, you can customize the count
and resources
values.
count
as 3.Resources Requests Memory
as 1024Mi
.Resources Requests Cpu
as 1000m
.Click Next.
Use the Tanzu CLI to ensure that your project context is set correctly.
tanzu project use PROJECT-NAME
Create a my-custom-gateway.yaml
file with the following contents.
---
apiVersion: spaces.tanzu.vmware.com/v1alpha1
kind: Profile
metadata:
name: my-custom-gateway
spec:
requiredCapabilities:
- name: spring-cloud-gateway.tanzu.vmware.com
traits:
- name: api-gateway.spring.tanzu.vmware.com
values:
inline:
gateway:
count: 3
resources:
requests:
cpu: 1000m
memory: 1024Mi
Run the following command to create the profile.
tanzu deploy --only my-custom-gateway.yaml
Type y
to confirm. The following message will appear confirming the creation.
✓ Successfully created profile my-custom-gateway
You will see the newly created Profile, my-custom-gateway
, in Tanzu Platform hub in Application Spaces > Profiles.
After you have created the custom Profile, you can apply the profile to a Space by following the steps in Create a Space. Make sure to add my-custom-gateway
to the Profiles you select for the Space.