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
f3fd7b14
Commit
f3fd7b14
authored
Jan 07, 2016
by
vaikas-google
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wire in the in memory registry provider so that we can show how it works
parent
616a8c38
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
18 deletions
+61
-18
deployments.go
manager/deployments.go
+17
-2
manager.go
manager/manager/manager.go
+25
-2
inmem_repository_service.go
registry/inmem_repository_service.go
+19
-2
registryprovider.go
registry/registryprovider.go
+0
-12
No files found.
manager/deployments.go
View file @
f3fd7b14
...
...
@@ -31,9 +31,10 @@ import (
"github.com/ghodss/yaml"
"github.com/gorilla/mux"
"github.com/kubernetes/deployment-manager/manager/manager"
"github.com/kubernetes/deployment-manager/common"
"github.com/kubernetes/deployment-manager/manager/manager"
"github.com/kubernetes/deployment-manager/manager/repository"
"github.com/kubernetes/deployment-manager/registry"
"github.com/kubernetes/deployment-manager/util"
)
...
...
@@ -48,6 +49,7 @@ var deployments = []Route{
{
"Expand"
,
"/expand"
,
"POST"
,
expandHandlerFunc
,
""
},
{
"ListTypes"
,
"/types"
,
"GET"
,
listTypesHandlerFunc
,
""
},
{
"ListTypeInstances"
,
"/types/{type}/instances"
,
"GET"
,
listTypeInstancesHandlerFunc
,
""
},
{
"ListRegistries"
,
"/registries"
,
"GET"
,
listRegistriesHandlerFunc
,
""
},
}
var
(
...
...
@@ -72,8 +74,9 @@ func init() {
func
newManager
()
manager
.
Manager
{
expander
:=
manager
.
NewExpander
(
getServiceURL
(
*
expanderURL
,
*
expanderName
),
manager
.
NewTypeResolver
())
deployer
:=
manager
.
NewDeployer
(
getServiceURL
(
*
deployerURL
,
*
deployerName
))
registryService
:=
registry
.
NewInmemRepositoryService
()
r
:=
repository
.
NewMapBasedRepository
()
return
manager
.
NewManager
(
expander
,
deployer
,
r
)
return
manager
.
NewManager
(
expander
,
deployer
,
r
,
registryService
)
}
func
getServiceURL
(
serviceURL
,
serviceName
string
)
string
{
...
...
@@ -329,3 +332,15 @@ func listTypeInstancesHandlerFunc(w http.ResponseWriter, r *http.Request) {
util
.
LogHandlerExitWithJSON
(
handler
,
w
,
backend
.
ListInstances
(
typeName
),
http
.
StatusOK
)
}
// Putting Registry handlers here for now because deployments.go
// currently owns its own Manager backend and doesn't like to share.
func
listRegistriesHandlerFunc
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
handler
:=
"manager: list registries"
util
.
LogHandlerEntry
(
handler
,
r
)
registries
,
err
:=
backend
.
ListRegistries
()
if
err
!=
nil
{
return
}
util
.
LogHandlerExitWithJSON
(
handler
,
w
,
registries
,
http
.
StatusOK
)
}
manager/manager/manager.go
View file @
f3fd7b14
...
...
@@ -23,6 +23,7 @@ import (
"github.com/kubernetes/deployment-manager/common"
"github.com/kubernetes/deployment-manager/manager/repository"
"github.com/kubernetes/deployment-manager/registry"
)
// Manager manages a persistent set of Deployments.
...
...
@@ -37,17 +38,23 @@ type Manager interface {
Expand
(
t
*
common
.
Template
)
(
*
common
.
Manifest
,
error
)
ListTypes
()
[]
string
ListInstances
(
typeName
string
)
[]
*
common
.
TypeInstance
// Registry related functions
ListRegistries
()
([]
*
common
.
Registry
,
error
)
CreateRegistry
(
pr
*
common
.
Registry
)
error
GetRegistry
(
name
string
)
(
*
common
.
Registry
,
error
)
DeleteRegistry
(
name
string
)
error
}
type
manager
struct
{
expander
Expander
deployer
Deployer
repository
repository
.
Repository
registryService
registry
.
RegistryService
}
// NewManager returns a new initialized Manager.
func
NewManager
(
expander
Expander
,
deployer
Deployer
,
repository
repository
.
Repository
)
Manager
{
return
&
manager
{
expander
,
deployer
,
repository
}
func
NewManager
(
expander
Expander
,
deployer
Deployer
,
repository
repository
.
Repository
,
registryService
registry
.
RegistryService
)
Manager
{
return
&
manager
{
expander
,
deployer
,
repository
,
registryService
}
}
// ListDeployments returns the list of deployments
...
...
@@ -302,6 +309,22 @@ func (m *manager) ListInstances(typeName string) []*common.TypeInstance {
return
m
.
repository
.
GetTypeInstances
(
typeName
)
}
func
(
m
*
manager
)
ListRegistries
()
([]
*
common
.
Registry
,
error
)
{
return
m
.
registryService
.
List
()
}
func
(
m
*
manager
)
CreateRegistry
(
pr
*
common
.
Registry
)
error
{
return
m
.
registryService
.
Create
(
pr
)
}
func
(
m
*
manager
)
GetRegistry
(
name
string
)
(
*
common
.
Registry
,
error
)
{
return
m
.
registryService
.
Get
(
name
)
}
func
(
m
*
manager
)
DeleteRegistry
(
name
string
)
error
{
return
m
.
registryService
.
Delete
(
name
)
}
func
generateManifestName
()
string
{
return
fmt
.
Sprintf
(
"manifest-%d"
,
time
.
Now
()
.
UTC
()
.
UnixNano
())
}
...
...
registry/inmem_repository_service.go
View file @
f3fd7b14
...
...
@@ -28,13 +28,30 @@ type inmemRepositoryService struct {
}
func
NewInmemRepositoryService
()
RegistryService
{
r
eturn
&
inmemRepositoryService
{
r
s
:=
&
inmemRepositoryService
{
repositories
:
make
(
map
[
string
]
*
common
.
Registry
),
}
rs
.
Create
(
&
common
.
Registry
{
Name
:
"charts"
,
Type
:
common
.
Github
,
URL
:
"github.com/helm/charts"
,
Format
:
common
.
UnversionedRegistry
,
})
rs
.
Create
(
&
common
.
Registry
{
Name
:
"application-dm-templates"
,
Type
:
common
.
Github
,
URL
:
"github.com/kubernetes/application-dm-templates"
,
Format
:
common
.
VersionedRegistry
,
})
return
rs
}
func
(
rs
*
inmemRepositoryService
)
List
()
([]
*
common
.
Registry
,
error
)
{
return
nil
,
nil
ret
:=
[]
*
common
.
Registry
{}
for
_
,
r
:=
range
rs
.
repositories
{
ret
=
append
(
ret
,
r
)
}
return
ret
,
nil
}
func
(
rs
*
inmemRepositoryService
)
Create
(
repository
*
common
.
Registry
)
error
{
...
...
registry/registryprovider.go
View file @
f3fd7b14
...
...
@@ -30,18 +30,6 @@ type RegistryProvider interface {
func
NewDefaultRegistryProvider
()
RegistryProvider
{
rs
:=
NewInmemRepositoryService
()
rs
.
Create
(
&
common
.
Registry
{
Name
:
"charts"
,
Type
:
common
.
Github
,
URL
:
"github.com/helm/charts"
,
Format
:
common
.
UnversionedRegistry
,
})
rs
.
Create
(
&
common
.
Registry
{
Name
:
"application-dm-templates"
,
Type
:
common
.
Github
,
URL
:
"github.com/kubernetes/application-dm-templates"
,
Format
:
common
.
VersionedRegistry
,
})
return
&
DefaultRegistryProvider
{
rs
:
rs
}
}
...
...
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