@@ -147,16 +147,6 @@ func authKubernetes(h *VaultHandler) (vault.AuthMethod, error) {
147
147
})
148
148
}
149
149
150
- func convertTLSSpec (spec v1beta1.VaultTLSSpec ) * vaultapi.TLSConfig {
151
- return & vaultapi.TLSConfig {
152
- CACert : spec .CACert ,
153
- ClientCert : spec .ClientCert ,
154
- ClientKey : spec .ClientKey ,
155
- TLSServerName : spec .ServerName ,
156
- Insecure : spec .Insecure ,
157
- }
158
- }
159
-
160
150
// FromCredential creates a vault client handler
161
151
// If the binding holds no vault address it will fallback to the env VAULT_ADDRESS
162
152
func FromCredential (credential * DatabaseCredential , logger logr.Logger ) (* VaultHandler , error ) {
@@ -198,62 +188,6 @@ type VaultHandler struct {
198
188
logger logr.Logger
199
189
}
200
190
201
- // ApplySecret applies the desired secret to vault
202
- //func (h *VaultHandler) ApplySecret(binding *v1beta1.VaultBinding, secret *corev1.Secret) (bool, error) {
203
- // var writeBack bool
204
- //
205
- // // TODO Is there such a thing as locking the path so we don't overwrite fields which would be changed at the same time?
206
- // data, err := h.Read(binding.Spec.Path)
207
- // if err != nil {
208
- // return writeBack, err
209
- // }
210
- //
211
- // // Loop through all mapping field and apply to the vault path data
212
- // for _, field := range binding.Spec.Fields {
213
- // k8sField := field.Name
214
- // vaultField := k8sField
215
- // if field.Rename != "" {
216
- // vaultField = field.Rename
217
- // }
218
- //
219
- // h.logger.Info("applying k8s field to vault", "k8sField", k8sField, "vaultField", vaultField, "vaultPath", binding.Spec.Path)
220
- //
221
- // // If k8s secret field does not exists return an error
222
- // k8sValue, ok := secret.Data[k8sField]
223
- // if !ok {
224
- // return writeBack, ErrK8sSecretFieldNotAvailable
225
- // }
226
- //
227
- // secret := string(k8sValue)
228
- //
229
- // _, existingField := data[vaultField]
230
- //
231
- // switch {
232
- // case !existingField:
233
- // h.logger.Info("found new field to write", "vaultField", vaultField)
234
- // data[vaultField] = secret
235
- // writeBack = true
236
- // case data[vaultField] == secret:
237
- // h.logger.Info("skipping field, no update required", "vaultField", vaultField)
238
- // case binding.Spec.ForceApply == true:
239
- // data[vaultField] = secret
240
- // writeBack = true
241
- // default:
242
- // h.logger.Info("skipping field, it already exists in vault and force apply is disabled", "vaultField", vaultField)
243
- // }
244
- // }
245
- //
246
- // if writeBack == true {
247
- // // Finally write the secret back
248
- // _, err = h.c.Logical().Write(binding.Spec.Path, data)
249
- // if err != nil {
250
- // return writeBack, err
251
- // }
252
- // }
253
- //
254
- // return writeBack, nil
255
- //}
256
-
257
191
// Read vault path and return data map
258
192
// Return empty map if no data exists
259
193
func (h * VaultHandler ) Read (path string ) (map [string ]interface {}, error ) {
0 commit comments