func NewCommandTop(name, fullName string, f *clientcmd.Factory, out, errOut io.Writer) *cobra.Command { // Parent command to which all subcommands are added. cmds := &cobra.Command{ Use: name, Short: "Show usage statistics of resources on the server", Long: topLong, Run: cmdutil.DefaultSubCommandRun(errOut), } cmds.AddCommand(NewCmdTopImages(f, fullName, TopImagesRecommendedName, out)) cmds.AddCommand(NewCmdTopImageStreams(f, fullName, TopImageStreamsRecommendedName, out)) cmdTopNode := kcmd.NewCmdTopNode(f.Factory, out) cmdTopNode.Long = templates.LongDesc(cmdTopNode.Long) cmdTopNode.Example = templates.Examples(cmdTopNode.Example) cmdTopPod := kcmd.NewCmdTopPod(f.Factory, out) cmdTopPod.Long = templates.LongDesc(cmdTopPod.Long) cmdTopPod.Example = templates.Examples(cmdTopPod.Example) cmds.AddCommand(cmdTopNode) cmds.AddCommand(cmdTopPod) return cmds }
// NewAppRecommendedCommandName is the recommended command name. const NewAppRecommendedCommandName = "new-app" type usage interface { UsageError(baseName string) string } var ( newAppLong = templates.LongDesc(` Create a new application by specifying source code, templates, and/or images This command will try to build up the components of an application using images, templates, or code that has a public repository. It will lookup the images on the local Docker installation (if available), a Docker registry, an integrated image stream, or stored templates. If you specify a source code URL, it will set up a build that takes your source code and converts it into an image that can run inside of a pod. Local source must be in a git repository that has a remote repository that the server can see. The images will be deployed via a deployment configuration, and a service will be connected to the first public port of the app. You may either specify components using the various existing flags or let %[2]s autodetect what kind of components you have provided. If you provide source code, a new build will be automatically triggered. You can use '%[1]s status' to check the progress.`) newAppExample = templates.Examples(` # List all local templates and image streams that can be used to create an app %[1]s %[2]s --list # Create an application based on the source code in the current git repository (with a public remote) # and a Docker image %[1]s %[2]s . --docker-image=repo/langimage
"github.com/spf13/cobra" kapi "k8s.io/kubernetes/pkg/api" kcmd "k8s.io/kubernetes/pkg/kubectl/cmd" kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/kubectl/resource" "github.com/openshift/origin/pkg/cmd/templates" cmdutil "github.com/openshift/origin/pkg/cmd/util" "github.com/openshift/origin/pkg/cmd/util/clientcmd" ) var ( exposeLong = templates.LongDesc(` Expose containers internally as services or externally via routes There is also the ability to expose a deployment configuration, replication controller, service, or pod as a new service on a specified port. If no labels are specified, the new object will re-use the labels from the object it exposes.`) exposeExample = templates.Examples(` # Create a route based on service nginx. The new route will re-use nginx's labels %[1]s expose service nginx # Create a route and specify your own label and route name %[1]s expose service nginx -l name=myroute --name=fromdowntown # Create a route and specify a hostname %[1]s expose service nginx --hostname=www.example.com # Expose a deployment configuration as a service and use the specified port %[1]s expose dc ruby-hello-world --port=8080
const ( // RsyncRecommendedName is the recommended name for the rsync command RsyncRecommendedName = "rsync" noRsyncUnixWarning = "WARNING: rsync command not found in path. Please use your package manager to install it.\n" noRsyncWindowsWarning = "WARNING: rsync command not found in path. Download cwRsync for Windows and add it to your PATH.\n" ) var ( rsyncLong = templates.LongDesc(` Copy local files to or from a pod container This command will copy local files to or from a remote container. It only copies the changed files using the rsync command from your OS. To ensure optimum performance, install rsync locally. In UNIX systems, use your package manager. In Windows, install cwRsync from https://www.itefix.net/cwrsync. If no container is specified, the first container of the pod is used for the copy.`) rsyncExample = templates.Examples(` # Synchronize a local directory with a pod directory %[1]s ./local/dir/ POD:/remote/dir # Synchronize a pod directory with a local directory %[1]s POD:/remote/dir/ ./local/dir`) ) // copyStrategy
observeLong = templates.LongDesc(` Observe changes to resources and take action on them This command assists in building scripted reactions to changes that occur in Kubernetes or OpenShift resources. This is frequently referred to as a 'controller' in Kubernetes and acts to ensure particular conditions are maintained. On startup, observe will list all of the resources of a particular type and execute the provided script on each one. Observe watches the server for changes, and will reexecute the script for each update. Observe works best for problems of the form "for every resource X, make sure Y is true". Some examples of ways observe can be used include: * Ensure every namespace has a quota or limit range object * Ensure every service is registered in DNS by making calls to a DNS API * Send an email alert whenever a node reports 'NotReady' * Watch for the 'FailedScheduling' event and write an IRC message * Dynamically provision persistent volumes when a new PVC is created * Delete pods that have reached successful completion after a period of time. The simplest pattern is maintaining an invariant on an object - for instance, "every namespace should have an annotation that indicates its owner". If the object is deleted no reaction is necessary. A variation on that pattern is creating another object: "every namespace should have a quota object based on the resources allowed for an owner". $ cat set_owner.sh #!/bin/sh if [[ "$(%[1]s get namespace "$1" --template='{{ .metadata.annotations.owner }}')" == "" ]]; then %[1]s annotate namespace "$1" owner=bob fi $ %[1]s observe namespaces -- ./set_owner.sh The set_owner.sh script is invoked with a single argument (the namespace name) for each namespace. This simple script ensures that any user without the "owner" annotation gets one set, but preserves any existing value. The next common of controller pattern is provisioning - making changes in an external system to match the state of a Kubernetes resource. These scripts need to account for deletions that may take place while the observe command is not running. You can provide the list of known objects via the --names command, which should return a newline-delimited list of names or namespace/name pairs. Your command will be invoked whenever observe checks the latest state on the server - any resources returned by --names that are not found on the server will be passed to your --delete command. For example, you may wish to ensure that every node that is added to Kubernetes is added to your cluster inventory along with its IP: $ cat add_to_inventory.sh #!/bin/sh echo "$1 $2" >> inventory sort -u inventory -o inventory $ cat remove_from_inventory.sh #!/bin/sh grep -vE "^$1 " inventory > /tmp/newinventory mv -f /tmp/newinventory inventory $ cat known_nodes.sh #!/bin/sh touch inventory cut -f 1-1 -d ' ' inventory $ %[1]s observe nodes -a '{ .status.addresses[0].address }' \ --names ./known_nodes.sh \ --delete ./remove_from_inventory.sh \ -- ./add_to_inventory.sh If you stop the observe command and then delete a node, when you launch observe again the contents of inventory will be compared to the list of nodes from the server, and any node in the inventory file that no longer exists will trigger a call to remove_from_inventory.sh with the name of the node. Important: when handling deletes, the previous state of the object may not be available and only the name/namespace of the object will be passed to your --delete command as arguments (all custom arguments are omitted). More complicated interactions build on the two examples above - your inventory script could make a call to allocate storage on your infrastructure as a service, or register node names in DNS, or set complex firewalls. The more complex your integration, the more important it is to record enough data in the remote system that you can identify when resources on either side are deleted. Experimental: This command is under active development and may change without notice.`)
"github.com/openshift/origin/pkg/cmd/util/clientcmd" configcmd "github.com/openshift/origin/pkg/config/cmd" "github.com/openshift/origin/pkg/generate/app" appcmd "github.com/openshift/origin/pkg/generate/app/cmd" "github.com/openshift/origin/pkg/generate/appjson" ) const AppJSONV1GeneratorName = "app-json/v1" var ( appJSONLong = templates.LongDesc(` Import app.json files as OpenShift objects app.json defines the pattern of a simple, stateless web application that can be horizontally scaled. This command will transform a provided app.json object into its OpenShift equivalent. During transformation fields in the app.json syntax that are not relevant when running on top of a containerized platform will be ignored and a warning printed. The command will create objects unless you pass the -o yaml or --as-template flags to generate a configuration file for later use. Experimental: This command is under active development and may change without notice.`) appJSONExample = templates.Examples(` # Import a directory containing an app.json file $ %[1]s app.json -f . # Turn an app.json file into a template $ %[1]s app.json -f ./app.json -o yaml --as-template`) ) type AppJSONOptions struct {
func (o *MasterOptions) DefaultsFromName(basename string) { if cmdutil.GetProductName(basename) == cmdutil.ProductAtomicEnterprise { o.DisabledFeatures = configapi.AtomicDisabledFeatures } } var masterLong = templates.LongDesc(` Start a master server This command helps you launch a master server. Running %[1]s start master will start a master listening on all interfaces, launch an etcd server to store persistent data, and launch the Kubernetes system components. The server will run in the foreground until you terminate the process. Note: starting the master without passing the --master address will attempt to find the IP address that will be visible inside running Docker containers. This is not always successful, so if you have problems tell the master what public address it should use via --master=<ip>. You may also pass --etcd=<address> to connect to an external etcd server. You may also pass --kubeconfig=<path> to connect to an external Kubernetes cluster.`) // NewCommandStartMaster provides a CLI handler for 'start master' command func NewCommandStartMaster(basename string, out, errout io.Writer) (*cobra.Command, *MasterOptions) { options := &MasterOptions{Output: out} options.DefaultsFromName(basename) cmd := &cobra.Command{
"github.com/openshift/origin/pkg/cmd/templates" cmdutil "github.com/openshift/origin/pkg/cmd/util" "github.com/openshift/origin/pkg/cmd/util/clientcmd" ) var ( probeLong = templates.LongDesc(` Set or remove a liveness or readiness probe from a pod or pod template Each container in a pod may define one or more probes that are used for general health checking. A liveness probe is checked periodically to ensure the container is still healthy: if the probe fails, the container is restarted. Readiness probes set or clear the ready flag for each container, which controls whether the container's ports are included in the list of endpoints for a service and whether a deployment can proceed. A readiness check should indicate when your container is ready to accept incoming traffic or begin handling work. Setting both liveness and readiness probes for each container is highly recommended. The three probe types are: 1. Open a TCP socket on the pod IP 2. Perform an HTTP GET against a URL on a container that must return 200 OK 3. Run a command in the container that must return exit code 0 Containers that take a variable amount of time to start should set generous initial-delay-seconds values, otherwise as your application evolves you may suddenly begin to fail.`) probeExample = templates.Examples(` # Clear both readiness and liveness probes off all containers %[1]s probe dc/registry --remove --readiness --liveness # Set an exec action as a liveness probe to run 'echo ok'
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" ocmd "github.com/openshift/origin/pkg/cmd/cli/cmd" "github.com/openshift/origin/pkg/cmd/templates" "github.com/openshift/origin/pkg/cmd/util" "github.com/openshift/origin/pkg/cmd/util/clientcmd" "github.com/openshift/origin/pkg/router/controller" f5plugin "github.com/openshift/origin/pkg/router/f5" ) var ( f5Long = templates.LongDesc(` Start an F5 route synchronizer This command launches a process that will synchronize an F5 to the route configuration of your master. You may restrict the set of routes exposed to a single project (with --namespace), projects your client has access to with a set of labels (--project-labels), namespaces matching a label (--namespace-labels), or all namespaces (no argument). You can limit the routes to those matching a --labels or --fields selector. Note that you must have a cluster-wide administrative role to view all namespaces.`) ) // F5RouterOptions represent the complete structure needed to start an F5 router // sync process. type F5RouterOptions struct { Config *clientcmd.Config F5Router RouterSelection }
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/util/term" "github.com/openshift/origin/pkg/cmd/cli/config" "github.com/openshift/origin/pkg/cmd/flagtypes" "github.com/openshift/origin/pkg/cmd/templates" osclientcmd "github.com/openshift/origin/pkg/cmd/util/clientcmd" ) var ( loginLong = templates.LongDesc(` Log in to your server and save login for subsequent use First-time users of the client should run this command to connect to a server, establish an authenticated session, and save connection to the configuration file. The default configuration will be saved to your home directory under ".kube/config". The information required to login -- like username and password, a session token, or the server details -- can be provided through flags. If not provided, the command will prompt for user input as needed.`) loginExample = templates.Examples(` # Log in interactively %[1]s login # Log in to the given server with the given certificate authority file %[1]s login localhost:8443 --certificate-authority=/path/to/cert.crt # Log in to the given server with the given credentials (will not prompt interactively) %[1]s login localhost:8443 --username=myuser --password=mypass`)
"github.com/openshift/origin/pkg/router/controller" templateplugin "github.com/openshift/origin/pkg/router/template" "github.com/openshift/origin/pkg/util/proc" ) // defaultReloadInterval is how often to do reloads in seconds. const defaultReloadInterval = 5 var routerLong = templates.LongDesc(` Start a router This command launches a router connected to your cluster master. The router listens for routes and endpoints created by users and keeps a local router configuration up to date with those changes. You may customize the router by providing your own --template and --reload scripts. The router must have a default certificate in pem format. You may provide it via --default-cert otherwise one is automatically created. You may restrict the set of routes exposed to a single project (with --namespace), projects your client has access to with a set of labels (--project-labels), namespaces matching a label (--namespace-labels), or all namespaces (no argument). You can limit the routes to those matching a --labels or --fields selector. Note that you must have a cluster-wide administrative role to view all namespaces.`) type TemplateRouterOptions struct { Config *clientcmd.Config TemplateRouter RouterStats RouterSelection }
NodeConfigFile string PrintIP bool ServiceNetworkCIDR string Output io.Writer } var allInOneLong = templates.LongDesc(` Start an all-in-one server This command helps you launch an all-in-one server, which allows you to run all of the components of an enterprise Kubernetes system on a server with Docker. Running: %[1]s start will start listening on all interfaces, launch an etcd server to store persistent data, and launch the Kubernetes system components. The server will run in the foreground until you terminate the process. This command delegates to "%[1]s start master" and "%[1]s start node". Note: starting OpenShift without passing the --master address will attempt to find the IP address that will be visible inside running Docker containers. This is not always successful, so if you have problems tell OpenShift what public address it will be via --master=<ip>. You may also pass --etcd=<address> to connect to an external etcd server. You may also pass --kubeconfig=<path> to connect to an external Kubernetes cluster.`) // NewCommandStartAllInOne provides a CLI handler for 'start' command func NewCommandStartAllInOne(basename string, out, errout io.Writer) (*cobra.Command, *AllInOneOptions) { options := &AllInOneOptions{Output: out, MasterOptions: &MasterOptions{Output: out}} options.MasterOptions.DefaultsFromName(basename)
"github.com/openshift/origin/pkg/cmd/util/clientcmd" deployapi "github.com/openshift/origin/pkg/deploy/api" imageapi "github.com/openshift/origin/pkg/image/api" imagegraph "github.com/openshift/origin/pkg/image/graph/nodes" ) const ( TopImagesRecommendedName = "images" maxImageIDLength = 20 ) var ( topImagesLong = templates.LongDesc(` Show usage statistics for Images This command analyzes all the Images managed by the platform and presents current usage statistics.`) topImagesExample = templates.Examples(` # Show usage statistics for Images %[1]s %[2]s`) ) // NewCmdTopImages implements the OpenShift cli top images command. func NewCmdTopImages(f *clientcmd.Factory, parentName, name string, out io.Writer) *cobra.Command { opts := &TopImagesOptions{} cmd := &cobra.Command{ Use: name, Short: "Show usage statistics for Images", Long: topImagesLong,
"github.com/spf13/cobra" "k8s.io/kubernetes/pkg/api/meta" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/runtime" authorizationapi "github.com/openshift/origin/pkg/authorization/api" "github.com/openshift/origin/pkg/client" "github.com/openshift/origin/pkg/cmd/templates" "github.com/openshift/origin/pkg/cmd/util/clientcmd" ) const PolicyBindingRecommendedName = "policybinding" var ( policyBindingLong = templates.LongDesc(`Create a policy binding that references the policy in the targeted namespace.`) policyBindingExample = templates.Examples(` # Create a policy binding in namespace "foo" that references the policy in namespace "bar" %[1]s bar -n foo`) ) type CreatePolicyBindingOptions struct { BindingNamespace string PolicyNamespace string BindingClient client.PolicyBindingsNamespacer Mapper meta.RESTMapper OutputFormat string Out io.Writer
"github.com/openshift/origin/pkg/cmd/admin/prune" "github.com/openshift/origin/pkg/cmd/admin/registry" "github.com/openshift/origin/pkg/cmd/admin/router" "github.com/openshift/origin/pkg/cmd/admin/top" "github.com/openshift/origin/pkg/cmd/cli/cmd" "github.com/openshift/origin/pkg/cmd/experimental/buildchain" exipfailover "github.com/openshift/origin/pkg/cmd/experimental/ipfailover" "github.com/openshift/origin/pkg/cmd/server/admin" "github.com/openshift/origin/pkg/cmd/templates" cmdutil "github.com/openshift/origin/pkg/cmd/util" "github.com/openshift/origin/pkg/cmd/util/clientcmd" ) var adminLong = templates.LongDesc(` Administrative Commands Commands for managing a cluster are exposed here. Many administrative actions involve interaction with the command-line client as well.`) func NewCommandAdmin(name, fullName string, in io.Reader, out io.Writer, errout io.Writer) *cobra.Command { // Main command cmds := &cobra.Command{ Use: name, Short: "Tools for managing a cluster", Long: fmt.Sprintf(adminLong), Run: kcmdutil.DefaultSubCommandRun(out), } f := clientcmd.New(cmds.PersistentFlags()) groups := templates.CommandGroups{
"k8s.io/kubernetes/pkg/credentialprovider" kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "github.com/spf13/cobra" ) const CreateDockerConfigSecretRecommendedName = "new-dockercfg" var ( createDockercfgLong = templates.LongDesc(` Create a new dockercfg secret Dockercfg secrets are used to authenticate against Docker registries. When using the Docker command line to push images, you can authenticate to a given registry by running 'docker login DOCKER_REGISTRY_SERVER --username=DOCKER_USER --password=DOCKER_PASSWORD --email=DOCKER_EMAIL'. That produces a ~/.dockercfg file that is used by subsequent 'docker push' and 'docker pull' commands to authenticate to the registry. When creating applications, you may have a Docker registry that requires authentication. In order for the nodes to pull images on your behalf, they have to have the credentials. You can provide this information by creating a dockercfg secret and attaching it to your service account.`) createDockercfgExample = templates.Examples(` # Create a new .dockercfg secret: %[1]s SECRET --docker-server=DOCKER_REGISTRY_SERVER --docker-username=DOCKER_USER --docker-password=DOCKER_PASSWORD --docker-email=DOCKER_EMAIL # Create a new .dockercfg secret from an existing file: %[2]s SECRET path/to/.dockercfg # Create a new .docker/config.json secret from an existing file:
"github.com/openshift/origin/pkg/cmd/templates" "github.com/spf13/cobra" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "github.com/openshift/origin/pkg/gitserver" "github.com/openshift/origin/pkg/gitserver/autobuild" ) const LogLevelEnv = "LOGLEVEL" var ( longCommandDesc = templates.LongDesc(` Start a Git server This command launches a Git HTTP/HTTPS server that supports push and pull, mirroring, and automatic creation of applications on push. %[1]s`) repositoryBuildConfigsDesc = templates.LongDesc(` Retrieve build configs for a gitserver repository This command lists build configurations in the current namespace that correspond to a given git repository.`) ) // CommandFor returns the appropriate command for this base name, // or the global OpenShift command func CommandFor(basename string) *cobra.Command { var cmd *cobra.Command
"k8s.io/kubernetes/pkg/api/meta" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/runtime" "github.com/openshift/origin/pkg/client" "github.com/openshift/origin/pkg/cmd/templates" "github.com/openshift/origin/pkg/cmd/util/clientcmd" imageapi "github.com/openshift/origin/pkg/image/api" ) const ImageStreamRecommendedName = "imagestream" var ( imageStreamLong = templates.LongDesc(` Create a new image stream Image streams allow you to track, tag, and import images from other registries. They also define an access controlled destination that you can push images to.`) imageStreamExample = templates.Examples(` # Create a new image stream %[1]s mysql`) ) type CreateImageStreamOptions struct { IS *imageapi.ImageStream Client client.ImageStreamsNamespacer DryRun bool Mapper meta.RESTMapper
cmdutil "github.com/openshift/origin/pkg/cmd/util" "github.com/openshift/origin/pkg/cmd/util/clientcmd" "github.com/openshift/origin/pkg/cmd/util/variable" configcmd "github.com/openshift/origin/pkg/config/cmd" "github.com/openshift/origin/pkg/ipfailover" "github.com/openshift/origin/pkg/ipfailover/keepalived" ) var ( ipFailover_long = templates.LongDesc(` Configure or view IP Failover configuration This command helps to setup an IP failover configuration for the cluster. An administrator can configure IP failover on an entire cluster or on a subset of nodes (as defined via a labeled selector). If an IP failover configuration does not exist with the given name, the --create flag can be passed to create a deployment configuration that will provide IP failover capability. If you are running in production, it is recommended that the labeled selector for the nodes matches at least 2 nodes to ensure you have failover protection, and that you provide a --replicas=<n> value that matches the number of nodes for the given labeled selector.`) ipFailover_example = templates.Examples(` # Check the default IP failover configuration ("ipfailover"): %[1]s %[2]s # See what the IP failover configuration would look like if it is created: %[1]s %[2]s -o json # Create an IP failover configuration if it does not already exist:
cmdutil "github.com/openshift/origin/pkg/cmd/util" "github.com/openshift/origin/pkg/cmd/util/clientcmd" deployapi "github.com/openshift/origin/pkg/deploy/api" "github.com/openshift/origin/pkg/generate/app" imageapi "github.com/openshift/origin/pkg/image/api" "k8s.io/kubernetes/pkg/util/sets" ) var ( triggersLong = templates.LongDesc(` Set or remove triggers for build configs and deployment configs All build configs and deployment configs may have a set of triggers that result in a new deployment or build being created. This command enables you to alter those triggers - making them automatic or manual, adding new entries, or changing existing entries. Deployments support triggering off of image changes and on config changes. Config changes are any alterations to the pod template, while image changes will result in the container image value being updated whenever an image stream tag is updated. Build configs support triggering off of image changes, config changes, and webhooks (both GitHub-specific and generic). The config change trigger for a build config will only trigger the first build.`) triggersExample = templates.Examples(` # Print the triggers on the registry %[1]s triggers dc/registry # Set all triggers to manual %[1]s triggers dc/registry --manual # Enable all automatic triggers
"io" "strings" kapi "k8s.io/kubernetes/pkg/api" kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "github.com/openshift/origin/pkg/cmd/templates" "github.com/spf13/cobra" ) // LinkSecretRecommendedName `oc secrets link` const LinkSecretRecommendedName = "link" var ( linkSecretLong = templates.LongDesc(` Link secrets to a service account Linking a secret enables a service account to automatically use that secret for some forms of authentication.`) linkSecretExample = templates.Examples(` # Add an image pull secret to a service account to automatically use it for pulling pod images: %[1]s serviceaccount-name pull-secret --for=pull # Add an image pull secret to a service account to automatically use it for both pulling and pushing build images: %[1]s builder builder-image-secret --for=pull,mount # 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: %[1]s pod-sa pod-secret`) ) type LinkSecretOptions struct { SecretOptions
var ( internalMigrateImagesLong = templates.LongDesc(` Migrate references to Docker images This command updates embedded Docker image references on the server in place. By default it will update image streams and images, and may be used to update resources with a pod template (deployments, replication controllers, daemon sets). References are changed by providing a mapping between a source registry and name and the desired registry and name. Either name or registry can be set to '*' to change all values. The registry value "docker.io" is special and will handle any image reference that refers to the DockerHub. You may pass multiple mappings - the first matching mapping will be applied per resource. The following resource types may be migrated by this command: * buildconfigs * daemonsets * deploymentconfigs * images * imagestreams * jobs * pods * replicationcontrollers * secrets (docker) Only images, imagestreams, and secrets are updated by default. Updating images and image streams requires administrative privileges.`) internalMigrateImagesExample = templates.Examples(`
"github.com/openshift/origin/pkg/cmd/templates" cmdutil "github.com/openshift/origin/pkg/cmd/util" "github.com/openshift/origin/pkg/cmd/util/clientcmd" "github.com/openshift/origin/pkg/generate/git" oerrors "github.com/openshift/origin/pkg/util/errors" "github.com/openshift/source-to-image/pkg/tar" ) var ( startBuildLong = templates.LongDesc(` Start a build This command starts a new build for the provided build config or copies an existing build using --from-build=<name>. Pass the --follow flag to see output from the build. In addition, you can pass a file, directory, or source code repository with the --from-file, --from-dir, or --from-repo flags directly to the build. The contents will be streamed to the build and override the current build source settings. When using --from-repo, the --commit flag can be used to control which branch, tag, or commit is sent to the server. If you pass --from-file, the file is placed in the root of an empty directory with the same filename. Note that builds triggered from binary input will not preserve the source on the server, so rebuilds triggered by base image changes will use the source specified on the build config.`) startBuildExample = templates.Examples(` # Starts build from build config "hello-world" %[1]s start-build hello-world # Starts build from a previous build "hello-world-1" %[1]s start-build --from-build=hello-world-1 # Use the contents of a directory as build input
kapi "k8s.io/kubernetes/pkg/api" kcoreclient "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/unversioned" kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" kvalidation "k8s.io/kubernetes/pkg/util/validation" "github.com/openshift/origin/pkg/cmd/templates" "github.com/openshift/origin/pkg/cmd/util/clientcmd" "github.com/spf13/cobra" ) const NewSecretRecommendedCommandName = "new" var ( newLong = templates.LongDesc(` Create a new secret based on a file or directory Key files can be specified using their file path, in which case a default name will be given to them, or optionally with a name and file path, in which case the given name will be used. Specifying a directory will create a secret using with all valid keys in that directory.`) newExample = templates.Examples(` # Create a new secret named my-secret with a key named ssh-privatekey %[1]s my-secret ~/.ssh/ssh-privatekey # Create a new secret named my-secret with keys named ssh-privatekey and ssh-publickey instead of the names of the keys on disk %[1]s my-secret ssh-privatekey=~/.ssh/id_rsa ssh-publickey=~/.ssh/id_rsa.pub # Create a new secret named my-secret with keys for each file in the folder "bar" %[1]s my-secret path/to/bar # Create a new .dockercfg secret named my-secret %[1]s my-secret path/to/.dockercfg
kapi "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/meta" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/runtime" "github.com/openshift/origin/pkg/client" "github.com/openshift/origin/pkg/cmd/templates" "github.com/openshift/origin/pkg/cmd/util/clientcmd" deployapi "github.com/openshift/origin/pkg/deploy/api" ) var DeploymentConfigRecommendedName = "deploymentconfig" var ( deploymentConfigLong = templates.LongDesc(` Create a deployment config that uses a given image. Deployment configs define the template for a pod and manages deploying new images or configuration changes.`) deploymentConfigExample = templates.Examples(` # Create an nginx deployment config named my-nginx %[1]s my-nginx --image=nginx`) ) type CreateDeploymentConfigOptions struct { DC *deployapi.DeploymentConfig Client client.DeploymentConfigsNamespacer DryRun bool Mapper meta.RESTMapper OutputFormat string
var masterCertLong = templates.LongDesc(` Create keys and certificates for a master This command creates keys and certs necessary to run a secure master. It also creates keys, certificates, and configuration necessary for most related infrastructure components that are clients to the master. See the related "create-node-config" command for generating per-node config. All files are expected or created in standard locations under the cert-dir. openshift.local.config/master/ ca.{crt,key,serial.txt} master.server.{crt,key} openshift-router.{crt,key,kubeconfig} admin.{crt,key,kubeconfig} ... Note that the certificate authority (CA aka "signer") generated automatically is self-signed. In production usage, administrators are more likely to want to generate signed certificates separately rather than rely on a generated CA. Alternatively, start with an existing signed CA and have this command use it to generate valid certificates. This command would usually only be used once at installation. If you need to regenerate the master server cert, DO NOT use --overwrite as this would recreate ALL certs including the CA cert, invalidating any existing infrastructure or client configuration. Instead, delete/rename the existing server cert and run the command to fill it in: mv openshift.local.config/master/master.server.crt{,.old} %[1]s --cert-dir=... \ --master=https://internal.master.fqdn:8443 \ --public-master=https://external.master.fqdn:8443 \ --hostnames=external.master.fqdn,internal.master.fqdn,localhost,127.0.0.1,172.17.42.1,kubernetes.default.local Alternatively, use the related "ca create-server-cert" command to explicitly create a certificate. Regardless of --overwrite, the master server key/cert will be updated if --hostnames does not match the current certificate. Regardless of --overwrite, .kubeconfig files will be updated every time this command is run, so always specify --master (and if needed, --public-master). This is designed to match the behavior of "start" which rewrites certs/confs for certain configuration changes.`)
"github.com/spf13/cobra" "k8s.io/kubernetes/pkg/api/errors" kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "github.com/openshift/origin/pkg/build/api" buildutil "github.com/openshift/origin/pkg/build/util" "github.com/openshift/origin/pkg/cmd/templates" "github.com/openshift/origin/pkg/cmd/util/clientcmd" ) var ( buildLogsLong = templates.LongDesc(` Retrieve logs for a build This command displays the log for the provided build. If the pod that ran the build has been deleted logs will no longer be available. If the build has not yet completed, the build logs will be streamed until the build completes or fails.`) buildLogsExample = templates.Examples(` # Stream logs from container %[1]s build-logs 566bed879d2d`) ) // NewCmdBuildLogs implements the OpenShift cli build-logs command func NewCmdBuildLogs(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command { opts := api.BuildLogOptions{} cmd := &cobra.Command{ Use: "build-logs BUILD", Short: "Show logs from a build", Long: buildLogsLong,
kapi "k8s.io/kubernetes/pkg/api" kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/kubectl/resource" "github.com/openshift/origin/pkg/cmd/templates" cmdutil "github.com/openshift/origin/pkg/cmd/util" "github.com/openshift/origin/pkg/cmd/util/clientcmd" "github.com/openshift/origin/pkg/route/api" fileutil "github.com/openshift/origin/pkg/util/file" ) var ( routeLong = templates.LongDesc(` Expose containers externally via secured routes Three types of secured routes are supported: edge, passthrough, and reencrypt. If you wish to create unsecured routes, see "%[1]s expose -h"`) ) // NewCmdCreateRoute is a macro command to create a secured route. func NewCmdCreateRoute(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command { cmd := &cobra.Command{ Use: "route", Short: "Expose containers externally via secured routes", Long: fmt.Sprintf(routeLong, fullName), Run: cmdutil.DefaultSubCommandRun(out), } cmd.AddCommand(NewCmdCreateEdgeRoute(fullName, f, out)) cmd.AddCommand(NewCmdCreatePassthroughRoute(fullName, f, out))
package sa import ( "io" "github.com/spf13/cobra" "github.com/openshift/origin/pkg/cmd/templates" cmdutil "github.com/openshift/origin/pkg/cmd/util" "github.com/openshift/origin/pkg/cmd/util/clientcmd" ) const ServiceAccountsRecommendedName = "serviceaccounts" var serviceAccountsLong = templates.LongDesc(`Manage service accounts in your project. Service accounts allow system components to access the API.`) const ( serviceAccountsShort = `Manage service accounts in your project.` ) func NewCmdServiceAccounts(name, fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command { cmds := &cobra.Command{ Use: name, Short: serviceAccountsShort, Long: serviceAccountsLong, Aliases: []string{"sa"}, Run: cmdutil.DefaultSubCommandRun(out), }
"github.com/openshift/origin/pkg/cmd/templates" cmdutil "github.com/openshift/origin/pkg/cmd/util" "github.com/openshift/origin/pkg/cmd/util/clientcmd" deployapi "github.com/openshift/origin/pkg/deploy/api" deployclient "github.com/openshift/origin/pkg/deploy/client/clientset_generated/internalclientset/typed/core/unversioned" unidlingapi "github.com/openshift/origin/pkg/unidling/api" utilunidling "github.com/openshift/origin/pkg/unidling/util" utilerrors "github.com/openshift/origin/pkg/util/errors" ) var ( idleLong = templates.LongDesc(` Idle scalable resources Idling discovers the scalable resources (such as deployment configs and replication controllers) associated with a series of services by examining the endpoints of the service. Each service is then marked as idled, the associated resources are recorded, and the resources are scaled down to zero replicas. Upon receiving network traffic, the services (and any associated routes) will "wake up" the associated resources by scaling them back up to their previous scale.`) idleExample = templates.Examples(` # Idle the scalable controllers associated with the services listed in to-idle.txt $ %[1]s idle --resource-names-file to-idle.txt`) ) // NewCmdIdle implements the OpenShift cli idle command func NewCmdIdle(fullName string, f *clientcmd.Factory, out, errOut io.Writer) *cobra.Command { o := &IdleOptions{ out: out, errOut: errOut,