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
3db24d85
Commit
3db24d85
authored
Jan 07, 2016
by
vaikas-google
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean up the code for fetching registries
parent
1ee72edf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
19 deletions
+5
-19
dm.go
dm/dm.go
+2
-7
inmem_repository_service.go
registry/inmem_repository_service.go
+3
-12
No files found.
dm/dm.go
View file @
3db24d85
...
@@ -44,7 +44,7 @@ var (
...
@@ -44,7 +44,7 @@ var (
deployment_name
=
flag
.
String
(
"name"
,
""
,
"Name of deployment, used for deploy and update commands (defaults to template name)"
)
deployment_name
=
flag
.
String
(
"name"
,
""
,
"Name of deployment, used for deploy and update commands (defaults to template name)"
)
stdin
=
flag
.
Bool
(
"stdin"
,
false
,
"Reads a configuration from the standard input"
)
stdin
=
flag
.
Bool
(
"stdin"
,
false
,
"Reads a configuration from the standard input"
)
properties
=
flag
.
String
(
"properties"
,
""
,
"Properties to use when deploying a template (e.g., --properties k1=v1,k2=v2)"
)
properties
=
flag
.
String
(
"properties"
,
""
,
"Properties to use when deploying a template (e.g., --properties k1=v1,k2=v2)"
)
template_registry
=
flag
.
String
(
"registry"
,
"
kubernetes/application-dm-templates"
,
"Github based template registry (owner/repo[/path]
)"
)
template_registry
=
flag
.
String
(
"registry"
,
"
github.com/kubernetes/application-dm-templates"
,
"Registry (github.com/owner/repo
)"
)
service
=
flag
.
String
(
"service"
,
"http://localhost:8001/api/v1/proxy/namespaces/dm/services/manager-service:manager"
,
"URL for deployment manager"
)
service
=
flag
.
String
(
"service"
,
"http://localhost:8001/api/v1/proxy/namespaces/dm/services/manager-service:manager"
,
"URL for deployment manager"
)
binary
=
flag
.
String
(
"binary"
,
"../expandybird/expansion/expansion.py"
,
"Path to template expansion binary"
)
binary
=
flag
.
String
(
"binary"
,
"../expandybird/expansion/expansion.py"
,
"Path to template expansion binary"
)
timeout
=
flag
.
Int
(
"timeout"
,
10
,
"Time in seconds to wait for response"
)
timeout
=
flag
.
Int
(
"timeout"
,
10
,
"Time in seconds to wait for response"
)
...
@@ -82,12 +82,7 @@ var usage = func() {
...
@@ -82,12 +82,7 @@ var usage = func() {
}
}
func
getGitRegistry
()
(
registry
.
Registry
,
error
)
{
func
getGitRegistry
()
(
registry
.
Registry
,
error
)
{
rs
:=
registry
.
NewDefaultRegistryProvider
()
return
registry
.
NewDefaultRegistryProvider
()
.
GetRegistry
(
*
template_registry
)
s
:=
strings
.
Split
(
*
template_registry
,
"/"
)
if
len
(
s
)
<
2
{
panic
(
fmt
.
Errorf
(
"invalid template registry: %s"
,
*
template_registry
))
}
return
rs
.
GetRegistry
(
"github.com/"
+
s
[
0
]
+
"/"
+
s
[
1
])
}
}
func
main
()
{
func
main
()
{
...
...
registry/inmem_repository_service.go
View file @
3db24d85
...
@@ -66,20 +66,11 @@ func (rs *inmemRepositoryService) Get(name string) (*common.Registry, error) {
...
@@ -66,20 +66,11 @@ func (rs *inmemRepositoryService) Get(name string) (*common.Registry, error) {
func
(
rs
*
inmemRepositoryService
)
Delete
(
name
string
)
error
{
func
(
rs
*
inmemRepositoryService
)
Delete
(
name
string
)
error
{
return
nil
return
nil
}
}
func
(
rs
*
inmemRepositoryService
)
GetByURL
(
URL
string
)
(
*
common
.
Registry
,
error
)
{
if
!
strings
.
HasPrefix
(
URL
,
"github.com/"
)
{
return
nil
,
fmt
.
Errorf
(
"Failed to parse short github url: %s"
,
URL
)
}
s
:=
strings
.
Split
(
URL
,
"/"
)
if
len
(
s
)
<
3
{
panic
(
fmt
.
Errorf
(
"invalid template registry: %s"
,
URL
))
}
toFind
:=
"github.com/"
+
s
[
1
]
+
"/"
+
s
[
2
]
// GetByURL returns a registry that handles the types for a given URL.
fmt
.
Printf
(
"toFind: %s"
,
toFind
)
func
(
rs
*
inmemRepositoryService
)
GetByURL
(
URL
string
)
(
*
common
.
Registry
,
error
)
{
for
_
,
r
:=
range
rs
.
repositories
{
for
_
,
r
:=
range
rs
.
repositories
{
fmt
.
Printf
(
"Checking: %s"
,
r
.
URL
)
if
strings
.
HasPrefix
(
r
.
URL
,
URL
)
{
if
r
.
URL
==
toFind
{
return
r
,
nil
return
r
,
nil
}
}
}
}
...
...
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