-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(service): replace/refactor internal repository cache (#3534)
- Loading branch information
Showing
61 changed files
with
1,128 additions
and
1,508 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Docker image for core-svc cronjob | ||
FROM alpine:3.18.2 | ||
RUN apk add --no-cache ca-certificates=20230506-r0 curl=8.1.2-r0 bash=5.2.15-r5 && rm -rf /var/cache/apk/* | ||
RUN curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl" &&\ | ||
chmod +x ./kubectl &&\ | ||
mv ./kubectl /usr/bin/kubectl | ||
|
||
RUN mkdir /code | ||
WORKDIR /code | ||
COPY cleanup.sh /code/ | ||
|
||
ENTRYPOINT ["/bin/bash", "/code/cleanup.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Core Service cache cleanup image | ||
Small image to be used for the cache cleanup CronJob for the core service. | ||
|
||
Loops through endpoint slices and call the cleanup endpoint on each core-svc instance. | ||
|
||
Push as `renku/renku-core-cleanup:<version>` to use |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
core_version=$1 | ||
namespace=$2 | ||
|
||
mapfile -t -d " " pod_ips < <(kubectl -n "$namespace" get pods --selector="app.kubernetes.io/name=core" --selector="app.kubernetes.io/deploymentVersion=$core_version" -o=jsonpath="{.items[*].status.podIP}" ) | ||
|
||
success=true | ||
|
||
for pod_ip in "${pod_ips[@]}" | ||
do | ||
echo "Calling http://$pod_ip:8080/renku/cache.cleanup" | ||
if curl "http://$pod_ip:8080/renku/cache.cleanup" ; then | ||
: | ||
else | ||
echo "Cleanup failed for pod $pod_ip with status $?">&2 | ||
success=false | ||
fi | ||
done | ||
|
||
if ! $success; then | ||
exit 1; | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{{- range $version := .Values.versions }} | ||
{{ if ne $version.name "v9"}} | ||
--- | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
name: {{ include "renku-core.fullname" $ }}-cleanup-{{ $version.name }} | ||
labels: | ||
app.kubernetes.io/deploymentVersion: {{ $version.name }} | ||
spec: | ||
schedule: "*/5 * * * *" | ||
concurrencyPolicy: Forbid | ||
jobTemplate: | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: {{ include "renku-core.fullname" $ }}-cache-cleanup-{{ $version.name }} | ||
image: renku/renku-core-cleanup:v1 | ||
imagePullPolicy: IfNotPresent | ||
args: | ||
- {{ $version.name | quote}} | ||
- {{ $.Release.Namespace }} | ||
restartPolicy: OnFailure | ||
serviceAccountName: {{ include "renku-core.fullname" $ }}-cleanup | ||
{{ end }} | ||
{{ end }} |
36 changes: 36 additions & 0 deletions
36
helm-chart/renku-core/templates/cronjob-serviceaccount.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ include "renku-core.fullname" $ }}-cleanup | ||
labels: | ||
{{ include "renku-core.labels" $ | indent 4 }} | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: Role | ||
metadata: | ||
name: {{ include "renku-core.fullname" $ }}-cleanup | ||
labels: | ||
{{ include "renku-core.labels" $ | indent 4 }} | ||
rules: | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- pods | ||
verbs: | ||
- get | ||
- list | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
name: {{ include "renku-core.fullname" $ }}-cleanup | ||
labels: | ||
{{ include "renku-core.labels" $ | indent 4 }} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: Role | ||
name: {{ include "renku-core.fullname" $ }}-cleanup | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{ include "renku-core.fullname" $ }}-cleanup | ||
namespace: {{ $.Release.Namespace }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.