TykTechnologies / tyk-operator

Tyk Operator for Kubernetes
https://tyk.io
Other
198 stars 41 forks source link

Api Definition yaml file doesn't support "custom_middleware_bundle" #653

Closed emperorente closed 1 year ago

emperorente commented 1 year ago

Api Definition yaml file doesn't support "custom_middleware_bundle"

Expected Behavior

I'm trying to create a API with custom_middleware_bundle via yaml, it should be applied by tyk-operator, and create the api succefully.

Current Behavior

It can't be applied.

Possible Solution

It can be worked as below config:

kind: ApiDefinition
metadata:
  name: testservice.plugin
  namespace: test-namespace
spec:
  domain: test.com
  name: testservice.plugin
  use_keyless: false
  protocol: http
  active: true
  proxy:
    target_url: http://httpbin.org
    strip_listen_path: true
    listen_path: /test/test-plugin
  use_standard_auth: true
  auth_configs:
    authToken:
      auth_header_name: Authorization
      use_cookie: true
      cookie_name: test_ts
  custom_middleware:
    driver: goplugin # Golang driver name
    pre:
      - name: "TestFunc"
        path: "middleware/testplugin_v5.0.0_linux_amd64.so"
    auth_check:
        name: "TestFunc"
        path: "middleware/testplugin_v5.0.0_linux_amd64.so"

Steps to Reproduce

1.Hybrid Tyk 2.Sample config:

apiVersion: tyk.tyk.io/v1alpha1
kind: ApiDefinition
metadata:
  name: testservice.plugin
  namespace: test-namespace
spec:
  domain: test.com
  name: testservice.plugin
  use_keyless: false
  protocol: http
  active: true
  proxy:
    target_url: http://httpbin.org
    strip_listen_path: true
    listen_path: /test/test-plugin
  use_standard_auth: true
  auth_configs:
    authToken:
      auth_header_name: Authorization
      use_cookie: true
      cookie_name: test_ts
  custom_middleware_bundle:
    key: "TestGoPlugin"
    location: "testplugin-v1.zip"
    strip_path: false`

3.

Screenshots/Video

Logs/Errors

Context

Your Environment

talex-de commented 1 year ago

Looks like your configuration is wrong, Tyk middleware bundles can be configured like this:

apiVersion: tyk.tyk.io/v1alpha1
kind: ApiDefinition

spec:
  custom_middleware_bundle: bundle-name-v1.0.0.zip
  custom_middleware:
    pre:
      - name: TransformAuthHeader
        path: CustomGoPlugin.so
emperorente commented 1 year ago

It can work. Thanks, Alex. By the way, it's nice to see you here.