Add --cacert flag to velero cli commands (#2364)

* Add --cacert flag to velero cli commands

Adds a --cacert flag to the log and describe commands
that takes a path to a PEM-encoded certificate bundle
as an alternative to --insecure-skip-tls-verify for
dealing with self-signed certificates.

Signed-off-by: Sam Lucidi <slucidi@redhat.com>
This commit is contained in:
Samuel Lucidi
2020-04-03 11:02:41 -04:00
committed by GitHub
parent 016868ecd3
commit c8223608ba
11 changed files with 103 additions and 23 deletions

View File

@@ -28,6 +28,7 @@ import (
const (
ConfigKeyNamespace = "namespace"
ConfigKeyFeatures = "features"
ConfigKeyCACert = "cacert"
)
// VeleroConfig is a map of strings to interface{} for deserializing Velero client config options.
@@ -110,6 +111,19 @@ func (c VeleroConfig) Features() []string {
return strings.Split(features, ",")
}
func (c VeleroConfig) CACertFile() string {
val, ok := c[ConfigKeyCACert]
if !ok {
return ""
}
caCertFile, ok := val.(string)
if !ok {
return ""
}
return caCertFile
}
func configFileName() string {
return filepath.Join(os.Getenv("HOME"), ".config", "velero", "config.json")
}