This is similar to https://github.com/bentoml/BentoML/issues/1909, except i am doing k8s deployment and couldn't figure out where to put bento_config.yaml
stuff in k8s config. Current config
apiVersion: serving.yatai.ai/v2alpha1
kind: BentoDeployment
metadata:
name: isleroyale
spec:
autoscaling:
maxReplicas: 10
minReplicas: 2
bento: isleroyale
ingress:
enabled: true
resources:
limits:
cpu: 4000m
memory: 4Gi
requests:
cpu: 2000m
memory: 3Gi
envs:
- name: BENTOML_CONFIG_OPTIONS
value: >-
tracing.exporter_type=otlp
I am trying to load swagger from react app (backstage https://backstage.io/docs/features/software-catalog/) and getting cors issue - considering k8s deployment, how to enable cors?
Access to fetch at 'https://localhost:8080/isleroyale/docs.json' from origin 'http:localhost:8081' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Figured out that configuration can be overridden Overriding configuration with environment variables and CORS can be enabled with http config server config with BENTOML_CONFIG_OPTIONS
env variable
envs:
- name: BENTOML_CONFIG_OPTIONS
value: >-
api_server.http.cors.enabled=true
api_server.http.cors.access_control_allow_origin=https://services.localhost.8080
api_server.http.cors.access_control_allow_methods[0]=GET
api_server.http.cors.access_control_allow_methods[1]=OPTIONS
api_server.http.cors.access_control_allow_methods[2]=HEAD