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 38b64fb commit 385c911
Show file tree
Hide file tree
Showing 6 changed files with 97 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,46 @@
{{- range $cfgName := .Values.scanConfigurations }}
apiVersion: batch/v1
kind: CronJob
metadata:
name: {{ $name := print "cache-manager-" $cfgName }}{{ $name }}
spec:
schedule: {{ default "0 * * * *" $.Values.schedule | quote }} # schedule contains asterisks, quote to avoid yaml parser errors
concurrencyPolicy: Forbid
successfulJobsHistoryLimit: {{ default 1 $.Values.successfulJobsHistoryLimit }}
failedJobsHistoryLimit: {{ default 1 $.Values.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:
- name: CFG_NAME
value: {{ $cfgName }}
{{- if default dict $.Values.envVars }}
{{- range $key, $value := $.Values.envVars }}
- name: {{ $key }}
value: {{ $value }}
{{- end }}
{{- 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 385c911

Please sign in to comment.