Skip to content

Commit dfaaf7d

Browse files
authored
Merge pull request #7 from BaizeAI/feat/update-image-format
feat: update image format
2 parents 16155cd + b468b02 commit dfaaf7d

File tree

6 files changed

+38
-8
lines changed

6 files changed

+38
-8
lines changed

.github/workflows/ci-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
images: |
6565
ghcr.io/baizeai/snapshot-controller
6666
tags: |
67-
type=semver,pattern={{version}}
67+
type=semver,pattern={{raw}}
6868
6969
- name: Build
7070
uses: docker/build-push-action@v4
@@ -102,7 +102,7 @@ jobs:
102102
103103
- name: Tag helm chart image
104104
run: |
105-
image_tag=${{ steps.get_version.outputs.VERSION }}
105+
image_tag=v${{ steps.get_version.outputs.VERSION }}
106106
chart_version=${{ steps.get_version.outputs.VERSION }}
107107
sed -i "s/latest/${image_tag}/g" $HELM_CHARTS_DIR/values.yaml
108108
chart_smever=${chart_version#"v"}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
{{/*
3+
Return the proper image name
4+
{{ include "common.images.image" ( dict "imageRoot" .Values.path.to.the.image "global" $) }}
5+
*/}}
6+
{{- define "common.images.image" -}}
7+
{{- $registryName := .imageRoot.registry -}}
8+
{{- $repositoryName := .imageRoot.repository -}}
9+
{{- $tag := .imageRoot.tag | toString -}}
10+
{{- if .global }}
11+
{{- if .global.imageRegistry }}
12+
{{- $registryName = .global.imageRegistry -}}
13+
{{- end -}}
14+
{{- end -}}
15+
{{- if $registryName }}
16+
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
17+
{{- else -}}
18+
{{- printf "%s:%s" $repositoryName $tag -}}
19+
{{- end -}}
20+
{{- end -}}

manifests/snapshot-pod/templates/_helpers.tpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,8 @@ Create the name of the service account to use
6060
{{- default "default" .Values.serviceAccount.name }}
6161
{{- end }}
6262
{{- end }}
63+
64+
65+
{{- define "snapshot-pod.image" -}}
66+
{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }}
67+
{{- end -}}

manifests/snapshot-pod/templates/daemonset.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ spec:
3838
- name: {{ .Chart.Name }}
3939
securityContext:
4040
{{- toYaml .Values.securityContext | nindent 12 }}
41-
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
41+
image: {{ template "snapshot-pod.image" . }}
4242
imagePullPolicy: {{ .Values.image.pullPolicy }}
4343
args:
4444
- --leader-elect=false

manifests/snapshot-pod/templates/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ spec:
3333
- name: {{ .Chart.Name }}
3434
securityContext:
3535
{{- toYaml .Values.securityContext | nindent 12 }}
36-
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
36+
image: {{ template "snapshot-pod.image" . }}
3737
imagePullPolicy: {{ .Values.image.pullPolicy }}
3838
args:
3939
- --leader-elect=true

manifests/snapshot-pod/values.yaml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@
22
# This is a YAML-formatted file.
33
# Declare variables to be passed into your templates.
44

5+
global:
6+
## @param global.imageRegistry Global image registry
7+
imageRegistry: ""
8+
59
replicaCount: 1
610

711
image:
8-
repository: aiharbor.daocloud.io/baize/snapshot-pod-controller
12+
registry: ghcr.io
13+
repository: baizeai/snapshot-controller
914
pullPolicy: IfNotPresent
1015
# Overrides the image tag whose default is the chart appVersion.
1116
tag: "latest"
@@ -28,15 +33,15 @@ serviceAccount:
2833
podAnnotations: {}
2934

3035
podSecurityContext: {}
31-
# fsGroup: 2000
36+
# fsGroup: 2000
3237

3338
securityContext: {}
3439
# capabilities:
3540
# drop:
3641
# - ALL
3742
# readOnlyRootFilesystem: true
3843
# runAsNonRoot: true
39-
# runAsUser: 1000
44+
# runAsUser: 1000
4045

4146
service:
4247
type: ClusterIP
@@ -45,7 +50,7 @@ resources: {}
4550
# We usually recommend not to specify default resources and to leave this as a conscious
4651
# choice for the user. This also increases chances charts run on environments with little
4752
# resources, such as Minikube. If you do want to specify resources, uncomment the following
48-
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
53+
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
4954

5055
nodeSelector: {}
5156

0 commit comments

Comments
 (0)