To work with multiple deployments an operator context must be used.
It is then possible to specify the operator context in the tyk CRDs so that operator will lookup the values from the operator context when creating/updating or reconciling those CRDs.
So if you had a namespace called tyk1 and created an OperatorContext called local-operator-context by applying the following yaml
apiVersion: tyk.tyk.io/v1alpha1
kind: OperatorContext
metadata:
name: local-operator-context
spec:
env:
mode: ce
auth: your gateway secret
org: your orgid
url: http://<your gateway URL>:<port>/
insecureSkipVerify: true
Then when creating other tyk CRDs (APIs or policies etc) this can be added to their YAML to get operator to pick up the context and use it.
If I have an ApiDefinition that I intend to apply to two Tyk gateways how can achive that?
I guess i cant specify more than one contextRef per ApiDefinition and i dont want to duplicate the ApiDefinition for each operator context.
I’d like to understand your setup. When you run multiple gateways on different namespaces, do you want the two gateways to manage different set of APIs? Or are they just replicates?
Sure, Yes they are just duplicates. So i want to have a single Operator to manage all tyk gateways (running on different namespaces) and they all have the same definitions(Apis/Policies)
Instead of a Deployment, you would need to deploy the gateways to different namespaces separately. However, as long as they share the same API configs via the same PV, Operator can help to synchronise API config updates among the gateways.