Skip to content

Commit 9cbc4c7

Browse files
committed
chore: add sequence diagram for encrypt and decrypt request
Signed-off-by: Anish Ramasekar <[email protected]>
1 parent b0345e6 commit 9cbc4c7

File tree

2 files changed

+56
-1
lines changed

2 files changed

+56
-1
lines changed

keps/sig-auth/3299-kms-v2-improvements/README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
- [Non-Goals](#non-goals)
99
- [Proposal](#proposal)
1010
- [Design Details](#design-details)
11+
- [Sequence Diagram](#sequence-diagram)
12+
- [Encrypt Request](#encrypt-request)
13+
- [Decrypt Request](#decrypt-request)
1114
- [Test Plan](#test-plan)
1215
- [Graduation Criteria](#graduation-criteria)
1316
- [Alpha](#alpha)
@@ -290,6 +293,58 @@ This `UID` field is included in the `EncryptRequest` and `DecryptRequest` of the
290293
2. In addition to the `UID`, the kube-apiserver will also log non-sensitive metadata such as `name`, `namespace` and `GroupVersionResource` of the object that triggered the envelope operation.
291294
2. Sent to the kms-plugin as part of the `EncryptRequest` and `DecryptRequest` structs.
292295

296+
### Sequence Diagram
297+
298+
#### Encrypt Request
299+
300+
```mermaid
301+
sequenceDiagram
302+
participant etcd
303+
participant kubeapiserver
304+
participant kmsplugin
305+
participant externalkms
306+
kubeapiserver->>kmsplugin: encrypt request
307+
alt using key hierarchy
308+
kmsplugin->>kmsplugin: encrypt DEK with local KEK
309+
kmsplugin->>externalkms: encrypt local KEK with remote KEK
310+
externalkms->>kmsplugin: encrypted local KEK
311+
kmsplugin->>kmsplugin: cache encrypted local KEK
312+
kmsplugin->>kubeapiserver: return encrypt response <br/> {"cipher": "<encrypted DEK>", currentKeyID: "<remote KEK ID>", <br/> "metadata": {"kms.kubernetes.io/local-kek": "<encrypted local KEK>"}}
313+
else not using key hierarchy
314+
%% current behavior
315+
kmsplugin->>externalkms: encrypt DEK with remote KEK
316+
externalkms->>kmsplugin: encrypted DEK
317+
kmsplugin->>kubeapiserver: return encrypt response <br/> {"cipher": "<encrypted DEK>", currentKeyID: "<remote KEK ID>", "metadata": {}}
318+
end
319+
kubeapiserver->>etcd: store encrypt response and encrypted DEK
320+
```
321+
322+
#### Decrypt Request
323+
324+
```mermaid
325+
sequenceDiagram
326+
participant kubeapiserver
327+
participant kmsplugin
328+
participant externalkms
329+
%% if local KEK in metadata, then using hierarchy
330+
alt encrypted local KEK is in metadata
331+
kubeapiserver->>kmsplugin: decrypt request <br/> {"cipher": "<encrypted DEK>", observedKeyID: "<currentKeyID gotten as part of EncryptResponse>", <br/> "metadata": {"kms.kubernetes.io/local-kek": "<encrypted local KEK>"}}
332+
alt encrypted local KEK in cache
333+
kmsplugin->>kmsplugin: decrypt DEK with local KEK
334+
else encrypted local KEK not in cache
335+
kmsplugin->>externalkms: decrypt local KEK with remote KEK
336+
externalkms->>kmsplugin: decrypted local KEK
337+
kmsplugin->>kmsplugin: decrypt DEK with local KEK
338+
kmsplugin->>kmsplugin: cache decrypted local KEK
339+
end
340+
kmsplugin->>kubeapiserver: return decrypt response <br/> {"plain": "<decrypted DEK>", currentKeyID: "<remote KEK ID>", <br/> "metadata": {"kms.kubernetes.io/local-kek": "<encrypted local KEK>"}}
341+
else encrypted local KEK is not in metadata
342+
kubeapiserver->>kmsplugin: decrypt request <br/> {"cipher": "<encrypted DEK>", observedKeyID: "<currentKeyID gotten as part of EncryptResponse>", <br/> "metadata": {}}
343+
kmsplugin->>externalkms: decrypt DEK with remote KEK (same behavior as today)
344+
externalkms->>kmsplugin: decrypted DEK
345+
kmsplugin->>kubeapiserver: return decrypt response <br/> {"plain": "<decrypted DEK>", currentKeyID: "<remote KEK ID>", <br/> "metadata": {}}
346+
end
347+
```
293348

294349
### Test Plan
295350

keps/sig-auth/3299-kms-v2-improvements/kep.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ title: KMS v2 Improvements
22
kep-number: 3299
33
authors:
44
- "@ritazh"
5-
- "aramase"
5+
- "@aramase"
66
owning-sig: sig-auth
77
participating-sigs:
88
- sig-auth

0 commit comments

Comments
 (0)