Skip to content

Commit

Permalink
Fix the type, don't save to the mongodb
Browse files Browse the repository at this point in the history
  • Loading branch information
hwchiu committed Jul 5, 2018
1 parent f118c4f commit 5cfb451
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/entity/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ type Storage struct {
Type StorageType `bson:"type" json:"type"`
Name string `bson:"name" json:"name"`
CreatedAt *time.Time `bson:"createdAt,omitempty" json:"createdAt,omitempty"`
NFS NFSStorage `bson:"nfs" json:"nfs"`
Fake FakeStorage `json:"fake"` //FakeNetwork, for restful testing.
NFS *NFSStorage `bson:"nfs,omitempty" json:"nfs,omitempty"`
Fake *FakeStorage `bson:"fake,omitempty" json:"fake,omitempty"` //FakeStorage, for restful testing.
}

//GetCollection - get model mongo collection name.
Expand Down
5 changes: 5 additions & 0 deletions src/storageprovider/nfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ func getDeployment(name string, storage *entity.Storage) *appsv1.Deployment {
Name: name,
},
Spec: appsv1.DeploymentSpec{
Selector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"app": name,
},
},
Replicas: &replicas,
Strategy: appsv1.DeploymentStrategy{
Type: appsv1.RecreateDeploymentStrategyType,
Expand Down
4 changes: 2 additions & 2 deletions src/storageprovider/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ type StorageProvider interface {
func GetStorageProvider(storage *entity.Storage) (StorageProvider, error) {
switch storage.Type {
case "nfs":
return NFSStorageProvider{storage.NFS}, nil
return NFSStorageProvider{*storage.NFS}, nil
case "fake":
return FakeStorageProvider{storage.Fake}, nil
return FakeStorageProvider{*storage.Fake}, nil
default:
return nil, fmt.Errorf("Unsupported Storage Type %s", storage.Type)
}
Expand Down

0 comments on commit 5cfb451

Please sign in to comment.