Gradiant / 5g-charts

Helm charts for 5G Technologies
Apache License 2.0
110 stars 43 forks source link

Add a sidecar container to NFs #108

Closed hinddeep closed 1 year ago

hinddeep commented 1 year ago

I have created a sidecar container image. I want to run this image as a sidecar container in NF such as amf. How can I modify AMF's chart to add my sidecar container?

cgiraldo commented 1 year ago

Hi Hindeep,

Our helm charts have a configurable field in values.yaml call sidecars. You can add the yaml description of your sidecar for the corresponding NF. For example, for the amf, something like this:

amf:
  sidecars:
    - name: nginx
      image: nginx:1.14.2
      ports:
      - containerPort: 80

The contents of sidecars are also evaluated as a template, so you can include {{ }} and refer to other helm variables. Checkout Helm Documentation for advanced usage.

hinddeep commented 1 year ago

I navigated to openverso-charts/charts/open5gs-amf/values.yaml and added the following code in values.yaml under sidecars:

sidecars:
- name: myimg
  image: img:0.0.1
  ports:
  - containerPort: 9090

I then tried to install amf using the following command:

helm install amf -n open5gs ./charts/open5gs-amf

I received the following error:

Error: INSTALLATION FAILED: found in Chart.yaml, but missing in charts/ directory: common
cgiraldo commented 1 year ago

If you install from source code, you have to download the chart dependencies before installing. You should run:

helm dep update ./charts/open5gs-amf

You can also provide your own values.yaml overwritting the chart one. Then you can use the helm chart from openverso repo:

helm install amf -n open5gs openverso/open5gs-amf --values my-values.yaml