aws / aws/aws-cdk

(aws-eks): `KubernetsPatch`'s applyPatch, restorePatch type is incorrect when 'PatchType.JSON'

Open
#11,775 3 comments 6 reactions 0 assignees View on GitHub
@aws-cdk/aws-eks @aws-cdk/aws-eks-v2-alpha bug effort/small p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

Json Patch standard denotes that https://tools.ietf.org/html/rfc6902#section-3

> A JSON Patch document is a JSON [RFC4627] document that represents an
> array of objects. Each object represents a single operation to be
> applied to the target JSON document.

However `KubernetesPatch.applyPatch` type is `{ [key: string]; any }`.
https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/aws-eks/lib/k8s-patch.ts#L20-L28

It is not wrong, but somewhat confusing.

### Reproduction Steps

### What did you expect to happen?

it should be `{ [key: string]; any} | {op: "add"|"remove"|"replace"|"move"|"copy"|"test", path: string, value: any}[]`

### What actually happened?

### Environment

- **CDK CLI Version :** 1.75.0
- **Framework Version:** 1.75.0
- **Node.js Version:**
- **OS :**
- **Language (Version):**

### Other

---

This is :bug: Bug Report

Contributor guide

Open the contributing guide

Research direction

Start in packages/@aws-cdk/aws-eks/lib/k8s-patch.ts, especially the applyPatch and restorePatch type definitions, and compare them with the JSON Patch format described in RFC 6902 section 3. Done means the public types accurately represent JSON Patch operations while preserving the existing patch form.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, kubernetes, typescript
Domain
devops, infrastructure
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.