apiserver/pkg/storage
Monis Khan 254de03ce9 kmsv2: re-use DEK while key ID is unchanged
This change updates KMS v2 to not create a new DEK for every
encryption.  Instead, we re-use the DEK while the key ID is stable.

Specifically:

We no longer use a random 12 byte nonce per encryption.  Instead, we
use both a random 4 byte nonce and an 8 byte nonce set via an atomic
counter.  Since each DEK is randomly generated and never re-used,
the combination of DEK and counter are always unique.  Thus there
can never be a nonce collision.  AES GCM strongly encourages the use
of a 12 byte nonce, hence the additional 4 byte random nonce.  We
could leave those 4 bytes set to all zeros, but there is no harm in
setting them to random data (it may help in some edge cases such as
live VM migration).

If the plugin is not healthy, the last DEK will be used for
encryption for up to three minutes (there is no difference on the
behavior of reads which have always used the DEK cache).  This will
reduce the impact of a short plugin outage while making it easy to
perform storage migration after a key ID change (i.e. simply wait
ten minutes after the key ID change before starting the migration).

The DEK rotation cycle is performed in sync with the KMS v2 status
poll thus we always have the correct information to determine if a
read is stale in regards to storage migration.

Signed-off-by: Monis Khan <mok@microsoft.com>

Kubernetes-commit: 832d6f0e19f13b9dd22b1fe9d705817e9e64f4f1
2023-02-24 16:51:08 -05:00
..
cacher Fix setting resource version after init events for RV=0 case 2023-03-03 13:22:13 +01:00
errors Fix function name of IsExist err 2022-03-19 23:06:51 +08:00
etcd3 Recognize etcd/grpc cancel errors correctly 2023-03-08 15:51:25 -05:00
names grammar: replace all occurrences of "the the" with "the" 2022-09-17 22:58:01 +02:00
storagebackend Load encryption config once 2022-08-29 17:25:48 -04:00
testing staging: fix "go vet" issues 2023-02-28 21:22:40 +01:00
testresource storage: isolate the test resource 2022-05-11 09:05:18 -07:00
tests staging: fix "go vet" issues 2023-02-28 21:22:40 +01:00
value kmsv2: re-use DEK while key ID is unchanged 2023-02-24 16:51:08 -05:00
OWNERS apiserver/storage: add myself to the reviewers list 2022-05-12 15:40:33 -07:00
api_object_versioner.go storage: move the APIObjectVersioner definition to storage 2022-05-11 07:44:21 -07:00
api_object_versioner_test.go storage: isolate the test resource 2022-05-11 09:05:18 -07:00
continue.go add explicit typing for continue tests 2022-05-31 10:23:07 -07:00
continue_test.go add explicit typing for continue tests 2022-05-31 10:23:07 -07:00
doc.go move pkg/storage to apiserver 2017-02-01 07:33:52 -05:00
errors.go Fix function name of IsExist err 2022-03-19 23:06:51 +08:00
interfaces.go Add SendInitialEvents to storage ListOptions 2023-01-30 14:54:59 +01:00
selection_predicate.go Partition watchers by namespace/name scope 2023-02-05 18:46:19 -05:00
selection_predicate_test.go Fix staticcheck failures 2021-04-02 12:23:30 +08:00
util.go Simplify trigger functions in cacher 2019-07-04 14:21:06 +02:00
util_test.go move cacher in separate dir 2018-05-30 20:44:31 +08:00