diff --git a/templates/dnf-json.yml b/templates/dnf-json.yml new file mode 100644 index 000000000..6b825adb0 --- /dev/null +++ b/templates/dnf-json.yml @@ -0,0 +1,108 @@ +apiVersion: v1 +kind: Template +labels: + app: dnf-json + template: dnf-json +metadata: + annotations: + description: | + Internal depsolving service meant as a supporting service for image-builder in crc + name: dnf-json +objects: + +- apiVersion: apps/v1 + kind: Deployment + metadata: + labels: + service: dnf-json + name: dnf-json + spec: + replicas: 9 + selector: + matchLabels: + name: dnf-json + template: + metadata: + labels: + name: dnf-json + spec: + serviceAccountName: dnf-json + affinity: + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 100 + podAffinityTerm: + labelSelector: + matchLabels: + name: dnf-json + topologyKey: kubernetes.io/hostname + containers: + - image: "${IMAGE_NAME}:${IMAGE_TAG}" + name: dnf-json + command: [ "python3", "/opt/entrypoint.py", "--dnf-json", "--dnf-json-port", "8080" ] + env: + - name: OVERWRITE_CACHE_DIR + value: "${CACHE_DIR}" + resources: + requests: + cpu: "${CPU_REQUEST}" + memory: "${MEMORY_REQUEST}" + limits: + cpu: "${CPU_LIMIT}" + memory: "${MEMORY_LIMIT}" + ports: + - name: api + containerPort: 8080 + protocol: TCP + volumeMounts: + - name: cache + mountPath: "${CACHE_DIR}" + volumes: + - name: cache + emptyDir: {} + +- apiVersion: v1 + kind: ServiceAccount + metadata: + name: dnf-json + imagePullSecrets: + - name: quay-cloudservices-pull + +- apiVersion: v1 + kind: Service + metadata: + labels: + service: dnf-json + name: dnf-json + spec: + ports: + - name: dnf-json + protocol: TCP + port: 8080 + targetPort: 8080 + selector: + name: dnf-json + +parameters: +- description: composer image name + name: IMAGE_NAME + value: quay.io/app-sre/composer + required: true +- description: composer image tag + name: IMAGE_TAG + required: true +# dnf-json can handle 1 depsolve at a time, therefore it benefits from multiple small containers +- name: CPU_REQUEST + description: CPU request per container + value: "125m" +- name: CPU_LIMIT + description: CPU limit per container + value: "125m" +- name: MEMORY_REQUEST + description: Memory request per container + value: "128Mi" +- name: MEMORY_LIMIT + description: Memory limit per container + value: "256Mi" +- name: CACHE_DIR + value: "/var/cache/dnf-json"