Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show snapshot list in dormantdatabase description #33

Merged
merged 4 commits into from
May 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion docs/kubedb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@ Troubleshooting and Debugging Commands:
Other Commands:
help Help about any command

Use "kubedb <command> --help" for more information about a given command..
Usage:
kubedb [flags] [options]

Use "kubedb <command> --help" for more information about a given command.
```
2 changes: 1 addition & 1 deletion docs/kubedb/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Options:
-R, --recursive=false: Process the directory used in -f, --filename recursively.

Usage:
kubedb create [options]
kubedb create [flags] [options]

Use "kubedb create options" for a list of global command-line options (applies to all commands).
```
Expand Down
2 changes: 1 addition & 1 deletion docs/kubedb/delete.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Options:
-l, --selector='': Selector (label query) to filter on.

Usage:
kubedb delete ([-f FILENAME] | TYPE [(NAME | -l label)]) [options]
kubedb delete ([-f FILENAME] | TYPE [(NAME | -l label)]) [flags] [options]

Use "kubedb delete options" for a list of global command-line options (applies to all commands).
```
Expand Down
6 changes: 3 additions & 3 deletions docs/kubedb/describe.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ description of a given resource or group of resources.Valid resource types inclu
* elastic
* postgres
* snapshot
* dormantDatabase
* dormantdatabase

Examples:
# Describe a elastic
Expand All @@ -23,15 +23,15 @@ Examples:
# Describe a postgres
kubedb describe pg/postgres-demo

# Describe all dormantDatabases
# Describe all dormantdatabases
kubedb describe drmn

Options:
--all-namespaces=false: If present, list the requested object(s) across all namespaces.
--show-events=true: If true, display events related to the described object.

Usage:
kubedb describe (TYPE [NAME_PREFIX] | TYPE/NAME) [options]
kubedb describe (TYPE [NAME_PREFIX] | TYPE/NAME) [flags] [options]

Use "kubedb describe options" for a list of global command-line options (applies to all commands).
```
Expand Down
8 changes: 4 additions & 4 deletions docs/kubedb/get.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Valid resource types include:
* elastic
* postgres
* snapshot
* dormantDatabase
* dormantdatabase

Examples:
# List all elastic in ps output format.
Expand Down Expand Up @@ -45,7 +45,7 @@ context is ignored even if specified with --namespace.
--show-labels=false: When printing, show all labels as the last column (default hide labels column)

Usage:
kubedb get [options]
kubedb get [flags] [options]

Use "kubedb get options" for a list of global command-line options (applies to all commands).
```
Expand Down Expand Up @@ -74,8 +74,8 @@ pg/postgres-demo Running 1h
NAME STATUS AGE
snap/snapshot-xyz Succeeded 27m

NAME STATUS AGE
drmn/e2e-elastic-v4xgwz Deleted 9m
NAME STATUS AGE
drmn/e2e-elastic-v4xgwz Paused 9m
```

##### Get Postgres with labels
Expand Down
8 changes: 4 additions & 4 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/cmd/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func NewCmdDelete(out, errOut io.Writer) *cobra.Command {

cmd := &cobra.Command{
Use: "delete ([-f FILENAME] | TYPE [(NAME | -l label)])",
Short: "Delete resources by file names, stdin, resources and names, or by resources and label selector",
Short: "Delete resources by filenames, stdin, resources and names, or by resources and label selector",
Long: delete_long,
Example: delete_example,
Run: func(cmd *cobra.Command, args []string) {
Expand Down Expand Up @@ -83,7 +83,7 @@ func RunDelete(f cmdutil.Factory, cmd *cobra.Command, out io.Writer, args []stri
NamespaceParam(cmdNamespace).DefaultNamespace().
FilenameParam(enforceNamespace, options).
SelectorParam(cmdutil.GetFlagString(cmd, "selector")).
ResourceTypeOrNameArgs(true, args...).RequireObject(true).
ResourceTypeOrNameArgs(false, args...).RequireObject(true).
Flatten().
Do()
err = r.Err()
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var (
# Describe a postgres
kubedb describe pg/postgres-demo

# Describe all dormantDatabases
# Describe all dormantdatabases
kubedb describe drmn`)
)

Expand Down
18 changes: 18 additions & 0 deletions pkg/cmd/describer/k8sdb_describer.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,20 @@ func (d *humanReadableDescriber) describeDormantDatabase(item *tapi.DormantDatab
return "", err
}

snapshots, err := d.extensionsClient.Snapshots(item.Namespace).List(
kapi.ListOptions{
LabelSelector: labels.SelectorFromSet(
map[string]string{
LabelDatabaseKind: item.Labels[LabelDatabaseKind],
LabelDatabaseName: item.Name,
},
),
},
)
if err != nil {
return "", err
}

var events *kapi.EventList
if describerSettings.ShowEvents {
if ref, err := kapi.GetReference(item); err != nil {
Expand Down Expand Up @@ -239,6 +253,10 @@ func (d *humanReadableDescriber) describeDormantDatabase(item *tapi.DormantDatab

describeOrigin(item.Spec.Origin, out)

if item.Status.Phase != tapi.DormantDatabasePhaseWipedOut {
listSnapshots(snapshots, out)
}

if events != nil {
describeEvents(events, out)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const (
* elastic
* postgres
* snapshot
* dormantDatabase
* dormantdatabase
`
)

Expand Down
49 changes: 25 additions & 24 deletions vendor/github.com/spf13/cobra/command.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions vendor/k8s.io/kubernetes/pkg/version/base.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.