func (h *azureSecretHandler) HandleConfigMap() (map[string]string, error) {
	if h.secretSpec.Spec.Vault.Object.Type == akv.AzureKeyVaultObjectTypeMultiKeyValueSecret && h.secretSpec.Spec.Output.ConfigMap.DataKey != "" {
		klog.InfoS("output data key ignored - vault object type is multi key and will use its own keys", klog.KObj(h.secretSpec))
	}
	values := make(map[string]string)
	secret, err := h.vaultService.GetSecret(&h.secretSpec.Spec.Vault)
	if err != nil {
		return nil, err
	}
	secret, err = h.transformator.Transform(secret)
	if err != nil {
		return nil, err
	}
	if h.secretSpec.Spec.Vault.Object.Type != akv.AzureKeyVaultObjectTypeMultiKeyValueSecret &&
		h.secretSpec.Spec.Output.ConfigMap.DataKey == "" {
		return nil, fmt.Errorf("no datakey spesified for output configmap")
	}
	values[h.secretSpec.Spec.Output.ConfigMap.DataKey] = secret
	return values, nil
}
Handle getting and formating Azure Key Vault Secret from Azure Key Vault to Kubernetes
package controller
import (
	"encoding/base64"
	"encoding/json"
	"fmt"
	"strings"
	"github.com/SparebankenVest/azure-key-vault-to-kubernetes/pkg/akv2k8s/transformers"
	vault "github.com/SparebankenVest/azure-key-vault-to-kubernetes/pkg/azure/keyvault/client"
	akv "github.com/SparebankenVest/azure-key-vault-to-kubernetes/pkg/k8s/apis/azurekeyvault/v2beta1"
	yaml "gopkg.in/yaml.v2"
	corev1 "k8s.io/api/core/v1"
	"k8s.io/klog/v2"
)
type KubernetesHandler interface {
	HandleSecret() (map[string][]byte, error)
	HandleConfigMap() (map[string]string, error)
}
type azureSecretHandler struct {
	secretSpec    *akv.AzureKeyVaultSecret
	vaultService  vault.Service
	transformator transformers.Transformator
}
type azureCertificateHandler struct {
	secretSpec   *akv.AzureKeyVaultSecret
	vaultService vault.Service
}
type azureKeyHandler struct {
	secretSpec   *akv.AzureKeyVaultSecret
	vaultService vault.Service
}
type azureMultiValueSecretHandler struct {
	secretSpec   *akv.AzureKeyVaultSecret
	vaultService vault.Service
}
func NewAzureSecretHandler(secretSpec *akv.AzureKeyVaultSecret, vaultService vault.Service, transformator transformers.Transformator) *azureSecretHandler {
	return &azureSecretHandler{
		secretSpec:    secretSpec,
		vaultService:  vaultService,
		transformator: transformator,
	}
}
func NewAzureCertificateHandler(secretSpec *akv.AzureKeyVaultSecret, vaultService vault.Service) *azureCertificateHandler {
	return &azureCertificateHandler{
		secretSpec:   secretSpec,
		vaultService: vaultService,
	}
}
func NewAzureKeyHandler(secretSpec *akv.AzureKeyVaultSecret, vaultService vault.Service) *azureKeyHandler {
	return &azureKeyHandler{
		secretSpec:   secretSpec,
		vaultService: vaultService,
	}
}
func NewAzureMultiKeySecretHandler(secretSpec *akv.AzureKeyVaultSecret, vaultService vault.Service) *azureMultiValueSecretHandler {
	return &azureMultiValueSecretHandler{
		secretSpec:   secretSpec,
		vaultService: vaultService,
	}
}
func (h *azureSecretHandler) HandleSecret() (map[string][]byte, error) {
	if h.secretSpec.Spec.Vault.Object.Type == akv.AzureKeyVaultObjectTypeMultiKeyValueSecret && h.secretSpec.Spec.Output.Secret.DataKey != "" {
		klog.InfoS("output data key ignored - vault object type is multi key and will use its own keys", klog.KObj(h.secretSpec))
	}
	values := make(map[string][]byte)
	secret, err := h.vaultService.GetSecret(&h.secretSpec.Spec.Vault)
	if err != nil {
		return nil, err
	}
	secret, err = h.transformator.Transform(secret)
	if err != nil {
		return nil, err
	}
	switch h.secretSpec.Spec.Output.Secret.Type {
	case corev1.SecretTypeBasicAuth:
		creds := strings.Split(secret, ":")
		if len(creds) != 2 {
			return nil, fmt.Errorf("unable to handle azure key vault secret as basic auth - check that formatting is correct 'username:password'")
		}
		values[corev1.BasicAuthUsernameKey] = []byte(creds[0])
		values[corev1.BasicAuthPasswordKey] = []byte(creds[1])
	case corev1.SecretTypeDockerConfigJson:
		values[corev1.DockerConfigJsonKey] = []byte(secret)
	case corev1.SecretTypeDockercfg:
		values[corev1.DockerConfigKey] = []byte(secret)
	case corev1.SecretTypeSSHAuth:
		values[corev1.SSHAuthPrivateKey] = []byte(secret)
	case corev1.SecretTypeTLS:
		pfxRaw, err := base64.StdEncoding.DecodeString(secret)
		if err != nil {
			return nil, fmt.Errorf("Failed to decode base64 encoded secret, error: %+v", err)
		}
		cert, err := vault.NewCertificateFromPfx(pfxRaw, h.secretSpec.Spec.Output.Secret.ChainOrder == "ensureserverfirst")
		if err != nil {
			return nil, fmt.Errorf("Error while processing secret content as pfx, error: %+v", err)
		}
		if values[corev1.TLSCertKey], err = cert.ExportPublicKeyAsPem(); err != nil {
			return nil, fmt.Errorf("Error exporting public key, error: %+v", err)
		}
		if values[corev1.TLSPrivateKeyKey], err = cert.ExportPrivateKeyAsPem(); err != nil {
			return nil, fmt.Errorf("Error exporting private key, error: %+v", err)
		}
	default:
		if h.secretSpec.Spec.Vault.Object.Type != akv.AzureKeyVaultObjectTypeMultiKeyValueSecret &&
			h.secretSpec.Spec.Output.Secret.DataKey == "" {
			return nil, fmt.Errorf("no datakey spesified for output secret")
		}
		values[h.secretSpec.Spec.Output.Secret.DataKey] = []byte(secret)
	}
	return values, nil
}