1
0
Fork 0
forked from infra/ansible

[flatpak-indexer] Separate the instances

Try another approach to separate the instances. Create a separate redis
instance for quay.io, that should allow to have completely separate
quay.io resources and registry.fp.o resources.

Signed-off-by: Michal Konecny <mkonecny@redhat.com>
This commit is contained in:
Michal Konečný 2026-07-08 13:56:56 +02:00 committed by Michal Konečný
commit c5e16e687c
4 changed files with 171 additions and 23 deletions

View file

@ -1,14 +1,14 @@
redis_url: ${REDIS_URL}
redis_password: ${REDIS_PASSWORD}
koji_config: fedora
deltas_dir: ${OUTPUT_DIR}/deltas/
icons_dir: ${OUTPUT_DIR}/icons/
deltas_dir: ${OUTPUT_DIR}/quay.io/deltas/
icons_dir: ${OUTPUT_DIR}/quay.io/icons/
{% if env == 'staging' %}
deltas_uri: https://registry{{ env_suffix }}.fedoraproject.org/deltas/
icons_uri: https://registry{{ env_suffix }}.fedoraproject.org/app-icons/
deltas_uri: https://registry{{ env_suffix }}.fedoraproject.org/quay.io/deltas/
icons_uri: https://registry{{ env_suffix }}.fedoraproject.org/quay.io/app-icons/
{% else %}
deltas_uri: https://cdn.registry.fedoraproject.org/deltas/
icons_uri: https://cdn.registry.fedoraproject.org/app-icons/
deltas_uri: https://cdn.registry.fedoraproject.org/quay.io/deltas/
icons_uri: https://cdn.registry.fedoraproject.org/quay.io/app-icons/
{% endif %}
clean_files_after: 1d
daemon:

View file

