mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-07 13:55:20 +00:00
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:
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user