Skip to content

Commit

Permalink
Print StorageType (#273)
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <tamal@appscode.com>
  • Loading branch information
tamalsaha authored Aug 29, 2018
1 parent da9cff2 commit f8cbb72
Showing 1 changed file with 12 additions and 28 deletions.
40 changes: 12 additions & 28 deletions pkg/describer/kubedb_describer.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,7 @@ func (d *ElasticsearchDescriber) describeElasticsearch(item *api.Elasticsearch,

describeInitialization(item.Spec.Init, w)

if item.Spec.StorageType == api.StorageTypeEphemeral {
// TODO:
} else {
describeStorage(item.Spec.Storage, w)
}
describeStorage(item.Spec.StorageType, item.Spec.Storage, w)

showWorkload(d.client, item.Namespace, selector, w)

Expand Down Expand Up @@ -164,11 +160,7 @@ func (d *PostgresDescriber) describePostgres(item *api.Postgres, selector labels

describeInitialization(item.Spec.Init, w)

if item.Spec.StorageType == api.StorageTypeEphemeral {
// TODO:
} else {
describeStorage(item.Spec.Storage, w)
}
describeStorage(item.Spec.StorageType, item.Spec.Storage, w)

showWorkload(d.client, item.Namespace, selector, w)

Expand Down Expand Up @@ -250,11 +242,7 @@ func (d *MySQLDescriber) describeMySQL(item *api.MySQL, selector labels.Selector
w.Write(LEVEL_0, "Reason:\t%s\n", item.Status.Reason)
}

if item.Spec.StorageType == api.StorageTypeEphemeral {
// TODO:
} else {
describeStorage(item.Spec.Storage, w)
}
describeStorage(item.Spec.StorageType, item.Spec.Storage, w)

showWorkload(d.client, item.Namespace, selector, w)

Expand Down Expand Up @@ -330,11 +318,7 @@ func (d *MongoDBDescriber) describeMongoDB(item *api.MongoDB, selector labels.Se
w.Write(LEVEL_0, "Reason:\t%s\n", item.Status.Reason)
}

if item.Spec.StorageType == api.StorageTypeEphemeral {
// TODO:
} else {
describeStorage(item.Spec.Storage, w)
}
describeStorage(item.Spec.StorageType, item.Spec.Storage, w)

showWorkload(d.client, item.Namespace, selector, w)

Expand Down Expand Up @@ -410,11 +394,7 @@ func (d *RedisDescriber) describeRedis(item *api.Redis, selector labels.Selector
w.Write(LEVEL_0, "Reason:\t%s\n", item.Status.Reason)
}

if item.Spec.StorageType == api.StorageTypeEphemeral {
// TODO:
} else {
describeStorage(item.Spec.Storage, w)
}
describeStorage(item.Spec.StorageType, item.Spec.Storage, w)

showWorkload(d.client, item.Namespace, selector, w)

Expand Down Expand Up @@ -542,8 +522,7 @@ func (d *SnapshotDescriber) describeSnapshot(item *api.Snapshot, events *core.Ev
}

w.Write(LEVEL_0, "Storage:\n")
// TODO
// describeSnapshotStorage(item.Spec.Backend, w, 2)
describeSnapshotStorage(item.Spec.Backend, w)

secretVolumes := make(map[string]*core.SecretVolumeSource)
if item.Spec.StorageSecretName != "" {
Expand Down Expand Up @@ -626,7 +605,12 @@ func (d *DormantDatabaseDescriber) describeDormantDatabase(item *api.DormantData
})
}

func describeStorage(pvcSpec *core.PersistentVolumeClaimSpec, w printersinternal.PrefixWriter) {
func describeStorage(st api.StorageType, pvcSpec *core.PersistentVolumeClaimSpec, w printersinternal.PrefixWriter) {
if st == api.StorageTypeEphemeral {
w.Write(LEVEL_0, " StorageType:\t%s\n", api.StorageTypeEphemeral)
} else {
w.Write(LEVEL_0, " StorageType:\t%s\n", api.StorageTypeDurable)
}
if pvcSpec == nil {
w.Write(LEVEL_0, "No volumes.\n")
return
Expand Down

0 comments on commit f8cbb72

Please sign in to comment.