mirror of
https://github.com/replicatedhq/ttl.sh.git
synced 2026-07-11 23:29:27 +00:00
123 lines
2.8 KiB
YAML
123 lines
2.8 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: ttl-registry
|
|
labels:
|
|
app: ttl-registry
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: ttl-registry
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: ttl-registry
|
|
spec:
|
|
containers:
|
|
- name: ttl-registry
|
|
image: registry:2
|
|
command: ["/entrypoint.sh"]
|
|
ports:
|
|
- containerPort: 5000
|
|
volumeMounts:
|
|
- name: registry-data
|
|
mountPath: /var/lib/registry
|
|
- name: registry-scripts
|
|
mountPath: /entrypoint.sh
|
|
subPath: entrypoint.sh
|
|
- name: registry-scripts
|
|
mountPath: /garbage-collect.sh
|
|
subPath: garbage-collect.sh
|
|
- name: registry-config
|
|
mountPath: /etc/docker/registry/config.yml
|
|
subPath: config.yml
|
|
readinessProbe:
|
|
failureThreshold: 3
|
|
initialDelaySeconds: 10
|
|
periodSeconds: 1
|
|
successThreshold: 2
|
|
timeoutSeconds: 1
|
|
httpGet:
|
|
path: /
|
|
port: 5000
|
|
scheme: HTTP
|
|
volumes:
|
|
- name: registry-data
|
|
emptyDir: {}
|
|
- name: registry-config
|
|
configMap:
|
|
name: ttl-registry-config
|
|
- name: registry-scripts
|
|
configMap:
|
|
name: ttl-registry-scripts
|
|
defaultMode: 0755
|
|
---
|
|
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: ttl-registry-scripts
|
|
labels:
|
|
app: ttl-registry
|
|
data:
|
|
entrypoint.sh: |
|
|
#!/bin/sh
|
|
set -e
|
|
echo "0 * * * * /garbage-collect.sh >> /proc/1/fd/1 2>&1" > /etc/crontabs/root
|
|
crond
|
|
registry serve /etc/docker/registry/config.yml
|
|
garbage-collect.sh: |
|
|
#!/bin/sh
|
|
set -e
|
|
if [ ! -d "/var/lib/registry/docker" ]; then
|
|
echo "No registry data found, skipping garbage collection"
|
|
exit 0
|
|
fi
|
|
registry garbage-collect /etc/docker/registry/config.yml
|
|
---
|
|
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: ttl-registry-config
|
|
labels:
|
|
app: ttl-registry
|
|
data:
|
|
config.yml: |
|
|
version: 0.1
|
|
log:
|
|
level: debug
|
|
storage:
|
|
delete:
|
|
enabled: true
|
|
filesystem:
|
|
rootdirectory: /var/lib/registry
|
|
http:
|
|
addr: 0.0.0.0:5000
|
|
headers:
|
|
X-Content-Type-Options: [nosniff]
|
|
notifications:
|
|
endpoints:
|
|
- name: ttl-hooks
|
|
url: http://ttl-hooks:8000/v1/hook/registry-event
|
|
headers:
|
|
Authorization: ["Token dev-hook-token"]
|
|
timeout: 200ms
|
|
threshold: 3
|
|
backoff: 5s
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: ttl-registry
|
|
labels:
|
|
app: ttl-registry
|
|
annotations:
|
|
dev.okteto.com/auto-ingress: "true"
|
|
spec:
|
|
type: ClusterIP
|
|
ports:
|
|
- protocol: TCP
|
|
port: 5000
|
|
targetPort: 5000
|
|
selector:
|
|
app: ttl-registry |