Skip to content

Commit 1f7bfcd

Browse files
authored
feat: copy charts to pvc (#947)
**What problem does this PR solve?**: Copies charts to a common pvc. Still missing: - Special container that holds previous versions that would populate the initial PVC for previous versions. **Which issue(s) this PR fixes**: Fixes # **How Has This Been Tested?**: <!-- Please describe the tests that you ran to verify your changes. Provide output from the tests and any manual steps needed to replicate the tests. --> **Special notes for your reviewer**: <!-- Use this to provide any additional information to the reviewers. This may include: - Best way to review the PR. - Where the author wants the most review attention on. - etc. -->
1 parent 5aad02e commit 1f7bfcd

File tree

3 files changed

+45
-9
lines changed

3 files changed

+45
-9
lines changed

.goreleaser.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ dockers:
109109
build_flag_templates:
110110
- "--platform=linux/amd64"
111111
- "--pull"
112+
- '--build-arg=VERSION=v{{ trimprefix .Version "v" }}'
112113
- "--label=org.opencontainers.image.created={{.CommitDate}}"
113114
- "--label=org.opencontainers.image.title=caren-helm-reg"
114115
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
@@ -124,6 +125,7 @@ dockers:
124125
build_flag_templates:
125126
- "--platform=linux/arm64"
126127
- "--pull"
128+
- '--build-arg=VERSION=v{{ trimprefix .Version "v" }}'
127129
- "--label=org.opencontainers.image.created={{.CommitDate}}"
128130
- "--label=org.opencontainers.image.title=caren-helm-reg"
129131
- "--label=org.opencontainers.image.revision={{.FullCommit}}"

charts/cluster-api-runtime-extensions-nutanix/templates/helm-repository.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,21 @@ spec:
2626
kind: Issuer
2727
secretName: helm-repository-tls
2828
---
29+
apiVersion: v1
30+
kind: PersistentVolumeClaim
31+
metadata:
32+
finalizers:
33+
- kubernetes.io/pvc-protection
34+
name: helm-charts-pvc
35+
namespace: {{ .Release.Namespace }}
36+
spec:
37+
accessModes:
38+
- ReadWriteOnce
39+
resources:
40+
requests:
41+
storage: 2Gi
42+
volumeMode: Filesystem
43+
---
2944
apiVersion: apps/v1
3045
kind: Deployment
3146
metadata:
@@ -45,6 +60,14 @@ spec:
4560
labels:
4661
app: helm-repository # pods have this label, and Service and Deployment depend on it
4762
spec:
63+
initContainers:
64+
- name: copy-charts
65+
image: "{{ .Values.helmRepositoryImage.repository }}:{{ default $.Chart.AppVersion .Values.helmRepositoryImage.tag }}"
66+
command: ["/bin/sh", "-c", "cp /charts/*.tar /helm-charts"]
67+
imagePullPolicy: "{{ .Values.image.pullPolicy }}"
68+
volumeMounts:
69+
- name: charts-volume
70+
mountPath: "/helm-charts"
4871
containers:
4972
- name: helm-repository
5073
ports:
@@ -53,10 +76,22 @@ spec:
5376
containerPort: 5000
5477
image: "{{ .Values.helmRepositoryImage.repository }}:{{ default $.Chart.AppVersion .Values.helmRepositoryImage.tag }}"
5578
imagePullPolicy: "{{ .Values.image.pullPolicy }}"
79+
command: ["/usr/bin/mindthegap"]
80+
args:
81+
- serve
82+
- bundle
83+
- --bundle=/helm-charts/helm-charts-*.tar
84+
- --listen-port=5000
85+
- --listen-address=0.0.0.0
86+
- --tls-private-key-file=/certs/tls.key
87+
- --tls-cert-file=/certs/tls.crt
5688
volumeMounts:
5789
- name: certs-vol
5890
mountPath: "/certs"
5991
readOnly: true
92+
- name: charts-volume
93+
mountPath: "/helm-charts"
94+
readOnly: true
6095
livenessProbe:
6196
tcpSocket:
6297
port: serve
@@ -73,6 +108,9 @@ spec:
73108
- name: certs-vol
74109
secret:
75110
secretName: helm-repository-tls
111+
- name: charts-volume
112+
persistentVolumeClaim:
113+
claimName: helm-charts-pvc
76114
---
77115
apiVersion: v1
78116
kind: Service
Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
ARG MINDTHEGAP_VERSION=v1.14.4
2-
32
FROM --platform=${BUILDPLATFORM} ghcr.io/mesosphere/mindthegap:${MINDTHEGAP_VERSION} as bundle_builder
43
# this gets called by goreleaser so the copy source has to be the path relative to the repo root.
54
RUN --mount=source=./hack/addons/mindthegap-helm-registry/repos.yaml,target=/repos.yaml \
65
["/ko-app/mindthegap", "create", "bundle", "--helm-charts-file=/repos.yaml", "--output-file=/tmp/helm-charts.tar"]
76

8-
FROM --platform=${TARGETPLATFORM} ghcr.io/mesosphere/mindthegap:${MINDTHEGAP_VERSION}
9-
COPY --from=bundle_builder /tmp/helm-charts.tar /tmp/helm-charts.tar
7+
FROM --platform=${TARGETPLATFORM} alpine:3.20.3
8+
ARG VERSION
9+
COPY --from=bundle_builder /tmp/helm-charts.tar /charts/helm-charts-${VERSION}.tar
10+
COPY --from=bundle_builder /ko-app/mindthegap /usr/bin/mindthegap
1011
VOLUME /certs
11-
CMD [ "serve", "bundle", \
12-
"--bundle=/tmp/helm-charts.tar", \
13-
"--listen-port=5000", \
14-
"--listen-address=0.0.0.0", \
15-
"--tls-private-key-file=/certs/tls.key", \
16-
"--tls-cert-file=/certs/tls.crt" ]
12+
ENTRYPOINT /usr/bin/mindthegap

0 commit comments

Comments
 (0)