Skip to content

Commit

Permalink
Add cache manager image and helm chart
Browse files Browse the repository at this point in the history
  • Loading branch information
8R0WNI3 committed Nov 22, 2024
1 parent 5559f5a commit 1628335
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .ci/pipeline_definitions
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ delivery-service:
inputs:
steps:
build_python_packages: ~
extension-cache-manager: &extension-cache-manager-image
image: europe-docker.pkg.dev/gardener-project/releases/ocm-gear/extension-cache-manager
dockerfile: Dockerfile.extensions.cache-manager
tag_as_latest: True
inputs:
steps:
build_python_packages: ~
extension-clamav: &extension-clamav-image
image: europe-docker.pkg.dev/gardener-project/releases/ocm-gear/extension-clamav
dockerfile: Dockerfile.extensions.clamav
Expand Down Expand Up @@ -135,6 +142,10 @@ delivery-service:
attribute: backlog-controller.issue-replicator.image.repository
- ref: ocm-resource:extensions.tag
attribute: backlog-controller.issue-replicator.image.tag
- ref: ocm-resource:extension-cache-manager.repository
attribute: cache-manager.image.repository
- ref: ocm-resource:extension-cache-manager.tag
attribute: cache-manager.image.tag
- ref: ocm-resource:extensions.repository
attribute: delivery-db-backup.image.repository
- ref: ocm-resource:extensions.tag
Expand Down Expand Up @@ -167,6 +178,10 @@ delivery-service:
<<: *extensions-image
tag_as_latest: False
image: europe-docker.pkg.dev/gardener-project/snapshots/ocm-gear/extensions
extension-cache-manager:
<<: *extension-cache-manager-image
tag_as_latest: False
image: europe-docker.pkg.dev/gardener-project/snapshots/ocm-gear/extension-cache-manager
extension-clamav:
<<: *extension-clamav-image
tag_as_latest: False
Expand Down
27 changes: 27 additions & 0 deletions Dockerfile.extensions.cache-manager
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM ghcr.io/gardener/cc-utils/alpine:3

RUN --mount=type=bind,source=VERSION,target=/VERSION \
--mount=type=bind,source=requirements.utils.txt,target=/requirements.utils.txt \
--mount=type=bind,source=requirements.service.txt,target=/requirements.service.txt \
--mount=type=bind,source=/dist,target=/dist \
apk add --no-cache \
bash \
gcc \
git \
libc-dev \
libffi-dev \
postgresql16-client \
python3 \
python3-dev \
py3-pip \
py3-numpy \
py3-scipy \
&& mkdir -p $HOME/.config/pip \
&& echo -e "[global]\nbreak-system-packages = true" >> $HOME/.config/pip/pip.conf \
&& pip3 install --upgrade --no-cache-dir --find-links ./dist ocm-gear-service \
&& apk del --no-cache \
libc-dev \
libffi-dev \
python3-dev

ENTRYPOINT ["python3", "-m", "cache_manager"]
3 changes: 3 additions & 0 deletions charts/extensions/charts/cache-manager/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
apiVersion: v2
name: cache-manager
version: 0.1.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{{- range $config := .Values.configurations }}
apiVersion: batch/v1
kind: CronJob
metadata:
name: {{ $name := print "cache-manager-" $config.envVars.CFG_NAME }}{{ $name }}
spec:
schedule: {{ default "0 * * * *" $config.schedule | quote }} # schedule contains asterisks, quote to avoid yaml parser errors
concurrencyPolicy: Forbid
successfulJobsHistoryLimit: {{ default 1 $config.successfulJobsHistoryLimit }}
failedJobsHistoryLimit: {{ default 1 $config.failedJobsHistoryLimit }}
jobTemplate:
spec:
template:
metadata:
labels:
app: cache-manager
spec:
containers:
- name: cache-manager
image: {{ include "image" $.Values.image }}
imagePullPolicy: IfNotPresent
command:
- python3
- -m
- cache_manager
env:
{{- range $key, $value := $config.envVars }}
- name: {{ $key }}
value: {{ $value }}
{{- end }}
volumeMounts:
- name: cfg-factory
mountPath: "/cfg_factory"
readOnly: true
volumes:
- name: cfg-factory
secret:
secretName: cfg-factory-secret
optional: true
restartPolicy: Never
---
{{- end }}
5 changes: 5 additions & 0 deletions charts/extensions/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ backlog-controller:
image: # image property will be set during release
repository: ~
tag: ~
cache-manager:
enabled: false
image: # image property will be set during release
repository: ~
tag: ~
delivery-db-backup:
enabled: false
image: # image property will be set during release
Expand Down
1 change: 1 addition & 0 deletions setup.service.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def modules():
return [
'app',
'artefacts',
'cache_manager',
'compliance_tests',
'components',
'dora',
Expand Down

0 comments on commit 1628335

Please sign in to comment.