Environment key added for client cert directory.

Signed-off-by: Sunil Kumar <suryakn27@outlook.com>
pull/10807/head^2
suryatech27-cloud 4 years ago
parent 7afcef8678
commit fd085b33ef

@ -67,7 +67,7 @@ Environment variables:
| $HELM_KUBEASUSER | set the Username to impersonate for the operation. |
| $HELM_KUBECONTEXT | set the name of the kubeconfig context. |
| $HELM_KUBETOKEN | set the Bearer KubeToken used for authentication. |
| $HELM_SECONDARY_CERT_DIR | set the secondary certificate directory for 2-way ssl support for oci pull. |
| $HELM_CLIENT_TLS_CERT_DIR | set the certificate directory for 2-way tls support for oci pull. |
Helm stores cache, configuration, and data based on the following configuration order:

@ -15,6 +15,6 @@ HELM_PLUGINS
HELM_REGISTRY_CONFIG
HELM_REPOSITORY_CACHE
HELM_REPOSITORY_CONFIG
HELM_SECONDARY_CERT_DIR
HELM_CLIENT_TLS_CERT_DIR
:4
Completion ended with directive: ShellCompDirectiveNoFileComp

@ -68,14 +68,14 @@ func ReadCertFromSecDir(host string) (opts Options, err error) {
fmt.Printf("%v OS not supported for this oci pull. Contact your administrator for more information !!!", runtime.GOOS)
os.Exit(1)
} else {
cmd, err := exec.Command("helm", "env", "HELM_SECONDARY_CERT_DIR").Output()
cmd, err := exec.Command("helm", "env", "HELM_CLIENT_TLS_CERT_DIR").Output()
if err != nil {
fmt.Printf("Error : %s", err)
os.Exit(1)
}
clientCertDir := strings.TrimSuffix(string(cmd), "\n")
if clientCertDir == "" {
fmt.Printf("Please Configure secondary certificate directory for ssl connection set/export HELM_SECONDARY_CERT_DIR='/etc/docker/certs.d/'\n")
fmt.Printf("Please configure client certificate directory for tls connection set/export HELM_CLIENT_TLS_CERT_DIR='/etc/docker/certs.d/'\n")
os.Exit(1)
}
@ -87,7 +87,7 @@ func ReadCertFromSecDir(host string) (opts Options, err error) {
if _, err := os.Stat(clientCertDir); err != nil {
if os.IsNotExist(err) {
os.MkdirAll(clientCertDir, os.ModePerm)
return opts, errors.Wrapf(err, "Client Certificate Directory Not Exist !! \n %v Directory created.", clientCertDir)
return opts, errors.Wrapf(err, "%v\n%v Directory created.", clientCertDir)
}
} else {

@ -82,7 +82,7 @@ func New() *EnvSettings {
KubeAsGroups: envCSV("HELM_KUBEASGROUPS"),
KubeAPIServer: os.Getenv("HELM_KUBEAPISERVER"),
KubeCaFile: os.Getenv("HELM_KUBECAFILE"),
ClientSecCertDirectory: envOr("HELM_SECONDARY_CERT_DIR", ""),
ClientSecCertDirectory: envOr("HELM_CLIENT_TLS_CERT_DIR", ""),
PluginsDirectory: envOr("HELM_PLUGINS", helmpath.DataPath("plugins")),
RegistryConfig: envOr("HELM_REGISTRY_CONFIG", helmpath.ConfigPath("registry/config.json")),
RepositoryConfig: envOr("HELM_REPOSITORY_CONFIG", helmpath.ConfigPath("repositories.yaml")),
@ -161,7 +161,7 @@ func (s *EnvSettings) EnvVars() map[string]string {
"HELM_REPOSITORY_CONFIG": s.RepositoryConfig,
"HELM_NAMESPACE": s.Namespace(),
"HELM_MAX_HISTORY": strconv.Itoa(s.MaxHistory),
"HELM_SECONDARY_CERT_DIR": s.ClientSecCertDirectory,
"HELM_CLIENT_TLS_CERT_DIR": s.ClientSecCertDirectory,
// broken, these are populated from helm flags and not kubeconfig.
"HELM_KUBECONTEXT": s.KubeContext,

Loading…
Cancel
Save