Skip to content

Commit 415af24

Browse files
committed
feat: default service image tags to AppVersion
1 parent 3fcd069 commit 415af24

5 files changed

Lines changed: 61 additions & 3 deletions

File tree

helm/fiftyone-teams-app/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,7 @@ If pods show unhealthy states (e.g., `0/1`, `CrashLoopBackOff`, `Pending`):
10461046
| serviceOrchestrator.builtinServices.configMap.create | bool | `true` | Controls whether to create the `ConfigMap` named `serviceOrchestrator.builtinServices.configMap.name`. |
10471047
| serviceOrchestrator.builtinServices.configMap.labels | object | `{}` | Additional labels for the generated `ConfigMap`. [Reference][labels-and-selectors]. |
10481048
| serviceOrchestrator.builtinServices.configMap.name | string | `""` | Name of the `ConfigMap` (existing or to be created) in the namespace `namespace.name` holding the builtin services overrides. Defaults to `release-name-fiftyone-teams-app-builtin-services`. |
1049-
| serviceOrchestrator.builtinServices.services | list | `[]` | Builtin service overrides, deep-merged by `id` onto the defaults packaged in fiftyone (`builtin_version` must be bumped for a changed entry to re-apply to an environment that already stores the builtin). |
1049+
| serviceOrchestrator.builtinServices.services | list | `[]` | Builtin service overrides, deep-merged by `id` onto the defaults packaged in fiftyone (`builtin_version` must be bumped for a changed entry to re-apply to an environment that already stores the builtin). An `entrypoint.container.image` without a tag defaults to the chart's appVersion. |
10501050
| serviceOrchestrator.enabled | bool | `false` | Controls whether to create the builtin services overrides `ConfigMap` below and wire it into `teams-api`. |
10511051
| teamsAppSettings.affinity | object | `{}` | Affinity and anti-affinity for `teams-app`. [Reference][affinity]. |
10521052
| teamsAppSettings.autoscaling.enabled | bool | `false` | Controls horizontal pod autoscaling for `teams-app`. [Reference][autoscaling]. |

helm/fiftyone-teams-app/templates/service-orchestrator-builtin-services-configmap.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,22 @@ metadata:
1616
{{- end }}
1717
labels:
1818
{{- include "service-orchestrator.builtin-services-config-map-labels" . | nindent 4 }}
19+
{{- /* An entrypoint.container.image without a tag defaults to the chart's
20+
appVersion, so entries track image bumps instead of pinning a tag —
21+
same convention as the chart's other images. Tag detection looks at
22+
the segment after the last "/" so a registry port
23+
(registry:5000/image) is not mistaken for a tag, and digests
24+
(image@sha256:...) are left alone. */}}
25+
{{- $services := list }}
26+
{{- range $service := (.Values.serviceOrchestrator.builtinServices.services | default list) }}
27+
{{- $service = deepCopy $service }}
28+
{{- $image := dig "entrypoint" "container" "image" "" $service }}
29+
{{- if and $image (not (contains ":" (last (splitList "/" $image)))) }}
30+
{{- $_ := set $service.entrypoint.container "image" (printf "%s:%s" $image $.Chart.AppVersion) }}
31+
{{- end }}
32+
{{- $services = append $services $service }}
33+
{{- end }}
1934
data:
2035
builtin_services.yaml: |
21-
{{- toYaml (.Values.serviceOrchestrator.builtinServices.services | default list) | nindent 4 }}
36+
{{- toYaml $services | nindent 4 }}
2237
{{- end }}

helm/fiftyone-teams-app/values.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3501,7 +3501,7 @@
35013501
"type": "object"
35023502
},
35033503
"services": {
3504-
"description": "Builtin service overrides, deep-merged by `id` onto the defaults\npackaged in fiftyone (`builtin_version` must be bumped for a changed\nentry to re-apply to an environment that already stores the builtin).",
3504+
"description": "Builtin service overrides, deep-merged by `id` onto the defaults\npackaged in fiftyone (`builtin_version` must be bumped for a changed\nentry to re-apply to an environment that already stores the builtin).\nAn `entrypoint.container.image` without a tag defaults to the chart's\nappVersion.",
35053505
"items": {
35063506
"required": []
35073507
},

helm/fiftyone-teams-app/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1433,6 +1433,8 @@ serviceOrchestrator:
14331433
# -- Builtin service overrides, deep-merged by `id` onto the defaults
14341434
# packaged in fiftyone (`builtin_version` must be bumped for a changed
14351435
# entry to re-apply to an environment that already stores the builtin).
1436+
# An `entrypoint.container.image` without a tag defaults to the chart's
1437+
# appVersion.
14361438
services: []
14371439

14381440
# FiftyOne Enterprise App (teams-app) configurations

tests/unit/helm/service-orchestrator-builtin-services-configmap_test.go

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,47 @@ func (s *builtinServicesConfigMapTemplateTest) TestServicesPayload() {
156156
s.Equal("registry:5000/sam2-video:tag", container["image"])
157157
},
158158
},
159+
{
160+
// An entrypoint image without a tag defaults to the chart's
161+
// appVersion; a registry port is not mistaken for a tag and
162+
// digest-pinned images are left alone.
163+
"enabledWithImageTagDefaulting",
164+
map[string]string{
165+
"serviceOrchestrator.enabled": "true",
166+
},
167+
map[string]string{
168+
"serviceOrchestrator.builtinServices.services": `[
169+
{
170+
"id": "builtin:untagged",
171+
"builtin_version": 1,
172+
"entrypoint": {"container": {"image": "registry:5000/sam2-video"}}
173+
},
174+
{
175+
"id": "builtin:digest",
176+
"builtin_version": 1,
177+
"entrypoint": {"container": {"image": "registry:5000/sam2-video@sha256:abc123"}}
178+
}
179+
]`,
180+
},
181+
2,
182+
func(services []map[string]interface{}) {
183+
cInfo, err := chartInfo(s.T(), s.chartPath)
184+
s.NoError(err)
185+
appVersion, exists := cInfo["appVersion"]
186+
s.True(exists)
187+
188+
entrypoint := services[0]["entrypoint"].(map[string]interface{})
189+
container := entrypoint["container"].(map[string]interface{})
190+
s.Equal(
191+
fmt.Sprintf("registry:5000/sam2-video:%s", appVersion),
192+
container["image"],
193+
)
194+
195+
entrypoint = services[1]["entrypoint"].(map[string]interface{})
196+
container = entrypoint["container"].(map[string]interface{})
197+
s.Equal("registry:5000/sam2-video@sha256:abc123", container["image"])
198+
},
199+
},
159200
}
160201

161202
for _, testCase := range testCases {

0 commit comments

Comments
 (0)