> For the complete CircleCI developer hub index, see [llms.txt](https://circleci.com/developer/llms.txt)

# circleci/redhat-openshift

This orb is no longer supported by CircleCI because of limited or no use. 
If you would like to use this orb or create your own version feel free to 
fork the repository and use the following https://circleci.com/blog/building-private-orbs/ 
as a guide to making this orb into a private orb for your own use. 
An orb for working with Red Hat OpenShift.
Project homepage: https://github.com/CircleCI-Public/redhat-openshift-orb


## Commands

### create-local-cluster-with-oc

Creates a local Kubernetes cluster with the oc client CLI.
Requires the setup_remote_engine step if this command is run
on a Docker executor.

Note: This relies on the "oc cluster up" command being available
in the version of oc client CLI installed. It is not currently
available in version 4 of the OpenShift client CLI.


| Parameter | Type | Default | Description |
|---|---|---|---|
| `cli-release-tag` | string |  | OpenShift client CLI version.
Defaults to the latest stable version.
 |
| `host-config-dir` | string |  | Directory on Docker host for OpenShift configuration.
 |
| `host-data-dir` | string |  | Directory on Docker host for OpenShift data.
Specify this to persist data across restarts of the cluster.
 |
| `skip-registry-check` | boolean | false | Whether to skip the Docker daemon registry check.
 |
| `use-existing-config` | boolean | false | Whether to use existing configuration if present.
 |

### install-openshift-cli

Install the OpenShift client CLI and also the kubectl
that is included in the CLI package.
Requirements: curl, amd64 architecture


| Parameter | Type | Default | Description |
|---|---|---|---|
| `release-tag` | string |  | OpenShift client CLI version.
Use this to specify a tag to select which published release of the CLI,
as listed on https://github.com/openshift/origin/releases,
to install. If no value is specified, the latest stable release will be installed.
Note: The specified release should be compatible with the version of the
OpenShift cluster that the CLI is intended for. Also, pre or alpha releases cannot be specified.
 |

### login-and-update-kubeconfig

Performs a login to the OpenShift server, either via username and password,
certificate authority file, or a token.
Upon a successful login, the kubectl configuration file (kubeconfig) will
be updated with the OpenShift cluster access credentials.


| Parameter | Type | Default | Description |
|---|---|---|---|
| `certificate-authority` | string |  | Used for login via certificate authority.
Specfiies the path to the certificate authority file for logging into the OpenShift server.
(Do not set the "username", "password" and "token" parameters if login via certificate
authority is desired)
 |
| `insecure-skip-tls-verify` | boolean | false | If true, the server's certificate will not be checked for validity. This will
make your HTTPS connections insecure.
 |
| `openshift-cli-release-tag` | string |  | The version of the OpenShift CLI to be installed, if it is
not already installed. Defaults to the latest stable version.
 |
| `openshift-platform-version` | enum |  | The version of the OpenShift platform that the cluster is on.
 |
| `password` | string |  | Used for login via username and password.
Specifies the password for logging into the OpenShift server.
(Do not set the "certificate-authority" and "token" parameters if login via username
and password credentials is desired)
 |
| `project` | string |  | Specifies a project to switch to after the login.
If none is specified, the default project will be used.
 |
| `server-address` | string |  | The address of the OpenShift server (in the form hostname:port).
 |
| `token` | string |  | Used for login via token.
Specifies the bearer token for authentication to the API server
 |
| `username` | string |  | Used for login via username and password.
Specifies the username for logging into the OpenShift server.
(Do not set the "certificate-authority" and "token" parameters if login via username
and password credentials is desired)
 |

## Executors

### default

Debian-based circleci/python Docker image to use


| Parameter | Type | Default | Description |
|---|---|---|---|
| `debian-release` | string | stretch |  |
| `python-version` | string | 3.7 |  |

### machine-for-local-cluster

Machine executor suitable for running local clusters.


### python2

CircleCI convenience image for Python 2.


### python3

CircleCI convenience image for Python 3.


## Examples

### create-local-cluster

Create an local OpenShift cluster.


```yaml
version: '2.1'
orbs:
  redhat-openshift: circleci/redhat-openshift@0.1.0
jobs:
  create-local-cluster:
    executor: redhat-openshift/machine-for-local-cluster
    steps:
      - redhat-openshift/create-local-cluster-with-oc:
          skip-registry-check: true
      - redhat-openshift/login-and-update-kubeconfig:
          insecure-skip-tls-verify: true
          openshift-platform-version: 3.x
          password: password
          server-address: https://127.0.0.1:8443
          username: dev1
      - run:
          command: >
            oc new-project localclustertestproject

            oc new-app
            centos/ruby-25-centos7~https://github.com/sclorg/ruby-ex.git

            kubectl get services
          name: Test the cluster
workflows:
  deployment:
    jobs:
      - create-local-cluster
```

### deployment

Deploy an application to an existing OpenShift cluster with kubectl.


```yaml
version: '2.1'
orbs:
  kubernetes: circleci/kubernetes@0.3.0
  redhat-openshift: circleci/redhat-openshift@0.1.0
jobs:
  deploy-to-cluster:
    executor: redhat-openshift/default
    steps:
      - redhat-openshift/login-and-update-kubeconfig:
          insecure-skip-tls-verify: true
          openshift-platform-version: 4.x
          password: $OPENSHIFT_PASSWORD
          server-address: $OPENSHIFT_SERVER
          username: $OPENSHIFT_USER
      - run:
          command: |
            cat \<<- EOF > deployment.yaml
            apiVersion: apps/v1
            kind: Deployment
            metadata:
              name: nginx-deployment
            spec:
              selector:
                matchLabels:
                  app: nginx
              replicas: 2
              template:
                metadata:
                  labels:
                    app: nginx
                spec:
                  containers:
                  - name: nginx
                    image: nginx:1.7.9
                    ports:
                    - containerPort: 80
            EOF
          name: Create example k8s deployment yaml file
      - kubernetes/create-or-update-resource:
          get-rollout-status: true
          resource-file-path: deployment.yaml
          resource-name: deployment/nginx-deployment
workflows:
  deployment:
    jobs:
      - deploy-to-cluster
```