Skip to content

Commit

Permalink
Merge pull request #2491 from sp98/add-azure-kms-support
Browse files Browse the repository at this point in the history
add support for Azure key vault
  • Loading branch information
openshift-merge-bot[bot] authored Mar 14, 2024
2 parents 73ae0f2 + af8524a commit c65c08c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions controllers/storagecluster/cephcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ func (obj *ocsCephCluster) ensureCreated(r *StorageClusterReconciler, sc *ocsv1.
sc.Status.KMSServerConnection.KMSServerConnectionError = ""
if kmsConfigMap.Data["KMS_PROVIDER"] == "vault" {
sc.Status.KMSServerConnection.KMSServerAddress = kmsConfigMap.Data["VAULT_ADDR"]
} else if kmsConfigMap.Data["KMS_PROVIDER"] == AzureKSMProvider {
sc.Status.KMSServerConnection.KMSServerAddress = kmsConfigMap.Data["AZURE_VAULT_URL"]
}
if err = reachKMSProvider(kmsConfigMap); err != nil {
sc.Status.KMSServerConnection.KMSServerConnectionError = err.Error()
Expand Down
8 changes: 8 additions & 0 deletions controllers/storagecluster/cephcluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,13 @@ func createDummyKMSConfigMap(kmsProvider, kmsAddr string, kmsAuthMethod string)
cm.Data["IBM_KP_SECRET_NAME"] = "my-kms-key"
cm.Data["IBM_KP_BASE_URL"] = "my-base-url"
cm.Data["IBM_KP_TOKEN_URL"] = "my-token-url"
case AzureKSMProvider:
cm.Data["AZURE_CLIENT_ID"] = "azure-client-id"
cm.Data["AZURE_TENANT_ID"] = "azure-tenant-id"
cm.Data["AZURE_VAULT_URL"] = kmsAddr
cm.Data["AZURE_CERT_SECRET_NAME"] = "cert-secret"
}

return cm
}

Expand Down Expand Up @@ -737,6 +743,8 @@ func TestKMSConfigChanges(t *testing.T) {
enabled: true, kmsAddress: "http://localhost:5678", authMethod: VaultSAAuthMethod},
{testLabel: "case 8", kmsProvider: ThalesKMSProvider,
clusterWideEncryption: true, kmsAddress: "http://localhost:5671"},
{testLabel: "case 9", kmsProvider: AzureKSMProvider,
clusterWideEncryption: true, kmsAddress: "http://localhost:5671"},
}
for _, kmsArgs := range validKMSArgs {
t.Run(kmsArgs.testLabel, func(t *testing.T) {
Expand Down
2 changes: 2 additions & 0 deletions controllers/storagecluster/kms_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ const (
IbmKeyProtectKMSProvider = "ibmkeyprotect"
// ThalesKMSProvider a constant to represent Thales (using KMIP) KMS provider
ThalesKMSProvider = "kmip"
// AzureKSMProvider represents the Azure Key vault.
AzureKSMProvider = "azure-kv"
)

var (
Expand Down

0 comments on commit c65c08c

Please sign in to comment.