-
Task
-
Resolution: Not a Bug
-
Minor
-
None
-
2.11.0 CR1
-
False
-
False
-
Not Started
-
Not Started
-
Not Started
-
Not Started
-
Not Started
-
Not Started
-
Undefined
-
In THREESCALE-5515, I introduced this workaround. Please consider whether the workaround can be included as an alternative way to add a custom policy.
Users can register a policy as a configmap.
Here is an example of registering apicast-example-policy.
1) fork the repository
2) $ git clone <forked repository>
3) $ cd apicast-example-policy
4) $ oc login <OpenShift URL>
5) $ oc project <3scale Porject>
6) $ oc create configmap example-policy --from-file=policies/example/0.1This configmap will include apicast-policy.json, example.lua and init.lua files.
7)
$ oc set volumes dc/apicast-staging --add --overwrite --name=example-policy \
--mount-path=/opt/app-root/src/policies/example/0.1 --source='{"configMap":{"name":"example-policy"}}'The default policy load path is /opt/app-root/src/policies. To change the path, set a path as APICAST_POLICY_LOAD_PATH environment variables.
When compared to the procedure in the document,
pros:
- this doesn't require building container
cons:
- users have to configure all APIcast to enable a policy. If a customer uses an embedded apicast-staging, embedded apicast-prodcution and self-managed apicast, they have to configure it on each apicast.
- configmap doens't keep directories. so this only applicable when a policy files are in one directory.
- is related to
-
THREESCALE-5515 "Adding custom policies to APIcast" procedure fails on OCP 4
- Closed
- links to