OC(1)

πŸ“¦
version 4.22.0 Β· 2 versions
, in nixpkgs unstable

πŸŽ€ NAME πŸŽ€

hii bestie πŸ’– welcome to oc(1) β€” specifically the page for oc new-app, dated June 2016 in the header. The name-line tea is:

  • oc new-app β€” Create a new application

✨ SYNOPSIS ✨

oc new-app [OPTIONS]

πŸ’… DESCRIPTION πŸ’…

Create a new application by specifying source code, templates, and/or images. Periodt.

This command will try to build up the components of an application using images, templates, or code that has a public repository. It will look up the images on the local container storage (if available), a container image registry, an integrated image stream, or stored templates. It’s giving β€œlet me check every drawer real quick” energy πŸ”πŸ’…

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 or 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 oc new-app autodetect what kind of components you have provided. Autodetect is lowkey the main character here πŸ‘‘

If you provide source code, a new build will be automatically triggered. You can use 'oc status' to check the progress. fr fr, go check on it 🌸

πŸ‘‘ OPTIONS πŸ‘‘

  • --allow-missing-images=false β€” if this is true, it means referenced container images that cannot be found locally or in a registry should still be used. 🫢
  • --allow-missing-imagestream-tags=false β€” if this is true, it means image stream tags that don't exist should still be used. ✨
  • --allow-missing-template-keys=false β€” if this is true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.
  • --as-deployment-config=false β€” if this is true, create this application as a deployment config, which allows for hooks and custom strategies. πŸŽ€
  • --as-test=false β€” if this is true, create this application as a test deployment, which validates that the deployment succeeds and then scales down.
  • --binary=false β€” instead of expecting a source URL, set the build to expect binary contents. This will disable triggers. πŸ’€
  • --build-env=[] β€” specify a key-value pair for an environment variable to set into each build image.
  • --build-env-file=[] β€” file containing key-value pairs of environment variables to set into each build image.
  • --code=[] β€” source code to use to build this application. 🧚
  • --context-dir="" β€” context directory to be used for the build.
  • --dry-run=false β€” if this is true, show the result of the operation without performing it. πŸ™ˆ
  • -e, --env=[] β€” specify a key-value pair for an environment variable to set into each container.
  • --env-file=[] β€” file containing key-value pairs of environment variables to set into each container.
  • -f, --file=[] β€” path to a template file to use for the app.
  • --grant-install-rights=false β€” if this is true, a component that requires access to your account may use your token to install software into your project. Only grant images you trust the right to run with your token. πŸ«ΆπŸ”
  • --group=[] β€” indicate components that should be grouped together as <comp1>+<comp2>.
  • --ignore-unknown-parameters=false β€” if this is true, it will not stop processing if a provided parameter does not exist in the template.
  • --image=[] β€” name of a container image to include in the app. Note: not specifying a registry or repository means defaults in place for client image pulls are employed. πŸ¦‹
  • -i, --image-stream=[] β€” name of an existing image stream to use to deploy an app.
  • --import-mode="" β€” imports the full manifest list of a tag when set to 'PreserveOriginal'. Defaults to 'Legacy'.
  • --insecure-registry=false β€” if this is true, it means the referenced container images are on insecure registries and should bypass certificate checking.
  • -l, --labels="" β€” label to set in all resources for this application.
  • -L, --list=false β€” list all local templates and image streams that can be used to create. πŸ’…
  • --name="" β€” set name to use for generated application artifacts.
  • --no-install=false β€” do not attempt to run images that describe themselves as being installable.
  • -o, --output="" β€” output format. One of: json, yaml, kyaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file.
  • --output-version="" β€” the preferred API versions of the output objects.
  • -p, --param=[] β€” specify a key-value pair (e.g., -p FOO=BAR) to set/override a parameter value in the template. πŸ“
  • --param-file=[] β€” file containing parameter values to set/override in the template.
  • -S, --search=false β€” search all templates, image streams, and container images that match the arguments provided. Note: the container images search is run on the OpenShift cluster via the ImageStreamImport API.
  • -a, --show-all=false β€” when printing, show all resources (default hide terminated pods.)
  • --show-labels=false β€” when printing, show all labels as the last column (default hide labels column)
  • --show-managed-fields=false β€” if this is true, keep the managedFields when printing objects in JSON or YAML format.
  • --sort-by="" β€” if non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. '{.metadata.name}'). The field in the API resource specified by this JSONPath expression must be an integer or a string. ⭐
  • --source-secret="" β€” the name of an existing secret that should be used for cloning a private git repository.
  • --strategy= β€” specify the build strategy to use if you don't want to detect (docker|pipeline|source). NOTICE: the pipeline strategy is deprecated; consider using Jenkinsfiles directly on Jenkins or OpenShift Pipelines. this one is important, bestie πŸ’€
  • --template=[] β€” name of a stored template to use in the app. 🌈

🧬 OPTIONS INHERITED FROM PARENT COMMANDS 🧬

  • --as="" β€” username to impersonate for the operation. User could be a regular user or a service account in a namespace.
  • --as-group=[] β€” group to impersonate for the operation; this flag can be repeated to specify multiple groups.
  • --as-uid="" β€” UID to impersonate for the operation.
  • --as-user-extra=[] β€” user extras to impersonate for the operation; this flag can be repeated to specify multiple values for the same key.
  • --cache-dir="/homeless-shelter/.kube/cache" β€” default cache directory.
  • --certificate-authority="" β€” path to a cert file for the certificate authority.
  • --client-certificate="" β€” path to a client certificate file for TLS.
  • --client-key="" β€” path to a client key file for TLS.
  • --cluster="" β€” the name of the kubeconfig cluster to use.
  • --context="" β€” the name of the kubeconfig context to use.
  • --disable-compression=false β€” if this is true, opt-out of response compression for all requests to the server.
  • --insecure-skip-tls-verify=false β€” if this is true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. 🚨
  • --kubeconfig="" β€” path to the kubeconfig file to use for CLI requests.
  • --kuberc="" β€” path to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.
  • --match-server-version=false β€” require server version to match client version.
  • -n, --namespace="" β€” if present, the namespace scope for this CLI request.
  • --profile="none" β€” name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex).
  • --profile-output="profile.pprof" β€” name of the file to write the profile to.
  • --request-timeout="0" β€” the length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.
  • -s, --server="" β€” the address and port of the Kubernetes API server.
  • --tls-server-name="" β€” server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used.
  • --token="" β€” bearer token for authentication to the API server.
  • --user="" β€” the name of the kubeconfig user to use.
  • --warnings-as-errors=false β€” treat warnings received from the server as errors and exit with a non-zero exit code. πŸ‘‘

🌸 EXAMPLE 🌸

ok so this is the part everyone actually came for β€” the receipts πŸ’… every single one of these is copy-pasteable, so go off bestie:

# List all local templates and image streams that can be used to create an app
oc new-app --list
# Create an application based on the source code in the current git repository (with a public remote) and a container image
oc new-app . --image=registry/repo/langimage
# Create an application myapp with Docker based build strategy expecting binary input
oc new-app  --strategy=docker --binary --name myapp
ok lowkey yes there are two spaces after new-app in that last one β€” that's literally how it's written, don't come for me πŸ™ˆ
# Create a Ruby application based on the provided [image] [source code] combination
oc new-app centos/ruby-25-centos7 https://github.com/sclorg/ruby-ex.git
# Use the public container registry MySQL image to create an app. Generated artifacts will be labeled with db=mysql
oc new-app mysql MYSQL_USER=user MYSQL_PASSWORD=pass MYSQL_DATABASE=testdb -l db=mysql
# Use a MySQL image in a private registry to create an app and override application artifacts' names
oc new-app --image=myregistry.com/mycompany/mysql --name=private
# Use an image with the full manifest list to create an app and override application artifacts' names
oc new-app --image=myregistry.com/mycompany/image --name=private --import-mode=PreserveOriginal
# Create an application from a remote repository using its beta4 branch
oc new-app https://github.com/openshift/ruby-hello-world#beta4
# Create an application based on a stored template, explicitly setting a parameter value
oc new-app --template=ruby-helloworld-sample --param=MYSQL_USER=admin
# Create an application from a remote repository and specify a context directory
oc new-app https://github.com/youruser/yourgitrepo --context-dir=src/build
# Create an application from a remote private repository and specify which existing secret to use
oc new-app https://github.com/youruser/yourgitrepo --source-secret=yoursecret
# Create an application based on a template file, explicitly setting a parameter value
oc new-app --file=./example/myapp/template.json --param=MYSQL_USER=admin
# Search all templates, image streams, and container images for the ones that match "ruby"
oc new-app --search ruby
# Search for "ruby", but only in stored templates (--template, --image-stream and --image
# can be used to filter search results)
oc new-app --search --template=ruby
# Search for "ruby" in stored templates and print the output as YAML
oc new-app --search --template=ruby --output=yaml

see?? told you ✨ every flag, every path, every MYSQL_USER=admin, all of it, untouched. no cap 🫢


πŸ‘€ SEE ALSO πŸ‘€

yeah it's just the one (1) reference and yes it keeps its lil trailing comma, that's how we roll πŸŽ€


πŸ¦‹ HISTORY πŸ¦‹

June 2016, Ported from the Kubernetes man-doc generator

a vintage. an icon. June 2016 really said "let me port this from the Kubernetes man-doc generator" and we've been eating ever since πŸ˜­πŸ‘‘


and that's the whole page bestie!! 🌈✨

this lil masterpiece comes to you courtesy of Openshift β€” living under the Openshift CLI User Manuals umbrella, dated way back in June 2016, page name OC(1) and all πŸ’–

go create an app or twelve, you absolute main character πŸ§šπŸ’…

πŸ“¦ where this page comes from