@ -60,65 +60,6 @@ spec:
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: flatpak-quay-indexer
labels:
app: flatpak-quay-indexer
annotations:
image.openshift.io/triggers: '[{"from":{"kind":"ImageStreamTag","name":"flatpak-indexer:latest"},"fieldPath":"spec.template.spec.containers[?(@.name==\"flatpak-quay-indexer\")].image"}]'
spec:
replicas: 1
selector:
matchLabels:
app: flatpak-quay-indexer
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
template:
metadata:
labels:
app: flatpak-quay-indexer
spec:
containers:
- name: flatpak-quay-indexer
image: image-registry.openshift-image-registry.svc:5000/flatpak-indexer/flatpak-indexer:latest
env:
- name: OUTPUT_DIR
value: /var/www/flatpaks
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: redis-password
key: password
- name: REDIS_URL
value: redis://redis.flatpak-indexer.svc.cluster.local:6379
ports:
- containerPort: 8080
protocol: TCP
volumeMounts:
- mountPath: /etc/flatpak-indexer
name: indexer-config-volume
readOnly: true
- mountPath: /etc/koji.conf
name: koji-conf-volume
readOnly: true
- mountPath: /var/www/flatpaks
name: index-output-volume
volumes:
- name: indexer-config-volume
configMap:
name: indexer-quay-config
- name: koji-conf-volume
configMap:
name: koji-conf
- name: index-output-volume
persistentVolumeClaim:
claimName: flatpak-indexer-storage{{ '-stg' if env == 'staging' else '' }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: flatpak-indexer-differ
@ -235,3 +176,183 @@ spec:
- name: redis-data-volume
persistentVolumeClaim:
claimName: flatpak-indexer-redis-storage{{ '-stg' if env == 'staging' else '' }}
{% if env == 'staging' %}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: flatpak-quay-indexer
labels:
app: flatpak-quay-indexer
annotations:
image.openshift.io/triggers: '[{"from":{"kind":"ImageStreamTag","name":"flatpak-indexer:latest"},"fieldPath":"spec.template.spec.containers[?(@.name==\"flatpak-quay-indexer\")].image"}]'
spec:
replicas: 1
selector:
matchLabels:
app: flatpak-quay-indexer
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
template:
metadata:
labels:
app: flatpak-quay-indexer
spec:
containers:
- name: flatpak-quay-indexer
image: image-registry.openshift-image-registry.svc:5000/flatpak-indexer/flatpak-indexer:latest
env:
- name: OUTPUT_DIR
value: /var/www/flatpaks
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: redis-quay-password
key: password
- name: REDIS_URL
value: redis://redis-quay.flatpak-indexer.svc.cluster.local:6379
ports:
- containerPort: 8080
protocol: TCP
volumeMounts:
- mountPath: /etc/flatpak-indexer
name: indexer-config-volume
readOnly: true
- mountPath: /etc/koji.conf
name: koji-conf-volume
readOnly: true
- mountPath: /var/www/flatpaks
name: index-output-volume
volumes:
- name: indexer-config-volume
configMap:
name: indexer-quay-config
- name: koji-conf-volume
configMap:
name: koji-conf
- name: index-output-volume
persistentVolumeClaim:
claimName: flatpak-indexer-storage{{ '-stg' if env == 'staging' else '' }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: flatpak-indexer-quay-differ
name: flatpak-indexer-quay-differ
spec:
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: flatpak-indexer-quay-differ
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
template:
metadata:
labels:
app: flatpak-indexer-quay-differ
annotations:
image.openshift.io/triggers: '[{"from":{"kind":"ImageStreamTag","name":"flatpak-indexer:latest"},"fieldPath":"spec.template.spec.containers[?(@.name==\"flatpak-indexer-differ\")].image"}]'
spec:
containers:
- name: flatpak-indexer-quay-differ
image: image-registry.openshift-image-registry.svc:5000/flatpak-indexer/flatpak-indexer:latest
env:
- name: OUTPUT_DIR
value: /var/www/flatpaks
- name: FLATPAK_INDEXER_COMMAND
value: differ
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: redis-quay-password
key: password
- name: REDIS_URL
value: redis://redis-quay.flatpak-indexer.svc.cluster.local:6379
ports:
- containerPort: 8080
protocol: TCP
resources:
requests:
cpu: 2
memory: 1Gi
limits:
cpu: 2
memory: 8Gi
volumeMounts:
- mountPath: /etc/flatpak-indexer
name: indexer-config-volume
readOnly: true
- mountPath: /var/www/flatpaks
name: index-output-volume
volumes:
- name: indexer-config-volume
configMap:
name: indexer-quay-config
- name: index-output-volume
persistentVolumeClaim:
claimName: flatpak-indexer-storage{{ '-stg' if env == 'staging' else '' }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: redis-quay
name: redis-quay
spec:
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: redis-quay
strategy:
type: Recreate
template:
metadata:
labels:
app: redis-quay
annotations:
image.openshift.io/triggers: '[{"from":{"kind":"ImageStreamTag","name":"redis:latest"},"fieldPath":"spec.template.spec.containers[?(@.name==\"redis-quay\")].image"}]'
spec:
containers:
- name: redis
image: image-registry.openshift-image-registry.svc:5000/flatpak-indexer/redis:latest
env:
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: redis-quay-password
key: password
ports:
- containerPort: 6379
protocol: TCP
livenessProbe:
exec:
command: ['valkey-cli', '-a', '$REDIS_PASSWORD', 'ping']
failureThreshold: 3
initialDelaySeconds: 15
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
readinessProbe:
exec:
command: ['valkey-cli', '-a', '$REDIS_PASSWORD', 'ping']
failureThreshold: 3
periodSeconds: 60
successThreshold: 1
timeoutSeconds: 1
volumeMounts:
- mountPath: /data
name: redis-data-volume
volumes:
- name: redis-data-volume
persistentVolumeClaim:
claimName: flatpak-indexer-redis-quay-storage{{ '-stg' if env == 'staging' else '' }}
{% endif %}

View file

@ -9,3 +9,14 @@ stringData:
{% else %}
password: {{ prod_flatpak_indexer_redis_password }}
{% endif %}
---
kind: Secret
apiVersion: v1
metadata:
name: redis-quay-password
stringData:
{% if env == 'staging' %}
password: {{ stg_flatpak_indexer_redis_password }}
{% else %}
password: {{ prod_flatpak_indexer_redis_password }}
{% endif %}

View file

@ -30,3 +30,19 @@ spec:
requests:
storage: 1Gi
volumeName: flatpak-indexer-redis-storage{{ '-stg' if env == 'staging' else '' }}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: flatpak-indexer-redis-quay-storage{{ '-stg' if env == 'staging' else '' }}
spec:
accessModes:
- ReadWriteOnce
# Set the storageClassName to the empty string, otherwise it
# will get the cluster default storageClass and it won't match
# the named volume that already exists for us.
storageClassName: ""
resources:
requests:
storage: 1Gi
volumeName: flatpak-indexer-redis-quay-storage{{ '-stg' if env == 'staging' else '' }}