Skip to content

Commit e51d4b7

Browse files
committed
Inject pull secret for Kserve components
Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
1 parent d0e6cf3 commit e51d4b7

File tree

4 files changed

+55
-2
lines changed

4 files changed

+55
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/.idea
Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,39 @@
1-
{{ .Files.Get "files/resources.yaml" }}
1+
{{- $resourcesFile := .Files.Get "files/resources.yaml" }}
2+
{{- $pullSecretEmitted := dict }}
3+
{{- range $doc := regexSplit "(?m)^---$" $resourcesFile -1 }}
4+
{{- $resource := fromYaml $doc }}
5+
{{- if and $resource $resource.kind }}
6+
{{- if eq $resource.kind "ServiceAccount" }}
7+
{{- $ns := $resource.metadata.namespace }}
8+
{{- if and $.Values.pullSecret.dockerConfigJson (not (hasKey $pullSecretEmitted $ns)) }}
9+
{{- $_ := set $pullSecretEmitted $ns true }}
10+
---
11+
apiVersion: v1
12+
kind: Secret
13+
metadata:
14+
name: {{ $.Values.pullSecret.name }}
15+
namespace: {{ $ns }}
16+
type: kubernetes.io/dockerconfigjson
17+
data:
18+
.dockerconfigjson: {{ $.Values.pullSecret.dockerConfigJson | b64enc }}
19+
{{- end }}
20+
---
21+
apiVersion: v1
22+
kind: ServiceAccount
23+
metadata:
24+
{{- with $resource.metadata.labels }}
25+
labels:
26+
{{- range $key, $value := . }}
27+
{{ $key }}: {{ $value | quote }}
28+
{{- end }}
29+
{{- end }}
30+
name: {{ $resource.metadata.name }}
31+
namespace: {{ $ns }}
32+
imagePullSecrets:
33+
- name: {{ $.Values.pullSecret.name }}
34+
{{- else }}
35+
---
36+
{{ $doc }}
37+
{{- end }}
38+
{{- end }}
39+
{{- end }}

charts/kserve/values.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
# Default values for kserve-rhaii-xks
22
# This chart uses pre-rendered Kustomize output with embedded Go templates
3-
# that are passed through unchanged to the cluster.
3+
# that are passed through unchanged to the cluster.
4+
5+
# Pull secret for registry.redhat.io
6+
# Auth is configured in the root values.yaml and passed via helmfile
7+
pullSecret:
8+
name: redhat-pull-secret
9+
dockerConfigJson: "" # Set automatically by helmfile from root auth config

helmfile.yaml.gotmpl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ releases:
5151
version: {{ $kserveVersion }}
5252
namespace: opendatahub
5353
disableValidation: true
54+
set:
55+
{{- if .Values.useSystemPodmanAuth }}
56+
- name: pullSecret.dockerConfigJson
57+
file: {{ env "HOME" }}/.config/containers/auth.json
58+
{{- else if .Values.pullSecretFile }}
59+
- name: pullSecret.dockerConfigJson
60+
file: {{ .Values.pullSecretFile }}
61+
{{- end }}
5462
# CRDs are applied separately via presync hook to avoid 1MB secret size limit
5563
hooks:
5664
# Apply CRDs before helm install via presync

0 commit comments

Comments
 (0)