Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
1105 Внедрение механизмов обеспечения безопасности цепочки поставки программных проектов
Legacy
scanned-projects
helm
Commits
b1e0c8fc
Commit
b1e0c8fc
authored
8 years ago
by
Adam Reese
Browse files
Options
Download
Plain Diff
Merge pull request #759 from adamreese/feat/tunnel2
feat(tunnel): wire in the tunnel setup and teardown
parents
d16e7881
f0a15743
main
Release
add-codeql
dependabot/go_modules/github.com/docker/distribution-2.8.2incompatible
dependabot/go_modules/github.com/lib/pq-1.10.9
dependabot/go_modules/github.com/rubenv/sql-migrate-1.4.0
dependabot/go_modules/golang.org/x/crypto-0.9.0
dependabot/go_modules/golang.org/x/term-0.8.0
dependabot/go_modules/k8s.io/klog/v2-2.100.1
dev-v2
feat-v3/event-emitter-lua
kube-update-test
release-2.0
release-2.1
release-2.10
release-2.11
release-2.12
release-2.13
release-2.14
release-2.15
release-2.16
release-2.17
release-2.2
release-2.3
release-2.4
release-2.5
release-2.6
release-2.7
release-2.8
release-2.9
release-3.0
release-3.1
release-3.10
release-3.11
release-3.12
release-3.2
release-3.3
release-3.4
release-3.5
release-3.6
release-3.6.1
release-3.6.2
release-3.7
release-3.8
release-3.9
release-v3.0.0-beta.4
v3.12.0
v3.12.0-rc.1
v3.12.0-dev.1
v3.11.3
v3.11.2
v3.11.1
v3.11.0
v3.11.0-rc.2
v3.11.0-rc.1
v3.10.3
v3.10.2
v3.10.1
v3.10.0
v3.10.0-rc.1
v3.9.4
v3.9.3
v3.9.2
v3.9.1
v3.9.0
v3.9.0-rc.1
v3.8.2
v3.8.1
v3.8.0
v3.8.0-rc.2
v3.8.0-rc.1
v3.7.2
v3.7.1
v3.7.0
v3.7.0-rc.3
v3.7.0-rc.2
v3.7.0-rc.1
v3.6.3
v3.6.2
v3.6.1
v3.6.0
v3.6.0-rc.1
v3.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
v2.5.0
v2.4.2
v2.4.1
v2.4.0
v2.3.1
v2.3.0
v2.2.3
v2.2.2
v2.2.1
v2.2.0
v2.1.3
v2.1.2
v2.1.1
v2.1.0
v2.0.2
v2.0.1
v2.0.0
v2.0.0-rc.2
v2.0.0-rc.1
v2.0.0-beta.2
v2.0.0-beta.1
v2.0.0-alpha.5
v2.0.0-alpha.4
v2.0.0-alpha.3
v2.0.0-alpha.2
v2.0.0-alpha.1
No related merge requests found
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
cmd/helm/delete.go
+7
-6
cmd/helm/delete.go
cmd/helm/get.go
+5
-4
cmd/helm/get.go
cmd/helm/helm.go
+31
-14
cmd/helm/helm.go
cmd/helm/install.go
+5
-4
cmd/helm/install.go
cmd/helm/list.go
+6
-5
cmd/helm/list.go
cmd/helm/status.go
+5
-4
cmd/helm/status.go
cmd/helm/tunnel.go
+7
-1
cmd/helm/tunnel.go
with
66 additions
and
38 deletions
+66
-38
cmd/helm/delete.go
+
7
−
6
View file @
b1e0c8fc
...
...
@@ -18,12 +18,13 @@ deleting them.
var
deleteDryRun
bool
var
deleteCommand
=
&
cobra
.
Command
{
Use
:
"delete [flags] RELEASE_NAME"
,
Aliases
:
[]
string
{
"del"
},
SuggestFor
:
[]
string
{
"remove"
,
"rm"
},
Short
:
"Given a release name, delete the release from Kubernetes"
,
Long
:
deleteDesc
,
RunE
:
delRelease
,
Use
:
"delete [flags] RELEASE_NAME"
,
Aliases
:
[]
string
{
"del"
},
SuggestFor
:
[]
string
{
"remove"
,
"rm"
},
Short
:
"Given a release name, delete the release from Kubernetes"
,
Long
:
deleteDesc
,
RunE
:
delRelease
,
PersistentPreRunE
:
setupConnection
,
}
func
init
()
{
...
...
This diff is collapsed.
Click to expand it.
cmd/helm/get.go
+
5
−
4
View file @
b1e0c8fc
...
...
@@ -46,10 +46,11 @@ var getOut = ""
var
errReleaseRequired
=
errors
.
New
(
"release name is required"
)
var
getCommand
=
&
cobra
.
Command
{
Use
:
"get [flags] RELEASE_NAME"
,
Short
:
"Download a named release"
,
Long
:
getHelp
,
RunE
:
getCmd
,
Use
:
"get [flags] RELEASE_NAME"
,
Short
:
"Download a named release"
,
Long
:
getHelp
,
RunE
:
getCmd
,
PersistentPreRunE
:
setupConnection
,
}
var
getValuesCommand
=
&
cobra
.
Command
{
...
...
This diff is collapsed.
Click to expand it.
cmd/helm/helm.go
+
31
−
14
View file @
b1e0c8fc
...
...
@@ -35,22 +35,22 @@ It will also set up any necessary local configuration.
Common actions from this point include:
- helm search: search for charts
- helm fetch: download a chart to your local directory to view
- helm install: upload the chart to Kubernetes
- helm list: list releases of charts
- helm search:
search for charts
- helm fetch:
download a chart to your local directory to view
- helm install:
upload the chart to Kubernetes
- helm list:
list releases of charts
Environment:
$HELM_HOME Set an alternative location for Helm files. By default, these are stored in ~/.helm
$HELM_HOST Set an alternative Tiller host. The format is host:port (default ":44134").
$HELM_HOME
Set an alternative location for Helm files. By default, these are stored in ~/.helm
$HELM_HOST
Set an alternative Tiller host. The format is host:port (default ":44134").
`
// RootCommand is the top-level command for Helm.
var
RootCommand
=
&
cobra
.
Command
{
Use
:
"helm"
,
Short
:
"The Helm package manager for Kubernetes."
,
Long
:
globalUsage
,
PersistentP
re
Run
:
bootstrap
,
Use
:
"helm"
,
Short
:
"The Helm package manager for Kubernetes."
,
Long
:
globalUsage
,
PersistentP
ost
Run
:
teardown
,
}
func
init
()
{
...
...
@@ -59,9 +59,6 @@ func init() {
home
=
"$HOME/.helm"
}
thost
:=
os
.
Getenv
(
hostEnvVar
)
if
thost
==
""
{
thost
=
defaultHost
}
p
:=
RootCommand
.
PersistentFlags
()
p
.
StringVar
(
&
helmHome
,
"home"
,
home
,
"location of your Helm config. Overrides $HELM_HOME."
)
p
.
StringVar
(
&
tillerHost
,
"host"
,
thost
,
"address of tiller. Overrides $HELM_HOST."
)
...
...
@@ -74,12 +71,32 @@ func main() {
}
}
func
bootstrap
(
c
*
cobra
.
Command
,
args
[]
string
)
{
func
setupConnection
(
c
*
cobra
.
Command
,
args
[]
string
)
error
{
if
tillerHost
==
""
{
// Should failure fall back to default host?
tunnel
,
err
:=
newTillerPortForwarder
()
if
err
!=
nil
{
return
err
}
tillerHost
=
fmt
.
Sprintf
(
":%d"
,
tunnel
.
Local
)
if
flagVerbose
{
fmt
.
Printf
(
"Created tunnel using local port: '%d'
\n
"
,
tunnel
.
Local
)
}
}
// Set up the gRPC config.
helm
.
Config
.
ServAddr
=
tillerHost
if
flagVerbose
{
fmt
.
Printf
(
"Server: %q
\n
"
,
helm
.
Config
.
ServAddr
)
}
return
nil
}
func
teardown
(
c
*
cobra
.
Command
,
args
[]
string
)
{
if
tunnel
!=
nil
{
tunnel
.
Close
()
}
}
func
checkArgsLength
(
expectedNum
,
actualNum
int
,
requiredArgs
...
string
)
error
{
...
...
This diff is collapsed.
Click to expand it.
cmd/helm/install.go
+
5
−
4
View file @
b1e0c8fc
...
...
@@ -35,10 +35,11 @@ var (
)
var
installCmd
=
&
cobra
.
Command
{
Use
:
"install [CHART]"
,
Short
:
"install a chart archive."
,
Long
:
installDesc
,
RunE
:
runInstall
,
Use
:
"install [CHART]"
,
Short
:
"install a chart archive."
,
Long
:
installDesc
,
RunE
:
runInstall
,
PersistentPreRunE
:
setupConnection
,
}
func
init
()
{
...
...
This diff is collapsed.
Click to expand it.
cmd/helm/list.go
+
6
−
5
View file @
b1e0c8fc
...
...
@@ -37,11 +37,12 @@ flag with the '--offset' flag allows you to page through results.
`
var
listCommand
=
&
cobra
.
Command
{
Use
:
"list [flags] [FILTER]"
,
Short
:
"List releases"
,
Long
:
listHelp
,
RunE
:
listCmd
,
Aliases
:
[]
string
{
"ls"
},
Use
:
"list [flags] [FILTER]"
,
Short
:
"List releases"
,
Long
:
listHelp
,
RunE
:
listCmd
,
Aliases
:
[]
string
{
"ls"
},
PersistentPreRunE
:
setupConnection
,
}
var
(
...
...
This diff is collapsed.
Click to expand it.
cmd/helm/status.go
+
5
−
4
View file @
b1e0c8fc
...
...
@@ -13,10 +13,11 @@ This command shows the status of a named release.
`
var
statusCommand
=
&
cobra
.
Command
{
Use
:
"status [flags] RELEASE_NAME"
,
Short
:
"Displays the status of the named release"
,
Long
:
statusHelp
,
RunE
:
status
,
Use
:
"status [flags] RELEASE_NAME"
,
Short
:
"Displays the status of the named release"
,
Long
:
statusHelp
,
RunE
:
status
,
PersistentPreRunE
:
setupConnection
,
}
func
init
()
{
...
...
This diff is collapsed.
Click to expand it.
cmd/helm/tunnel.go
+
7
−
1
View file @
b1e0c8fc
...
...
@@ -9,12 +9,17 @@ import (
"github.com/kubernetes/helm/pkg/kube"
)
// TODO refactor out this global var
var
tunnel
*
kube
.
Tunnel
func
newTillerPortForwarder
()
(
*
kube
.
Tunnel
,
error
)
{
podName
,
err
:=
getTillerPodName
(
"helm"
)
if
err
!=
nil
{
return
nil
,
err
}
return
kube
.
New
(
nil
)
.
ForwardPort
(
"helm"
,
podName
,
44134
)
// FIXME use a constain that is accessable on init
const
tillerPort
=
44134
return
kube
.
New
(
nil
)
.
ForwardPort
(
"helm"
,
podName
,
tillerPort
)
}
func
getTillerPodName
(
namespace
string
)
(
string
,
error
)
{
...
...
@@ -23,6 +28,7 @@ func getTillerPodName(namespace string) (string, error) {
return
""
,
err
}
// TODO use a const for labels
selector
:=
labels
.
Set
{
"app"
:
"helm"
,
"name"
:
"tiller"
}
.
AsSelector
()
options
:=
api
.
ListOptions
{
LabelSelector
:
selector
}
pods
,
err
:=
client
.
Pods
(
namespace
)
.
List
(
options
)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets