feat(ollama) exposed ollama api port and ingress (#17997)

**Description**
Exposes the api (main pod) service port and also add ingress for it.

⚒️ Fixes  # <!--(issue)-->

**⚙️ Type of change**

- [X] ⚙️ Feature/App addition
- [ ] 🪛 Bugfix
- [ ] ⚠️ Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] 🔃 Refactor of current code

**🧪 How Has This Been Tested?**
<!--
Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration
-->

**📃 Notes:**
<!-- Please enter any other relevant information here -->
ingress for the api service isnt exactly necessary as its exposed via
the /ollama/api route for the main web gui port.
however some users may want to configure it to use the api service
exclusively for external applications that wont work with that route.

**✔️ Checklist:**

- [X] ⚖️ My code follows the style guidelines of this project
- [X] 👀 I have performed a self-review of my own code
- [ ] #️⃣ I have commented my code, particularly in hard-to-understand
areas
- [ ] 📄 I have made corresponding changes to the documentation
- [ ] ⚠️ My changes generate no new warnings
- [ ] 🧪 I have added tests to this description that prove my fix is
effective or that my feature works
- [X] ⬆️ I increased versions for any altered app according to semantic
versioning

** App addition**

If this PR is an app addition please make sure you have done the
following.

- [ ] 🖼️ I have added an icon in the Chart's root directory called
`icon.png`

---

_Please don't blindly check all the boxes. Read them and only check
those that apply.
Those checkboxes are there for the reviewer to see what is this all
about and
the status of this PR with a quick glance._

---------

Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
This commit is contained in:
Xstar97TheNoob
2024-02-08 16:24:58 -05:00
committed by GitHub
parent 93e967d6da
commit b084f37487
3 changed files with 40 additions and 3 deletions
+1 -1
View File
@@ -36,4 +36,4 @@ sources:
- https://hub.docker.com/r/ollama/ollama
- https://ghcr.io/ollama-webui/ollama-webui
type: application
version: 1.0.5
version: 1.0.6
+32
View File
@@ -34,6 +34,28 @@ questions:
type: int
default: 10686
required: true
- variable: api
label: API Service
description: The API service.
schema:
additional_attrs: true
type: dict
attrs:
# Include{serviceSelectorLoadBalancer}
# Include{serviceSelectorExtras}
- variable: api
label: API Service Port Configuration
schema:
additional_attrs: true
type: dict
attrs:
- variable: port
label: Port
description: This port exposes the container port on the service
schema:
type: int
default: 11434
required: true
# Include{serviceExpertRoot}
# Include{serviceExpert}
# Include{serviceList}
@@ -65,6 +87,16 @@ questions:
# Include{ingressDefault}
# Include{ingressTLS}
# Include{ingressTraefik}
# Include{ingressAdvanced}
- variable: api
label: "API Ingress"
schema:
additional_attrs: true
type: dict
attrs:
# Include{ingressDefault}
# Include{ingressTLS}
# Include{ingressTraefik}
# Include{ingressAdvanced}
# Include{ingressList}
# Include{securityContextRoot}
+7 -2
View File
@@ -18,15 +18,20 @@ service:
targetSelector: ui
api:
enabled: true
type: ClusterIP
targetSelector: main
ports:
api:
enabled: true
protocol: http
targetPort: 11434
port: 11434
targetSelector: main
ingress:
api:
targetSelector:
api: api
workload:
main:
podSpec:
@@ -78,7 +83,7 @@ workload:
type: tcp
port: "{{ .Values.service.main.ports.main.targetPort }}"
env:
OLLAMA_API_BASE_URL: '{{ printf "http://%v-api:%v/api" (include "tc.v1.common.lib.chart.names.fullname" $) .Values.service.api.ports.api.port }}'
OLLAMA_API_BASE_URL: '{{ printf "http://%v-api:%v/api" (include "tc.v1.common.lib.chart.names.fullname" $) .Values.service.api.ports.api.targetPort }}'
persistence:
config: