Paul Bennett
Paul Bennett

Reputation: 177

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

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.

Upvotes: 5

Views: 2893

Answers (1)

Simon
Simon

Reputation: 4475

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)

Upvotes: 9

Related Questions