1
1
// Copyright 2024 Nutanix. All rights reserved.
2
2
// SPDX-License-Identifier: Apache-2.0
3
3
4
- package encryption
4
+ package encryptionatrest
5
5
6
6
import (
7
7
"context"
@@ -100,7 +100,7 @@ func (h *encryptionPatchHandler) Mutate(
100
100
return err
101
101
}
102
102
103
- found , err := h .DefaultEncryptionSecretExists (ctx , cluster )
103
+ found , err := h .defaultEncryptionSecretExists (ctx , cluster )
104
104
if err != nil {
105
105
log .WithValues (
106
106
"defaultEncryptionSecret" , defaultEncryptionSecretName (cluster .Name ),
@@ -110,11 +110,13 @@ func (h *encryptionPatchHandler) Mutate(
110
110
111
111
// we do not rotate or override the secret keys for encryption configuration
112
112
if ! found {
113
- encConfig , err := h .generateEncryptionConfiguration (encryptionVariable .Providers )
113
+ encryptionConfig , err := h .generateEncryptionConfiguration (
114
+ encryptionVariable .Providers ,
115
+ )
114
116
if err != nil {
115
117
return err
116
118
}
117
- if err := h .CreateEncryptionConfigurationSecret (ctx , encConfig , cluster ); err != nil {
119
+ if err := h .createEncryptionConfigurationSecret (ctx , encryptionConfig , cluster ); err != nil {
118
120
return err
119
121
}
120
122
}
@@ -163,7 +165,7 @@ func (h *encryptionPatchHandler) generateEncryptionConfiguration(
163
165
resourceConfigs := []apiserverv1.ResourceConfiguration {}
164
166
for _ , encProvider := range providers {
165
167
provider := encProvider
166
- resourceConfig , err := encryptionConfigForSecretsAndConfigMaps (
168
+ resourceConfig , err := defaultEncryptionConfiguration (
167
169
& provider ,
168
170
h .keyGenerator ,
169
171
)
@@ -183,7 +185,7 @@ func (h *encryptionPatchHandler) generateEncryptionConfiguration(
183
185
}, nil
184
186
}
185
187
186
- func (h * encryptionPatchHandler ) DefaultEncryptionSecretExists (
188
+ func (h * encryptionPatchHandler ) defaultEncryptionSecretExists (
187
189
ctx context.Context ,
188
190
cluster * clusterv1.Cluster ,
189
191
) (bool , error ) {
@@ -208,7 +210,7 @@ func (h *encryptionPatchHandler) DefaultEncryptionSecretExists(
208
210
return true , nil
209
211
}
210
212
211
- func (h * encryptionPatchHandler ) CreateEncryptionConfigurationSecret (
213
+ func (h * encryptionPatchHandler ) createEncryptionConfigurationSecret (
212
214
ctx context.Context ,
213
215
encryptionConfig * apiserverv1.EncryptionConfiguration ,
214
216
cluster * clusterv1.Cluster ,
@@ -251,7 +253,7 @@ func (h *encryptionPatchHandler) CreateEncryptionConfigurationSecret(
251
253
}
252
254
253
255
// We only support encryption for "secrets" and "configmaps".
254
- func encryptionConfigForSecretsAndConfigMaps (
256
+ func defaultEncryptionConfiguration (
255
257
providers * carenv1.EncryptionProviders ,
256
258
secretGenerator TokenGenerator ,
257
259
) (* apiserverv1.ResourceConfiguration , error ) {
0 commit comments