Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.
Open
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
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ $ pi --user=user2 --region=gcp-us-central1 info

//use specified user and server
$ pi --server=https://gcp-us-central1.hyper.sh:443 --user=user3 info

//change default zone
$ pi config set-default-zone user3 --region=gcp-us-central1 --zone=gcp-us-central1-b
```


Expand Down Expand Up @@ -556,6 +559,20 @@ nginx-data gcp-us-central1-a 1 2018-04-27T15:24:31+00:00 nginx-with-v

## pod operation

### pod create

> create pod via command line

```
$ pi create pod busybox --image=busybox

//specify pod size
$ pi create pod busybox --image=busybox --size=s1

//specify zone to run pod
$ pi create pod busybox --image=busybox --zone=gcp-us-central1-b
```

### pod exec

> exec command in running pod
Expand Down
2 changes: 1 addition & 1 deletion examples/pod/pod-with-zone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ spec:
- name: busybox
image: busybox
nodeSelector:
zone: gcp-us-central1-a
zone: gcp-us-central1-b
10 changes: 5 additions & 5 deletions pkg/pi/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,10 @@ __custom_func() {

var (
bash_completion_flags = map[string]string{
//"namespace": "__pi_get_resource_namespace",
//"context": "__pi_config_get_contexts",
//"cluster": "__pi_config_get_clusters",
//"user": "__pi_config_get_users",
//"namespace": "__pi_get_resource_namespace",
//"context": "__pi_config_get_contexts",
//"cluster": "__pi_config_get_clusters",
//"user": "__pi_config_get_users",
}
)

Expand Down Expand Up @@ -257,7 +257,7 @@ func NewPiCommand(f cmdutil.Factory, in io.Reader, out, err io.Writer) *cobra.Co

cmds.AddCommand(NewCmdOptions(out))
cmds.AddCommand(NewCmdInfo(f, out, err))
cmds.AddCommand(cmdconfig.NewCmdConfig(clientcmd.NewDefaultPathOptions(), out, err))
cmds.AddCommand(cmdconfig.NewCmdConfig(clientcmd.NewDefaultPathOptions(), out, err, f))
return cmds
}

Expand Down
5 changes: 4 additions & 1 deletion pkg/pi/cmd/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
)

// NewCmdConfig creates a command object for the "config" action, and adds all child commands to it.
func NewCmdConfig(pathOptions *clientcmd.PathOptions, out, errOut io.Writer) *cobra.Command {
func NewCmdConfig(pathOptions *clientcmd.PathOptions, out, errOut io.Writer, f cmdutil.Factory) *cobra.Command {
if len(pathOptions.ExplicitFileFlag) == 0 {
pathOptions.ExplicitFileFlag = clientcmd.RecommendedConfigPathFlag
}
Expand Down Expand Up @@ -75,6 +75,9 @@ func NewCmdConfig(pathOptions *clientcmd.PathOptions, out, errOut io.Writer) *co
//cmd.AddCommand(NewCmdConfigDeleteContext(out, errOut, pathOptions))
//cmd.AddCommand(NewCmdConfigRenameContext(out, pathOptions))
cmd.AddCommand(NewCmdConfigDeleteAuthInfo(out, errOut, pathOptions))

cmd.AddCommand(NewCmdConfigSetDefaultZone(f, out, pathOptions))

return cmd
}

Expand Down
Loading