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
2c351c06
Commit
2c351c06
authored
Mar 30, 2016
by
Jack Greenfield
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #498 from jackgr/deployment
More tweaks to enable end-to-end deployment
parents
91b1b0b3
b20a7c53
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
52 additions
and
16 deletions
+52
-16
replicatedservice-3.tgz
examples/charts/replicatedservice-3.tgz
+0
-0
replicatedservice-v3.tgz
examples/charts/replicatedservice-v3.tgz
+0
-0
Chart.yaml
examples/charts/replicatedservice/Chart.yaml
+2
-2
chart.go
pkg/chart/chart.go
+3
-4
chart_test.go
pkg/chart/chart_test.go
+41
-8
service.go
pkg/expansion/service.go
+6
-2
No files found.
examples/charts/replicatedservice-3.tgz
0 → 100644
View file @
2c351c06
File added
examples/charts/replicatedservice-v3.tgz
deleted
100644 → 0
View file @
91b1b0b3
File deleted
examples/charts/replicatedservice/Chart.yaml
View file @
2c351c06
name
:
replicatedservice
description
:
Port of the replicatedservice template from kubernetes/charts
version
:
3
version
:
"
3"
home
:
"
"
expander
:
name
:
Expandybird
entrypoint
:
templates/replicatedservice.py
schema
:
templates/replicatedservice.py.schema
pkg/chart/chart.go
View file @
2c351c06
...
...
@@ -20,7 +20,6 @@ import (
"archive/tar"
"bytes"
"compress/gzip"
"encoding/base64"
"errors"
"fmt"
"io"
...
...
@@ -412,16 +411,16 @@ func (c *Chart) loadMember(filename string) (*Member, error) {
return
nil
,
err
}
b
,
err
:=
ioutil
.
ReadFile
(
filename
)
content
,
err
:=
ioutil
.
ReadFile
(
filename
)
if
err
!=
nil
{
return
nil
,
err
}
path
:=
strings
.
TrimPrefix
(
filename
,
dir
)
content
:=
base64
.
StdEncoding
.
EncodeToString
(
b
)
path
=
strings
.
TrimLeft
(
path
,
"/"
)
result
:=
&
Member
{
Path
:
path
,
Content
:
[]
byte
(
content
)
,
Content
:
content
,
}
return
result
,
nil
...
...
pkg/chart/chart_test.go
View file @
2c351c06
...
...
@@ -17,13 +17,14 @@ limitations under the License.
package
chart
import
(
"encoding/base64"
"fmt"
"io/ioutil"
"path/filepath"
"reflect"
"testing"
"github.com/kubernetes/helm/pkg/log"
"github.com/kubernetes/helm/pkg/util"
)
const
(
...
...
@@ -202,7 +203,7 @@ func findMember(root, path string, members []*Member) error {
for
_
,
member
:=
range
members
{
if
member
.
Path
==
path
{
filename
:=
filepath
.
Join
(
root
,
path
)
if
err
:=
compareContent
(
filename
,
string
(
member
.
Content
)
);
err
!=
nil
{
if
err
:=
compareContent
(
filename
,
member
.
Content
);
err
!=
nil
{
return
err
}
...
...
@@ -233,20 +234,52 @@ func TestLoadMember(t *testing.T) {
}
filename
:=
filepath
.
Join
(
c
.
loader
.
dir
(),
testmember
)
if
err
:=
compareContent
(
filename
,
string
(
member
.
Content
)
);
err
!=
nil
{
if
err
:=
compareContent
(
filename
,
member
.
Content
);
err
!=
nil
{
t
.
Fatal
(
err
)
}
}
func
compareContent
(
filename
,
content
string
)
error
{
b
,
err
:=
ioutil
.
ReadFile
(
filename
)
func
TestLoadContent
(
t
*
testing
.
T
)
{
c
,
err
:=
LoadDir
(
testdir
)
if
err
!=
nil
{
t
.
Errorf
(
"Failed to load chart: %s"
,
err
)
}
content
,
err
:=
c
.
LoadContent
()
if
err
!=
nil
{
t
.
Errorf
(
"Failed to load chart content: %s"
,
err
)
}
want
:=
c
.
Chartfile
()
have
:=
content
.
Chartfile
if
!
reflect
.
DeepEqual
(
want
,
have
)
{
t
.
Errorf
(
"Unexpected chart file
\n
want:
\n
%s
\n
have:
\n
%s
\n
"
,
util
.
ToYAMLOrError
(
want
),
util
.
ToYAMLOrError
(
have
))
}
for
_
,
member
:=
range
content
.
Members
{
have
:=
member
.
Content
wantMember
,
err
:=
c
.
LoadMember
(
member
.
Path
)
if
err
!=
nil
{
t
.
Errorf
(
"Failed to load chart member: %s"
,
err
)
}
t
.
Logf
(
"%s:
\n
%s
\n\n
"
,
member
.
Path
,
member
.
Content
)
want
:=
wantMember
.
Content
if
!
reflect
.
DeepEqual
(
want
,
have
)
{
t
.
Errorf
(
"Unexpected chart member %s
\n
want:
\n
%v
\n
have:
\n
%v
\n
"
,
member
.
Path
,
want
,
have
)
}
}
}
func
compareContent
(
filename
string
,
content
[]
byte
)
error
{
compare
,
err
:=
ioutil
.
ReadFile
(
filename
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"Cannot read test file %s: %s"
,
filename
,
err
)
}
compare
:=
base64
.
StdEncoding
.
EncodeToString
(
b
)
if
content
!=
compare
{
return
fmt
.
Errorf
(
"Expected member content
\n
%v
\n
got
\n
%v"
,
[]
byte
(
compare
),
[]
byte
(
content
))
if
!
reflect
.
DeepEqual
(
compare
,
content
)
{
return
fmt
.
Errorf
(
"Expected member content
\n
%v
\n
got
\n
%v"
,
compare
,
content
)
}
return
nil
...
...
pkg/expansion/service.go
View file @
2c351c06
...
...
@@ -49,14 +49,18 @@ func NewService(address string, port int, backend Expander) *Service {
badRequest
(
resp
,
err
.
Error
())
return
}
reqMsg
:=
fmt
.
Sprintf
(
"
\n
handling request:
\n
%s
\n
"
,
util
.
ToYAMLOrError
(
request
))
util
.
LogHandlerText
(
"expansion service"
,
reqMsg
)
response
,
err
:=
backend
.
ExpandChart
(
request
)
if
err
!=
nil
{
badRequest
(
resp
,
fmt
.
Sprintf
(
"error expanding chart: %s"
,
err
))
return
}
util
.
LogHandlerExit
(
"expansion service"
,
http
.
StatusOK
,
"OK"
,
resp
.
ResponseWriter
)
message
:=
fmt
.
Sprintf
(
"
\n
Resources:
\n
%s
\n
"
,
response
.
Resources
)
util
.
LogHandlerText
(
"expansion service"
,
message
)
respMsg
:=
fmt
.
Sprintf
(
"
\n
returning response:
\n
%s
\n
"
,
util
.
ToYAMLOrError
(
response
.
Resources
)
)
util
.
LogHandlerText
(
"expansion service"
,
respMsg
)
resp
.
WriteEntity
(
response
)
}
webService
.
Route
(
...
...
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