Documentation
¶
Index ¶
Constants ¶
View Source
const ( // DefaultNamespace is the default kubernetes namespace. DefaultNamespace = "default" // DefaultLabelValue is the default label value that will be applied to secrets // created by pentagon. DefaultLabelValue = "default" // VaultSourceType indicates a mapping sourced from Hashicorp Vault. VaultSourceType = "vault" // GSMSourceType indicates a mapping sourced from Google Secrets Manager. GSMSourceType = "gsm" // GSM encoded as just raw bytes (default) GSMEncodingTypeDefault = "default" // GSM encoded as json GSMEncodingTypeJSON = "json" )
View Source
const LabelKey = "pentagon"
LabelKey is the name of label that will be attached to every secret created by pentagon.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Vault is the configuration used to connect to vault.
Vault VaultConfig `yaml:"vault"`
// Namespace is the k8s namespace that the secrets will be created in.
Namespace string `yaml:"namespace"`
// Label is the value of the `pentagon` label that will be added to all
// k8s secrets created by pentagon.
Label string `yaml:"label"`
// Mappings is a list of mappings.
Mappings []Mapping `yaml:"mappings"`
}
Config describes the configuration for Pentagon.
func (*Config) SetDefaults ¶
func (c *Config) SetDefaults()
SetDefaults sets defaults for the Namespace and Label in case they're not passed in from the configuration file.
type Mapping ¶
type Mapping struct {
// SourceType is the source of a secret: Vault or GSM. Defaults to Vault.
SourceType string `yaml:"sourceType"`
// Path is the path to a Vault or GSM secret.
// GSM secrets can use one of the following forms;
// - projects/*/secrets/*/versions/*
// - projects/*/locations/*/secrets/*/versions/*
Path string `yaml:"path"`
// [DEPRECATED] VaultPath is the path to a vault secret. Use Path instead.
VaultPath string `yaml:"vaultPath"`
// SecretName is the name of the k8s secret that the vault contents should
// be written to. Note that this must be a DNS-1123-compatible name and
// match the regex [a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*
SecretName string `yaml:"secretName"`
// SecretType is a k8s SecretType type (string)
SecretType corev1.SecretType `yaml:"secretType"`
// VaultEngineType is the type of secrets engine mounted at the path of this
// Vault secret. This specifically overrides the DefaultEngineType
// specified in VaultConfig.
VaultEngineType vault.EngineType `yaml:"vaultEngineType"`
// GSMEncodingType enables the parsing of JSON secrets with more than one key-value pair when set
// to 'json'. For the default behavior, simple values, set to 'string'.
GSMEncodingType string `yaml:"gsmEncodingType"`
// GSMSecretKeyValue allows you to specify the value of the Kubernetes key to
// use for this secret's value in cases where gsmEncodingType is *not* json. If
// this is unset, the key name will default to the value of secretName.
GSMSecretKeyValue string `yaml:"gsmSecretKeyValue"`
// AdditionalSecretLabels allows you to specify the additional labels that will be
// added to the created Kubernetes secret.
AdditionalSecretLabels map[string]string `yaml:"additionalSecretLabels"`
}
Mapping is a single mapping for a vault secret to a k8s secret.
type Reflector ¶
type Reflector struct {
// contains filtered or unexported fields
}
Reflector moves secrets from Vault/GSM to Kubernetes
func NewReflector ¶
func NewReflector( vaultClient vault.Logical, gsmClient gsm.SecretAccessor, k8sClient kubernetes.Interface, k8sNamespace string, labelValue string, ) *Reflector
NewReflector returns a new reflector
type VaultConfig ¶
type VaultConfig struct {
// URL is the url to the vault server.
URL string `yaml:"url"`
// AuthType can be "token" or "gcp-default".
AuthType vault.AuthType `yaml:"authType"`
// DefaultEngineType is the type of secrets engine used because the API
// responses may differ based on the engine used. In particular, K/V v2
// has an extra layer of data wrapping that differs from v1.
// Allowed values are "kv" and "kv-v2".
DefaultEngineType vault.EngineType `yaml:"defaultEngineType"`
// Role is the role used when authenticating with vault. If this is unset
// the role will be discovered by querying the GCP metadata service for
// the default service account's email address and using the "user" portion
// (before the '@').
Role string `yaml:"role"` // used for non-token auth
// Token is a vault token and is only considered when AuthType == "token".
Token string `yaml:"token"`
// TLSConfig allows you to set any TLS options that the vault client
// accepts.
TLSConfig *api.TLSConfig `yaml:"tls"` // for other vault TLS options
}
VaultConfig is the vault configuration.
Click to show internal directories.
Click to hide internal directories.