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
ab5f29d0
Commit
ab5f29d0
authored
Mar 23, 2016
by
jackgr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renames in manager/repository
parent
43a6876a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
54 deletions
+54
-54
persistent.go
cmd/manager/repository/persistent/persistent.go
+12
-12
persistent_test.go
cmd/manager/repository/persistent/persistent_test.go
+2
-2
repository.go
cmd/manager/repository/repository.go
+4
-4
test_common.go
cmd/manager/repository/test_common.go
+18
-18
transient.go
cmd/manager/repository/transient/transient.go
+16
-16
transient_test.go
cmd/manager/repository/transient/transient_test.go
+2
-2
No files found.
cmd/manager/repository/persistent/persistent.go
View file @
ab5f29d0
...
@@ -44,7 +44,7 @@ type pManifest struct {
...
@@ -44,7 +44,7 @@ type pManifest struct {
type
pInstance
struct
{
type
pInstance
struct
{
ID
string
`bson:"_id"`
ID
string
`bson:"_id"`
common
.
Type
Instance
common
.
Chart
Instance
}
}
type
pRepository
struct
{
type
pRepository
struct
{
...
@@ -428,8 +428,8 @@ func (r *pRepository) removeManifestsForDeployment(d *common.Deployment) error {
...
@@ -428,8 +428,8 @@ func (r *pRepository) removeManifestsForDeployment(d *common.Deployment) error {
return
nil
return
nil
}
}
// List
Type
s returns all types known from existing instances.
// List
Chart
s returns all types known from existing instances.
func
(
r
*
pRepository
)
List
Type
s
()
([]
string
,
error
)
{
func
(
r
*
pRepository
)
List
Chart
s
()
([]
string
,
error
)
{
var
result
[]
string
var
result
[]
string
if
err
:=
r
.
Instances
.
Find
(
nil
)
.
Distinct
(
"typeinstance.type"
,
&
result
);
err
!=
nil
{
if
err
:=
r
.
Instances
.
Find
(
nil
)
.
Distinct
(
"typeinstance.type"
,
&
result
);
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"cannot list type instances: %s"
,
err
)
return
nil
,
fmt
.
Errorf
(
"cannot list type instances: %s"
,
err
)
...
@@ -438,9 +438,9 @@ func (r *pRepository) ListTypes() ([]string, error) {
...
@@ -438,9 +438,9 @@ func (r *pRepository) ListTypes() ([]string, error) {
return
result
,
nil
return
result
,
nil
}
}
// Get
Type
Instances returns all instances of a given type. If typeName is empty
// Get
Chart
Instances returns all instances of a given type. If typeName is empty
// or equal to "all", returns all instances of all types.
// or equal to "all", returns all instances of all types.
func
(
r
*
pRepository
)
Get
TypeInstances
(
typeName
string
)
([]
*
common
.
Type
Instance
,
error
)
{
func
(
r
*
pRepository
)
Get
ChartInstances
(
typeName
string
)
([]
*
common
.
Chart
Instance
,
error
)
{
query
:=
bson
.
M
{
"typeinstance.type"
:
typeName
}
query
:=
bson
.
M
{
"typeinstance.type"
:
typeName
}
if
typeName
==
""
||
typeName
==
"all"
{
if
typeName
==
""
||
typeName
==
"all"
{
query
=
nil
query
=
nil
...
@@ -451,17 +451,17 @@ func (r *pRepository) GetTypeInstances(typeName string) ([]*common.TypeInstance,
...
@@ -451,17 +451,17 @@ func (r *pRepository) GetTypeInstances(typeName string) ([]*common.TypeInstance,
return
nil
,
fmt
.
Errorf
(
"cannot get instances of type %s: %s"
,
typeName
,
err
)
return
nil
,
fmt
.
Errorf
(
"cannot get instances of type %s: %s"
,
typeName
,
err
)
}
}
instances
:=
[]
*
common
.
Type
Instance
{}
instances
:=
[]
*
common
.
Chart
Instance
{}
for
_
,
pi
:=
range
result
{
for
_
,
pi
:=
range
result
{
instances
=
append
(
instances
,
&
pi
.
Type
Instance
)
instances
=
append
(
instances
,
&
pi
.
Chart
Instance
)
}
}
return
instances
,
nil
return
instances
,
nil
}
}
// Clear
Type
InstancesForDeployment deletes all type instances associated with the given
// Clear
Chart
InstancesForDeployment deletes all type instances associated with the given
// deployment from the repository.
// deployment from the repository.
func
(
r
*
pRepository
)
Clear
Type
InstancesForDeployment
(
deploymentName
string
)
error
{
func
(
r
*
pRepository
)
Clear
Chart
InstancesForDeployment
(
deploymentName
string
)
error
{
if
deploymentName
!=
""
{
if
deploymentName
!=
""
{
query
:=
bson
.
M
{
"typeinstance.deployment"
:
deploymentName
}
query
:=
bson
.
M
{
"typeinstance.deployment"
:
deploymentName
}
if
_
,
err
:=
r
.
Instances
.
RemoveAll
(
query
);
err
!=
nil
{
if
_
,
err
:=
r
.
Instances
.
RemoveAll
(
query
);
err
!=
nil
{
...
@@ -472,12 +472,12 @@ func (r *pRepository) ClearTypeInstancesForDeployment(deploymentName string) err
...
@@ -472,12 +472,12 @@ func (r *pRepository) ClearTypeInstancesForDeployment(deploymentName string) err
return
nil
return
nil
}
}
// Add
Type
Instances adds the supplied type instances to the repository.
// Add
Chart
Instances adds the supplied type instances to the repository.
func
(
r
*
pRepository
)
Add
TypeInstances
(
instances
map
[
string
][]
*
common
.
Type
Instance
)
error
{
func
(
r
*
pRepository
)
Add
ChartInstances
(
instances
map
[
string
][]
*
common
.
Chart
Instance
)
error
{
for
_
,
is
:=
range
instances
{
for
_
,
is
:=
range
instances
{
for
_
,
i
:=
range
is
{
for
_
,
i
:=
range
is
{
key
:=
fmt
.
Sprintf
(
"%s.%s.%s"
,
i
.
Deployment
,
i
.
Type
,
i
.
Name
)
key
:=
fmt
.
Sprintf
(
"%s.%s.%s"
,
i
.
Deployment
,
i
.
Type
,
i
.
Name
)
wrapper
:=
pInstance
{
ID
:
key
,
Type
Instance
:
*
i
}
wrapper
:=
pInstance
{
ID
:
key
,
Chart
Instance
:
*
i
}
if
err
:=
r
.
Instances
.
Insert
(
&
wrapper
);
err
!=
nil
{
if
err
:=
r
.
Instances
.
Insert
(
&
wrapper
);
err
!=
nil
{
return
fmt
.
Errorf
(
"cannot insert type instance %v: %s"
,
wrapper
,
err
)
return
fmt
.
Errorf
(
"cannot insert type instance %v: %s"
,
wrapper
,
err
)
}
}
...
...
cmd/manager/repository/persistent/persistent_test.go
View file @
ab5f29d0
...
@@ -102,9 +102,9 @@ func TestRepositoryDeleteDeploymentWorksForget(t *testing.T) {
...
@@ -102,9 +102,9 @@ func TestRepositoryDeleteDeploymentWorksForget(t *testing.T) {
}
}
}
}
func
TestRepository
Type
Instances
(
t
*
testing
.
T
)
{
func
TestRepository
Chart
Instances
(
t
*
testing
.
T
)
{
if
r
:=
createRepository
();
r
!=
nil
{
if
r
:=
createRepository
();
r
!=
nil
{
defer
resetRepository
(
t
,
r
)
defer
resetRepository
(
t
,
r
)
repository
.
TestRepository
Type
Instances
(
t
,
r
)
repository
.
TestRepository
Chart
Instances
(
t
,
r
)
}
}
}
}
cmd/manager/repository/repository.go
View file @
ab5f29d0
...
@@ -40,10 +40,10 @@ type Repository interface {
...
@@ -40,10 +40,10 @@ type Repository interface {
GetLatestManifest
(
deploymentName
string
)
(
*
common
.
Manifest
,
error
)
GetLatestManifest
(
deploymentName
string
)
(
*
common
.
Manifest
,
error
)
// Types.
// Types.
List
Type
s
()
([]
string
,
error
)
List
Chart
s
()
([]
string
,
error
)
Get
TypeInstances
(
typeName
string
)
([]
*
common
.
Type
Instance
,
error
)
Get
ChartInstances
(
chartName
string
)
([]
*
common
.
Chart
Instance
,
error
)
Clear
Type
InstancesForDeployment
(
deploymentName
string
)
error
Clear
Chart
InstancesForDeployment
(
deploymentName
string
)
error
Add
TypeInstances
(
instances
map
[
string
][]
*
common
.
Type
Instance
)
error
Add
ChartInstances
(
instances
map
[
string
][]
*
common
.
Chart
Instance
)
error
Close
()
Close
()
}
}
cmd/manager/repository/test_common.go
View file @
ab5f29d0
...
@@ -210,9 +210,9 @@ func TestRepositoryDeleteDeploymentWorksForget(t *testing.T, r Repository) {
...
@@ -210,9 +210,9 @@ func TestRepositoryDeleteDeploymentWorksForget(t *testing.T, r Repository) {
}
}
}
}
// TestRepository
Type
Instances checks that type instances can be listed and retrieved successfully.
// TestRepository
Chart
Instances checks that type instances can be listed and retrieved successfully.
func
TestRepository
Type
Instances
(
t
*
testing
.
T
,
r
Repository
)
{
func
TestRepository
Chart
Instances
(
t
*
testing
.
T
,
r
Repository
)
{
d1Map
:=
map
[
string
][]
*
common
.
Type
Instance
{
d1Map
:=
map
[
string
][]
*
common
.
Chart
Instance
{
"t1"
:
{
"t1"
:
{
{
{
Name
:
"i1"
,
Name
:
"i1"
,
...
@@ -224,7 +224,7 @@ func TestRepositoryTypeInstances(t *testing.T, r Repository) {
...
@@ -224,7 +224,7 @@ func TestRepositoryTypeInstances(t *testing.T, r Repository) {
},
},
}
}
d2Map
:=
map
[
string
][]
*
common
.
Type
Instance
{
d2Map
:=
map
[
string
][]
*
common
.
Chart
Instance
{
"t2"
:
{
"t2"
:
{
{
{
Name
:
"i2"
,
Name
:
"i2"
,
...
@@ -236,7 +236,7 @@ func TestRepositoryTypeInstances(t *testing.T, r Repository) {
...
@@ -236,7 +236,7 @@ func TestRepositoryTypeInstances(t *testing.T, r Repository) {
},
},
}
}
d3Map
:=
map
[
string
][]
*
common
.
Type
Instance
{
d3Map
:=
map
[
string
][]
*
common
.
Chart
Instance
{
"t2"
:
{
"t2"
:
{
{
{
Name
:
"i3"
,
Name
:
"i3"
,
...
@@ -248,7 +248,7 @@ func TestRepositoryTypeInstances(t *testing.T, r Repository) {
...
@@ -248,7 +248,7 @@ func TestRepositoryTypeInstances(t *testing.T, r Repository) {
},
},
}
}
instances
,
err
:=
r
.
Get
Type
Instances
(
"noinstances"
)
instances
,
err
:=
r
.
Get
Chart
Instances
(
"noinstances"
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
...
@@ -257,7 +257,7 @@ func TestRepositoryTypeInstances(t *testing.T, r Repository) {
...
@@ -257,7 +257,7 @@ func TestRepositoryTypeInstances(t *testing.T, r Repository) {
t
.
Fatalf
(
"expected no instances: %v"
,
instances
)
t
.
Fatalf
(
"expected no instances: %v"
,
instances
)
}
}
types
,
err
:=
r
.
List
Type
s
()
types
,
err
:=
r
.
List
Chart
s
()
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
...
@@ -266,11 +266,11 @@ func TestRepositoryTypeInstances(t *testing.T, r Repository) {
...
@@ -266,11 +266,11 @@ func TestRepositoryTypeInstances(t *testing.T, r Repository) {
t
.
Fatalf
(
"expected no types: %v"
,
types
)
t
.
Fatalf
(
"expected no types: %v"
,
types
)
}
}
r
.
Add
Type
Instances
(
d1Map
)
r
.
Add
Chart
Instances
(
d1Map
)
r
.
Add
Type
Instances
(
d2Map
)
r
.
Add
Chart
Instances
(
d2Map
)
r
.
Add
Type
Instances
(
d3Map
)
r
.
Add
Chart
Instances
(
d3Map
)
instances
,
err
=
r
.
Get
Type
Instances
(
"unknowntype"
)
instances
,
err
=
r
.
Get
Chart
Instances
(
"unknowntype"
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
...
@@ -279,7 +279,7 @@ func TestRepositoryTypeInstances(t *testing.T, r Repository) {
...
@@ -279,7 +279,7 @@ func TestRepositoryTypeInstances(t *testing.T, r Repository) {
t
.
Fatalf
(
"expected no instances: %v"
,
instances
)
t
.
Fatalf
(
"expected no instances: %v"
,
instances
)
}
}
instances
,
err
=
r
.
Get
Type
Instances
(
"t1"
)
instances
,
err
=
r
.
Get
Chart
Instances
(
"t1"
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
...
@@ -288,7 +288,7 @@ func TestRepositoryTypeInstances(t *testing.T, r Repository) {
...
@@ -288,7 +288,7 @@ func TestRepositoryTypeInstances(t *testing.T, r Repository) {
t
.
Fatalf
(
"expected one instance: %v"
,
instances
)
t
.
Fatalf
(
"expected one instance: %v"
,
instances
)
}
}
instances
,
err
=
r
.
Get
Type
Instances
(
"t2"
)
instances
,
err
=
r
.
Get
Chart
Instances
(
"t2"
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
...
@@ -297,7 +297,7 @@ func TestRepositoryTypeInstances(t *testing.T, r Repository) {
...
@@ -297,7 +297,7 @@ func TestRepositoryTypeInstances(t *testing.T, r Repository) {
t
.
Fatalf
(
"expected two instances: %v"
,
instances
)
t
.
Fatalf
(
"expected two instances: %v"
,
instances
)
}
}
instances
,
err
=
r
.
Get
Type
Instances
(
"all"
)
instances
,
err
=
r
.
Get
Chart
Instances
(
"all"
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
...
@@ -306,7 +306,7 @@ func TestRepositoryTypeInstances(t *testing.T, r Repository) {
...
@@ -306,7 +306,7 @@ func TestRepositoryTypeInstances(t *testing.T, r Repository) {
t
.
Fatalf
(
"expected three total instances: %v"
,
instances
)
t
.
Fatalf
(
"expected three total instances: %v"
,
instances
)
}
}
types
,
err
=
r
.
List
Type
s
()
types
,
err
=
r
.
List
Chart
s
()
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
...
@@ -315,12 +315,12 @@ func TestRepositoryTypeInstances(t *testing.T, r Repository) {
...
@@ -315,12 +315,12 @@ func TestRepositoryTypeInstances(t *testing.T, r Repository) {
t
.
Fatalf
(
"expected two total types: %v"
,
types
)
t
.
Fatalf
(
"expected two total types: %v"
,
types
)
}
}
err
=
r
.
Clear
Type
InstancesForDeployment
(
"d1"
)
err
=
r
.
Clear
Chart
InstancesForDeployment
(
"d1"
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
instances
,
err
=
r
.
Get
Type
Instances
(
"t1"
)
instances
,
err
=
r
.
Get
Chart
Instances
(
"t1"
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
...
@@ -329,7 +329,7 @@ func TestRepositoryTypeInstances(t *testing.T, r Repository) {
...
@@ -329,7 +329,7 @@ func TestRepositoryTypeInstances(t *testing.T, r Repository) {
t
.
Fatalf
(
"expected no instances after clear: %v"
,
instances
)
t
.
Fatalf
(
"expected no instances after clear: %v"
,
instances
)
}
}
types
,
err
=
r
.
List
Type
s
()
types
,
err
=
r
.
List
Chart
s
()
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
...
...
cmd/manager/repository/transient/transient.go
View file @
ab5f29d0
...
@@ -27,16 +27,16 @@ import (
...
@@ -27,16 +27,16 @@ import (
"github.com/kubernetes/helm/pkg/common"
"github.com/kubernetes/helm/pkg/common"
)
)
// deployment
Type
InstanceMap stores type instances mapped by deployment name.
// deployment
Chart
InstanceMap stores type instances mapped by deployment name.
// This allows for simple updating and deleting of per-deployment instances
// This allows for simple updating and deleting of per-deployment instances
// when deployments are created/updated/deleted.
// when deployments are created/updated/deleted.
type
deployment
TypeInstanceMap
map
[
string
][]
*
common
.
Type
Instance
type
deployment
ChartInstanceMap
map
[
string
][]
*
common
.
Chart
Instance
type
tRepository
struct
{
type
tRepository
struct
{
sync
.
RWMutex
sync
.
RWMutex
deployments
map
[
string
]
common
.
Deployment
deployments
map
[
string
]
common
.
Deployment
manifests
map
[
string
]
map
[
string
]
*
common
.
Manifest
manifests
map
[
string
]
map
[
string
]
*
common
.
Manifest
instances
map
[
string
]
deployment
Type
InstanceMap
instances
map
[
string
]
deployment
Chart
InstanceMap
}
}
// NewRepository returns a new transient repository. Its lifetime is coupled
// NewRepository returns a new transient repository. Its lifetime is coupled
...
@@ -46,14 +46,14 @@ func NewRepository() repository.Repository {
...
@@ -46,14 +46,14 @@ func NewRepository() repository.Repository {
return
&
tRepository
{
return
&
tRepository
{
deployments
:
make
(
map
[
string
]
common
.
Deployment
,
0
),
deployments
:
make
(
map
[
string
]
common
.
Deployment
,
0
),
manifests
:
make
(
map
[
string
]
map
[
string
]
*
common
.
Manifest
,
0
),
manifests
:
make
(
map
[
string
]
map
[
string
]
*
common
.
Manifest
,
0
),
instances
:
make
(
map
[
string
]
deployment
Type
InstanceMap
,
0
),
instances
:
make
(
map
[
string
]
deployment
Chart
InstanceMap
,
0
),
}
}
}
}
func
(
r
*
tRepository
)
Close
()
{
func
(
r
*
tRepository
)
Close
()
{
r
.
deployments
=
make
(
map
[
string
]
common
.
Deployment
,
0
)
r
.
deployments
=
make
(
map
[
string
]
common
.
Deployment
,
0
)
r
.
manifests
=
make
(
map
[
string
]
map
[
string
]
*
common
.
Manifest
,
0
)
r
.
manifests
=
make
(
map
[
string
]
map
[
string
]
*
common
.
Manifest
,
0
)
r
.
instances
=
make
(
map
[
string
]
deployment
Type
InstanceMap
,
0
)
r
.
instances
=
make
(
map
[
string
]
deployment
Chart
InstanceMap
,
0
)
}
}
// ListDeployments returns of all of the deployments in the repository.
// ListDeployments returns of all of the deployments in the repository.
...
@@ -258,8 +258,8 @@ func (r *tRepository) GetLatestManifest(deploymentName string) (*common.Manifest
...
@@ -258,8 +258,8 @@ func (r *tRepository) GetLatestManifest(deploymentName string) (*common.Manifest
return
r
.
getManifestForDeployment
(
deploymentName
,
d
.
LatestManifest
)
return
r
.
getManifestForDeployment
(
deploymentName
,
d
.
LatestManifest
)
}
}
// List
Type
s returns all types known from existing instances.
// List
Chart
s returns all types known from existing instances.
func
(
r
*
tRepository
)
List
Type
s
()
([]
string
,
error
)
{
func
(
r
*
tRepository
)
List
Chart
s
()
([]
string
,
error
)
{
var
keys
[]
string
var
keys
[]
string
for
k
:=
range
r
.
instances
{
for
k
:=
range
r
.
instances
{
keys
=
append
(
keys
,
k
)
keys
=
append
(
keys
,
k
)
...
@@ -268,10 +268,10 @@ func (r *tRepository) ListTypes() ([]string, error) {
...
@@ -268,10 +268,10 @@ func (r *tRepository) ListTypes() ([]string, error) {
return
keys
,
nil
return
keys
,
nil
}
}
// Get
Type
Instances returns all instances of a given type. If type is empty,
// Get
Chart
Instances returns all instances of a given type. If type is empty,
// returns all instances for all types.
// returns all instances for all types.
func
(
r
*
tRepository
)
Get
TypeInstances
(
typeName
string
)
([]
*
common
.
Type
Instance
,
error
)
{
func
(
r
*
tRepository
)
Get
ChartInstances
(
typeName
string
)
([]
*
common
.
Chart
Instance
,
error
)
{
var
instances
[]
*
common
.
Type
Instance
var
instances
[]
*
common
.
Chart
Instance
for
t
,
dInstMap
:=
range
r
.
instances
{
for
t
,
dInstMap
:=
range
r
.
instances
{
if
t
==
typeName
||
typeName
==
""
||
typeName
==
"all"
{
if
t
==
typeName
||
typeName
==
""
||
typeName
==
"all"
{
for
_
,
i
:=
range
dInstMap
{
for
_
,
i
:=
range
dInstMap
{
...
@@ -283,9 +283,9 @@ func (r *tRepository) GetTypeInstances(typeName string) ([]*common.TypeInstance,
...
@@ -283,9 +283,9 @@ func (r *tRepository) GetTypeInstances(typeName string) ([]*common.TypeInstance,
return
instances
,
nil
return
instances
,
nil
}
}
// Clear
Type
InstancesForDeployment deletes all type instances associated with the given
// Clear
Chart
InstancesForDeployment deletes all type instances associated with the given
// deployment from the repository.
// deployment from the repository.
func
(
r
*
tRepository
)
Clear
Type
InstancesForDeployment
(
deploymentName
string
)
error
{
func
(
r
*
tRepository
)
Clear
Chart
InstancesForDeployment
(
deploymentName
string
)
error
{
r
.
Lock
()
r
.
Lock
()
defer
r
.
Unlock
()
defer
r
.
Unlock
()
...
@@ -299,22 +299,22 @@ func (r *tRepository) ClearTypeInstancesForDeployment(deploymentName string) err
...
@@ -299,22 +299,22 @@ func (r *tRepository) ClearTypeInstancesForDeployment(deploymentName string) err
return
nil
return
nil
}
}
// Add
Type
Instances adds the supplied type instances to the repository.
// Add
Chart
Instances adds the supplied type instances to the repository.
func
(
r
*
tRepository
)
Add
TypeInstances
(
instances
map
[
string
][]
*
common
.
Type
Instance
)
error
{
func
(
r
*
tRepository
)
Add
ChartInstances
(
instances
map
[
string
][]
*
common
.
Chart
Instance
)
error
{
r
.
Lock
()
r
.
Lock
()
defer
r
.
Unlock
()
defer
r
.
Unlock
()
// Add instances to the appropriate type and deployment maps.
// Add instances to the appropriate type and deployment maps.
for
t
,
is
:=
range
instances
{
for
t
,
is
:=
range
instances
{
if
r
.
instances
[
t
]
==
nil
{
if
r
.
instances
[
t
]
==
nil
{
r
.
instances
[
t
]
=
make
(
deployment
Type
InstanceMap
)
r
.
instances
[
t
]
=
make
(
deployment
Chart
InstanceMap
)
}
}
tmap
:=
r
.
instances
[
t
]
tmap
:=
r
.
instances
[
t
]
for
_
,
instance
:=
range
is
{
for
_
,
instance
:=
range
is
{
deployment
:=
instance
.
Deployment
deployment
:=
instance
.
Deployment
if
tmap
[
deployment
]
==
nil
{
if
tmap
[
deployment
]
==
nil
{
tmap
[
deployment
]
=
make
([]
*
common
.
Type
Instance
,
0
)
tmap
[
deployment
]
=
make
([]
*
common
.
Chart
Instance
,
0
)
}
}
tmap
[
deployment
]
=
append
(
tmap
[
deployment
],
instance
)
tmap
[
deployment
]
=
append
(
tmap
[
deployment
],
instance
)
...
...
cmd/manager/repository/transient/transient_test.go
View file @
ab5f29d0
...
@@ -50,6 +50,6 @@ func TestRepositoryDeleteDeploymentWorksForget(t *testing.T) {
...
@@ -50,6 +50,6 @@ func TestRepositoryDeleteDeploymentWorksForget(t *testing.T) {
repository
.
TestRepositoryDeleteDeploymentWorksForget
(
t
,
NewRepository
())
repository
.
TestRepositoryDeleteDeploymentWorksForget
(
t
,
NewRepository
())
}
}
func
TestRepository
Type
Instances
(
t
*
testing
.
T
)
{
func
TestRepository
Chart
Instances
(
t
*
testing
.
T
)
{
repository
.
TestRepository
Type
Instances
(
t
,
NewRepository
())
repository
.
TestRepository
Chart
Instances
(
t
,
NewRepository
())
}
}
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