tyk-operator
tyk-operator copied to clipboard
[TT-6163]Ability to specify 'Categories' on an Api when using tyk ingress and template ApiDefinition
As far as I can tell from documentation / hacking around in the definitions there is no known way to add categories to an API in tyk when using the 'Tyk Ingress Controller' method
When using pure API definitions you are able to add categories to an api by adding hashtags to the end of the ApiDefinition.spec.name property
When the ApiDefinition is marked as a template and you subsequently the tyk ingress method, the api within tyk adopts the metadata.name property of the ingress which cannot contain spaces or # characters - see https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
Is there any way to add additional categories to an API created using an ingress definition such as annotations on the ingress?
Example
API Definition:
apiVersion: tyk.tyk.io/v1alpha1
kind: ApiDefinition
metadata:
name: myapideftemplate
labels:
template: "true"
spec:
name: foo
protocol: http
use_keyless: true
proxy:
target_url: http://example.com
Ingress:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: httpbin-ingress
annotations:
kubernetes.io/ingress.class: tyk
tyk.io/template: myapideftemplate
tyk.io/categories: '#category1 #category2' # <------ ADDITIONAL ANNOTATION TO BE APPENDED TO THE RESULTANT API'S NAME IN TYK
spec:
rules:
- http:
paths:
- path: /httpbin
pathType: Prefix
backend:
service:
name: httpbin
port:
number: 8000
@BenWolstencroft Thank you for posting this issue here. I can replicated your issue and I created an internal ticket for this for further review. We will post here if there's an update for this.
@pagemag Thank you, we are tyk-pro customers and are heavy kubernetes users, currently in the process of migrating from our EC2 based installation to a helm-deployed k8s installation, whilst this isn't a show stopper for us, it's fairly important as categories make it much easier to work with a large number of microservices within the tyk dashboard.
Is there any update on this?
@BenWolstencroft Thank you for raising this. I was thinking it would be better if we added a label for categories in template for instead.