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
9d1a5d8c
Commit
9d1a5d8c
authored
Nov 12, 2015
by
vaikas-google
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/kubernetes/deployment-manager
parents
7650b916
c7d35e3a
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
58 additions
and
38 deletions
+58
-38
design.md
docs/design/design.md
+1
-1
Makefile
expandybird/Makefile
+8
-3
service.go
expandybird/service/service.go
+2
-2
Makefile
manager/Makefile
+9
-5
deployer.go
manager/manager/deployer.go
+6
-6
expander.go
manager/manager/expander.go
+16
-16
Makefile
resourcifier/Makefile
+7
-2
redis.yaml
types/redis/v1/redis.yaml
+7
-0
replicatedservice.py
types/replicatedservice/v1/replicatedservice.py
+2
-3
No files found.
docs/design/design.md
View file @
9d1a5d8c
...
...
@@ -341,7 +341,7 @@ processing deployments. It uses the following process:
1.
Create a new deployment with a manifest containing _inputConfig_ from the
user request
1.
Call out to he
**expandybird**
service to expand the _inputConfig_
1.
Call out to
t
he
**expandybird**
service to expand the _inputConfig_
1.
Store the resulting _expandedConfig_ and _layout_
1.
Call out to the
**resourcifier**
service to perform processing on resources
from the _expandedConfig_
...
...
expandybird/Makefile
View file @
9d1a5d8c
# Makefile for the Docker image
gcr.io
/$(PROJECT)/expandybird
# Makefile for the Docker image
$(DOCKER_REGISTRY)
/$(PROJECT)/expandybird
# MAINTAINER: Jack Greenfield <jackgr@google.com>
# If you update this image please check the tag value before pushing.
.PHONY
:
all build test push container clean
PREFIX
:=
gcr.io/
$(PROJECT)
DOCKER_REGISTRY
:=
gcr.io
PREFIX
:=
$(DOCKER_REGISTRY)
/
$(PROJECT)
IMAGE
:=
expandybird
TAG
:=
latest
DIR
:=
.
push
:
container
ifeq
($(DOCKER_REGISTRY),gcr.io)
gcloud docker push $(PREFIX)/$(IMAGE)
:
$(TAG)
else
docker push $(PREFIX)/$(IMAGE)
:
$(TAG)
endif
container
:
expandybird
cp
$(
shell
which expandybird
)
.
...
...
@@ -25,4 +30,4 @@ expandybird:
clean
:
-
docker rmi
$(PREFIX)
/
$(IMAGE)
:
$(TAG)
rm
-f
expandybird
expandybird/service/service.go
View file @
9d1a5d8c
...
...
@@ -68,14 +68,14 @@ func NewExpansionHandler(backend expander.Expander) restful.RouteFunction {
output
,
err
:=
backend
.
ExpandTemplate
(
template
)
if
err
!=
nil
{
message
:=
fmt
.
Sprintf
(
"error
(%s) expanding template:
\n
%v
\n
"
,
err
,
template
)
message
:=
fmt
.
Sprintf
(
"error
expanding template: %s"
,
err
)
logAndReturnErrorFromHandler
(
http
.
StatusBadRequest
,
message
,
resp
)
return
}
response
,
err
:=
expander
.
NewExpansionResponse
(
output
)
if
err
!=
nil
{
message
:=
fmt
.
Sprintf
(
"error
(%s) marshaling output:
\n
%v
\n
"
,
err
,
output
)
message
:=
fmt
.
Sprintf
(
"error
marshaling output: %s"
,
err
)
logAndReturnErrorFromHandler
(
http
.
StatusBadRequest
,
message
,
resp
)
return
}
...
...
manager/Makefile
View file @
9d1a5d8c
# Makefile for the Docker image
gcr.io
/$(PROJECT)/manager
# Makefile for the Docker image
$(DOCKER_REGISTRY)
/$(PROJECT)/manager
# MAINTAINER: Jack Greenfield <jackgr@google.com>
# If you update this image please check the tag value before pushing.
.PHONY
:
all build test push container clean .project
PREFIX
:=
gcr.io/
$(PROJECT)
DOCKER_REGISTRY
:=
gcr.io
PREFIX
:=
$(DOCKER_REGISTRY)
/
$(PROJECT)
IMAGE
:=
manager
TAG
:=
latest
...
...
@@ -12,11 +13,15 @@ ROOT_DIR := $(abspath ./..)
DIR
=
$(ROOT_DIR)
push
:
container
ifeq
($(DOCKER_REGISTRY),gcr.io)
gcloud docker push $(PREFIX)/$(IMAGE)
:
$(TAG)
else
docker push $(PREFIX)/$(IMAGE)
:
$(TAG)
endif
container
:
container
:
docker build
-t
$(PREFIX)
/
$(IMAGE)
:
$(TAG)
-f
Dockerfile
$(DIR)
clean
:
-
docker rmi
$(PREFIX)
/
$(IMAGE)
:
$(TAG)
\ No newline at end of file
manager/manager/deployer.go
View file @
9d1a5d8c
...
...
@@ -100,7 +100,7 @@ func (d *deployer) PutConfiguration(configuration *Configuration) error {
func
(
d
*
deployer
)
callServiceWithConfiguration
(
method
,
operation
string
,
configuration
*
Configuration
)
error
{
callback
:=
func
(
e
error
)
error
{
return
fmt
.
Errorf
(
"cannot %s configuration
(%s)
"
,
operation
,
e
)
return
fmt
.
Errorf
(
"cannot %s configuration
: %s
"
,
operation
,
e
)
}
y
,
err
:=
yaml
.
Marshal
(
configuration
)
...
...
@@ -129,14 +129,14 @@ func (d *deployer) callService(method, url string, reader io.Reader, callback fo
}
defer
response
.
Body
.
Close
()
if
response
.
StatusCode
<
http
.
StatusOK
||
response
.
StatusCode
>=
http
.
StatusMultipleChoices
{
err
:=
fmt
.
Errorf
(
"deployer service response:
\n
%v
\n
"
,
response
)
body
,
err
:=
ioutil
.
ReadAll
(
response
.
Body
)
if
err
!=
nil
{
return
nil
,
callback
(
err
)
}
body
,
err
:=
ioutil
.
ReadAll
(
response
.
Body
)
if
err
!=
nil
{
if
response
.
StatusCode
<
http
.
StatusOK
||
response
.
StatusCode
>=
http
.
StatusMultipleChoices
{
err
:=
fmt
.
Errorf
(
"resourcifier response:
\n
%s"
,
body
)
return
nil
,
callback
(
err
)
}
...
...
manager/manager/expander.go
View file @
9d1a5d8c
...
...
@@ -54,7 +54,7 @@ func (e *expander) getBaseURL() string {
}
func
expanderError
(
t
*
Template
,
err
error
)
error
{
return
fmt
.
Errorf
(
"cannot expand template named %s (%s):
\n
%s
\n
"
,
t
.
Name
,
err
,
t
.
Content
)
return
fmt
.
Errorf
(
"cannot expand template named %s (%s):
\n
%s"
,
t
.
Name
,
err
,
t
.
Content
)
}
// ExpanderResponse gives back a layout, which has nested structure
...
...
@@ -117,7 +117,7 @@ func (e *expander) ExpandTemplate(t Template) (*ExpandedTemplate, error) {
// 4. If type resolution resulted in new imports being available, return to 2.
config
:=
&
Configuration
{}
if
err
:=
yaml
.
Unmarshal
([]
byte
(
t
.
Content
),
config
);
err
!=
nil
{
e
:=
fmt
.
Errorf
(
"Unable to unmarshal configuration (%s): %s
\n
"
,
err
,
t
.
Content
)
e
:=
fmt
.
Errorf
(
"Unable to unmarshal configuration (%s): %s"
,
err
,
t
.
Content
)
return
nil
,
e
}
...
...
@@ -127,7 +127,7 @@ func (e *expander) ExpandTemplate(t Template) (*ExpandedTemplate, error) {
// Start things off by attempting to resolve the templates in a first pass.
newImp
,
err
:=
e
.
typeResolver
.
ResolveTypes
(
config
,
t
.
Imports
)
if
err
!=
nil
{
e
:=
fmt
.
Errorf
(
"type resolution failed:
%s
\n
"
,
err
)
e
:=
fmt
.
Errorf
(
"type resolution failed:
%s
"
,
err
)
return
nil
,
expanderError
(
&
t
,
e
)
}
...
...
@@ -137,7 +137,7 @@ func (e *expander) ExpandTemplate(t Template) (*ExpandedTemplate, error) {
// Now expand with everything imported.
result
,
err
:=
e
.
expandTemplate
(
&
t
)
if
err
!=
nil
{
e
:=
fmt
.
Errorf
(
"template expansion:
%s
\n
"
,
err
)
e
:=
fmt
.
Errorf
(
"template expansion:
%s
"
,
err
)
return
nil
,
expanderError
(
&
t
,
e
)
}
...
...
@@ -152,7 +152,7 @@ func (e *expander) ExpandTemplate(t Template) (*ExpandedTemplate, error) {
newImp
,
err
=
e
.
typeResolver
.
ResolveTypes
(
result
.
Config
,
nil
)
if
err
!=
nil
{
e
:=
fmt
.
Errorf
(
"type resolution failed:
%s
\n
"
,
err
)
e
:=
fmt
.
Errorf
(
"type resolution failed:
%s
"
,
err
)
return
nil
,
expanderError
(
&
t
,
e
)
}
...
...
@@ -167,7 +167,7 @@ func (e *expander) ExpandTemplate(t Template) (*ExpandedTemplate, error) {
content
,
err
=
yaml
.
Marshal
(
result
.
Config
)
t
.
Content
=
string
(
content
)
if
err
!=
nil
{
e
:=
fmt
.
Errorf
(
"Unable to unmarshal response from expander (%s): %s
\n
"
,
e
:=
fmt
.
Errorf
(
"Unable to unmarshal response from expander (%s): %s"
,
err
,
result
.
Config
)
return
nil
,
expanderError
(
&
t
,
e
)
}
...
...
@@ -183,31 +183,31 @@ func (e *expander) expandTemplate(t *Template) (*ExpandedTemplate, error) {
response
,
err
:=
http
.
Post
(
e
.
getBaseURL
(),
"application/json"
,
ioutil
.
NopCloser
(
bytes
.
NewReader
(
j
)))
if
err
!=
nil
{
e
:=
fmt
.
Errorf
(
"http POST failed:
%s
\n
"
,
err
)
e
:=
fmt
.
Errorf
(
"http POST failed:
%s
"
,
err
)
return
nil
,
e
}
defer
response
.
Body
.
Close
()
if
response
.
StatusCode
!=
http
.
StatusOK
{
err
:=
fmt
.
Errorf
(
"expander service response:%v"
,
response
)
return
nil
,
err
}
defer
response
.
Body
.
Close
()
body
,
err
:=
ioutil
.
ReadAll
(
response
.
Body
)
if
err
!=
nil
{
e
:=
fmt
.
Errorf
(
"error reading response:
%s
\n
"
,
err
)
e
:=
fmt
.
Errorf
(
"error reading response:
%s
"
,
err
)
return
nil
,
e
}
if
response
.
StatusCode
!=
http
.
StatusOK
{
err
:=
fmt
.
Errorf
(
"expandybird response:
\n
%s"
,
body
)
return
nil
,
err
}
er
:=
&
ExpansionResponse
{}
if
err
:=
json
.
Unmarshal
(
body
,
er
);
err
!=
nil
{
e
:=
fmt
.
Errorf
(
"cannot unmarshal response body (%s):%s
\n
"
,
err
,
body
)
e
:=
fmt
.
Errorf
(
"cannot unmarshal response body (%s):%s"
,
err
,
body
)
return
nil
,
e
}
template
,
err
:=
er
.
Unmarshal
()
if
err
!=
nil
{
e
:=
fmt
.
Errorf
(
"cannot unmarshal response yaml (%s):%v
\n
"
,
err
,
er
)
e
:=
fmt
.
Errorf
(
"cannot unmarshal response yaml (%s):%v"
,
err
,
er
)
return
nil
,
e
}
...
...
resourcifier/Makefile
View file @
9d1a5d8c
# Makefile for the Docker image
gcr.io
/$(PROJECT)/resourcifier
# Makefile for the Docker image
$(DOCKER_REGISTRY)
/$(PROJECT)/resourcifier
# MAINTAINER: Jack Greenfield <jackgr@google.com>
# If you update this image please check the tag value before pushing.
.PHONY
:
all build test push container clean
PREFIX
:=
gcr.io/
$(PROJECT)
DOCKER_REGISTRY
:=
gcr.io
PREFIX
:=
$(DOCKER_REGISTRY)
/
$(PROJECT)
IMAGE
:=
resourcifier
TAG
:=
latest
...
...
@@ -12,7 +13,11 @@ ROOT_DIR := $(abspath ./..)
DIR
=
$(ROOT_DIR)
push
:
container
ifeq
($(DOCKER_REGISTRY),gcr.io)
gcloud docker push $(PREFIX)/$(IMAGE)
:
$(TAG)
else
docker push $(PREFIX)/$(IMAGE)
:
$(TAG)
endif
container
:
docker build
-t
$(PREFIX)
/
$(IMAGE)
:
$(TAG)
-f
Dockerfile
$(DIR)
...
...
types/redis/v1/redis.yaml
0 → 100644
View file @
9d1a5d8c
imports
:
-
path
:
redis.jinja
resources
:
-
name
:
redis
type
:
redis.jinja
properties
:
null
types/replicatedservice/v1/replicatedservice.py
View file @
9d1a5d8c
...
...
@@ -99,10 +99,9 @@ def GenerateConfig(context):
return
yaml
.
dump
(
config
)
# Generates labels either from the context.properties['labels'] or generates
# a default label 'name':name
def
GenerateLabels
(
context
,
name
):
"""Generates labels from context.properties['labels'] or creates default.
"""Generates labels either from the context.properties['labels'] or
generates a default label 'name':name
We make a deep copy of the context.properties['labels'] section to avoid
linking in the yaml document, which I believe reduces readability of the
...
...
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