Skip to content

Commit a94f5ae

Browse files
author
Mr Goran
committed
DK-1665 read write to vault path - fix build
1 parent 6a66795 commit a94f5ae

File tree

3 files changed

+2
-69
lines changed

3 files changed

+2
-69
lines changed

common/vault.go

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -147,16 +147,6 @@ func authKubernetes(h *VaultHandler) (vault.AuthMethod, error) {
147147
})
148148
}
149149

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-
160150
// FromCredential creates a vault client handler
161151
// If the binding holds no vault address it will fallback to the env VAULT_ADDRESS
162152
func FromCredential(credential *DatabaseCredential, logger logr.Logger) (*VaultHandler, error) {
@@ -198,62 +188,6 @@ type VaultHandler struct {
198188
logger logr.Logger
199189
}
200190

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-
257191
// Read vault path and return data map
258192
// Return empty map if no data exists
259193
func (h *VaultHandler) Read(path string) (map[string]interface{}, error) {

config/manager/kustomization.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
44
kind: Kustomization
55
images:
66
- name: controller
7-
newName: nexus.doodle.com:5000/devops/kubedb
8-
newTag: "0.03"
7+
newName: nexus-docker.minikube/kubedb
8+
newTag: goran-test

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ module github.com/doodlescheduling/kubedb
33
go 1.13
44

55
require (
6-
cloud.google.com/go v0.38.0
76
github.com/go-logr/logr v0.1.0
87
github.com/golang/snappy v0.0.2 // indirect
98
github.com/hashicorp/errwrap v1.1.0

0 commit comments

Comments
 (0)