@@ -24,6 +24,7 @@ import (
2424 configv1client "github.com/openshift/client-go/config/clientset/versioned/typed/config/v1"
2525
2626 "github.com/openshift/library-go/test/library"
27+ "github.com/openshift/library-go/test/library/encryption/kms"
2728)
2829
2930var (
@@ -66,6 +67,7 @@ func SetAndWaitForEncryptionType(t testing.TB, encryptionType configv1.Encryptio
6667 if needsUpdate {
6768 t .Logf ("Updating encryption type in the config file for APIServer to %q" , encryptionType )
6869 apiServer .Spec .Encryption .Type = encryptionType
70+ apiServer .Spec .Encryption .KMS = defaultTestKMSConfig (encryptionType )
6971 _ , err = clientSet .ApiServerConfig .Update (context .TODO (), apiServer , metav1.UpdateOptions {})
7072 require .NoError (t , err )
7173 } else {
@@ -338,3 +340,23 @@ func setUpTearDown(namespace string) func(testing.TB, bool) {
338340 }
339341 }
340342}
343+
344+ func defaultTestKMSConfig (encryptionType configv1.EncryptionType ) * configv1.KMSConfig {
345+ if encryptionType != configv1 .EncryptionTypeKMS {
346+ return nil
347+ }
348+ return & configv1.KMSConfig {
349+ Type : configv1 .VaultKMSProvider ,
350+ Vault : configv1.VaultKMSConfig {
351+ KMSPluginImage : kms .WellKnownUpstreamMockKMSPluginImage ,
352+ VaultAddress : "https://vault.example.com" ,
353+ Authentication : configv1.VaultAuthentication {
354+ Type : configv1 .VaultAuthenticationTypeAppRole ,
355+ AppRole : configv1.VaultAppRoleAuthentication {
356+ Secret : configv1.VaultSecretReference {Name : "vault-approle-secret" },
357+ },
358+ },
359+ TransitKey : "test-transit-key" ,
360+ },
361+ }
362+ }
0 commit comments