Skip to content

Commit 1d80d43

Browse files
authored
add image digest option to tibidata-api-go (#15)
- add tibiadata-api-go.image helper - add readme for tibiadata-api-go chart - bump helm chart version
1 parent 82032aa commit 1d80d43

File tree

5 files changed

+63
-3
lines changed

5 files changed

+63
-3
lines changed

charts/tibiadata-api-go/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type: application
2424
# This is the chart version. This version number should be incremented each time you make changes
2525
# to the chart and its templates, including the app version.
2626
# Versions are expected to follow Semantic Versioning (https://semver.org/)
27-
version: 1.0.5
27+
version: 1.1.0
2828

2929
# This is the version number of the application being deployed. This version number should be
3030
# incremented each time you make changes to the application. Versions are not expected to

charts/tibiadata-api-go/README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# tibiadata-api-go Helm chart
2+
3+
## Installation
4+
5+
To add the tibiadata helm repo, run:
6+
7+
```console
8+
helm repo add tibiadata https://charts.tibiadata.com
9+
helm repo update
10+
```
11+
12+
To install a release named tibiadata-api-go, run:
13+
14+
```console
15+
helm install tibiadata-api-go tibiadata/tibiadata-api-go
16+
```
17+
18+
## Chart Values
19+
20+
```console
21+
helm show values tibiadata/tibiadata-api-go
22+
```
23+
24+
## Value Details
25+
26+
### image
27+
28+
Specify the container image to use for the deployment. `image.tag` For example, the following sets the image to the `ghcr.io/tibiadata/tibiadata-api-go` repo and the `v4.1.2` tag. The container pulls the image if not already present:
29+
30+
```yaml
31+
image:
32+
repository: ghcr.io/tibiadata/tibiadata-api-go
33+
tag: v4.1.2
34+
pullPolicy: IfNotPresent
35+
```
36+
37+
The chart also supports specifying an image based on digest value:
38+
39+
```yaml
40+
image:
41+
repository: ghcr.io/tibiadata/tibiadata-api-go
42+
digest: sha256:a6f902768cb71c0a0b391ec167146cd75bc07f063ad84f9022d98f7459f301bb
43+
pullPolicy: IfNotPresent
44+
```
45+
46+
If neither tag or digest is specified, the `appVersion` of the chart is used as a default.

charts/tibiadata-api-go/templates/_helpers.tpl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,19 @@ Create chart name and version as used by the chart label.
3030
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
3131
{{- end }}
3232

33+
{{/*
34+
Create chart image to be used by specifying tag or digest (including sha256: prefix)
35+
*/}}
36+
{{- define "tibiadata-api-go.image" -}}
37+
{{- $repository := .Values.image.repository -}}
38+
{{- if .Values.image.digest -}}
39+
{{- printf "%s@%s" $repository .Values.image.digest -}}
40+
{{- else -}}
41+
{{- $tag := default .Chart.AppVersion .Values.image.tag -}}
42+
{{- printf "%s:%s" $repository $tag -}}
43+
{{- end -}}
44+
{{- end -}}
45+
3346
{{/*
3447
Common labels
3548
*/}}

charts/tibiadata-api-go/templates/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ spec:
3131
- name: {{ .Chart.Name }}
3232
securityContext:
3333
{{- toYaml .Values.securityContext | nindent 12 }}
34-
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
34+
image: {{ include "tibiadata-api-go.image" . }}
3535
imagePullPolicy: {{ .Values.image.pullPolicy }}
3636
ports:
3737
- name: http

charts/tibiadata-api-go/values.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ replicaCount: 3
77
image:
88
repository: ghcr.io/tibiadata/tibiadata-api-go
99
pullPolicy: IfNotPresent
10-
# Overrides the image tag whose default is the chart appVersion.
10+
# Overrides the image tag whose default is the chart appVersion (digest takes precedence over tag).
1111
tag: ""
12+
digest: ""
1213

1314
imagePullSecrets: []
1415
nameOverride: ""

0 commit comments

Comments
 (0)