Closes #1
This commit is contained in:
parent
ca432c8743
commit
33875aa899
@ -1,3 +1,15 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
# defaults file for ansible-role-localagi
|
||||
localagi_pvc_storage: "20Gi"
|
||||
localagi_model: "gemma-3-12b-it-qat"
|
||||
localagi_multimodal_model: "minicpm-v-2_6"
|
||||
localagi_image_model: "sd-1.5-ggml"
|
||||
localagi_timeout: "60s"
|
||||
localagi_state_dir: "/var/lib/localagi"
|
||||
localagi_api_keys:
|
||||
- "123abc"
|
||||
- "abc123"
|
||||
localagi_localrag_url: "http://localrag.local:8080"
|
||||
localagi_llm_api_url: "http://localai.local:8080"
|
||||
localagi_llm_api_key: "123abc"
|
||||
|
||||
148
tasks/main.yml
148
tasks/main.yml
@ -1,3 +1,151 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
# tasks file for ansible-role-localagi
|
||||
- name: Create namespace for localagi
|
||||
k8s:
|
||||
state: present
|
||||
definition:
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: localagi
|
||||
|
||||
- name: Create pvc for localagi
|
||||
k8s:
|
||||
state: present
|
||||
definition:
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: localagi-data
|
||||
namespace: localagi
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: "{{ localagi_pvc_storage }}"
|
||||
|
||||
- name: Create deployment for localagi
|
||||
k8s:
|
||||
state: present
|
||||
definition:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: localagi
|
||||
namespace: localagi
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: localagi
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: localagi
|
||||
spec:
|
||||
containers:
|
||||
- name: localagi
|
||||
image: mudler/localagi:latest
|
||||
ports:
|
||||
- containerPort: 3000
|
||||
env:
|
||||
- name: LOCALAGI_MODEL
|
||||
value: "{{ localagi_model }}"
|
||||
- name: LOCALAGI_MULTIMODAL_MODEL
|
||||
value: "{{ localagi_multimodal_model }}"
|
||||
- name: LOCALAGI_IMAGE_MODEL
|
||||
value: "{{ localagi_image_model }}"
|
||||
- name: LOCALAGI_TIMEOUT
|
||||
value: "{{ localagi_timeout }}"
|
||||
- name: LOCALAGI_STATE_DIR
|
||||
value: "{{ localagi_state_dir }}"
|
||||
- name: LOCALAGI_LOCALRAG_URL
|
||||
value: "{{ localagi_localrag_url }}"
|
||||
- name: LOCALAGI_LLM_API_URL
|
||||
value: "{{ localagi_llm_api_url }}"
|
||||
- name: LOCALAGI_LLM_API_KEY
|
||||
value: "{{ localagi_llm_api_key }}"
|
||||
volumeMounts:
|
||||
- name: localagi-data
|
||||
mountPath: "{{ localagi_state_dir }}"
|
||||
volumes:
|
||||
- name: localagi-data
|
||||
persistentVolumeClaim:
|
||||
claimName: localagi-data
|
||||
|
||||
- name: Create service for localagi
|
||||
k8s:
|
||||
state: present
|
||||
definition:
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: localagi
|
||||
namespace: localagi
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 3000
|
||||
selector:
|
||||
app: localagi
|
||||
|
||||
- name: Create autoscaling for localagi
|
||||
k8s:
|
||||
state: present
|
||||
definition:
|
||||
apiVersion: autoscaling/v1
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: localagi
|
||||
namespace: localagi
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: localagi
|
||||
minReplicas: 1
|
||||
maxReplicas: 5
|
||||
targetCPUUtilizationPercentage: 80
|
||||
|
||||
- name: Create ingress for localagi
|
||||
k8s:
|
||||
state: present
|
||||
definition:
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: localagi-ingress
|
||||
namespace: localagi
|
||||
annotations:
|
||||
cert-manager.io/cluster-issuer: ca-issuer
|
||||
nginx.ingress.kubernetes.io/rewrite-target: /
|
||||
nginx.ingress.kubernetes.io/use-regex: "true"
|
||||
kubernetes.io/ingress.class: "nginx"
|
||||
spec:
|
||||
ingressClassName: nginx
|
||||
rules:
|
||||
- host: localagi.eom.dev
|
||||
http:
|
||||
paths:
|
||||
- path: /api
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: localagi
|
||||
port:
|
||||
number: 80
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: localagi
|
||||
port:
|
||||
number: 80
|
||||
tls:
|
||||
- hosts:
|
||||
- localagi.eom.dev
|
||||
secretName: localagi-tls
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user