From 46dd2eb5ffe2464787ed9cba0b4acdde62e1d147 Mon Sep 17 00:00:00 2001 From: Rakshith R Date: Thu, 23 Feb 2023 12:42:22 +0530 Subject: [PATCH] core: add KeyRotationSpec to cephcluster CR This commit adds KeyRotationSpec to cephcluster CR to support encryption key rotation feature. If enabled Rook will create a cronjob for each encrypted PVC based OSD with given schedule set to rotate their respective key encryption key. Signed-off-by: Rakshith R --- .../charts/rook-ceph/templates/resources.yaml | 26 +++++++++++++++++++ deploy/examples/crds.yaml | 26 +++++++++++++++++++ pkg/apis/ceph.rook.io/v1/types.go | 16 ++++++++++++ 3 files changed, 68 insertions(+) diff --git a/deploy/charts/rook-ceph/templates/resources.yaml b/deploy/charts/rook-ceph/templates/resources.yaml index 746070ff5..c55f997f1 100644 --- a/deploy/charts/rook-ceph/templates/resources.yaml +++ b/deploy/charts/rook-ceph/templates/resources.yaml @@ -2548,6 +2548,19 @@ spec: description: Security represents security settings nullable: true properties: + keyRotation: + description: KeyRotation defines options for Key Rotation. + nullable: true + properties: + enabled: + default: false + description: Enabled represents whether the key rotation is enabled. + type: boolean + schedule: + default: '@weekly' + description: Schedule represents the cron schedule for key rotation. + type: string + type: object kms: description: KeyManagementService is the main Key Management option nullable: true @@ -12986,6 +12999,19 @@ spec: description: Security represents security settings nullable: true properties: + keyRotation: + description: KeyRotation defines options for Key Rotation. + nullable: true + properties: + enabled: + default: false + description: Enabled represents whether the key rotation is enabled. + type: boolean + schedule: + default: '@weekly' + description: Schedule represents the cron schedule for key rotation. + type: string + type: object kms: description: KeyManagementService is the main Key Management option nullable: true diff --git a/deploy/examples/crds.yaml b/deploy/examples/crds.yaml index b0a768aca..6493db113 100644 --- a/deploy/examples/crds.yaml +++ b/deploy/examples/crds.yaml @@ -2546,6 +2546,19 @@ spec: description: Security represents security settings nullable: true properties: + keyRotation: + description: KeyRotation defines options for Key Rotation. + nullable: true + properties: + enabled: + default: false + description: Enabled represents whether the key rotation is enabled. + type: boolean + schedule: + default: '@weekly' + description: Schedule represents the cron schedule for key rotation. + type: string + type: object kms: description: KeyManagementService is the main Key Management option nullable: true @@ -12978,6 +12991,19 @@ spec: description: Security represents security settings nullable: true properties: + keyRotation: + description: KeyRotation defines options for Key Rotation. + nullable: true + properties: + enabled: + default: false + description: Enabled represents whether the key rotation is enabled. + type: boolean + schedule: + default: '@weekly' + description: Schedule represents the cron schedule for key rotation. + type: string + type: object kms: description: KeyManagementService is the main Key Management option nullable: true diff --git a/pkg/apis/ceph.rook.io/v1/types.go b/pkg/apis/ceph.rook.io/v1/types.go index a9a44ac83..f80c01cfe 100755 --- a/pkg/apis/ceph.rook.io/v1/types.go +++ b/pkg/apis/ceph.rook.io/v1/types.go @@ -242,6 +242,10 @@ type SecuritySpec struct { // +optional // +nullable KeyManagementService KeyManagementServiceSpec `json:"kms,omitempty"` + // KeyRotation defines options for Key Rotation. + // +optional + // +nullable + KeyRotation KeyRotationSpec `json:"keyRotation,omitempty"` } // ObjectStoreSecuritySpec is spec to define security features like encryption @@ -268,6 +272,18 @@ type KeyManagementServiceSpec struct { TokenSecretName string `json:"tokenSecretName,omitempty"` } +// KeyRotationSpec represents the settings for Key Rotation. +type KeyRotationSpec struct { + // Enabled represents whether the key rotation is enabled. + // +optional + // +kubebuilder:default=false + Enabled bool `json:"enabled,omitempty"` + // Schedule represents the cron schedule for key rotation. + // +optional + // +kubebuilder:default="@weekly" + Schedule string `json:"schedule,omitempty"` +} + // CephVersionSpec represents the settings for the Ceph version that Rook is orchestrating. type CephVersionSpec struct { // Image is the container image used to launch the ceph daemons, such as quay.io/ceph/ceph: