Skip to content

Commit 03a4b78

Browse files
committed
fix: auto-inject sidecar settings
1 parent c42832d commit 03a4b78

4 files changed

Lines changed: 44 additions & 4 deletions

File tree

helm/fiftyone-teams-app/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ If pods show unhealthy states (e.g., `0/1`, `CrashLoopBackOff`, `Pending`):
943943
| delegatedOperatorJobTemplates.template.image.tag | string | `""` | Image tag for `delegated-operator-executor`. Defaults to the chart version. |
944944
| delegatedOperatorJobTemplates.template.jobAnnotations | object | `{}` | Annotations for the `teams-do` deployment. [Reference][annotations]. |
945945
| delegatedOperatorJobTemplates.template.labels | object | `{}` | Additional labels for the `delegated-operator-executor` related objects. [Reference][labels-and-selectors]. |
946-
| delegatedOperatorJobTemplates.template.nativeSidecarContainers | list | `[]` | Native sidecar containers for on-demand delegated-operator Job pods (Kubernetes 1.29+). Entries are rendered under `initContainers`; set `restartPolicy: Always` on each entry to enable the native sidecar lifecycle. Kubelet auto-terminates these when the executor container finishes, so the Job completes cleanly. [Reference][sidecar-containers]. |
946+
| delegatedOperatorJobTemplates.template.nativeSidecarContainers | list | `[]` | Native sidecar containers for on-demand delegated-operator Job pods (Kubernetes 1.29+). Entries are rendered under `initContainers`; set `restartPolicy: Always` on each entry to enable the native sidecar lifecycle. Kubelet auto-terminates these when the executor container finishes, so the Job completes cleanly. The chart auto-injects `TARGET_CONTAINER=executor` on each entry (override by setting it explicitly). [Reference][sidecar-containers]. |
947947
| delegatedOperatorJobTemplates.template.nodeSelector | object | `{}` | nodeSelector for `delegated-operator-executor`. [Reference][node-selector]. |
948948
| delegatedOperatorJobTemplates.template.podAnnotations | object | `{}` | Annotations for delegated-operator-executor pods. [Reference][annotations]. |
949949
| delegatedOperatorJobTemplates.template.podSecurityContext | object | `{}` | Pod-level security attributes and common container settings for `delegated-operator-executor`. [Reference][security-context]. |

helm/fiftyone-teams-app/templates/delegated-operator-job-configmap.yaml

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,31 @@ data:
4444
{{- $mergedVolumes := $jobConfig.volumes | default $baseTpl.volumes }}
4545
{{- $mergedExtraContainers := $jobConfig.extraContainers | default $baseTpl.extraContainers }}
4646
{{- $mergedNativeSidecarContainers := $jobConfig.nativeSidecarContainers | default $baseTpl.nativeSidecarContainers }}
47+
48+
{{- /* telemetry-sidecar needs a shared emptyDir; values can't reliably keep it through fleet regenerators, so reconcile it here. */ -}}
49+
{{- $needsTelemetrySocket := false }}
50+
{{- range $sidecar := $mergedNativeSidecarContainers }}
51+
{{- range $vm := ($sidecar.volumeMounts | default list) }}
52+
{{- if eq $vm.name "telemetry-socket" }}{{- $needsTelemetrySocket = true }}{{- end }}
53+
{{- end }}
54+
{{- end }}
55+
{{- if $needsTelemetrySocket }}
56+
{{- $hasVolume := false }}
57+
{{- range $v := ($mergedVolumes | default list) }}
58+
{{- if eq $v.name "telemetry-socket" }}{{- $hasVolume = true }}{{- end }}
59+
{{- end }}
60+
{{- if not $hasVolume }}
61+
{{- $mergedVolumes = append ($mergedVolumes | default list) (dict "name" "telemetry-socket" "emptyDir" dict) }}
62+
{{- end }}
63+
{{- $hasMount := false }}
64+
{{- range $vm := ($mergedVolumeMounts | default list) }}
65+
{{- if eq $vm.name "telemetry-socket" }}{{- $hasMount = true }}{{- end }}
66+
{{- end }}
67+
{{- if not $hasMount }}
68+
{{- $mergedVolumeMounts = append ($mergedVolumeMounts | default list) (dict "name" "telemetry-socket" "mountPath" "/tmp/telemetry") }}
69+
{{- end }}
70+
{{- end }}
71+
4772
{{- /* Trunc at 48 for the random ID to be generated via API */ -}}
4873
{{- $metadataName := kebabcase $jobName | trunc 48 }}
4974

@@ -129,7 +154,20 @@ data:
129154
{{- end }}
130155
{{- with $mergedNativeSidecarContainers }}
131156
initContainers:
132-
{{- toYaml . | nindent 12 }}
157+
{{- /* TARGET_CONTAINER tells the telemetry sidecar's log tailer which container to follow; the executor is hardcoded so we know the value. */ -}}
158+
{{- range $sidecar := . }}
159+
{{- $hasTargetContainer := false }}
160+
{{- range $env := ($sidecar.env | default list) }}
161+
{{- if eq $env.name "TARGET_CONTAINER" }}
162+
{{- $hasTargetContainer = true }}
163+
{{- end }}
164+
{{- end }}
165+
{{- $rendered := deepCopy $sidecar }}
166+
{{- if not $hasTargetContainer }}
167+
{{- $_ := set $rendered "env" (prepend ($sidecar.env | default list) (dict "name" "TARGET_CONTAINER" "value" "executor")) }}
168+
{{- end }}
169+
{{- list $rendered | toYaml | nindent 12 }}
170+
{{- end }}
133171
{{- end }}
134172
{{- with $mergedNodeSelector }}
135173
nodeSelector:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2489,7 +2489,7 @@
24892489
"type": "object"
24902490
},
24912491
"nativeSidecarContainers": {
2492-
"description": "Native sidecar containers for on-demand delegated-operator Job pods\n(Kubernetes 1.29+). Entries are rendered under `initContainers`; set\n`restartPolicy: Always` on each entry to enable the native sidecar\nlifecycle. Kubelet auto-terminates these when the executor container\nfinishes, so the Job completes cleanly. [Reference][sidecar-containers].",
2492+
"description": "Native sidecar containers for on-demand delegated-operator Job pods\n(Kubernetes 1.29+). Entries are rendered under `initContainers`; set\n`restartPolicy: Always` on each entry to enable the native sidecar\nlifecycle. Kubelet auto-terminates these when the executor container\nfinishes, so the Job completes cleanly. The chart auto-injects\n`TARGET_CONTAINER=executor` on each entry (override by setting it\nexplicitly). [Reference][sidecar-containers].",
24932493
"items": {
24942494
"required": []
24952495
},

helm/fiftyone-teams-app/values.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,9 @@ delegatedOperatorJobTemplates:
10311031
# (Kubernetes 1.29+). Entries are rendered under `initContainers`; set
10321032
# `restartPolicy: Always` on each entry to enable the native sidecar
10331033
# lifecycle. Kubelet auto-terminates these when the executor container
1034-
# finishes, so the Job completes cleanly. [Reference][sidecar-containers].
1034+
# finishes, so the Job completes cleanly. The chart auto-injects
1035+
# `TARGET_CONTAINER=executor` on each entry (override by setting it
1036+
# explicitly). [Reference][sidecar-containers].
10351037
nativeSidecarContainers: []
10361038
# -- On-Demand Delegated Operator Jobs.
10371039
jobs: {}

0 commit comments

Comments
 (0)