Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
08aed00f
Commit
08aed00f
authored
Feb 10, 2016
by
Adam Reese
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #18 from adamreese/fix/dm-install
fix(dm-install): do not require a namespace on kubectl create
parents
4a5cf501
838d5c04
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
12 additions
and
27 deletions
+12
-27
client.go
dm/client.go
+1
-1
install.go
dm/install.go
+1
-1
uninstall.go
dm/uninstall.go
+1
-1
create.go
kubectl/create.go
+2
-10
create_test.go
kubectl/create_test.go
+2
-2
delete.go
kubectl/delete.go
+2
-9
kubectl.go
kubectl/kubectl.go
+3
-3
No files found.
dm/client.go
View file @
08aed00f
...
@@ -103,7 +103,7 @@ func (c *Client) CallService(path, method, action string, dest interface{}, read
...
@@ -103,7 +103,7 @@ func (c *Client) CallService(path, method, action string, dest interface{}, read
return
nil
return
nil
}
}
// callHTTP is a low-level prim
a
tive for executing HTTP operations.
// callHTTP is a low-level prim
i
tive for executing HTTP operations.
func
(
c
*
Client
)
callHTTP
(
path
,
method
,
action
string
,
reader
io
.
ReadCloser
)
(
string
,
error
)
{
func
(
c
*
Client
)
callHTTP
(
path
,
method
,
action
string
,
reader
io
.
ReadCloser
)
(
string
,
error
)
{
request
,
err
:=
http
.
NewRequest
(
method
,
path
,
reader
)
request
,
err
:=
http
.
NewRequest
(
method
,
path
,
reader
)
...
...
dm/install.go
View file @
08aed00f
...
@@ -10,7 +10,7 @@ import (
...
@@ -10,7 +10,7 @@ import (
// Returns the string output received from the operation, and an error if the
// Returns the string output received from the operation, and an error if the
// command failed.
// command failed.
func
Install
(
runner
kubectl
.
Runner
)
(
string
,
error
)
{
func
Install
(
runner
kubectl
.
Runner
)
(
string
,
error
)
{
o
,
err
:=
runner
.
Create
([]
byte
(
InstallYAML
)
,
"dm"
)
o
,
err
:=
runner
.
Create
([]
byte
(
InstallYAML
))
return
string
(
o
),
err
return
string
(
o
),
err
}
}
...
...
dm/uninstall.go
View file @
08aed00f
...
@@ -9,6 +9,6 @@ import (
...
@@ -9,6 +9,6 @@ import (
// Returns the string output received from the operation, and an error if the
// Returns the string output received from the operation, and an error if the
// command failed.
// command failed.
func
Uninstall
(
runner
kubectl
.
Runner
)
(
string
,
error
)
{
func
Uninstall
(
runner
kubectl
.
Runner
)
(
string
,
error
)
{
o
,
err
:=
runner
.
Delete
(
"dm"
,
"Namespace"
,
"dm"
)
o
,
err
:=
runner
.
Delete
(
"dm"
,
"Namespace"
)
return
string
(
o
),
err
return
string
(
o
),
err
}
}
kubectl/create.go
View file @
08aed00f
package
kubectl
package
kubectl
// Create uploads a chart to Kubernetes
// Create uploads a chart to Kubernetes
func
(
r
RealRunner
)
Create
(
stdin
[]
byte
,
ns
string
)
([]
byte
,
error
)
{
func
(
r
RealRunner
)
Create
(
stdin
[]
byte
)
([]
byte
,
error
)
{
args
:=
[]
string
{
"create"
,
"-f"
,
"-"
}
args
:=
[]
string
{
"create"
,
"-f"
,
"-"
}
if
ns
!=
""
{
args
=
append
([]
string
{
"--namespace="
+
ns
},
args
...
)
}
cmd
:=
command
(
args
...
)
cmd
:=
command
(
args
...
)
assignStdin
(
cmd
,
stdin
)
assignStdin
(
cmd
,
stdin
)
...
@@ -15,13 +11,9 @@ func (r RealRunner) Create(stdin []byte, ns string) ([]byte, error) {
...
@@ -15,13 +11,9 @@ func (r RealRunner) Create(stdin []byte, ns string) ([]byte, error) {
}
}
// Create returns the commands to kubectl
// Create returns the commands to kubectl
func
(
r
PrintRunner
)
Create
(
stdin
[]
byte
,
ns
string
)
([]
byte
,
error
)
{
func
(
r
PrintRunner
)
Create
(
stdin
[]
byte
)
([]
byte
,
error
)
{
args
:=
[]
string
{
"create"
,
"-f"
,
"-"
}
args
:=
[]
string
{
"create"
,
"-f"
,
"-"
}
if
ns
!=
""
{
args
=
append
([]
string
{
"--namespace="
+
ns
},
args
...
)
}
cmd
:=
command
(
args
...
)
cmd
:=
command
(
args
...
)
assignStdin
(
cmd
,
stdin
)
assignStdin
(
cmd
,
stdin
)
...
...
kubectl/create_test.go
View file @
08aed00f
...
@@ -7,9 +7,9 @@ import (
...
@@ -7,9 +7,9 @@ import (
func
TestPrintCreate
(
t
*
testing
.
T
)
{
func
TestPrintCreate
(
t
*
testing
.
T
)
{
var
client
Runner
=
PrintRunner
{}
var
client
Runner
=
PrintRunner
{}
expected
:=
`[CMD] kubectl
--namespace=default-namespace
create -f - < some stdin data`
expected
:=
`[CMD] kubectl create -f - < some stdin data`
out
,
err
:=
client
.
Create
([]
byte
(
"some stdin data"
)
,
"default-namespace"
)
out
,
err
:=
client
.
Create
([]
byte
(
"some stdin data"
))
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
(
err
)
t
.
Error
(
err
)
}
}
...
...
kubectl/delete.go
View file @
08aed00f
package
kubectl
package
kubectl
// Delete removes a chart from Kubernetes.
// Delete removes a chart from Kubernetes.
func
(
r
RealRunner
)
Delete
(
name
,
ktype
,
ns
string
)
([]
byte
,
error
)
{
func
(
r
RealRunner
)
Delete
(
name
,
ktype
string
)
([]
byte
,
error
)
{
args
:=
[]
string
{
"delete"
,
ktype
,
name
}
args
:=
[]
string
{
"delete"
,
ktype
,
name
}
if
ns
!=
""
{
args
=
append
([]
string
{
"--namespace="
+
ns
},
args
...
)
}
return
command
(
args
...
)
.
CombinedOutput
()
return
command
(
args
...
)
.
CombinedOutput
()
}
}
// Delete returns the commands to kubectl
// Delete returns the commands to kubectl
func
(
r
PrintRunner
)
Delete
(
name
,
ktype
,
ns
string
)
([]
byte
,
error
)
{
func
(
r
PrintRunner
)
Delete
(
name
,
ktype
string
)
([]
byte
,
error
)
{
args
:=
[]
string
{
"delete"
,
ktype
,
name
}
args
:=
[]
string
{
"delete"
,
ktype
,
name
}
if
ns
!=
""
{
args
=
append
([]
string
{
"--namespace="
+
ns
},
args
...
)
}
cmd
:=
command
(
args
...
)
cmd
:=
command
(
args
...
)
return
[]
byte
(
cmd
.
String
()),
nil
return
[]
byte
(
cmd
.
String
()),
nil
}
}
kubectl/kubectl.go
View file @
08aed00f
...
@@ -8,11 +8,11 @@ type Runner interface {
...
@@ -8,11 +8,11 @@ type Runner interface {
// ClusterInfo returns Kubernetes cluster info
// ClusterInfo returns Kubernetes cluster info
ClusterInfo
()
([]
byte
,
error
)
ClusterInfo
()
([]
byte
,
error
)
// Create uploads a chart to Kubernetes
// Create uploads a chart to Kubernetes
Create
(
[]
byte
,
string
)
([]
byte
,
error
)
Create
(
stdin
[]
byte
)
([]
byte
,
error
)
// Delete removes a chart from Kubernetes.
// Delete removes a chart from Kubernetes.
Delete
(
string
,
string
,
string
)
([]
byte
,
error
)
Delete
(
name
string
,
ktype
string
)
([]
byte
,
error
)
// Get returns Kubernetes resources
// Get returns Kubernetes resources
Get
(
[]
byte
,
string
)
([]
byte
,
error
)
Get
(
stdin
[]
byte
,
ns
string
)
([]
byte
,
error
)
// GetByKind gets an entry by kind, name, and namespace.
// GetByKind gets an entry by kind, name, and namespace.
//
//
...
...
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