Commit fe2c45b
fix(k8s): support merge/json patch types in k8s_patch_resource
k8s_patch_resource always invoked `kubectl patch -p <patch>` with no
`--type`, so kubectl defaulted to a strategic merge patch. Strategic
merge is only implemented for built-in Kubernetes types — every
CustomResource (CRD) rejects it:
error: application/strategic-merge-patch+json is not supported by
<group>/<version>, Kind=<Kind>: the body of the request was in an
unknown format - accepted media types include:
application/json-patch+json, application/merge-patch+json,
application/apply-patch+yaml
This made the tool unable to patch any custom resource. Add an optional
`patch_type` parameter (strategic|merge|json) and pass it through as
`--type`. Default stays "strategic" so built-in patching is unchanged;
callers patching a CRD set "merge" (or "json"). This mirrors the
sibling k8s_patch_status handler, which already uses --type=merge.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: braghettos <braghettos@users.noreply.github.com>1 parent 9d18d83 commit fe2c45b
2 files changed
Lines changed: 63 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| 135 | + | |
135 | 136 | | |
136 | 137 | | |
137 | 138 | | |
138 | 139 | | |
139 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
140 | 149 | | |
141 | 150 | | |
142 | 151 | | |
| |||
152 | 161 | | |
153 | 162 | | |
154 | 163 | | |
155 | | - | |
| 164 | + | |
156 | 165 | | |
157 | 166 | | |
158 | 167 | | |
| |||
717 | 726 | | |
718 | 727 | | |
719 | 728 | | |
720 | | - | |
| 729 | + | |
721 | 730 | | |
722 | 731 | | |
723 | 732 | | |
| 733 | + | |
724 | 734 | | |
725 | 735 | | |
726 | 736 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
245 | | - | |
| 245 | + | |
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
| |||
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
265 | 314 | | |
266 | 315 | | |
267 | 316 | | |
| |||
1232 | 1281 | | |
1233 | 1282 | | |
1234 | 1283 | | |
1235 | | - | |
| 1284 | + | |
1236 | 1285 | | |
1237 | 1286 | | |
1238 | 1287 | | |
| |||
0 commit comments