Can oc new-app create a Deployment instead of a DeploymentConfig?
Asked Answered
F

1

5

oc new-app always creates a DeploymentConfig. Is there an option to create a Deployment instead of a DeploymentConfig?

Why? DeploymentConfig is a proprietary legacy Red Hat only resource kind. I would prefer a modern cross platform industry standard Deployment.

Felsite answered 4/12, 2020 at 18:38 Comment(0)
J
9

oc new-app always creates a DeploymentConfig. Is there an option to create a Deployment instead of a DeploymentConfig?

Current versions of oc have been creating Deployments for quite some time now:

$ oc new-app --docker-image=<IMAGE> --name=my-application
--> Found container image [..]

    * An image stream tag will be created as "my-application:latest" that will track this image

--> Creating resources ...
    imagestream.image.openshift.io "my-application" created
    deployment.apps "my-application" created
    service "my-application" created
--> Success
    Application is not exposed. You can expose services to the outside world by executing one or more of the commands below:
     'oc expose service/my-application'
    Run 'oc status' to view your app.
$ oc get deployment
NAME             READY   UP-TO-DATE   AVAILABLE   AGE
my-application   1/1     1            1           7s
$ oc get deploymentconfig
No resources found in simon namespace.

So you should update your oc client as you seem to be using an old version (my output above is with a 4.6 client).

The old behaviour of creating a DeploymentConfig can still be forced by using the --as-deployment-config option:

$ oc new-app --docker-image=<IMAGE> --name=my-application --as-deployment-config

Note that DeploymentConfigs still have their place if you want to use features like triggers, automatic rollback, lifecycle hooks or custom strategies (DeploymentConfigs-specific features)

Johannesburg answered 5/12, 2020 at 11:34 Comment(1)
Aha...I'm way back on openshift-clients-4.3.0-201910250623-88-g6a937dfe. Thanks Simon.Felsite

© 2022 - 2024 — McMap. All rights reserved.