Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
6a43f63c
Unverified
Commit
6a43f63c
authored
Apr 25, 2019
by
Darren Shepherd
Committed by
GitHub
Apr 25, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #388 from galal-hussein/pass_proxy_variable_to_helm
Add proxy env to helm controller
parents
1f4be584
b87684fc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
1 deletion
+25
-1
controller.go
pkg/helm/controller.go
+25
-1
No files found.
pkg/helm/controller.go
View file @
6a43f63c
...
...
@@ -5,6 +5,7 @@ import (
"crypto/sha256"
"encoding/hex"
"fmt"
"os"
"sort"
batchclient
"github.com/rancher/k3s/types/apis/batch/v1"
...
...
@@ -185,7 +186,7 @@ func job(chart *k3s.HelmChart) (*batch.Job, *core.ConfigMap) {
},
},
}
setProxyEnv
(
job
)
configMap
:=
configMap
(
chart
)
if
configMap
==
nil
{
return
job
,
nil
...
...
@@ -317,3 +318,26 @@ func keys(val map[string]intstr.IntOrString) []string {
sort
.
Strings
(
keys
)
return
keys
}
func
setProxyEnv
(
job
*
batch
.
Job
)
{
proxySysEnv
:=
[]
string
{
"http_proxy"
,
"https_proxy"
,
"HTTP_PROXY"
,
"HTTPS_PROXY"
,
"NO_PROXY"
,
}
for
_
,
proxyEnv
:=
range
proxySysEnv
{
proxyEnvValue
:=
os
.
Getenv
(
proxyEnv
)
if
len
(
proxyEnvValue
)
==
0
{
continue
}
envar
:=
core
.
EnvVar
{
Name
:
proxyEnv
,
Value
:
proxyEnvValue
,
}
job
.
Spec
.
Template
.
Spec
.
Containers
[
0
]
.
Env
=
append
(
job
.
Spec
.
Template
.
Spec
.
Containers
[
0
]
.
Env
,
envar
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment