91 lines
2.3 KiB
YAML
91 lines
2.3 KiB
YAML
apiVersion: apps/v1
|
|
kind: DaemonSet
|
|
metadata:
|
|
name: agent-image-puller
|
|
namespace: swarm-system
|
|
labels:
|
|
app: agent-image-puller
|
|
component: optimization
|
|
spec:
|
|
selector:
|
|
matchLabels:
|
|
app: agent-image-puller
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: agent-image-puller
|
|
spec:
|
|
# Run on all nodes including control plane
|
|
tolerations:
|
|
- key: node-role.kubernetes.io/control-plane
|
|
operator: Exists
|
|
effect: NoSchedule
|
|
- key: node-role.kubernetes.io/master
|
|
operator: Exists
|
|
effect: NoSchedule
|
|
|
|
# Use host network to avoid CNI overhead
|
|
hostNetwork: true
|
|
|
|
initContainers:
|
|
# Pre-pull the agent image
|
|
- name: pull-agent-image
|
|
image: ghcr.io/heicode/swarm-agent:latest
|
|
command: ['sh', '-c', 'echo "Agent image pulled successfully"']
|
|
resources:
|
|
limits:
|
|
memory: "128Mi"
|
|
cpu: "100m"
|
|
|
|
# Pre-pull common base images
|
|
- name: pull-python-base
|
|
image: python:3.11-slim
|
|
command: ['sh', '-c', 'echo "Python base image pulled"']
|
|
resources:
|
|
limits:
|
|
memory: "128Mi"
|
|
cpu: "100m"
|
|
|
|
containers:
|
|
# Keep-alive container (does nothing but keeps DaemonSet running)
|
|
- name: pause
|
|
image: gcr.io/google_containers/pause:3.9
|
|
resources:
|
|
limits:
|
|
memory: "32Mi"
|
|
cpu: "10m"
|
|
requests:
|
|
memory: "16Mi"
|
|
cpu: "5m"
|
|
|
|
# Optional: Periodic re-pull to get latest images
|
|
- name: periodic-puller
|
|
image: docker:24-cli
|
|
command:
|
|
- /bin/sh
|
|
- -c
|
|
- |
|
|
while true; do
|
|
echo "Checking for image updates..."
|
|
# This would require docker socket mount in production
|
|
# For now, just sleep
|
|
sleep 3600 # Re-check every hour
|
|
done
|
|
resources:
|
|
limits:
|
|
memory: "64Mi"
|
|
cpu: "50m"
|
|
volumeMounts:
|
|
- name: docker-socket
|
|
mountPath: /var/run/docker.sock
|
|
readOnly: true
|
|
|
|
volumes:
|
|
- name: docker-socket
|
|
hostPath:
|
|
path: /var/run/docker.sock
|
|
type: Socket
|
|
|
|
# Ensure DaemonSet runs before agent pods
|
|
priorityClassName: system-node-critical
|