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_KUBEASUSER | set the Username to impersonate for the operation. |
| $HELM_KUBECONTEXT | set the name of the kubeconfig context. | | $HELM_KUBECONTEXT | set the name of the kubeconfig context. |
| $HELM_KUBETOKEN | set the Bearer KubeToken used for authentication. | | $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: Helm stores cache, configuration, and data based on the following configuration order:

@ -15,6 +15,6 @@ HELM_PLUGINS
HELM_REGISTRY_CONFIG HELM_REGISTRY_CONFIG
HELM_REPOSITORY_CACHE HELM_REPOSITORY_CACHE
HELM_REPOSITORY_CONFIG HELM_REPOSITORY_CONFIG
HELM_SECONDARY_CERT_DIR HELM_CLIENT_TLS_CERT_DIR
:4 :4
Completion ended with directive: ShellCompDirectiveNoFileComp 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) fmt.Printf("%v OS not supported for this oci pull. Contact your administrator for more information !!!", runtime.GOOS)
os.Exit(1) os.Exit(1)
} else { } 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 { if err != nil {
fmt.Printf("Error : %s", err) fmt.Printf("Error : %s", err)
os.Exit(1) os.Exit(1)
} }
clientCertDir := strings.TrimSuffix(string(cmd), "\n") clientCertDir := strings.TrimSuffix(string(cmd), "\n")
if clientCertDir == "" { 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) os.Exit(1)
} }
@ -87,7 +87,7 @@ func ReadCertFromSecDir(host string) (opts Options, err error) {
if _, err := os.Stat(clientCertDir); err != nil { if _, err := os.Stat(clientCertDir); err != nil {
if os.IsNotExist(err) { if os.IsNotExist(err) {
os.MkdirAll(clientCertDir, os.ModePerm) 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 { } else {

@ -82,7 +82,7 @@ func New() *EnvSettings {
KubeAsGroups: envCSV("HELM_KUBEASGROUPS"), KubeAsGroups: envCSV("HELM_KUBEASGROUPS"),
KubeAPIServer: os.Getenv("HELM_KUBEAPISERVER"), KubeAPIServer: os.Getenv("HELM_KUBEAPISERVER"),
KubeCaFile: os.Getenv("HELM_KUBECAFILE"), 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")), PluginsDirectory: envOr("HELM_PLUGINS", helmpath.DataPath("plugins")),
RegistryConfig: envOr("HELM_REGISTRY_CONFIG", helmpath.ConfigPath("registry/config.json")), RegistryConfig: envOr("HELM_REGISTRY_CONFIG", helmpath.ConfigPath("registry/config.json")),
RepositoryConfig: envOr("HELM_REPOSITORY_CONFIG", helmpath.ConfigPath("repositories.yaml")), RepositoryConfig: envOr("HELM_REPOSITORY_CONFIG", helmpath.ConfigPath("repositories.yaml")),
@ -150,18 +150,18 @@ func envCSV(name string) (ls []string) {
func (s *EnvSettings) EnvVars() map[string]string { func (s *EnvSettings) EnvVars() map[string]string {
envvars := map[string]string{ envvars := map[string]string{
"HELM_BIN": os.Args[0], "HELM_BIN": os.Args[0],
"HELM_CACHE_HOME": helmpath.CachePath(""), "HELM_CACHE_HOME": helmpath.CachePath(""),
"HELM_CONFIG_HOME": helmpath.ConfigPath(""), "HELM_CONFIG_HOME": helmpath.ConfigPath(""),
"HELM_DATA_HOME": helmpath.DataPath(""), "HELM_DATA_HOME": helmpath.DataPath(""),
"HELM_DEBUG": fmt.Sprint(s.Debug), "HELM_DEBUG": fmt.Sprint(s.Debug),
"HELM_PLUGINS": s.PluginsDirectory, "HELM_PLUGINS": s.PluginsDirectory,
"HELM_REGISTRY_CONFIG": s.RegistryConfig, "HELM_REGISTRY_CONFIG": s.RegistryConfig,
"HELM_REPOSITORY_CACHE": s.RepositoryCache, "HELM_REPOSITORY_CACHE": s.RepositoryCache,
"HELM_REPOSITORY_CONFIG": s.RepositoryConfig, "HELM_REPOSITORY_CONFIG": s.RepositoryConfig,
"HELM_NAMESPACE": s.Namespace(), "HELM_NAMESPACE": s.Namespace(),
"HELM_MAX_HISTORY": strconv.Itoa(s.MaxHistory), "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. // broken, these are populated from helm flags and not kubeconfig.
"HELM_KUBECONTEXT": s.KubeContext, "HELM_KUBECONTEXT": s.KubeContext,

Loading…
Cancel
Save