forked from red-hat-storage/ocs-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OCS Operator will check whether KMS (Key Management System) feature is enabled or not through StorageCluster Spec (under 'Encryption' -> 'KeyManagementService' -> 'Enable' = true). If KMS is enabled, operator will look for a configmap, named "ocs-kms-connection-details", fetch details from it and update the 'CephCluster' Spec. Once successfully updated, rook will access the necessary info through the CephCluster Spec and in turn try to store the LUKS's (Linux Unified Key Setup) Key Encryption Key (KEK) inside a KMS. Main pre-requisite for this feature is a valid KMS Service provider should be running and should be reachable from other nodes in the cluster. More internal details could be found at: rook/rook#6474 Signed-off-by: Arun Kumar Mohan <amohan@redhat.com>
- Loading branch information
Showing
8 changed files
with
87 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package storagecluster | ||
|
||
import ( | ||
"context" | ||
|
||
ocsv1 "github.com/openshift/ocs-operator/pkg/apis/ocs/v1" | ||
corev1 "k8s.io/api/core/v1" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
|
||
"k8s.io/apimachinery/pkg/types" | ||
) | ||
|
||
const ( | ||
// KMSConfigMapName is the name configmap which has KMS config details | ||
KMSConfigMapName = "ocs-kms-connection-details" | ||
// KMSTokenSecretName is the name of the secret which has KMS token details | ||
KMSTokenSecretName = "ocs-kms-token" | ||
// KMSProviderKey is the key in config map to get the KMS provider name | ||
KMSProviderKey = "KMS_PROVIDER" | ||
// VaultKMSProvider a constant to represent 'vault' KMS provider | ||
VaultKMSProvider = "vault" | ||
) | ||
|
||
func getKMSConfigMap(instance *ocsv1.StorageCluster, client client.Client) (*corev1.ConfigMap, error) { | ||
// if 'KMS' is not enabled, nothing to fetch | ||
if !instance.Spec.Encryption.KeyManagementService.Enable { | ||
return nil, nil | ||
} | ||
kmsConfigMap := corev1.ConfigMap{} | ||
err := client.Get(context.TODO(), | ||
types.NamespacedName{ | ||
Name: KMSConfigMapName, | ||
Namespace: instance.ObjectMeta.Namespace, | ||
}, | ||
&kmsConfigMap, | ||
) | ||
return &kmsConfigMap, err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters