Oc new-app: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
 
(15 intermediate revisions by the same user not shown)
Line 3: Line 3:
* [[Oc#new-app|oc]]
* [[Oc#new-app|oc]]
* [[oc new-project]]
* [[oc new-project]]
* [[oc run]]


=Overview=
=Overview=


A tool that generates an appropriate JSON configuration so OpenShift can build an image based on it. The configuration represents resources of an application, maintained inside a [[OpenShift Concepts#Projects|project]].  
new-app is a command that generates a JSON/YAML configuration. As the result of executing the command, the "app=<''app-name''>" label is set on all objects created as the result of the command.


For more details on projects and applications, see [[OpenShift_Concepts#Projects_and_Applications|Projects and Applications]].
For more details see: {{Internal|OpenShift Application Operations#Overview|Application Operations}}


The command is a shortcut to configure a project with common resources for a standard development workflow. Source code, images and templates are specified at this stage. The command looks for images on the new local Docker installation, if available, in the Docker registry and the OpenShift image stream.
=Modes=
* [[OpenShift Create an Application from a Git Repository|Create an Application from a Git Repository]]
* [[OpenShift Create an Application from a Template|Create an Application from a Template]]
* [[OpenShift Create an Application from a Docker Image|Create an Application from a Docker Image]]


If new-app finds a [[Docker Concepts#Dockerfile|Dockerfile]] in the repository, it uses the "docker" build strategy. Otherwise it uses the "source" strategy. The strategy can be explicitly set with --strategy option.
=Dry Run=


It can also be used to instantiate a stored template:
Specify


<pre>
-o yaml|json
oc new-app --template=example-template --param=USERNAME=somevalue
</pre>


When new-app is executed, OpenShift tries to do the following:
and no objects will be created, but only YAML|JSON output generated.


1. Create a [[OpenShift Concepts#Build_Configuration|build configuration]] and build the source into a new version of the application.
=Options=


2. As result of [[OpenShift Concepts#Build_Configuration|build configuration]] configuration execution, a new container image based on the [[OpenShift Concepts#Image_Stream|image stream]] compatible with the source code is created.
==-l, --labels==


3. Create a [[OpenShift Concepts#Deployment_Configuration|deployment configuration]] that deploys the new image.
To set a single label on all objects of the new application:


4. Deploy a [[OpenShift Concepts#Pod|pod]].
oc new-app -l 'key1=value1' ...


5. Configure a [[OpenShift Concepts#Service|service]].
To set multiple labels:


6. Optionally, a [[OpenShift Concepts#Route|route]] is create to expose the service externally.
oc new-app -l 'key1=value1,key2=value2,key3=value3' ...
 
{{Warn|Do not use spaces within the -l '...'}}
 
Note that using "app=..." label will overwrite the default app label value set by the new-app command. The command line value takes precedence.
 
==-p, --param==
 
Set values for template parameters:
 
oc new-app -p "VOLUME_CAPACITY=2Gi"
 
oc new-app --param "VOLUME_CAPACITY=2Gi"
 
==--name===
 
--name=something
 
The name of the generated application artifacts.

Latest revision as of 23:11, 5 February 2018

Internal

Overview

new-app is a command that generates a JSON/YAML configuration. As the result of executing the command, the "app=<app-name>" label is set on all objects created as the result of the command.

For more details see:

Application Operations

Modes

Dry Run

Specify

-o yaml|json

and no objects will be created, but only YAML|JSON output generated.

Options

-l, --labels

To set a single label on all objects of the new application:

oc new-app -l 'key1=value1' ...

To set multiple labels:

oc new-app -l 'key1=value1,key2=value2,key3=value3' ...

Do not use spaces within the -l '...'

Note that using "app=..." label will overwrite the default app label value set by the new-app command. The command line value takes precedence.

-p, --param

Set values for template parameters:

oc new-app -p "VOLUME_CAPACITY=2Gi"
oc new-app --param "VOLUME_CAPACITY=2Gi"

--name=

--name=something

The name of the generated application artifacts.