Commit 82e6b4b
fix(supervisor): KUBERNETES_WORKER_POD_ANNOTATIONS values must be strings
K8s annotations are 'map[string]string' per API spec. The default
JsonStringMap validator on JsonObjectEnv treats each value as a
nested Record<string,string>, which silently accepts object values
like {} and then crashes at the K8s apiserver:
Pod in version v1 cannot be handled as a Pod: json: cannot unmarshal
object into Go struct field ObjectMeta.metadata.annotations of type
string
Real production failure on FedStart with the Rubix pod-cert annotation
(`{"com.palantir.rubix.service/pod-cert": {}}`) — pre-fix the env
var passed zod validation, then kubernetes.ts spread the object into
the Pod spec, and the apiserver rejected with the above. Worker pods
never got created → no task runs ever scheduled.
Fix: override the valueValidator to z.string() for annotations.
Schema now matches K8s annotation reality. Object values are rejected
at zod parse time with a clear error before they ever reach the
apiserver. Security context env vars stay on JsonAny (their values
genuinely ARE nested objects).
Tests: add a 'flat string values, K8s-annotation shape' suite covering:
- the Rubix pod-cert string value passes
- multiple flat string annotations pass
- the exact pre-fix failure shape (object value) is now rejected
- other non-string values (numeric/boolean/nested map) rejected
Regression case is the literal FedStart input that caused the prod
crash, so anyone changing this validator in the future has to face it.
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent 0b2fa27 commit 82e6b4b
3 files changed
Lines changed: 80 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
99 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
100 | 115 | | |
101 | 116 | | |
102 | 117 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
0 commit comments