... | ... |
@@ -14,27 +14,26 @@ import ( |
14 | 14 |
"github.com/openshift/origin/pkg/bootstrap/docker/dockerhelper" |
15 | 15 |
"github.com/openshift/origin/pkg/bootstrap/docker/errors" |
16 | 16 |
"github.com/openshift/origin/pkg/bootstrap/docker/openshift" |
17 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
17 | 18 |
osclientcmd "github.com/openshift/origin/pkg/cmd/util/clientcmd" |
18 | 19 |
dockerutil "github.com/openshift/origin/pkg/cmd/util/docker" |
19 | 20 |
) |
20 | 21 |
|
21 |
-const ( |
|
22 |
- cmdDownLong = ` |
|
23 |
-Stops the container running OpenShift on Docker and associated containers. |
|
22 |
+const CmdDownRecommendedName = "down" |
|
24 | 23 |
|
25 |
-If you started your OpenShift with a specific docker-machine, you need to specify the |
|
26 |
-same machine using the --docker-machine argument. |
|
27 |
-` |
|
24 |
+var ( |
|
25 |
+ cmdDownLong = templates.LongDesc(` |
|
26 |
+ Stops the container running OpenShift on Docker and associated containers. |
|
28 | 27 |
|
29 |
- cmdDownExample = ` |
|
30 |
- # Stop local Docker cluster |
|
31 |
- %[1]s |
|
28 |
+ If you started your OpenShift with a specific docker-machine, you need to specify the |
|
29 |
+ same machine using the --docker-machine argument.`) |
|
32 | 30 |
|
33 |
- # Stop cluster running on Docker machine 'mymachine' |
|
34 |
- %[1]s --docker-machine=mymachine |
|
35 |
-` |
|
31 |
+ cmdDownExample = templates.Examples(` |
|
32 |
+ # Stop local Docker cluster |
|
33 |
+ %[1]s |
|
36 | 34 |
|
37 |
- CmdDownRecommendedName = "down" |
|
35 |
+ # Stop cluster running on Docker machine 'mymachine' |
|
36 |
+ %[1]s --docker-machine=mymachine`) |
|
38 | 37 |
) |
39 | 38 |
|
40 | 39 |
type ClientStopConfig struct { |
... | ... |
@@ -26,6 +26,7 @@ import ( |
26 | 26 |
"github.com/openshift/origin/pkg/bootstrap/docker/openshift" |
27 | 27 |
"github.com/openshift/origin/pkg/client" |
28 | 28 |
configapi "github.com/openshift/origin/pkg/cmd/server/api" |
29 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
29 | 30 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
30 | 31 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
31 | 32 |
osclientcmd "github.com/openshift/origin/pkg/cmd/util/clientcmd" |
... | ... |
@@ -53,42 +54,41 @@ const ( |
53 | 53 |
|
54 | 54 |
defaultImages = "openshift/origin-${component}:${version}" |
55 | 55 |
defaultOpenShiftImage = "openshift/origin:${version}" |
56 |
+) |
|
56 | 57 |
|
57 |
- cmdUpLong = ` |
|
58 |
-Starts an OpenShift cluster using Docker containers, provisioning a registry, router, |
|
59 |
-initial templates, and a default project. |
|
58 |
+var ( |
|
59 |
+ cmdUpLong = templates.LongDesc(` |
|
60 |
+ Starts an OpenShift cluster using Docker containers, provisioning a registry, router, |
|
61 |
+ initial templates, and a default project. |
|
60 | 62 |
|
61 |
-This command will attempt to use an existing connection to a Docker daemon. Before running |
|
62 |
-the command, ensure that you can execure docker commands successfully (ie. 'docker ps'). |
|
63 |
+ This command will attempt to use an existing connection to a Docker daemon. Before running |
|
64 |
+ the command, ensure that you can execure docker commands successfully (ie. 'docker ps'). |
|
63 | 65 |
|
64 |
-Optionally, the command can create a new Docker machine for OpenShift using the VirtualBox |
|
65 |
-driver when the --create-machine argument is specified. The machine will be named 'openshift' |
|
66 |
-by default. To name the machine differently, use the --docker-machine=NAME argument. If the |
|
67 |
-to find an existing docker machine with that name and start it if it's not running. |
|
66 |
+ Optionally, the command can create a new Docker machine for OpenShift using the VirtualBox |
|
67 |
+ driver when the --create-machine argument is specified. The machine will be named 'openshift' |
|
68 |
+ by default. To name the machine differently, use the --docker-machine=NAME argument. If the |
|
69 |
+ --docker-machine=NAME argument is specified, but --create-machine is not, the command will attempt |
|
70 |
+ to find an existing docker machine with that name and start it if it's not running. |
|
68 | 71 |
|
69 |
-By default, the OpenShift cluster will be setup to use a routing suffix that ends in xip.io. |
|
70 |
-This is to allow dynamic host names to be created for routes. An alternate routing suffix |
|
71 |
-can be specified using the --routing-suffix flag. |
|
72 |
+ By default, the OpenShift cluster will be setup to use a routing suffix that ends in xip.io. |
|
73 |
+ This is to allow dynamic host names to be created for routes. An alternate routing suffix |
|
74 |
+ can be specified using the --routing-suffix flag. |
|
72 | 75 |
|
73 |
-A public hostname can also be specified for the server with the --public-hostname flag. |
|
74 |
-` |
|
75 |
- cmdUpExample = ` |
|
76 |
- # Start OpenShift on a new docker machine named 'openshift' |
|
77 |
- %[1]s --create-machine |
|
76 |
+ A public hostname can also be specified for the server with the --public-hostname flag.`) |
|
78 | 77 |
|
79 |
- # Start OpenShift using a specific public host name |
|
80 |
- %[1]s --public-hostname=my.address.example.com |
|
78 |
+ cmdUpExample = templates.Examples(` |
|
79 |
+ # Start OpenShift on a new docker machine named 'openshift' |
|
80 |
+ %[1]s --create-machine |
|
81 | 81 |
|
82 |
- # Start OpenShift and preserve data and config between restarts |
|
83 |
- %[1]s --host-data-dir=/mydata --use-existing-config |
|
82 |
+ # Start OpenShift using a specific public host name |
|
83 |
+ %[1]s --public-hostname=my.address.example.com |
|
84 | 84 |
|
85 |
- # Use a different set of images |
|
86 |
- %[1]s --image="registry.example.com/origin" --version="v1.1" |
|
87 |
-` |
|
88 |
-) |
|
85 |
+ # Start OpenShift and preserve data and config between restarts |
|
86 |
+ %[1]s --host-data-dir=/mydata --use-existing-config |
|
87 |
+ |
|
88 |
+ # Use a different set of images |
|
89 |
+ %[1]s --image="registry.example.com/origin" --version="v1.1"`) |
|
89 | 90 |
|
90 |
-var ( |
|
91 | 91 |
imageStreamLocations = map[string]string{ |
92 | 92 |
"origin centos7 image streams": "examples/image-streams/image-streams-centos7.json", |
93 | 93 |
} |
... | ... |
@@ -31,11 +31,11 @@ import ( |
31 | 31 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
32 | 32 |
) |
33 | 33 |
|
34 |
-const adminLong = ` |
|
35 |
-Administrative Commands |
|
34 |
+var adminLong = templates.LongDesc(` |
|
35 |
+ Administrative Commands |
|
36 | 36 |
|
37 |
-Commands for managing a cluster are exposed here. Many administrative |
|
38 |
-actions involve interaction with the command-line client as well.` |
|
37 |
+ Commands for managing a cluster are exposed here. Many administrative |
|
38 |
+ actions involve interaction with the command-line client as well.`) |
|
39 | 39 |
|
40 | 40 |
func NewCommandAdmin(name, fullName string, in io.Reader, out io.Writer, errout io.Writer) *cobra.Command { |
41 | 41 |
// Main command |
... | ... |
@@ -72,10 +72,10 @@ func NewCommandAdmin(name, fullName string, in io.Reader, out io.Writer, errout |
72 | 72 |
Commands: []*cobra.Command{ |
73 | 73 |
admin.NewCommandNodeConfig(admin.NodeConfigCommandName, fullName+" "+admin.NodeConfigCommandName, out), |
74 | 74 |
node.NewCommandManageNode(f, node.ManageNodeCommandName, fullName+" "+node.ManageNodeCommandName, out, errout), |
75 |
- cmdutil.ReplaceCommandName("kubectl", fullName, kubectl.NewCmdCordon(f.Factory, out)), |
|
76 |
- cmdutil.ReplaceCommandName("kubectl", fullName, kubectl.NewCmdUncordon(f.Factory, out)), |
|
77 |
- cmdutil.ReplaceCommandName("kubectl", fullName, kubectl.NewCmdDrain(f.Factory, out)), |
|
78 |
- cmdutil.ReplaceCommandName("kubectl", fullName, kubectl.NewCmdTaint(f.Factory, out)), |
|
75 |
+ cmdutil.ReplaceCommandName("kubectl", fullName, templates.Normalize(kubectl.NewCmdCordon(f.Factory, out))), |
|
76 |
+ cmdutil.ReplaceCommandName("kubectl", fullName, templates.Normalize(kubectl.NewCmdUncordon(f.Factory, out))), |
|
77 |
+ cmdutil.ReplaceCommandName("kubectl", fullName, templates.Normalize(kubectl.NewCmdDrain(f.Factory, out))), |
|
78 |
+ cmdutil.ReplaceCommandName("kubectl", fullName, templates.Normalize(kubectl.NewCmdTaint(f.Factory, out))), |
|
79 | 79 |
network.NewCmdPodNetwork(network.PodNetworkCommandName, fullName+" "+network.PodNetworkCommandName, f, out), |
80 | 80 |
}, |
81 | 81 |
}, |
... | ... |
@@ -17,6 +17,7 @@ import ( |
17 | 17 |
"github.com/openshift/origin/pkg/cmd/admin/diagnostics/options" |
18 | 18 |
"github.com/openshift/origin/pkg/cmd/cli/config" |
19 | 19 |
"github.com/openshift/origin/pkg/cmd/flagtypes" |
20 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
20 | 21 |
osclientcmd "github.com/openshift/origin/pkg/cmd/util/clientcmd" |
21 | 22 |
"github.com/openshift/origin/pkg/cmd/util/variable" |
22 | 23 |
"github.com/openshift/origin/pkg/diagnostics/log" |
... | ... |
@@ -51,41 +52,40 @@ type DiagnosticsOptions struct { |
51 | 51 |
} |
52 | 52 |
|
53 | 53 |
const ( |
54 |
+ DiagnosticsRecommendedName = "diagnostics" |
|
55 |
+ |
|
54 | 56 |
// Standard locations for the host config files OpenShift uses. |
55 | 57 |
StandardMasterConfigPath string = "/etc/origin/master/master-config.yaml" |
56 | 58 |
StandardNodeConfigPath string = "/etc/origin/node/node-config.yaml" |
57 | 59 |
) |
58 | 60 |
|
59 |
-const ( |
|
60 |
- DiagnosticsRecommendedName = "diagnostics" |
|
61 |
- longDescription = ` |
|
62 |
-This utility helps troubleshoot and diagnose known problems. It runs |
|
63 |
-diagnostics using a client and/or the state of a running master / |
|
64 |
-node host. |
|
65 |
- |
|
66 |
- %[1]s |
|
67 |
- |
|
68 |
-If run without flags, it will check for standard config files for |
|
69 |
-client, master, and node, and if found, use them for diagnostics. |
|
70 |
-You may also specify config files explicitly with flags, in which case |
|
71 |
-you will receive an error if they are not found. For example: |
|
72 |
- |
|
73 |
- %[1]s --master-config=/etc/origin/master/master-config.yaml |
|
74 |
- |
|
75 |
-* If master/node config files are not found and the --host flag is not |
|
76 |
- present, host diagnostics are skipped. |
|
77 |
-* If the client has cluster-admin access, this access enables cluster |
|
78 |
- diagnostics to run which regular users cannot. |
|
79 |
-* If a client config file is not found, client and cluster diagnostics |
|
80 |
- are skipped. |
|
81 |
- |
|
82 |
-Diagnostics may be individually run by passing diagnostic name as arguments. |
|
83 |
- |
|
84 |
- %[1]s <DiagnosticName> |
|
85 |
- |
|
86 |
-The available diagnostic names are: |
|
87 |
-%[2]s |
|
88 |
-` |
|
61 |
+var ( |
|
62 |
+ longDescription = templates.LongDesc(` |
|
63 |
+ This utility helps troubleshoot and diagnose known problems. It runs |
|
64 |
+ diagnostics using a client and/or the state of a running master / |
|
65 |
+ node host. |
|
66 |
+ |
|
67 |
+ %[1]s |
|
68 |
+ |
|
69 |
+ If run without flags, it will check for standard config files for |
|
70 |
+ client, master, and node, and if found, use them for diagnostics. |
|
71 |
+ You may also specify config files explicitly with flags, in which case |
|
72 |
+ you will receive an error if they are not found. For example: |
|
73 |
+ |
|
74 |
+ %[1]s --master-config=/etc/origin/master/master-config.yaml |
|
75 |
+ |
|
76 |
+ * If master/node config files are not found and the --host flag is not |
|
77 |
+ present, host diagnostics are skipped. |
|
78 |
+ * If the client has cluster-admin access, this access enables cluster |
|
79 |
+ diagnostics to run which regular users cannot. |
|
80 |
+ * If a client config file is not found, client and cluster diagnostics |
|
81 |
+ are skipped. |
|
82 |
+ |
|
83 |
+ Diagnostics may be individually run by passing diagnostic name as arguments. |
|
84 |
+ |
|
85 |
+ %[1]s <DiagnosticName> |
|
86 |
+ |
|
87 |
+ The available diagnostic names are: %[2]s.`) |
|
89 | 88 |
) |
90 | 89 |
|
91 | 90 |
// NewCmdDiagnostics is the base command for running any diagnostics. |
... | ... |
@@ -99,7 +99,7 @@ func NewCmdDiagnostics(name string, fullName string, out io.Writer) *cobra.Comma |
99 | 99 |
cmd := &cobra.Command{ |
100 | 100 |
Use: name, |
101 | 101 |
Short: "Diagnose common cluster problems", |
102 |
- Long: fmt.Sprintf(longDescription, fullName, strings.Join(availableDiagnostics().List(), " ")), |
|
102 |
+ Long: fmt.Sprintf(longDescription, fullName, strings.Join(availableDiagnostics().List(), ", ")), |
|
103 | 103 |
Run: func(c *cobra.Command, args []string) { |
104 | 104 |
kcmdutil.CheckErr(o.Complete(args)) |
105 | 105 |
|
... | ... |
@@ -13,6 +13,7 @@ import ( |
13 | 13 |
"k8s.io/kubernetes/pkg/util/sets" |
14 | 14 |
|
15 | 15 |
"github.com/openshift/origin/pkg/cmd/admin/diagnostics/options" |
16 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
16 | 17 |
"github.com/openshift/origin/pkg/diagnostics/log" |
17 | 18 |
poddiag "github.com/openshift/origin/pkg/diagnostics/pod" |
18 | 19 |
"github.com/openshift/origin/pkg/diagnostics/types" |
... | ... |
@@ -36,10 +37,9 @@ const ( |
36 | 36 |
StandardMasterUrl = "https://kubernetes.default.svc.cluster.local" |
37 | 37 |
) |
38 | 38 |
|
39 |
-const longPodDiagDescription = ` |
|
40 |
-This utility is intended to run diagnostics inside a container and |
|
41 |
-log the results so that the calling diagnostic can report them. |
|
42 |
-` |
|
39 |
+var longPodDiagDescription = templates.LongDesc(` |
|
40 |
+ This utility is intended to run diagnostics inside a container and |
|
41 |
+ log the results so that the calling diagnostic can report them.`) |
|
43 | 42 |
|
44 | 43 |
// NewCommandPodDiagnostics is the command for running pod diagnostics. |
45 | 44 |
func NewCommandPodDiagnostics(name string, out io.Writer) *cobra.Command { |
... | ... |
@@ -11,29 +11,33 @@ import ( |
11 | 11 |
"github.com/spf13/cobra" |
12 | 12 |
|
13 | 13 |
"github.com/openshift/origin/pkg/client" |
14 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
14 | 15 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
15 | 16 |
) |
16 | 17 |
|
17 | 18 |
const ( |
18 |
- AddRecommendedName = "add-users" |
|
19 |
- addLong = ` |
|
20 |
-Add users to a group. |
|
19 |
+ AddRecommendedName = "add-users" |
|
20 |
+ RemoveRecommendedName = "remove-users" |
|
21 |
+) |
|
21 | 22 |
|
22 |
-This command will append unique users to the list of members for a group.` |
|
23 |
+var ( |
|
24 |
+ addLong = templates.LongDesc(` |
|
25 |
+ Add users to a group. |
|
23 | 26 |
|
24 |
- addExample = ` # Add user1 and user2 to my-group |
|
25 |
- %[1]s my-group user1 user2` |
|
26 |
-) |
|
27 |
+ This command will append unique users to the list of members for a group.`) |
|
27 | 28 |
|
28 |
-const ( |
|
29 |
- RemoveRecommendedName = "remove-users" |
|
30 |
- removeLong = ` |
|
31 |
-Remove users from a group. |
|
29 |
+ addExample = templates.Examples(` |
|
30 |
+ # Add user1 and user2 to my-group |
|
31 |
+ %[1]s my-group user1 user2`) |
|
32 |
+ |
|
33 |
+ removeLong = templates.LongDesc(` |
|
34 |
+ Remove users from a group. |
|
32 | 35 |
|
33 |
-This command will remove users from the list of members for a group.` |
|
36 |
+ This command will remove users from the list of members for a group.`) |
|
34 | 37 |
|
35 |
- removeExample = ` # Remove user1 and user2 from my-group |
|
36 |
- %[1]s my-group user1 user2` |
|
38 |
+ removeExample = templates.Examples(` |
|
39 |
+ # Remove user1 and user2 from my-group |
|
40 |
+ %[1]s my-group user1 user2`) |
|
37 | 41 |
) |
38 | 42 |
|
39 | 43 |
type GroupModificationOptions struct { |
... | ... |
@@ -6,18 +6,17 @@ import ( |
6 | 6 |
"github.com/spf13/cobra" |
7 | 7 |
|
8 | 8 |
"github.com/openshift/origin/pkg/cmd/admin/groups/sync/cli" |
9 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
9 | 10 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
10 | 11 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
11 | 12 |
) |
12 | 13 |
|
13 | 14 |
const GroupsRecommendedName = "groups" |
14 | 15 |
|
15 |
-const ( |
|
16 |
- groupLong = ` |
|
17 |
-Manage groups in your cluster |
|
16 |
+var groupLong = templates.LongDesc(` |
|
17 |
+ Manage groups in your cluster |
|
18 | 18 |
|
19 |
-Groups are sets of users that can be used when describing policy.` |
|
20 |
-) |
|
19 |
+ Groups are sets of users that can be used when describing policy.`) |
|
21 | 20 |
|
22 | 21 |
func NewCmdGroups(name, fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command { |
23 | 22 |
// Parent command to which all subcommands are added. |
... | ... |
@@ -13,25 +13,28 @@ import ( |
13 | 13 |
"github.com/spf13/cobra" |
14 | 14 |
|
15 | 15 |
"github.com/openshift/origin/pkg/client" |
16 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
16 | 17 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
17 | 18 |
userapi "github.com/openshift/origin/pkg/user/api" |
18 | 19 |
) |
19 | 20 |
|
20 |
-const ( |
|
21 |
- NewGroupRecommendedName = "new" |
|
22 |
- newLong = ` |
|
23 |
-Create a new group. |
|
21 |
+const NewGroupRecommendedName = "new" |
|
24 | 22 |
|
25 |
-This command will create a new group with an optional list of users.` |
|
23 |
+var ( |
|
24 |
+ newLong = templates.LongDesc(` |
|
25 |
+ Create a new group. |
|
26 | 26 |
|
27 |
- newExample = ` # Add a group with no users |
|
28 |
- %[1]s my-group |
|
27 |
+ This command will create a new group with an optional list of users.`) |
|
29 | 28 |
|
30 |
- # Add a group with two users |
|
31 |
- %[1]s my-group user1 user2 |
|
29 |
+ newExample = templates.Examples(` |
|
30 |
+ # Add a group with no users |
|
31 |
+ %[1]s my-group |
|
32 | 32 |
|
33 |
- # Add a group with one user and shorter output |
|
34 |
- %[1]s my-group user1 -o name` |
|
33 |
+ # Add a group with two users |
|
34 |
+ %[1]s my-group user1 user2 |
|
35 |
+ |
|
36 |
+ # Add a group with one user and shorter output |
|
37 |
+ %[1]s my-group user1 -o name`) |
|
35 | 38 |
) |
36 | 39 |
|
37 | 40 |
type NewGroupOptions struct { |
... | ... |
@@ -18,35 +18,36 @@ import ( |
18 | 18 |
"github.com/openshift/origin/pkg/cmd/admin/groups/sync" |
19 | 19 |
"github.com/openshift/origin/pkg/cmd/server/api" |
20 | 20 |
"github.com/openshift/origin/pkg/cmd/server/api/validation" |
21 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
21 | 22 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
22 | 23 |
) |
23 | 24 |
|
24 |
-const ( |
|
25 |
- PruneRecommendedName = "prune" |
|
25 |
+const PruneRecommendedName = "prune" |
|
26 | 26 |
|
27 |
- pruneLong = ` |
|
28 |
-Prune OpenShift Groups referencing missing records on from an external provider. |
|
27 |
+var ( |
|
28 |
+ pruneLong = templates.LongDesc(` |
|
29 |
+ Prune OpenShift Groups referencing missing records on from an external provider. |
|
29 | 30 |
|
30 |
-In order to prune OpenShift Group records using those from an external provider, determine which Groups you wish |
|
31 |
-to prune. For instance, all or some groups may be selected from the current Groups stored in OpenShift that have |
|
32 |
-been synced previously. Any combination of a literal whitelist, a whitelist file and a blacklist file is supported. |
|
33 |
-The path to a sync configuration file that was used for syncing the groups in question is required in order to |
|
34 |
-describe how data is requested from the external record store. Default behavior is to indicate all OpenShift groups |
|
35 |
-for which the external record does not exist, to run the pruning process and commit the results, use the --confirm |
|
36 |
-flag. |
|
37 |
-` |
|
38 |
- pruneExamples = ` # Prune all orphaned groups |
|
39 |
- %[1]s --sync-config=/path/to/ldap-sync-config.yaml --confirm |
|
31 |
+ In order to prune OpenShift Group records using those from an external provider, determine which Groups you wish |
|
32 |
+ to prune. For instance, all or some groups may be selected from the current Groups stored in OpenShift that have |
|
33 |
+ been synced previously. Any combination of a literal whitelist, a whitelist file and a blacklist file is supported. |
|
34 |
+ The path to a sync configuration file that was used for syncing the groups in question is required in order to |
|
35 |
+ describe how data is requested from the external record store. Default behavior is to indicate all OpenShift groups |
|
36 |
+ for which the external record does not exist, to run the pruning process and commit the results, use the --confirm |
|
37 |
+ flag.`) |
|
40 | 38 |
|
41 |
- # Prune all orphaned groups except the ones from the blacklist file |
|
42 |
- %[1]s --blacklist=/path/to/blacklist.txt --sync-config=/path/to/ldap-sync-config.yaml --confirm |
|
39 |
+ pruneExamples = templates.Examples(` |
|
40 |
+ # Prune all orphaned groups |
|
41 |
+ %[1]s --sync-config=/path/to/ldap-sync-config.yaml --confirm |
|
43 | 42 |
|
44 |
- # Prune all orphaned groups from a list of specific groups specified in a whitelist file |
|
45 |
- %[1]s --whitelist=/path/to/whitelist.txt --sync-config=/path/to/ldap-sync-config.yaml --confirm |
|
43 |
+ # Prune all orphaned groups except the ones from the blacklist file |
|
44 |
+ %[1]s --blacklist=/path/to/blacklist.txt --sync-config=/path/to/ldap-sync-config.yaml --confirm |
|
46 | 45 |
|
47 |
- # Prune all orphaned groups from a list of specific groups specified in a whitelist |
|
48 |
- %[1]s groups/group_name groups/other_name --sync-config=/path/to/ldap-sync-config.yaml --confirm |
|
49 |
-` |
|
46 |
+ # Prune all orphaned groups from a list of specific groups specified in a whitelist file |
|
47 |
+ %[1]s --whitelist=/path/to/whitelist.txt --sync-config=/path/to/ldap-sync-config.yaml --confirm |
|
48 |
+ |
|
49 |
+ # Prune all orphaned groups from a list of specific groups specified in a whitelist |
|
50 |
+ %[1]s groups/group_name groups/other_name --sync-config=/path/to/ldap-sync-config.yaml --confirm`) |
|
50 | 51 |
) |
51 | 52 |
|
52 | 53 |
type PruneOptions struct { |
... | ... |
@@ -27,39 +27,40 @@ import ( |
27 | 27 |
"github.com/openshift/origin/pkg/cmd/server/api" |
28 | 28 |
configapilatest "github.com/openshift/origin/pkg/cmd/server/api/latest" |
29 | 29 |
"github.com/openshift/origin/pkg/cmd/server/api/validation" |
30 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
30 | 31 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
31 | 32 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
32 | 33 |
) |
33 | 34 |
|
34 |
-const ( |
|
35 |
- SyncRecommendedName = "sync" |
|
36 |
- |
|
37 |
- syncLong = ` |
|
38 |
-Sync OpenShift Groups with records from an external provider. |
|
39 |
- |
|
40 |
-In order to sync OpenShift Group records with those from an external provider, determine which Groups you wish |
|
41 |
-to sync and where their records live. For instance, all or some groups may be selected from the current Groups |
|
42 |
-stored in OpenShift that have been synced previously, or similarly all or some groups may be selected from those |
|
43 |
-stored on an LDAP server. The path to a sync configuration file is required in order to describe how data is |
|
44 |
-requested from the external record store and migrated to OpenShift records. Default behavior is to do a dry-run |
|
45 |
-without changing OpenShift records. Passing '--confirm' will sync all groups from the LDAP server returned by the |
|
46 |
-LDAP query templates. |
|
47 |
-` |
|
48 |
- syncExamples = ` # Sync all groups from an LDAP server |
|
49 |
- %[1]s --sync-config=/path/to/ldap-sync-config.yaml --confirm |
|
50 |
- |
|
51 |
- # Sync all groups except the ones from the blacklist file from an LDAP server |
|
52 |
- %[1]s --blacklist=/path/to/blacklist.txt --sync-config=/path/to/ldap-sync-config.yaml --confirm |
|
53 |
- |
|
54 |
- # Sync specific groups specified in a whitelist file with an LDAP server |
|
55 |
- %[1]s --whitelist=/path/to/whitelist.txt --sync-config=/path/to/sync-config.yaml --confirm |
|
56 |
- |
|
57 |
- # Sync all OpenShift Groups that have been synced previously with an LDAP server |
|
58 |
- %[1]s --type=openshift --sync-config=/path/to/ldap-sync-config.yaml --confirm |
|
59 |
- |
|
60 |
- # Sync specific OpenShift Groups if they have been synced previously with an LDAP server |
|
61 |
- %[1]s groups/group1 groups/group2 groups/group3 --sync-config=/path/to/sync-config.yaml --confirm |
|
62 |
-` |
|
35 |
+const SyncRecommendedName = "sync" |
|
36 |
+ |
|
37 |
+var ( |
|
38 |
+ syncLong = templates.LongDesc(` |
|
39 |
+ Sync OpenShift Groups with records from an external provider. |
|
40 |
+ |
|
41 |
+ In order to sync OpenShift Group records with those from an external provider, determine which Groups you wish |
|
42 |
+ to sync and where their records live. For instance, all or some groups may be selected from the current Groups |
|
43 |
+ stored in OpenShift that have been synced previously, or similarly all or some groups may be selected from those |
|
44 |
+ stored on an LDAP server. The path to a sync configuration file is required in order to describe how data is |
|
45 |
+ requested from the external record store and migrated to OpenShift records. Default behavior is to do a dry-run |
|
46 |
+ without changing OpenShift records. Passing '--confirm' will sync all groups from the LDAP server returned by the |
|
47 |
+ LDAP query templates.`) |
|
48 |
+ |
|
49 |
+ syncExamples = templates.Examples(` |
|
50 |
+ # Sync all groups from an LDAP server |
|
51 |
+ %[1]s --sync-config=/path/to/ldap-sync-config.yaml --confirm |
|
52 |
+ |
|
53 |
+ # Sync all groups except the ones from the blacklist file from an LDAP server |
|
54 |
+ %[1]s --blacklist=/path/to/blacklist.txt --sync-config=/path/to/ldap-sync-config.yaml --confirm |
|
55 |
+ |
|
56 |
+ # Sync specific groups specified in a whitelist file with an LDAP server |
|
57 |
+ %[1]s --whitelist=/path/to/whitelist.txt --sync-config=/path/to/sync-config.yaml --confirm |
|
58 |
+ |
|
59 |
+ # Sync all OpenShift Groups that have been synced previously with an LDAP server |
|
60 |
+ %[1]s --type=openshift --sync-config=/path/to/ldap-sync-config.yaml --confirm |
|
61 |
+ |
|
62 |
+ # Sync specific OpenShift Groups if they have been synced previously with an LDAP server |
|
63 |
+ %[1]s groups/group1 groups/group2 groups/group3 --sync-config=/path/to/sync-config.yaml --confirm`) |
|
63 | 64 |
) |
64 | 65 |
|
65 | 66 |
// GroupSyncSource determines the source of the groups to be synced |
... | ... |
@@ -18,49 +18,56 @@ import ( |
18 | 18 |
buildapi "github.com/openshift/origin/pkg/build/api" |
19 | 19 |
"github.com/openshift/origin/pkg/client" |
20 | 20 |
"github.com/openshift/origin/pkg/cmd/admin/migrate" |
21 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
22 |
+ |
|
21 | 23 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
22 | 24 |
imageapi "github.com/openshift/origin/pkg/image/api" |
23 | 25 |
) |
24 | 26 |
|
25 |
-const ( |
|
26 |
- internalMigrateImagesLong = ` |
|
27 |
-Migrate references to Docker images |
|
27 |
+var ( |
|
28 |
+ internalMigrateImagesLong = templates.LongDesc(` |
|
29 |
+ Migrate references to Docker images |
|
28 | 30 |
|
29 |
-This command updates embedded Docker image references on the server in place. By default it |
|
30 |
-will update image streams and images, and may be used to update resources with a pod template |
|
31 |
-(deployments, replication controllers, daemon sets). |
|
31 |
+ This command updates embedded Docker image references on the server in place. By default it |
|
32 |
+ will update image streams and images, and may be used to update resources with a pod template |
|
33 |
+ (deployments, replication controllers, daemon sets). |
|
32 | 34 |
|
33 |
-References are changed by providing a mapping between a source registry and name and the |
|
34 |
-desired registry and name. Either name or registry can be set to '*' to change all values. |
|
35 |
-The registry value "docker.io" is special and will handle any image reference that refers to |
|
36 |
-the DockerHub. You may pass multiple mappings - the first matching mapping will be applied |
|
37 |
-per resource. |
|
35 |
+ References are changed by providing a mapping between a source registry and name and the |
|
36 |
+ desired registry and name. Either name or registry can be set to '*' to change all values. |
|
37 |
+ The registry value "docker.io" is special and will handle any image reference that refers to |
|
38 |
+ the DockerHub. You may pass multiple mappings - the first matching mapping will be applied |
|
39 |
+ per resource. |
|
38 | 40 |
|
39 |
-The following resource types may be migrated by this command: |
|
41 |
+ The following resource types may be migrated by this command: |
|
40 | 42 |
|
41 |
-* images * daemonsets |
|
42 |
-* imagestreams * jobs |
|
43 |
-* buildconfigs * replicationcontrollers |
|
44 |
-* deploymentconfigs * pods |
|
45 |
-* secrets (docker) |
|
43 |
+ * buildconfigs |
|
44 |
+ * daemonsets |
|
45 |
+ * deploymentconfigs |
|
46 |
+ * images |
|
47 |
+ * imagestreams |
|
48 |
+ * jobs |
|
49 |
+ * pods |
|
50 |
+ * replicationcontrollers |
|
51 |
+ * secrets (docker) |
|
46 | 52 |
|
47 |
-Only images, imagestreams, and secrets are updated by default. Updating images and image |
|
48 |
-streams requires administrative privileges.` |
|
53 |
+ Only images, imagestreams, and secrets are updated by default. Updating images and image |
|
54 |
+ streams requires administrative privileges.`) |
|
49 | 55 |
|
50 |
- internalMigrateImagesExample = ` # Perform a dry-run of migrating all "docker.io" references to "myregistry.com" |
|
51 |
- %[1]s docker.io/*=myregistry.com/* |
|
56 |
+ internalMigrateImagesExample = templates.Examples(` |
|
57 |
+ # Perform a dry-run of migrating all "docker.io" references to "myregistry.com" |
|
58 |
+ %[1]s docker.io/*=myregistry.com/* |
|
52 | 59 |
|
53 |
- # To actually perform the migration, the confirm flag must be appended |
|
54 |
- %[1]s docker.io/*=myregistry.com/* --confirm |
|
60 |
+ # To actually perform the migration, the confirm flag must be appended |
|
61 |
+ %[1]s docker.io/*=myregistry.com/* --confirm |
|
55 | 62 |
|
56 |
- # To see more details of what will be migrated, use the loglevel and output flags |
|
57 |
- %[1]s docker.io/*=myregistry.com/* --loglevel=2 -o yaml |
|
63 |
+ # To see more details of what will be migrated, use the loglevel and output flags |
|
64 |
+ %[1]s docker.io/*=myregistry.com/* --loglevel=2 -o yaml |
|
58 | 65 |
|
59 |
- # Migrate from a service IP to an internal service DNS name |
|
60 |
- %[1]s 172.30.1.54/*=registry.openshift.svc.cluster.local/* |
|
66 |
+ # Migrate from a service IP to an internal service DNS name |
|
67 |
+ %[1]s 172.30.1.54/*=registry.openshift.svc.cluster.local/* |
|
61 | 68 |
|
62 |
- # Migrate from a service IP to an internal service DNS name for all deployment configs and builds |
|
63 |
- %[1]s 172.30.1.54/*=registry.openshift.svc.cluster.local/* --include=buildconfigs,deploymentconfigs` |
|
69 |
+ # Migrate from a service IP to an internal service DNS name for all deployment configs and builds |
|
70 |
+ %[1]s 172.30.1.54/*=registry.openshift.svc.cluster.local/* --include=buildconfigs,deploymentconfigs`) |
|
64 | 71 |
) |
65 | 72 |
|
66 | 73 |
type MigrateImageReferenceOptions struct { |
... | ... |
@@ -5,15 +5,17 @@ import ( |
5 | 5 |
|
6 | 6 |
"github.com/spf13/cobra" |
7 | 7 |
|
8 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
8 | 9 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
9 | 10 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
10 | 11 |
) |
11 | 12 |
|
12 | 13 |
const MigrateRecommendedName = "migrate" |
13 | 14 |
|
14 |
-const migrateLong = `Migrate resources on the cluster |
|
15 |
+var migrateLong = templates.LongDesc(` |
|
16 |
+ Migrate resources on the cluster |
|
15 | 17 |
|
16 |
-These commands assist administrators in performing preventative maintenance on a cluster.` |
|
18 |
+ These commands assist administrators in performing preventative maintenance on a cluster.`) |
|
17 | 19 |
|
18 | 20 |
func NewCommandMigrate(name, fullName string, f *clientcmd.Factory, out io.Writer, cmds ...*cobra.Command) *cobra.Command { |
19 | 21 |
// Parent command to which all subcommands are added. |
... | ... |
@@ -15,42 +15,43 @@ import ( |
15 | 15 |
"k8s.io/kubernetes/pkg/util/sets" |
16 | 16 |
|
17 | 17 |
"github.com/openshift/origin/pkg/cmd/admin/migrate" |
18 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
18 | 19 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
19 | 20 |
) |
20 | 21 |
|
21 |
-const ( |
|
22 |
- internalMigrateStorageLong = ` |
|
23 |
-Migrate internal object storage via update |
|
22 |
+var ( |
|
23 |
+ internalMigrateStorageLong = templates.LongDesc(` |
|
24 |
+ Migrate internal object storage via update |
|
24 | 25 |
|
25 |
-This command invokes an update operation on every API object reachable by the caller. This forces |
|
26 |
-the server to write to the underlying storage if the object representation has changed. Use this |
|
27 |
-command to ensure that the most recent storage changes have been applied to all objects (storage |
|
28 |
-version, storage encoding, any newer object defaults). |
|
26 |
+ This command invokes an update operation on every API object reachable by the caller. This forces |
|
27 |
+ the server to write to the underlying storage if the object representation has changed. Use this |
|
28 |
+ command to ensure that the most recent storage changes have been applied to all objects (storage |
|
29 |
+ version, storage encoding, any newer object defaults). |
|
29 | 30 |
|
30 |
-To operate on a subset of resources, use the --include flag. If you encounter errors during a run |
|
31 |
-the command will output a list of resources that received errors, which you can then re-run the |
|
32 |
-command on. You may also specify --from-key and --to-key to restrict the set of resource names |
|
33 |
-to operate on (key is NAMESPACE/NAME for resources in namespaces or NAME for cluster scoped |
|
34 |
-resources). --from-key is inclusive if specified, while --to-key is exclusive. |
|
31 |
+ To operate on a subset of resources, use the --include flag. If you encounter errors during a run |
|
32 |
+ the command will output a list of resources that received errors, which you can then re-run the |
|
33 |
+ command on. You may also specify --from-key and --to-key to restrict the set of resource names |
|
34 |
+ to operate on (key is NAMESPACE/NAME for resources in namespaces or NAME for cluster scoped |
|
35 |
+ resources). --from-key is inclusive if specified, while --to-key is exclusive. |
|
35 | 36 |
|
36 |
-By default, events are not migrated since they expire within a very short period of time. If you |
|
37 |
-have significantly increased the expiration time of events, run a migration with --include=events |
|
37 |
+ By default, events are not migrated since they expire within a very short period of time. If you |
|
38 |
+ have significantly increased the expiration time of events, run a migration with --include=events |
|
38 | 39 |
|
39 |
-WARNING: This is a slow command and will put significant load on an API server. It may also |
|
40 |
- result in significant intra-cluster traffic.` |
|
40 |
+ WARNING: This is a slow command and will put significant load on an API server. It may also |
|
41 |
+ result in significant intra-cluster traffic.`) |
|
41 | 42 |
|
42 |
- internalMigrateStorageExample = ` # Perform a dry-run of updating all objects |
|
43 |
- %[1]s |
|
43 |
+ internalMigrateStorageExample = templates.Examples(` |
|
44 |
+ # Perform a dry-run of updating all objects |
|
45 |
+ %[1]s |
|
44 | 46 |
|
45 |
- # To actually perform the update, the confirm flag must be appended |
|
46 |
- %[1]s --confirm |
|
47 |
+ # To actually perform the update, the confirm flag must be appended |
|
48 |
+ %[1]s --confirm |
|
47 | 49 |
|
48 |
- # Only migrate pods |
|
49 |
- %[1]s --include=pods --confirm |
|
50 |
+ # Only migrate pods |
|
51 |
+ %[1]s --include=pods --confirm |
|
50 | 52 |
|
51 |
- # Only pods that are in namespaces starting with "bar" |
|
52 |
- %[1]s --include=pods --confirm --from-key=bar/ --to-key=bar/\xFF |
|
53 |
-` |
|
53 |
+ # Only pods that are in namespaces starting with "bar" |
|
54 |
+ %[1]s --include=pods --confirm --from-key=bar/ --to-key=bar/\xFF`) |
|
54 | 55 |
) |
55 | 56 |
|
56 | 57 |
type MigrateAPIStorageOptions struct { |
... | ... |
@@ -9,23 +9,25 @@ import ( |
9 | 9 |
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" |
10 | 10 |
kerrors "k8s.io/kubernetes/pkg/util/errors" |
11 | 11 |
|
12 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
12 | 13 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
13 | 14 |
sdnapi "github.com/openshift/origin/pkg/sdn/api" |
14 | 15 |
) |
15 | 16 |
|
16 |
-const ( |
|
17 |
- IsolateProjectsNetworkCommandName = "isolate-projects" |
|
17 |
+const IsolateProjectsNetworkCommandName = "isolate-projects" |
|
18 | 18 |
|
19 |
- isolateProjectsNetworkLong = ` |
|
20 |
-Isolate project network |
|
19 |
+var ( |
|
20 |
+ isolateProjectsNetworkLong = templates.LongDesc(` |
|
21 |
+ Isolate project network |
|
21 | 22 |
|
22 |
-Allows projects to isolate their network from other projects when using the %[1]s network plugin.` |
|
23 |
+ Allows projects to isolate their network from other projects when using the %[1]s network plugin.`) |
|
23 | 24 |
|
24 |
- isolateProjectsNetworkExample = ` # Provide isolation for project p1 |
|
25 |
- %[1]s <p1> |
|
25 |
+ isolateProjectsNetworkExample = templates.Examples(` |
|
26 |
+ # Provide isolation for project p1 |
|
27 |
+ %[1]s <p1> |
|
26 | 28 |
|
27 |
- # Allow all projects with label name=top-secret to have their own isolated project network |
|
28 |
- %[1]s --selector='name=top-secret'` |
|
29 |
+ # Allow all projects with label name=top-secret to have their own isolated project network |
|
30 |
+ %[1]s --selector='name=top-secret'`) |
|
29 | 31 |
) |
30 | 32 |
|
31 | 33 |
type IsolateOptions struct { |
... | ... |
@@ -10,23 +10,26 @@ import ( |
10 | 10 |
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" |
11 | 11 |
kerrors "k8s.io/kubernetes/pkg/util/errors" |
12 | 12 |
|
13 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
13 | 14 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
15 |
+ |
|
14 | 16 |
sdnapi "github.com/openshift/origin/pkg/sdn/api" |
15 | 17 |
) |
16 | 18 |
|
17 |
-const ( |
|
18 |
- JoinProjectsNetworkCommandName = "join-projects" |
|
19 |
+const JoinProjectsNetworkCommandName = "join-projects" |
|
19 | 20 |
|
20 |
- joinProjectsNetworkLong = ` |
|
21 |
-Join project network |
|
21 |
+var ( |
|
22 |
+ joinProjectsNetworkLong = templates.LongDesc(` |
|
23 |
+ Join project network |
|
22 | 24 |
|
23 |
-Allows projects to join existing project network when using the %[1]s network plugin.` |
|
25 |
+ Allows projects to join existing project network when using the %[1]s network plugin.`) |
|
24 | 26 |
|
25 |
- joinProjectsNetworkExample = ` # Allow project p2 to use project p1 network |
|
26 |
- %[1]s --to=<p1> <p2> |
|
27 |
+ joinProjectsNetworkExample = templates.Examples(` |
|
28 |
+ # Allow project p2 to use project p1 network |
|
29 |
+ %[1]s --to=<p1> <p2> |
|
27 | 30 |
|
28 |
- # Allow all projects with label name=top-secret to use project p1 network |
|
29 |
- %[1]s --to=<p1> --selector='name=top-secret'` |
|
31 |
+ # Allow all projects with label name=top-secret to use project p1 network |
|
32 |
+ %[1]s --to=<p1> --selector='name=top-secret'`) |
|
30 | 33 |
) |
31 | 34 |
|
32 | 35 |
type JoinOptions struct { |
... | ... |
@@ -9,23 +9,26 @@ import ( |
9 | 9 |
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" |
10 | 10 |
kerrors "k8s.io/kubernetes/pkg/util/errors" |
11 | 11 |
|
12 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
12 | 13 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
14 |
+ |
|
13 | 15 |
sdnapi "github.com/openshift/origin/pkg/sdn/api" |
14 | 16 |
) |
15 | 17 |
|
16 |
-const ( |
|
17 |
- MakeGlobalProjectsNetworkCommandName = "make-projects-global" |
|
18 |
+const MakeGlobalProjectsNetworkCommandName = "make-projects-global" |
|
18 | 19 |
|
19 |
- makeGlobalProjectsNetworkLong = ` |
|
20 |
-Make project network global |
|
20 |
+var ( |
|
21 |
+ makeGlobalProjectsNetworkLong = templates.LongDesc(` |
|
22 |
+ Make project network global |
|
21 | 23 |
|
22 |
-Allows projects to access all pods in the cluster and vice versa when using the %[1]s network plugin.` |
|
24 |
+ Allows projects to access all pods in the cluster and vice versa when using the %[1]s network plugin.`) |
|
23 | 25 |
|
24 |
- makeGlobalProjectsNetworkExample = ` # Allow project p1 to access all pods in the cluster and vice versa |
|
25 |
- %[1]s <p1> |
|
26 |
+ makeGlobalProjectsNetworkExample = templates.Examples(` |
|
27 |
+ # Allow project p1 to access all pods in the cluster and vice versa |
|
28 |
+ %[1]s <p1> |
|
26 | 29 |
|
27 |
- # Allow all projects with label name=share to access all pods in the cluster and vice versa |
|
28 |
- %[1]s --selector='name=share'` |
|
30 |
+ # Allow all projects with label name=share to access all pods in the cluster and vice versa |
|
31 |
+ %[1]s --selector='name=share'`) |
|
29 | 32 |
) |
30 | 33 |
|
31 | 34 |
type MakeGlobalOptions struct { |
... | ... |
@@ -5,17 +5,18 @@ import ( |
5 | 5 |
|
6 | 6 |
"github.com/spf13/cobra" |
7 | 7 |
|
8 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
8 | 9 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
9 | 10 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
10 | 11 |
) |
11 | 12 |
|
12 | 13 |
const PodNetworkCommandName = "pod-network" |
13 | 14 |
|
14 |
-const ( |
|
15 |
- podNetworkLong = ` |
|
16 |
-Manage pod network in the cluster |
|
15 |
+var ( |
|
16 |
+ podNetworkLong = templates.LongDesc(` |
|
17 |
+ Manage pod network in the cluster |
|
17 | 18 |
|
18 |
-This command provides common pod network operations for administrators.` |
|
19 |
+ This command provides common pod network operations for administrators.`) |
|
19 | 20 |
) |
20 | 21 |
|
21 | 22 |
func NewCmdPodNetwork(name, fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command { |
... | ... |
@@ -9,44 +9,46 @@ import ( |
9 | 9 |
|
10 | 10 |
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" |
11 | 11 |
|
12 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
12 | 13 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
13 | 14 |
) |
14 | 15 |
|
15 |
-const ( |
|
16 |
- ManageNodeCommandName = "manage-node" |
|
16 |
+const ManageNodeCommandName = "manage-node" |
|
17 | 17 |
|
18 |
- manageNodeLong = ` |
|
19 |
-Manage nodes |
|
18 |
+var ( |
|
19 |
+ manageNodeLong = templates.LongDesc(` |
|
20 |
+ Manage nodes |
|
20 | 21 |
|
21 |
-This command provides common operations on nodes for administrators. |
|
22 |
+ This command provides common operations on nodes for administrators. |
|
22 | 23 |
|
23 |
-schedulable: Marking node schedulable will allow pods to be schedulable on the node and |
|
24 |
- marking node unschedulable will block pods to be scheduled on the node. |
|
24 |
+ schedulable: Marking node schedulable will allow pods to be schedulable on the node and |
|
25 |
+ marking node unschedulable will block pods to be scheduled on the node. |
|
25 | 26 |
|
26 |
-evacuate: Migrate all/selected pod on the provided nodes. |
|
27 |
+ evacuate: Migrate all/selected pod on the provided nodes. |
|
27 | 28 |
|
28 |
-list-pods: List all/selected pods on given/selected nodes. It can list the output in json/yaml format.` |
|
29 |
+ list-pods: List all/selected pods on given/selected nodes. It can list the output in json/yaml format.`) |
|
29 | 30 |
|
30 |
- manageNodeExample = ` # Block accepting any pods on given nodes |
|
31 |
- %[1]s <mynode> --schedulable=false |
|
31 |
+ manageNodeExample = templates.Examples(` |
|
32 |
+ # Block accepting any pods on given nodes |
|
33 |
+ %[1]s <mynode> --schedulable=false |
|
32 | 34 |
|
33 |
- # Mark selected nodes as schedulable |
|
34 |
- %[1]s --selector="<env=dev>" --schedulable=true |
|
35 |
+ # Mark selected nodes as schedulable |
|
36 |
+ %[1]s --selector="<env=dev>" --schedulable=true |
|
35 | 37 |
|
36 |
- # Migrate selected pods |
|
37 |
- %[1]s <mynode> --evacuate --pod-selector="<service=myapp>" |
|
38 |
+ # Migrate selected pods |
|
39 |
+ %[1]s <mynode> --evacuate --pod-selector="<service=myapp>" |
|
38 | 40 |
|
39 |
- # Migrate selected pods, use a grace period of 60 seconds |
|
40 |
- %[1]s <mynode> --evacuate --grace-period=60 --pod-selector="<service=myapp>" |
|
41 |
+ # Migrate selected pods, use a grace period of 60 seconds |
|
42 |
+ %[1]s <mynode> --evacuate --grace-period=60 --pod-selector="<service=myapp>" |
|
41 | 43 |
|
42 |
- # Migrate selected pods not backed by replication controller |
|
43 |
- %[1]s <mynode> --evacuate --force --pod-selector="<service=myapp>" |
|
44 |
+ # Migrate selected pods not backed by replication controller |
|
45 |
+ %[1]s <mynode> --evacuate --force --pod-selector="<service=myapp>" |
|
44 | 46 |
|
45 |
- # Show pods that will be migrated |
|
46 |
- %[1]s <mynode> --evacuate --dry-run --pod-selector="<service=myapp>" |
|
47 |
+ # Show pods that will be migrated |
|
48 |
+ %[1]s <mynode> --evacuate --dry-run --pod-selector="<service=myapp>" |
|
47 | 49 |
|
48 |
- # List all pods on given nodes |
|
49 |
- %[1]s <mynode1> <mynode2> --list-pods` |
|
50 |
+ # List all pods on given nodes |
|
51 |
+ %[1]s <mynode1> <mynode2> --list-pods`) |
|
50 | 52 |
) |
51 | 53 |
|
52 | 54 |
var schedulable, evacuate, listpods bool |
... | ... |
@@ -12,6 +12,7 @@ import ( |
12 | 12 |
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" |
13 | 13 |
|
14 | 14 |
authorizationapi "github.com/openshift/origin/pkg/authorization/api" |
15 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
15 | 16 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
16 | 17 |
uservalidation "github.com/openshift/origin/pkg/user/api/validation" |
17 | 18 |
) |
... | ... |
@@ -28,12 +29,13 @@ const ( |
28 | 28 |
RemoveClusterRoleFromUserRecommendedName = "remove-cluster-role-from-user" |
29 | 29 |
) |
30 | 30 |
|
31 |
-const ( |
|
32 |
- addRoleToUserExample = ` # Add the 'view' role to user1 for the current project |
|
33 |
- %[1]s view user1 |
|
31 |
+var ( |
|
32 |
+ addRoleToUserExample = templates.Examples(` |
|
33 |
+ # Add the 'view' role to user1 for the current project |
|
34 |
+ %[1]s view user1 |
|
34 | 35 |
|
35 |
- # Add the 'edit' role to serviceaccount1 for the current project |
|
36 |
- %[1]s edit -z serviceaccount1` |
|
36 |
+ # Add the 'edit' role to serviceaccount1 for the current project |
|
37 |
+ %[1]s edit -z serviceaccount1`) |
|
37 | 38 |
) |
38 | 39 |
|
39 | 40 |
type RoleModificationOptions struct { |
... | ... |
@@ -12,6 +12,7 @@ import ( |
12 | 12 |
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" |
13 | 13 |
|
14 | 14 |
authorizationapi "github.com/openshift/origin/pkg/authorization/api" |
15 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
15 | 16 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
16 | 17 |
uservalidation "github.com/openshift/origin/pkg/user/api/validation" |
17 | 18 |
) |
... | ... |
@@ -23,12 +24,13 @@ const ( |
23 | 23 |
RemoveSCCFromUserRecommendedName = "remove-scc-from-user" |
24 | 24 |
) |
25 | 25 |
|
26 |
-const ( |
|
27 |
- addSCCToUserExample = ` # Add the 'restricted' security context contraint to user1 and user2 |
|
28 |
- %[1]s restricted user1 user2 |
|
26 |
+var ( |
|
27 |
+ addSCCToUserExample = templates.Examples(` |
|
28 |
+ # Add the 'restricted' security context contraint to user1 and user2 |
|
29 |
+ %[1]s restricted user1 user2 |
|
29 | 30 |
|
30 |
- # Add the 'privileged' security context contraint to the service account serviceaccount1 in the current namespace |
|
31 |
- %[1]s privileged -z serviceaccount1` |
|
31 |
+ # Add the 'privileged' security context contraint to the service account serviceaccount1 in the current namespace |
|
32 |
+ %[1]s privileged -z serviceaccount1`) |
|
32 | 33 |
) |
33 | 34 |
|
34 | 35 |
type SCCModificationOptions struct { |
... | ... |
@@ -20,16 +20,15 @@ import ( |
20 | 20 |
|
21 | 21 |
const PolicyRecommendedName = "policy" |
22 | 22 |
|
23 |
-const policyLong = ` |
|
24 |
-Manage policy on the cluster |
|
23 |
+var policyLong = templates.LongDesc(` |
|
24 |
+ Manage policy on the cluster |
|
25 | 25 |
|
26 |
-These commands allow you to assign and manage the roles and policies that apply to users. The reconcile |
|
27 |
-commands allow you to reset and upgrade your system policies to the latest default policies. |
|
26 |
+ These commands allow you to assign and manage the roles and policies that apply to users. The reconcile |
|
27 |
+ commands allow you to reset and upgrade your system policies to the latest default policies. |
|
28 | 28 |
|
29 |
-To see more information on roles and policies, use the 'get' and 'describe' commands on the following |
|
30 |
-resources: 'clusterroles', 'clusterpolicy', 'clusterrolebindings', 'roles', 'policy', 'rolebindings', |
|
31 |
-and 'scc'. |
|
32 |
-` |
|
29 |
+ To see more information on roles and policies, use the 'get' and 'describe' commands on the following |
|
30 |
+ resources: 'clusterroles', 'clusterpolicy', 'clusterrolebindings', 'roles', 'policy', 'rolebindings', |
|
31 |
+ and 'scc'.`) |
|
33 | 32 |
|
34 | 33 |
// NewCmdPolicy implements the OpenShift cli policy command |
35 | 34 |
func NewCmdPolicy(name, fullName string, f *clientcmd.Factory, out, errout io.Writer) *cobra.Command { |
... | ... |
@@ -17,8 +17,10 @@ import ( |
17 | 17 |
authorizationapi "github.com/openshift/origin/pkg/authorization/api" |
18 | 18 |
"github.com/openshift/origin/pkg/client" |
19 | 19 |
"github.com/openshift/origin/pkg/cmd/server/bootstrappolicy" |
20 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
20 | 21 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
21 | 22 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
23 |
+ |
|
22 | 24 |
uservalidation "github.com/openshift/origin/pkg/user/api/validation" |
23 | 25 |
) |
24 | 26 |
|
... | ... |
@@ -43,30 +45,31 @@ type ReconcileClusterRoleBindingsOptions struct { |
43 | 43 |
RoleBindingClient client.ClusterRoleBindingInterface |
44 | 44 |
} |
45 | 45 |
|
46 |
-const ( |
|
47 |
- reconcileBindingsLong = ` |
|
48 |
-Update cluster role bindings to match the recommended bootstrap policy |
|
46 |
+var ( |
|
47 |
+ reconcileBindingsLong = templates.LongDesc(` |
|
48 |
+ Update cluster role bindings to match the recommended bootstrap policy |
|
49 | 49 |
|
50 |
-This command will inspect the cluster role bindings against the recommended bootstrap policy. |
|
51 |
-Any cluster role binding that does not match will be replaced by the recommended bootstrap role binding. |
|
52 |
-This command will not remove any additional cluster role bindings. |
|
50 |
+ This command will inspect the cluster role bindings against the recommended bootstrap policy. |
|
51 |
+ Any cluster role binding that does not match will be replaced by the recommended bootstrap role binding. |
|
52 |
+ This command will not remove any additional cluster role bindings. |
|
53 | 53 |
|
54 |
-You can see which recommended cluster role bindings have changed by choosing an output type.` |
|
54 |
+ You can see which recommended cluster role bindings have changed by choosing an output type.`) |
|
55 | 55 |
|
56 |
- reconcileBindingsExample = ` # Display the names of cluster role bindings that would be modified |
|
57 |
- %[1]s -o name |
|
56 |
+ reconcileBindingsExample = templates.Examples(` |
|
57 |
+ # Display the names of cluster role bindings that would be modified |
|
58 |
+ %[1]s -o name |
|
58 | 59 |
|
59 |
- # Display the cluster role bindings that would be modified, removing any extra subjects |
|
60 |
- %[1]s --additive-only=false |
|
60 |
+ # Display the cluster role bindings that would be modified, removing any extra subjects |
|
61 |
+ %[1]s --additive-only=false |
|
61 | 62 |
|
62 |
- # Update cluster role bindings that don't match the current defaults |
|
63 |
- %[1]s --confirm |
|
63 |
+ # Update cluster role bindings that don't match the current defaults |
|
64 |
+ %[1]s --confirm |
|
64 | 65 |
|
65 |
- # Update cluster role bindings that don't match the current defaults, avoid adding roles to the system:authenticated group |
|
66 |
- %[1]s --confirm --exclude-groups=system:authenticated |
|
66 |
+ # Update cluster role bindings that don't match the current defaults, avoid adding roles to the system:authenticated group |
|
67 |
+ %[1]s --confirm --exclude-groups=system:authenticated |
|
67 | 68 |
|
68 |
- # Update cluster role bindings that don't match the current defaults, removing any extra subjects from the binding |
|
69 |
- %[1]s --confirm --additive-only=false` |
|
69 |
+ # Update cluster role bindings that don't match the current defaults, removing any extra subjects from the binding |
|
70 |
+ %[1]s --confirm --additive-only=false`) |
|
70 | 71 |
) |
71 | 72 |
|
72 | 73 |
// NewCmdReconcileClusterRoleBindings implements the OpenShift cli reconcile-cluster-role-bindings command |
... | ... |
@@ -17,8 +17,10 @@ import ( |
17 | 17 |
"github.com/openshift/origin/pkg/authorization/rulevalidation" |
18 | 18 |
"github.com/openshift/origin/pkg/client" |
19 | 19 |
"github.com/openshift/origin/pkg/cmd/server/bootstrappolicy" |
20 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
20 | 21 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
21 | 22 |
osutil "github.com/openshift/origin/pkg/cmd/util" |
23 |
+ |
|
22 | 24 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
23 | 25 |
) |
24 | 26 |
|
... | ... |
@@ -43,30 +45,31 @@ type ReconcileClusterRolesOptions struct { |
43 | 43 |
RoleClient client.ClusterRoleInterface |
44 | 44 |
} |
45 | 45 |
|
46 |
-const ( |
|
47 |
- reconcileLong = ` |
|
48 |
-Update cluster roles to match the recommended bootstrap policy |
|
46 |
+var ( |
|
47 |
+ reconcileLong = templates.LongDesc(` |
|
48 |
+ Update cluster roles to match the recommended bootstrap policy |
|
49 | 49 |
|
50 |
-This command will compare cluster roles against the recommended bootstrap policy. Any cluster role |
|
51 |
-that does not match will be replaced by the recommended bootstrap role. This command will not remove |
|
52 |
-any additional cluster role. |
|
50 |
+ This command will compare cluster roles against the recommended bootstrap policy. Any cluster role |
|
51 |
+ that does not match will be replaced by the recommended bootstrap role. This command will not remove |
|
52 |
+ any additional cluster role. |
|
53 | 53 |
|
54 |
-Cluster roles with the annotation %s set to "true" are skipped. |
|
54 |
+ Cluster roles with the annotation %s set to "true" are skipped. |
|
55 | 55 |
|
56 |
-You can see which cluster roles have recommended changed by choosing an output type.` |
|
56 |
+ You can see which cluster roles have recommended changed by choosing an output type.`) |
|
57 | 57 |
|
58 |
- reconcileExample = ` # Display the names of cluster roles that would be modified |
|
59 |
- %[1]s -o name |
|
58 |
+ reconcileExample = templates.Examples(` |
|
59 |
+ # Display the names of cluster roles that would be modified |
|
60 |
+ %[1]s -o name |
|
60 | 61 |
|
61 |
- # Add missing permissions to cluster roles that don't match the current defaults |
|
62 |
- %[1]s --confirm |
|
62 |
+ # Add missing permissions to cluster roles that don't match the current defaults |
|
63 |
+ %[1]s --confirm |
|
63 | 64 |
|
64 |
- # Add missing permissions and remove extra permissions from |
|
65 |
- # cluster roles that don't match the current defaults |
|
66 |
- %[1]s --additive-only=false --confirm |
|
65 |
+ # Add missing permissions and remove extra permissions from |
|
66 |
+ # cluster roles that don't match the current defaults |
|
67 |
+ %[1]s --additive-only=false --confirm |
|
67 | 68 |
|
68 |
- # Display the union of the default and modified cluster roles |
|
69 |
- %[1]s --additive-only` |
|
69 |
+ # Display the union of the default and modified cluster roles |
|
70 |
+ %[1]s --additive-only`) |
|
70 | 71 |
) |
71 | 72 |
|
72 | 73 |
// NewCmdReconcileClusterRoles implements the OpenShift cli reconcile-cluster-roles command |
... | ... |
@@ -16,7 +16,9 @@ import ( |
16 | 16 |
"k8s.io/kubernetes/pkg/util/sets" |
17 | 17 |
|
18 | 18 |
"github.com/openshift/origin/pkg/cmd/server/bootstrappolicy" |
19 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
19 | 20 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
21 |
+ |
|
20 | 22 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
21 | 23 |
) |
22 | 24 |
|
... | ... |
@@ -40,28 +42,29 @@ type ReconcileSCCOptions struct { |
40 | 40 |
NSClient kclient.NamespaceInterface |
41 | 41 |
} |
42 | 42 |
|
43 |
-const ( |
|
44 |
- reconcileSCCLong = ` |
|
45 |
-Replace cluster SCCs to match the recommended bootstrap policy |
|
43 |
+var ( |
|
44 |
+ reconcileSCCLong = templates.LongDesc(` |
|
45 |
+ Replace cluster SCCs to match the recommended bootstrap policy |
|
46 | 46 |
|
47 |
-This command will inspect the cluster SCCs against the recommended bootstrap SCCs. |
|
48 |
-Any cluster SCC that does not match will be replaced by the recommended SCC. |
|
49 |
-This command will not remove any additional cluster SCCs. By default, this command |
|
50 |
-will not remove additional users and groups that have been granted access to the SCC and |
|
51 |
-will preserve existing priorities (but will always reconcile unset priorities and the policy |
|
52 |
-definition). |
|
47 |
+ This command will inspect the cluster SCCs against the recommended bootstrap SCCs. |
|
48 |
+ Any cluster SCC that does not match will be replaced by the recommended SCC. |
|
49 |
+ This command will not remove any additional cluster SCCs. By default, this command |
|
50 |
+ will not remove additional users and groups that have been granted access to the SCC and |
|
51 |
+ will preserve existing priorities (but will always reconcile unset priorities and the policy |
|
52 |
+ definition). |
|
53 | 53 |
|
54 |
-You can see which cluster SCCs have recommended changes by choosing an output type.` |
|
54 |
+ You can see which cluster SCCs have recommended changes by choosing an output type.`) |
|
55 | 55 |
|
56 |
- reconcileSCCExample = ` # Display the cluster SCCs that would be modified |
|
57 |
- %[1]s |
|
56 |
+ reconcileSCCExample = templates.Examples(` |
|
57 |
+ # Display the cluster SCCs that would be modified |
|
58 |
+ %[1]s |
|
58 | 59 |
|
59 |
- # Update cluster SCCs that don't match the current defaults preserving additional grants |
|
60 |
- # for users and group and keeping any priorities that are already set |
|
61 |
- %[1]s --confirm |
|
60 |
+ # Update cluster SCCs that don't match the current defaults preserving additional grants |
|
61 |
+ # for users and group and keeping any priorities that are already set |
|
62 |
+ %[1]s --confirm |
|
62 | 63 |
|
63 |
- # Replace existing users, groups, and priorities that do not match defaults |
|
64 |
- %[1]s --additive-only=false --confirm` |
|
64 |
+ # Replace existing users, groups, and priorities that do not match defaults |
|
65 |
+ %[1]s --additive-only=false --confirm`) |
|
65 | 66 |
) |
66 | 67 |
|
67 | 68 |
// NewDefaultReconcileSCCOptions provides a ReconcileSCCOptions with default settings. |
... | ... |
@@ -14,7 +14,9 @@ import ( |
14 | 14 |
"github.com/openshift/origin/pkg/client" |
15 | 15 |
"github.com/openshift/origin/pkg/cmd/admin/policy" |
16 | 16 |
"github.com/openshift/origin/pkg/cmd/server/bootstrappolicy" |
17 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
17 | 18 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
19 |
+ |
|
18 | 20 |
projectapi "github.com/openshift/origin/pkg/project/api" |
19 | 21 |
) |
20 | 22 |
|
... | ... |
@@ -32,12 +34,12 @@ type NewProjectOptions struct { |
32 | 32 |
AdminUser string |
33 | 33 |
} |
34 | 34 |
|
35 |
-const newProjectLong = ` |
|
36 |
-Create a new project |
|
35 |
+var newProjectLong = templates.LongDesc(` |
|
36 |
+ Create a new project |
|
37 | 37 |
|
38 |
-Use this command to create a project. You may optionally specify metadata about the project, |
|
39 |
-an admin user (and role, if you want to use a non-default admin role), and a node selector |
|
40 |
-to restrict which nodes pods in this project can be scheduled to.` |
|
38 |
+ Use this command to create a project. You may optionally specify metadata about the project, |
|
39 |
+ an admin user (and role, if you want to use a non-default admin role), and a node selector |
|
40 |
+ to restrict which nodes pods in this project can be scheduled to.`) |
|
41 | 41 |
|
42 | 42 |
// NewCmdNewProject implements the OpenShift cli new-project command |
43 | 43 |
func NewCmdNewProject(name, fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command { |
... | ... |
@@ -15,23 +15,26 @@ import ( |
15 | 15 |
buildapi "github.com/openshift/origin/pkg/build/api" |
16 | 16 |
"github.com/openshift/origin/pkg/build/prune" |
17 | 17 |
"github.com/openshift/origin/pkg/client" |
18 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
18 | 19 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
19 | 20 |
) |
20 | 21 |
|
21 | 22 |
const PruneBuildsRecommendedName = "builds" |
22 | 23 |
|
23 |
-const ( |
|
24 |
- buildsLongDesc = `Prune old completed and failed builds |
|
24 |
+var ( |
|
25 |
+ buildsLongDesc = templates.LongDesc(` |
|
26 |
+ Prune old completed and failed builds |
|
25 | 27 |
|
26 |
-By default, the prune operation performs a dry run making no changes to internal registry. A |
|
28 |
+ By default, the prune operation performs a dry run making no changes to internal registry. A |
|
29 |
+ --confirm flag is needed for changes to be effective.`) |
|
27 | 30 |
|
28 |
- buildsExample = ` # Dry run deleting older completed and failed builds and also including |
|
29 |
- # all builds whose associated BuildConfig no longer exists |
|
30 |
- %[1]s %[2]s --orphans |
|
31 |
+ buildsExample = templates.Examples(` |
|
32 |
+ # Dry run deleting older completed and failed builds and also including |
|
33 |
+ # all builds whose associated BuildConfig no longer exists |
|
34 |
+ %[1]s %[2]s --orphans |
|
31 | 35 |
|
32 |
- # To actually perform the prune operation, the confirm flag must be appended |
|
33 |
- %[1]s %[2]s --orphans --confirm` |
|
36 |
+ # To actually perform the prune operation, the confirm flag must be appended |
|
37 |
+ %[1]s %[2]s --orphans --confirm`) |
|
34 | 38 |
) |
35 | 39 |
|
36 | 40 |
// PruneBuildsOptions holds all the required options for pruning builds. |
... | ... |
@@ -14,6 +14,7 @@ import ( |
14 | 14 |
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" |
15 | 15 |
|
16 | 16 |
"github.com/openshift/origin/pkg/client" |
17 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
17 | 18 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
18 | 19 |
deployapi "github.com/openshift/origin/pkg/deploy/api" |
19 | 20 |
"github.com/openshift/origin/pkg/deploy/prune" |
... | ... |
@@ -21,18 +22,19 @@ import ( |
21 | 21 |
|
22 | 22 |
const PruneDeploymentsRecommendedName = "deployments" |
23 | 23 |
|
24 |
-const ( |
|
25 |
- deploymentsLongDesc = `Prune old completed and failed deployments |
|
24 |
+var ( |
|
25 |
+ deploymentsLongDesc = templates.LongDesc(` |
|
26 |
+ Prune old completed and failed deployments |
|
26 | 27 |
|
27 |
-By default, the prune operation performs a dry run making no changes to the deployments. |
|
28 |
-A --confirm flag is needed for changes to be effective. |
|
29 |
-` |
|
28 |
+ By default, the prune operation performs a dry run making no changes to the deployments. |
|
29 |
+ A --confirm flag is needed for changes to be effective.`) |
|
30 | 30 |
|
31 |
- deploymentsExample = ` # Dry run deleting all but the last complete deployment for every deployment config |
|
32 |
- %[1]s %[2]s --keep-complete=1 |
|
31 |
+ deploymentsExample = templates.Examples(` |
|
32 |
+ # Dry run deleting all but the last complete deployment for every deployment config |
|
33 |
+ %[1]s %[2]s --keep-complete=1 |
|
33 | 34 |
|
34 |
- # To actually perform the prune operation, the confirm flag must be appended |
|
35 |
- %[1]s %[2]s --keep-complete=1 --confirm` |
|
35 |
+ # To actually perform the prune operation, the confirm flag must be appended |
|
36 |
+ %[1]s %[2]s --keep-complete=1 --confirm`) |
|
36 | 37 |
) |
37 | 38 |
|
38 | 39 |
// PruneDeploymentsOptions holds all the required options for pruning deployments. |
... | ... |
@@ -22,37 +22,40 @@ import ( |
22 | 22 |
|
23 | 23 |
"github.com/openshift/origin/pkg/client" |
24 | 24 |
"github.com/openshift/origin/pkg/cmd/server/bootstrappolicy" |
25 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
25 | 26 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
26 | 27 |
imageapi "github.com/openshift/origin/pkg/image/api" |
27 | 28 |
"github.com/openshift/origin/pkg/image/prune" |
28 | 29 |
oserrors "github.com/openshift/origin/pkg/util/errors" |
29 | 30 |
) |
30 | 31 |
|
31 |
-const ( |
|
32 |
- // PruneImagesRecommendedName is the recommended command name |
|
33 |
- PruneImagesRecommendedName = "images" |
|
32 |
+// PruneImagesRecommendedName is the recommended command name |
|
33 |
+const PruneImagesRecommendedName = "images" |
|
34 | 34 |
|
35 |
- imagesLongDesc = `Prune images no longer needed due to age and/or status |
|
35 |
+var ( |
|
36 |
+ imagesLongDesc = templates.LongDesc(` |
|
37 |
+ Prune images no longer needed due to age and/or status |
|
36 | 38 |
|
37 |
-By default, the prune operation performs a dry run making no changes to internal registry. A |
|
39 |
+ By default, the prune operation performs a dry run making no changes to internal registry. A |
|
40 |
+ --confirm flag is needed for changes to be effective. |
|
38 | 41 |
|
39 |
-Only a user with a cluster role %s or higher who is logged-in will be able to actually delete the |
|
40 |
-images.` |
|
42 |
+ Only a user with a cluster role %s or higher who is logged-in will be able to actually delete the |
|
43 |
+ images.`) |
|
41 | 44 |
|
42 |
- imagesExample = ` # See, what the prune command would delete if only images more than an hour old and obsoleted |
|
43 |
- # by 3 newer revisions under the same tag were considered. |
|
44 |
- %[1]s %[2]s --keep-tag-revisions=3 --keep-younger-than=60m |
|
45 |
+ imagesExample = templates.Examples(` |
|
46 |
+ # See, what the prune command would delete if only images more than an hour old and obsoleted |
|
47 |
+ # by 3 newer revisions under the same tag were considered. |
|
48 |
+ %[1]s %[2]s --keep-tag-revisions=3 --keep-younger-than=60m |
|
45 | 49 |
|
46 |
- # To actually perform the prune operation, the confirm flag must be appended |
|
47 |
- %[1]s %[2]s --keep-tag-revisions=3 --keep-younger-than=60m --confirm |
|
50 |
+ # To actually perform the prune operation, the confirm flag must be appended |
|
51 |
+ %[1]s %[2]s --keep-tag-revisions=3 --keep-younger-than=60m --confirm |
|
48 | 52 |
|
49 |
- # See, what the prune command would delete if we're interested in removing images |
|
50 |
- # exceeding currently set LimitRanges ('openshift.io/Image') |
|
51 |
- %[1]s %[2]s --prune-over-size-limit |
|
53 |
+ # See, what the prune command would delete if we're interested in removing images |
|
54 |
+ # exceeding currently set LimitRanges ('openshift.io/Image') |
|
55 |
+ %[1]s %[2]s --prune-over-size-limit |
|
52 | 56 |
|
53 |
- # To actually perform the prune operation, the confirm flag must be appended |
|
54 |
- %[1]s %[2]s --prune-over-size-limit --confirm` |
|
57 |
+ # To actually perform the prune operation, the confirm flag must be appended |
|
58 |
+ %[1]s %[2]s --prune-over-size-limit --confirm`) |
|
55 | 59 |
) |
56 | 60 |
|
57 | 61 |
var ( |
... | ... |
@@ -6,18 +6,21 @@ import ( |
6 | 6 |
"github.com/spf13/cobra" |
7 | 7 |
|
8 | 8 |
groups "github.com/openshift/origin/pkg/cmd/admin/groups/sync/cli" |
9 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
9 | 10 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
10 | 11 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
11 | 12 |
) |
12 | 13 |
|
13 |
-const PruneRecommendedName = "prune" |
|
14 |
- |
|
15 |
-const PruneGroupsRecommendedName = "groups" |
|
14 |
+const ( |
|
15 |
+ PruneRecommendedName = "prune" |
|
16 |
+ PruneGroupsRecommendedName = "groups" |
|
17 |
+) |
|
16 | 18 |
|
17 |
-const pruneLong = `Remove older versions of resources from the server |
|
19 |
+var pruneLong = templates.LongDesc(` |
|
20 |
+ Remove older versions of resources from the server |
|
18 | 21 |
|
19 |
-The commands here allow administrators to manage the older versions of resources on |
|
20 |
-the system by removing them.` |
|
22 |
+ The commands here allow administrators to manage the older versions of resources on |
|
23 |
+ the system by removing them.`) |
|
21 | 24 |
|
22 | 25 |
func NewCommandPrune(name, fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command { |
23 | 26 |
// Parent command to which all subcommands are added. |
... | ... |
@@ -24,52 +24,55 @@ import ( |
24 | 24 |
"k8s.io/kubernetes/pkg/util/intstr" |
25 | 25 |
|
26 | 26 |
authapi "github.com/openshift/origin/pkg/authorization/api" |
27 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
27 | 28 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
28 | 29 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
29 | 30 |
"github.com/openshift/origin/pkg/cmd/util/variable" |
31 |
+ |
|
30 | 32 |
configcmd "github.com/openshift/origin/pkg/config/cmd" |
31 | 33 |
deployapi "github.com/openshift/origin/pkg/deploy/api" |
32 | 34 |
"github.com/openshift/origin/pkg/generate/app" |
33 | 35 |
) |
34 | 36 |
|
35 |
-const ( |
|
36 |
- registryLong = ` |
|
37 |
-Install or configure an integrated Docker registry |
|
37 |
+var ( |
|
38 |
+ registryLong = templates.LongDesc(` |
|
39 |
+ Install or configure an integrated Docker registry |
|
38 | 40 |
|
39 |
-This command sets up a Docker registry integrated with your cluster to provide notifications when |
|
40 |
-images are pushed. With no arguments, the command will check for the existing registry service |
|
41 |
-called 'docker-registry' and try to create it. If you want to test whether the registry has |
|
42 |
-been created add the --dry-run flag and the command will exit with 1 if the registry does not |
|
43 |
-exist. |
|
41 |
+ This command sets up a Docker registry integrated with your cluster to provide notifications when |
|
42 |
+ images are pushed. With no arguments, the command will check for the existing registry service |
|
43 |
+ called 'docker-registry' and try to create it. If you want to test whether the registry has |
|
44 |
+ been created add the --dry-run flag and the command will exit with 1 if the registry does not |
|
45 |
+ exist. |
|
44 | 46 |
|
45 |
-To run a highly available registry, you should be using a remote storage mechanism like an |
|
46 |
-object store (several are supported by the Docker registry). The default Docker registry image |
|
47 |
-is configured to accept configuration as environment variables - refer to the configuration file in |
|
48 |
-that image for more on setting up alternative storage. Once you've made those changes, you can |
|
49 |
-pass --replicas=2 or higher to ensure you have failover protection. The default registry setup |
|
50 |
-uses a local volume and the data will be lost if you delete the running pod. |
|
47 |
+ To run a highly available registry, you should be using a remote storage mechanism like an |
|
48 |
+ object store (several are supported by the Docker registry). The default Docker registry image |
|
49 |
+ is configured to accept configuration as environment variables - refer to the configuration file in |
|
50 |
+ that image for more on setting up alternative storage. Once you've made those changes, you can |
|
51 |
+ pass --replicas=2 or higher to ensure you have failover protection. The default registry setup |
|
52 |
+ uses a local volume and the data will be lost if you delete the running pod. |
|
51 | 53 |
|
52 |
-If multiple ports are specified using the option --ports, the first specified port will be |
|
53 |
-chosen for use as the REGISTRY_HTTP_ADDR and will be passed to Docker registry. |
|
54 |
+ If multiple ports are specified using the option --ports, the first specified port will be |
|
55 |
+ chosen for use as the REGISTRY_HTTP_ADDR and will be passed to Docker registry. |
|
54 | 56 |
|
55 |
-NOTE: This command is intended to simplify the tasks of setting up a Docker registry in a new |
|
56 |
- installation. Some configuration beyond this command is still required to make |
|
57 |
- your registry persist data.` |
|
57 |
+ NOTE: This command is intended to simplify the tasks of setting up a Docker registry in a new |
|
58 |
+ installation. Some configuration beyond this command is still required to make |
|
59 |
+ your registry persist data.`) |
|
58 | 60 |
|
59 |
- registryExample = ` # Check if default Docker registry ("docker-registry") has been created |
|
60 |
- %[1]s %[2]s --dry-run |
|
61 |
+ registryExample = templates.Examples(` |
|
62 |
+ # Check if default Docker registry ("docker-registry") has been created |
|
63 |
+ %[1]s %[2]s --dry-run |
|
61 | 64 |
|
62 |
- # See what the registry will look like if created |
|
63 |
- %[1]s %[2]s -o yaml |
|
65 |
+ # See what the registry will look like if created |
|
66 |
+ %[1]s %[2]s -o yaml |
|
64 | 67 |
|
65 |
- # Create a registry with two replicas if it does not exist |
|
66 |
- %[1]s %[2]s --replicas=2 |
|
68 |
+ # Create a registry with two replicas if it does not exist |
|
69 |
+ %[1]s %[2]s --replicas=2 |
|
67 | 70 |
|
68 |
- # Use a different registry image |
|
69 |
- %[1]s %[2]s --images=myrepo/docker-registry:mytag |
|
71 |
+ # Use a different registry image |
|
72 |
+ %[1]s %[2]s --images=myrepo/docker-registry:mytag |
|
70 | 73 |
|
71 |
- # Enforce quota and limits on images |
|
72 |
- %[1]s %[2]s --enforce-quota` |
|
74 |
+ # Enforce quota and limits on images |
|
75 |
+ %[1]s %[2]s --enforce-quota`) |
|
73 | 76 |
) |
74 | 77 |
|
75 | 78 |
// RegistryOptions contains the configuration for the registry as well as any other |
... | ... |
@@ -25,8 +25,10 @@ import ( |
25 | 25 |
|
26 | 26 |
authapi "github.com/openshift/origin/pkg/authorization/api" |
27 | 27 |
"github.com/openshift/origin/pkg/cmd/server/bootstrappolicy" |
28 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
28 | 29 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
29 | 30 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
31 |
+ |
|
30 | 32 |
"github.com/openshift/origin/pkg/cmd/util/variable" |
31 | 33 |
configcmd "github.com/openshift/origin/pkg/config/cmd" |
32 | 34 |
deployapi "github.com/openshift/origin/pkg/deploy/api" |
... | ... |
@@ -35,36 +37,36 @@ import ( |
35 | 35 |
fileutil "github.com/openshift/origin/pkg/util/file" |
36 | 36 |
) |
37 | 37 |
|
38 |
-const ( |
|
39 |
- routerLong = ` |
|
40 |
-Install or configure a router |
|
38 |
+var ( |
|
39 |
+ routerLong = templates.LongDesc(` |
|
40 |
+ Install or configure a router |
|
41 | 41 |
|
42 |
-This command helps to setup a router to take edge traffic and balance it to |
|
43 |
-your application. With no arguments, the command will check for an existing router |
|
44 |
-service called 'router' and create one if it does not exist. If you want to test whether |
|
45 |
-a router has already been created add the --dry-run flag and the command will exit with |
|
46 |
-1 if the registry does not exist. |
|
42 |
+ This command helps to setup a router to take edge traffic and balance it to |
|
43 |
+ your application. With no arguments, the command will check for an existing router |
|
44 |
+ service called 'router' and create one if it does not exist. If you want to test whether |
|
45 |
+ a router has already been created add the --dry-run flag and the command will exit with |
|
46 |
+ 1 if the registry does not exist. |
|
47 | 47 |
|
48 |
-If a router does not exist with the given name, this command will |
|
49 |
-create a deployment configuration and service that will run the router. If you are |
|
50 |
-running your router in production, you should pass --replicas=2 or higher to ensure |
|
51 |
-you have failover protection.` |
|
48 |
+ If a router does not exist with the given name, this command will |
|
49 |
+ create a deployment configuration and service that will run the router. If you are |
|
50 |
+ running your router in production, you should pass --replicas=2 or higher to ensure |
|
51 |
+ you have failover protection.`) |
|
52 | 52 |
|
53 |
- routerExample = ` # Check the default router ("router") |
|
54 |
- %[1]s %[2]s --dry-run |
|
53 |
+ routerExample = templates.Examples(` |
|
54 |
+ # Check the default router ("router") |
|
55 |
+ %[1]s %[2]s --dry-run |
|
55 | 56 |
|
56 |
- # See what the router would look like if created |
|
57 |
- %[1]s %[2]s -o yaml |
|
57 |
+ # See what the router would look like if created |
|
58 |
+ %[1]s %[2]s -o yaml |
|
58 | 59 |
|
59 |
- # Create a router with two replicas if it does not exist |
|
60 |
- %[1]s %[2]s router-west --replicas=2 |
|
60 |
+ # Create a router with two replicas if it does not exist |
|
61 |
+ %[1]s %[2]s router-west --replicas=2 |
|
61 | 62 |
|
62 |
- # Use a different router image |
|
63 |
- %[1]s %[2]s region-west --images=myrepo/somerouter:mytag |
|
63 |
+ # Use a different router image |
|
64 |
+ %[1]s %[2]s region-west --images=myrepo/somerouter:mytag |
|
64 | 65 |
|
65 |
- # Run the router with a hint to the underlying implementation to _not_ expose statistics. |
|
66 |
- %[1]s %[2]s router-west --stats-port=0 |
|
67 |
- ` |
|
66 |
+ # Run the router with a hint to the underlying implementation to _not_ expose statistics. |
|
67 |
+ %[1]s %[2]s router-west --stats-port=0`) |
|
68 | 68 |
|
69 | 69 |
secretsVolumeName = "secret-volume" |
70 | 70 |
secretsPath = "/etc/secret-volume" |
... | ... |
@@ -79,9 +81,9 @@ you have failover protection.` |
79 | 79 |
privkeyVolumeName = "external-host-private-key-volume" |
80 | 80 |
privkeyName = "router.pem" |
81 | 81 |
privkeyPath = secretsPath + "/" + privkeyName |
82 |
-) |
|
83 | 82 |
|
84 |
-var defaultCertificatePath = path.Join(defaultCertificateDir, "tls.crt") |
|
83 |
+ defaultCertificatePath = path.Join(defaultCertificateDir, "tls.crt") |
|
84 |
+) |
|
85 | 85 |
|
86 | 86 |
// RouterConfig contains the configuration parameters necessary to |
87 | 87 |
// launch a router, including general parameters, type of router, and |
... | ... |
@@ -16,23 +16,29 @@ import ( |
16 | 16 |
kubegraph "github.com/openshift/origin/pkg/api/kubegraph/nodes" |
17 | 17 |
buildapi "github.com/openshift/origin/pkg/build/api" |
18 | 18 |
"github.com/openshift/origin/pkg/client" |
19 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
19 | 20 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
20 | 21 |
deployapi "github.com/openshift/origin/pkg/deploy/api" |
21 | 22 |
imageapi "github.com/openshift/origin/pkg/image/api" |
23 |
+ |
|
22 | 24 |
imagegraph "github.com/openshift/origin/pkg/image/graph/nodes" |
23 | 25 |
) |
24 | 26 |
|
25 | 27 |
const ( |
26 | 28 |
TopImagesRecommendedName = "images" |
29 |
+ maxImageIDLength = 20 |
|
30 |
+) |
|
27 | 31 |
|
28 |
- topImagesLong = `Show usage statistics for Images |
|
32 |
+var ( |
|
33 |
+ topImagesLong = templates.LongDesc(` |
|
34 |
+ Show usage statistics for Images |
|
29 | 35 |
|
30 |
-This command analyzes all the Images managed by the platform and presents current |
|
31 |
-usage statistics.` |
|
36 |
+ This command analyzes all the Images managed by the platform and presents current |
|
37 |
+ usage statistics.`) |
|
32 | 38 |
|
33 |
- topImagesExample = ` # Show usage statistics for Images |
|
34 |
- %[1]s %[2]s` |
|
35 |
- maxImageIDLength = 20 |
|
39 |
+ topImagesExample = templates.Examples(` |
|
40 |
+ # Show usage statistics for Images |
|
41 |
+ %[1]s %[2]s`) |
|
36 | 42 |
) |
37 | 43 |
|
38 | 44 |
// NewCmdTopImages implements the OpenShift cli top images command. |
... | ... |
@@ -12,22 +12,26 @@ import ( |
12 | 12 |
"k8s.io/kubernetes/pkg/util/sets" |
13 | 13 |
|
14 | 14 |
"github.com/openshift/origin/pkg/api/graph" |
15 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
16 |
+ |
|
15 | 17 |
"github.com/openshift/origin/pkg/client" |
16 | 18 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
17 | 19 |
imageapi "github.com/openshift/origin/pkg/image/api" |
18 | 20 |
imagegraph "github.com/openshift/origin/pkg/image/graph/nodes" |
19 | 21 |
) |
20 | 22 |
|
21 |
-const ( |
|
22 |
- TopImageStreamsRecommendedName = "imagestreams" |
|
23 |
+const TopImageStreamsRecommendedName = "imagestreams" |
|
23 | 24 |
|
24 |
- topImageStreamsLong = `Show usage statistics for ImageStreams |
|
25 |
+var ( |
|
26 |
+ topImageStreamsLong = templates.LongDesc(` |
|
27 |
+ Show usage statistics for ImageStreams |
|
25 | 28 |
|
26 |
-This command analyzes all the ImageStreams managed by the platform and presents current |
|
27 |
-usage statistics.` |
|
29 |
+ This command analyzes all the ImageStreams managed by the platform and presents current |
|
30 |
+ usage statistics.`) |
|
28 | 31 |
|
29 |
- topImageStreamsExample = ` # Show usage statistics for ImageStreams |
|
30 |
- %[1]s %[2]s` |
|
32 |
+ topImageStreamsExample = templates.Examples(` |
|
33 |
+ # Show usage statistics for ImageStreams |
|
34 |
+ %[1]s %[2]s`) |
|
31 | 35 |
) |
32 | 36 |
|
33 | 37 |
// NewCmdTopImageStreams implements the OpenShift cli top imagestreams command. |
... | ... |
@@ -7,18 +7,19 @@ import ( |
7 | 7 |
|
8 | 8 |
kcmd "k8s.io/kubernetes/pkg/kubectl/cmd" |
9 | 9 |
|
10 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
10 | 11 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
12 |
+ |
|
11 | 13 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
12 | 14 |
) |
13 | 15 |
|
14 |
-const ( |
|
15 |
- TopRecommendedName = "top" |
|
16 |
+const TopRecommendedName = "top" |
|
16 | 17 |
|
17 |
- topLong = `Show usage statistics of resources on the server |
|
18 |
+var topLong = templates.LongDesc(` |
|
19 |
+ Show usage statistics of resources on the server |
|
18 | 20 |
|
19 |
-This command analyzes resources managed by the platform and presents current |
|
20 |
-usage statistics.` |
|
21 |
-) |
|
21 |
+ This command analyzes resources managed by the platform and presents current |
|
22 |
+ usage statistics.`) |
|
22 | 23 |
|
23 | 24 |
func NewCommandTop(name, fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command { |
24 | 25 |
// Parent command to which all subcommands are added. |
... | ... |
@@ -31,7 +32,13 @@ func NewCommandTop(name, fullName string, f *clientcmd.Factory, out io.Writer) * |
31 | 31 |
|
32 | 32 |
cmds.AddCommand(NewCmdTopImages(f, fullName, TopImagesRecommendedName, out)) |
33 | 33 |
cmds.AddCommand(NewCmdTopImageStreams(f, fullName, TopImageStreamsRecommendedName, out)) |
34 |
- cmds.AddCommand(kcmd.NewCmdTopNode(f.Factory, out)) |
|
35 |
- cmds.AddCommand(kcmd.NewCmdTopPod(f.Factory, out)) |
|
34 |
+ cmdTopNode := kcmd.NewCmdTopNode(f.Factory, out) |
|
35 |
+ cmdTopNode.Long = templates.LongDesc(cmdTopNode.Long) |
|
36 |
+ cmdTopNode.Example = templates.Examples(cmdTopNode.Example) |
|
37 |
+ cmdTopPod := kcmd.NewCmdTopPod(f.Factory, out) |
|
38 |
+ cmdTopPod.Long = templates.LongDesc(cmdTopPod.Long) |
|
39 |
+ cmdTopPod.Example = templates.Examples(cmdTopPod.Example) |
|
40 |
+ cmds.AddCommand(cmdTopNode) |
|
41 |
+ cmds.AddCommand(cmdTopPod) |
|
36 | 42 |
return cmds |
37 | 43 |
} |
... | ... |
@@ -13,22 +13,25 @@ import ( |
13 | 13 |
"k8s.io/kubernetes/pkg/util/validation/field" |
14 | 14 |
|
15 | 15 |
configapilatest "github.com/openshift/origin/pkg/cmd/server/api/latest" |
16 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
17 |
+ |
|
16 | 18 |
"github.com/openshift/origin/pkg/cmd/server/api/validation" |
17 | 19 |
) |
18 | 20 |
|
19 | 21 |
const ( |
20 |
- ValidateMasterConfigRecommendedName = "master-config" |
|
21 |
- |
|
22 |
- validateMasterConfigLong = ` |
|
23 |
-Validate the configuration file for a master server. |
|
22 |
+ ValidateMasterConfigRecommendedName = "master-config" |
|
23 |
+ validateMasterConfigDeprecationMessage = `This command is deprecated and will be removed. Use 'oadm diagnostics MasterConfigCheck --master-config=path/to/config.yaml' instead.` |
|
24 |
+) |
|
24 | 25 |
|
25 |
-This command validates that a configuration file intended to be used for a master server is valid. |
|
26 |
-` |
|
26 |
+var ( |
|
27 |
+ validateMasterConfigLong = templates.LongDesc(` |
|
28 |
+ Validate the configuration file for a master server. |
|
27 | 29 |
|
28 |
- validateMasterConfigExample = ` // Validate master server configuration file |
|
29 |
- %s openshift.local.config/master/master-config.yaml` |
|
30 |
+ This command validates that a configuration file intended to be used for a master server is valid.`) |
|
30 | 31 |
|
31 |
- validateMasterConfigDeprecationMessage = `This command is deprecated and will be removed. Use 'oadm diagnostics MasterConfigCheck --master-config=path/to/config.yaml' instead.` |
|
32 |
+ validateMasterConfigExample = templates.Examples(` |
|
33 |
+ # Validate master server configuration file |
|
34 |
+ %s openshift.local.config/master/master-config.yaml`) |
|
32 | 35 |
) |
33 | 36 |
|
34 | 37 |
type ValidateMasterConfigOptions struct { |
... | ... |
@@ -13,21 +13,23 @@ import ( |
13 | 13 |
|
14 | 14 |
configapilatest "github.com/openshift/origin/pkg/cmd/server/api/latest" |
15 | 15 |
"github.com/openshift/origin/pkg/cmd/server/api/validation" |
16 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
16 | 17 |
) |
17 | 18 |
|
18 | 19 |
const ( |
19 |
- ValidateNodeConfigRecommendedName = "node-config" |
|
20 |
- |
|
21 |
- validateNodeConfigLong = ` |
|
22 |
-Validate the configuration file for a node. |
|
20 |
+ ValidateNodeConfigRecommendedName = "node-config" |
|
21 |
+ validateNodeConfigDeprecationMessage = `This command is deprecated and will be removed. Use 'oadm diagnostics NodeConfigCheck --node-config=path/to/config.yaml' instead.` |
|
22 |
+) |
|
23 | 23 |
|
24 |
-This command validates that a configuration file intended to be used for a node is valid. |
|
25 |
-` |
|
24 |
+var ( |
|
25 |
+ validateNodeConfigLong = templates.LongDesc(` |
|
26 |
+ Validate the configuration file for a node. |
|
26 | 27 |
|
27 |
- valiateNodeConfigExample = ` // Validate node configuration file |
|
28 |
- %s openshift.local.config/master/node-config.yaml` |
|
28 |
+ This command validates that a configuration file intended to be used for a node is valid.`) |
|
29 | 29 |
|
30 |
- validateNodeConfigDeprecationMessage = `This command is deprecated and will be removed. Use 'oadm diagnostics NodeConfigCheck --node-config=path/to/config.yaml' instead.` |
|
30 |
+ validateNodeConfigExample = templates.Examples(` |
|
31 |
+ # Validate node configuration file |
|
32 |
+ %s openshift.local.config/master/node-config.yaml`) |
|
31 | 33 |
) |
32 | 34 |
|
33 | 35 |
type ValidateNodeConfigOptions struct { |
... | ... |
@@ -48,7 +50,7 @@ func NewCommandValidateNodeConfig(name, fullName string, out io.Writer) *cobra.C |
48 | 48 |
Use: fmt.Sprintf("%s SOURCE", name), |
49 | 49 |
Short: "Validate the configuration file for a node", |
50 | 50 |
Long: validateNodeConfigLong, |
51 |
- Example: fmt.Sprintf(valiateNodeConfigExample, fullName), |
|
51 |
+ Example: fmt.Sprintf(validateNodeConfigExample, fullName), |
|
52 | 52 |
Deprecated: validateNodeConfigDeprecationMessage, |
53 | 53 |
Run: func(c *cobra.Command, args []string) { |
54 | 54 |
if err := options.Complete(args); err != nil { |
... | ... |
@@ -5,21 +5,22 @@ import ( |
5 | 5 |
|
6 | 6 |
"github.com/spf13/cobra" |
7 | 7 |
|
8 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
8 | 9 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
9 | 10 |
) |
10 | 11 |
|
11 | 12 |
const ( |
12 | 13 |
ValidateRecommendedName = "validate" |
13 | 14 |
|
14 |
- validateLong = `Validate configuration file integrity |
|
15 |
- |
|
16 |
-The commands here allow administrators to validate the integrity of configuration files. |
|
17 |
-` |
|
18 |
- |
|
19 | 15 |
validateDeprecationMessage = `and will be removed. Use "oadm diagnostics" to run configuration validations instead. |
20 | 16 |
See sub-command help text for specific instructions with "oadm diagnostics".` |
21 | 17 |
) |
22 | 18 |
|
19 |
+var validateLong = templates.LongDesc(` |
|
20 |
+ Validate configuration file integrity |
|
21 |
+ |
|
22 |
+ The commands here allow administrators to validate the integrity of configuration files.`) |
|
23 |
+ |
|
23 | 24 |
func NewCommandValidate(name, fullName string, out io.Writer) *cobra.Command { |
24 | 25 |
// Parent command to which all subcommands are added. |
25 | 26 |
cmds := &cobra.Command{ |
... | ... |
@@ -35,35 +35,38 @@ import ( |
35 | 35 |
|
36 | 36 |
const productName = `OpenShift` |
37 | 37 |
|
38 |
-const cliLong = productName + ` Client |
|
38 |
+var ( |
|
39 |
+ cliLong = templates.LongDesc(` |
|
40 |
+ ` + productName + ` Client |
|
39 | 41 |
|
40 |
-This client helps you develop, build, deploy, and run your applications on any OpenShift or Kubernetes compatible platform. It also includes the administrative commands for managing a cluster under the 'adm' subcommand. |
|
41 |
-` |
|
42 |
+ This client helps you develop, build, deploy, and run your applications on any |
|
43 |
+ OpenShift or Kubernetes compatible platform. It also includes the administrative |
|
44 |
+ commands for managing a cluster under the 'adm' subcommand.`) |
|
42 | 45 |
|
43 |
-const cliExplain = ` |
|
44 |
-To create a new application, login to your server and then run new-app: |
|
46 |
+ cliExplain = templates.LongDesc(` |
|
47 |
+ To create a new application, login to your server and then run new-app: |
|
45 | 48 |
|
46 |
- %[1]s login https://mycluster.mycompany.com |
|
47 |
- %[1]s new-app centos/ruby-22-centos7~https://github.com/openshift/ruby-ex.git |
|
48 |
- %[1]s logs -f bc/ruby-ex |
|
49 |
+ %[1]s login https://mycluster.mycompany.com |
|
50 |
+ %[1]s new-app centos/ruby-22-centos7~https://github.com/openshift/ruby-ex.git |
|
51 |
+ %[1]s logs -f bc/ruby-ex |
|
49 | 52 |
|
50 |
-This will create an application based on the Docker image 'centos/ruby-22-centos7' that builds the source code from GitHub. A build will start automatically, push the resulting image to the registry, and a deployment will roll that change out in your project. |
|
53 |
+ This will create an application based on the Docker image 'centos/ruby-22-centos7' that builds the source code from GitHub. A build will start automatically, push the resulting image to the registry, and a deployment will roll that change out in your project. |
|
51 | 54 |
|
52 |
-Once your application is deployed, use the status, describe, and get commands to see more about the created components: |
|
55 |
+ Once your application is deployed, use the status, describe, and get commands to see more about the created components: |
|
53 | 56 |
|
54 |
- %[1]s status |
|
55 |
- %[1]s describe deploymentconfig ruby-ex |
|
56 |
- %[1]s get pods |
|
57 |
+ %[1]s status |
|
58 |
+ %[1]s describe deploymentconfig ruby-ex |
|
59 |
+ %[1]s get pods |
|
57 | 60 |
|
58 |
-To make this application visible outside of the cluster, use the expose command on the service we just created to create a 'route' (which will connect your application over the HTTP port to a public domain name). |
|
61 |
+ To make this application visible outside of the cluster, use the expose command on the service we just created to create a 'route' (which will connect your application over the HTTP port to a public domain name). |
|
59 | 62 |
|
60 |
- %[1]s expose svc/ruby-ex |
|
61 |
- %[1]s status |
|
63 |
+ %[1]s expose svc/ruby-ex |
|
64 |
+ %[1]s status |
|
62 | 65 |
|
63 |
-You should now see the URL the application can be reached at. |
|
66 |
+ You should now see the URL the application can be reached at. |
|
64 | 67 |
|
65 |
-To see the full list of commands supported, run '%[1]s help'. |
|
66 |
-` |
|
68 |
+ To see the full list of commands supported, run '%[1]s --help'.`) |
|
69 |
+) |
|
67 | 70 |
|
68 | 71 |
func NewCommandCLI(name, fullName string, in io.Reader, out, errout io.Writer) *cobra.Command { |
69 | 72 |
// Main command |
... | ... |
@@ -75,8 +78,7 @@ func NewCommandCLI(name, fullName string, in io.Reader, out, errout io.Writer) * |
75 | 75 |
explainOut := term.NewResponsiveWriter(out) |
76 | 76 |
c.SetOutput(explainOut) |
77 | 77 |
cmdutil.RequireNoArguments(c, args) |
78 |
- fmt.Fprint(explainOut, cliLong) |
|
79 |
- fmt.Fprintf(explainOut, cliExplain, fullName) |
|
78 |
+ fmt.Fprintf(explainOut, "%s\n\n%s\n", cliLong, fmt.Sprintf(cliExplain, fullName)) |
|
80 | 79 |
}, |
81 | 80 |
BashCompletionFunction: bashCompletionFunc, |
82 | 81 |
} |
... | ... |
@@ -14,19 +14,21 @@ import ( |
14 | 14 |
|
15 | 15 |
"github.com/openshift/origin/pkg/build/api" |
16 | 16 |
buildutil "github.com/openshift/origin/pkg/build/util" |
17 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
17 | 18 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
18 | 19 |
) |
19 | 20 |
|
20 |
-const ( |
|
21 |
- buildLogsLong = ` |
|
22 |
-Retrieve logs for a build |
|
21 |
+var ( |
|
22 |
+ buildLogsLong = templates.LongDesc(` |
|
23 |
+ Retrieve logs for a build |
|
23 | 24 |
|
24 |
-This command displays the log for the provided build. If the pod that ran the build has been deleted logs |
|
25 |
-will no longer be available. If the build has not yet completed, the build logs will be streamed until the |
|
26 |
-build completes or fails.` |
|
25 |
+ This command displays the log for the provided build. If the pod that ran the build has been deleted logs |
|
26 |
+ will no longer be available. If the build has not yet completed, the build logs will be streamed until the |
|
27 |
+ build completes or fails.`) |
|
27 | 28 |
|
28 |
- buildLogsExample = ` # Stream logs from container |
|
29 |
- %[1]s build-logs 566bed879d2d` |
|
29 |
+ buildLogsExample = templates.Examples(` |
|
30 |
+ # Stream logs from container |
|
31 |
+ %[1]s build-logs 566bed879d2d`) |
|
30 | 32 |
) |
31 | 33 |
|
32 | 34 |
// NewCmdBuildLogs implements the OpenShift cli build-logs command |
... | ... |
@@ -19,6 +19,7 @@ import ( |
19 | 19 |
buildclient "github.com/openshift/origin/pkg/build/client" |
20 | 20 |
buildutil "github.com/openshift/origin/pkg/build/util" |
21 | 21 |
osclient "github.com/openshift/origin/pkg/client" |
22 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
22 | 23 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
23 | 24 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
24 | 25 |
) |
... | ... |
@@ -26,27 +27,28 @@ import ( |
26 | 26 |
// CancelBuildRecommendedCommandName is the recommended command name. |
27 | 27 |
const CancelBuildRecommendedCommandName = "cancel-build" |
28 | 28 |
|
29 |
-const ( |
|
30 |
- cancelBuildLong = ` |
|
31 |
-Cancel running, pending, or new builds |
|
29 |
+var ( |
|
30 |
+ cancelBuildLong = templates.LongDesc(` |
|
31 |
+ Cancel running, pending, or new builds |
|
32 | 32 |
|
33 |
-This command requests a graceful shutdown of the build. There may be a delay between requesting |
|
34 |
-the build and the time the build is terminated.` |
|
33 |
+ This command requests a graceful shutdown of the build. There may be a delay between requesting |
|
34 |
+ the build and the time the build is terminated.`) |
|
35 | 35 |
|
36 |
- cancelBuildExample = ` # Cancel the build with the given name |
|
37 |
- %[1]s %[2]s ruby-build-2 |
|
36 |
+ cancelBuildExample = templates.Examples(` |
|
37 |
+ # Cancel the build with the given name |
|
38 |
+ %[1]s %[2]s ruby-build-2 |
|
38 | 39 |
|
39 |
- # Cancel the named build and print the build logs |
|
40 |
- %[1]s %[2]s ruby-build-2 --dump-logs |
|
40 |
+ # Cancel the named build and print the build logs |
|
41 |
+ %[1]s %[2]s ruby-build-2 --dump-logs |
|
41 | 42 |
|
42 |
- # Cancel the named build and create a new one with the same parameters |
|
43 |
- %[1]s %[2]s ruby-build-2 --restart |
|
43 |
+ # Cancel the named build and create a new one with the same parameters |
|
44 |
+ %[1]s %[2]s ruby-build-2 --restart |
|
44 | 45 |
|
45 |
- # Cancel multiple builds |
|
46 |
- %[1]s %[2]s ruby-build-1 ruby-build-2 ruby-build-3 |
|
46 |
+ # Cancel multiple builds |
|
47 |
+ %[1]s %[2]s ruby-build-1 ruby-build-2 ruby-build-3 |
|
47 | 48 |
|
48 |
- # Cancel all builds created from 'ruby-build' build configuration that are in 'new' state |
|
49 |
- %[1]s %[2]s bc/ruby-build --state=new` |
|
49 |
+ # Cancel all builds created from 'ruby-build' build configuration that are in 'new' state |
|
50 |
+ %[1]s %[2]s bc/ruby-build --state=new`) |
|
50 | 51 |
) |
51 | 52 |
|
52 | 53 |
// CancelBuildOptions contains all the options for running the CancelBuild cli command. |
... | ... |
@@ -7,30 +7,30 @@ import ( |
7 | 7 |
"github.com/spf13/cobra" |
8 | 8 |
|
9 | 9 |
"github.com/openshift/origin/pkg/bootstrap/docker" |
10 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
10 | 11 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
11 | 12 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
12 | 13 |
) |
13 | 14 |
|
14 |
-const ( |
|
15 |
- ClusterRecommendedName = "cluster" |
|
15 |
+const ClusterRecommendedName = "cluster" |
|
16 | 16 |
|
17 |
- clusterLongDescription = ` |
|
18 |
-Manage a local OpenShift cluster. |
|
17 |
+var ( |
|
18 |
+ clusterLong = templates.LongDesc(` |
|
19 |
+ Manage a local OpenShift cluster |
|
19 | 20 |
|
20 |
-The OpenShift cluster will run as an all-in-one container on a Docker host. The Docker host |
|
21 |
-may be a local VM (ie. using docker-machine on OS X and Windows clients), remote machine, or |
|
22 |
-the local Unix host. |
|
21 |
+ The OpenShift cluster will run as an all-in-one container on a Docker host. The Docker host |
|
22 |
+ may be a local VM (ie. using docker-machine on OS X and Windows clients), remote machine, or |
|
23 |
+ the local Unix host. |
|
23 | 24 |
|
24 |
-To use an existing Docker connection, ensure that Docker commands are working and that you |
|
25 |
-can create new containers. For OS X and Windows clients, a docker-machine with the VirtualBox |
|
26 |
-driver can be created for you using the --create-machine option. |
|
25 |
+ To use an existing Docker connection, ensure that Docker commands are working and that you |
|
26 |
+ can create new containers. For OS X and Windows clients, a docker-machine with the VirtualBox |
|
27 |
+ driver can be created for you using the --create-machine option. |
|
27 | 28 |
|
28 |
-By default, etcd data will not be preserved between container restarts. If you wish to |
|
29 |
-preserve your data, specify a value for --host-data-dir and the --use-existing-config flag. |
|
29 |
+ By default, etcd data will not be preserved between container restarts. If you wish to |
|
30 |
+ preserve your data, specify a value for --host-data-dir and the --use-existing-config flag. |
|
30 | 31 |
|
31 |
-Default routes are setup using xip.io and the host ip of your cluster. To use a different |
|
32 |
-routing suffix, use the --routing-suffix flag. |
|
33 |
-` |
|
32 |
+ Default routes are setup using xip.io and the host ip of your cluster. To use a different |
|
33 |
+ routing suffix, use the --routing-suffix flag.`) |
|
34 | 34 |
) |
35 | 35 |
|
36 | 36 |
func NewCmdCluster(name, fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command { |
... | ... |
@@ -38,7 +38,7 @@ func NewCmdCluster(name, fullName string, f *clientcmd.Factory, out io.Writer) * |
38 | 38 |
cmds := &cobra.Command{ |
39 | 39 |
Use: fmt.Sprintf("%s ACTION", name), |
40 | 40 |
Short: "Start and stop OpenShift cluster", |
41 |
- Long: clusterLongDescription, |
|
41 |
+ Long: clusterLong, |
|
42 | 42 |
Run: cmdutil.DefaultSubCommandRun(out), |
43 | 43 |
} |
44 | 44 |
|
... | ... |
@@ -16,20 +16,22 @@ import ( |
16 | 16 |
"k8s.io/kubernetes/pkg/runtime" |
17 | 17 |
|
18 | 18 |
"github.com/openshift/origin/pkg/client" |
19 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
19 | 20 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
20 | 21 |
quotaapi "github.com/openshift/origin/pkg/quota/api" |
21 | 22 |
) |
22 | 23 |
|
23 |
-const ( |
|
24 |
- ClusterQuotaRecommendedName = "clusterresourcequota" |
|
24 |
+const ClusterQuotaRecommendedName = "clusterresourcequota" |
|
25 | 25 |
|
26 |
- clusterQuotaLong = ` |
|
27 |
-Create a cluster resource quota that controls certain resources. |
|
26 |
+var ( |
|
27 |
+ clusterQuotaLong = templates.LongDesc(` |
|
28 |
+ Create a cluster resource quota that controls certain resources. |
|
28 | 29 |
|
29 |
-Cluster resource quota objects defined quota restrictions that span multiple projects based on label selectors.` |
|
30 |
+ Cluster resource quota objects defined quota restrictions that span multiple projects based on label selectors.`) |
|
30 | 31 |
|
31 |
- clusterQuotaExample = ` # Create a cluster resource quota limited to 10 pods |
|
32 |
- %[1]s limit-bob --project-annotation-selector=openshift.io/requester=user-bob --hard=pods=10` |
|
32 |
+ clusterQuotaExample = templates.Examples(` |
|
33 |
+ # Create a cluster resource quota limited to 10 pods |
|
34 |
+ %[1]s limit-bob --project-annotation-selector=openshift.io/requester=user-bob --hard=pods=10`) |
|
33 | 35 |
) |
34 | 36 |
|
35 | 37 |
type CreateClusterQuotaOptions struct { |
... | ... |
@@ -12,20 +12,22 @@ import ( |
12 | 12 |
"k8s.io/kubernetes/pkg/runtime" |
13 | 13 |
|
14 | 14 |
"github.com/openshift/origin/pkg/client" |
15 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
15 | 16 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
16 | 17 |
deployapi "github.com/openshift/origin/pkg/deploy/api" |
17 | 18 |
) |
18 | 19 |
|
19 |
-const ( |
|
20 |
- DeploymentConfigRecommendedName = "deploymentconfig" |
|
20 |
+var DeploymentConfigRecommendedName = "deploymentconfig" |
|
21 | 21 |
|
22 |
- deploymentConfigLong = ` |
|
23 |
-Create a deployment config that uses a given image. |
|
22 |
+var ( |
|
23 |
+ deploymentConfigLong = templates.LongDesc(` |
|
24 |
+ Create a deployment config that uses a given image. |
|
24 | 25 |
|
25 |
-Deployment configs define the template for a pod and manages deploying new images or configuration changes.` |
|
26 |
+ Deployment configs define the template for a pod and manages deploying new images or configuration changes.`) |
|
26 | 27 |
|
27 |
- deploymentConfigExample = ` # Create an nginx deployment config named my-nginx |
|
28 |
- %[1]s my-nginx --image=nginx` |
|
28 |
+ deploymentConfigExample = templates.Examples(` |
|
29 |
+ # Create an nginx deployment config named my-nginx |
|
30 |
+ %[1]s my-nginx --image=nginx`) |
|
29 | 31 |
) |
30 | 32 |
|
31 | 33 |
type CreateDeploymentConfigOptions struct { |
... | ... |
@@ -12,25 +12,27 @@ import ( |
12 | 12 |
"k8s.io/kubernetes/pkg/runtime" |
13 | 13 |
|
14 | 14 |
"github.com/openshift/origin/pkg/client" |
15 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
15 | 16 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
16 | 17 |
userapi "github.com/openshift/origin/pkg/user/api" |
17 | 18 |
) |
18 | 19 |
|
19 |
-const ( |
|
20 |
- IdentityRecommendedName = "identity" |
|
20 |
+const IdentityRecommendedName = "identity" |
|
21 | 21 |
|
22 |
- identityLong = ` |
|
23 |
-This command can be used to create an identity object. |
|
22 |
+var ( |
|
23 |
+ identityLong = templates.LongDesc(` |
|
24 |
+ This command can be used to create an identity object. |
|
24 | 25 |
|
25 |
-Typically, identities are created automatically during login. If automatic |
|
26 |
-creation is disabled (by using the "lookup" mapping method), identities must |
|
27 |
-be created manually. |
|
26 |
+ Typically, identities are created automatically during login. If automatic |
|
27 |
+ creation is disabled (by using the "lookup" mapping method), identities must |
|
28 |
+ be created manually. |
|
28 | 29 |
|
29 |
-Corresponding user and useridentitymapping objects must also be created |
|
30 |
-to allow logging in with the created identity.` |
|
30 |
+ Corresponding user and useridentitymapping objects must also be created |
|
31 |
+ to allow logging in with the created identity.`) |
|
31 | 32 |
|
32 |
- identityExample = ` # Create an identity with identity provider "acme_ldap" and the identity provider username "adamjones" |
|
33 |
- %[1]s acme_ldap:adamjones` |
|
33 |
+ identityExample = templates.Examples(` |
|
34 |
+ # Create an identity with identity provider "acme_ldap" and the identity provider username "adamjones" |
|
35 |
+ %[1]s acme_ldap:adamjones`) |
|
34 | 36 |
) |
35 | 37 |
|
36 | 38 |
type CreateIdentityOptions struct { |
... | ... |
@@ -12,21 +12,23 @@ import ( |
12 | 12 |
"k8s.io/kubernetes/pkg/runtime" |
13 | 13 |
|
14 | 14 |
"github.com/openshift/origin/pkg/client" |
15 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
15 | 16 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
16 | 17 |
imageapi "github.com/openshift/origin/pkg/image/api" |
17 | 18 |
) |
18 | 19 |
|
19 |
-const ( |
|
20 |
- ImageStreamRecommendedName = "imagestream" |
|
20 |
+const ImageStreamRecommendedName = "imagestream" |
|
21 | 21 |
|
22 |
- imageStreamLong = ` |
|
23 |
-Create a new image stream |
|
22 |
+var ( |
|
23 |
+ imageStreamLong = templates.LongDesc(` |
|
24 |
+ Create a new image stream |
|
24 | 25 |
|
25 |
-Image streams allow you to track, tag, and import images from other registries. They also define an |
|
26 |
-access controlled destination that you can push images to.` |
|
26 |
+ Image streams allow you to track, tag, and import images from other registries. They also define an |
|
27 |
+ access controlled destination that you can push images to.`) |
|
27 | 28 |
|
28 |
- imageStreamExample = ` # Create a new image stream |
|
29 |
- %[1]s mysql` |
|
29 |
+ imageStreamExample = templates.Examples(` |
|
30 |
+ # Create a new image stream |
|
31 |
+ %[1]s mysql`) |
|
30 | 32 |
) |
31 | 33 |
|
32 | 34 |
type CreateImageStreamOptions struct { |
... | ... |
@@ -12,17 +12,18 @@ import ( |
12 | 12 |
|
13 | 13 |
authorizationapi "github.com/openshift/origin/pkg/authorization/api" |
14 | 14 |
"github.com/openshift/origin/pkg/client" |
15 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
15 | 16 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
16 | 17 |
) |
17 | 18 |
|
18 |
-const ( |
|
19 |
- PolicyBindingRecommendedName = "policybinding" |
|
19 |
+const PolicyBindingRecommendedName = "policybinding" |
|
20 | 20 |
|
21 |
- policyBindingLong = ` |
|
22 |
-Create a policy binding that references the policy in the targetted namespace.` |
|
21 |
+var ( |
|
22 |
+ policyBindingLong = templates.LongDesc(`Create a policy binding that references the policy in the targetted namespace.`) |
|
23 | 23 |
|
24 |
- policyBindingExample = ` # Create a policy binding in namespace "foo" that references the policy in namespace "bar" |
|
25 |
- %[1]s bar -n foo` |
|
24 |
+ policyBindingExample = templates.Examples(` |
|
25 |
+ # Create a policy binding in namespace "foo" that references the policy in namespace "bar" |
|
26 |
+ %[1]s bar -n foo`) |
|
26 | 27 |
) |
27 | 28 |
|
28 | 29 |
type CreatePolicyBindingOptions struct { |
... | ... |
@@ -10,19 +10,19 @@ import ( |
10 | 10 |
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" |
11 | 11 |
"k8s.io/kubernetes/pkg/kubectl/resource" |
12 | 12 |
|
13 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
13 | 14 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
14 | 15 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
15 | 16 |
"github.com/openshift/origin/pkg/route/api" |
16 | 17 |
fileutil "github.com/openshift/origin/pkg/util/file" |
17 | 18 |
) |
18 | 19 |
|
19 |
-const ( |
|
20 |
- routeLong = ` |
|
21 |
-Expose containers externally via secured routes |
|
20 |
+var ( |
|
21 |
+ routeLong = templates.LongDesc(` |
|
22 |
+ Expose containers externally via secured routes |
|
22 | 23 |
|
23 |
-Three types of secured routes are supported: edge, passthrough, and reencrypt. |
|
24 |
-If you wish to create unsecured routes, see "%[1]s expose -h" |
|
25 |
-` |
|
24 |
+ Three types of secured routes are supported: edge, passthrough, and reencrypt. |
|
25 |
+ If you wish to create unsecured routes, see "%[1]s expose -h"`) |
|
26 | 26 |
) |
27 | 27 |
|
28 | 28 |
// NewCmdCreateRoute is a macro command to create a secured route. |
... | ... |
@@ -41,19 +41,20 @@ func NewCmdCreateRoute(fullName string, f *clientcmd.Factory, out io.Writer) *co |
41 | 41 |
return cmd |
42 | 42 |
} |
43 | 43 |
|
44 |
-const ( |
|
45 |
- edgeRouteLong = ` |
|
46 |
-Create a route that uses edge TLS termination |
|
44 |
+var ( |
|
45 |
+ edgeRouteLong = templates.LongDesc(` |
|
46 |
+ Create a route that uses edge TLS termination |
|
47 | 47 |
|
48 |
-Specify the service (either just its name or using type/name syntax) that the |
|
49 |
-generated route should expose via the --service flag.` |
|
48 |
+ Specify the service (either just its name or using type/name syntax) that the |
|
49 |
+ generated route should expose via the --service flag.`) |
|
50 | 50 |
|
51 |
- edgeRouteExample = ` # Create an edge route named "my-route" that exposes frontend service. |
|
52 |
- %[1]s create route edge my-route --service=frontend |
|
51 |
+ edgeRouteExample = templates.Examples(` |
|
52 |
+ # Create an edge route named "my-route" that exposes frontend service. |
|
53 |
+ %[1]s create route edge my-route --service=frontend |
|
53 | 54 |
|
54 |
- # Create an edge route that exposes the frontend service and specify a path. |
|
55 |
- # If the route name is omitted, the service name will be re-used. |
|
56 |
- %[1]s create route edge --service=frontend --path /assets` |
|
55 |
+ # Create an edge route that exposes the frontend service and specify a path. |
|
56 |
+ # If the route name is omitted, the service name will be re-used. |
|
57 |
+ %[1]s create route edge --service=frontend --path /assets`) |
|
57 | 58 |
) |
58 | 59 |
|
59 | 60 |
// NewCmdCreateEdgeRoute is a macro command to create an edge route. |
... | ... |
@@ -155,19 +156,20 @@ func CreateEdgeRoute(f *clientcmd.Factory, out io.Writer, cmd *cobra.Command, ar |
155 | 155 |
return nil |
156 | 156 |
} |
157 | 157 |
|
158 |
-const ( |
|
159 |
- passthroughRouteLong = ` |
|
160 |
-Create a route that uses passthrough TLS termination |
|
158 |
+var ( |
|
159 |
+ passthroughRouteLong = templates.LongDesc(` |
|
160 |
+ Create a route that uses passthrough TLS termination |
|
161 | 161 |
|
162 |
-Specify the service (either just its name or using type/name syntax) that the |
|
163 |
-generated route should expose via the --service flag.` |
|
162 |
+ Specify the service (either just its name or using type/name syntax) that the |
|
163 |
+ generated route should expose via the --service flag.`) |
|
164 | 164 |
|
165 |
- passthroughRouteExample = ` # Create a passthrough route named "my-route" that exposes the frontend service. |
|
166 |
- %[1]s create route passthrough my-route --service=frontend |
|
165 |
+ passthroughRouteExample = templates.Examples(` |
|
166 |
+ # Create a passthrough route named "my-route" that exposes the frontend service. |
|
167 |
+ %[1]s create route passthrough my-route --service=frontend |
|
167 | 168 |
|
168 |
- # Create a passthrough route that exposes the frontend service and specify |
|
169 |
- # a hostname. If the route name is omitted, the service name will be re-used. |
|
170 |
- %[1]s create route passthrough --service=frontend --hostname=www.example.com` |
|
169 |
+ # Create a passthrough route that exposes the frontend service and specify |
|
170 |
+ # a hostname. If the route name is omitted, the service name will be re-used. |
|
171 |
+ %[1]s create route passthrough --service=frontend --hostname=www.example.com`) |
|
171 | 172 |
) |
172 | 173 |
|
173 | 174 |
// NewCmdCreatePassthroughRoute is a macro command to create a passthrough route. |
... | ... |
@@ -240,20 +242,21 @@ func CreatePassthroughRoute(f *clientcmd.Factory, out io.Writer, cmd *cobra.Comm |
240 | 240 |
return nil |
241 | 241 |
} |
242 | 242 |
|
243 |
-const ( |
|
244 |
- reencryptRouteLong = ` |
|
245 |
-Create a route that uses reencrypt TLS termination |
|
243 |
+var ( |
|
244 |
+ reencryptRouteLong = templates.LongDesc(` |
|
245 |
+ Create a route that uses reencrypt TLS termination |
|
246 | 246 |
|
247 |
-Specify the service (either just its name or using type/name syntax) that the |
|
248 |
-generated route should expose via the --service flag. A destination CA certificate |
|
249 |
-is needed for reencrypt routes, specify one with the --dest-ca-cert flag.` |
|
247 |
+ Specify the service (either just its name or using type/name syntax) that the |
|
248 |
+ generated route should expose via the --service flag. A destination CA certificate |
|
249 |
+ is needed for reencrypt routes, specify one with the --dest-ca-cert flag.`) |
|
250 | 250 |
|
251 |
- reencryptRouteExample = ` # Create a route named "my-route" that exposes the frontend service. |
|
252 |
- %[1]s create route reencrypt my-route --service=frontend --dest-ca-cert cert.cert |
|
251 |
+ reencryptRouteExample = templates.Examples(` |
|
252 |
+ # Create a route named "my-route" that exposes the frontend service. |
|
253 |
+ %[1]s create route reencrypt my-route --service=frontend --dest-ca-cert cert.cert |
|
253 | 254 |
|
254 |
- # Create a reencrypt route that exposes the frontend service and re-use |
|
255 |
- # the service name as the route name. |
|
256 |
- %[1]s create route reencrypt --service=frontend --dest-ca-cert cert.cert` |
|
255 |
+ # Create a reencrypt route that exposes the frontend service and re-use |
|
256 |
+ # the service name as the route name. |
|
257 |
+ %[1]s create route reencrypt --service=frontend --dest-ca-cert cert.cert`) |
|
257 | 258 |
) |
258 | 259 |
|
259 | 260 |
// NewCmdCreateReencryptRoute is a macro command to create a reencrypt route. |
... | ... |
@@ -11,25 +11,27 @@ import ( |
11 | 11 |
"k8s.io/kubernetes/pkg/runtime" |
12 | 12 |
|
13 | 13 |
"github.com/openshift/origin/pkg/client" |
14 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
14 | 15 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
15 | 16 |
userapi "github.com/openshift/origin/pkg/user/api" |
16 | 17 |
) |
17 | 18 |
|
18 |
-const ( |
|
19 |
- UserRecommendedName = "user" |
|
19 |
+const UserRecommendedName = "user" |
|
20 | 20 |
|
21 |
- userLong = ` |
|
22 |
-This command can be used to create a user object. |
|
21 |
+var ( |
|
22 |
+ userLong = templates.LongDesc(` |
|
23 |
+ This command can be used to create a user object. |
|
23 | 24 |
|
24 |
-Typically, users are created automatically during login. If automatic |
|
25 |
-creation is disabled (by using the "lookup" mapping method), users must |
|
26 |
-be created manually. |
|
25 |
+ Typically, users are created automatically during login. If automatic |
|
26 |
+ creation is disabled (by using the "lookup" mapping method), users must |
|
27 |
+ be created manually. |
|
27 | 28 |
|
28 |
-Corresponding identity and useridentitymapping objects must also be created |
|
29 |
-to allow logging in as the created user.` |
|
29 |
+ Corresponding identity and useridentitymapping objects must also be created |
|
30 |
+ to allow logging in as the created user.`) |
|
30 | 31 |
|
31 |
- userExample = ` # Create a user with the username "ajones" and the display name "Adam Jones" |
|
32 |
- %[1]s ajones --full-name="Adam Jones"` |
|
32 |
+ userExample = templates.Examples(` |
|
33 |
+ # Create a user with the username "ajones" and the display name "Adam Jones" |
|
34 |
+ %[1]s ajones --full-name="Adam Jones"`) |
|
33 | 35 |
) |
34 | 36 |
|
35 | 37 |
type CreateUserOptions struct { |
... | ... |
@@ -12,21 +12,23 @@ import ( |
12 | 12 |
"k8s.io/kubernetes/pkg/runtime" |
13 | 13 |
|
14 | 14 |
"github.com/openshift/origin/pkg/client" |
15 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
15 | 16 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
16 | 17 |
userapi "github.com/openshift/origin/pkg/user/api" |
17 | 18 |
) |
18 | 19 |
|
19 |
-const ( |
|
20 |
- UserIdentityMappingRecommendedName = "useridentitymapping" |
|
20 |
+const UserIdentityMappingRecommendedName = "useridentitymapping" |
|
21 | 21 |
|
22 |
- userIdentityMappingLong = ` |
|
23 |
-Typically, identities are automatically mapped to users during login. If automatic |
|
24 |
-mapping is disabled (by using the "lookup" mapping method), or a mapping needs to |
|
25 |
-be manually established between an identity and a user, this command can be used |
|
26 |
-to create a useridentitymapping object.` |
|
22 |
+var ( |
|
23 |
+ userIdentityMappingLong = templates.LongDesc(` |
|
24 |
+ Typically, identities are automatically mapped to users during login. If automatic |
|
25 |
+ mapping is disabled (by using the "lookup" mapping method), or a mapping needs to |
|
26 |
+ be manually established between an identity and a user, this command can be used |
|
27 |
+ to create a useridentitymapping object.`) |
|
27 | 28 |
|
28 |
- userIdentityMappingExample = ` # Map the identity "acme_ldap:adamjones" to the user "ajones" |
|
29 |
- %[1]s acme_ldap:adamjones ajones` |
|
29 |
+ userIdentityMappingExample = templates.Examples(` |
|
30 |
+ # Map the identity "acme_ldap:adamjones" to the user "ajones" |
|
31 |
+ %[1]s acme_ldap:adamjones ajones`) |
|
30 | 32 |
) |
31 | 33 |
|
32 | 34 |
type CreateUserIdentityMappingOptions struct { |
... | ... |
@@ -24,6 +24,7 @@ import ( |
24 | 24 |
"k8s.io/kubernetes/pkg/util/term" |
25 | 25 |
"k8s.io/kubernetes/pkg/watch" |
26 | 26 |
|
27 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
27 | 28 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
28 | 29 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
29 | 30 |
generateapp "github.com/openshift/origin/pkg/generate/app" |
... | ... |
@@ -59,45 +60,47 @@ type DebugOptions struct { |
59 | 59 |
} |
60 | 60 |
|
61 | 61 |
const ( |
62 |
- debugLong = ` |
|
63 |
-Launch a command shell to debug a running application |
|
62 |
+ debugPodLabelName = "debug.openshift.io/name" |
|
64 | 63 |
|
65 |
-When debugging images and setup problems, it's useful to get an exact copy of a running |
|
66 |
-pod configuration and troubleshoot with a shell. Since a pod that is failing may not be |
|
67 |
-started and not accessible to 'rsh' or 'exec', the 'debug' command makes it easy to |
|
68 |
-create a carbon copy of that setup. |
|
64 |
+ debugPodAnnotationSourceContainer = "debug.openshift.io/source-container" |
|
65 |
+ debugPodAnnotationSourceResource = "debug.openshift.io/source-resource" |
|
66 |
+) |
|
69 | 67 |
|
70 |
-The default mode is to start a shell inside of the first container of the referenced pod, |
|
71 |
-replication controller, or deployment config. The started pod will be a copy of your |
|
72 |
-source pod, with labels stripped, the command changed to '/bin/sh', and readiness and |
|
73 |
-liveness checks disabled. If you just want to run a command, add '--' and a command to |
|
74 |
-run. Passing a command will not create a TTY or send STDIN by default. Other flags are |
|
75 |
-supported for altering the container or pod in common ways. |
|
68 |
+var ( |
|
69 |
+ debugLong = templates.LongDesc(` |
|
70 |
+ Launch a command shell to debug a running application |
|
76 | 71 |
|
77 |
-A common problem running containers is a security policy that prohibits you from running |
|
78 |
-as a root user on the cluster. You can use this command to test running a pod as |
|
79 |
-non-root (with --as-user) or to run a non-root pod as root (with --as-root). |
|
72 |
+ When debugging images and setup problems, it's useful to get an exact copy of a running |
|
73 |
+ pod configuration and troubleshoot with a shell. Since a pod that is failing may not be |
|
74 |
+ started and not accessible to 'rsh' or 'exec', the 'debug' command makes it easy to |
|
75 |
+ create a carbon copy of that setup. |
|
80 | 76 |
|
81 |
-The debug pod is deleted when the the remote command completes or the user interrupts |
|
82 |
-the shell.` |
|
77 |
+ The default mode is to start a shell inside of the first container of the referenced pod, |
|
78 |
+ replication controller, or deployment config. The started pod will be a copy of your |
|
79 |
+ source pod, with labels stripped, the command changed to '/bin/sh', and readiness and |
|
80 |
+ liveness checks disabled. If you just want to run a command, add '--' and a command to |
|
81 |
+ run. Passing a command will not create a TTY or send STDIN by default. Other flags are |
|
82 |
+ supported for altering the container or pod in common ways. |
|
83 | 83 |
|
84 |
- debugExample = ` |
|
85 |
- # Debug a currently running deployment |
|
86 |
- %[1]s dc/test |
|
84 |
+ A common problem running containers is a security policy that prohibits you from running |
|
85 |
+ as a root user on the cluster. You can use this command to test running a pod as |
|
86 |
+ non-root (with --as-user) or to run a non-root pod as root (with --as-root). |
|
87 | 87 |
|
88 |
- # Test running a deployment as a non-root user |
|
89 |
- %[1]s dc/test --as-user=1000000 |
|
88 |
+ The debug pod is deleted when the the remote command completes or the user interrupts |
|
89 |
+ the shell.`) |
|
90 | 90 |
|
91 |
- # Debug a specific failing container by running the env command in the 'second' container |
|
92 |
- %[1]s dc/test -c second -- /bin/env |
|
91 |
+ debugExample = templates.Examples(` |
|
92 |
+ # Debug a currently running deployment |
|
93 |
+ %[1]s dc/test |
|
93 | 94 |
|
94 |
- # See the pod that would be created to debug |
|
95 |
- %[1]s dc/test -o yaml` |
|
95 |
+ # Test running a deployment as a non-root user |
|
96 |
+ %[1]s dc/test --as-user=1000000 |
|
96 | 97 |
|
97 |
- debugPodLabelName = "debug.openshift.io/name" |
|
98 |
+ # Debug a specific failing container by running the env command in the 'second' container |
|
99 |
+ %[1]s dc/test -c second -- /bin/env |
|
98 | 100 |
|
99 |
- debugPodAnnotationSourceContainer = "debug.openshift.io/source-container" |
|
100 |
- debugPodAnnotationSourceResource = "debug.openshift.io/source-resource" |
|
101 |
+ # See the pod that would be created to debug |
|
102 |
+ %[1]s dc/test -o yaml`) |
|
101 | 103 |
) |
102 | 104 |
|
103 | 105 |
// NewCmdDebug creates a command for debugging pods. |
... | ... |
@@ -21,6 +21,7 @@ import ( |
21 | 21 |
|
22 | 22 |
"github.com/openshift/origin/pkg/client" |
23 | 23 |
"github.com/openshift/origin/pkg/cmd/cli/describe" |
24 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
24 | 25 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
25 | 26 |
deployapi "github.com/openshift/origin/pkg/deploy/api" |
26 | 27 |
deployutil "github.com/openshift/origin/pkg/deploy/util" |
... | ... |
@@ -43,52 +44,53 @@ type DeployOptions struct { |
43 | 43 |
follow bool |
44 | 44 |
} |
45 | 45 |
|
46 |
-const ( |
|
47 |
- deployLong = ` |
|
48 |
-View, start, cancel, or retry a deployment |
|
46 |
+var ( |
|
47 |
+ deployLong = templates.LongDesc(` |
|
48 |
+ View, start, cancel, or retry a deployment |
|
49 | 49 |
|
50 |
-This command allows you to control a deployment config. Each individual deployment is exposed |
|
51 |
-as a new replication controller, and the deployment process manages scaling down old deployments |
|
52 |
-and scaling up new ones. Use '%[1]s rollback' to rollback to any previous deployment. |
|
50 |
+ This command allows you to control a deployment config. Each individual deployment is exposed |
|
51 |
+ as a new replication controller, and the deployment process manages scaling down old deployments |
|
52 |
+ and scaling up new ones. Use '%[1]s rollback' to rollback to any previous deployment. |
|
53 | 53 |
|
54 |
-There are several deployment strategies defined: |
|
54 |
+ There are several deployment strategies defined: |
|
55 | 55 |
|
56 |
-* Rolling (default) - scales up the new deployment in stages, gradually reducing the number |
|
57 |
- of old deployments. If one of the new deployed pods never becomes "ready", the new deployment |
|
58 |
- will be rolled back (scaled down to zero). Use when your application can tolerate two versions |
|
59 |
- of code running at the same time (many web applications, scalable databases) |
|
60 |
-* Recreate - scales the old deployment down to zero, then scales the new deployment up to full. |
|
61 |
- Use when your application cannot tolerate two versions of code running at the same time |
|
62 |
-* Custom - run your own deployment process inside a Docker container using your own scripts. |
|
56 |
+ * Rolling (default) - scales up the new deployment in stages, gradually reducing the number |
|
57 |
+ of old deployments. If one of the new deployed pods never becomes "ready", the new deployment |
|
58 |
+ will be rolled back (scaled down to zero). Use when your application can tolerate two versions |
|
59 |
+ of code running at the same time (many web applications, scalable databases) |
|
60 |
+ * Recreate - scales the old deployment down to zero, then scales the new deployment up to full. |
|
61 |
+ Use when your application cannot tolerate two versions of code running at the same time |
|
62 |
+ * Custom - run your own deployment process inside a Docker container using your own scripts. |
|
63 | 63 |
|
64 |
-If a deployment fails, you may opt to retry it (if the error was transient). Some deployments may |
|
65 |
-never successfully complete - in which case you can use the '--latest' flag to force a redeployment. |
|
66 |
-If a deployment config has completed deploying successfully at least once in the past, it would be |
|
67 |
-automatically rolled back in the event of a new failed deployment. Note that you would still need |
|
68 |
-to update the erroneous deployment config in order to have its template persisted across your |
|
69 |
-application. |
|
64 |
+ If a deployment fails, you may opt to retry it (if the error was transient). Some deployments may |
|
65 |
+ never successfully complete - in which case you can use the '--latest' flag to force a redeployment. |
|
66 |
+ If a deployment config has completed deploying successfully at least once in the past, it would be |
|
67 |
+ automatically rolled back in the event of a new failed deployment. Note that you would still need |
|
68 |
+ to update the erroneous deployment config in order to have its template persisted across your |
|
69 |
+ application. |
|
70 | 70 |
|
71 |
-If you want to cancel a running deployment, use '--cancel' but keep in mind that this is a best-effort |
|
72 |
-operation and may take some time to complete. It’s possible the deployment will partially or totally |
|
73 |
-complete before the cancellation is effective. In such a case an appropriate event will be emitted. |
|
71 |
+ If you want to cancel a running deployment, use '--cancel' but keep in mind that this is a best-effort |
|
72 |
+ operation and may take some time to complete. It’s possible the deployment will partially or totally |
|
73 |
+ complete before the cancellation is effective. In such a case an appropriate event will be emitted. |
|
74 | 74 |
|
75 |
-If no options are given, shows information about the latest deployment.` |
|
75 |
+ If no options are given, shows information about the latest deployment.`) |
|
76 | 76 |
|
77 |
- deployExample = ` # Display the latest deployment for the 'database' deployment config |
|
78 |
- %[1]s deploy database |
|
77 |
+ deployExample = templates.Examples(` |
|
78 |
+ # Display the latest deployment for the 'database' deployment config |
|
79 |
+ %[1]s deploy database |
|
79 | 80 |
|
80 |
- # Start a new deployment based on the 'database' |
|
81 |
- %[1]s deploy database --latest |
|
81 |
+ # Start a new deployment based on the 'database' |
|
82 |
+ %[1]s deploy database --latest |
|
82 | 83 |
|
83 |
- # Start a new deployment and follow its log |
|
84 |
- %[1]s deploy database --latest --follow |
|
84 |
+ # Start a new deployment and follow its log |
|
85 |
+ %[1]s deploy database --latest --follow |
|
85 | 86 |
|
86 |
- # Retry the latest failed deployment based on 'frontend' |
|
87 |
- # The deployer pod and any hook pods are deleted for the latest failed deployment |
|
88 |
- %[1]s deploy frontend --retry |
|
87 |
+ # Retry the latest failed deployment based on 'frontend' |
|
88 |
+ # The deployer pod and any hook pods are deleted for the latest failed deployment |
|
89 |
+ %[1]s deploy frontend --retry |
|
89 | 90 |
|
90 |
- # Cancel the in-progress deployment based on 'frontend' |
|
91 |
- %[1]s deploy frontend --cancel` |
|
91 |
+ # Cancel the in-progress deployment based on 'frontend' |
|
92 |
+ %[1]s deploy frontend --cancel`) |
|
92 | 93 |
) |
93 | 94 |
|
94 | 95 |
// NewCmdDeploy creates a new `deploy` command. |
... | ... |
@@ -17,26 +17,28 @@ import ( |
17 | 17 |
"k8s.io/kubernetes/pkg/util/interrupt" |
18 | 18 |
|
19 | 19 |
dockerbuilder "github.com/openshift/imagebuilder/dockerclient" |
20 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
20 | 21 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
21 | 22 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
22 | 23 |
) |
23 | 24 |
|
24 |
-const ( |
|
25 |
- dockerbuildLong = ` |
|
26 |
-Build a Dockerfile into a single layer |
|
25 |
+var ( |
|
26 |
+ dockerbuildLong = templates.LongDesc(` |
|
27 |
+ Build a Dockerfile into a single layer |
|
27 | 28 |
|
28 |
-Builds the provided directory with a Dockerfile into a single layered image. |
|
29 |
-Requires that you have a working connection to a Docker engine. You may mount |
|
30 |
-secrets or config into the build with the --mount flag - these files will not |
|
31 |
-be included in the final image. |
|
29 |
+ Builds the provided directory with a Dockerfile into a single layered image. |
|
30 |
+ Requires that you have a working connection to a Docker engine. You may mount |
|
31 |
+ secrets or config into the build with the --mount flag - these files will not |
|
32 |
+ be included in the final image. |
|
32 | 33 |
|
33 |
-Experimental: This command is under active development and may change without notice.` |
|
34 |
+ Experimental: This command is under active development and may change without notice.`) |
|
34 | 35 |
|
35 |
- dockerbuildExample = ` # Build the current directory into a single layer and tag |
|
36 |
- %[1]s ex dockerbuild . myimage:latest |
|
36 |
+ dockerbuildExample = templates.Examples(` |
|
37 |
+ # Build the current directory into a single layer and tag |
|
38 |
+ %[1]s ex dockerbuild . myimage:latest |
|
37 | 39 |
|
38 |
- # Mount a client secret into the build at a certain path |
|
39 |
- %[1]s ex dockerbuild . myimage:latest --mount ~/mysecret.pem:/etc/pki/secret/mysecret.pem` |
|
40 |
+ # Mount a client secret into the build at a certain path |
|
41 |
+ %[1]s ex dockerbuild . myimage:latest --mount ~/mysecret.pem:/etc/pki/secret/mysecret.pem`) |
|
40 | 42 |
) |
41 | 43 |
|
42 | 44 |
type DockerbuildOptions struct { |
... | ... |
@@ -9,17 +9,18 @@ import ( |
9 | 9 |
|
10 | 10 |
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" |
11 | 11 |
|
12 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
12 | 13 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
13 | 14 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
14 | 15 |
) |
15 | 16 |
|
16 |
-const ( |
|
17 |
- internalTYPELong = ` |
|
18 |
-Single line title |
|
17 |
+var ( |
|
18 |
+ internalTYPELong = templates.LongDesc(` |
|
19 |
+ Single line title |
|
19 | 20 |
|
20 |
-Description body` |
|
21 |
+ Description body`) |
|
21 | 22 |
|
22 |
- internalTYPEExample = `%s` |
|
23 |
+ internalTYPEExample = templates.Examples(`%s`) |
|
23 | 24 |
) |
24 | 25 |
|
25 | 26 |
type TYPEOptions struct { |
... | ... |
@@ -14,37 +14,39 @@ import ( |
14 | 14 |
"k8s.io/kubernetes/pkg/runtime" |
15 | 15 |
utilerrors "k8s.io/kubernetes/pkg/util/errors" |
16 | 16 |
|
17 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
17 | 18 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
18 | 19 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
19 | 20 |
templateapi "github.com/openshift/origin/pkg/template/api" |
20 | 21 |
) |
21 | 22 |
|
22 |
-const ( |
|
23 |
- exportLong = ` |
|
24 |
-Export resources so they can be used elsewhere |
|
23 |
+var ( |
|
24 |
+ exportLong = templates.LongDesc(` |
|
25 |
+ Export resources so they can be used elsewhere |
|
25 | 26 |
|
26 |
-The export command makes it easy to take existing objects and convert them to configuration files |
|
27 |
-for backups or for creating elsewhere in the cluster. Fields that cannot be specified on create |
|
28 |
-will be set to empty, and any field which is assigned on creation (like a service's clusterIP, or |
|
29 |
-a deployment config's latestVersion). The status part of objects is also cleared. |
|
27 |
+ The export command makes it easy to take existing objects and convert them to configuration files |
|
28 |
+ for backups or for creating elsewhere in the cluster. Fields that cannot be specified on create |
|
29 |
+ will be set to empty, and any field which is assigned on creation (like a service's clusterIP, or |
|
30 |
+ a deployment config's latestVersion). The status part of objects is also cleared. |
|
30 | 31 |
|
31 |
-Some fields like clusterIP may be useful when exporting an application from one cluster to apply |
|
32 |
-to another - assuming another service on the destination cluster does not already use that IP. |
|
33 |
-The --exact flag will instruct export to not clear fields that might be useful. You may also use |
|
34 |
-versions. |
|
32 |
+ Some fields like clusterIP may be useful when exporting an application from one cluster to apply |
|
33 |
+ to another - assuming another service on the destination cluster does not already use that IP. |
|
34 |
+ The --exact flag will instruct export to not clear fields that might be useful. You may also use |
|
35 |
+ --raw to get the exact values for an object - useful for converting a file on disk between API |
|
36 |
+ versions. |
|
35 | 37 |
|
36 |
-Another use case for export is to create reusable templates for applications. Pass --as-template |
|
37 |
-to generate the API structure for a template to which you can add parameters and object labels.` |
|
38 |
+ Another use case for export is to create reusable templates for applications. Pass --as-template |
|
39 |
+ to generate the API structure for a template to which you can add parameters and object labels.`) |
|
38 | 40 |
|
39 |
- exportExample = ` # export the services and deployment configurations labeled name=test |
|
40 |
- %[1]s export svc,dc -l name=test |
|
41 |
+ exportExample = templates.Examples(` |
|
42 |
+ # export the services and deployment configurations labeled name=test |
|
43 |
+ %[1]s export svc,dc -l name=test |
|
41 | 44 |
|
42 |
- # export all services to a template |
|
43 |
- %[1]s export service --as-template=test |
|
45 |
+ # export all services to a template |
|
46 |
+ %[1]s export service --as-template=test |
|
44 | 47 |
|
45 |
- # export to JSON |
|
46 |
- %[1]s export service -o json` |
|
48 |
+ # export to JSON |
|
49 |
+ %[1]s export service -o json`) |
|
47 | 50 |
) |
48 | 51 |
|
49 | 52 |
func NewCmdExport(fullName string, f *clientcmd.Factory, in io.Reader, out io.Writer) *cobra.Command { |
... | ... |
@@ -10,32 +10,34 @@ import ( |
10 | 10 |
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" |
11 | 11 |
"k8s.io/kubernetes/pkg/kubectl/resource" |
12 | 12 |
|
13 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
13 | 14 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
14 | 15 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
15 | 16 |
) |
16 | 17 |
|
17 |
-const ( |
|
18 |
- exposeLong = ` |
|
19 |
-Expose containers internally as services or externally via routes |
|
18 |
+var ( |
|
19 |
+ exposeLong = templates.LongDesc(` |
|
20 |
+ Expose containers internally as services or externally via routes |
|
20 | 21 |
|
21 |
-There is also the ability to expose a deployment configuration, replication controller, service, or pod |
|
22 |
-as a new service on a specified port. If no labels are specified, the new object will re-use the |
|
23 |
-labels from the object it exposes.` |
|
22 |
+ There is also the ability to expose a deployment configuration, replication controller, service, or pod |
|
23 |
+ as a new service on a specified port. If no labels are specified, the new object will re-use the |
|
24 |
+ labels from the object it exposes.`) |
|
24 | 25 |
|
25 |
- exposeExample = ` # Create a route based on service nginx. The new route will re-use nginx's labels |
|
26 |
- %[1]s expose service nginx |
|
26 |
+ exposeExample = templates.Examples(` |
|
27 |
+ # Create a route based on service nginx. The new route will re-use nginx's labels |
|
28 |
+ %[1]s expose service nginx |
|
27 | 29 |
|
28 |
- # Create a route and specify your own label and route name |
|
29 |
- %[1]s expose service nginx -l name=myroute --name=fromdowntown |
|
30 |
+ # Create a route and specify your own label and route name |
|
31 |
+ %[1]s expose service nginx -l name=myroute --name=fromdowntown |
|
30 | 32 |
|
31 |
- # Create a route and specify a hostname |
|
32 |
- %[1]s expose service nginx --hostname=www.example.com |
|
33 |
+ # Create a route and specify a hostname |
|
34 |
+ %[1]s expose service nginx --hostname=www.example.com |
|
33 | 35 |
|
34 |
- # Expose a deployment configuration as a service and use the specified port |
|
35 |
- %[1]s expose dc ruby-hello-world --port=8080 |
|
36 |
+ # Expose a deployment configuration as a service and use the specified port |
|
37 |
+ %[1]s expose dc ruby-hello-world --port=8080 |
|
36 | 38 |
|
37 |
- # Expose a service as a route in the specified path |
|
38 |
- %[1]s expose service nginx --path=/nginx` |
|
39 |
+ # Expose a service as a route in the specified path |
|
40 |
+ %[1]s expose service nginx --path=/nginx`) |
|
39 | 41 |
) |
40 | 42 |
|
41 | 43 |
// NewCmdExpose is a wrapper for the Kubernetes cli expose command |
... | ... |
@@ -16,29 +16,31 @@ import ( |
16 | 16 |
"k8s.io/kubernetes/pkg/runtime" |
17 | 17 |
"k8s.io/kubernetes/pkg/util/sets" |
18 | 18 |
|
19 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
19 | 20 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
20 | 21 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
21 | 22 |
) |
22 | 23 |
|
23 |
-const ( |
|
24 |
- extractLong = ` |
|
25 |
-Extract files out of secrets and config maps |
|
24 |
+var ( |
|
25 |
+ extractLong = templates.LongDesc(` |
|
26 |
+ Extract files out of secrets and config maps |
|
26 | 27 |
|
27 |
-The extract command makes it easy to download the contents of a config map or secret into a directory. |
|
28 |
-Each key in the config map or secret is created as a separate file with the name of the key, as it |
|
29 |
-is when you mount a secret or config map into a container. |
|
28 |
+ The extract command makes it easy to download the contents of a config map or secret into a directory. |
|
29 |
+ Each key in the config map or secret is created as a separate file with the name of the key, as it |
|
30 |
+ is when you mount a secret or config map into a container. |
|
30 | 31 |
|
31 |
-You can limit which keys are extracted with the --keys=NAME flag, or set the directory to extract to |
|
32 |
-with --to=DIRECTORY.` |
|
32 |
+ You can limit which keys are extracted with the --keys=NAME flag, or set the directory to extract to |
|
33 |
+ with --to=DIRECTORY.`) |
|
33 | 34 |
|
34 |
- extractExample = ` # extract the secret "test" to the current directory |
|
35 |
- %[1]s extract secret/test |
|
35 |
+ extractExample = templates.Examples(` |
|
36 |
+ # extract the secret "test" to the current directory |
|
37 |
+ %[1]s extract secret/test |
|
36 | 38 |
|
37 |
- # extract the config map "nginx" to the /tmp directory |
|
38 |
- %[1]s extract configmap/nginx --to=/tmp |
|
39 |
+ # extract the config map "nginx" to the /tmp directory |
|
40 |
+ %[1]s extract configmap/nginx --to=/tmp |
|
39 | 41 |
|
40 |
- # extract only the key "nginx.conf" from config map "nginx" to the /tmp directory |
|
41 |
- %[1]s extract configmap/nginx --to=/tmp --keys=nginx.conf` |
|
42 |
+ # extract only the key "nginx.conf" from config map "nginx" to the /tmp directory |
|
43 |
+ %[1]s extract configmap/nginx --to=/tmp --keys=nginx.conf`) |
|
42 | 44 |
) |
43 | 45 |
|
44 | 46 |
type ExtractOptions struct { |
... | ... |
@@ -24,6 +24,7 @@ import ( |
24 | 24 |
"k8s.io/kubernetes/pkg/util/strategicpatch" |
25 | 25 |
|
26 | 26 |
osclient "github.com/openshift/origin/pkg/client" |
27 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
27 | 28 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
28 | 29 |
deployapi "github.com/openshift/origin/pkg/deploy/api" |
29 | 30 |
deployclient "github.com/openshift/origin/pkg/deploy/client/clientset_generated/internalclientset/typed/core/unversioned" |
... | ... |
@@ -31,20 +32,21 @@ import ( |
31 | 31 |
utilunidling "github.com/openshift/origin/pkg/unidling/util" |
32 | 32 |
) |
33 | 33 |
|
34 |
-const ( |
|
35 |
- idleLong = ` |
|
36 |
-Idle scalable resources. |
|
34 |
+var ( |
|
35 |
+ idleLong = templates.LongDesc(` |
|
36 |
+ Idle scalable resources |
|
37 | 37 |
|
38 |
-Idling discovers the scalable resources (such as deployment configs and replication controllers) |
|
39 |
-associated with a series of services by examining the endpoints of the service. |
|
40 |
-Each service is then marked as idled, the associated resources are recorded, and the resources |
|
41 |
-are scaled down to zero replicas. |
|
38 |
+ Idling discovers the scalable resources (such as deployment configs and replication controllers) |
|
39 |
+ associated with a series of services by examining the endpoints of the service. |
|
40 |
+ Each service is then marked as idled, the associated resources are recorded, and the resources |
|
41 |
+ are scaled down to zero replicas. |
|
42 | 42 |
|
43 |
-Upon receiving network traffic, the services (and any associated routes) will "wake up" the |
|
44 |
-associated resources by scaling them back up to their previous scale.` |
|
43 |
+ Upon receiving network traffic, the services (and any associated routes) will "wake up" the |
|
44 |
+ associated resources by scaling them back up to their previous scale.`) |
|
45 | 45 |
|
46 |
- idleExample = ` # Idle the scalable controllers associated with the services listed in to-idle.txt |
|
47 |
- $ %[1]s idle --resource-names-file to-idle.txt` |
|
46 |
+ idleExample = templates.Examples(` |
|
47 |
+ # Idle the scalable controllers associated with the services listed in to-idle.txt |
|
48 |
+ $ %[1]s idle --resource-names-file to-idle.txt`) |
|
48 | 49 |
) |
49 | 50 |
|
50 | 51 |
// NewCmdIdle implements the OpenShift cli idle command |
... | ... |
@@ -21,6 +21,7 @@ import ( |
21 | 21 |
"k8s.io/kubernetes/pkg/runtime" |
22 | 22 |
|
23 | 23 |
"github.com/openshift/origin/pkg/client" |
24 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
24 | 25 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
25 | 26 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
26 | 27 |
configcmd "github.com/openshift/origin/pkg/config/cmd" |
... | ... |
@@ -29,28 +30,28 @@ import ( |
29 | 29 |
"github.com/openshift/origin/pkg/generate/appjson" |
30 | 30 |
) |
31 | 31 |
|
32 |
-const ( |
|
33 |
- appJSONLong = ` |
|
34 |
-Import app.json files as OpenShift objects |
|
32 |
+const AppJSONV1GeneratorName = "app-json/v1" |
|
35 | 33 |
|
36 |
-app.json defines the pattern of a simple, stateless web application that can be horizontally scaled. |
|
37 |
-This command will transform a provided app.json object into its OpenShift equivalent. |
|
38 |
-During transformation fields in the app.json syntax that are not relevant when running on top of |
|
39 |
-a containerized platform will be ignored and a warning printed. |
|
34 |
+var ( |
|
35 |
+ appJSONLong = templates.LongDesc(` |
|
36 |
+ Import app.json files as OpenShift objects |
|
40 | 37 |
|
41 |
-The command will create objects unless you pass the -o yaml or --as-template flags to generate a |
|
42 |
-configuration file for later use. |
|
38 |
+ app.json defines the pattern of a simple, stateless web application that can be horizontally scaled. |
|
39 |
+ This command will transform a provided app.json object into its OpenShift equivalent. |
|
40 |
+ During transformation fields in the app.json syntax that are not relevant when running on top of |
|
41 |
+ a containerized platform will be ignored and a warning printed. |
|
43 | 42 |
|
44 |
-Experimental: This command is under active development and may change without notice.` |
|
43 |
+ The command will create objects unless you pass the -o yaml or --as-template flags to generate a |
|
44 |
+ configuration file for later use. |
|
45 | 45 |
|
46 |
- appJSONExample = ` # Import a directory containing an app.json file |
|
47 |
- $ %[1]s app.json -f . |
|
46 |
+ Experimental: This command is under active development and may change without notice.`) |
|
48 | 47 |
|
49 |
- # Turn an app.json file into a template |
|
50 |
- $ %[1]s app.json -f ./app.json -o yaml --as-template |
|
51 |
-` |
|
48 |
+ appJSONExample = templates.Examples(` |
|
49 |
+ # Import a directory containing an app.json file |
|
50 |
+ $ %[1]s app.json -f . |
|
52 | 51 |
|
53 |
- AppJSONV1GeneratorName = "app-json/v1" |
|
52 |
+ # Turn an app.json file into a template |
|
53 |
+ $ %[1]s app.json -f ./app.json -o yaml --as-template`) |
|
54 | 54 |
) |
55 | 55 |
|
56 | 56 |
type AppJSONOptions struct { |
... | ... |
@@ -16,6 +16,7 @@ import ( |
16 | 16 |
"k8s.io/kubernetes/pkg/runtime" |
17 | 17 |
|
18 | 18 |
"github.com/openshift/origin/pkg/client" |
19 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
19 | 20 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
20 | 21 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
21 | 22 |
configcmd "github.com/openshift/origin/pkg/config/cmd" |
... | ... |
@@ -24,28 +25,28 @@ import ( |
24 | 24 |
"github.com/openshift/origin/pkg/generate/dockercompose" |
25 | 25 |
) |
26 | 26 |
|
27 |
-const ( |
|
28 |
- dockerComposeLong = ` |
|
29 |
-Import a Docker Compose file as OpenShift objects |
|
27 |
+const DockerComposeV1GeneratorName = "docker-compose/v1" |
|
30 | 28 |
|
31 |
-Docker Compose files offer a container centric build and deploy pattern for simple applications. |
|
32 |
-This command will transform a provided docker-compose.yml application into its OpenShift equivalent. |
|
33 |
-During transformation fields in the compose syntax that are not relevant when running on top of |
|
34 |
-a containerized platform will be ignored and a warning printed. |
|
29 |
+var ( |
|
30 |
+ dockerComposeLong = templates.LongDesc(` |
|
31 |
+ Import a Docker Compose file as OpenShift objects |
|
35 | 32 |
|
36 |
-The command will create objects unless you pass the -o yaml or --as-template flags to generate a |
|
37 |
-configuration file for later use. |
|
33 |
+ Docker Compose files offer a container centric build and deploy pattern for simple applications. |
|
34 |
+ This command will transform a provided docker-compose.yml application into its OpenShift equivalent. |
|
35 |
+ During transformation fields in the compose syntax that are not relevant when running on top of |
|
36 |
+ a containerized platform will be ignored and a warning printed. |
|
38 | 37 |
|
39 |
-Experimental: This command is under active development and may change without notice.` |
|
38 |
+ The command will create objects unless you pass the -o yaml or --as-template flags to generate a |
|
39 |
+ configuration file for later use. |
|
40 | 40 |
|
41 |
- dockerComposeExample = ` # Import a docker-compose.yml file into OpenShift |
|
42 |
- %[1]s docker-compose -f ./docker-compose.yml |
|
41 |
+ Experimental: This command is under active development and may change without notice.`) |
|
43 | 42 |
|
44 |
- # Turn a docker-compose.yml file into a template |
|
45 |
- %[1]s docker-compose -f ./docker-compose.yml -o yaml --as-template |
|
46 |
-` |
|
43 |
+ dockerComposeExample = templates.Examples(` |
|
44 |
+ # Import a docker-compose.yml file into OpenShift |
|
45 |
+ %[1]s docker-compose -f ./docker-compose.yml |
|
47 | 46 |
|
48 |
- DockerComposeV1GeneratorName = "docker-compose/v1" |
|
47 |
+ # Turn a docker-compose.yml file into a template |
|
48 |
+ %[1]s docker-compose -f ./docker-compose.yml -o yaml --as-template`) |
|
49 | 49 |
) |
50 | 50 |
|
51 | 51 |
type DockerComposeOptions struct { |
... | ... |
@@ -6,15 +6,16 @@ import ( |
6 | 6 |
|
7 | 7 |
"github.com/spf13/cobra" |
8 | 8 |
|
9 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
9 | 10 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
10 | 11 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
11 | 12 |
) |
12 | 13 |
|
13 |
-const ( |
|
14 |
- importLong = ` |
|
15 |
-Import outside applications into OpenShift |
|
14 |
+var ( |
|
15 |
+ importLong = templates.LongDesc(` |
|
16 |
+ Import outside applications into OpenShift |
|
16 | 17 |
|
17 |
-These commands assist in bringing existing applications into OpenShift.` |
|
18 |
+ These commands assist in bringing existing applications into OpenShift.`) |
|
18 | 19 |
) |
19 | 20 |
|
20 | 21 |
// NewCmdImport exposes commands for modifying objects. |
... | ... |
@@ -16,20 +16,21 @@ import ( |
16 | 16 |
|
17 | 17 |
"github.com/openshift/origin/pkg/client" |
18 | 18 |
"github.com/openshift/origin/pkg/cmd/cli/describe" |
19 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
19 | 20 |
imageapi "github.com/openshift/origin/pkg/image/api" |
20 | 21 |
"github.com/spf13/cobra" |
21 | 22 |
|
22 | 23 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
23 | 24 |
) |
24 | 25 |
|
25 |
-const ( |
|
26 |
- importImageLong = ` |
|
27 |
-Import tag and image information from an external Docker image repository |
|
26 |
+var ( |
|
27 |
+ importImageLong = templates.LongDesc(` |
|
28 |
+ Import tag and image information from an external Docker image repository |
|
28 | 29 |
|
29 |
-Only image streams that have a value set for spec.dockerImageRepository and/or |
|
30 |
-spec.Tags may have tag and image information imported.` |
|
30 |
+ Only image streams that have a value set for spec.dockerImageRepository and/or |
|
31 |
+ spec.Tags may have tag and image information imported.`) |
|
31 | 32 |
|
32 |
- importImageExample = ` %[1]s import-image mystream` |
|
33 |
+ importImageExample = templates.Examples(` %[1]s import-image mystream`) |
|
33 | 34 |
) |
34 | 35 |
|
35 | 36 |
// NewCmdImportImage implements the OpenShift cli import-image command. |
... | ... |
@@ -17,30 +17,32 @@ import ( |
17 | 17 |
|
18 | 18 |
"github.com/openshift/origin/pkg/cmd/cli/config" |
19 | 19 |
"github.com/openshift/origin/pkg/cmd/flagtypes" |
20 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
20 | 21 |
osclientcmd "github.com/openshift/origin/pkg/cmd/util/clientcmd" |
21 | 22 |
) |
22 | 23 |
|
23 |
-const ( |
|
24 |
- loginLong = ` |
|
25 |
-Log in to your server and save login for subsequent use |
|
24 |
+var ( |
|
25 |
+ loginLong = templates.LongDesc(` |
|
26 |
+ Log in to your server and save login for subsequent use |
|
26 | 27 |
|
27 |
-First-time users of the client should run this command to connect to a server, |
|
28 |
-establish an authenticated session, and save connection to the configuration file. The |
|
29 |
-default configuration will be saved to your home directory under |
|
30 |
-".kube/config". |
|
28 |
+ First-time users of the client should run this command to connect to a server, |
|
29 |
+ establish an authenticated session, and save connection to the configuration file. The |
|
30 |
+ default configuration will be saved to your home directory under |
|
31 |
+ ".kube/config". |
|
31 | 32 |
|
32 |
-The information required to login -- like username and password, a session token, or |
|
33 |
-the server details -- can be provided through flags. If not provided, the command will |
|
34 |
-prompt for user input as needed.` |
|
33 |
+ The information required to login -- like username and password, a session token, or |
|
34 |
+ the server details -- can be provided through flags. If not provided, the command will |
|
35 |
+ prompt for user input as needed.`) |
|
35 | 36 |
|
36 |
- loginExample = ` # Log in interactively |
|
37 |
- %[1]s login |
|
37 |
+ loginExample = templates.Examples(` |
|
38 |
+ # Log in interactively |
|
39 |
+ %[1]s login |
|
38 | 40 |
|
39 |
- # Log in to the given server with the given certificate authority file |
|
40 |
- %[1]s login localhost:8443 --certificate-authority=/path/to/cert.crt |
|
41 |
+ # Log in to the given server with the given certificate authority file |
|
42 |
+ %[1]s login localhost:8443 --certificate-authority=/path/to/cert.crt |
|
41 | 43 |
|
42 |
- # Log in to the given server with the given credentials (will not prompt interactively) |
|
43 |
- %[1]s login localhost:8443 --username=myuser --password=mypass` |
|
44 |
+ # Log in to the given server with the given credentials (will not prompt interactively) |
|
45 |
+ %[1]s login localhost:8443 --username=myuser --password=mypass`) |
|
44 | 46 |
) |
45 | 47 |
|
46 | 48 |
// NewCmdLogin implements the OpenShift cli login command |
... | ... |
@@ -14,6 +14,7 @@ import ( |
14 | 14 |
|
15 | 15 |
"github.com/openshift/origin/pkg/client" |
16 | 16 |
"github.com/openshift/origin/pkg/cmd/cli/config" |
17 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
17 | 18 |
osclientcmd "github.com/openshift/origin/pkg/cmd/util/clientcmd" |
18 | 19 |
) |
19 | 20 |
|
... | ... |
@@ -25,23 +26,23 @@ type LogoutOptions struct { |
25 | 25 |
PathOptions *kclientcmd.PathOptions |
26 | 26 |
} |
27 | 27 |
|
28 |
-const ( |
|
29 |
- logoutLong = ` |
|
30 |
-Log out of the active session out by clearing saved tokens |
|
28 |
+var ( |
|
29 |
+ logoutLong = templates.LongDesc(` |
|
30 |
+ Log out of the active session out by clearing saved tokens |
|
31 | 31 |
|
32 |
-An authentication token is stored in the config file after login - this command will delete |
|
33 |
-that token on the server, and then remove the token from the configuration file. |
|
32 |
+ An authentication token is stored in the config file after login - this command will delete |
|
33 |
+ that token on the server, and then remove the token from the configuration file. |
|
34 | 34 |
|
35 |
-If you are using an alternative authentication method like Kerberos or client certificates, |
|
36 |
-your ticket or client certificate will not be removed from the current system since these |
|
37 |
-are typically managed by other programs. Instead, you can delete your config file to remove |
|
38 |
-the local copy of that certificate or the record of your server login. |
|
35 |
+ If you are using an alternative authentication method like Kerberos or client certificates, |
|
36 |
+ your ticket or client certificate will not be removed from the current system since these |
|
37 |
+ are typically managed by other programs. Instead, you can delete your config file to remove |
|
38 |
+ the local copy of that certificate or the record of your server login. |
|
39 | 39 |
|
40 |
-After logging out, if you want to log back into the server use '%[1]s'.` |
|
40 |
+ After logging out, if you want to log back into the server use '%[1]s'.`) |
|
41 | 41 |
|
42 |
- logoutExample = ` |
|
43 |
- # Logout |
|
44 |
- %[1]s` |
|
42 |
+ logoutExample = templates.Examples(` |
|
43 |
+ # Logout |
|
44 |
+ %[1]s`) |
|
45 | 45 |
) |
46 | 46 |
|
47 | 47 |
// NewCmdLogout implements the OpenShift cli logout command |
... | ... |
@@ -15,6 +15,7 @@ import ( |
15 | 15 |
"k8s.io/kubernetes/pkg/runtime" |
16 | 16 |
|
17 | 17 |
buildapi "github.com/openshift/origin/pkg/build/api" |
18 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
18 | 19 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
19 | 20 |
deployapi "github.com/openshift/origin/pkg/deploy/api" |
20 | 21 |
) |
... | ... |
@@ -23,34 +24,35 @@ import ( |
23 | 23 |
// TODO: Probably move this pattern upstream? |
24 | 24 |
const LogsRecommendedCommandName = "logs" |
25 | 25 |
|
26 |
-const ( |
|
27 |
- logsLong = ` |
|
28 |
-Print the logs for a resource. |
|
26 |
+var ( |
|
27 |
+ logsLong = templates.LongDesc(` |
|
28 |
+ Print the logs for a resource |
|
29 | 29 |
|
30 |
-Supported resources are builds, build configs (bc), deployment configs (dc), and pods. |
|
31 |
-When a pod is specified and has more than one container, the container name should be |
|
32 |
-specified via -c. When a build config or deployment config is specified, you can view |
|
33 |
-the logs for a particular version of it via --version. |
|
30 |
+ Supported resources are builds, build configs (bc), deployment configs (dc), and pods. |
|
31 |
+ When a pod is specified and has more than one container, the container name should be |
|
32 |
+ specified via -c. When a build config or deployment config is specified, you can view |
|
33 |
+ the logs for a particular version of it via --version. |
|
34 | 34 |
|
35 |
-If your pod is failing to start, you may need to use the --previous option to see the |
|
36 |
-logs of the last attempt.` |
|
35 |
+ If your pod is failing to start, you may need to use the --previous option to see the |
|
36 |
+ logs of the last attempt.`) |
|
37 | 37 |
|
38 |
- logsExample = ` # Start streaming the logs of the most recent build of the openldap build config. |
|
39 |
- %[1]s %[2]s -f bc/openldap |
|
38 |
+ logsExample = templates.Examples(` |
|
39 |
+ # Start streaming the logs of the most recent build of the openldap build config. |
|
40 |
+ %[1]s %[2]s -f bc/openldap |
|
40 | 41 |
|
41 |
- # Start streaming the logs of the latest deployment of the mysql deployment config. |
|
42 |
- %[1]s %[2]s -f dc/mysql |
|
42 |
+ # Start streaming the logs of the latest deployment of the mysql deployment config. |
|
43 |
+ %[1]s %[2]s -f dc/mysql |
|
43 | 44 |
|
44 |
- # Get the logs of the first deployment for the mysql deployment config. Note that logs |
|
45 |
- # from older deployments may not exist either because the deployment was successful |
|
46 |
- # or due to deployment pruning or manual deletion of the deployment. |
|
47 |
- %[1]s %[2]s --version=1 dc/mysql |
|
45 |
+ # Get the logs of the first deployment for the mysql deployment config. Note that logs |
|
46 |
+ # from older deployments may not exist either because the deployment was successful |
|
47 |
+ # or due to deployment pruning or manual deletion of the deployment. |
|
48 |
+ %[1]s %[2]s --version=1 dc/mysql |
|
48 | 49 |
|
49 |
- # Return a snapshot of ruby-container logs from pod backend. |
|
50 |
- %[1]s %[2]s backend -c ruby-container |
|
50 |
+ # Return a snapshot of ruby-container logs from pod backend. |
|
51 |
+ %[1]s %[2]s backend -c ruby-container |
|
51 | 52 |
|
52 |
- # Start streaming of ruby-container logs from pod backend. |
|
53 |
- %[1]s %[2]s -f pod/backend -c ruby-container` |
|
53 |
+ # Start streaming of ruby-container logs from pod backend. |
|
54 |
+ %[1]s %[2]s -f pod/backend -c ruby-container`) |
|
54 | 55 |
) |
55 | 56 |
|
56 | 57 |
// OpenShiftLogsOptions holds all the necessary options for running oc logs. |
... | ... |
@@ -29,6 +29,7 @@ import ( |
29 | 29 |
"k8s.io/kubernetes/pkg/util/wait" |
30 | 30 |
|
31 | 31 |
buildapi "github.com/openshift/origin/pkg/build/api" |
32 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
32 | 33 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
33 | 34 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
34 | 35 |
dockerutil "github.com/openshift/origin/pkg/cmd/util/docker" |
... | ... |
@@ -47,62 +48,62 @@ type usage interface { |
47 | 47 |
UsageError(baseName string) string |
48 | 48 |
} |
49 | 49 |
|
50 |
-const ( |
|
51 |
- newAppLong = ` |
|
52 |
-Create a new application by specifying source code, templates, and/or images |
|
50 |
+var ( |
|
51 |
+ newAppLong = templates.LongDesc(` |
|
52 |
+ Create a new application by specifying source code, templates, and/or images |
|
53 | 53 |
|
54 |
-This command will try to build up the components of an application using images, templates, |
|
55 |
-or code that has a public repository. It will lookup the images on the local Docker installation |
|
56 |
-(if available), a Docker registry, an integrated image stream, or stored templates. |
|
54 |
+ This command will try to build up the components of an application using images, templates, |
|
55 |
+ or code that has a public repository. It will lookup the images on the local Docker installation |
|
56 |
+ (if available), a Docker registry, an integrated image stream, or stored templates. |
|
57 | 57 |
|
58 |
-If you specify a source code URL, it will set up a build that takes your source code and converts |
|
59 |
-it into an image that can run inside of a pod. Local source must be in a git repository that has a |
|
60 |
-remote repository that the server can see. The images will be deployed via a deployment |
|
61 |
-configuration, and a service will be connected to the first public port of the app. You may either specify |
|
62 |
-components using the various existing flags or let %[2]s autodetect what kind of components |
|
63 |
-you have provided. |
|
58 |
+ If you specify a source code URL, it will set up a build that takes your source code and converts |
|
59 |
+ it into an image that can run inside of a pod. Local source must be in a git repository that has a |
|
60 |
+ remote repository that the server can see. The images will be deployed via a deployment |
|
61 |
+ configuration, and a service will be connected to the first public port of the app. You may either specify |
|
62 |
+ components using the various existing flags or let %[2]s autodetect what kind of components |
|
63 |
+ you have provided. |
|
64 | 64 |
|
65 |
-If you provide source code, a new build will be automatically triggered. |
|
66 |
-You can use '%[1]s status' to check the progress.` |
|
65 |
+ If you provide source code, a new build will be automatically triggered. |
|
66 |
+ You can use '%[1]s status' to check the progress.`) |
|
67 | 67 |
|
68 |
- newAppExample = ` |
|
69 |
- # List all local templates and image streams that can be used to create an app |
|
70 |
- %[1]s %[2]s --list |
|
68 |
+ newAppExample = templates.Examples(` |
|
69 |
+ # List all local templates and image streams that can be used to create an app |
|
70 |
+ %[1]s %[2]s --list |
|
71 | 71 |
|
72 |
- # Create an application based on the source code in the current git repository (with a public remote) |
|
73 |
- # and a Docker image |
|
74 |
- %[1]s %[2]s . --docker-image=repo/langimage |
|
72 |
+ # Create an application based on the source code in the current git repository (with a public remote) |
|
73 |
+ # and a Docker image |
|
74 |
+ %[1]s %[2]s . --docker-image=repo/langimage |
|
75 | 75 |
|
76 |
- # Create a Ruby application based on the provided [image]~[source code] combination |
|
77 |
- %[1]s %[2]s centos/ruby-22-centos7~https://github.com/openshift/ruby-ex.git |
|
76 |
+ # Create a Ruby application based on the provided [image]~[source code] combination |
|
77 |
+ %[1]s %[2]s centos/ruby-22-centos7~https://github.com/openshift/ruby-ex.git |
|
78 | 78 |
|
79 |
- # Use the public Docker Hub MySQL image to create an app. Generated artifacts will be labeled with db=mysql |
|
80 |
- %[1]s %[2]s mysql MYSQL_USER=user MYSQL_PASSWORD=pass MYSQL_DATABASE=testdb -l db=mysql |
|
79 |
+ # Use the public Docker Hub MySQL image to create an app. Generated artifacts will be labeled with db=mysql |
|
80 |
+ %[1]s %[2]s mysql MYSQL_USER=user MYSQL_PASSWORD=pass MYSQL_DATABASE=testdb -l db=mysql |
|
81 | 81 |
|
82 |
- # Use a MySQL image in a private registry to create an app and override application artifacts' names |
|
83 |
- %[1]s %[2]s --docker-image=myregistry.com/mycompany/mysql --name=private |
|
82 |
+ # Use a MySQL image in a private registry to create an app and override application artifacts' names |
|
83 |
+ %[1]s %[2]s --docker-image=myregistry.com/mycompany/mysql --name=private |
|
84 | 84 |
|
85 |
- # Create an application from a remote repository using its beta4 branch |
|
86 |
- %[1]s %[2]s https://github.com/openshift/ruby-hello-world#beta4 |
|
85 |
+ # Create an application from a remote repository using its beta4 branch |
|
86 |
+ %[1]s %[2]s https://github.com/openshift/ruby-hello-world#beta4 |
|
87 | 87 |
|
88 |
- # Create an application based on a stored template, explicitly setting a parameter value |
|
89 |
- %[1]s %[2]s --template=ruby-helloworld-sample --param=MYSQL_USER=admin |
|
88 |
+ # Create an application based on a stored template, explicitly setting a parameter value |
|
89 |
+ %[1]s %[2]s --template=ruby-helloworld-sample --param=MYSQL_USER=admin |
|
90 | 90 |
|
91 |
- # Create an application from a remote repository and specify a context directory |
|
92 |
- %[1]s %[2]s https://github.com/youruser/yourgitrepo --context-dir=src/build |
|
91 |
+ # Create an application from a remote repository and specify a context directory |
|
92 |
+ %[1]s %[2]s https://github.com/youruser/yourgitrepo --context-dir=src/build |
|
93 | 93 |
|
94 |
- # Create an application based on a template file, explicitly setting a parameter value |
|
95 |
- %[1]s %[2]s --file=./example/myapp/template.json --param=MYSQL_USER=admin |
|
94 |
+ # Create an application based on a template file, explicitly setting a parameter value |
|
95 |
+ %[1]s %[2]s --file=./example/myapp/template.json --param=MYSQL_USER=admin |
|
96 | 96 |
|
97 |
- # Search all templates, image streams, and Docker images for the ones that match "ruby" |
|
98 |
- %[1]s %[2]s --search ruby |
|
97 |
+ # Search all templates, image streams, and Docker images for the ones that match "ruby" |
|
98 |
+ %[1]s %[2]s --search ruby |
|
99 | 99 |
|
100 |
- # Search for "ruby", but only in stored templates (--template, --image-stream and --docker-image |
|
101 |
- # can be used to filter search results) |
|
102 |
- %[1]s %[2]s --search --template=ruby |
|
100 |
+ # Search for "ruby", but only in stored templates (--template, --image-stream and --docker-image |
|
101 |
+ # can be used to filter search results) |
|
102 |
+ %[1]s %[2]s --search --template=ruby |
|
103 | 103 |
|
104 |
- # Search for "ruby" in stored templates and print the output as an YAML |
|
105 |
- %[1]s %[2]s --search --template=ruby --output=yaml` |
|
104 |
+ # Search for "ruby" in stored templates and print the output as an YAML |
|
105 |
+ %[1]s %[2]s --search --template=ruby --output=yaml`) |
|
106 | 106 |
|
107 | 107 |
newAppNoInput = `You must specify one or more images, image streams, templates, or source code locations to create an application. |
108 | 108 |
|
... | ... |
@@ -15,6 +15,7 @@ import ( |
15 | 15 |
"k8s.io/kubernetes/pkg/util/errors" |
16 | 16 |
|
17 | 17 |
buildapi "github.com/openshift/origin/pkg/build/api" |
18 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
18 | 19 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
19 | 20 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
20 | 21 |
configcmd "github.com/openshift/origin/pkg/config/cmd" |
... | ... |
@@ -25,43 +26,43 @@ import ( |
25 | 25 |
// NewBuildRecommendedCommandName is the recommended command name. |
26 | 26 |
const NewBuildRecommendedCommandName = "new-build" |
27 | 27 |
|
28 |
-const ( |
|
29 |
- newBuildLong = ` |
|
30 |
-Create a new build by specifying source code |
|
28 |
+var ( |
|
29 |
+ newBuildLong = templates.LongDesc(` |
|
30 |
+ Create a new build by specifying source code |
|
31 | 31 |
|
32 |
-This command will try to create a build configuration for your application using images and |
|
33 |
-code that has a public repository. It will lookup the images on the local Docker installation |
|
34 |
-(if available), a Docker registry, or an image stream. |
|
32 |
+ This command will try to create a build configuration for your application using images and |
|
33 |
+ code that has a public repository. It will lookup the images on the local Docker installation |
|
34 |
+ (if available), a Docker registry, or an image stream. |
|
35 | 35 |
|
36 |
-If you specify a source code URL, it will set up a build that takes your source code and converts |
|
37 |
-it into an image that can run inside of a pod. Local source must be in a git repository that has a |
|
38 |
-remote repository that the server can see. |
|
36 |
+ If you specify a source code URL, it will set up a build that takes your source code and converts |
|
37 |
+ it into an image that can run inside of a pod. Local source must be in a git repository that has a |
|
38 |
+ remote repository that the server can see. |
|
39 | 39 |
|
40 |
-Once the build configuration is created a new build will be automatically triggered. |
|
41 |
-You can use '%[1]s status' to check the progress.` |
|
40 |
+ Once the build configuration is created a new build will be automatically triggered. |
|
41 |
+ You can use '%[1]s status' to check the progress.`) |
|
42 | 42 |
|
43 |
- newBuildExample = ` |
|
44 |
- # Create a build config based on the source code in the current git repository (with a public |
|
45 |
- # remote) and a Docker image |
|
46 |
- %[1]s %[2]s . --docker-image=repo/langimage |
|
43 |
+ newBuildExample = templates.Examples(` |
|
44 |
+ # Create a build config based on the source code in the current git repository (with a public |
|
45 |
+ # remote) and a Docker image |
|
46 |
+ %[1]s %[2]s . --docker-image=repo/langimage |
|
47 | 47 |
|
48 |
- # Create a NodeJS build config based on the provided [image]~[source code] combination |
|
49 |
- %[1]s %[2]s openshift/nodejs-010-centos7~https://github.com/openshift/nodejs-ex.git |
|
48 |
+ # Create a NodeJS build config based on the provided [image]~[source code] combination |
|
49 |
+ %[1]s %[2]s openshift/nodejs-010-centos7~https://github.com/openshift/nodejs-ex.git |
|
50 | 50 |
|
51 |
- # Create a build config from a remote repository using its beta2 branch |
|
52 |
- %[1]s %[2]s https://github.com/openshift/ruby-hello-world#beta2 |
|
51 |
+ # Create a build config from a remote repository using its beta2 branch |
|
52 |
+ %[1]s %[2]s https://github.com/openshift/ruby-hello-world#beta2 |
|
53 | 53 |
|
54 |
- # Create a build config using a Dockerfile specified as an argument |
|
55 |
- %[1]s %[2]s -D $'FROM centos:7\nRUN yum install -y httpd' |
|
54 |
+ # Create a build config using a Dockerfile specified as an argument |
|
55 |
+ %[1]s %[2]s -D $'FROM centos:7\nRUN yum install -y httpd' |
|
56 | 56 |
|
57 |
- # Create a build config from a remote repository and add custom environment variables |
|
58 |
- %[1]s %[2]s https://github.com/openshift/ruby-hello-world RACK_ENV=development |
|
57 |
+ # Create a build config from a remote repository and add custom environment variables |
|
58 |
+ %[1]s %[2]s https://github.com/openshift/ruby-hello-world RACK_ENV=development |
|
59 | 59 |
|
60 |
- # Create a build config from a remote repository and inject the npmrc into a build |
|
61 |
- %[1]s %[2]s https://github.com/openshift/ruby-hello-world --build-secret npmrc:.npmrc |
|
60 |
+ # Create a build config from a remote repository and inject the npmrc into a build |
|
61 |
+ %[1]s %[2]s https://github.com/openshift/ruby-hello-world --build-secret npmrc:.npmrc |
|
62 | 62 |
|
63 |
- # Create a build config that gets its input from a remote repository and another Docker image |
|
64 |
- %[1]s %[2]s https://github.com/openshift/ruby-hello-world --source-image=openshift/jenkins-1-centos7 --source-image-path=/var/lib/jenkins:tmp` |
|
63 |
+ # Create a build config that gets its input from a remote repository and another Docker image |
|
64 |
+ %[1]s %[2]s https://github.com/openshift/ruby-hello-world --source-image=openshift/jenkins-1-centos7 --source-image-path=/var/lib/jenkins:tmp`) |
|
65 | 65 |
|
66 | 66 |
newBuildNoInput = `You must specify one or more images, image streams, or source code locations to create a build. |
67 | 67 |
|
... | ... |
@@ -33,6 +33,7 @@ import ( |
33 | 33 |
"k8s.io/kubernetes/pkg/util/jsonpath" |
34 | 34 |
"k8s.io/kubernetes/pkg/watch" |
35 | 35 |
|
36 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
36 | 37 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
37 | 38 |
"github.com/openshift/origin/pkg/util/proc" |
38 | 39 |
) |
... | ... |
@@ -61,101 +62,100 @@ var ( |
61 | 61 |
) |
62 | 62 |
) |
63 | 63 |
|
64 |
-const ( |
|
65 |
- observeLong = ` |
|
66 |
-Observe changes to resources and take action on them |
|
67 |
- |
|
68 |
-This command assists in building scripted reactions to changes that occur in |
|
69 |
-Kubernetes or OpenShift resources. This is frequently referred to as a |
|
70 |
-'controller' in Kubernetes and acts to ensure particular conditions are |
|
71 |
-maintained. On startup, observe will list all of the resources of a |
|
72 |
-particular type and execute the provided script on each one. Observe watches |
|
73 |
-the server for changes, and will reexecute the script for each update. |
|
74 |
- |
|
75 |
-Observe works best for problems of the form "for every resource X, make sure |
|
76 |
-Y is true". Some examples of ways observe can be used include: |
|
77 |
- |
|
78 |
-* Ensure every namespace has a quota or limit range object |
|
79 |
-* Ensure every service is registered in DNS by making calls to a DNS API |
|
80 |
-* Send an email alert whenever a node reports 'NotReady' |
|
81 |
-* Watch for the 'FailedScheduling' event and write an IRC message |
|
82 |
-* Dynamically provision persistent volumes when a new PVC is created |
|
83 |
-* Delete pods that have reached successful completion after a period of time. |
|
84 |
- |
|
85 |
-The simplest pattern is maintaining an invariant on an object - for instance, |
|
86 |
-"every namespace should have an annotation that indicates its owner". If the |
|
87 |
-object is deleted no reaction is necessary. A variation on that pattern is |
|
88 |
-creating another object: "every namespace should have a quota object based |
|
89 |
-on the resources allowed for an owner". |
|
90 |
- |
|
91 |
- $ cat set_owner.sh |
|
92 |
- #!/bin/sh |
|
93 |
- if [[ "$(%[1]s get namespace "$1" --template='{{ .metadata.annotations.owner }}')" == "" ]]; then |
|
94 |
- %[1]s annotate namespace "$1" owner=bob |
|
95 |
- fi |
|
96 |
- |
|
97 |
- $ %[1]s observe namespaces -- ./set_owner.sh |
|
98 |
- |
|
99 |
-The set_owner.sh script is invoked with a single argument (the namespace name) |
|
100 |
-for each namespace. This simple script ensures that any user without the |
|
101 |
-"owner" annotation gets one set, but preserves any existing value. |
|
102 |
- |
|
103 |
-The next common of controller pattern is provisioning - making changes in an |
|
104 |
-external system to match the state of a Kubernetes resource. These scripts need |
|
105 |
-to account for deletions that may take place while the observe command is not |
|
106 |
-running. You can provide the list of known objects via the --names command, |
|
107 |
-which should return a newline-delimited list of names or namespace/name pairs. |
|
108 |
-Your command will be invoked whenever observe checks the latest state on the |
|
109 |
-server - any resources returned by --names that are not found on the server |
|
110 |
-will be passed to your --delete command. |
|
111 |
- |
|
112 |
-For example, you may wish to ensure that every node that is added to Kubernetes |
|
113 |
-is added to your cluster inventory along with its IP: |
|
114 |
- |
|
115 |
- $ cat add_to_inventory.sh |
|
116 |
- #!/bin/sh |
|
117 |
- echo "$1 $2" >> inventory |
|
118 |
- sort -u inventory -o inventory |
|
119 |
- |
|
120 |
- $ cat remove_from_inventory.sh |
|
121 |
- #!/bin/sh |
|
122 |
- grep -vE "^$1 " inventory > /tmp/newinventory |
|
123 |
- mv -f /tmp/newinventory inventory |
|
124 |
- |
|
125 |
- $ cat known_nodes.sh |
|
126 |
- #!/bin/sh |
|
127 |
- touch inventory |
|
128 |
- cut -f 1-1 -d ' ' inventory |
|
129 |
- |
|
130 |
- $ %[1]s observe nodes -a '{ .status.addresses[0].address }' \ |
|
131 |
- --names ./known_nodes.sh \ |
|
132 |
- --delete ./remove_from_inventory.sh \ |
|
133 |
- -- ./add_to_inventory.sh |
|
134 |
- |
|
135 |
- |
|
136 |
-If you stop the observe command and then delete a node, when you launch observe |
|
137 |
-again the contents of inventory will be compared to the list of nodes from the |
|
138 |
-server, and any node in the inventory file that no longer exists will trigger |
|
139 |
-a call to remove_from_inventory.sh with the name of the node. |
|
140 |
- |
|
141 |
-Important: when handling deletes, the previous state of the object may not be |
|
142 |
- available and only the name/namespace of the object will be passed to your |
|
143 |
- --delete command as arguments (all custom arguments are omitted). |
|
144 |
- |
|
145 |
-More complicated interactions build on the two examples above - your inventory |
|
146 |
-script could make a call to allocate storage on your infrastructure as a |
|
147 |
-service, or register node names in DNS, or set complex firewalls. The more |
|
148 |
-complex your integration, the more important it is to record enough data in the |
|
149 |
-remote system that you can identify when resources on either side are deleted. |
|
150 |
- |
|
151 |
-Experimental: This command is under active development and may change without notice.` |
|
152 |
- |
|
153 |
- observeExample = ` # observe changes to services |
|
154 |
- %[1]s observe services |
|
155 |
- |
|
156 |
- # observe changes to services, including the clusterIP and invoke a script for each |
|
157 |
- %[1]s observe services -a '{ .spec.clusterIP }' -- register_dns.sh |
|
158 |
-` |
|
64 |
+var ( |
|
65 |
+ observeLong = templates.LongDesc(` |
|
66 |
+ Observe changes to resources and take action on them |
|
67 |
+ |
|
68 |
+ This command assists in building scripted reactions to changes that occur in |
|
69 |
+ Kubernetes or OpenShift resources. This is frequently referred to as a |
|
70 |
+ 'controller' in Kubernetes and acts to ensure particular conditions are |
|
71 |
+ maintained. On startup, observe will list all of the resources of a |
|
72 |
+ particular type and execute the provided script on each one. Observe watches |
|
73 |
+ the server for changes, and will reexecute the script for each update. |
|
74 |
+ |
|
75 |
+ Observe works best for problems of the form "for every resource X, make sure |
|
76 |
+ Y is true". Some examples of ways observe can be used include: |
|
77 |
+ |
|
78 |
+ * Ensure every namespace has a quota or limit range object |
|
79 |
+ * Ensure every service is registered in DNS by making calls to a DNS API |
|
80 |
+ * Send an email alert whenever a node reports 'NotReady' |
|
81 |
+ * Watch for the 'FailedScheduling' event and write an IRC message |
|
82 |
+ * Dynamically provision persistent volumes when a new PVC is created |
|
83 |
+ * Delete pods that have reached successful completion after a period of time. |
|
84 |
+ |
|
85 |
+ The simplest pattern is maintaining an invariant on an object - for instance, |
|
86 |
+ "every namespace should have an annotation that indicates its owner". If the |
|
87 |
+ object is deleted no reaction is necessary. A variation on that pattern is |
|
88 |
+ creating another object: "every namespace should have a quota object based |
|
89 |
+ on the resources allowed for an owner". |
|
90 |
+ |
|
91 |
+ $ cat set_owner.sh |
|
92 |
+ #!/bin/sh |
|
93 |
+ if [[ "$(%[1]s get namespace "$1" --template='{{ .metadata.annotations.owner }}')" == "" ]]; then |
|
94 |
+ %[1]s annotate namespace "$1" owner=bob |
|
95 |
+ fi |
|
96 |
+ |
|
97 |
+ $ %[1]s observe namespaces -- ./set_owner.sh |
|
98 |
+ |
|
99 |
+ The set_owner.sh script is invoked with a single argument (the namespace name) |
|
100 |
+ for each namespace. This simple script ensures that any user without the |
|
101 |
+ "owner" annotation gets one set, but preserves any existing value. |
|
102 |
+ |
|
103 |
+ The next common of controller pattern is provisioning - making changes in an |
|
104 |
+ external system to match the state of a Kubernetes resource. These scripts need |
|
105 |
+ to account for deletions that may take place while the observe command is not |
|
106 |
+ running. You can provide the list of known objects via the --names command, |
|
107 |
+ which should return a newline-delimited list of names or namespace/name pairs. |
|
108 |
+ Your command will be invoked whenever observe checks the latest state on the |
|
109 |
+ server - any resources returned by --names that are not found on the server |
|
110 |
+ will be passed to your --delete command. |
|
111 |
+ |
|
112 |
+ For example, you may wish to ensure that every node that is added to Kubernetes |
|
113 |
+ is added to your cluster inventory along with its IP: |
|
114 |
+ |
|
115 |
+ $ cat add_to_inventory.sh |
|
116 |
+ #!/bin/sh |
|
117 |
+ echo "$1 $2" >> inventory |
|
118 |
+ sort -u inventory -o inventory |
|
119 |
+ |
|
120 |
+ $ cat remove_from_inventory.sh |
|
121 |
+ #!/bin/sh |
|
122 |
+ grep -vE "^$1 " inventory > /tmp/newinventory |
|
123 |
+ mv -f /tmp/newinventory inventory |
|
124 |
+ |
|
125 |
+ $ cat known_nodes.sh |
|
126 |
+ #!/bin/sh |
|
127 |
+ touch inventory |
|
128 |
+ cut -f 1-1 -d ' ' inventory |
|
129 |
+ |
|
130 |
+ $ %[1]s observe nodes -a '{ .status.addresses[0].address }' \ |
|
131 |
+ --names ./known_nodes.sh \ |
|
132 |
+ --delete ./remove_from_inventory.sh \ |
|
133 |
+ -- ./add_to_inventory.sh |
|
134 |
+ |
|
135 |
+ If you stop the observe command and then delete a node, when you launch observe |
|
136 |
+ again the contents of inventory will be compared to the list of nodes from the |
|
137 |
+ server, and any node in the inventory file that no longer exists will trigger |
|
138 |
+ a call to remove_from_inventory.sh with the name of the node. |
|
139 |
+ |
|
140 |
+ Important: when handling deletes, the previous state of the object may not be |
|
141 |
+ available and only the name/namespace of the object will be passed to your |
|
142 |
+ --delete command as arguments (all custom arguments are omitted). |
|
143 |
+ |
|
144 |
+ More complicated interactions build on the two examples above - your inventory |
|
145 |
+ script could make a call to allocate storage on your infrastructure as a |
|
146 |
+ service, or register node names in DNS, or set complex firewalls. The more |
|
147 |
+ complex your integration, the more important it is to record enough data in the |
|
148 |
+ remote system that you can identify when resources on either side are deleted. |
|
149 |
+ |
|
150 |
+ Experimental: This command is under active development and may change without notice.`) |
|
151 |
+ |
|
152 |
+ observeExample = templates.Examples(` |
|
153 |
+ # Observe changes to services |
|
154 |
+ %[1]s observe services |
|
155 |
+ |
|
156 |
+ # Observe changes to services, including the clusterIP and invoke a script for each |
|
157 |
+ %[1]s observe services -a '{ .spec.clusterIP }' -- register_dns.sh`) |
|
159 | 158 |
) |
160 | 159 |
|
161 | 160 |
// NewCmdObserve creates the observe command. |
... | ... |
@@ -19,39 +19,41 @@ import ( |
19 | 19 |
"k8s.io/kubernetes/pkg/util/sets" |
20 | 20 |
|
21 | 21 |
"github.com/openshift/origin/pkg/cmd/cli/describe" |
22 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
22 | 23 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
23 | 24 |
"github.com/openshift/origin/pkg/template" |
24 | 25 |
templateapi "github.com/openshift/origin/pkg/template/api" |
25 | 26 |
) |
26 | 27 |
|
27 |
-const ( |
|
28 |
- processLong = ` |
|
29 |
-Process template into a list of resources specified in filename or stdin |
|
28 |
+var ( |
|
29 |
+ processLong = templates.LongDesc(` |
|
30 |
+ Process template into a list of resources specified in filename or stdin |
|
30 | 31 |
|
31 |
-Templates allow parameterization of resources prior to being sent to the server for creation or |
|
32 |
-update. Templates have "parameters", which may either be generated on creation or set by the user, |
|
33 |
-as well as metadata describing the template. |
|
32 |
+ Templates allow parameterization of resources prior to being sent to the server for creation or |
|
33 |
+ update. Templates have "parameters", which may either be generated on creation or set by the user, |
|
34 |
+ as well as metadata describing the template. |
|
34 | 35 |
|
35 |
-The output of the process command is always a list of one or more resources. You may pipe the |
|
36 |
-output to the create command over STDIN (using the '-f -' option) or redirect it to a file.` |
|
36 |
+ The output of the process command is always a list of one or more resources. You may pipe the |
|
37 |
+ output to the create command over STDIN (using the '-f -' option) or redirect it to a file.`) |
|
37 | 38 |
|
38 |
- processExample = ` # Convert template.json file into resource list and pass to create |
|
39 |
- %[1]s process -f template.json | %[1]s create -f - |
|
39 |
+ processExample = templates.Examples(` |
|
40 |
+ # Convert template.json file into resource list and pass to create |
|
41 |
+ %[1]s process -f template.json | %[1]s create -f - |
|
40 | 42 |
|
41 |
- # Process template while passing a user-defined label |
|
42 |
- %[1]s process -f template.json -l name=mytemplate |
|
43 |
+ # Process template while passing a user-defined label |
|
44 |
+ %[1]s process -f template.json -l name=mytemplate |
|
43 | 45 |
|
44 |
- # Convert stored template into resource list |
|
45 |
- %[1]s process foo |
|
46 |
+ # Convert stored template into resource list |
|
47 |
+ %[1]s process foo |
|
46 | 48 |
|
47 |
- # Convert stored template into resource list by setting/overriding parameter values |
|
48 |
- %[1]s process foo PARM1=VALUE1 PARM2=VALUE2 |
|
49 |
+ # Convert stored template into resource list by setting/overriding parameter values |
|
50 |
+ %[1]s process foo PARM1=VALUE1 PARM2=VALUE2 |
|
49 | 51 |
|
50 |
- # Convert template stored in different namespace into a resource list |
|
51 |
- %[1]s process openshift//foo |
|
52 |
+ # Convert template stored in different namespace into a resource list |
|
53 |
+ %[1]s process openshift//foo |
|
52 | 54 |
|
53 |
- # Convert template.json into resource list |
|
54 |
- cat template.json | %[1]s process -f -` |
|
55 |
+ # Convert template.json into resource list |
|
56 |
+ cat template.json | %[1]s process -f -`) |
|
55 | 57 |
) |
56 | 58 |
|
57 | 59 |
// NewCmdProcess implements the OpenShift cli process command |
... | ... |
@@ -16,6 +16,7 @@ import ( |
16 | 16 |
|
17 | 17 |
"github.com/openshift/origin/pkg/client" |
18 | 18 |
cliconfig "github.com/openshift/origin/pkg/cmd/cli/config" |
19 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
19 | 20 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
20 | 21 |
"github.com/openshift/origin/pkg/project/api" |
21 | 22 |
projectutil "github.com/openshift/origin/pkg/project/util" |
... | ... |
@@ -38,25 +39,26 @@ type ProjectOptions struct { |
38 | 38 |
SkipAccessValidation bool |
39 | 39 |
} |
40 | 40 |
|
41 |
-const ( |
|
42 |
- projectLong = ` |
|
43 |
-Switch to another project and make it the default in your configuration |
|
41 |
+var ( |
|
42 |
+ projectLong = templates.LongDesc(` |
|
43 |
+ Switch to another project and make it the default in your configuration |
|
44 | 44 |
|
45 |
-If no project was specified on the command line, display information about the current active |
|
46 |
-project. Since you can use this command to connect to projects on different servers, you will |
|
47 |
-occasionally encounter projects of the same name on different servers. When switching to that |
|
48 |
-project, a new local context will be created that will have a unique name - for instance, |
|
49 |
-'myapp-2'. If you have previously created a context with a different name than the project |
|
50 |
-name, this command will accept that context name instead. |
|
45 |
+ If no project was specified on the command line, display information about the current active |
|
46 |
+ project. Since you can use this command to connect to projects on different servers, you will |
|
47 |
+ occasionally encounter projects of the same name on different servers. When switching to that |
|
48 |
+ project, a new local context will be created that will have a unique name - for instance, |
|
49 |
+ 'myapp-2'. If you have previously created a context with a different name than the project |
|
50 |
+ name, this command will accept that context name instead. |
|
51 | 51 |
|
52 |
-For advanced configuration, or to manage the contents of your config file, use the 'config' |
|
53 |
-command.` |
|
52 |
+ For advanced configuration, or to manage the contents of your config file, use the 'config' |
|
53 |
+ command.`) |
|
54 | 54 |
|
55 |
- projectExample = ` # Switch to 'myapp' project |
|
56 |
- %[1]s myapp |
|
55 |
+ projectExample = templates.Examples(` |
|
56 |
+ # Switch to 'myapp' project |
|
57 |
+ %[1]s myapp |
|
57 | 58 |
|
58 |
- # Display the project currently in use |
|
59 |
- %[1]s` |
|
59 |
+ # Display the project currently in use |
|
60 |
+ %[1]s`) |
|
60 | 61 |
) |
61 | 62 |
|
62 | 63 |
// NewCmdProject implements the OpenShift cli rollback command |
... | ... |
@@ -13,6 +13,7 @@ import ( |
13 | 13 |
|
14 | 14 |
"github.com/openshift/origin/pkg/client" |
15 | 15 |
cliconfig "github.com/openshift/origin/pkg/cmd/cli/config" |
16 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
16 | 17 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
17 | 18 |
"github.com/openshift/origin/pkg/project/api" |
18 | 19 |
|
... | ... |
@@ -46,12 +47,12 @@ func (p SortByProjectName) Less(i, j int) bool { |
46 | 46 |
return p[i].Name < p[j].Name |
47 | 47 |
} |
48 | 48 |
|
49 |
-const ( |
|
50 |
- projectsLong = ` |
|
51 |
-Display information about the current active project and existing projects on the server. |
|
49 |
+var ( |
|
50 |
+ projectsLong = templates.LongDesc(` |
|
51 |
+ Display information about the current active project and existing projects on the server. |
|
52 | 52 |
|
53 |
-For advanced configuration, or to manage the contents of your config file, use the 'config' |
|
54 |
-command.` |
|
53 |
+ For advanced configuration, or to manage the contents of your config file, use the 'config' |
|
54 |
+ command.`) |
|
55 | 55 |
) |
56 | 56 |
|
57 | 57 |
// NewCmdProjects implements the OpenShift cli rollback command |
... | ... |
@@ -18,43 +18,45 @@ import ( |
18 | 18 |
latest "github.com/openshift/origin/pkg/api/latest" |
19 | 19 |
"github.com/openshift/origin/pkg/client" |
20 | 20 |
describe "github.com/openshift/origin/pkg/cmd/cli/describe" |
21 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
21 | 22 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
22 | 23 |
deployapi "github.com/openshift/origin/pkg/deploy/api" |
23 | 24 |
deployutil "github.com/openshift/origin/pkg/deploy/util" |
24 | 25 |
) |
25 | 26 |
|
26 |
-const ( |
|
27 |
- rollbackLong = ` |
|
28 |
-Revert an application back to a previous deployment |
|
27 |
+var ( |
|
28 |
+ rollbackLong = templates.LongDesc(` |
|
29 |
+ Revert an application back to a previous deployment |
|
29 | 30 |
|
30 |
-When you run this command your deployment configuration will be updated to |
|
31 |
-match a previous deployment. By default only the pod and container |
|
32 |
-configuration will be changed and scaling or trigger settings will be left as- |
|
33 |
-is. Note that environment variables and volumes are included in rollbacks, so |
|
34 |
-if you've recently updated security credentials in your environment your |
|
35 |
-previous deployment may not have the correct values. |
|
31 |
+ When you run this command your deployment configuration will be updated to |
|
32 |
+ match a previous deployment. By default only the pod and container |
|
33 |
+ configuration will be changed and scaling or trigger settings will be left as- |
|
34 |
+ is. Note that environment variables and volumes are included in rollbacks, so |
|
35 |
+ if you've recently updated security credentials in your environment your |
|
36 |
+ previous deployment may not have the correct values. |
|
36 | 37 |
|
37 |
-Any image triggers present in the rolled back configuration will be disabled |
|
38 |
-with a warning. This is to help prevent your rolled back deployment from being |
|
39 |
-replaced by a triggered deployment soon after your rollback. To re-enable the |
|
40 |
-triggers, use the 'deploy' command. |
|
38 |
+ Any image triggers present in the rolled back configuration will be disabled |
|
39 |
+ with a warning. This is to help prevent your rolled back deployment from being |
|
40 |
+ replaced by a triggered deployment soon after your rollback. To re-enable the |
|
41 |
+ triggers, use the 'deploy' command. |
|
41 | 42 |
|
42 |
-If you would like to review the outcome of the rollback, pass '--dry-run' to print |
|
43 |
-a human-readable representation of the updated deployment configuration instead of |
|
44 |
-executing the rollback. This is useful if you're not quite sure what the outcome |
|
45 |
-will be.` |
|
43 |
+ If you would like to review the outcome of the rollback, pass '--dry-run' to print |
|
44 |
+ a human-readable representation of the updated deployment configuration instead of |
|
45 |
+ executing the rollback. This is useful if you're not quite sure what the outcome |
|
46 |
+ will be.`) |
|
46 | 47 |
|
47 |
- rollbackExample = ` # Perform a rollback to the last successfully completed deployment for a deploymentconfig |
|
48 |
- %[1]s rollback frontend |
|
48 |
+ rollbackExample = templates.Examples(` |
|
49 |
+ # Perform a rollback to the last successfully completed deployment for a deploymentconfig |
|
50 |
+ %[1]s rollback frontend |
|
49 | 51 |
|
50 |
- # See what a rollback to version 3 will look like, but don't perform the rollback |
|
51 |
- %[1]s rollback frontend --to-version=3 --dry-run |
|
52 |
+ # See what a rollback to version 3 will look like, but don't perform the rollback |
|
53 |
+ %[1]s rollback frontend --to-version=3 --dry-run |
|
52 | 54 |
|
53 |
- # Perform a rollback to a specific deployment |
|
54 |
- %[1]s rollback frontend-2 |
|
55 |
+ # Perform a rollback to a specific deployment |
|
56 |
+ %[1]s rollback frontend-2 |
|
55 | 57 |
|
56 |
- # Perform the rollback manually by piping the JSON of the new config back to %[1]s |
|
57 |
- %[1]s rollback frontend -o json | %[1]s replace dc/frontend -f -` |
|
58 |
+ # Perform the rollback manually by piping the JSON of the new config back to %[1]s |
|
59 |
+ %[1]s rollback frontend -o json | %[1]s replace dc/frontend -f -`) |
|
58 | 60 |
) |
59 | 61 |
|
60 | 62 |
// NewCmdRollback creates a CLI rollback command. |
... | ... |
@@ -5,6 +5,7 @@ import ( |
5 | 5 |
"fmt" |
6 | 6 |
"io" |
7 | 7 |
|
8 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
8 | 9 |
"github.com/spf13/cobra" |
9 | 10 |
kerrors "k8s.io/kubernetes/pkg/api/errors" |
10 | 11 |
"k8s.io/kubernetes/pkg/api/meta" |
... | ... |
@@ -19,19 +20,19 @@ import ( |
19 | 19 |
deployutil "github.com/openshift/origin/pkg/deploy/util" |
20 | 20 |
) |
21 | 21 |
|
22 |
-const ( |
|
23 |
- rolloutLatestLong = ` |
|
24 |
-Start a new rollout for a deployment config with the latest state from its triggers |
|
22 |
+var ( |
|
23 |
+ rolloutLatestLong = templates.LongDesc(` |
|
24 |
+ Start a new rollout for a deployment config with the latest state from its triggers |
|
25 | 25 |
|
26 |
-This command is appropriate for running manual rollouts. If you want full control over |
|
27 |
-running new rollouts, use "oc set triggers --manual" to disable all triggers in your |
|
28 |
-deployment config and then whenever you want to run a new deployment process, use this |
|
29 |
-command in order to pick up the latest images found in the cluster that are pointed by |
|
30 |
-your image change triggers.` |
|
26 |
+ This command is appropriate for running manual rollouts. If you want full control over |
|
27 |
+ running new rollouts, use "oc set triggers --manual" to disable all triggers in your |
|
28 |
+ deployment config and then whenever you want to run a new deployment process, use this |
|
29 |
+ command in order to pick up the latest images found in the cluster that are pointed by |
|
30 |
+ your image change triggers.`) |
|
31 | 31 |
|
32 |
- rolloutLatestExample = ` # Start a new rollout based on the latest images defined in the image change triggers. |
|
33 |
- %[1]s rollout latest dc/nginx |
|
34 |
-` |
|
32 |
+ rolloutLatestExample = templates.Examples(` |
|
33 |
+ # Start a new rollout based on the latest images defined in the image change triggers. |
|
34 |
+ %[1]s rollout latest dc/nginx`) |
|
35 | 35 |
) |
36 | 36 |
|
37 | 37 |
// RolloutLatestOptions holds all the options for the `rollout latest` command. |
... | ... |
@@ -7,28 +7,28 @@ import ( |
7 | 7 |
"github.com/spf13/cobra" |
8 | 8 |
"k8s.io/kubernetes/pkg/kubectl/cmd/rollout" |
9 | 9 |
|
10 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
10 | 11 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
11 | 12 |
) |
12 | 13 |
|
13 |
-const ( |
|
14 |
- rolloutLong = ` |
|
15 |
-Start a new rollout, view its status or history, rollback to a previous revision of your app |
|
16 |
- |
|
17 |
-This command allows you to control a deployment config. Each individual rollout is exposed |
|
18 |
-as a replication controller, and the deployment process manages scaling down old replication |
|
19 |
-controllers and scaling up new ones. |
|
20 |
- |
|
21 |
-There are several deployment strategies defined: |
|
22 |
- |
|
23 |
-* Rolling (default) - scales up the new replication controller in stages, gradually reducing the |
|
24 |
- number of old pods. If one of the new deployed pods never becomes "ready", the new rollout |
|
25 |
- will be rolled back (scaled down to zero). Use when your application can tolerate two versions |
|
26 |
- of code running at the same time (many web applications, scalable databases) |
|
27 |
-* Recreate - scales the old replication controller down to zero, then scales the new replication |
|
28 |
- controller up to full. Use when your application cannot tolerate two versions of code running |
|
29 |
- at the same time |
|
30 |
-* Custom - run your own deployment process inside a Docker container using your own scripts. |
|
31 |
-` |
|
14 |
+var ( |
|
15 |
+ rolloutLong = templates.LongDesc(` |
|
16 |
+ Start a new rollout, view its status or history, rollback to a previous revision of your app |
|
17 |
+ |
|
18 |
+ This command allows you to control a deployment config. Each individual rollout is exposed |
|
19 |
+ as a replication controller, and the deployment process manages scaling down old replication |
|
20 |
+ controllers and scaling up new ones. |
|
21 |
+ |
|
22 |
+ There are several deployment strategies defined: |
|
23 |
+ |
|
24 |
+ * Rolling (default) - scales up the new replication controller in stages, gradually reducing the |
|
25 |
+ number of old pods. If one of the new deployed pods never becomes "ready", the new rollout |
|
26 |
+ will be rolled back (scaled down to zero). Use when your application can tolerate two versions |
|
27 |
+ of code running at the same time (many web applications, scalable databases) |
|
28 |
+ * Recreate - scales the old replication controller down to zero, then scales the new replication |
|
29 |
+ controller up to full. Use when your application cannot tolerate two versions of code running |
|
30 |
+ at the same time |
|
31 |
+ * Custom - run your own deployment process inside a Docker container using your own scripts.`) |
|
32 | 32 |
) |
33 | 33 |
|
34 | 34 |
// NewCmdRollout facilitates kubectl rollout subcommands |
... | ... |
@@ -53,19 +53,19 @@ func NewCmdRollout(fullName string, f *clientcmd.Factory, out io.Writer) *cobra. |
53 | 53 |
return cmd |
54 | 54 |
} |
55 | 55 |
|
56 |
-const ( |
|
57 |
- rolloutHistoryLong = ` |
|
58 |
-View the history of rollouts for a specific deployment config |
|
56 |
+var ( |
|
57 |
+ rolloutHistoryLong = templates.LongDesc(` |
|
58 |
+ View the history of rollouts for a specific deployment config |
|
59 | 59 |
|
60 |
-You can also view more detailed information for a specific revision |
|
61 |
-by using the --revision flag. |
|
62 |
-` |
|
60 |
+ You can also view more detailed information for a specific revision |
|
61 |
+ by using the --revision flag.`) |
|
63 | 62 |
|
64 |
- rolloutHistoryExample = ` # View the rollout history of a deployment |
|
65 |
- %[1]s rollout history dc/nginx |
|
63 |
+ rolloutHistoryExample = templates.Examples(` |
|
64 |
+ # View the rollout history of a deployment |
|
65 |
+ %[1]s rollout history dc/nginx |
|
66 | 66 |
|
67 |
- # View the details of deployment revision 3 |
|
68 |
- %[1]s rollout history dc/nginx --revision=3` |
|
67 |
+ # View the details of deployment revision 3 |
|
68 |
+ %[1]s rollout history dc/nginx --revision=3`) |
|
69 | 69 |
) |
70 | 70 |
|
71 | 71 |
// NewCmdRolloutHistory is a wrapper for the Kubernetes cli rollout history command |
... | ... |
@@ -77,17 +77,18 @@ func NewCmdRolloutHistory(fullName string, f *clientcmd.Factory, out io.Writer) |
77 | 77 |
return cmd |
78 | 78 |
} |
79 | 79 |
|
80 |
-const ( |
|
81 |
- rolloutPauseLong = ` |
|
82 |
-Mark the provided resource as paused |
|
80 |
+var ( |
|
81 |
+ rolloutPauseLong = templates.LongDesc(` |
|
82 |
+ Mark the provided resource as paused |
|
83 | 83 |
|
84 |
-Paused resources will not be reconciled by a controller. |
|
85 |
-Use \"%[1]s rollout resume\" to resume a paused resource.` |
|
84 |
+ Paused resources will not be reconciled by a controller. |
|
85 |
+ Use \"%[1]s rollout resume\" to resume a paused resource.`) |
|
86 | 86 |
|
87 |
- rolloutPauseExample = ` # Mark the nginx deployment as paused. Any current state of |
|
88 |
- # the deployment will continue its function, new updates to the deployment will not |
|
89 |
- # have an effect as long as the deployment is paused. |
|
90 |
- %[1]s rollout pause dc/nginx` |
|
87 |
+ rolloutPauseExample = templates.Examples(` |
|
88 |
+ # Mark the nginx deployment as paused. Any current state of |
|
89 |
+ # the deployment will continue its function, new updates to the deployment will not |
|
90 |
+ # have an effect as long as the deployment is paused. |
|
91 |
+ %[1]s rollout pause dc/nginx`) |
|
91 | 92 |
) |
92 | 93 |
|
93 | 94 |
// NewCmdRolloutPause is a wrapper for the Kubernetes cli rollout pause command |
... | ... |
@@ -99,15 +100,16 @@ func NewCmdRolloutPause(fullName string, f *clientcmd.Factory, out io.Writer) *c |
99 | 99 |
return cmd |
100 | 100 |
} |
101 | 101 |
|
102 |
-const ( |
|
103 |
- rolloutResumeLong = ` |
|
104 |
-Resume a paused resource |
|
102 |
+var ( |
|
103 |
+ rolloutResumeLong = templates.LongDesc(` |
|
104 |
+ Resume a paused resource |
|
105 | 105 |
|
106 |
-Paused resources will not be reconciled by a controller. By resuming a |
|
107 |
-resource, we allow it to be reconciled again.` |
|
106 |
+ Paused resources will not be reconciled by a controller. By resuming a |
|
107 |
+ resource, we allow it to be reconciled again.`) |
|
108 | 108 |
|
109 |
- rolloutResumeExample = ` # Resume an already paused deployment |
|
110 |
- %[1]s rollout resume dc/nginx` |
|
109 |
+ rolloutResumeExample = templates.Examples(` |
|
110 |
+ # Resume an already paused deployment |
|
111 |
+ %[1]s rollout resume dc/nginx`) |
|
111 | 112 |
) |
112 | 113 |
|
113 | 114 |
// NewCmdRolloutResume is a wrapper for the Kubernetes cli rollout resume command |
... | ... |
@@ -119,32 +121,33 @@ func NewCmdRolloutResume(fullName string, f *clientcmd.Factory, out io.Writer) * |
119 | 119 |
return cmd |
120 | 120 |
} |
121 | 121 |
|
122 |
-const ( |
|
123 |
- rolloutUndoLong = ` |
|
124 |
-Revert an application back to a previous deployment |
|
125 |
- |
|
126 |
-When you run this command your deployment configuration will be updated to |
|
127 |
-match a previous deployment. By default only the pod and container |
|
128 |
-configuration will be changed and scaling or trigger settings will be left as- |
|
129 |
-is. Note that environment variables and volumes are included in rollbacks, so |
|
130 |
-if you've recently updated security credentials in your environment your |
|
131 |
-previous deployment may not have the correct values. |
|
132 |
- |
|
133 |
-Any image triggers present in the rolled back configuration will be disabled |
|
134 |
-with a warning. This is to help prevent your rolled back deployment from being |
|
135 |
-replaced by a triggered deployment soon after your rollback. To re-enable the |
|
136 |
-triggers, use the 'deploy --enable-triggers' command. |
|
137 |
- |
|
138 |
-If you would like to review the outcome of the rollback, pass '--dry-run' to print |
|
139 |
-a human-readable representation of the updated deployment configuration instead of |
|
140 |
-executing the rollback. This is useful if you're not quite sure what the outcome |
|
141 |
-will be.` |
|
142 |
- |
|
143 |
- rolloutUndoExample = ` # Rollback to the previous deployment |
|
144 |
- %[1]s rollout undo dc/nginx |
|
145 |
- |
|
146 |
- # Rollback to deployment revision 3. The replication controller for that version must exist. |
|
147 |
- %[1]s rollout undo dc/nginx --to-revision=3` |
|
122 |
+var ( |
|
123 |
+ rolloutUndoLong = templates.LongDesc(` |
|
124 |
+ Revert an application back to a previous deployment |
|
125 |
+ |
|
126 |
+ When you run this command your deployment configuration will be updated to |
|
127 |
+ match a previous deployment. By default only the pod and container |
|
128 |
+ configuration will be changed and scaling or trigger settings will be left as- |
|
129 |
+ is. Note that environment variables and volumes are included in rollbacks, so |
|
130 |
+ if you've recently updated security credentials in your environment your |
|
131 |
+ previous deployment may not have the correct values. |
|
132 |
+ |
|
133 |
+ Any image triggers present in the rolled back configuration will be disabled |
|
134 |
+ with a warning. This is to help prevent your rolled back deployment from being |
|
135 |
+ replaced by a triggered deployment soon after your rollback. To re-enable the |
|
136 |
+ triggers, use the 'deploy --enable-triggers' command. |
|
137 |
+ |
|
138 |
+ If you would like to review the outcome of the rollback, pass '--dry-run' to print |
|
139 |
+ a human-readable representation of the updated deployment configuration instead of |
|
140 |
+ executing the rollback. This is useful if you're not quite sure what the outcome |
|
141 |
+ will be.`) |
|
142 |
+ |
|
143 |
+ rolloutUndoExample = templates.Examples(` |
|
144 |
+ # Rollback to the previous deployment |
|
145 |
+ %[1]s rollout undo dc/nginx |
|
146 |
+ |
|
147 |
+ # Rollback to deployment revision 3. The replication controller for that version must exist. |
|
148 |
+ %[1]s rollout undo dc/nginx --to-revision=3`) |
|
148 | 149 |
) |
149 | 150 |
|
150 | 151 |
// NewCmdRolloutUndo is a wrapper for the Kubernetes cli rollout undo command |
... | ... |
@@ -156,13 +159,13 @@ func NewCmdRolloutUndo(fullName string, f *clientcmd.Factory, out io.Writer) *co |
156 | 156 |
return cmd |
157 | 157 |
} |
158 | 158 |
|
159 |
-const ( |
|
160 |
- rolloutStatusLong = ` |
|
161 |
-Watch the status of the latest rollout, until it's done.` |
|
159 |
+var ( |
|
160 |
+ rolloutStatusLong = templates.LongDesc(` |
|
161 |
+ Watch the status of the latest rollout, until it's done.`) |
|
162 | 162 |
|
163 |
- rolloutStatusExample = ` # Watch the status of the latest rollout |
|
164 |
- %[1]s rollout status dc/nginx |
|
165 |
-` |
|
163 |
+ rolloutStatusExample = templates.Examples(` |
|
164 |
+ # Watch the status of the latest rollout |
|
165 |
+ %[1]s rollout status dc/nginx`) |
|
166 | 166 |
) |
167 | 167 |
|
168 | 168 |
// NewCmdRolloutStatus is a wrapper for the Kubernetes cli rollout status command |
... | ... |
@@ -11,42 +11,43 @@ import ( |
11 | 11 |
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" |
12 | 12 |
"k8s.io/kubernetes/pkg/util/term" |
13 | 13 |
|
14 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
14 | 15 |
"github.com/openshift/origin/pkg/cmd/util" |
15 | 16 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
16 | 17 |
) |
17 | 18 |
|
18 |
-const ( |
|
19 |
- RshRecommendedName = "rsh" |
|
19 |
+const RshRecommendedName = "rsh" |
|
20 | 20 |
|
21 |
- rshLong = ` |
|
22 |
-Open a remote shell session to a container |
|
21 |
+var ( |
|
22 |
+ rshLong = templates.LongDesc(` |
|
23 |
+ Open a remote shell session to a container |
|
23 | 24 |
|
24 |
-This command will attempt to start a shell session in a pod for the specified resource. |
|
25 |
-It works with pods, deployment configs, jobs, daemon sets, and replication controllers. |
|
26 |
-Any of the aforementioned resources (apart from pods) will be resolved to a ready pod. |
|
27 |
-It will default to the first container if none is specified, and will attempt to use |
|
28 |
-'/bin/sh' as the default shell. You may pass any flags supported by this command before |
|
29 |
-the resource name, and an optional command after the resource name, which will be executed |
|
30 |
-instead of a login shell. A TTY will be automatically allocated if standard input is |
|
31 |
-interactive - use -t and -T to override. A TERM variable is sent to the environment where |
|
32 |
-the shell (or command) will be executed. By default its value is the same as the TERM |
|
33 |
-variable from the local environment; if not set, 'xterm' is used. |
|
25 |
+ This command will attempt to start a shell session in a pod for the specified resource. |
|
26 |
+ It works with pods, deployment configs, jobs, daemon sets, and replication controllers. |
|
27 |
+ Any of the aforementioned resources (apart from pods) will be resolved to a ready pod. |
|
28 |
+ It will default to the first container if none is specified, and will attempt to use |
|
29 |
+ '/bin/sh' as the default shell. You may pass any flags supported by this command before |
|
30 |
+ the resource name, and an optional command after the resource name, which will be executed |
|
31 |
+ instead of a login shell. A TTY will be automatically allocated if standard input is |
|
32 |
+ interactive - use -t and -T to override. A TERM variable is sent to the environment where |
|
33 |
+ the shell (or command) will be executed. By default its value is the same as the TERM |
|
34 |
+ variable from the local environment; if not set, 'xterm' is used. |
|
34 | 35 |
|
35 |
-Note, some containers may not include a shell - use '%[1]s exec' if you need to run commands |
|
36 |
-directly.` |
|
36 |
+ Note, some containers may not include a shell - use '%[1]s exec' if you need to run commands |
|
37 |
+ directly.`) |
|
37 | 38 |
|
38 |
- rshExample = ` |
|
39 |
- # Open a shell session on the first container in pod 'foo' |
|
40 |
- %[1]s foo |
|
39 |
+ rshExample = templates.Examples(` |
|
40 |
+ # Open a shell session on the first container in pod 'foo' |
|
41 |
+ %[1]s foo |
|
41 | 42 |
|
42 |
- # Run the command 'cat /etc/resolv.conf' inside pod 'foo' |
|
43 |
- %[1]s foo cat /etc/resolv.conf |
|
43 |
+ # Run the command 'cat /etc/resolv.conf' inside pod 'foo' |
|
44 |
+ %[1]s foo cat /etc/resolv.conf |
|
44 | 45 |
|
45 |
- # See the configuration of your internal registry |
|
46 |
- %[1]s dc/docker-registry cat config.yml |
|
46 |
+ # See the configuration of your internal registry |
|
47 |
+ %[1]s dc/docker-registry cat config.yml |
|
47 | 48 |
|
48 |
- # Open a shell session on the container named 'index' inside a pod of your job |
|
49 |
- # %[1]s -c index job/sheduled` |
|
49 |
+ # Open a shell session on the container named 'index' inside a pod of your job |
|
50 |
+ # %[1]s -c index job/sheduled`) |
|
50 | 51 |
) |
51 | 52 |
|
52 | 53 |
// RshOptions declare the arguments accepted by the Rsh command |
... | ... |
@@ -12,6 +12,7 @@ import ( |
12 | 12 |
"github.com/spf13/cobra" |
13 | 13 |
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" |
14 | 14 |
|
15 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
15 | 16 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
16 | 17 |
"github.com/openshift/origin/pkg/util/fsnotification" |
17 | 18 |
) |
... | ... |
@@ -20,27 +21,29 @@ const ( |
20 | 20 |
// RsyncRecommendedName is the recommended name for the rsync command |
21 | 21 |
RsyncRecommendedName = "rsync" |
22 | 22 |
|
23 |
- rsyncLong = ` |
|
24 |
-Copy local files to or from a pod container |
|
23 |
+ noRsyncUnixWarning = "WARNING: rsync command not found in path. Please use your package manager to install it.\n" |
|
24 |
+ noRsyncWindowsWarning = "WARNING: rsync command not found in path. Download cwRsync for Windows and add it to your PATH.\n" |
|
25 |
+) |
|
25 | 26 |
|
26 |
-This command will copy local files to or from a remote container. |
|
27 |
-It only copies the changed files using the rsync command from your OS. |
|
28 |
-To ensure optimum performance, install rsync locally. In UNIX systems, |
|
29 |
-use your package manager. In Windows, install cwRsync from |
|
30 |
-https://www.itefix.net/cwrsync. |
|
27 |
+var ( |
|
28 |
+ rsyncLong = templates.LongDesc(` |
|
29 |
+ Copy local files to or from a pod container |
|
31 | 30 |
|
32 |
-If no container is specified, the first container of the pod is used |
|
33 |
-for the copy.` |
|
31 |
+ This command will copy local files to or from a remote container. |
|
32 |
+ It only copies the changed files using the rsync command from your OS. |
|
33 |
+ To ensure optimum performance, install rsync locally. In UNIX systems, |
|
34 |
+ use your package manager. In Windows, install cwRsync from |
|
35 |
+ https://www.itefix.net/cwrsync. |
|
34 | 36 |
|
35 |
- rsyncExample = ` |
|
36 |
- # Synchronize a local directory with a pod directory |
|
37 |
- %[1]s ./local/dir/ POD:/remote/dir |
|
37 |
+ If no container is specified, the first container of the pod is used |
|
38 |
+ for the copy.`) |
|
38 | 39 |
|
39 |
- # Synchronize a pod directory with a local directory |
|
40 |
- %[1]s POD:/remote/dir/ ./local/dir` |
|
40 |
+ rsyncExample = templates.Examples(` |
|
41 |
+ # Synchronize a local directory with a pod directory |
|
42 |
+ %[1]s ./local/dir/ POD:/remote/dir |
|
41 | 43 |
|
42 |
- noRsyncUnixWarning = "WARNING: rsync command not found in path. Please use your package manager to install it.\n" |
|
43 |
- noRsyncWindowsWarning = "WARNING: rsync command not found in path. Download cwRsync for Windows and add it to your PATH.\n" |
|
44 |
+ # Synchronize a pod directory with a local directory |
|
45 |
+ %[1]s POD:/remote/dir/ ./local/dir`) |
|
44 | 46 |
) |
45 | 47 |
|
46 | 48 |
// copyStrategy |
... | ... |
@@ -14,39 +14,40 @@ import ( |
14 | 14 |
"k8s.io/kubernetes/pkg/runtime" |
15 | 15 |
|
16 | 16 |
buildapi "github.com/openshift/origin/pkg/build/api" |
17 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
17 | 18 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
18 | 19 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
19 | 20 |
) |
20 | 21 |
|
21 |
-const ( |
|
22 |
- buildHookLong = ` |
|
23 |
-Set or remove a build hook on a build config |
|
22 |
+var ( |
|
23 |
+ buildHookLong = templates.LongDesc(` |
|
24 |
+ Set or remove a build hook on a build config |
|
24 | 25 |
|
25 |
-Build hooks allow behavior to be injected into the build process. |
|
26 |
+ Build hooks allow behavior to be injected into the build process. |
|
26 | 27 |
|
27 |
-A post-commit build hook is executed after a build has committed an image but before the |
|
28 |
-image has been pushed to a registry. It can be used to execute tests on the image and verify |
|
29 |
-it before it is made available in a registry or for any other logic that is needed to execute |
|
30 |
-before the image is pushed to the registry. A new container with the recently built image is |
|
31 |
-launched with the build hook command. If the command or script run by the build hook returns a |
|
32 |
-non-zero exit code, the resulting image will not be pushed to the registry. |
|
28 |
+ A post-commit build hook is executed after a build has committed an image but before the |
|
29 |
+ image has been pushed to a registry. It can be used to execute tests on the image and verify |
|
30 |
+ it before it is made available in a registry or for any other logic that is needed to execute |
|
31 |
+ before the image is pushed to the registry. A new container with the recently built image is |
|
32 |
+ launched with the build hook command. If the command or script run by the build hook returns a |
|
33 |
+ non-zero exit code, the resulting image will not be pushed to the registry. |
|
33 | 34 |
|
34 |
-The command for a build hook may be specified as a shell script (with the --script argument), |
|
35 |
-as a new entrypoint command on the image with the --command argument, or as a set of |
|
36 |
-arguments to the image's entrypoint (default). |
|
37 |
-` |
|
35 |
+ The command for a build hook may be specified as a shell script (with the --script argument), |
|
36 |
+ as a new entrypoint command on the image with the --command argument, or as a set of |
|
37 |
+ arguments to the image's entrypoint (default).`) |
|
38 | 38 |
|
39 |
- buildHookExample = ` # Clear post-commit hook on a build config |
|
40 |
- %[1]s build-hook bc/mybuild --post-commit --remove |
|
39 |
+ buildHookExample = templates.Examples(` |
|
40 |
+ # Clear post-commit hook on a build config |
|
41 |
+ %[1]s build-hook bc/mybuild --post-commit --remove |
|
41 | 42 |
|
42 |
- # Set the post-commit hook to execute a test suite using a new entrypoint |
|
43 |
- %[1]s build-hook bc/mybuild --post-commit --command -- /bin/bash -c /var/lib/test-image.sh |
|
43 |
+ # Set the post-commit hook to execute a test suite using a new entrypoint |
|
44 |
+ %[1]s build-hook bc/mybuild --post-commit --command -- /bin/bash -c /var/lib/test-image.sh |
|
44 | 45 |
|
45 |
- # Set the post-commit hook to execute a shell script |
|
46 |
- %[1]s build-hook bc/mybuild --post-commit --script="/var/lib/test-image.sh param1 param2 && /var/lib/done.sh" |
|
46 |
+ # Set the post-commit hook to execute a shell script |
|
47 |
+ %[1]s build-hook bc/mybuild --post-commit --script="/var/lib/test-image.sh param1 param2 && /var/lib/done.sh" |
|
47 | 48 |
|
48 |
- # Set the post-commit hook as a set of arguments to the default image entrypoint |
|
49 |
- %[1]s build-hook bc/mybuild --post-commit -- arg1 arg2` |
|
49 |
+ # Set the post-commit hook as a set of arguments to the default image entrypoint |
|
50 |
+ %[1]s build-hook bc/mybuild --post-commit -- arg1 arg2`) |
|
50 | 51 |
) |
51 | 52 |
|
52 | 53 |
type BuildHookOptions struct { |
... | ... |
@@ -15,37 +15,37 @@ import ( |
15 | 15 |
"k8s.io/kubernetes/pkg/util/errors" |
16 | 16 |
|
17 | 17 |
buildapi "github.com/openshift/origin/pkg/build/api" |
18 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
18 | 19 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
19 | 20 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
20 | 21 |
) |
21 | 22 |
|
22 |
-const ( |
|
23 |
- buildSecretLong = ` |
|
24 |
-Set or remove a build secret on a build config |
|
23 |
+var ( |
|
24 |
+ buildSecretLong = templates.LongDesc(` |
|
25 |
+ Set or remove a build secret on a build config |
|
25 | 26 |
|
26 |
-A build config can reference a secret to push or pull images from private registries or |
|
27 |
-to access private source repositories. |
|
27 |
+ A build config can reference a secret to push or pull images from private registries or |
|
28 |
+ to access private source repositories. |
|
28 | 29 |
|
29 |
-Specify the type of secret being set by using the --push, --pull, or --source flags. |
|
30 |
-A secret reference can be removed by using --remove flag. |
|
30 |
+ Specify the type of secret being set by using the --push, --pull, or --source flags. |
|
31 |
+ A secret reference can be removed by using --remove flag. |
|
31 | 32 |
|
32 |
-A label selector may be specified with the --selector flag to select the build configs |
|
33 |
-on which to set or remove secrets. Alternatively, all build configs in the namespace can |
|
34 |
-be selected with the --all flag. |
|
35 |
-` |
|
33 |
+ A label selector may be specified with the --selector flag to select the build configs |
|
34 |
+ on which to set or remove secrets. Alternatively, all build configs in the namespace can |
|
35 |
+ be selected with the --all flag.`) |
|
36 | 36 |
|
37 |
- buildSecretExample = ` # Clear push secret on a build config |
|
38 |
- %[1]s build-secret --push --remove bc/mybuild |
|
37 |
+ buildSecretExample = templates.Examples(` |
|
38 |
+ # Clear push secret on a build config |
|
39 |
+ %[1]s build-secret --push --remove bc/mybuild |
|
39 | 40 |
|
40 |
- # Set the pull secret on a build config |
|
41 |
- %[1]s build-secret --pull bc/mybuild mysecret |
|
41 |
+ # Set the pull secret on a build config |
|
42 |
+ %[1]s build-secret --pull bc/mybuild mysecret |
|
42 | 43 |
|
43 |
- # Set the push and pull secret on a build config |
|
44 |
- %[1]s build-secret --push --pull bc/mybuild mysecret |
|
44 |
+ # Set the push and pull secret on a build config |
|
45 |
+ %[1]s build-secret --push --pull bc/mybuild mysecret |
|
45 | 46 |
|
46 |
- # Set the source secret on a set of build configs matching a selector |
|
47 |
- %[1]s build-secret --source -l app=myapp gitsecret |
|
48 |
-` |
|
47 |
+ # Set the source secret on a set of build configs matching a selector |
|
48 |
+ %[1]s build-secret --source -l app=myapp gitsecret`) |
|
49 | 49 |
) |
50 | 50 |
|
51 | 51 |
type BuildSecretOptions struct { |
... | ... |
@@ -13,45 +13,46 @@ import ( |
13 | 13 |
"k8s.io/kubernetes/pkg/kubectl/resource" |
14 | 14 |
"k8s.io/kubernetes/pkg/runtime" |
15 | 15 |
|
16 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
16 | 17 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
17 | 18 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
18 | 19 |
deployapi "github.com/openshift/origin/pkg/deploy/api" |
19 | 20 |
) |
20 | 21 |
|
21 |
-const ( |
|
22 |
- deploymentHookLong = ` |
|
23 |
-Set or remove a deployment hook on a deployment config |
|
22 |
+var ( |
|
23 |
+ deploymentHookLong = templates.LongDesc(` |
|
24 |
+ Set or remove a deployment hook on a deployment config |
|
24 | 25 |
|
25 |
-Deployment configs allow hooks to execute at different points in the lifecycle of the |
|
26 |
-deployment, depending on the deployment strategy. |
|
26 |
+ Deployment configs allow hooks to execute at different points in the lifecycle of the |
|
27 |
+ deployment, depending on the deployment strategy. |
|
27 | 28 |
|
28 |
-For deployments with a Recreate strategy, a Pre, Mid, and Post hook can be specified. |
|
29 |
-The Pre hook will execute before the deployment starts. The Mid hook will execute once the |
|
30 |
-previous deployment has been scaled down to 0, but before the new one ramps up. |
|
31 |
-The Post hook will execute once the deployment has completed. |
|
29 |
+ For deployments with a Recreate strategy, a Pre, Mid, and Post hook can be specified. |
|
30 |
+ The Pre hook will execute before the deployment starts. The Mid hook will execute once the |
|
31 |
+ previous deployment has been scaled down to 0, but before the new one ramps up. |
|
32 |
+ The Post hook will execute once the deployment has completed. |
|
32 | 33 |
|
33 |
-For deployments with a Rolling strategy, a Pre and Post hook can be specified. |
|
34 |
-The Pre hook will execute before the deployment starts and the Post hook will execute once |
|
35 |
-the deployment has completed. |
|
34 |
+ For deployments with a Rolling strategy, a Pre and Post hook can be specified. |
|
35 |
+ The Pre hook will execute before the deployment starts and the Post hook will execute once |
|
36 |
+ the deployment has completed. |
|
36 | 37 |
|
37 |
-For each hook, a new pod will be started using one of the containers in the deployment's pod |
|
38 |
-template with a specific command to execute. Additional environment variables may be specified |
|
39 |
-for the hook, as well as which volumes from the pod template will be mounted on the hook pod. |
|
38 |
+ For each hook, a new pod will be started using one of the containers in the deployment's pod |
|
39 |
+ template with a specific command to execute. Additional environment variables may be specified |
|
40 |
+ for the hook, as well as which volumes from the pod template will be mounted on the hook pod. |
|
40 | 41 |
|
41 |
-Each hook can have its own cancellation policy. One of: abort, retry, or ignore. Not all cancellation |
|
42 |
-policies can be set on all hooks. For example, a Post hook on a rolling strategy does not support |
|
43 |
-the abort policy, because at that point the deployment has already happened. |
|
44 |
-` |
|
42 |
+ Each hook can have its own cancellation policy. One of: abort, retry, or ignore. Not all cancellation |
|
43 |
+ policies can be set on all hooks. For example, a Post hook on a rolling strategy does not support |
|
44 |
+ the abort policy, because at that point the deployment has already happened.`) |
|
45 | 45 |
|
46 |
- deploymentHookExample = ` # Clear pre and post hooks on a deployment config |
|
47 |
- %[1]s deployment-hook dc/myapp --remove --pre --post |
|
46 |
+ deploymentHookExample = templates.Examples(` |
|
47 |
+ # Clear pre and post hooks on a deployment config |
|
48 |
+ %[1]s deployment-hook dc/myapp --remove --pre --post |
|
48 | 49 |
|
49 |
- # Set the pre deployment hook to execute a db migration command for an application |
|
50 |
- # using the data volume from the application |
|
51 |
- %[1]s deployment-hook dc/myapp --pre -v data -- /var/lib/migrate-db.sh |
|
50 |
+ # Set the pre deployment hook to execute a db migration command for an application |
|
51 |
+ # using the data volume from the application |
|
52 |
+ %[1]s deployment-hook dc/myapp --pre -v data -- /var/lib/migrate-db.sh |
|
52 | 53 |
|
53 |
- # Set a mid deployment hook along with additional environment variables |
|
54 |
- %[1]s deployment-hook dc/myapp --mid -v data -e VAR1=value1 -e VAR2=value2 -- /var/lib/prepare-deploy.sh` |
|
54 |
+ # Set a mid deployment hook along with additional environment variables |
|
55 |
+ %[1]s deployment-hook dc/myapp --mid -v data -e VAR1=value1 -e VAR2=value2 -- /var/lib/prepare-deploy.sh`) |
|
55 | 56 |
) |
56 | 57 |
|
57 | 58 |
type DeploymentHookOptions struct { |
... | ... |
@@ -19,55 +19,57 @@ import ( |
19 | 19 |
"k8s.io/kubernetes/pkg/runtime" |
20 | 20 |
"k8s.io/kubernetes/pkg/util/strategicpatch" |
21 | 21 |
|
22 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
22 | 23 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
23 | 24 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
24 | 25 |
) |
25 | 26 |
|
26 |
-const ( |
|
27 |
- envLong = ` |
|
28 |
-Update environment variables on a pod template or a build config |
|
27 |
+var ( |
|
28 |
+ envLong = templates.LongDesc(` |
|
29 |
+ Update environment variables on a pod template or a build config |
|
29 | 30 |
|
30 |
-List environment variable definitions in one or more pods, pod templates or build |
|
31 |
-configuration. |
|
32 |
-Add, update, or remove container environment variable definitions in one or |
|
33 |
-more pod templates (within replication controllers or deployment configurations) or |
|
34 |
-build configurations. |
|
35 |
-View or modify the environment variable definitions on all containers in the |
|
36 |
-specified pods or pod templates, or just those that match a wildcard. |
|
31 |
+ List environment variable definitions in one or more pods, pod templates or build |
|
32 |
+ configuration. |
|
33 |
+ Add, update, or remove container environment variable definitions in one or |
|
34 |
+ more pod templates (within replication controllers or deployment configurations) or |
|
35 |
+ build configurations. |
|
36 |
+ View or modify the environment variable definitions on all containers in the |
|
37 |
+ specified pods or pod templates, or just those that match a wildcard. |
|
37 | 38 |
|
38 |
-If "--env -" is passed, environment variables can be read from STDIN using the standard env |
|
39 |
-syntax.` |
|
39 |
+ If "--env -" is passed, environment variables can be read from STDIN using the standard env |
|
40 |
+ syntax.`) |
|
40 | 41 |
|
41 |
- envExample = ` # Update deployment 'registry' with a new environment variable |
|
42 |
- %[1]s env dc/registry STORAGE_DIR=/local |
|
42 |
+ envExample = templates.Examples(` |
|
43 |
+ # Update deployment 'registry' with a new environment variable |
|
44 |
+ %[1]s env dc/registry STORAGE_DIR=/local |
|
43 | 45 |
|
44 |
- # List the environment variables defined on a build config 'sample-build' |
|
45 |
- %[1]s env bc/sample-build --list |
|
46 |
+ # List the environment variables defined on a build config 'sample-build' |
|
47 |
+ %[1]s env bc/sample-build --list |
|
46 | 48 |
|
47 |
- # List the environment variables defined on all pods |
|
48 |
- %[1]s env pods --all --list |
|
49 |
+ # List the environment variables defined on all pods |
|
50 |
+ %[1]s env pods --all --list |
|
49 | 51 |
|
50 |
- # Output modified build config in YAML, and does not alter the object on the server |
|
51 |
- %[1]s env bc/sample-build STORAGE_DIR=/data -o yaml |
|
52 |
+ # Output modified build config in YAML, and does not alter the object on the server |
|
53 |
+ %[1]s env bc/sample-build STORAGE_DIR=/data -o yaml |
|
52 | 54 |
|
53 |
- # Update all containers in all replication controllers in the project to have ENV=prod |
|
54 |
- %[1]s env rc --all ENV=prod |
|
55 |
+ # Update all containers in all replication controllers in the project to have ENV=prod |
|
56 |
+ %[1]s env rc --all ENV=prod |
|
55 | 57 |
|
56 |
- # Import environment from a secret |
|
57 |
- %[1]s env --from=secret/mysecret dc/myapp |
|
58 |
+ # Import environment from a secret |
|
59 |
+ %[1]s env --from=secret/mysecret dc/myapp |
|
58 | 60 |
|
59 |
- # Import environment from a config map with a prefix |
|
60 |
- %[1]s env --from=configmap/myconfigmap --prefix=MYSQL_ dc/myapp |
|
61 |
+ # Import environment from a config map with a prefix |
|
62 |
+ %[1]s env --from=configmap/myconfigmap --prefix=MYSQL_ dc/myapp |
|
61 | 63 |
|
62 |
- # Remove the environment variable ENV from container 'c1' in all deployment configs |
|
63 |
- %[1]s env dc --all --containers="c1" ENV- |
|
64 |
+ # Remove the environment variable ENV from container 'c1' in all deployment configs |
|
65 |
+ %[1]s env dc --all --containers="c1" ENV- |
|
64 | 66 |
|
65 |
- # Remove the environment variable ENV from a deployment config definition on disk and |
|
66 |
- # update the deployment config on the server |
|
67 |
- %[1]s env -f dc.json ENV- |
|
67 |
+ # Remove the environment variable ENV from a deployment config definition on disk and |
|
68 |
+ # update the deployment config on the server |
|
69 |
+ %[1]s env -f dc.json ENV- |
|
68 | 70 |
|
69 |
- # Set some of the local shell environment into a deployment config on the server |
|
70 |
- env | grep RAILS_ | %[1]s env -e - dc/registry` |
|
71 |
+ # Set some of the local shell environment into a deployment config on the server |
|
72 |
+ env | grep RAILS_ | %[1]s env -e - dc/registry`) |
|
71 | 73 |
) |
72 | 74 |
|
73 | 75 |
// NewCmdEnv implements the OpenShift cli env command |
... | ... |
@@ -18,49 +18,51 @@ import ( |
18 | 18 |
"k8s.io/kubernetes/pkg/runtime" |
19 | 19 |
"k8s.io/kubernetes/pkg/util/intstr" |
20 | 20 |
|
21 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
21 | 22 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
22 | 23 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
23 | 24 |
) |
24 | 25 |
|
25 |
-const ( |
|
26 |
- probeLong = ` |
|
27 |
-Set or remove a liveness or readiness probe from a pod or pod template |
|
26 |
+var ( |
|
27 |
+ probeLong = templates.LongDesc(` |
|
28 |
+ Set or remove a liveness or readiness probe from a pod or pod template |
|
28 | 29 |
|
29 |
-Each container in a pod may define one or more probes that are used for general health |
|
30 |
-checking. A liveness probe is checked periodically to ensure the container is still healthy: |
|
31 |
-if the probe fails, the container is restarted. Readiness probes set or clear the ready |
|
32 |
-flag for each container, which controls whether the container's ports are included in the list |
|
33 |
-of endpoints for a service and whether a deployment can proceed. A readiness check should |
|
34 |
-indicate when your container is ready to accept incoming traffic or begin handling work. |
|
35 |
-Setting both liveness and readiness probes for each container is highly recommended. |
|
30 |
+ Each container in a pod may define one or more probes that are used for general health |
|
31 |
+ checking. A liveness probe is checked periodically to ensure the container is still healthy: |
|
32 |
+ if the probe fails, the container is restarted. Readiness probes set or clear the ready |
|
33 |
+ flag for each container, which controls whether the container's ports are included in the list |
|
34 |
+ of endpoints for a service and whether a deployment can proceed. A readiness check should |
|
35 |
+ indicate when your container is ready to accept incoming traffic or begin handling work. |
|
36 |
+ Setting both liveness and readiness probes for each container is highly recommended. |
|
36 | 37 |
|
37 |
-The three probe types are: |
|
38 |
+ The three probe types are: |
|
38 | 39 |
|
39 |
-1. Open a TCP socket on the pod IP |
|
40 |
-2. Perform an HTTP GET against a URL on a container that must return 200 OK |
|
41 |
-3. Run a command in the container that must return exit code 0 |
|
40 |
+ 1. Open a TCP socket on the pod IP |
|
41 |
+ 2. Perform an HTTP GET against a URL on a container that must return 200 OK |
|
42 |
+ 3. Run a command in the container that must return exit code 0 |
|
42 | 43 |
|
43 |
-Containers that take a variable amount of time to start should set generous |
|
44 |
-initial-delay-seconds values, otherwise as your application evolves you may suddenly begin |
|
45 |
-to fail.` |
|
44 |
+ Containers that take a variable amount of time to start should set generous |
|
45 |
+ initial-delay-seconds values, otherwise as your application evolves you may suddenly begin |
|
46 |
+ to fail.`) |
|
46 | 47 |
|
47 |
- probeExample = ` # Clear both readiness and liveness probes off all containers |
|
48 |
- %[1]s probe dc/registry --remove --readiness --liveness |
|
48 |
+ probeExample = templates.Examples(` |
|
49 |
+ # Clear both readiness and liveness probes off all containers |
|
50 |
+ %[1]s probe dc/registry --remove --readiness --liveness |
|
49 | 51 |
|
50 |
- # Set an exec action as a liveness probe to run 'echo ok' |
|
51 |
- %[1]s probe dc/registry --liveness -- echo ok |
|
52 |
+ # Set an exec action as a liveness probe to run 'echo ok' |
|
53 |
+ %[1]s probe dc/registry --liveness -- echo ok |
|
52 | 54 |
|
53 |
- # Set a readiness probe to try to open a TCP socket on 3306 |
|
54 |
- %[1]s probe rc/mysql --readiness --open-tcp=3306 |
|
55 |
+ # Set a readiness probe to try to open a TCP socket on 3306 |
|
56 |
+ %[1]s probe rc/mysql --readiness --open-tcp=3306 |
|
55 | 57 |
|
56 |
- # Set an HTTP readiness probe for port 8080 and path /healthz over HTTP on the pod IP |
|
57 |
- %[1]s probe dc/webapp --readiness --get-url=http://:8080/healthz |
|
58 |
+ # Set an HTTP readiness probe for port 8080 and path /healthz over HTTP on the pod IP |
|
59 |
+ %[1]s probe dc/webapp --readiness --get-url=http://:8080/healthz |
|
58 | 60 |
|
59 |
- # Set an HTTP readiness probe over HTTPS on 127.0.0.1 for a hostNetwork pod |
|
60 |
- %[1]s probe dc/router --readiness --get-url=https://127.0.0.1:1936/stats |
|
61 |
+ # Set an HTTP readiness probe over HTTPS on 127.0.0.1 for a hostNetwork pod |
|
62 |
+ %[1]s probe dc/router --readiness --get-url=https://127.0.0.1:1936/stats |
|
61 | 63 |
|
62 |
- # Set only the initial-delay-seconds field on all deployments |
|
63 |
- %[1]s probe dc --all --readiness --initial-delay-seconds=30` |
|
64 |
+ # Set only the initial-delay-seconds field on all deployments |
|
65 |
+ %[1]s probe dc --all --readiness --initial-delay-seconds=30`) |
|
64 | 66 |
) |
65 | 67 |
|
66 | 68 |
type ProbeOptions struct { |
... | ... |
@@ -19,53 +19,55 @@ import ( |
19 | 19 |
"k8s.io/kubernetes/pkg/runtime" |
20 | 20 |
"k8s.io/kubernetes/pkg/util/sets" |
21 | 21 |
|
22 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
22 | 23 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
23 | 24 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
24 | 25 |
routeapi "github.com/openshift/origin/pkg/route/api" |
25 | 26 |
) |
26 | 27 |
|
27 |
-const ( |
|
28 |
- backendsLong = ` |
|
29 |
-Set and adjust route backends |
|
28 |
+var ( |
|
29 |
+ backendsLong = templates.LongDesc(` |
|
30 |
+ Set and adjust route backends |
|
30 | 31 |
|
31 |
-Routes may have one or more optional backend services with weights controlling how much |
|
32 |
-traffic flows to each service. Traffic is assigned proportional to the combined weights |
|
33 |
-of each backend. A weight of zero means that the backend will receive no traffic. If all |
|
34 |
-weights are zero the route will not send traffic to any backends. |
|
32 |
+ Routes may have one or more optional backend services with weights controlling how much |
|
33 |
+ traffic flows to each service. Traffic is assigned proportional to the combined weights |
|
34 |
+ of each backend. A weight of zero means that the backend will receive no traffic. If all |
|
35 |
+ weights are zero the route will not send traffic to any backends. |
|
35 | 36 |
|
36 |
-When setting backends, the first backend is the primary and the other backends are |
|
37 |
-considered alternates. For example: |
|
37 |
+ When setting backends, the first backend is the primary and the other backends are |
|
38 |
+ considered alternates. For example: |
|
38 | 39 |
|
39 |
- $ %[1]s route-backends web prod=99 canary=1 |
|
40 |
+ $ %[1]s route-backends web prod=99 canary=1 |
|
40 | 41 |
|
41 |
-will set the primary backend to service "prod" with a weight of 99 and the first |
|
42 |
-alternate backend to service "canary" with a weight of 1. This means 99%% of traffic will |
|
43 |
-be sent to the service "prod". |
|
42 |
+ will set the primary backend to service "prod" with a weight of 99 and the first |
|
43 |
+ alternate backend to service "canary" with a weight of 1. This means 99%% of traffic will |
|
44 |
+ be sent to the service "prod". |
|
44 | 45 |
|
45 |
-The --adjust flag allows you to alter the weight of an individual service relative to |
|
46 |
-itself or to the primary backend. Specifying a percentage will adjust the backend |
|
47 |
-relative to either the primary or the first alternate (if you specify the primary). |
|
48 |
-If there are other backends their weights will be kept proportional to the changed. |
|
46 |
+ The --adjust flag allows you to alter the weight of an individual service relative to |
|
47 |
+ itself or to the primary backend. Specifying a percentage will adjust the backend |
|
48 |
+ relative to either the primary or the first alternate (if you specify the primary). |
|
49 |
+ If there are other backends their weights will be kept proportional to the changed. |
|
49 | 50 |
|
50 |
-Not all routers may support multiple or weighted backends.` |
|
51 |
+ Not all routers may support multiple or weighted backends.`) |
|
51 | 52 |
|
52 |
- backendsExample = ` # Print the backends on the route 'web' |
|
53 |
- %[1]s route-backends web |
|
53 |
+ backendsExample = templates.Examples(` |
|
54 |
+ # Print the backends on the route 'web' |
|
55 |
+ %[1]s route-backends web |
|
54 | 56 |
|
55 |
- # Set two backend services on route 'web' with 2/3rds of traffic going to 'a' |
|
56 |
- %[1]s route-backends web a=2 b=1 |
|
57 |
+ # Set two backend services on route 'web' with 2/3rds of traffic going to 'a' |
|
58 |
+ %[1]s route-backends web a=2 b=1 |
|
57 | 59 |
|
58 |
- # Increase the traffic percentage going to b by 10%% relative to a |
|
59 |
- %[1]s route-backends web --adjust b=+10%% |
|
60 |
+ # Increase the traffic percentage going to b by 10%% relative to a |
|
61 |
+ %[1]s route-backends web --adjust b=+10%% |
|
60 | 62 |
|
61 |
- # Set traffic percentage going to b to 10%% of the traffic going to a |
|
62 |
- %[1]s route-backends web --adjust b=10%% |
|
63 |
+ # Set traffic percentage going to b to 10%% of the traffic going to a |
|
64 |
+ %[1]s route-backends web --adjust b=10%% |
|
63 | 65 |
|
64 |
- # Set weight of b to 10 |
|
65 |
- %[1]s route-backends web --adjust b=10 |
|
66 |
+ # Set weight of b to 10 |
|
67 |
+ %[1]s route-backends web --adjust b=10 |
|
66 | 68 |
|
67 |
- # Set the weight to all backends to zero |
|
68 |
- %[1]s route-backends web --zero` |
|
69 |
+ # Set the weight to all backends to zero |
|
70 |
+ %[1]s route-backends web --zero`) |
|
69 | 71 |
) |
70 | 72 |
|
71 | 73 |
type BackendsOptions struct { |
... | ... |
@@ -12,11 +12,11 @@ import ( |
12 | 12 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
13 | 13 |
) |
14 | 14 |
|
15 |
-const ( |
|
16 |
- setLong = ` |
|
17 |
-Configure application resources |
|
15 |
+var ( |
|
16 |
+ setLong = templates.LongDesc(` |
|
17 |
+ Configure application resources |
|
18 | 18 |
|
19 |
-These commands help you make changes to existing application resources.` |
|
19 |
+ These commands help you make changes to existing application resources.`) |
|
20 | 20 |
) |
21 | 21 |
|
22 | 22 |
// NewCmdSet exposes commands for modifying objects. |
... | ... |
@@ -66,22 +66,22 @@ func NewCmdSet(fullName string, f *clientcmd.Factory, in io.Reader, out, errout |
66 | 66 |
return set |
67 | 67 |
} |
68 | 68 |
|
69 |
-const ( |
|
70 |
- setImageLong = ` |
|
71 |
-Update existing container image(s) of resources. |
|
72 |
-` |
|
69 |
+var ( |
|
70 |
+ setImageLong = templates.LongDesc(` |
|
71 |
+Update existing container image(s) of resources.`) |
|
73 | 72 |
|
74 |
- setImageExample = ` # Set a deployment configs's nginx container image to 'nginx:1.9.1', and its busybox container image to 'busybox'. |
|
75 |
- %[1]s image dc/nginx busybox=busybox nginx=nginx:1.9.1 |
|
73 |
+ setImageExample = templates.Examples(` |
|
74 |
+ # Set a deployment configs's nginx container image to 'nginx:1.9.1', and its busybox container image to 'busybox'. |
|
75 |
+ %[1]s image dc/nginx busybox=busybox nginx=nginx:1.9.1 |
|
76 | 76 |
|
77 |
- # Update all deployments' and rc's nginx container's image to 'nginx:1.9.1' |
|
78 |
- %[1]s image deployments,rc nginx=nginx:1.9.1 --all |
|
77 |
+ # Update all deployments' and rc's nginx container's image to 'nginx:1.9.1' |
|
78 |
+ %[1]s image deployments,rc nginx=nginx:1.9.1 --all |
|
79 | 79 |
|
80 |
- # Update image of all containers of daemonset abc to 'nginx:1.9.1' |
|
81 |
- %[1]s image daemonset abc *=nginx:1.9.1 |
|
80 |
+ # Update image of all containers of daemonset abc to 'nginx:1.9.1' |
|
81 |
+ %[1]s image daemonset abc *=nginx:1.9.1 |
|
82 | 82 |
|
83 |
- # Print result (in yaml format) of updating nginx container image from local file, without hitting the server |
|
84 |
- %[1]s image -f path/to/file.yaml nginx=nginx:1.9.1 --local -o yaml` |
|
83 |
+ # Print result (in yaml format) of updating nginx container image from local file, without hitting the server |
|
84 |
+ %[1]s image -f path/to/file.yaml nginx=nginx:1.9.1 --local -o yaml`) |
|
85 | 85 |
) |
86 | 86 |
|
87 | 87 |
// NewCmdImage is a wrapper for the Kubernetes CLI set image command |
... | ... |
@@ -20,6 +20,7 @@ import ( |
20 | 20 |
|
21 | 21 |
buildapi "github.com/openshift/origin/pkg/build/api" |
22 | 22 |
buildutil "github.com/openshift/origin/pkg/build/util" |
23 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
23 | 24 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
24 | 25 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
25 | 26 |
deployapi "github.com/openshift/origin/pkg/deploy/api" |
... | ... |
@@ -28,42 +29,43 @@ import ( |
28 | 28 |
"k8s.io/kubernetes/pkg/util/sets" |
29 | 29 |
) |
30 | 30 |
|
31 |
-const ( |
|
32 |
- triggersLong = ` |
|
33 |
-Set or remove triggers for build configs and deployment configs |
|
31 |
+var ( |
|
32 |
+ triggersLong = templates.LongDesc(` |
|
33 |
+ Set or remove triggers for build configs and deployment configs |
|
34 | 34 |
|
35 |
-All build configs and deployment configs may have a set of triggers that result in a new deployment |
|
36 |
-or build being created. This command enables you to alter those triggers - making them automatic or |
|
37 |
-manual, adding new entries, or changing existing entries. |
|
35 |
+ All build configs and deployment configs may have a set of triggers that result in a new deployment |
|
36 |
+ or build being created. This command enables you to alter those triggers - making them automatic or |
|
37 |
+ manual, adding new entries, or changing existing entries. |
|
38 | 38 |
|
39 |
-Deployments support triggering off of image changes and on config changes. Config changes are any |
|
40 |
-alterations to the pod template, while image changes will result in the container image value being |
|
41 |
-updated whenever an image stream tag is updated. |
|
39 |
+ Deployments support triggering off of image changes and on config changes. Config changes are any |
|
40 |
+ alterations to the pod template, while image changes will result in the container image value being |
|
41 |
+ updated whenever an image stream tag is updated. |
|
42 | 42 |
|
43 |
-Build configs support triggering off of image changes, config changes, and webhooks (both GitHub-specific |
|
44 |
-and generic). The config change trigger for a build config will only trigger the first build.` |
|
43 |
+ Build configs support triggering off of image changes, config changes, and webhooks (both GitHub-specific |
|
44 |
+ and generic). The config change trigger for a build config will only trigger the first build.`) |
|
45 | 45 |
|
46 |
- triggersExample = ` # Print the triggers on the registry |
|
47 |
- %[1]s triggers dc/registry |
|
46 |
+ triggersExample = templates.Examples(` |
|
47 |
+ # Print the triggers on the registry |
|
48 |
+ %[1]s triggers dc/registry |
|
48 | 49 |
|
49 |
- # Set all triggers to manual |
|
50 |
- %[1]s triggers dc/registry --manual |
|
50 |
+ # Set all triggers to manual |
|
51 |
+ %[1]s triggers dc/registry --manual |
|
51 | 52 |
|
52 |
- # Enable all automatic triggers |
|
53 |
- %[1]s triggers dc/registry --auto |
|
53 |
+ # Enable all automatic triggers |
|
54 |
+ %[1]s triggers dc/registry --auto |
|
54 | 55 |
|
55 |
- # Reset the GitHub webhook on a build to a new, generated secret |
|
56 |
- %[1]s triggers bc/webapp --from-github |
|
57 |
- %[1]s triggers bc/webapp --from-webhook |
|
56 |
+ # Reset the GitHub webhook on a build to a new, generated secret |
|
57 |
+ %[1]s triggers bc/webapp --from-github |
|
58 |
+ %[1]s triggers bc/webapp --from-webhook |
|
58 | 59 |
|
59 |
- # Remove all triggers |
|
60 |
- %[1]s triggers bc/webapp --remove-all |
|
60 |
+ # Remove all triggers |
|
61 |
+ %[1]s triggers bc/webapp --remove-all |
|
61 | 62 |
|
62 |
- # Stop triggering on config change |
|
63 |
- %[1]s triggers dc/registry --from-config --remove |
|
63 |
+ # Stop triggering on config change |
|
64 |
+ %[1]s triggers dc/registry --from-config --remove |
|
64 | 65 |
|
65 |
- # Add an image trigger to a build config |
|
66 |
- %[1]s triggers bc/webapp --from-image=namespace1/image:latest` |
|
66 |
+ # Add an image trigger to a build config |
|
67 |
+ %[1]s triggers bc/webapp --from-image=namespace1/image:latest`) |
|
67 | 68 |
) |
68 | 69 |
|
69 | 70 |
type TriggersOptions struct { |
... | ... |
@@ -24,68 +24,70 @@ import ( |
24 | 24 |
"k8s.io/kubernetes/pkg/labels" |
25 | 25 |
"k8s.io/kubernetes/pkg/runtime" |
26 | 26 |
|
27 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
27 | 28 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
28 | 29 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
29 | 30 |
) |
30 | 31 |
|
31 |
-const ( |
|
32 |
- volumeLong = ` |
|
33 |
-Update volumes on a pod template |
|
32 |
+const volumePrefix = "volume-" |
|
34 | 33 |
|
35 |
-This command can add, update or remove volumes from containers for any object |
|
36 |
-that has a pod template (deployment configs, replication controllers, or pods). |
|
37 |
-You can list volumes in pod or any object that has a pod template. You can |
|
38 |
-specify a single object or multiple, and alter volumes on all containers or |
|
39 |
-just those that match a given name. |
|
34 |
+var ( |
|
35 |
+ volumeLong = templates.LongDesc(` |
|
36 |
+ Update volumes on a pod template |
|
40 | 37 |
|
41 |
-If you alter a volume setting on a deployment config, a deployment will be |
|
42 |
-triggered. Changing a replication controller will not affect running pods, and |
|
43 |
-you cannot change a pod's volumes once it has been created. |
|
38 |
+ This command can add, update or remove volumes from containers for any object |
|
39 |
+ that has a pod template (deployment configs, replication controllers, or pods). |
|
40 |
+ You can list volumes in pod or any object that has a pod template. You can |
|
41 |
+ specify a single object or multiple, and alter volumes on all containers or |
|
42 |
+ just those that match a given name. |
|
44 | 43 |
|
45 |
-Volume types include: |
|
44 |
+ If you alter a volume setting on a deployment config, a deployment will be |
|
45 |
+ triggered. Changing a replication controller will not affect running pods, and |
|
46 |
+ you cannot change a pod's volumes once it has been created. |
|
46 | 47 |
|
47 |
-* emptydir (empty directory) *default* |
|
48 |
- A directory allocated when the pod is created on a local host, is removed when |
|
49 |
- the pod is deleted and is not copied across servers |
|
50 |
-* hostdir (host directory) |
|
51 |
- A directory with specific path on any host (requires elevated privileges) |
|
52 |
-* persistentvolumeclaim or pvc (persistent volume claim) |
|
53 |
- Link the volume directory in the container to a persistent volume claim you have |
|
54 |
- allocated by name - a persistent volume claim is a request to allocate storage. |
|
55 |
- Note that if your claim hasn't been bound, your pods will not start. |
|
56 |
-* secret (mounted secret) |
|
57 |
- Secret volumes mount a named secret to the provided directory. |
|
48 |
+ Volume types include: |
|
58 | 49 |
|
59 |
-For descriptions on other volume types, see https://docs.openshift.com` |
|
50 |
+ * emptydir (empty directory) *default*: A directory allocated when the pod is |
|
51 |
+ created on a local host, is removed when the pod is deleted and is not copied |
|
52 |
+ across servers |
|
53 |
+ * hostdir (host directory): A directory with specific path on any host |
|
54 |
+ (requires elevated privileges) |
|
55 |
+ * persistentvolumeclaim or pvc (persistent volume claim): Link the volume |
|
56 |
+ directory in the container to a persistent volume claim you have allocated by |
|
57 |
+ name - a persistent volume claim is a request to allocate storage. Note that |
|
58 |
+ if your claim hasn't been bound, your pods will not start. |
|
59 |
+ * secret (mounted secret): Secret volumes mount a named secret to the provided |
|
60 |
+ directory. |
|
60 | 61 |
|
61 |
- volumeExample = ` # List volumes defined on all deployment configs in the current project |
|
62 |
- %[1]s volume dc --all |
|
62 |
+ For descriptions on other volume types, see https://docs.openshift.com`) |
|
63 | 63 |
|
64 |
- # Add a new empty dir volume to deployment config (dc) 'registry' mounted under |
|
65 |
- # /var/lib/registry |
|
66 |
- %[1]s volume dc/registry --add --mount-path=/var/lib/registry |
|
64 |
+ volumeExample = templates.Examples(` |
|
65 |
+ # List volumes defined on all deployment configs in the current project |
|
66 |
+ %[1]s volume dc --all |
|
67 | 67 |
|
68 |
- # Use an existing persistent volume claim (pvc) to overwrite an existing volume 'v1' |
|
69 |
- %[1]s volume dc/registry --add --name=v1 -t pvc --claim-name=pvc1 --overwrite |
|
68 |
+ # Add a new empty dir volume to deployment config (dc) 'registry' mounted under |
|
69 |
+ # /var/lib/registry |
|
70 |
+ %[1]s volume dc/registry --add --mount-path=/var/lib/registry |
|
70 | 71 |
|
71 |
- # Remove volume 'v1' from deployment config 'registry' |
|
72 |
- %[1]s volume dc/registry --remove --name=v1 |
|
72 |
+ # Use an existing persistent volume claim (pvc) to overwrite an existing volume 'v1' |
|
73 |
+ %[1]s volume dc/registry --add --name=v1 -t pvc --claim-name=pvc1 --overwrite |
|
73 | 74 |
|
74 |
- # Create a new persistent volume claim that overwrites an existing volume 'v1' |
|
75 |
- %[1]s volume dc/registry --add --name=v1 -t pvc --claim-size=1G --overwrite |
|
75 |
+ # Remove volume 'v1' from deployment config 'registry' |
|
76 |
+ %[1]s volume dc/registry --remove --name=v1 |
|
76 | 77 |
|
77 |
- # Change the mount point for volume 'v1' to /data |
|
78 |
- %[1]s volume dc/registry --add --name=v1 -m /data --overwrite |
|
78 |
+ # Create a new persistent volume claim that overwrites an existing volume 'v1' |
|
79 |
+ %[1]s volume dc/registry --add --name=v1 -t pvc --claim-size=1G --overwrite |
|
79 | 80 |
|
80 |
- # Modify the deployment config by removing volume mount "v1" from container "c1" |
|
81 |
- # (and by removing the volume "v1" if no other containers have volume mounts that reference it) |
|
82 |
- %[1]s volume dc/registry --remove --name=v1 --containers=c1 |
|
81 |
+ # Change the mount point for volume 'v1' to /data |
|
82 |
+ %[1]s volume dc/registry --add --name=v1 -m /data --overwrite |
|
83 | 83 |
|
84 |
- # Add new volume based on a more complex volume source (Git repo, AWS EBS, GCE PD, |
|
85 |
- # Ceph, Gluster, NFS, ISCSI, ...) |
|
86 |
- %[1]s volume dc/registry --add -m /repo --source=<json-string>` |
|
84 |
+ # Modify the deployment config by removing volume mount "v1" from container "c1" |
|
85 |
+ # (and by removing the volume "v1" if no other containers have volume mounts that reference it) |
|
86 |
+ %[1]s volume dc/registry --remove --name=v1 --containers=c1 |
|
87 | 87 |
|
88 |
- volumePrefix = "volume-" |
|
88 |
+ # Add new volume based on a more complex volume source (Git repo, AWS EBS, GCE PD, |
|
89 |
+ # Ceph, Gluster, NFS, ISCSI, ...) |
|
90 |
+ %[1]s volume dc/registry --add -m /repo --source=<json-string>`) |
|
89 | 91 |
) |
90 | 92 |
|
91 | 93 |
type VolumeOptions struct { |
... | ... |
@@ -29,6 +29,7 @@ import ( |
29 | 29 |
|
30 | 30 |
buildapi "github.com/openshift/origin/pkg/build/api" |
31 | 31 |
osclient "github.com/openshift/origin/pkg/client" |
32 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
32 | 33 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
33 | 34 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
34 | 35 |
"github.com/openshift/origin/pkg/generate/git" |
... | ... |
@@ -36,41 +37,41 @@ import ( |
36 | 36 |
"github.com/openshift/source-to-image/pkg/tar" |
37 | 37 |
) |
38 | 38 |
|
39 |
-const ( |
|
40 |
- startBuildLong = ` |
|
41 |
-Start a build |
|
39 |
+var ( |
|
40 |
+ startBuildLong = templates.LongDesc(` |
|
41 |
+ Start a build |
|
42 | 42 |
|
43 |
-This command starts a new build for the provided build config or copies an existing build using |
|
43 |
+ This command starts a new build for the provided build config or copies an existing build using |
|
44 |
+ --from-build=<name>. Pass the --follow flag to see output from the build. |
|
44 | 45 |
|
45 |
-In addition, you can pass a file, directory, or source code repository with the --from-file, |
|
46 |
-and override the current build source settings. When using --from-repo, the --commit flag can be |
|
47 |
-used to control which branch, tag, or commit is sent to the server. If you pass --from-file, the |
|
48 |
-file is placed in the root of an empty directory with the same filename. Note that builds |
|
49 |
-triggered from binary input will not preserve the source on the server, so rebuilds triggered by |
|
50 |
-base image changes will use the source specified on the build config. |
|
51 |
-` |
|
46 |
+ In addition, you can pass a file, directory, or source code repository with the --from-file, |
|
47 |
+ --from-dir, or --from-repo flags directly to the build. The contents will be streamed to the build |
|
48 |
+ and override the current build source settings. When using --from-repo, the --commit flag can be |
|
49 |
+ used to control which branch, tag, or commit is sent to the server. If you pass --from-file, the |
|
50 |
+ file is placed in the root of an empty directory with the same filename. Note that builds |
|
51 |
+ triggered from binary input will not preserve the source on the server, so rebuilds triggered by |
|
52 |
+ base image changes will use the source specified on the build config.`) |
|
52 | 53 |
|
53 |
- startBuildExample = ` # Starts build from build config "hello-world" |
|
54 |
- %[1]s start-build hello-world |
|
54 |
+ startBuildExample = templates.Examples(` |
|
55 |
+ # Starts build from build config "hello-world" |
|
56 |
+ %[1]s start-build hello-world |
|
55 | 57 |
|
56 |
- # Starts build from a previous build "hello-world-1" |
|
57 |
- %[1]s start-build --from-build=hello-world-1 |
|
58 |
+ # Starts build from a previous build "hello-world-1" |
|
59 |
+ %[1]s start-build --from-build=hello-world-1 |
|
58 | 60 |
|
59 |
- # Use the contents of a directory as build input |
|
60 |
- %[1]s start-build hello-world --from-dir=src/ |
|
61 |
+ # Use the contents of a directory as build input |
|
62 |
+ %[1]s start-build hello-world --from-dir=src/ |
|
61 | 63 |
|
62 |
- # Send the contents of a Git repository to the server from tag 'v2' |
|
63 |
- %[1]s start-build hello-world --from-repo=../hello-world --commit=v2 |
|
64 |
+ # Send the contents of a Git repository to the server from tag 'v2' |
|
65 |
+ %[1]s start-build hello-world --from-repo=../hello-world --commit=v2 |
|
64 | 66 |
|
65 |
- # Start a new build for build config "hello-world" and watch the logs until the build |
|
66 |
- # completes or fails. |
|
67 |
- %[1]s start-build hello-world --follow |
|
67 |
+ # Start a new build for build config "hello-world" and watch the logs until the build |
|
68 |
+ # completes or fails. |
|
69 |
+ %[1]s start-build hello-world --follow |
|
68 | 70 |
|
69 |
- # Start a new build for build config "hello-world" and wait until the build completes. It |
|
70 |
- # exits with a non-zero return code if the build fails. |
|
71 |
- %[1]s start-build hello-world --wait` |
|
71 |
+ # Start a new build for build config "hello-world" and wait until the build completes. It |
|
72 |
+ # exits with a non-zero return code if the build fails. |
|
73 |
+ %[1]s start-build hello-world --wait`) |
|
72 | 74 |
) |
73 | 75 |
|
74 | 76 |
// NewCmdStartBuild implements the OpenShift cli start-build command |
... | ... |
@@ -12,6 +12,7 @@ import ( |
12 | 12 |
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" |
13 | 13 |
|
14 | 14 |
"github.com/openshift/origin/pkg/cmd/cli/describe" |
15 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
15 | 16 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
16 | 17 |
dotutil "github.com/openshift/origin/pkg/util/dot" |
17 | 18 |
) |
... | ... |
@@ -19,26 +20,27 @@ import ( |
19 | 19 |
// StatusRecommendedName is the recommended command name. |
20 | 20 |
const StatusRecommendedName = "status" |
21 | 21 |
|
22 |
-const ( |
|
23 |
- statusLong = ` |
|
24 |
-Show a high level overview of the current project |
|
22 |
+var ( |
|
23 |
+ statusLong = templates.LongDesc(` |
|
24 |
+ Show a high level overview of the current project |
|
25 | 25 |
|
26 |
-This command will show services, deployment configs, build configurations, and active deployments. |
|
27 |
-If you have any misconfigured components information about them will be shown. For more information |
|
28 |
-about individual items, use the describe command (e.g. %[1]s describe buildConfig, |
|
29 |
-%[1]s describe deploymentConfig, %[1]s describe service). |
|
26 |
+ This command will show services, deployment configs, build configurations, and active deployments. |
|
27 |
+ If you have any misconfigured components information about them will be shown. For more information |
|
28 |
+ about individual items, use the describe command (e.g. %[1]s describe buildConfig, |
|
29 |
+ %[1]s describe deploymentConfig, %[1]s describe service). |
|
30 | 30 |
|
31 |
-You can specify an output format of "-o dot" to have this command output the generated status |
|
32 |
-graph in DOT format that is suitable for use by the "dot" command.` |
|
31 |
+ You can specify an output format of "-o dot" to have this command output the generated status |
|
32 |
+ graph in DOT format that is suitable for use by the "dot" command.`) |
|
33 | 33 |
|
34 |
- statusExample = ` # See an overview of the current project. |
|
35 |
- %[1]s |
|
34 |
+ statusExample = templates.Examples(` |
|
35 |
+ # See an overview of the current project. |
|
36 |
+ %[1]s |
|
36 | 37 |
|
37 |
- # Export the overview of the current project in an svg file. |
|
38 |
- %[1]s -o dot | dot -T svg -o project.svg |
|
38 |
+ # Export the overview of the current project in an svg file. |
|
39 |
+ %[1]s -o dot | dot -T svg -o project.svg |
|
39 | 40 |
|
40 |
- # See an overview of the current project including details for any identified issues. |
|
41 |
- %[1]s -v` |
|
41 |
+ # See an overview of the current project including details for any identified issues. |
|
42 |
+ %[1]s -v`) |
|
42 | 43 |
) |
43 | 44 |
|
44 | 45 |
// StatusOptions contains all the necessary options for the Openshift cli status command. |
... | ... |
@@ -17,6 +17,7 @@ import ( |
17 | 17 |
"k8s.io/kubernetes/pkg/util/sets" |
18 | 18 |
|
19 | 19 |
"github.com/openshift/origin/pkg/client" |
20 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
20 | 21 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
21 | 22 |
imageapi "github.com/openshift/origin/pkg/image/api" |
22 | 23 |
) |
... | ... |
@@ -39,33 +40,33 @@ type TagOptions struct { |
39 | 39 |
destNameAndTag []string |
40 | 40 |
} |
41 | 41 |
|
42 |
-const ( |
|
43 |
- tagLong = ` |
|
44 |
-Tag existing images into image streams |
|
42 |
+var ( |
|
43 |
+ tagLong = templates.LongDesc(` |
|
44 |
+ Tag existing images into image streams |
|
45 | 45 |
|
46 |
-The tag command allows you to take an existing tag or image from an image |
|
47 |
-stream, or a Docker image pull spec, and set it as the most recent image for a |
|
48 |
-tag in 1 or more other image streams. It is similar to the 'docker tag' |
|
49 |
-command, but it operates on image streams instead. |
|
46 |
+ The tag command allows you to take an existing tag or image from an image |
|
47 |
+ stream, or a Docker image pull spec, and set it as the most recent image for a |
|
48 |
+ tag in 1 or more other image streams. It is similar to the 'docker tag' |
|
49 |
+ command, but it operates on image streams instead. |
|
50 | 50 |
|
51 |
-Pass the --insecure flag if your external registry does not have a valid HTTPS |
|
52 |
-certificate, or is only served over HTTP. Pass --scheduled to have the server |
|
53 |
-regularly check the tag for updates and import the latest version (which can |
|
54 |
-then trigger builds and deployments). Note that --scheduled is only allowed for |
|
55 |
-Docker images. |
|
56 |
-` |
|
51 |
+ Pass the --insecure flag if your external registry does not have a valid HTTPS |
|
52 |
+ certificate, or is only served over HTTP. Pass --scheduled to have the server |
|
53 |
+ regularly check the tag for updates and import the latest version (which can |
|
54 |
+ then trigger builds and deployments). Note that --scheduled is only allowed for |
|
55 |
+ Docker images.`) |
|
57 | 56 |
|
58 |
- tagExample = ` # Tag the current image for the image stream 'openshift/ruby' and tag '2.0' into the image stream 'yourproject/ruby with tag 'tip'. |
|
59 |
- %[1]s tag openshift/ruby:2.0 yourproject/ruby:tip |
|
57 |
+ tagExample = templates.Examples(` |
|
58 |
+ # Tag the current image for the image stream 'openshift/ruby' and tag '2.0' into the image stream 'yourproject/ruby with tag 'tip'. |
|
59 |
+ %[1]s tag openshift/ruby:2.0 yourproject/ruby:tip |
|
60 | 60 |
|
61 |
- # Tag a specific image. |
|
62 |
- %[1]s tag openshift/ruby@sha256:6b646fa6bf5e5e4c7fa41056c27910e679c03ebe7f93e361e6515a9da7e258cc yourproject/ruby:tip |
|
61 |
+ # Tag a specific image. |
|
62 |
+ %[1]s tag openshift/ruby@sha256:6b646fa6bf5e5e4c7fa41056c27910e679c03ebe7f93e361e6515a9da7e258cc yourproject/ruby:tip |
|
63 | 63 |
|
64 |
- # Tag an external Docker image. |
|
65 |
- %[1]s tag --source=docker openshift/origin:latest yourproject/ruby:tip |
|
64 |
+ # Tag an external Docker image. |
|
65 |
+ %[1]s tag --source=docker openshift/origin:latest yourproject/ruby:tip |
|
66 | 66 |
|
67 |
- # Remove the specified spec tag from an image stream. |
|
68 |
- %[1]s tag openshift/origin:latest -d` |
|
67 |
+ # Remove the specified spec tag from an image stream. |
|
68 |
+ %[1]s tag openshift/origin:latest -d`) |
|
69 | 69 |
) |
70 | 70 |
|
71 | 71 |
// NewCmdTag implements the OpenShift cli tag command. |
... | ... |
@@ -9,6 +9,7 @@ import ( |
9 | 9 |
"github.com/MakeNowJust/heredoc" |
10 | 10 |
"github.com/spf13/cobra" |
11 | 11 |
|
12 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
12 | 13 |
ocutil "github.com/openshift/origin/pkg/cmd/util" |
13 | 14 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
14 | 15 |
) |
... | ... |
@@ -194,7 +195,7 @@ func writeConcept(w io.Writer, c concept) { |
194 | 194 |
} |
195 | 195 |
|
196 | 196 |
var ( |
197 |
- typesLong = heredoc.Doc(` |
|
197 |
+ typesLong = templates.LongDesc(` |
|
198 | 198 |
Concepts and Types |
199 | 199 |
|
200 | 200 |
Kubernetes and OpenShift help developers and operators build, test, and deploy |
... | ... |
@@ -204,20 +205,20 @@ var ( |
204 | 204 |
|
205 | 205 |
Concepts: |
206 | 206 |
|
207 |
- %[1]sFor more, see https://docs.openshift.com |
|
208 |
- `) |
|
207 |
+ %[1]sFor more, see https://docs.openshift.com`) |
|
209 | 208 |
|
210 |
- typesExample = ` # View all projects you have access to |
|
211 |
- %[1]s get projects |
|
209 |
+ typesExample = templates.Examples(` |
|
210 |
+ # View all projects you have access to |
|
211 |
+ %[1]s get projects |
|
212 | 212 |
|
213 |
- # See a list of all services in the current project |
|
214 |
- %[1]s get svc |
|
213 |
+ # See a list of all services in the current project |
|
214 |
+ %[1]s get svc |
|
215 | 215 |
|
216 |
- # Describe a deployment configuration in detail |
|
217 |
- %[1]s describe dc mydeploymentconfig |
|
216 |
+ # Describe a deployment configuration in detail |
|
217 |
+ %[1]s describe dc mydeploymentconfig |
|
218 | 218 |
|
219 |
- # Show the images tagged into an image stream |
|
220 |
- %[1]s describe is ruby-centos7` |
|
219 |
+ # Show the images tagged into an image stream |
|
220 |
+ %[1]s describe is ruby-centos7`) |
|
221 | 221 |
) |
222 | 222 |
|
223 | 223 |
func NewCmdTypes(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command { |
... | ... |
@@ -16,6 +16,7 @@ import ( |
16 | 16 |
kubeversion "k8s.io/kubernetes/pkg/version" |
17 | 17 |
|
18 | 18 |
"github.com/openshift/origin/pkg/client" |
19 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
19 | 20 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
20 | 21 |
"github.com/openshift/origin/pkg/cmd/util/tokencmd" |
21 | 22 |
"github.com/openshift/origin/pkg/version" |
... | ... |
@@ -23,9 +24,8 @@ import ( |
23 | 23 |
"github.com/spf13/cobra" |
24 | 24 |
) |
25 | 25 |
|
26 |
-const ( |
|
27 |
- versionLong = ` |
|
28 |
-Display client and server versions.` |
|
26 |
+var ( |
|
27 |
+ versionLong = templates.LongDesc(`Display client and server versions.`) |
|
29 | 28 |
) |
30 | 29 |
|
31 | 30 |
type VersionOptions struct { |
... | ... |
@@ -9,19 +9,19 @@ import ( |
9 | 9 |
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" |
10 | 10 |
|
11 | 11 |
osclient "github.com/openshift/origin/pkg/client" |
12 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
12 | 13 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
13 | 14 |
userapi "github.com/openshift/origin/pkg/user/api" |
14 | 15 |
) |
15 | 16 |
|
16 | 17 |
const WhoAmIRecommendedCommandName = "whoami" |
17 | 18 |
|
18 |
-const whoamiLong = ` |
|
19 |
-Show information about the current session |
|
19 |
+var whoamiLong = templates.LongDesc(` |
|
20 |
+ Show information about the current session |
|
20 | 21 |
|
21 |
-The default options for this command will return the currently authenticated user name |
|
22 |
-or an empty string. Other flags support returning the currently used token or the |
|
23 |
-user context. |
|
24 |
-` |
|
22 |
+ The default options for this command will return the currently authenticated user name |
|
23 |
+ or an empty string. Other flags support returning the currently used token or the |
|
24 |
+ user context.`) |
|
25 | 25 |
|
26 | 26 |
type WhoAmIOptions struct { |
27 | 27 |
UserInterface osclient.UserInterface |
... | ... |
@@ -17,6 +17,7 @@ import ( |
17 | 17 |
"github.com/openshift/origin/pkg/cmd/cli/cmd/create" |
18 | 18 |
cmdconfig "github.com/openshift/origin/pkg/cmd/cli/config" |
19 | 19 |
"github.com/openshift/origin/pkg/cmd/cli/describe" |
20 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
20 | 21 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
21 | 22 |
) |
22 | 23 |
|
... | ... |
@@ -34,28 +35,30 @@ func adjustCmdExamples(cmd *cobra.Command, parentName string, name string) { |
34 | 34 |
cmd.Example = strings.Join(examples, "\n") |
35 | 35 |
} |
36 | 36 |
|
37 |
-const ( |
|
38 |
- getLong = `Display one or many resources |
|
37 |
+var ( |
|
38 |
+ getLong = templates.LongDesc(` |
|
39 |
+ Display one or many resources |
|
39 | 40 |
|
40 |
-Possible resources include builds, buildConfigs, services, pods, etc. To see a |
|
41 |
-list of common resources, use '%[1]s get'. Some resources may omit |
|
42 |
-advanced details that you can see with '-o wide'. If you want an even more |
|
43 |
-detailed view, use '%[1]s describe'.` |
|
41 |
+ Possible resources include builds, buildConfigs, services, pods, etc. To see |
|
42 |
+ a list of common resources, use '%[1]s get'. Some resources may omit advanced |
|
43 |
+ details that you can see with '-o wide'. If you want an even more detailed |
|
44 |
+ view, use '%[1]s describe'.`) |
|
44 | 45 |
|
45 |
- getExample = ` # List all pods in ps output format. |
|
46 |
- %[1]s get pods |
|
46 |
+ getExample = templates.Examples(` |
|
47 |
+ # List all pods in ps output format. |
|
48 |
+ %[1]s get pods |
|
47 | 49 |
|
48 |
- # List a single replication controller with specified ID in ps output format. |
|
49 |
- %[1]s get rc redis |
|
50 |
+ # List a single replication controller with specified ID in ps output format. |
|
51 |
+ %[1]s get rc redis |
|
50 | 52 |
|
51 |
- # List all pods and show more details about them. |
|
52 |
- %[1]s get -o wide pods |
|
53 |
+ # List all pods and show more details about them. |
|
54 |
+ %[1]s get -o wide pods |
|
53 | 55 |
|
54 |
- # List a single pod in JSON output format. |
|
55 |
- %[1]s get -o json pod redis-pod |
|
56 |
+ # List a single pod in JSON output format. |
|
57 |
+ %[1]s get -o json pod redis-pod |
|
56 | 58 |
|
57 |
- # Return only the status value of the specified pod. |
|
58 |
- %[1]s get -o template pod redis-pod --template={{.currentState.status}}` |
|
59 |
+ # Return only the status value of the specified pod. |
|
60 |
+ %[1]s get -o template pod redis-pod --template={{.currentState.status}}`) |
|
59 | 61 |
) |
60 | 62 |
|
61 | 63 |
// NewCmdGet is a wrapper for the Kubernetes cli get command |
... | ... |
@@ -67,19 +70,21 @@ func NewCmdGet(fullName string, f *clientcmd.Factory, out, errOut io.Writer) *co |
67 | 67 |
return cmd |
68 | 68 |
} |
69 | 69 |
|
70 |
-const ( |
|
71 |
- replaceLong = `Replace a resource by filename or stdin |
|
70 |
+var ( |
|
71 |
+ replaceLong = templates.LongDesc(` |
|
72 |
+ Replace a resource by filename or stdin |
|
72 | 73 |
|
73 |
-JSON and YAML formats are accepted.` |
|
74 |
+ JSON and YAML formats are accepted.`) |
|
74 | 75 |
|
75 |
- replaceExample = ` # Replace a pod using the data in pod.json. |
|
76 |
- %[1]s replace -f pod.json |
|
76 |
+ replaceExample = templates.Examples(` |
|
77 |
+ # Replace a pod using the data in pod.json. |
|
78 |
+ %[1]s replace -f pod.json |
|
77 | 79 |
|
78 |
- # Replace a pod based on the JSON passed into stdin. |
|
79 |
- cat pod.json | %[1]s replace -f - |
|
80 |
+ # Replace a pod based on the JSON passed into stdin. |
|
81 |
+ cat pod.json | %[1]s replace -f - |
|
80 | 82 |
|
81 |
- # Force replace, delete and then re-create the resource |
|
82 |
- %[1]s replace --force -f pod.json` |
|
83 |
+ # Force replace, delete and then re-create the resource |
|
84 |
+ %[1]s replace --force -f pod.json`) |
|
83 | 85 |
) |
84 | 86 |
|
85 | 87 |
// NewCmdReplace is a wrapper for the Kubernetes cli replace command |
... | ... |
@@ -90,13 +95,15 @@ func NewCmdReplace(fullName string, f *clientcmd.Factory, out io.Writer) *cobra. |
90 | 90 |
return cmd |
91 | 91 |
} |
92 | 92 |
|
93 |
-const ( |
|
94 |
- patchLong = `Update field(s) of a resource using strategic merge patch |
|
93 |
+var ( |
|
94 |
+ patchLong = templates.LongDesc(` |
|
95 |
+ Update field(s) of a resource using strategic merge patch |
|
95 | 96 |
|
96 |
-JSON and YAML formats are accepted.` |
|
97 |
+ JSON and YAML formats are accepted.`) |
|
97 | 98 |
|
98 |
- patchExample = ` # Partially update a node using strategic merge patch |
|
99 |
- %[1]s patch node k8s-node-1 -p '{"spec":{"unschedulable":true}}'` |
|
99 |
+ patchExample = templates.Examples(` |
|
100 |
+ # Partially update a node using strategic merge patch |
|
101 |
+ %[1]s patch node k8s-node-1 -p '{"spec":{"unschedulable":true}}'`) |
|
100 | 102 |
) |
101 | 103 |
|
102 | 104 |
// NewCmdPatch is a wrapper for the Kubernetes cli patch command |
... | ... |
@@ -107,37 +114,39 @@ func NewCmdPatch(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Co |
107 | 107 |
return cmd |
108 | 108 |
} |
109 | 109 |
|
110 |
-const ( |
|
111 |
- deleteLong = `Delete a resource |
|
110 |
+var ( |
|
111 |
+ deleteLong = templates.LongDesc(` |
|
112 |
+ Delete a resource |
|
112 | 113 |
|
113 |
-JSON and YAML formats are accepted. |
|
114 |
+ JSON and YAML formats are accepted. |
|
114 | 115 |
|
115 |
-If both a filename and command line arguments are passed, the command line |
|
116 |
-arguments are used and the filename is ignored. |
|
116 |
+ If both a filename and command line arguments are passed, the command line |
|
117 |
+ arguments are used and the filename is ignored. |
|
117 | 118 |
|
118 |
-Note that the delete command does NOT do resource version checks, so if someone |
|
119 |
-submits an update to a resource right when you submit a delete, their update |
|
120 |
-will be lost along with the rest of the resource.` |
|
119 |
+ Note that the delete command does NOT do resource version checks, so if someone |
|
120 |
+ submits an update to a resource right when you submit a delete, their update |
|
121 |
+ will be lost along with the rest of the resource.`) |
|
121 | 122 |
|
122 |
- deleteExample = ` # Delete a pod using the type and ID specified in pod.json. |
|
123 |
- %[1]s delete -f pod.json |
|
123 |
+ deleteExample = templates.Examples(` |
|
124 |
+ # Delete a pod using the type and ID specified in pod.json. |
|
125 |
+ %[1]s delete -f pod.json |
|
124 | 126 |
|
125 |
- # Delete a pod based on the type and ID in the JSON passed into stdin. |
|
126 |
- cat pod.json | %[1]s delete -f - |
|
127 |
+ # Delete a pod based on the type and ID in the JSON passed into stdin. |
|
128 |
+ cat pod.json | %[1]s delete -f - |
|
127 | 129 |
|
128 |
- # Delete pods and services with label name=myLabel. |
|
129 |
- %[1]s delete pods,services -l name=myLabel |
|
130 |
+ # Delete pods and services with label name=myLabel. |
|
131 |
+ %[1]s delete pods,services -l name=myLabel |
|
130 | 132 |
|
131 |
- # Delete a pod with name node-1-vsjnm. |
|
132 |
- %[1]s delete pod node-1-vsjnm |
|
133 |
+ # Delete a pod with name node-1-vsjnm. |
|
134 |
+ %[1]s delete pod node-1-vsjnm |
|
133 | 135 |
|
134 |
- # Delete all resources associated with a running app, includes |
|
135 |
- # buildconfig,deploymentconfig,service,imagestream,route and pod, |
|
136 |
- # where 'appName' is listed in 'Labels' of 'oc describe [resource] [resource name]' output. |
|
137 |
- %[1]s delete all -l app=appName |
|
136 |
+ # Delete all resources associated with a running app, includes |
|
137 |
+ # buildconfig,deploymentconfig,service,imagestream,route and pod, |
|
138 |
+ # where 'appName' is listed in 'Labels' of 'oc describe [resource] [resource name]' output. |
|
139 |
+ %[1]s delete all -l app=appName |
|
138 | 140 |
|
139 |
- # Delete all pods |
|
140 |
- %[1]s delete pods --all` |
|
141 |
+ # Delete all pods |
|
142 |
+ %[1]s delete pods --all`) |
|
141 | 143 |
) |
142 | 144 |
|
143 | 145 |
// NewCmdDelete is a wrapper for the Kubernetes cli delete command |
... | ... |
@@ -150,16 +159,18 @@ func NewCmdDelete(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.C |
150 | 150 |
return cmd |
151 | 151 |
} |
152 | 152 |
|
153 |
-const ( |
|
154 |
- createLong = `Create a resource by filename or stdin |
|
153 |
+var ( |
|
154 |
+ createLong = templates.LongDesc(` |
|
155 |
+ Create a resource by filename or stdin |
|
155 | 156 |
|
156 |
-JSON and YAML formats are accepted.` |
|
157 |
+ JSON and YAML formats are accepted.`) |
|
157 | 158 |
|
158 |
- createExample = ` # Create a pod using the data in pod.json. |
|
159 |
- %[1]s create -f pod.json |
|
159 |
+ createExample = templates.Examples(` |
|
160 |
+ # Create a pod using the data in pod.json. |
|
161 |
+ %[1]s create -f pod.json |
|
160 | 162 |
|
161 |
- # Create a pod based on the JSON passed into stdin. |
|
162 |
- cat pod.json | %[1]s create -f -` |
|
163 |
+ # Create a pod based on the JSON passed into stdin. |
|
164 |
+ cat pod.json | %[1]s create -f -`) |
|
163 | 165 |
) |
164 | 166 |
|
165 | 167 |
// NewCmdCreate is a wrapper for the Kubernetes cli create command |
... | ... |
@@ -168,6 +179,10 @@ func NewCmdCreate(parentName string, f *clientcmd.Factory, out io.Writer) *cobra |
168 | 168 |
cmd.Long = createLong |
169 | 169 |
cmd.Example = fmt.Sprintf(createExample, parentName) |
170 | 170 |
|
171 |
+ // normalize long descs and examples |
|
172 |
+ // TODO remove when normalization is moved upstream |
|
173 |
+ templates.NormalizeAll(cmd) |
|
174 |
+ |
|
171 | 175 |
// create subcommands |
172 | 176 |
cmd.AddCommand(create.NewCmdCreateRoute(parentName, f, out)) |
173 | 177 |
cmd.AddCommand(create.NewCmdCreatePolicyBinding(create.PolicyBindingRecommendedName, parentName+" create "+create.PolicyBindingRecommendedName, f, out)) |
... | ... |
@@ -184,26 +199,29 @@ func NewCmdCreate(parentName string, f *clientcmd.Factory, out io.Writer) *cobra |
184 | 184 |
return cmd |
185 | 185 |
} |
186 | 186 |
|
187 |
-const ( |
|
188 |
- completionLong = `This command prints shell code which must be evaluated to provide interactive |
|
189 |
-completion of %s commands.` |
|
187 |
+var ( |
|
188 |
+ completionLong = templates.LongDesc(` |
|
189 |
+ This command prints shell code which must be evaluated to provide interactive |
|
190 |
+ completion of %s commands.`) |
|
190 | 191 |
|
191 |
- completionExample = ` # Generate the %s completion code for bash |
|
192 |
- %s completion bash > bash_completion.sh |
|
193 |
- source bash_completion.sh |
|
192 |
+ completionExample = templates.Examples(` |
|
193 |
+ # Generate the %s completion code for bash |
|
194 |
+ %s completion bash > bash_completion.sh |
|
195 |
+ source bash_completion.sh |
|
194 | 196 |
|
195 |
- # The above example depends on the bash-completion framework. |
|
196 |
- It must be sourced before sourcing the openshift cli completion, i.e. on the Mac: |
|
197 |
+ # The above example depends on the bash-completion framework. |
|
198 |
+ # It must be sourced before sourcing the openshift cli completion, |
|
199 |
+ # i.e. on the Mac: |
|
197 | 200 |
|
198 |
- brew install bash-completion |
|
199 |
- source $(brew --prefix)/etc/bash_completion |
|
200 |
- %s completion bash > bash_completion.sh |
|
201 |
- source bash_completion.sh |
|
201 |
+ brew install bash-completion |
|
202 |
+ source $(brew --prefix)/etc/bash_completion |
|
203 |
+ %s completion bash > bash_completion.sh |
|
204 |
+ source bash_completion.sh |
|
202 | 205 |
|
203 |
- # In zsh*, the following will load openshift cli zsh completion: |
|
204 |
- source <(%s completion zsh) |
|
206 |
+ # In zsh*, the following will load openshift cli zsh completion: |
|
207 |
+ source <(%s completion zsh) |
|
205 | 208 |
|
206 |
- * zsh completions are only supported in versions of zsh >= 5.2` |
|
209 |
+ * zsh completions are only supported in versions of zsh >= 5.2`) |
|
207 | 210 |
) |
208 | 211 |
|
209 | 212 |
func NewCmdCompletion(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command { |
... | ... |
@@ -219,14 +237,15 @@ func NewCmdCompletion(fullName string, f *clientcmd.Factory, out io.Writer) *cob |
219 | 219 |
return cmd |
220 | 220 |
} |
221 | 221 |
|
222 |
-const ( |
|
223 |
- execLong = `Execute a command in a container` |
|
222 |
+var ( |
|
223 |
+ execLong = templates.LongDesc(`Execute a command in a container`) |
|
224 | 224 |
|
225 |
- execExample = ` # Get output from running 'date' in ruby-container from pod 'mypod' |
|
225 |
+ execExample = templates.Examples(` |
|
226 |
+ # Get output from running 'date' in ruby-container from pod 'mypod' |
|
226 | 227 |
%[1]s exec mypod -c ruby-container date |
227 | 228 |
|
228 | 229 |
# Switch to raw terminal mode, sends stdin to 'bash' in ruby-container from pod 'mypod' and sends stdout/stderr from 'bash' back to the client |
229 |
- %[1]s exec mypod -c ruby-container -i -t -- bash -il` |
|
230 |
+ %[1]s exec mypod -c ruby-container -i -t -- bash -il`) |
|
230 | 231 |
) |
231 | 232 |
|
232 | 233 |
// NewCmdExec is a wrapper for the Kubernetes cli exec command |
... | ... |
@@ -239,20 +258,21 @@ func NewCmdExec(fullName string, f *clientcmd.Factory, cmdIn io.Reader, cmdOut, |
239 | 239 |
return cmd |
240 | 240 |
} |
241 | 241 |
|
242 |
-const ( |
|
243 |
- portForwardLong = `Forward 1 or more local ports to a pod` |
|
242 |
+var ( |
|
243 |
+ portForwardLong = templates.LongDesc(`Forward 1 or more local ports to a pod`) |
|
244 | 244 |
|
245 |
- portForwardExample = ` # Listens on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in the pod |
|
246 |
- %[1]s port-forward mypod 5000 6000 |
|
245 |
+ portForwardExample = templates.Examples(` |
|
246 |
+ # Listens on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in the pod |
|
247 |
+ %[1]s port-forward mypod 5000 6000 |
|
247 | 248 |
|
248 |
- # Listens on port 8888 locally, forwarding to 5000 in the pod |
|
249 |
- %[1]s port-forward mypod 8888:5000 |
|
249 |
+ # Listens on port 8888 locally, forwarding to 5000 in the pod |
|
250 |
+ %[1]s port-forward mypod 8888:5000 |
|
250 | 251 |
|
251 |
- # Listens on a random port locally, forwarding to 5000 in the pod |
|
252 |
- %[1]s port-forward mypod :5000 |
|
252 |
+ # Listens on a random port locally, forwarding to 5000 in the pod |
|
253 |
+ %[1]s port-forward mypod :5000 |
|
253 | 254 |
|
254 |
- # Listens on a random port locally, forwarding to 5000 in the pod |
|
255 |
- %[1]s port-forward mypod 0:5000` |
|
255 |
+ # Listens on a random port locally, forwarding to 5000 in the pod |
|
256 |
+ %[1]s port-forward mypod 0:5000`) |
|
256 | 257 |
) |
257 | 258 |
|
258 | 259 |
// NewCmdPortForward is a wrapper for the Kubernetes cli port-forward command |
... | ... |
@@ -264,17 +284,19 @@ func NewCmdPortForward(fullName string, f *clientcmd.Factory, out, errout io.Wri |
264 | 264 |
return cmd |
265 | 265 |
} |
266 | 266 |
|
267 |
-const ( |
|
268 |
- describeLong = `Show details of a specific resource |
|
267 |
+var ( |
|
268 |
+ describeLong = templates.LongDesc(` |
|
269 |
+ Show details of a specific resource |
|
269 | 270 |
|
270 |
-This command joins many API calls together to form a detailed description of a |
|
271 |
-given resource.` |
|
271 |
+ This command joins many API calls together to form a detailed description of a |
|
272 |
+ given resource.`) |
|
272 | 273 |
|
273 |
- describeExample = ` # Provide details about the ruby-22-centos7 image repository |
|
274 |
- %[1]s describe imageRepository ruby-22-centos7 |
|
274 |
+ describeExample = templates.Examples(` |
|
275 |
+ # Provide details about the ruby-22-centos7 image repository |
|
276 |
+ %[1]s describe imageRepository ruby-22-centos7 |
|
275 | 277 |
|
276 |
- # Provide details about the ruby-sample-build build configuration |
|
277 |
- %[1]s describe bc ruby-sample-build` |
|
278 |
+ # Provide details about the ruby-sample-build build configuration |
|
279 |
+ %[1]s describe bc ruby-sample-build`) |
|
278 | 280 |
) |
279 | 281 |
|
280 | 282 |
// NewCmdDescribe is a wrapper for the Kubernetes cli describe command |
... | ... |
@@ -286,19 +308,20 @@ func NewCmdDescribe(fullName string, f *clientcmd.Factory, out, errOut io.Writer |
286 | 286 |
return cmd |
287 | 287 |
} |
288 | 288 |
|
289 |
-const ( |
|
290 |
- proxyLong = `Run a proxy to the API server` |
|
289 |
+var ( |
|
290 |
+ proxyLong = templates.LongDesc(`Run a proxy to the API server`) |
|
291 | 291 |
|
292 |
- proxyExample = ` # Run a proxy to the api server on port 8011, serving static content from ./local/www/ |
|
293 |
- %[1]s proxy --port=8011 --www=./local/www/ |
|
292 |
+ proxyExample = templates.Examples(` |
|
293 |
+ # Run a proxy to the api server on port 8011, serving static content from ./local/www/ |
|
294 |
+ %[1]s proxy --port=8011 --www=./local/www/ |
|
294 | 295 |
|
295 |
- # Run a proxy to the api server on an arbitrary local port. |
|
296 |
- # The chosen port for the server will be output to stdout. |
|
297 |
- %[1]s proxy --port=0 |
|
296 |
+ # Run a proxy to the api server on an arbitrary local port. |
|
297 |
+ # The chosen port for the server will be output to stdout. |
|
298 |
+ %[1]s proxy --port=0 |
|
298 | 299 |
|
299 |
- # Run a proxy to the api server, changing the api prefix to my-api |
|
300 |
- # This makes e.g. the pods api available at localhost:8011/my-api/api/v1/pods/ |
|
301 |
- %[1]s proxy --api-prefix=/my-api` |
|
300 |
+ # Run a proxy to the api server, changing the api prefix to my-api |
|
301 |
+ # This makes e.g. the pods api available at localhost:8011/my-api/api/v1/pods/ |
|
302 |
+ %[1]s proxy --api-prefix=/my-api`) |
|
302 | 303 |
) |
303 | 304 |
|
304 | 305 |
// NewCmdProxy is a wrapper for the Kubernetes cli proxy command |
... | ... |
@@ -309,26 +332,28 @@ func NewCmdProxy(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Co |
309 | 309 |
return cmd |
310 | 310 |
} |
311 | 311 |
|
312 |
-const ( |
|
313 |
- scaleLong = `Set a new size for a deployment or replication controller |
|
312 |
+var ( |
|
313 |
+ scaleLong = templates.LongDesc(` |
|
314 |
+ Set a new size for a deployment or replication controller |
|
314 | 315 |
|
315 |
-Scale also allows users to specify one or more preconditions for the scale action. |
|
316 |
-If --current-replicas or --resource-version is specified, it is validated before the |
|
317 |
-scale is attempted, and it is guaranteed that the precondition holds true when the |
|
318 |
-scale is sent to the server. |
|
316 |
+ Scale also allows users to specify one or more preconditions for the scale action. |
|
317 |
+ If --current-replicas or --resource-version is specified, it is validated before the |
|
318 |
+ scale is attempted, and it is guaranteed that the precondition holds true when the |
|
319 |
+ scale is sent to the server. |
|
319 | 320 |
|
320 |
-Note that scaling a deployment configuration with no deployments will update the |
|
321 |
-desired replicas in the configuration template.` |
|
321 |
+ Note that scaling a deployment configuration with no deployments will update the |
|
322 |
+ desired replicas in the configuration template.`) |
|
322 | 323 |
|
323 |
- scaleExample = ` # Scale replication controller named 'foo' to 3. |
|
324 |
- %[1]s scale --replicas=3 replicationcontrollers foo |
|
324 |
+ scaleExample = templates.Examples(` |
|
325 |
+ # Scale replication controller named 'foo' to 3. |
|
326 |
+ %[1]s scale --replicas=3 replicationcontrollers foo |
|
325 | 327 |
|
326 |
- # If the replication controller named foo's current size is 2, scale foo to 3. |
|
327 |
- %[1]s scale --current-replicas=2 --replicas=3 replicationcontrollers foo |
|
328 |
+ # If the replication controller named foo's current size is 2, scale foo to 3. |
|
329 |
+ %[1]s scale --current-replicas=2 --replicas=3 replicationcontrollers foo |
|
328 | 330 |
|
329 |
- # Scale the latest deployment of 'bar'. In case of no deployment, bar's template |
|
330 |
- # will be scaled instead. |
|
331 |
- %[1]s scale --replicas=10 dc bar` |
|
331 |
+ # Scale the latest deployment of 'bar'. In case of no deployment, bar's template |
|
332 |
+ # will be scaled instead. |
|
333 |
+ %[1]s scale --replicas=10 dc bar`) |
|
332 | 334 |
) |
333 | 335 |
|
334 | 336 |
// NewCmdScale is a wrapper for the Kubernetes cli scale command |
... | ... |
@@ -341,18 +366,22 @@ func NewCmdScale(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Co |
341 | 341 |
return cmd |
342 | 342 |
} |
343 | 343 |
|
344 |
-const ( |
|
345 |
- autoScaleLong = `Autoscale a deployment config or replication controller. |
|
344 |
+var ( |
|
345 |
+ autoScaleLong = templates.LongDesc(` |
|
346 |
+ Autoscale a deployment config or replication controller. |
|
346 | 347 |
|
347 |
-Looks up a deployment config or replication controller by name and creates an autoscaler that uses |
|
348 |
-this deployment config or replication controller as a reference. An autoscaler can automatically |
|
349 |
-increase or decrease number of pods deployed within the system as needed.` |
|
348 |
+ Looks up a deployment config or replication controller by name and creates an autoscaler that uses |
|
349 |
+ this deployment config or replication controller as a reference. An autoscaler can automatically |
|
350 |
+ increase or decrease number of pods deployed within the system as needed.`) |
|
350 | 351 |
|
351 |
- autoScaleExample = ` # Auto scale a deployment config "foo", with the number of pods between 2 to 10, target CPU utilization at a default value that server applies: |
|
352 |
- %[1]s autoscale dc/foo --min=2 --max=10 |
|
352 |
+ autoScaleExample = templates.Examples(` |
|
353 |
+ # Auto scale a deployment config "foo", with the number of pods between 2 to |
|
354 |
+ # 10, target CPU utilization at a default value that server applies: |
|
355 |
+ %[1]s autoscale dc/foo --min=2 --max=10 |
|
353 | 356 |
|
354 |
- # Auto scale a replication controller "foo", with the number of pods between 1 to 5, target CPU utilization at 80%% |
|
355 |
- %[1]s autoscale rc/foo --max=5 --cpu-percent=80` |
|
357 |
+ # Auto scale a replication controller "foo", with the number of pods between |
|
358 |
+ # 1 to 5, target CPU utilization at 80%% |
|
359 |
+ %[1]s autoscale rc/foo --max=5 --cpu-percent=80`) |
|
356 | 360 |
) |
357 | 361 |
|
358 | 362 |
// NewCmdAutoscale is a wrapper for the Kubernetes cli autoscale command |
... | ... |
@@ -365,25 +394,27 @@ func NewCmdAutoscale(fullName string, f *clientcmd.Factory, out io.Writer) *cobr |
365 | 365 |
return cmd |
366 | 366 |
} |
367 | 367 |
|
368 |
-const ( |
|
369 |
- runLong = `Create and run a particular image, possibly replicated |
|
368 |
+var ( |
|
369 |
+ runLong = templates.LongDesc(` |
|
370 |
+ Create and run a particular image, possibly replicated |
|
370 | 371 |
|
371 |
-Creates a deployment config to manage the created container(s). You can choose to run in the |
|
372 |
-foreground for an interactive container execution. You may pass 'run/v1' to |
|
372 |
+ Creates a deployment config to manage the created container(s). You can choose to run in the |
|
373 |
+ foreground for an interactive container execution. You may pass 'run/v1' to |
|
374 |
+ --generator to create a replication controller instead of a deployment config.`) |
|
373 | 375 |
|
374 |
- runExample = ` # Starts a single instance of nginx. |
|
375 |
- %[1]s run nginx --image=nginx |
|
376 |
+ runExample = templates.Examples(` |
|
377 |
+ # Starts a single instance of nginx. |
|
378 |
+ %[1]s run nginx --image=nginx |
|
376 | 379 |
|
377 |
- # Starts a replicated instance of nginx. |
|
378 |
- %[1]s run nginx --image=nginx --replicas=5 |
|
380 |
+ # Starts a replicated instance of nginx. |
|
381 |
+ %[1]s run nginx --image=nginx --replicas=5 |
|
379 | 382 |
|
380 |
- # Dry run. Print the corresponding API objects without creating them. |
|
381 |
- %[1]s run nginx --image=nginx --dry-run |
|
383 |
+ # Dry run. Print the corresponding API objects without creating them. |
|
384 |
+ %[1]s run nginx --image=nginx --dry-run |
|
382 | 385 |
|
383 |
- # Start a single instance of nginx, but overload the spec of the replication |
|
384 |
- # controller with a partial set of values parsed from JSON. |
|
385 |
- %[1]s run nginx --image=nginx --overrides='{ "apiVersion": "v1", "spec": { ... } }' |
|
386 |
+ # Start a single instance of nginx, but overload the spec of the replication |
|
387 |
+ # controller with a partial set of values parsed from JSON. |
|
388 |
+ %[1]s run nginx --image=nginx --overrides='{ "apiVersion": "v1", "spec": { ... } }' |
|
386 | 389 |
|
387 | 390 |
# Start a single instance of nginx and keep it in the foreground, don't restart it if it exits. |
388 | 391 |
%[1]s run -i --tty nginx --image=nginx --restart=Never |
... | ... |
@@ -393,7 +424,7 @@ foreground for an interactive container execution. You may pass 'run/v1' to |
393 | 393 |
%[1]s run nginx --image=nginx -- <arg1> <arg2> ... <argN> |
394 | 394 |
|
395 | 395 |
# Start the nginx container using a different command and custom arguments |
396 |
- %[1]s run nginx --image=nginx --command -- <cmd> <arg1> ... <argN>` |
|
396 |
+ %[1]s run nginx --image=nginx --command -- <cmd> <arg1> ... <argN>`) |
|
397 | 397 |
) |
398 | 398 |
|
399 | 399 |
// NewCmdRun is a wrapper for the Kubernetes cli run command |
... | ... |
@@ -410,21 +441,23 @@ func NewCmdRun(fullName string, f *clientcmd.Factory, in io.Reader, out, errout |
410 | 410 |
return cmd |
411 | 411 |
} |
412 | 412 |
|
413 |
-const ( |
|
414 |
- attachLong = `Attach to a running container |
|
413 |
+var ( |
|
414 |
+ attachLong = templates.LongDesc(` |
|
415 |
+ Attach to a running container |
|
415 | 416 |
|
416 |
-Attach the current shell to a remote container, returning output or setting up a full |
|
417 |
-terminal session. Can be used to debug containers and invoke interactive commands.` |
|
417 |
+ Attach the current shell to a remote container, returning output or setting up a full |
|
418 |
+ terminal session. Can be used to debug containers and invoke interactive commands.`) |
|
418 | 419 |
|
419 |
- attachExample = ` # Get output from running pod 123456-7890, using the first container by default |
|
420 |
- %[1]s attach 123456-7890 |
|
420 |
+ attachExample = templates.Examples(` |
|
421 |
+ # Get output from running pod 123456-7890, using the first container by default |
|
422 |
+ %[1]s attach 123456-7890 |
|
421 | 423 |
|
422 |
- # Get output from ruby-container from pod 123456-7890 |
|
423 |
- %[1]s attach 123456-7890 -c ruby-container |
|
424 |
+ # Get output from ruby-container from pod 123456-7890 |
|
425 |
+ %[1]s attach 123456-7890 -c ruby-container |
|
424 | 426 |
|
425 |
- # Switch to raw terminal mode, sends stdin to 'bash' in ruby-container from pod 123456-780 |
|
426 |
- # and sends stdout/stderr from 'bash' back to the client |
|
427 |
- %[1]s attach 123456-7890 -c ruby-container -i -t` |
|
427 |
+ # Switch to raw terminal mode, sends stdin to 'bash' in ruby-container from pod 123456-780 |
|
428 |
+ # and sends stdout/stderr from 'bash' back to the client |
|
429 |
+ %[1]s attach 123456-7890 -c ruby-container -i -t`) |
|
428 | 430 |
) |
429 | 431 |
|
430 | 432 |
// NewCmdAttach is a wrapper for the Kubernetes cli attach command |
... | ... |
@@ -435,36 +468,38 @@ func NewCmdAttach(fullName string, f *clientcmd.Factory, in io.Reader, out, erro |
435 | 435 |
return cmd |
436 | 436 |
} |
437 | 437 |
|
438 |
-const ( |
|
439 |
- annotateLong = `Update the annotations on one or more resources |
|
438 |
+var ( |
|
439 |
+ annotateLong = templates.LongDesc(` |
|
440 |
+ Update the annotations on one or more resources |
|
440 | 441 |
|
441 |
-An annotation is a key/value pair that can hold larger (compared to a label), |
|
442 |
-and possibly not human-readable, data. It is intended to store non-identifying |
|
443 |
-auxiliary data, especially data manipulated by tools and system extensions. If |
|
444 |
-attempting to overwrite an annotation will result in an error. If |
|
445 |
-otherwise the existing resource-version will be used. |
|
442 |
+ An annotation is a key/value pair that can hold larger (compared to a label), |
|
443 |
+ and possibly not human-readable, data. It is intended to store non-identifying |
|
444 |
+ auxiliary data, especially data manipulated by tools and system extensions. If |
|
445 |
+ --overwrite is true, then existing annotations can be overwritten, otherwise |
|
446 |
+ attempting to overwrite an annotation will result in an error. If |
|
447 |
+ --resource-version is specified, then updates will use this resource version, |
|
448 |
+ otherwise the existing resource-version will be used. |
|
446 | 449 |
|
447 |
-Run '%[1]s types' for a list of valid resources.` |
|
450 |
+ Run '%[1]s types' for a list of valid resources.`) |
|
448 | 451 |
|
449 |
- annotateExample = ` # Update pod 'foo' with the annotation 'description' and the value 'my frontend'. |
|
450 |
- # If the same annotation is set multiple times, only the last value will be applied |
|
451 |
- %[1]s annotate pods foo description='my frontend' |
|
452 |
+ annotateExample = templates.Examples(` |
|
453 |
+ # Update pod 'foo' with the annotation 'description' and the value 'my frontend'. |
|
454 |
+ # If the same annotation is set multiple times, only the last value will be applied |
|
455 |
+ %[1]s annotate pods foo description='my frontend' |
|
452 | 456 |
|
453 |
- # Update pod 'foo' with the annotation 'description' and the value |
|
454 |
- # 'my frontend running nginx', overwriting any existing value. |
|
455 |
- %[1]s annotate --overwrite pods foo description='my frontend running nginx' |
|
457 |
+ # Update pod 'foo' with the annotation 'description' and the value |
|
458 |
+ # 'my frontend running nginx', overwriting any existing value. |
|
459 |
+ %[1]s annotate --overwrite pods foo description='my frontend running nginx' |
|
456 | 460 |
|
457 |
- # Update all pods in the namespace |
|
458 |
- %[1]s annotate pods --all description='my frontend running nginx' |
|
461 |
+ # Update all pods in the namespace |
|
462 |
+ %[1]s annotate pods --all description='my frontend running nginx' |
|
459 | 463 |
|
460 |
- # Update pod 'foo' only if the resource is unchanged from version 1. |
|
461 |
- %[1]s annotate pods foo description='my frontend running nginx' --resource-version=1 |
|
464 |
+ # Update pod 'foo' only if the resource is unchanged from version 1. |
|
465 |
+ %[1]s annotate pods foo description='my frontend running nginx' --resource-version=1 |
|
462 | 466 |
|
463 |
- # Update pod 'foo' by removing an annotation named 'description' if it exists. |
|
464 |
- # Does not require the --overwrite flag. |
|
465 |
- %[1]s annotate pods foo description-` |
|
467 |
+ # Update pod 'foo' by removing an annotation named 'description' if it exists. |
|
468 |
+ # Does not require the --overwrite flag. |
|
469 |
+ %[1]s annotate pods foo description-`) |
|
466 | 470 |
) |
467 | 471 |
|
468 | 472 |
// NewCmdAnnotate is a wrapper for the Kubernetes cli annotate command |
... | ... |
@@ -475,30 +510,32 @@ func NewCmdAnnotate(fullName string, f *clientcmd.Factory, out io.Writer) *cobra |
475 | 475 |
return cmd |
476 | 476 |
} |
477 | 477 |
|
478 |
-const ( |
|
479 |
- labelLong = `Update the labels on one or more resources |
|
478 |
+var ( |
|
479 |
+ labelLong = templates.LongDesc(` |
|
480 |
+ Update the labels on one or more resources |
|
480 | 481 |
|
481 |
-A valid label value is consisted of letters and/or numbers with a max length of %[1]d |
|
482 |
-characters. If --overwrite is true, then existing labels can be overwritten, otherwise |
|
483 |
-attempting to overwrite a label will result in an error. If --resource-version is |
|
484 |
-specified, then updates will use this resource version, otherwise the existing |
|
485 |
-resource-version will be used.` |
|
482 |
+ A valid label value is consisted of letters and/or numbers with a max length of %[1]d |
|
483 |
+ characters. If --overwrite is true, then existing labels can be overwritten, otherwise |
|
484 |
+ attempting to overwrite a label will result in an error. If --resource-version is |
|
485 |
+ specified, then updates will use this resource version, otherwise the existing |
|
486 |
+ resource-version will be used.`) |
|
486 | 487 |
|
487 |
- labelExample = ` # Update pod 'foo' with the label 'unhealthy' and the value 'true'. |
|
488 |
- %[1]s label pods foo unhealthy=true |
|
488 |
+ labelExample = templates.Examples(` |
|
489 |
+ # Update pod 'foo' with the label 'unhealthy' and the value 'true'. |
|
490 |
+ %[1]s label pods foo unhealthy=true |
|
489 | 491 |
|
490 |
- # Update pod 'foo' with the label 'status' and the value 'unhealthy', overwriting any existing value. |
|
491 |
- %[1]s label --overwrite pods foo status=unhealthy |
|
492 |
+ # Update pod 'foo' with the label 'status' and the value 'unhealthy', overwriting any existing value. |
|
493 |
+ %[1]s label --overwrite pods foo status=unhealthy |
|
492 | 494 |
|
493 |
- # Update all pods in the namespace |
|
494 |
- %[1]s label pods --all status=unhealthy |
|
495 |
+ # Update all pods in the namespace |
|
496 |
+ %[1]s label pods --all status=unhealthy |
|
495 | 497 |
|
496 |
- # Update pod 'foo' only if the resource is unchanged from version 1. |
|
497 |
- %[1]s label pods foo status=unhealthy --resource-version=1 |
|
498 |
+ # Update pod 'foo' only if the resource is unchanged from version 1. |
|
499 |
+ %[1]s label pods foo status=unhealthy --resource-version=1 |
|
498 | 500 |
|
499 |
- # Update pod 'foo' by removing a label named 'bar' if it exists. |
|
500 |
- # Does not require the --overwrite flag. |
|
501 |
- %[1]s label pods foo bar-` |
|
501 |
+ # Update pod 'foo' by removing a label named 'bar' if it exists. |
|
502 |
+ # Does not require the --overwrite flag. |
|
503 |
+ %[1]s label pods foo bar-`) |
|
502 | 504 |
) |
503 | 505 |
|
504 | 506 |
// NewCmdLabel is a wrapper for the Kubernetes cli label command |
... | ... |
@@ -509,16 +546,18 @@ func NewCmdLabel(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Co |
509 | 509 |
return cmd |
510 | 510 |
} |
511 | 511 |
|
512 |
-const ( |
|
513 |
- applyLong = `Apply a configuration to a resource by filename or stdin. |
|
512 |
+var ( |
|
513 |
+ applyLong = templates.LongDesc(` |
|
514 |
+ Apply a configuration to a resource by filename or stdin. |
|
514 | 515 |
|
515 |
-JSON and YAML formats are accepted.` |
|
516 |
+ JSON and YAML formats are accepted.`) |
|
516 | 517 |
|
517 |
- applyExample = `# Apply the configuration in pod.json to a pod. |
|
518 |
-%[1]s apply -f ./pod.json |
|
518 |
+ applyExample = templates.Examples(` |
|
519 |
+ # Apply the configuration in pod.json to a pod. |
|
520 |
+ %[1]s apply -f ./pod.json |
|
519 | 521 |
|
520 |
-# Apply the JSON passed into stdin to a pod. |
|
521 |
-cat pod.json | %[1]s apply -f -` |
|
522 |
+ # Apply the JSON passed into stdin to a pod. |
|
523 |
+ cat pod.json | %[1]s apply -f -`) |
|
522 | 524 |
) |
523 | 525 |
|
524 | 526 |
// NewCmdApply is a wrapper for the Kubernetes cli apply command |
... | ... |
@@ -529,19 +568,21 @@ func NewCmdApply(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Co |
529 | 529 |
return cmd |
530 | 530 |
} |
531 | 531 |
|
532 |
-const ( |
|
533 |
- explainLong = `Documentation of resources. |
|
532 |
+var ( |
|
533 |
+ explainLong = templates.LongDesc(` |
|
534 |
+ Documentation of resources. |
|
534 | 535 |
|
535 |
-Possible resource types include: pods (po), services (svc), |
|
536 |
-replicationcontrollers (rc), nodes (no), events (ev), componentstatuses (cs), |
|
537 |
-limitranges (limits), persistentvolumes (pv), persistentvolumeclaims (pvc), |
|
538 |
-resourcequotas (quota), namespaces (ns) or endpoints (ep).` |
|
536 |
+ Possible resource types include: pods (po), services (svc), |
|
537 |
+ replicationcontrollers (rc), nodes (no), events (ev), componentstatuses (cs), |
|
538 |
+ limitranges (limits), persistentvolumes (pv), persistentvolumeclaims (pvc), |
|
539 |
+ resourcequotas (quota), namespaces (ns) or endpoints (ep).`) |
|
539 | 540 |
|
540 |
- explainExample = `# Get the documentation of the resource and its fields |
|
541 |
-%[1]s explain pods |
|
541 |
+ explainExample = templates.Examples(` |
|
542 |
+ # Get the documentation of the resource and its fields |
|
543 |
+ %[1]s explain pods |
|
542 | 544 |
|
543 |
-# Get the documentation of a specific field of a resource |
|
544 |
-%[1]s explain pods.spec.containers` |
|
545 |
+ # Get the documentation of a specific field of a resource |
|
546 |
+ %[1]s explain pods.spec.containers`) |
|
545 | 547 |
) |
546 | 548 |
|
547 | 549 |
// NewCmdExplain is a wrapper for the Kubernetes cli explain command |
... | ... |
@@ -552,27 +593,28 @@ func NewCmdExplain(fullName string, f *clientcmd.Factory, out, errOut io.Writer) |
552 | 552 |
return cmd |
553 | 553 |
} |
554 | 554 |
|
555 |
-const ( |
|
556 |
- convertLong = `Convert config files between different API versions. Both YAML |
|
557 |
-and JSON formats are accepted. |
|
555 |
+var ( |
|
556 |
+ convertLong = templates.LongDesc(` |
|
557 |
+ Convert config files between different API versions. Both YAML |
|
558 |
+ and JSON formats are accepted. |
|
559 |
+ |
|
560 |
+ The command takes filename, directory, or URL as input, and convert it into format |
|
561 |
+ of version specified by --output-version flag. If target version is not specified or |
|
562 |
+ not supported, convert to latest version. |
|
558 | 563 |
|
559 |
-The command takes filename, directory, or URL as input, and convert it into format |
|
560 |
-of version specified by --output-version flag. If target version is not specified or |
|
561 |
-not supported, convert to latest version. |
|
564 |
+ The default output will be printed to stdout in YAML format. One can use -o option |
|
565 |
+ to change to output destination.`) |
|
562 | 566 |
|
563 |
-The default output will be printed to stdout in YAML format. One can use -o option |
|
564 |
-to change to output destination. |
|
565 |
-` |
|
566 |
- convertExample = ` # Convert 'pod.yaml' to latest version and print to stdout. |
|
567 |
- %[1]s convert -f pod.yaml |
|
567 |
+ convertExample = templates.Examples(` |
|
568 |
+ # Convert 'pod.yaml' to latest version and print to stdout. |
|
569 |
+ %[1]s convert -f pod.yaml |
|
568 | 570 |
|
569 |
- # Convert the live state of the resource specified by 'pod.yaml' to the latest version |
|
570 |
- # and print to stdout in json format. |
|
571 |
- %[1]s convert -f pod.yaml --local -o json |
|
571 |
+ # Convert the live state of the resource specified by 'pod.yaml' to the latest version |
|
572 |
+ # and print to stdout in json format. |
|
573 |
+ %[1]s convert -f pod.yaml --local -o json |
|
572 | 574 |
|
573 |
- # Convert all files under current directory to latest version and create them all. |
|
574 |
- %[1]s convert -f . | %[1]s create -f - |
|
575 |
-` |
|
575 |
+ # Convert all files under current directory to latest version and create them all. |
|
576 |
+ %[1]s convert -f . | %[1]s create -f -`) |
|
576 | 577 |
) |
577 | 578 |
|
578 | 579 |
// NewCmdConvert is a wrapper for the Kubernetes cli convert command |
... | ... |
@@ -583,39 +625,40 @@ func NewCmdConvert(fullName string, f *clientcmd.Factory, out io.Writer) *cobra. |
583 | 583 |
return cmd |
584 | 584 |
} |
585 | 585 |
|
586 |
-const ( |
|
587 |
- editLong = ` |
|
588 |
-Edit a resource from the default editor |
|
586 |
+var ( |
|
587 |
+ editLong = templates.LongDesc(` |
|
588 |
+ Edit a resource from the default editor |
|
589 | 589 |
|
590 |
-The edit command allows you to directly edit any API resource you can retrieve via the |
|
591 |
-command line tools. It will open the editor defined by your OC_EDITOR, or EDITOR environment |
|
592 |
-variables, or fall back to 'vi' for Linux or 'notepad' for Windows. You can edit multiple |
|
593 |
-objects, although changes are applied one at a time. The command accepts filenames as well |
|
594 |
-as command line arguments, although the files you point to must be previously saved versions |
|
595 |
-of resources. |
|
590 |
+ The edit command allows you to directly edit any API resource you can retrieve via the |
|
591 |
+ command line tools. It will open the editor defined by your OC_EDITOR, or EDITOR environment |
|
592 |
+ variables, or fall back to 'vi' for Linux or 'notepad' for Windows. You can edit multiple |
|
593 |
+ objects, although changes are applied one at a time. The command accepts filenames as well |
|
594 |
+ as command line arguments, although the files you point to must be previously saved versions |
|
595 |
+ of resources. |
|
596 | 596 |
|
597 |
-The files to edit will be output in the default API version, or a version specified |
|
598 |
-by --output-version. The default format is YAML - if you would like to edit in JSON |
|
599 |
-pass -o json. The flag --windows-line-endings can be used to force Windows line endings, |
|
600 |
-otherwise the default for your operating system will be used. |
|
597 |
+ The files to edit will be output in the default API version, or a version specified |
|
598 |
+ by --output-version. The default format is YAML - if you would like to edit in JSON |
|
599 |
+ pass -o json. The flag --windows-line-endings can be used to force Windows line endings, |
|
600 |
+ otherwise the default for your operating system will be used. |
|
601 | 601 |
|
602 |
-In the event an error occurs while updating, a temporary file will be created on disk |
|
603 |
-that contains your unapplied changes. The most common error when updating a resource |
|
604 |
-is another editor changing the resource on the server. When this occurs, you will have |
|
605 |
-to apply your changes to the newer version of the resource, or update your temporary |
|
606 |
-saved copy to include the latest resource version.` |
|
602 |
+ In the event an error occurs while updating, a temporary file will be created on disk |
|
603 |
+ that contains your unapplied changes. The most common error when updating a resource |
|
604 |
+ is another editor changing the resource on the server. When this occurs, you will have |
|
605 |
+ to apply your changes to the newer version of the resource, or update your temporary |
|
606 |
+ saved copy to include the latest resource version.`) |
|
607 | 607 |
|
608 |
- editExample = ` # Edit the service named 'docker-registry': |
|
609 |
- %[1]s edit svc/docker-registry |
|
608 |
+ editExample = templates.Examples(` |
|
609 |
+ # Edit the service named 'docker-registry': |
|
610 |
+ %[1]s edit svc/docker-registry |
|
610 | 611 |
|
611 |
- # Edit the DeploymentConfig named 'my-deployment': |
|
612 |
- %[1]s edit dc/my-deployment |
|
612 |
+ # Edit the DeploymentConfig named 'my-deployment': |
|
613 |
+ %[1]s edit dc/my-deployment |
|
613 | 614 |
|
614 |
- # Use an alternative editor |
|
615 |
- OC_EDITOR="nano" %[1]s edit dc/my-deployment |
|
615 |
+ # Use an alternative editor |
|
616 |
+ OC_EDITOR="nano" %[1]s edit dc/my-deployment |
|
616 | 617 |
|
617 |
- # Edit the service 'docker-registry' in JSON using the v1 API format: |
|
618 |
- %[1]s edit svc/docker-registry --output-version=v1 -o json` |
|
618 |
+ # Edit the service 'docker-registry' in JSON using the v1 API format: |
|
619 |
+ %[1]s edit svc/docker-registry --output-version=v1 -o json`) |
|
619 | 620 |
) |
620 | 621 |
|
621 | 622 |
// NewCmdEdit is a wrapper for the Kubernetes cli edit command |
... | ... |
@@ -626,21 +669,22 @@ func NewCmdEdit(fullName string, f *clientcmd.Factory, out, errout io.Writer) *c |
626 | 626 |
return cmd |
627 | 627 |
} |
628 | 628 |
|
629 |
-const ( |
|
630 |
- configLong = ` |
|
631 |
-Manage the client config files |
|
629 |
+var ( |
|
630 |
+ configLong = templates.LongDesc(` |
|
631 |
+ Manage the client config files |
|
632 | 632 |
|
633 |
-The client stores configuration in the current user's home directory (under the .kube directory as |
|
634 |
-config). When you login the first time, a new config file is created, and subsequent project changes with the |
|
635 |
-'project' command will set the current context. These subcommands allow you to manage the config directly. |
|
633 |
+ The client stores configuration in the current user's home directory (under the .kube directory as |
|
634 |
+ config). When you login the first time, a new config file is created, and subsequent project changes with the |
|
635 |
+ 'project' command will set the current context. These subcommands allow you to manage the config directly. |
|
636 | 636 |
|
637 |
-Reference: https://github.com/kubernetes/kubernetes/blob/master/docs/user-guide/kubeconfig-file.md` |
|
637 |
+ Reference: https://github.com/kubernetes/kubernetes/blob/master/docs/user-guide/kubeconfig-file.md`) |
|
638 | 638 |
|
639 |
- configExample = ` # Change the config context to use |
|
640 |
- %[1]s %[2]s use-context my-context |
|
639 |
+ configExample = templates.Examples(` |
|
640 |
+ # Change the config context to use |
|
641 |
+ %[1]s %[2]s use-context my-context |
|
641 | 642 |
|
642 |
- # Set the value of a config preference |
|
643 |
- %[1]s %[2]s set preferences.some true` |
|
643 |
+ # Set the value of a config preference |
|
644 |
+ %[1]s %[2]s set preferences.some true`) |
|
644 | 645 |
) |
645 | 646 |
|
646 | 647 |
// NewCmdConfig is a wrapper for the Kubernetes cli config command |
... | ... |
@@ -660,6 +704,9 @@ func NewCmdConfig(parentName, name string) *cobra.Command { |
660 | 660 |
cmd.Short = "Change configuration files for the client" |
661 | 661 |
cmd.Long = configLong |
662 | 662 |
cmd.Example = fmt.Sprintf(configExample, parentName, name) |
663 |
+ // normalize long descs and examples |
|
664 |
+ // TODO remove when normalization is moved upstream |
|
665 |
+ templates.NormalizeAll(cmd) |
|
663 | 666 |
adjustCmdExamples(cmd, parentName, name) |
664 | 667 |
return cmd |
665 | 668 |
} |
... | ... |
@@ -12,6 +12,7 @@ import ( |
12 | 12 |
"k8s.io/kubernetes/pkg/client/unversioned" |
13 | 13 |
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" |
14 | 14 |
|
15 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
15 | 16 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
16 | 17 |
"github.com/openshift/origin/pkg/cmd/util/term" |
17 | 18 |
"github.com/openshift/origin/pkg/serviceaccounts" |
... | ... |
@@ -22,21 +23,22 @@ const ( |
22 | 22 |
|
23 | 23 |
getServiceAccountTokenShort = `Get a token assigned to a service account.` |
24 | 24 |
|
25 |
- getServiceAccountTokenLong = ` |
|
26 |
-Get a token assigned to a service account. |
|
25 |
+ getServiceAccountTokenUsage = `%s SA-NAME` |
|
26 |
+) |
|
27 | 27 |
|
28 |
-If the service account has multiple tokens, the first token found will be returned. |
|
28 |
+var ( |
|
29 |
+ getServiceAccountTokenLong = templates.LongDesc(` |
|
30 |
+ Get a token assigned to a service account. |
|
29 | 31 |
|
30 |
-Service account API tokens are used by service accounts to authenticate to the API. |
|
31 |
-Client actions using a service account token will be executed as if the service account |
|
32 |
-itself were making the actions. |
|
33 |
-` |
|
32 |
+ If the service account has multiple tokens, the first token found will be returned. |
|
34 | 33 |
|
35 |
- getServiceAccountTokenUsage = `%s SA-NAME` |
|
34 |
+ Service account API tokens are used by service accounts to authenticate to the API. |
|
35 |
+ Client actions using a service account token will be executed as if the service account |
|
36 |
+ itself were making the actions.`) |
|
36 | 37 |
|
37 |
- getServiceAccountTokenExamples = ` # Get the service account token from service account 'default' |
|
38 |
- %[1]s 'default' |
|
39 |
-` |
|
38 |
+ getServiceAccountTokenExamples = templates.Examples(` |
|
39 |
+ # Get the service account token from service account 'default' |
|
40 |
+ %[1]s 'default'`) |
|
40 | 41 |
) |
41 | 42 |
|
42 | 43 |
type GetServiceAccountTokenOptions struct { |
... | ... |
@@ -17,6 +17,7 @@ import ( |
17 | 17 |
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" |
18 | 18 |
"k8s.io/kubernetes/pkg/watch" |
19 | 19 |
|
20 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
20 | 21 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
21 | 22 |
"github.com/openshift/origin/pkg/cmd/util/term" |
22 | 23 |
"github.com/openshift/origin/pkg/serviceaccounts" |
... | ... |
@@ -28,25 +29,26 @@ const ( |
28 | 28 |
|
29 | 29 |
newServiceAccountTokenShort = `Generate a new token for a service account.` |
30 | 30 |
|
31 |
- newServiceAccountTokenLong = ` |
|
32 |
-Generate a new token for a service account. |
|
31 |
+ newServiceAccountTokenUsage = `%s SA-NAME` |
|
32 |
+) |
|
33 | 33 |
|
34 |
-Service account API tokens are used by service accounts to authenticate to the API. |
|
35 |
-This command will generate a new token, which could be used to compartmentalize service |
|
36 |
-account actions by executing them with distinct tokens, to rotate out pre-existing token |
|
37 |
-on the service account, or for use by an external client. If a label is provided, it will |
|
38 |
-be applied to any created token so that tokens created with this command can be idenitifed. |
|
39 |
-` |
|
34 |
+var ( |
|
35 |
+ newServiceAccountTokenLong = templates.LongDesc(` |
|
36 |
+ Generate a new token for a service account. |
|
40 | 37 |
|
41 |
- newServiceAccountTokenUsage = `%s SA-NAME` |
|
38 |
+ Service account API tokens are used by service accounts to authenticate to the API. |
|
39 |
+ This command will generate a new token, which could be used to compartmentalize service |
|
40 |
+ account actions by executing them with distinct tokens, to rotate out pre-existing token |
|
41 |
+ on the service account, or for use by an external client. If a label is provided, it will |
|
42 |
+ be applied to any created token so that tokens created with this command can be idenitifed.`) |
|
42 | 43 |
|
43 |
- newServiceAccountTokenExamples = ` # Generate a new token for service account 'default' |
|
44 |
- %[1]s 'default' |
|
44 |
+ newServiceAccountTokenExamples = templates.Examples(` |
|
45 |
+ # Generate a new token for service account 'default' |
|
46 |
+ %[1]s 'default' |
|
45 | 47 |
|
46 |
- # Generate a new token for service account 'default' and apply |
|
47 |
- # labels 'foo' and 'bar' to the new token for identification |
|
48 |
- # %[1]s 'default' --labels foo=foo-value,bar=bar-value |
|
49 |
-` |
|
48 |
+ # Generate a new token for service account 'default' and apply |
|
49 |
+ # labels 'foo' and 'bar' to the new token for identification |
|
50 |
+ # %[1]s 'default' --labels foo=foo-value,bar=bar-value`) |
|
50 | 51 |
) |
51 | 52 |
|
52 | 53 |
type NewServiceAccountTokenOptions struct { |
... | ... |
@@ -5,19 +5,19 @@ import ( |
5 | 5 |
|
6 | 6 |
"github.com/spf13/cobra" |
7 | 7 |
|
8 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
8 | 9 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
9 | 10 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
10 | 11 |
) |
11 | 12 |
|
12 | 13 |
const ServiceAccountsRecommendedName = "serviceaccounts" |
13 | 14 |
|
14 |
-const ( |
|
15 |
- serviceAccountsShort = `Manage service accounts in your project.` |
|
15 |
+var serviceAccountsLong = templates.LongDesc(`Manage service accounts in your project. |
|
16 | 16 |
|
17 |
- serviceAccountsLong = ` |
|
18 |
-Manage service accounts in your project. |
|
17 |
+Service accounts allow system components to access the API.`) |
|
19 | 18 |
|
20 |
-Service accounts allow system components to access the API.` |
|
19 |
+const ( |
|
20 |
+ serviceAccountsShort = `Manage service accounts in your project.` |
|
21 | 21 |
) |
22 | 22 |
|
23 | 23 |
func NewCmdServiceAccounts(name, fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command { |
... | ... |
@@ -13,30 +13,32 @@ import ( |
13 | 13 |
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" |
14 | 14 |
kterm "k8s.io/kubernetes/pkg/util/term" |
15 | 15 |
|
16 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
16 | 17 |
"github.com/openshift/origin/pkg/cmd/util/term" |
17 | 18 |
) |
18 | 19 |
|
19 |
-const ( |
|
20 |
- // CreateBasicAuthSecretRecommendedCommandName represents name of subcommand for `oc secrets` command |
|
21 |
- CreateBasicAuthSecretRecommendedCommandName = "new-basicauth" |
|
20 |
+// CreateBasicAuthSecretRecommendedCommandName represents name of subcommand for `oc secrets` command |
|
21 |
+const CreateBasicAuthSecretRecommendedCommandName = "new-basicauth" |
|
22 | 22 |
|
23 |
- createBasicAuthSecretLong = ` |
|
24 |
-Create a new basic authentication secret |
|
23 |
+var ( |
|
24 |
+ createBasicAuthSecretLong = templates.LongDesc(` |
|
25 |
+ Create a new basic authentication secret |
|
25 | 26 |
|
26 |
-Basic authentication secrets are used to authenticate against SCM servers. |
|
27 |
+ Basic authentication secrets are used to authenticate against SCM servers. |
|
27 | 28 |
|
28 |
-When creating applications, you may have a SCM server that requires basic authentication - username, password. |
|
29 |
-In order for the nodes to clone source code on your behalf, they have to have the credentials. You can provide |
|
30 |
-this information by creating a 'basicauth' secret and attaching it to your service account.` |
|
29 |
+ When creating applications, you may have a SCM server that requires basic authentication - username, password. |
|
30 |
+ In order for the nodes to clone source code on your behalf, they have to have the credentials. You can provide |
|
31 |
+ this information by creating a 'basicauth' secret and attaching it to your service account.`) |
|
31 | 32 |
|
32 |
- createBasicAuthSecretExample = ` // If your basic authentication method requires only username and password or token, add it by using: |
|
33 |
- %[1]s SECRET --username=USERNAME --password=PASSWORD |
|
33 |
+ createBasicAuthSecretExample = templates.Examples(` |
|
34 |
+ # If your basic authentication method requires only username and password or token, add it by using: |
|
35 |
+ %[1]s SECRET --username=USERNAME --password=PASSWORD |
|
34 | 36 |
|
35 |
- // If your basic authentication method requires also CA certificate, add it by using: |
|
36 |
- %[1]s SECRET --username=USERNAME --password=PASSWORD --ca-cert=FILENAME |
|
37 |
+ # If your basic authentication method requires also CA certificate, add it by using: |
|
38 |
+ %[1]s SECRET --username=USERNAME --password=PASSWORD --ca-cert=FILENAME |
|
37 | 39 |
|
38 |
- // If you do already have a .gitconfig file needed for authentication, you can create a gitconfig secret by using: |
|
39 |
- %[2]s SECRET path/to/.gitconfig` |
|
40 |
+ # If you do already have a .gitconfig file needed for authentication, you can create a gitconfig secret by using: |
|
41 |
+ %[2]s SECRET path/to/.gitconfig`) |
|
40 | 42 |
) |
41 | 43 |
|
42 | 44 |
// CreateBasicAuthSecretOptions holds the credential needed to authenticate against SCM servers. |
... | ... |
@@ -8,6 +8,7 @@ import ( |
8 | 8 |
"io/ioutil" |
9 | 9 |
"strings" |
10 | 10 |
|
11 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
11 | 12 |
"k8s.io/kubernetes/pkg/api" |
12 | 13 |
client "k8s.io/kubernetes/pkg/client/unversioned" |
13 | 14 |
"k8s.io/kubernetes/pkg/credentialprovider" |
... | ... |
@@ -16,34 +17,35 @@ import ( |
16 | 16 |
"github.com/spf13/cobra" |
17 | 17 |
) |
18 | 18 |
|
19 |
-const ( |
|
20 |
- CreateDockerConfigSecretRecommendedName = "new-dockercfg" |
|
19 |
+const CreateDockerConfigSecretRecommendedName = "new-dockercfg" |
|
21 | 20 |
|
22 |
- createDockercfgLong = ` |
|
23 |
-Create a new dockercfg secret |
|
21 |
+var ( |
|
22 |
+ createDockercfgLong = templates.LongDesc(` |
|
23 |
+ Create a new dockercfg secret |
|
24 | 24 |
|
25 |
-Dockercfg secrets are used to authenticate against Docker registries. |
|
25 |
+ Dockercfg secrets are used to authenticate against Docker registries. |
|
26 | 26 |
|
27 |
-When using the Docker command line to push images, you can authenticate to a given registry by running |
|
28 |
- 'docker login DOCKER_REGISTRY_SERVER --username=DOCKER_USER --password=DOCKER_PASSWORD --email=DOCKER_EMAIL'. |
|
29 |
-That produces a ~/.dockercfg file that is used by subsequent 'docker push' and 'docker pull' commands to |
|
30 |
-authenticate to the registry. |
|
27 |
+ When using the Docker command line to push images, you can authenticate to a given registry by running |
|
28 |
+ 'docker login DOCKER_REGISTRY_SERVER --username=DOCKER_USER --password=DOCKER_PASSWORD --email=DOCKER_EMAIL'. |
|
29 |
+ That produces a ~/.dockercfg file that is used by subsequent 'docker push' and 'docker pull' commands to |
|
30 |
+ authenticate to the registry. |
|
31 | 31 |
|
32 |
-When creating applications, you may have a Docker registry that requires authentication. In order for the |
|
33 |
-nodes to pull images on your behalf, they have to have the credentials. You can provide this information |
|
34 |
-by creating a dockercfg secret and attaching it to your service account.` |
|
32 |
+ When creating applications, you may have a Docker registry that requires authentication. In order for the |
|
33 |
+ nodes to pull images on your behalf, they have to have the credentials. You can provide this information |
|
34 |
+ by creating a dockercfg secret and attaching it to your service account.`) |
|
35 | 35 |
|
36 |
- createDockercfgExample = ` # Create a new .dockercfg secret: |
|
37 |
- %[1]s SECRET --docker-server=DOCKER_REGISTRY_SERVER --docker-username=DOCKER_USER --docker-password=DOCKER_PASSWORD --docker-email=DOCKER_EMAIL |
|
36 |
+ createDockercfgExample = templates.Examples(` |
|
37 |
+ # Create a new .dockercfg secret: |
|
38 |
+ %[1]s SECRET --docker-server=DOCKER_REGISTRY_SERVER --docker-username=DOCKER_USER --docker-password=DOCKER_PASSWORD --docker-email=DOCKER_EMAIL |
|
38 | 39 |
|
39 |
- # Create a new .dockercfg secret from an existing file: |
|
40 |
- %[2]s SECRET path/to/.dockercfg |
|
40 |
+ # Create a new .dockercfg secret from an existing file: |
|
41 |
+ %[2]s SECRET path/to/.dockercfg |
|
41 | 42 |
|
42 |
- # Create a new .docker/config.json secret from an existing file: |
|
43 |
- %[2]s SECRET .dockerconfigjson=path/to/.docker/config.json |
|
43 |
+ # Create a new .docker/config.json secret from an existing file: |
|
44 |
+ %[2]s SECRET .dockerconfigjson=path/to/.docker/config.json |
|
44 | 45 |
|
45 |
- # To add new secret to 'imagePullSecrets' for the node, or 'secrets' for builds, use: |
|
46 |
- %[3]s SERVICE_ACCOUNT` |
|
46 |
+ # To add new secret to 'imagePullSecrets' for the node, or 'secrets' for builds, use: |
|
47 |
+ %[3]s SERVICE_ACCOUNT`) |
|
47 | 48 |
) |
48 | 49 |
|
49 | 50 |
type CreateDockerConfigOptions struct { |
... | ... |
@@ -9,27 +9,28 @@ import ( |
9 | 9 |
kapi "k8s.io/kubernetes/pkg/api" |
10 | 10 |
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" |
11 | 11 |
|
12 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
12 | 13 |
"github.com/spf13/cobra" |
13 | 14 |
) |
14 | 15 |
|
15 |
-const ( |
|
16 |
- // LinkSecretRecommendedName `oc secrets link` |
|
17 |
- LinkSecretRecommendedName = "link" |
|
16 |
+// LinkSecretRecommendedName `oc secrets link` |
|
17 |
+const LinkSecretRecommendedName = "link" |
|
18 | 18 |
|
19 |
- // TODO: move to examples |
|
20 |
- linkSecretLong = ` |
|
21 |
-Link secrets to a service account |
|
19 |
+var ( |
|
20 |
+ linkSecretLong = templates.LongDesc(` |
|
21 |
+ Link secrets to a service account |
|
22 | 22 |
|
23 |
-Linking a secret enables a service account to automatically use that secret for some forms of authentication` |
|
23 |
+ Linking a secret enables a service account to automatically use that secret for some forms of authentication.`) |
|
24 | 24 |
|
25 |
- linkSecretExample = ` # Add an image pull secret to a service account to automatically use it for pulling pod images: |
|
26 |
- %[1]s serviceaccount-name pull-secret --for=pull |
|
25 |
+ linkSecretExample = templates.Examples(` |
|
26 |
+ # Add an image pull secret to a service account to automatically use it for pulling pod images: |
|
27 |
+ %[1]s serviceaccount-name pull-secret --for=pull |
|
27 | 28 |
|
28 |
- # Add an image pull secret to a service account to automatically use it for both pulling and pushing build images: |
|
29 |
- %[1]s builder builder-image-secret --for=pull,mount |
|
29 |
+ # Add an image pull secret to a service account to automatically use it for both pulling and pushing build images: |
|
30 |
+ %[1]s builder builder-image-secret --for=pull,mount |
|
30 | 31 |
|
31 |
- # If the cluster's serviceAccountConfig is operating with limitSecretReferences: True, secrets must be added to the pod's service account whitelist in order to be available to the pod: |
|
32 |
- %[1]s pod-sa pod-secret` |
|
32 |
+ # If the cluster's serviceAccountConfig is operating with limitSecretReferences: True, secrets must be added to the pod's service account whitelist in order to be available to the pod: |
|
33 |
+ %[1]s pod-sa pod-secret`) |
|
33 | 34 |
) |
34 | 35 |
|
35 | 36 |
type LinkSecretOptions struct { |
... | ... |
@@ -14,35 +14,36 @@ import ( |
14 | 14 |
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" |
15 | 15 |
kvalidation "k8s.io/kubernetes/pkg/util/validation" |
16 | 16 |
|
17 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
17 | 18 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
18 | 19 |
"github.com/spf13/cobra" |
19 | 20 |
) |
20 | 21 |
|
21 |
-const ( |
|
22 |
- NewSecretRecommendedCommandName = "new" |
|
22 |
+const NewSecretRecommendedCommandName = "new" |
|
23 | 23 |
|
24 |
- newLong = ` |
|
25 |
-Create a new secret based on a file or directory |
|
24 |
+var ( |
|
25 |
+ newLong = templates.LongDesc(` |
|
26 |
+ Create a new secret based on a file or directory |
|
26 | 27 |
|
27 |
-Key files can be specified using their file path, in which case a default name will be given to them, or optionally |
|
28 |
-with a name and file path, in which case the given name will be used. Specifying a directory will create a secret |
|
29 |
-using with all valid keys in that directory. |
|
30 |
-` |
|
28 |
+ Key files can be specified using their file path, in which case a default name will be given to them, or optionally |
|
29 |
+ with a name and file path, in which case the given name will be used. Specifying a directory will create a secret |
|
30 |
+ using with all valid keys in that directory.`) |
|
31 | 31 |
|
32 |
- newExample = ` # Create a new secret named my-secret with a key named ssh-privatekey |
|
33 |
- %[1]s my-secret ~/.ssh/ssh-privatekey |
|
32 |
+ newExample = templates.Examples(` |
|
33 |
+ # Create a new secret named my-secret with a key named ssh-privatekey |
|
34 |
+ %[1]s my-secret ~/.ssh/ssh-privatekey |
|
34 | 35 |
|
35 |
- # Create a new secret named my-secret with keys named ssh-privatekey and ssh-publickey instead of the names of the keys on disk |
|
36 |
- %[1]s my-secret ssh-privatekey=~/.ssh/id_rsa ssh-publickey=~/.ssh/id_rsa.pub |
|
36 |
+ # Create a new secret named my-secret with keys named ssh-privatekey and ssh-publickey instead of the names of the keys on disk |
|
37 |
+ %[1]s my-secret ssh-privatekey=~/.ssh/id_rsa ssh-publickey=~/.ssh/id_rsa.pub |
|
37 | 38 |
|
38 |
- # Create a new secret named my-secret with keys for each file in the folder "bar" |
|
39 |
- %[1]s my-secret path/to/bar |
|
39 |
+ # Create a new secret named my-secret with keys for each file in the folder "bar" |
|
40 |
+ %[1]s my-secret path/to/bar |
|
40 | 41 |
|
41 |
- # Create a new .dockercfg secret named my-secret |
|
42 |
- %[1]s my-secret path/to/.dockercfg |
|
42 |
+ # Create a new .dockercfg secret named my-secret |
|
43 |
+ %[1]s my-secret path/to/.dockercfg |
|
43 | 44 |
|
44 |
- # Create a new .docker/config.json secret named my-secret |
|
45 |
- %[1]s my-secret .dockerconfigjson=path/to/.docker/config.json` |
|
45 |
+ # Create a new .docker/config.json secret named my-secret |
|
46 |
+ %[1]s my-secret .dockerconfigjson=path/to/.docker/config.json`) |
|
46 | 47 |
) |
47 | 48 |
|
48 | 49 |
type CreateSecretOptions struct { |
... | ... |
@@ -10,30 +10,33 @@ import ( |
10 | 10 |
client "k8s.io/kubernetes/pkg/client/unversioned" |
11 | 11 |
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" |
12 | 12 |
|
13 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
14 |
+ |
|
13 | 15 |
"github.com/spf13/cobra" |
14 | 16 |
) |
15 | 17 |
|
16 |
-const ( |
|
17 |
- // CreateSSHAuthSecretRecommendedCommandName represents name of subcommand for `oc secrets` command |
|
18 |
- CreateSSHAuthSecretRecommendedCommandName = "new-sshauth" |
|
18 |
+// CreateSSHAuthSecretRecommendedCommandName represents name of subcommand for `oc secrets` command |
|
19 |
+const CreateSSHAuthSecretRecommendedCommandName = "new-sshauth" |
|
19 | 20 |
|
20 |
- createSSHAuthSecretLong = ` |
|
21 |
-Create a new SSH authentication secret |
|
21 |
+var ( |
|
22 |
+ createSSHAuthSecretLong = templates.LongDesc(` |
|
23 |
+ Create a new SSH authentication secret |
|
22 | 24 |
|
23 |
-SSH authentication secrets are used to authenticate against SCM servers. |
|
25 |
+ SSH authentication secrets are used to authenticate against SCM servers. |
|
24 | 26 |
|
25 |
-When creating applications, you may have a SCM server that requires SSH authentication - private SSH key. |
|
26 |
-In order for the nodes to clone source code on your behalf, they have to have the credentials. You can |
|
27 |
-provide this information by creating a 'sshauth' secret and attaching it to your service account.` |
|
27 |
+ When creating applications, you may have a SCM server that requires SSH authentication - private SSH key. |
|
28 |
+ In order for the nodes to clone source code on your behalf, they have to have the credentials. You can |
|
29 |
+ provide this information by creating a 'sshauth' secret and attaching it to your service account.`) |
|
28 | 30 |
|
29 |
- createSSHAuthSecretExample = ` // If your SSH authentication method requires only private SSH key, add it by using: |
|
30 |
- %[1]s SECRET --ssh-privatekey=FILENAME |
|
31 |
+ createSSHAuthSecretExample = templates.Examples(` |
|
32 |
+ # If your SSH authentication method requires only private SSH key, add it by using: |
|
33 |
+ %[1]s SECRET --ssh-privatekey=FILENAME |
|
31 | 34 |
|
32 |
- // If your SSH authentication method requires also CA certificate, add it by using: |
|
33 |
- %[1]s SECRET --ssh-privatekey=FILENAME --ca-cert=FILENAME |
|
35 |
+ # If your SSH authentication method requires also CA certificate, add it by using: |
|
36 |
+ %[1]s SECRET --ssh-privatekey=FILENAME --ca-cert=FILENAME |
|
34 | 37 |
|
35 |
- // If you do already have a .gitconfig file needed for authentication, you can create a gitconfig secret by using: |
|
36 |
- %[2]s SECRET path/to/.gitconfig` |
|
38 |
+ # If you do already have a .gitconfig file needed for authentication, you can create a gitconfig secret by using: |
|
39 |
+ %[2]s SECRET path/to/.gitconfig`) |
|
37 | 40 |
) |
38 | 41 |
|
39 | 42 |
// CreateSSHAuthSecretOptions holds the credential needed to authenticate against SCM servers. |
... | ... |
@@ -6,6 +6,7 @@ import ( |
6 | 6 |
"github.com/spf13/cobra" |
7 | 7 |
|
8 | 8 |
"github.com/openshift/origin/pkg/build/builder/cmd/scmauth" |
9 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
9 | 10 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
10 | 11 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
11 | 12 |
) |
... | ... |
@@ -25,13 +26,13 @@ const ( |
25 | 25 |
SourceGitConfig = scmauth.GitConfigName |
26 | 26 |
) |
27 | 27 |
|
28 |
-const ( |
|
29 |
- secretsLong = ` |
|
30 |
-Manage secrets in your project |
|
28 |
+var ( |
|
29 |
+ secretsLong = templates.LongDesc(` |
|
30 |
+ Manage secrets in your project |
|
31 | 31 |
|
32 |
-Secrets are used to store confidential information that should not be contained inside of an image. |
|
33 |
-They are commonly used to hold things like keys for authentication to other internal systems like |
|
34 |
-Docker registries.` |
|
32 |
+ Secrets are used to store confidential information that should not be contained inside of an image. |
|
33 |
+ They are commonly used to hold things like keys for authentication to other internal systems like |
|
34 |
+ Docker registries.`) |
|
35 | 35 |
) |
36 | 36 |
|
37 | 37 |
func NewCmdSecrets(name, fullName string, f *clientcmd.Factory, reader io.Reader, out io.Writer, ocEditFullName string) *cobra.Command { |
... | ... |
@@ -8,20 +8,22 @@ import ( |
8 | 8 |
kapi "k8s.io/kubernetes/pkg/api" |
9 | 9 |
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" |
10 | 10 |
|
11 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
12 |
+ |
|
11 | 13 |
"github.com/spf13/cobra" |
12 | 14 |
) |
13 | 15 |
|
14 |
-const ( |
|
15 |
- UnlinkSecretRecommendedName = "unlink" |
|
16 |
+const UnlinkSecretRecommendedName = "unlink" |
|
16 | 17 |
|
17 |
- // TODO: move to examples |
|
18 |
- unlinkSecretLong = ` |
|
19 |
-Unlink (detach) secrets from a service account |
|
18 |
+var ( |
|
19 |
+ unlinkSecretLong = templates.LongDesc(` |
|
20 |
+ Unlink (detach) secrets from a service account |
|
20 | 21 |
|
21 |
-If a secret is no longer valid for a pod, build or image pull, you may unlink it from a service account.` |
|
22 |
+ If a secret is no longer valid for a pod, build or image pull, you may unlink it from a service account.`) |
|
22 | 23 |
|
23 |
- unlinkSecretExample = ` # Unlink a secret currently associated with a service account: |
|
24 |
-%[1]s serviceaccount-name secret-name another-secret-name ...` |
|
24 |
+ unlinkSecretExample = templates.Examples(` |
|
25 |
+ # Unlink a secret currently associated with a service account: |
|
26 |
+ %[1]s serviceaccount-name secret-name another-secret-name ...`) |
|
25 | 27 |
) |
26 | 28 |
|
27 | 29 |
type UnlinkSecretOptions struct { |
... | ... |
@@ -14,32 +14,34 @@ import ( |
14 | 14 |
|
15 | 15 |
"github.com/openshift/origin/pkg/client" |
16 | 16 |
"github.com/openshift/origin/pkg/cmd/cli/describe" |
17 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
17 | 18 |
osutil "github.com/openshift/origin/pkg/cmd/util" |
18 | 19 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
19 | 20 |
imageapi "github.com/openshift/origin/pkg/image/api" |
20 | 21 |
imagegraph "github.com/openshift/origin/pkg/image/graph/nodes" |
21 | 22 |
) |
22 | 23 |
|
23 |
-const ( |
|
24 |
- buildChainLong = ` |
|
25 |
-Output the inputs and dependencies of your builds |
|
24 |
+// BuildChainRecommendedCommandName is the recommended command name |
|
25 |
+const BuildChainRecommendedCommandName = "build-chain" |
|
26 | 26 |
|
27 |
-Supported formats for the generated graph are dot and a human-readable output. |
|
28 |
-Tag and namespace are optional and if they are not specified, 'latest' and the |
|
29 |
-default namespace will be used respectively.` |
|
27 |
+var ( |
|
28 |
+ buildChainLong = templates.LongDesc(` |
|
29 |
+ Output the inputs and dependencies of your builds |
|
30 | 30 |
|
31 |
- buildChainExample = ` # Build the dependency tree for the 'latest' tag in <image-stream> |
|
32 |
- %[1]s <image-stream> |
|
31 |
+ Supported formats for the generated graph are dot and a human-readable output. |
|
32 |
+ Tag and namespace are optional and if they are not specified, 'latest' and the |
|
33 |
+ default namespace will be used respectively.`) |
|
33 | 34 |
|
34 |
- # Build the dependency tree for 'v2' tag in dot format and visualize it via the dot utility |
|
35 |
- %[1]s <image-stream>:v2 -o dot | dot -T svg -o deps.svg |
|
35 |
+ buildChainExample = templates.Examples(` |
|
36 |
+ # Build the dependency tree for the 'latest' tag in <image-stream> |
|
37 |
+ %[1]s <image-stream> |
|
36 | 38 |
|
37 |
- # Build the dependency tree across all namespaces for the specified image stream tag found in 'test' namespace |
|
38 |
- %[1]s <image-stream> -n test --all` |
|
39 |
-) |
|
39 |
+ # Build the dependency tree for 'v2' tag in dot format and visualize it via the dot utility |
|
40 |
+ %[1]s <image-stream>:v2 -o dot | dot -T svg -o deps.svg |
|
40 | 41 |
|
41 |
-// BuildChainRecommendedCommandName is the recommended command name |
|
42 |
-const BuildChainRecommendedCommandName = "build-chain" |
|
42 |
+ # Build the dependency tree across all namespaces for the specified image stream tag found in 'test' namespace |
|
43 |
+ %[1]s <image-stream> -n test --all`) |
|
44 |
+) |
|
43 | 45 |
|
44 | 46 |
// BuildChainOptions contains all the options needed for build-chain |
45 | 47 |
type BuildChainOptions struct { |
... | ... |
@@ -5,15 +5,14 @@ import ( |
5 | 5 |
|
6 | 6 |
"github.com/spf13/cobra" |
7 | 7 |
|
8 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
8 | 9 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
9 | 10 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
10 | 11 |
) |
11 | 12 |
|
12 | 13 |
const ConfigRecommendedName = "config" |
13 | 14 |
|
14 |
-const configLong = ` |
|
15 |
-Manage cluster configuration files like master-config.yaml. |
|
16 |
-` |
|
15 |
+var configLong = templates.LongDesc(`Manage cluster configuration files like master-config.yaml.`) |
|
17 | 16 |
|
18 | 17 |
func NewCmdConfig(name, fullName string, f *clientcmd.Factory, out, errout io.Writer) *cobra.Command { |
19 | 18 |
cmd := &cobra.Command{ |
... | ... |
@@ -20,6 +20,7 @@ import ( |
20 | 20 |
|
21 | 21 |
configapi "github.com/openshift/origin/pkg/cmd/server/api" |
22 | 22 |
configapiinstall "github.com/openshift/origin/pkg/cmd/server/api/install" |
23 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
23 | 24 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
24 | 25 |
) |
25 | 26 |
|
... | ... |
@@ -39,11 +40,11 @@ type PatchOptions struct { |
39 | 39 |
Out io.Writer |
40 | 40 |
} |
41 | 41 |
|
42 |
-const ( |
|
43 |
- patch_long = `Patch the master-config.yaml or node-config.yaml` |
|
44 |
- patch_example = ` |
|
45 |
-# Set the auditConfig.enabled value to true |
|
46 |
-%[1]s openshift.local.config/master/master-config.yaml --patch='{"auditConfig": {"enabled": true}}'` |
|
42 |
+var ( |
|
43 |
+ patch_long = templates.LongDesc(`Patch the master-config.yaml or node-config.yaml`) |
|
44 |
+ patch_example = templates.Examples(` |
|
45 |
+ # Set the auditConfig.enabled value to true |
|
46 |
+ %[1]s openshift.local.config/master/master-config.yaml --patch='{"auditConfig": {"enabled": true}}'`) |
|
47 | 47 |
) |
48 | 48 |
|
49 | 49 |
func NewCmdPatch(name, fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command { |
... | ... |
@@ -15,6 +15,7 @@ import ( |
15 | 15 |
"k8s.io/kubernetes/pkg/runtime" |
16 | 16 |
|
17 | 17 |
"github.com/openshift/origin/pkg/cmd/server/bootstrappolicy" |
18 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
18 | 19 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
19 | 20 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
20 | 21 |
"github.com/openshift/origin/pkg/cmd/util/variable" |
... | ... |
@@ -23,36 +24,38 @@ import ( |
23 | 23 |
"github.com/openshift/origin/pkg/ipfailover/keepalived" |
24 | 24 |
) |
25 | 25 |
|
26 |
-const ( |
|
27 |
- ipFailover_long = `Configure or view IP Failover configuration |
|
26 |
+var ( |
|
27 |
+ ipFailover_long = templates.LongDesc(` |
|
28 |
+ Configure or view IP Failover configuration |
|
28 | 29 |
|
29 |
-This command helps to setup an IP failover configuration for the |
|
30 |
-cluster. An administrator can configure IP failover on an entire |
|
31 |
-cluster or on a subset of nodes (as defined via a labeled selector). |
|
30 |
+ This command helps to setup an IP failover configuration for the |
|
31 |
+ cluster. An administrator can configure IP failover on an entire |
|
32 |
+ cluster or on a subset of nodes (as defined via a labeled selector). |
|
32 | 33 |
|
33 |
-If an IP failover configuration does not exist with the given name, |
|
34 |
-the --create flag can be passed to create a deployment configuration that |
|
35 |
-will provide IP failover capability. If you are running in production, it is |
|
36 |
-recommended that the labeled selector for the nodes matches at least 2 nodes |
|
37 |
-to ensure you have failover protection, and that you provide a --replicas=<n> |
|
38 |
-value that matches the number of nodes for the given labeled selector.` |
|
34 |
+ If an IP failover configuration does not exist with the given name, |
|
35 |
+ the --create flag can be passed to create a deployment configuration that |
|
36 |
+ will provide IP failover capability. If you are running in production, it is |
|
37 |
+ recommended that the labeled selector for the nodes matches at least 2 nodes |
|
38 |
+ to ensure you have failover protection, and that you provide a --replicas=<n> |
|
39 |
+ value that matches the number of nodes for the given labeled selector.`) |
|
39 | 40 |
|
40 |
- ipFailover_example = ` # Check the default IP failover configuration ("ipfailover"): |
|
41 |
- %[1]s %[2]s |
|
41 |
+ ipFailover_example = templates.Examples(` |
|
42 |
+ # Check the default IP failover configuration ("ipfailover"): |
|
43 |
+ %[1]s %[2]s |
|
42 | 44 |
|
43 |
- # See what the IP failover configuration would look like if it is created: |
|
44 |
- %[1]s %[2]s -o json |
|
45 |
+ # See what the IP failover configuration would look like if it is created: |
|
46 |
+ %[1]s %[2]s -o json |
|
45 | 47 |
|
46 |
- # Create an IP failover configuration if it does not already exist: |
|
47 |
- %[1]s %[2]s ipf --virtual-ips="10.1.1.1-4" --create |
|
48 |
+ # Create an IP failover configuration if it does not already exist: |
|
49 |
+ %[1]s %[2]s ipf --virtual-ips="10.1.1.1-4" --create |
|
48 | 50 |
|
49 |
- # Create an IP failover configuration on a selection of nodes labeled |
|
50 |
- # "router=us-west-ha" (on 4 nodes with 7 virtual IPs monitoring a service |
|
51 |
- # listening on port 80, such as the router process). |
|
52 |
- %[1]s %[2]s ipfailover --selector="router=us-west-ha" --virtual-ips="1.2.3.4,10.1.1.100-104,5.6.7.8" --watch-port=80 --replicas=4 --create |
|
51 |
+ # Create an IP failover configuration on a selection of nodes labeled |
|
52 |
+ # "router=us-west-ha" (on 4 nodes with 7 virtual IPs monitoring a service |
|
53 |
+ # listening on port 80, such as the router process). |
|
54 |
+ %[1]s %[2]s ipfailover --selector="router=us-west-ha" --virtual-ips="1.2.3.4,10.1.1.100-104,5.6.7.8" --watch-port=80 --replicas=4 --create |
|
53 | 55 |
|
54 |
- # Use a different IP failover config image and see the configuration: |
|
55 |
- %[1]s %[2]s ipf-alt --selector="hagroup=us-west-ha" --virtual-ips="1.2.3.4" -o yaml --images=myrepo/myipfailover:mytag` |
|
56 |
+ # Use a different IP failover config image and see the configuration: |
|
57 |
+ %[1]s %[2]s ipf-alt --selector="hagroup=us-west-ha" --virtual-ips="1.2.3.4" -o yaml --images=myrepo/myipfailover:mytag`) |
|
56 | 58 |
) |
57 | 59 |
|
58 | 60 |
func NewCmdIPFailoverConfig(f *clientcmd.Factory, parentName, name string, out, errout io.Writer) *cobra.Command { |
... | ... |
@@ -9,20 +9,21 @@ import ( |
9 | 9 |
|
10 | 10 |
"github.com/openshift/origin/pkg/build/builder/cmd" |
11 | 11 |
ocmd "github.com/openshift/origin/pkg/cmd/cli/cmd" |
12 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
12 | 13 |
) |
13 | 14 |
|
14 |
-const ( |
|
15 |
- s2iBuilderLong = ` |
|
16 |
-Perform a Source-to-Image build |
|
15 |
+var ( |
|
16 |
+ s2iBuilderLong = templates.LongDesc(` |
|
17 |
+ Perform a Source-to-Image build |
|
17 | 18 |
|
18 |
-This command executes a Source-to-Image build using arguments passed via the environment. |
|
19 |
-It expects to be run inside of a container.` |
|
19 |
+ This command executes a Source-to-Image build using arguments passed via the environment. |
|
20 |
+ It expects to be run inside of a container.`) |
|
20 | 21 |
|
21 |
- dockerBuilderLong = ` |
|
22 |
-Perform a Docker build |
|
22 |
+ dockerBuilderLong = templates.LongDesc(` |
|
23 |
+ Perform a Docker build |
|
23 | 24 |
|
24 |
-This command executes a Docker build using arguments passed via the environment. |
|
25 |
-It expects to be run inside of a container.` |
|
25 |
+ This command executes a Docker build using arguments passed via the environment. |
|
26 |
+ It expects to be run inside of a container.`) |
|
26 | 27 |
) |
27 | 28 |
|
28 | 29 |
// NewCommandS2IBuilder provides a CLI handler for S2I build type |
... | ... |
@@ -17,6 +17,7 @@ import ( |
17 | 17 |
|
18 | 18 |
"github.com/openshift/origin/pkg/client" |
19 | 19 |
ocmd "github.com/openshift/origin/pkg/cmd/cli/cmd" |
20 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
20 | 21 |
"github.com/openshift/origin/pkg/cmd/util" |
21 | 22 |
deployapi "github.com/openshift/origin/pkg/deploy/api" |
22 | 23 |
"github.com/openshift/origin/pkg/deploy/strategy" |
... | ... |
@@ -25,29 +26,28 @@ import ( |
25 | 25 |
deployutil "github.com/openshift/origin/pkg/deploy/util" |
26 | 26 |
) |
27 | 27 |
|
28 |
-const ( |
|
29 |
- deployerLong = ` |
|
30 |
-Perform a deployment |
|
31 |
- |
|
32 |
-This command launches a deployment as described by a deployment configuration. It accepts the name |
|
33 |
-of a replication controller created by a deployment and runs that deployment to completion. You can |
|
34 |
-use the --until flag to run the deployment until you reach the specified condition. |
|
35 |
- |
|
36 |
-Available conditions: |
|
37 |
- |
|
38 |
-* "start": after old deployments are scaled to zero |
|
39 |
-* "pre": after the pre hook completes (even if no hook specified) |
|
40 |
-* "mid": after the mid hook completes (even if no hook specified) |
|
41 |
-* A percentage of the deployment, based on which strategy is in use |
|
42 |
- * "0%" Recreate after the previous deployment is scaled to zero |
|
43 |
- * "N%" Recreate after the acceptance check if this is not the first deployment |
|
44 |
- * "0%" Rolling before the rolling deployment is started, equivalent to "pre" |
|
45 |
- * "N%" Rolling the percentage of pods in the target deployment that are ready |
|
46 |
- * "100%" All after the deployment is at full scale, but before the post hook runs |
|
47 |
- |
|
48 |
-Unrecognized conditions will be ignored and the deployment will run to completion. You can run this |
|
49 |
-command multiple times when --until is specified - hooks will only be executed once. |
|
50 |
-` |
|
28 |
+var ( |
|
29 |
+ deployerLong = templates.LongDesc(` |
|
30 |
+ Perform a deployment |
|
31 |
+ |
|
32 |
+ This command launches a deployment as described by a deployment configuration. It accepts the name |
|
33 |
+ of a replication controller created by a deployment and runs that deployment to completion. You can |
|
34 |
+ use the --until flag to run the deployment until you reach the specified condition. |
|
35 |
+ |
|
36 |
+ Available conditions: |
|
37 |
+ |
|
38 |
+ * "start": after old deployments are scaled to zero |
|
39 |
+ * "pre": after the pre hook completes (even if no hook specified) |
|
40 |
+ * "mid": after the mid hook completes (even if no hook specified) |
|
41 |
+ * A percentage of the deployment, based on which strategy is in use |
|
42 |
+ * "0%" Recreate after the previous deployment is scaled to zero |
|
43 |
+ * "N%" Recreate after the acceptance check if this is not the first deployment |
|
44 |
+ * "0%" Rolling before the rolling deployment is started, equivalent to "pre" |
|
45 |
+ * "N%" Rolling the percentage of pods in the target deployment that are ready |
|
46 |
+ * "100%" All after the deployment is at full scale, but before the post hook runs |
|
47 |
+ |
|
48 |
+ Unrecognized conditions will be ignored and the deployment will run to completion. You can run this |
|
49 |
+ command multiple times when --until is specified - hooks will only be executed once.`) |
|
51 | 50 |
) |
52 | 51 |
|
53 | 52 |
type config struct { |
... | ... |
@@ -8,6 +8,7 @@ import ( |
8 | 8 |
"net/url" |
9 | 9 |
"os" |
10 | 10 |
|
11 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
11 | 12 |
"github.com/spf13/cobra" |
12 | 13 |
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" |
13 | 14 |
|
... | ... |
@@ -15,20 +16,22 @@ import ( |
15 | 15 |
"github.com/openshift/origin/pkg/gitserver/autobuild" |
16 | 16 |
) |
17 | 17 |
|
18 |
-const longCommandDesc = ` |
|
19 |
-Start a Git server |
|
18 |
+const LogLevelEnv = "LOGLEVEL" |
|
20 | 19 |
|
21 |
-This command launches a Git HTTP/HTTPS server that supports push and pull, mirroring, |
|
22 |
-and automatic creation of applications on push. |
|
20 |
+var ( |
|
21 |
+ longCommandDesc = templates.LongDesc(` |
|
22 |
+ Start a Git server |
|
23 | 23 |
|
24 |
-%[1]s |
|
25 |
-` |
|
26 |
-const LogLevelEnv = "LOGLEVEL" |
|
27 |
-const repositoryBuildConfigsDesc = ` |
|
28 |
-Retrieve build configs for a gitserver repository |
|
24 |
+ This command launches a Git HTTP/HTTPS server that supports push and pull, mirroring, |
|
25 |
+ and automatic creation of applications on push. |
|
26 |
+ |
|
27 |
+ %[1]s`) |
|
29 | 28 |
|
30 |
-This command lists build configurations in the current namespace that correspond to a given git repository. |
|
31 |
-` |
|
29 |
+ repositoryBuildConfigsDesc = templates.LongDesc(` |
|
30 |
+ Retrieve build configs for a gitserver repository |
|
31 |
+ |
|
32 |
+ This command lists build configurations in the current namespace that correspond to a given git repository.`) |
|
33 |
+) |
|
32 | 34 |
|
33 | 35 |
// CommandFor returns the appropriate command for this base name, |
34 | 36 |
// or the global OpenShift command |
... | ... |
@@ -12,22 +12,23 @@ import ( |
12 | 12 |
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" |
13 | 13 |
|
14 | 14 |
ocmd "github.com/openshift/origin/pkg/cmd/cli/cmd" |
15 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
15 | 16 |
"github.com/openshift/origin/pkg/cmd/util" |
16 | 17 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
17 | 18 |
"github.com/openshift/origin/pkg/router/controller" |
18 | 19 |
f5plugin "github.com/openshift/origin/pkg/router/f5" |
19 | 20 |
) |
20 | 21 |
|
21 |
-const ( |
|
22 |
- f5Long = ` |
|
23 |
-Start an F5 route synchronizer |
|
22 |
+var ( |
|
23 |
+ f5Long = templates.LongDesc(` |
|
24 |
+ Start an F5 route synchronizer |
|
24 | 25 |
|
25 |
-This command launches a process that will synchronize an F5 to the route configuration of your master. |
|
26 |
+ This command launches a process that will synchronize an F5 to the route configuration of your master. |
|
26 | 27 |
|
27 |
-You may restrict the set of routes exposed to a single project (with --namespace), projects your client has |
|
28 |
-access to with a set of labels (--project-labels), namespaces matching a label (--namespace-labels), or all |
|
29 |
-namespaces (no argument). You can limit the routes to those matching a --labels or --fields selector. Note |
|
30 |
-that you must have a cluster-wide administrative role to view all namespaces.` |
|
28 |
+ You may restrict the set of routes exposed to a single project (with --namespace), projects your client has |
|
29 |
+ access to with a set of labels (--project-labels), namespaces matching a label (--namespace-labels), or all |
|
30 |
+ namespaces (no argument). You can limit the routes to those matching a --labels or --fields selector. Note |
|
31 |
+ that you must have a cluster-wide administrative role to view all namespaces.`) |
|
31 | 32 |
) |
32 | 33 |
|
33 | 34 |
// F5RouterOptions represent the complete structure needed to start an F5 router |
... | ... |
@@ -15,6 +15,7 @@ import ( |
15 | 15 |
ktypes "k8s.io/kubernetes/pkg/types" |
16 | 16 |
|
17 | 17 |
ocmd "github.com/openshift/origin/pkg/cmd/cli/cmd" |
18 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
18 | 19 |
"github.com/openshift/origin/pkg/cmd/util" |
19 | 20 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
20 | 21 |
"github.com/openshift/origin/pkg/router" |
... | ... |
@@ -23,25 +24,24 @@ import ( |
23 | 23 |
"github.com/openshift/origin/pkg/util/proc" |
24 | 24 |
) |
25 | 25 |
|
26 |
-const ( |
|
27 |
- routerLong = ` |
|
28 |
-Start a router |
|
26 |
+// defaultReloadInterval is how often to do reloads in seconds. |
|
27 |
+const defaultReloadInterval = 5 |
|
29 | 28 |
|
30 |
-This command launches a router connected to your cluster master. The router listens for routes and endpoints |
|
31 |
-created by users and keeps a local router configuration up to date with those changes. |
|
29 |
+var routerLong = templates.LongDesc(` |
|
30 |
+ Start a router |
|
32 | 31 |
|
33 |
-You may customize the router by providing your own --template and --reload scripts. |
|
32 |
+ This command launches a router connected to your cluster master. The router listens for routes and endpoints |
|
33 |
+ created by users and keeps a local router configuration up to date with those changes. |
|
34 | 34 |
|
35 |
-The router must have a default certificate in pem format. You may provide it via --default-cert otherwise |
|
36 |
-one is automatically created. |
|
35 |
+ You may customize the router by providing your own --template and --reload scripts. |
|
37 | 36 |
|
38 |
-You may restrict the set of routes exposed to a single project (with --namespace), projects your client has |
|
39 |
-access to with a set of labels (--project-labels), namespaces matching a label (--namespace-labels), or all |
|
40 |
-namespaces (no argument). You can limit the routes to those matching a --labels or --fields selector. Note |
|
41 |
-that you must have a cluster-wide administrative role to view all namespaces.` |
|
42 |
- // defaultReloadInterval is how often to do reloads in seconds. |
|
43 |
- defaultReloadInterval = 5 |
|
44 |
-) |
|
37 |
+ The router must have a default certificate in pem format. You may provide it via --default-cert otherwise |
|
38 |
+ one is automatically created. |
|
39 |
+ |
|
40 |
+ You may restrict the set of routes exposed to a single project (with --namespace), projects your client has |
|
41 |
+ access to with a set of labels (--project-labels), namespaces matching a label (--namespace-labels), or all |
|
42 |
+ namespaces (no argument). You can limit the routes to those matching a --labels or --fields selector. Note |
|
43 |
+ that you must have a cluster-wide administrative role to view all namespaces.`) |
|
45 | 44 |
|
46 | 45 |
type TemplateRouterOptions struct { |
47 | 46 |
Config *clientcmd.Config |
... | ... |
@@ -31,14 +31,14 @@ import ( |
31 | 31 |
"github.com/openshift/origin/pkg/cmd/util/term" |
32 | 32 |
) |
33 | 33 |
|
34 |
-const ( |
|
35 |
- openshiftLong = ` |
|
36 |
-%[2]s |
|
34 |
+var ( |
|
35 |
+ openshiftLong = templates.LongDesc(` |
|
36 |
+ %[2]s |
|
37 | 37 |
|
38 |
-The %[3]s helps you build, deploy, and manage your applications on top of |
|
39 |
-Docker containers. To start an all-in-one server with the default configuration, run: |
|
38 |
+ The %[3]s helps you build, deploy, and manage your applications on top of |
|
39 |
+ Docker containers. To start an all-in-one server with the default configuration, run: |
|
40 | 40 |
|
41 |
- %[1]s start &` |
|
41 |
+ $ %[1]s start &`) |
|
42 | 42 |
) |
43 | 43 |
|
44 | 44 |
// CommandFor returns the appropriate command for this base name, |
... | ... |
@@ -178,26 +178,26 @@ func newExperimentalCommand(name, fullName string) *cobra.Command { |
178 | 178 |
return experimental |
179 | 179 |
} |
180 | 180 |
|
181 |
-const ( |
|
182 |
- completion_long = `Output shell completion code for the given shell (bash or zsh). |
|
181 |
+var ( |
|
182 |
+ completion_long = templates.LongDesc(` |
|
183 |
+ Output shell completion code for the given shell (bash or zsh). |
|
183 | 184 |
|
184 |
-This command prints shell code which must be evaluation to provide interactive |
|
185 |
-completion of kubectl commands. |
|
186 |
-` |
|
187 |
- completion_example = ` |
|
188 |
-$ source <(kubectl completion bash) |
|
185 |
+ This command prints shell code which must be evaluation to provide interactive |
|
186 |
+ completion of kubectl commands.`) |
|
189 | 187 |
|
190 |
-will load the kubectl completion code for bash. Note that this depends on the bash-completion |
|
191 |
-framework. It must be sourced before sourcing the kubectl completion, i.e. on the Mac: |
|
188 |
+ completion_example = templates.Examples(` |
|
189 |
+ $ source <(kubectl completion bash) |
|
192 | 190 |
|
193 |
-$ brew install bash-completion |
|
194 |
-$ source $(brew --prefix)/etc/bash_completion |
|
195 |
-$ source <(kubectl completion bash) |
|
191 |
+ will load the kubectl completion code for bash. Note that this depends on the bash-completion |
|
192 |
+ framework. It must be sourced before sourcing the kubectl completion, i.e. on the Mac: |
|
196 | 193 |
|
197 |
-If you use zsh, the following will load kubectl zsh completion: |
|
194 |
+ $ brew install bash-completion |
|
195 |
+ $ source $(brew --prefix)/etc/bash_completion |
|
196 |
+ $ source <(kubectl completion bash) |
|
198 | 197 |
|
199 |
-$ source <(kubectl completion zsh) |
|
200 |
-` |
|
198 |
+ If you use zsh, the following will load kubectl zsh completion: |
|
199 |
+ |
|
200 |
+ $ source <(kubectl completion zsh)`) |
|
201 | 201 |
) |
202 | 202 |
|
203 | 203 |
func newCompletionCommand(name, fullName string) *cobra.Command { |
... | ... |
@@ -8,13 +8,15 @@ import ( |
8 | 8 |
"github.com/spf13/cobra" |
9 | 9 |
|
10 | 10 |
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" |
11 |
+ |
|
12 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
11 | 13 |
) |
12 | 14 |
|
13 |
-const ( |
|
14 |
- recyclerLong = ` |
|
15 |
-Recycle a volume |
|
15 |
+var ( |
|
16 |
+ recyclerLong = templates.LongDesc(` |
|
17 |
+ Recycle a volume |
|
16 | 18 |
|
17 |
-This command will recycle a single volume provided as an argument.` |
|
19 |
+ This command will recycle a single volume provided as an argument.`) |
|
18 | 20 |
) |
19 | 21 |
|
20 | 22 |
// NewCommandRecycle provides a CLI handler for recycling volumes |
... | ... |
@@ -12,6 +12,8 @@ import ( |
12 | 12 |
kapi "k8s.io/kubernetes/pkg/api" |
13 | 13 |
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" |
14 | 14 |
"k8s.io/kubernetes/pkg/util/crypto" |
15 |
+ |
|
16 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
15 | 17 |
) |
16 | 18 |
|
17 | 19 |
const CreateClientCommandName = "create-api-client-config" |
... | ... |
@@ -31,13 +33,12 @@ type CreateClientOptions struct { |
31 | 31 |
Output io.Writer |
32 | 32 |
} |
33 | 33 |
|
34 |
-const createClientLong = ` |
|
35 |
-Create a client configuration for connecting to the server |
|
34 |
+var createClientLong = templates.LongDesc(` |
|
35 |
+ Create a client configuration for connecting to the server |
|
36 | 36 |
|
37 |
-This command creates a folder containing a client certificate, a client key, |
|
38 |
-a server certificate authority, and a .kubeconfig file for connecting to the |
|
39 |
-master as the provided user. |
|
40 |
-` |
|
37 |
+ This command creates a folder containing a client certificate, a client key, |
|
38 |
+ a server certificate authority, and a .kubeconfig file for connecting to the |
|
39 |
+ master as the provided user.`) |
|
41 | 40 |
|
42 | 41 |
func NewCommandCreateClient(commandName string, fullName string, out io.Writer) *cobra.Command { |
43 | 42 |
options := &CreateClientOptions{SignerCertOptions: NewDefaultSignerCertOptions(), Output: out} |
... | ... |
@@ -9,26 +9,26 @@ import ( |
9 | 9 |
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" |
10 | 10 |
|
11 | 11 |
"github.com/openshift/origin/pkg/auth/server/errorpage" |
12 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
12 | 13 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
13 | 14 |
) |
14 | 15 |
|
15 |
-const ( |
|
16 |
- CreateErrorTemplateCommand = "create-error-template" |
|
17 |
- errorLongDescription = ` |
|
18 |
-Create a template for customizing the error page |
|
16 |
+const CreateErrorTemplateCommand = "create-error-template" |
|
19 | 17 |
|
20 |
-This command creates a basic template to use as a starting point for |
|
21 |
-customizing the authentication error page. Save the output to a file and edit |
|
22 |
-the template to change the look and feel or add content. |
|
18 |
+var errorLongDescription = templates.LongDesc(` |
|
19 |
+ Create a template for customizing the error page |
|
23 | 20 |
|
24 |
-To use the template, set oauthConfig.templates.error in the master |
|
25 |
-configuration to point to the template file. For example, |
|
21 |
+ This command creates a basic template to use as a starting point for |
|
22 |
+ customizing the authentication error page. Save the output to a file and edit |
|
23 |
+ the template to change the look and feel or add content. |
|
26 | 24 |
|
27 |
- oauthConfig: |
|
28 |
- templates: |
|
29 |
- error: templates/error.html |
|
30 |
-` |
|
31 |
-) |
|
25 |
+ To use the template, set oauthConfig.templates.error in the master |
|
26 |
+ configuration to point to the template file. For example, |
|
27 |
+ |
|
28 |
+ oauthConfig: |
|
29 |
+ templates: |
|
30 |
+ error: templates/error.html |
|
31 |
+ `) |
|
32 | 32 |
|
33 | 33 |
type CreateErrorTemplateOptions struct{} |
34 | 34 |
|
... | ... |
@@ -17,6 +17,8 @@ import ( |
17 | 17 |
"github.com/spf13/cobra" |
18 | 18 |
|
19 | 19 |
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" |
20 |
+ |
|
21 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
20 | 22 |
) |
21 | 23 |
|
22 | 24 |
const CreateKeyPairCommandName = "create-key-pair" |
... | ... |
@@ -29,14 +31,14 @@ type CreateKeyPairOptions struct { |
29 | 29 |
Output io.Writer |
30 | 30 |
} |
31 | 31 |
|
32 |
-const createKeyPairLong = ` |
|
33 |
-Create an RSA key pair and generate PEM-encoded public/private key files |
|
32 |
+var createKeyPairLong = templates.LongDesc(` |
|
33 |
+ Create an RSA key pair and generate PEM-encoded public/private key files |
|
34 | 34 |
|
35 |
-Example: Creating service account signing and authenticating key files: |
|
35 |
+ Example: Creating service account signing and authenticating key files: |
|
36 | 36 |
|
37 |
- CONFIG=openshift.local.config/master |
|
38 |
- %[1]s --public-key=$CONFIG/serviceaccounts.public.key --private-key=$CONFIG/serviceaccounts.private.key |
|
39 |
-` |
|
37 |
+ CONFIG=openshift.local.config/master |
|
38 |
+ %[1]s --public-key=$CONFIG/serviceaccounts.public.key --private-key=$CONFIG/serviceaccounts.private.key |
|
39 |
+ `) |
|
40 | 40 |
|
41 | 41 |
func NewCommandCreateKeyPair(commandName string, fullName string, out io.Writer) *cobra.Command { |
42 | 42 |
options := &CreateKeyPairOptions{Output: out} |
... | ... |
@@ -17,12 +17,44 @@ import ( |
17 | 17 |
|
18 | 18 |
cliconfig "github.com/openshift/origin/pkg/cmd/cli/config" |
19 | 19 |
"github.com/openshift/origin/pkg/cmd/server/crypto" |
20 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
20 | 21 |
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd" |
21 | 22 |
clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" |
22 | 23 |
) |
23 | 24 |
|
24 | 25 |
const CreateKubeConfigCommandName = "create-kubeconfig" |
25 | 26 |
|
27 |
+var createKubeConfigLongDesc = templates.LongDesc(` |
|
28 |
+ Create's a .kubeconfig file at <--kubeconfig> that looks like this: |
|
29 |
+ |
|
30 |
+ clusters: |
|
31 |
+ - cluster: |
|
32 |
+ certificate-authority-data: <contents of --certificate-authority> |
|
33 |
+ server: <--master> |
|
34 |
+ name: <--cluster> |
|
35 |
+ - cluster: |
|
36 |
+ certificate-authority-data: <contents of --certificate-authority> |
|
37 |
+ server: <--public-master> |
|
38 |
+ name: public-<--cluster> |
|
39 |
+ contexts: |
|
40 |
+ - context: |
|
41 |
+ cluster: <--cluster> |
|
42 |
+ user: <--user> |
|
43 |
+ namespace: <--namespace> |
|
44 |
+ name: <--context> |
|
45 |
+ - context: |
|
46 |
+ cluster: public-<--cluster> |
|
47 |
+ user: <--user> |
|
48 |
+ namespace: <--namespace> |
|
49 |
+ name: public-<--context> |
|
50 |
+ current-context: <--context> |
|
51 |
+ kind: Config |
|
52 |
+ users: |
|
53 |
+ - name: <--user> |
|
54 |
+ user: |
|
55 |
+ client-certificate-data: <contents of --client-certificate> |
|
56 |
+ client-key-data: <contents of --client-key>`) |
|
57 |
+ |
|
26 | 58 |
type CreateKubeConfigOptions struct { |
27 | 59 |
APIServerURL string |
28 | 60 |
PublicAPIServerURL string |
... | ... |
@@ -43,37 +75,7 @@ func NewCommandCreateKubeConfig(commandName string, fullName string, out io.Writ |
43 | 43 |
cmd := &cobra.Command{ |
44 | 44 |
Use: commandName, |
45 | 45 |
Short: "Create a basic .kubeconfig file from client certs", |
46 |
- Long: ` |
|
47 |
-Create's a .kubeconfig file at <--kubeconfig> that looks like this: |
|
48 |
- |
|
49 |
-clusters: |
|
50 |
-- cluster: |
|
51 |
- certificate-authority-data: <contents of --certificate-authority> |
|
52 |
- server: <--master> |
|
53 |
- name: <--cluster> |
|
54 |
-- cluster: |
|
55 |
- certificate-authority-data: <contents of --certificate-authority> |
|
56 |
- server: <--public-master> |
|
57 |
- name: public-<--cluster> |
|
58 |
-contexts: |
|
59 |
-- context: |
|
60 |
- cluster: <--cluster> |
|
61 |
- user: <--user> |
|
62 |
- namespace: <--namespace> |
|
63 |
- name: <--context> |
|
64 |
-- context: |
|
65 |
- cluster: public-<--cluster> |
|
66 |
- user: <--user> |
|
67 |
- namespace: <--namespace> |
|
68 |
- name: public-<--context> |
|
69 |
-current-context: <--context> |
|
70 |
-kind: Config |
|
71 |
-users: |
|
72 |
-- name: <--user> |
|
73 |
- user: |
|
74 |
- client-certificate-data: <contents of --client-certificate> |
|
75 |
- client-key-data: <contents of --client-key> |
|
76 |
-`, |
|
46 |
+ Long: createKubeConfigLongDesc, |
|
77 | 47 |
Run: func(cmd *cobra.Command, args []string) { |
78 | 48 |
if err := options.Validate(args); err != nil { |
79 | 49 |
kcmdutil.CheckErr(kcmdutil.UsageError(cmd, err.Error())) |
... | ... |
@@ -9,27 +9,27 @@ import ( |
9 | 9 |
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" |
10 | 10 |
|
11 | 11 |
"github.com/openshift/origin/pkg/auth/server/login" |
12 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
12 | 13 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
13 | 14 |
) |
14 | 15 |
|
15 |
-const ( |
|
16 |
- CreateLoginTemplateCommand = "create-login-template" |
|
17 |
- longDescription = ` |
|
18 |
-Create a template for customizing the login page |
|
16 |
+const CreateLoginTemplateCommand = "create-login-template" |
|
19 | 17 |
|
20 |
-This command creates a basic template to use as a starting point for |
|
21 |
-customizing the login page. Save the output to a file and edit the template to |
|
22 |
-change the look and feel or add content. Be careful not to remove any parameter |
|
23 |
-values inside curly braces. |
|
18 |
+var longDescription = templates.LongDesc(` |
|
19 |
+ Create a template for customizing the login page |
|
24 | 20 |
|
25 |
-To use the template, set oauthConfig.templates.login in the master |
|
26 |
-configuration to point to the template file. For example, |
|
21 |
+ This command creates a basic template to use as a starting point for |
|
22 |
+ customizing the login page. Save the output to a file and edit the template to |
|
23 |
+ change the look and feel or add content. Be careful not to remove any parameter |
|
24 |
+ values inside curly braces. |
|
27 | 25 |
|
28 |
- oauthConfig: |
|
29 |
- templates: |
|
30 |
- login: templates/login.html |
|
31 |
-` |
|
32 |
-) |
|
26 |
+ To use the template, set oauthConfig.templates.login in the master |
|
27 |
+ configuration to point to the template file. For example, |
|
28 |
+ |
|
29 |
+ oauthConfig: |
|
30 |
+ templates: |
|
31 |
+ login: templates/login.html |
|
32 |
+ `) |
|
33 | 33 |
|
34 | 34 |
type CreateLoginTemplateOptions struct{} |
35 | 35 |
|
... | ... |
@@ -17,55 +17,56 @@ import ( |
17 | 17 |
"k8s.io/kubernetes/pkg/util/crypto" |
18 | 18 |
utilerrors "k8s.io/kubernetes/pkg/util/errors" |
19 | 19 |
|
20 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
20 | 21 |
"github.com/openshift/origin/pkg/util/parallel" |
21 | 22 |
) |
22 | 23 |
|
23 | 24 |
const CreateMasterCertsCommandName = "create-master-certs" |
24 |
-const masterCertLong = ` |
|
25 |
-Create keys and certificates for a master |
|
26 |
- |
|
27 |
-This command creates keys and certs necessary to run a secure master. |
|
28 |
-It also creates keys, certificates, and configuration necessary for most |
|
29 |
-related infrastructure components that are clients to the master. |
|
30 |
-See the related "create-node-config" command for generating per-node config. |
|
31 |
- |
|
32 |
-All files are expected or created in standard locations under the cert-dir. |
|
33 |
- |
|
34 |
- openshift.local.config/master/ |
|
35 |
- ca.{crt,key,serial.txt} |
|
36 |
- master.server.{crt,key} |
|
37 |
- openshift-router.{crt,key,kubeconfig} |
|
38 |
- admin.{crt,key,kubeconfig} |
|
39 |
- ... |
|
40 |
- |
|
41 |
-Note that the certificate authority (CA aka "signer") generated automatically |
|
42 |
-is self-signed. In production usage, administrators are more likely to |
|
43 |
-want to generate signed certificates separately rather than rely on a |
|
44 |
-generated CA. Alternatively, start with an existing signed CA and |
|
45 |
-have this command use it to generate valid certificates. |
|
46 |
- |
|
47 |
-This command would usually only be used once at installation. If you |
|
48 |
-need to regenerate the master server cert, DO NOT use --overwrite as this |
|
49 |
-would recreate ALL certs including the CA cert, invalidating any existing |
|
50 |
-infrastructure or client configuration. Instead, delete/rename the existing |
|
51 |
-server cert and run the command to fill it in: |
|
52 |
- |
|
53 |
- mv openshift.local.config/master/master.server.crt{,.old} |
|
54 |
- %[1]s --cert-dir=... \ |
|
55 |
- --master=https://internal.master.fqdn:8443 \ |
|
56 |
- --public-master=https://external.master.fqdn:8443 \ |
|
57 |
- --hostnames=external.master.fqdn,internal.master.fqdn,localhost,127.0.0.1,172.17.42.1,kubernetes.default.local |
|
58 |
- |
|
59 |
-Alternatively, use the related "ca create-server-cert" command to explicitly |
|
60 |
-create a certificate. |
|
61 |
- |
|
62 |
-Regardless of --overwrite, the master server key/cert will be updated |
|
63 |
-if --hostnames does not match the current certificate. |
|
64 |
-Regardless of --overwrite, .kubeconfig files will be updated every time this |
|
65 |
-command is run, so always specify --master (and if needed, --public-master). |
|
66 |
-This is designed to match the behavior of "start" which rewrites certs/confs |
|
67 |
-for certain configuration changes. |
|
68 |
-` |
|
25 |
+ |
|
26 |
+var masterCertLong = templates.LongDesc(` |
|
27 |
+ Create keys and certificates for a master |
|
28 |
+ |
|
29 |
+ This command creates keys and certs necessary to run a secure master. |
|
30 |
+ It also creates keys, certificates, and configuration necessary for most |
|
31 |
+ related infrastructure components that are clients to the master. |
|
32 |
+ See the related "create-node-config" command for generating per-node config. |
|
33 |
+ |
|
34 |
+ All files are expected or created in standard locations under the cert-dir. |
|
35 |
+ |
|
36 |
+ openshift.local.config/master/ |
|
37 |
+ ca.{crt,key,serial.txt} |
|
38 |
+ master.server.{crt,key} |
|
39 |
+ openshift-router.{crt,key,kubeconfig} |
|
40 |
+ admin.{crt,key,kubeconfig} |
|
41 |
+ ... |
|
42 |
+ |
|
43 |
+ Note that the certificate authority (CA aka "signer") generated automatically |
|
44 |
+ is self-signed. In production usage, administrators are more likely to |
|
45 |
+ want to generate signed certificates separately rather than rely on a |
|
46 |
+ generated CA. Alternatively, start with an existing signed CA and |
|
47 |
+ have this command use it to generate valid certificates. |
|
48 |
+ |
|
49 |
+ This command would usually only be used once at installation. If you |
|
50 |
+ need to regenerate the master server cert, DO NOT use --overwrite as this |
|
51 |
+ would recreate ALL certs including the CA cert, invalidating any existing |
|
52 |
+ infrastructure or client configuration. Instead, delete/rename the existing |
|
53 |
+ server cert and run the command to fill it in: |
|
54 |
+ |
|
55 |
+ mv openshift.local.config/master/master.server.crt{,.old} |
|
56 |
+ %[1]s --cert-dir=... \ |
|
57 |
+ --master=https://internal.master.fqdn:8443 \ |
|
58 |
+ --public-master=https://external.master.fqdn:8443 \ |
|
59 |
+ --hostnames=external.master.fqdn,internal.master.fqdn,localhost,127.0.0.1,172.17.42.1,kubernetes.default.local |
|
60 |
+ |
|
61 |
+ Alternatively, use the related "ca create-server-cert" command to explicitly |
|
62 |
+ create a certificate. |
|
63 |
+ |
|
64 |
+ Regardless of --overwrite, the master server key/cert will be updated |
|
65 |
+ if --hostnames does not match the current certificate. |
|
66 |
+ Regardless of --overwrite, .kubeconfig files will be updated every time this |
|
67 |
+ command is run, so always specify --master (and if needed, --public-master). |
|
68 |
+ This is designed to match the behavior of "start" which rewrites certs/confs |
|
69 |
+ for certain configuration changes.`) |
|
69 | 70 |
|
70 | 71 |
type CreateMasterCertsOptions struct { |
71 | 72 |
CertDir string |
... | ... |
@@ -9,27 +9,27 @@ import ( |
9 | 9 |
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" |
10 | 10 |
|
11 | 11 |
"github.com/openshift/origin/pkg/auth/server/selectprovider" |
12 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
12 | 13 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
13 | 14 |
) |
14 | 15 |
|
15 |
-const ( |
|
16 |
- CreateProviderSelectionTemplateCommand = "create-provider-selection-template" |
|
17 |
- providerSelectionLongDescription = ` |
|
18 |
-Create a template for customizing the provider selection page |
|
16 |
+const CreateProviderSelectionTemplateCommand = "create-provider-selection-template" |
|
19 | 17 |
|
20 |
-This command creates a basic template to use as a starting point for |
|
21 |
-customizing the login provider selection page. Save the output to a file and edit |
|
22 |
-the template to change the look and feel or add content. Be careful not to remove |
|
23 |
-any parameter values inside curly braces. |
|
18 |
+var providerSelectionLongDescription = templates.LongDesc(` |
|
19 |
+ Create a template for customizing the provider selection page |
|
24 | 20 |
|
25 |
-To use the template, set oauthConfig.templates.providerSelection in the master |
|
26 |
-configuration to point to the template file. For example, |
|
21 |
+ This command creates a basic template to use as a starting point for |
|
22 |
+ customizing the login provider selection page. Save the output to a file and edit |
|
23 |
+ the template to change the look and feel or add content. Be careful not to remove |
|
24 |
+ any parameter values inside curly braces. |
|
27 | 25 |
|
28 |
- oauthConfig: |
|
29 |
- templates: |
|
30 |
- providerSelection: templates/provider-selection.html |
|
31 |
-` |
|
32 |
-) |
|
26 |
+ To use the template, set oauthConfig.templates.providerSelection in the master |
|
27 |
+ configuration to point to the template file. For example, |
|
28 |
+ |
|
29 |
+ oauthConfig: |
|
30 |
+ templates: |
|
31 |
+ providerSelection: templates/provider-selection.html |
|
32 |
+ `) |
|
33 | 33 |
|
34 | 34 |
type CreateProviderSelectionTemplateOptions struct{} |
35 | 35 |
|
... | ... |
@@ -12,6 +12,7 @@ import ( |
12 | 12 |
"k8s.io/kubernetes/pkg/util/sets" |
13 | 13 |
|
14 | 14 |
"github.com/openshift/origin/pkg/cmd/server/crypto" |
15 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
15 | 16 |
) |
16 | 17 |
|
17 | 18 |
const CreateServerCertCommandName = "create-server-cert" |
... | ... |
@@ -27,22 +28,22 @@ type CreateServerCertOptions struct { |
27 | 27 |
Output io.Writer |
28 | 28 |
} |
29 | 29 |
|
30 |
-const createServerLong = ` |
|
31 |
-Create a key and server certificate |
|
30 |
+var createServerLong = templates.LongDesc(` |
|
31 |
+ Create a key and server certificate |
|
32 | 32 |
|
33 |
-Create a key and server certificate valid for the specified hostnames, |
|
34 |
-signed by the specified CA. These are useful for securing infrastructure |
|
35 |
-components such as the router, authentication server, etc. |
|
33 |
+ Create a key and server certificate valid for the specified hostnames, |
|
34 |
+ signed by the specified CA. These are useful for securing infrastructure |
|
35 |
+ components such as the router, authentication server, etc. |
|
36 | 36 |
|
37 |
-Example: Creating a secure router certificate. |
|
37 |
+ Example: Creating a secure router certificate. |
|
38 | 38 |
|
39 |
- CA=openshift.local.config/master |
|
40 |
- %[1]s --signer-cert=$CA/ca.crt \ |
|
41 |
- --signer-key=$CA/ca.key --signer-serial=$CA/ca.serial.txt \ |
|
42 |
- --hostnames='*.cloudapps.example.com' \ |
|
43 |
- --cert=cloudapps.crt --key=cloudapps.key |
|
44 |
- cat cloudapps.crt cloudapps.key $CA/ca.crt > cloudapps.router.pem |
|
45 |
-` |
|
39 |
+ CA=openshift.local.config/master |
|
40 |
+ %[1]s --signer-cert=$CA/ca.crt \ |
|
41 |
+ --signer-key=$CA/ca.key --signer-serial=$CA/ca.serial.txt \ |
|
42 |
+ --hostnames='*.cloudapps.example.com' \ |
|
43 |
+ --cert=cloudapps.crt --key=cloudapps.key |
|
44 |
+ cat cloudapps.crt cloudapps.key $CA/ca.crt > cloudapps.router.pem |
|
45 |
+ `) |
|
46 | 46 |
|
47 | 47 |
func NewCommandCreateServerCert(commandName string, fullName string, out io.Writer) *cobra.Command { |
48 | 48 |
options := &CreateServerCertOptions{SignerCertOptions: NewDefaultSignerCertOptions(), Output: out} |
... | ... |
@@ -11,6 +11,7 @@ import ( |
11 | 11 |
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" |
12 | 12 |
|
13 | 13 |
"github.com/openshift/origin/pkg/cmd/server/crypto" |
14 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
14 | 15 |
) |
15 | 16 |
|
16 | 17 |
const CreateSignerCertCommandName = "create-signer-cert" |
... | ... |
@@ -41,9 +42,8 @@ func BindCreateSignerCertOptions(options *CreateSignerCertOptions, flags *pflag. |
41 | 41 |
cobra.MarkFlagFilename(flags, prefix+"serial") |
42 | 42 |
} |
43 | 43 |
|
44 |
-const createSignerLong = ` |
|
45 |
-Create a self-signed CA key/cert for signing certificates used by server components. |
|
46 |
-` |
|
44 |
+var createSignerLong = templates.LongDesc(` |
|
45 |
+ Create a self-signed CA key/cert for signing certificates used by server components.`) |
|
47 | 46 |
|
48 | 47 |
func NewCommandCreateSignerCert(commandName string, fullName string, out io.Writer) *cobra.Command { |
49 | 48 |
options := &CreateSignerCertOptions{Overwrite: true, Output: out} |
... | ... |
@@ -14,6 +14,7 @@ import ( |
14 | 14 |
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" |
15 | 15 |
|
16 | 16 |
configapi "github.com/openshift/origin/pkg/cmd/server/api" |
17 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
17 | 18 |
pemutil "github.com/openshift/origin/pkg/cmd/util/pem" |
18 | 19 |
) |
19 | 20 |
|
... | ... |
@@ -36,12 +37,12 @@ type DecryptOptions struct { |
36 | 36 |
KeyFile string |
37 | 37 |
} |
38 | 38 |
|
39 |
-const decryptExample = ` # Decrypt an encrypted file to a cleartext file: |
|
39 |
+var decryptExample = templates.Examples(` |
|
40 |
+ # Decrypt an encrypted file to a cleartext file: |
|
40 | 41 |
%[1]s --key=secret.key --in=secret.encrypted --out=secret.decrypted |
41 | 42 |
|
42 | 43 |
# Decrypt from stdin to stdout: |
43 |
- %[1]s --key=secret.key < secret2.encrypted > secret2.decrypted |
|
44 |
-` |
|
44 |
+ %[1]s --key=secret.key < secret2.encrypted > secret2.decrypted`) |
|
45 | 45 |
|
46 | 46 |
func NewCommandDecrypt(commandName string, fullName, encryptFullName string, out io.Writer) *cobra.Command { |
47 | 47 |
options := &DecryptOptions{ |
... | ... |
@@ -18,6 +18,7 @@ import ( |
18 | 18 |
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" |
19 | 19 |
|
20 | 20 |
configapi "github.com/openshift/origin/pkg/cmd/server/api" |
21 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
21 | 22 |
pemutil "github.com/openshift/origin/pkg/cmd/util/pem" |
22 | 23 |
) |
23 | 24 |
|
... | ... |
@@ -45,12 +46,12 @@ type EncryptOptions struct { |
45 | 45 |
PromptWriter io.Writer |
46 | 46 |
} |
47 | 47 |
|
48 |
-const encryptExample = ` # Encrypt the content of secret.txt with a generated key: |
|
48 |
+var encryptExample = templates.Examples(` |
|
49 |
+ # Encrypt the content of secret.txt with a generated key: |
|
49 | 50 |
%[1]s --genkey=secret.key --in=secret.txt --out=secret.encrypted |
50 | 51 |
|
51 | 52 |
# Encrypt the content of secret2.txt with an existing key: |
52 |
- %[1]s --key=secret.key < secret2.txt > secret2.encrypted |
|
53 |
-` |
|
53 |
+ %[1]s --key=secret.key < secret2.txt > secret2.encrypted`) |
|
54 | 54 |
|
55 | 55 |
func NewCommandEncrypt(commandName string, fullName string, out io.Writer, errout io.Writer) *cobra.Command { |
56 | 56 |
options := &EncryptOptions{ |
... | ... |
@@ -24,6 +24,7 @@ import ( |
24 | 24 |
"github.com/openshift/origin/pkg/cmd/server/admin" |
25 | 25 |
configapi "github.com/openshift/origin/pkg/cmd/server/api" |
26 | 26 |
"github.com/openshift/origin/pkg/cmd/server/start/kubernetes" |
27 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
27 | 28 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
28 | 29 |
) |
29 | 30 |
|
... | ... |
@@ -39,26 +40,26 @@ type AllInOneOptions struct { |
39 | 39 |
Output io.Writer |
40 | 40 |
} |
41 | 41 |
|
42 |
-const allInOneLong = ` |
|
43 |
-Start an all-in-one server |
|
42 |
+var allInOneLong = templates.LongDesc(` |
|
43 |
+ Start an all-in-one server |
|
44 | 44 |
|
45 |
-This command helps you launch an all-in-one server, which allows you to run all of the |
|
46 |
-components of an enterprise Kubernetes system on a server with Docker. Running: |
|
45 |
+ This command helps you launch an all-in-one server, which allows you to run all of the |
|
46 |
+ components of an enterprise Kubernetes system on a server with Docker. Running: |
|
47 | 47 |
|
48 |
- %[1]s start |
|
48 |
+ %[1]s start |
|
49 | 49 |
|
50 |
-will start listening on all interfaces, launch an etcd server to store persistent |
|
51 |
-data, and launch the Kubernetes system components. The server will run in the foreground until |
|
52 |
-you terminate the process. This command delegates to "%[1]s start master" and |
|
53 |
-"%[1]s start node". |
|
50 |
+ will start listening on all interfaces, launch an etcd server to store persistent |
|
51 |
+ data, and launch the Kubernetes system components. The server will run in the foreground until |
|
52 |
+ you terminate the process. This command delegates to "%[1]s start master" and |
|
53 |
+ "%[1]s start node". |
|
54 | 54 |
|
55 |
-Note: starting OpenShift without passing the --master address will attempt to find the IP |
|
56 |
-address that will be visible inside running Docker containers. This is not always successful, |
|
57 |
-so if you have problems tell OpenShift what public address it will be via --master=<ip>. |
|
55 |
+ Note: starting OpenShift without passing the --master address will attempt to find the IP |
|
56 |
+ address that will be visible inside running Docker containers. This is not always successful, |
|
57 |
+ so if you have problems tell OpenShift what public address it will be via --master=<ip>. |
|
58 | 58 |
|
59 |
-You may also pass --etcd=<address> to connect to an external etcd server. |
|
59 |
+ You may also pass --etcd=<address> to connect to an external etcd server. |
|
60 | 60 |
|
61 |
-You may also pass --kubeconfig=<path> to connect to an external Kubernetes cluster.` |
|
61 |
+ You may also pass --kubeconfig=<path> to connect to an external Kubernetes cluster.`) |
|
62 | 62 |
|
63 | 63 |
// NewCommandStartAllInOne provides a CLI handler for 'start' command |
64 | 64 |
func NewCommandStartAllInOne(basename string, out, errout io.Writer) (*cobra.Command, *AllInOneOptions) { |
... | ... |
@@ -14,16 +14,18 @@ import ( |
14 | 14 |
|
15 | 15 |
"github.com/openshift/origin/pkg/cmd/flagtypes" |
16 | 16 |
configapi "github.com/openshift/origin/pkg/cmd/server/api" |
17 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
17 | 18 |
) |
18 | 19 |
|
19 |
-const apiLong = `Start the master API |
|
20 |
+var apiLong = templates.LongDesc(` |
|
21 |
+ Start the master API |
|
20 | 22 |
|
21 |
-This command starts the master API. Running |
|
23 |
+ This command starts the master API. Running |
|
22 | 24 |
|
23 |
- %[1]s start master %[2]s |
|
25 |
+ %[1]s start master %[2]s |
|
24 | 26 |
|
25 |
-will start the server listening for incoming API requests. The server |
|
26 |
-will run in the foreground until you terminate the process.` |
|
27 |
+ will start the server listening for incoming API requests. The server |
|
28 |
+ will run in the foreground until you terminate the process.`) |
|
27 | 29 |
|
28 | 30 |
// NewCommandStartMasterAPI starts only the APIserver |
29 | 31 |
func NewCommandStartMasterAPI(name, basename string, out, errout io.Writer) (*cobra.Command, *MasterOptions) { |
... | ... |
@@ -13,16 +13,18 @@ import ( |
13 | 13 |
|
14 | 14 |
"github.com/openshift/origin/pkg/cmd/flagtypes" |
15 | 15 |
configapi "github.com/openshift/origin/pkg/cmd/server/api" |
16 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
16 | 17 |
) |
17 | 18 |
|
18 |
-const controllersLong = `Start the master controllers |
|
19 |
+var controllersLong = templates.LongDesc(` |
|
20 |
+ Start the master controllers |
|
19 | 21 |
|
20 |
-This command starts the controllers for the master. Running |
|
22 |
+ This command starts the controllers for the master. Running |
|
21 | 23 |
|
22 |
- %[1]s start master %[2]s |
|
24 |
+ %[1]s start master %[2]s |
|
23 | 25 |
|
24 |
-will start the controllers that manage the master state, including the scheduler. The controllers |
|
25 |
-will run in the foreground until you terminate the process.` |
|
26 |
+ will start the controllers that manage the master state, including the scheduler. The controllers |
|
27 |
+ will run in the foreground until you terminate the process.`) |
|
26 | 28 |
|
27 | 29 |
// NewCommandStartMasterControllers starts only the controllers |
28 | 30 |
func NewCommandStartMasterControllers(name, basename string, out, errout io.Writer) (*cobra.Command, *MasterOptions) { |
... | ... |
@@ -18,6 +18,7 @@ import ( |
18 | 18 |
configapilatest "github.com/openshift/origin/pkg/cmd/server/api/latest" |
19 | 19 |
"github.com/openshift/origin/pkg/cmd/server/api/validation" |
20 | 20 |
"github.com/openshift/origin/pkg/cmd/server/etcd/etcdserver" |
21 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
21 | 22 |
) |
22 | 23 |
|
23 | 24 |
const RecommendedStartEtcdServerName = "etcd" |
... | ... |
@@ -27,15 +28,16 @@ type EtcdOptions struct { |
27 | 27 |
Output io.Writer |
28 | 28 |
} |
29 | 29 |
|
30 |
-const etcdLong = `Start an etcd server for testing. |
|
30 |
+var etcdLong = templates.LongDesc(` |
|
31 |
+ Start an etcd server for testing. |
|
31 | 32 |
|
32 |
-This command starts an etcd server based on the config for testing. It is not |
|
33 |
-intended for production use. Running |
|
33 |
+ This command starts an etcd server based on the config for testing. It is not |
|
34 |
+ intended for production use. Running |
|
34 | 35 |
|
35 |
- %[1]s start %[2]s |
|
36 |
+ %[1]s start %[2]s |
|
36 | 37 |
|
37 |
-will start the server listening for incoming requests. The server will run in |
|
38 |
-the foreground until you terminate the process.` |
|
38 |
+ will start the server listening for incoming requests. The server will run in |
|
39 |
+ the foreground until you terminate the process.`) |
|
39 | 40 |
|
40 | 41 |
// NewCommandStartEtcdServer starts only the etcd server |
41 | 42 |
func NewCommandStartEtcdServer(name, basename string, out, errout io.Writer) (*cobra.Command, *EtcdOptions) { |
... | ... |
@@ -38,6 +38,7 @@ import ( |
38 | 38 |
"github.com/openshift/origin/pkg/cmd/server/etcd/etcdserver" |
39 | 39 |
"github.com/openshift/origin/pkg/cmd/server/kubernetes" |
40 | 40 |
"github.com/openshift/origin/pkg/cmd/server/origin" |
41 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
41 | 42 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
42 | 43 |
"github.com/openshift/origin/pkg/cmd/util/pluginconfig" |
43 | 44 |
override "github.com/openshift/origin/pkg/quota/admission/clusterresourceoverride" |
... | ... |
@@ -60,23 +61,24 @@ func (o *MasterOptions) DefaultsFromName(basename string) { |
60 | 60 |
} |
61 | 61 |
} |
62 | 62 |
|
63 |
-const masterLong = `Start a master server |
|
63 |
+var masterLong = templates.LongDesc(` |
|
64 |
+ Start a master server |
|
64 | 65 |
|
65 |
-This command helps you launch a master server. Running |
|
66 |
+ This command helps you launch a master server. Running |
|
66 | 67 |
|
67 |
- %[1]s start master |
|
68 |
+ %[1]s start master |
|
68 | 69 |
|
69 |
-will start a master listening on all interfaces, launch an etcd server to store |
|
70 |
-persistent data, and launch the Kubernetes system components. The server will run in the |
|
71 |
-foreground until you terminate the process. |
|
70 |
+ will start a master listening on all interfaces, launch an etcd server to store |
|
71 |
+ persistent data, and launch the Kubernetes system components. The server will run in the |
|
72 |
+ foreground until you terminate the process. |
|
72 | 73 |
|
73 |
-Note: starting the master without passing the --master address will attempt to find the IP |
|
74 |
-address that will be visible inside running Docker containers. This is not always successful, |
|
75 |
-so if you have problems tell the master what public address it should use via --master=<ip>. |
|
74 |
+ Note: starting the master without passing the --master address will attempt to find the IP |
|
75 |
+ address that will be visible inside running Docker containers. This is not always successful, |
|
76 |
+ so if you have problems tell the master what public address it should use via --master=<ip>. |
|
76 | 77 |
|
77 |
-You may also pass --etcd=<address> to connect to an external etcd server. |
|
78 |
+ You may also pass --etcd=<address> to connect to an external etcd server. |
|
78 | 79 |
|
79 |
-You may also pass --kubeconfig=<path> to connect to an external Kubernetes cluster.` |
|
80 |
+ You may also pass --kubeconfig=<path> to connect to an external Kubernetes cluster.`) |
|
80 | 81 |
|
81 | 82 |
// NewCommandStartMaster provides a CLI handler for 'start master' command |
82 | 83 |
func NewCommandStartMaster(basename string, out, errout io.Writer) (*cobra.Command, *MasterOptions) { |
... | ... |
@@ -19,6 +19,7 @@ import ( |
19 | 19 |
configapi "github.com/openshift/origin/pkg/cmd/server/api" |
20 | 20 |
configapilatest "github.com/openshift/origin/pkg/cmd/server/api/latest" |
21 | 21 |
"github.com/openshift/origin/pkg/cmd/server/api/validation" |
22 |
+ "github.com/openshift/origin/pkg/cmd/templates" |
|
22 | 23 |
cmdutil "github.com/openshift/origin/pkg/cmd/util" |
23 | 24 |
"github.com/openshift/origin/pkg/cmd/util/docker" |
24 | 25 |
utilflags "github.com/openshift/origin/pkg/cmd/util/flags" |
... | ... |
@@ -33,15 +34,15 @@ type NodeOptions struct { |
33 | 33 |
Output io.Writer |
34 | 34 |
} |
35 | 35 |
|
36 |
-const nodeLong = ` |
|
37 |
-Start a node |
|
36 |
+var nodeLong = templates.LongDesc(` |
|
37 |
+ Start a node |
|
38 | 38 |
|
39 |
-This command helps you launch a node. Running |
|
39 |
+ This command helps you launch a node. Running |
|
40 | 40 |
|
41 |
- %[1]s start node --config=<node-config> |
|
41 |
+ %[1]s start node --config=<node-config> |
|
42 | 42 |
|
43 |
-will start a node with given configuration file. The node will run in the |
|
44 |
-foreground until you terminate the process.` |
|
43 |
+ will start a node with given configuration file. The node will run in the |
|
44 |
+ foreground until you terminate the process.`) |
|
45 | 45 |
|
46 | 46 |
// NewCommandStartNode provides a CLI handler for 'start node' command |
47 | 47 |
func NewCommandStartNode(basename string, out, errout io.Writer) (*cobra.Command, *NodeOptions) { |
... | ... |
@@ -73,15 +74,15 @@ func NewCommandStartNode(basename string, out, errout io.Writer) (*cobra.Command |
73 | 73 |
return cmd, options |
74 | 74 |
} |
75 | 75 |
|
76 |
-const networkLong = ` |
|
77 |
-Start node network components |
|
76 |
+var networkLong = templates.LongDesc(` |
|
77 |
+ Start node network components |
|
78 | 78 |
|
79 |
-This command helps you launch node networking. Running |
|
79 |
+ This command helps you launch node networking. Running |
|
80 | 80 |
|
81 |
- %[1]s start network --config=<node-config> |
|
81 |
+ %[1]s start network --config=<node-config> |
|
82 | 82 |
|
83 |
-will start the network proxy and SDN plugins with given configuration file. The proxy will |
|
84 |
-run in the foreground until you terminate the process.` |
|
83 |
+ will start the network proxy and SDN plugins with given configuration file. The proxy will |
|
84 |
+ run in the foreground until you terminate the process.`) |
|
85 | 85 |
|
86 | 86 |
// NewCommandStartNetwork provides a CLI handler for 'start network' command |
87 | 87 |
func NewCommandStartNetwork(basename string, out, errout io.Writer) (*cobra.Command, *NodeOptions) { |