Skip to content

Commit 7f6367d

Browse files
authored
chore(CI builds): Expose an in-cluster Helm repo off of the OCI chart pulled (#161)
* chore(CI builds): Expose an in-cluster Helm repo off of the OCI chart pulled Ref: https://issues.redhat.com/browse/RHIDP-7251 Ref: https://issues.redhat.com/browse/RHIDP-6668 * Update .rhdh/scripts/install.sh * Update .rhdh/scripts/install.sh
1 parent 35cf298 commit 7f6367d

1 file changed

Lines changed: 58 additions & 3 deletions

File tree

.rhdh/scripts/install.sh

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,73 @@ if [[ "$CV" == *"-CI" ]] || [[ $chartrepo -eq 1 ]]; then
6060
mkdir -p /tmp/"$CV"-unpacked && pushd /tmp/"$CV"-unpacked >/dev/null 2>&1 || exit 1
6161
helm pull oci://quay.io/rhdh/chart --version "$CV" -d /tmp/"$CV"-unpacked # get tarball
6262
helm repo index /tmp/"$CV"-unpacked # create index.yaml
63+
64+
# HelmChartRepository does not support OCI artifacts.
65+
# Host an in-cluster Helm repo serving both the index and chart files.
66+
if oc -n "$namespace" get configmap helm-repo-files > /dev/null; then
67+
oc -n "$namespace" delete configmap helm-repo-files
68+
fi
69+
oc -n "$namespace" create configmap helm-repo-files \
70+
--from-file=/tmp/"$CV"-unpacked/index.yaml \
71+
--from-file=/tmp/"$CV"-unpacked/chart-${CV}.tgz
72+
cat <<EOF > helm-repo.yaml
73+
apiVersion: apps/v1
74+
kind: Deployment
75+
metadata:
76+
name: helm-repo
77+
annotations:
78+
rhdh.redhat.com/chart-version: "$CV"
79+
spec:
80+
replicas: 1
81+
selector:
82+
matchLabels:
83+
app: helm-repo
84+
template:
85+
metadata:
86+
labels:
87+
app: helm-repo
88+
annotations:
89+
rhdh.redhat.com/chart-version: "$CV"
90+
spec:
91+
containers:
92+
- name: nginx
93+
image: quay.io/openshifttest/nginx-alpine:1.2.4
94+
ports:
95+
- containerPort: 8080
96+
volumeMounts:
97+
- name: chart-vol
98+
mountPath: /data/http/charts
99+
volumes:
100+
- name: chart-vol
101+
configMap:
102+
name: helm-repo-files
103+
---
104+
apiVersion: v1
105+
kind: Service
106+
metadata:
107+
name: helm-repo
108+
spec:
109+
selector:
110+
app: helm-repo
111+
ports:
112+
- port: 80
113+
targetPort: 8080
114+
EOF
115+
oc apply -f helm-repo.yaml || kubectl apply -f helm-repo.yaml
116+
63117
cat <<EOF > repo.yaml
64118
apiVersion: helm.openshift.io/v1beta1
65119
kind: HelmChartRepository
66120
metadata:
67121
name: rhdh-next-ci-repo
122+
annotations:
123+
rhdh.redhat.com/chart-version: "$CV"
68124
spec:
69125
connectionConfig:
70-
file: >-
71-
./index.yaml
126+
url: http://helm-repo.${namespace}.svc.cluster.local/charts
72127
EOF
73128

74-
oc apply -f repo.yaml || kubctl apply -f repo.yaml
129+
oc apply -f repo.yaml || kubectl apply -f repo.yaml
75130
popd >/dev/null 2>&1 || exit 1
76131

77132
# clean up temp files

0 commit comments

Comments
 (0)