152 lines
3.9 KiB
YAML
152 lines
3.9 KiB
YAML
#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
|
|
|