wso2 / kubernetes-apim

Kubernetes and Helm resources for WSO2 API Manager
Apache License 2.0
112 stars 216 forks source link

Monetizing #521

Open zerodarkzone opened 2 years ago

zerodarkzone commented 2 years ago

Description: Hi, Is there a working example to configure monetizing using the kubernetes deployment?. I've been trying to follow the monetizing tutorial https://apim.docs.wso2.com/en/latest/design/api-monetization/monetizing-an-api/ but i'm not sure how would I copy the jars to a kubernetes cluster.

Thanks

Suggested Labels: Monetizing, Question

falconmfm commented 2 years ago

There few ways, the simplest one is just to build your own image. Any file in the /home/wso2carbon/wso2-artifact-volume folder should be copied in the $CARBON_HOME . 1.- Clone this repo https://github.com/wso2/docker-apim 2.- Create a folder name wso2-artifact-volume 3.- Add your jar file inside this folder keeping the wso2carbon relative path, in this case, wso2-artifact-volume/repository/components/libs. 4.- Create your own Dockerfile with contents like:

---
# My Dockerfile.custom
FROM wso2/wso2am:4.0.0
COPY --chown=wso2carbon:wso2 wso2-artifact-volume ${USER_HOME}/wso2-artifact-volume
---

5.- Build the docker image with -f Dockerfile.custom and change the -tag /dockerapimcustom:0.0.1 parameter. 6.- Deploy helm with the parameter : --set wso2.deployment.am.imageName=/dockerapimcustom --set wso2.deployment.am.imageTag=0.0.1

Or

You can also change the helm chart, and modify the deployment to add a new initContainer like in the file: https://github.com/wso2/kubernetes-apim/blob/master/simple/am-single/templates/am/instance/wso2am-deployment.yaml ( line 36 ).

zerodarkzone commented 2 years ago

Hi, thanks for your response.

I modified the helm chart to add a new initContainer to download the jars.