OpenShift-only Custom Resource Definitions

Red Hat OpenShift is a complete DevOps platform extending Kubernetes in various ways. It bundles a constellation of Custom Resource Definitions (CRDs) to make the life of developers and cluster administrators easier.

Let us talk first about the CRDs only available on OpenShift.

Project

An OpenShift Project is similar to a Kubernetes namespace, but more tightly integrated into the security system of OpenShift through additional annotations.

apiVersion: project.openshift.io/v1
kind: Project
metadata:
  name: linkedin-learning-project
  annotations:
	openshift.io/description: "Project description"
	openshift.io/display-name: "Display name"

Route

The OpenShift Route object was one of the primary inspirations during the development of the Ingress object. In OpenShift, Ingress and Route objects work together to ensure your applications are available outside the cluster.

apiVersion: route.openshift.io/v1
kind: Route
metadata:
  name: my-route
spec:
  host: example.com
  port:
	targetPort: 8080
  to:
	kind: Service
	name: my-service

DeploymentConfig

Kubernetes' Deployment object draws its inspiration from the OpenShift-only DeploymentConfig object. Both are based on a ReplicationController object, supporting the deployment and configuration of an application. But DeploymentConfig objects can also specify deployment strategies and trigger changes or application upgrades from the command line.

apiVersion: v1
kind: DeploymentConfig
metadata:
  name: mydc
spec:
  replicas: 1
  template:
	spec:
  	containers:
    	- name: container
      	image: image-name:version
Red Hat does not recommend creating DeploymentConfig objects, and to create standard Deployment objects instead. But they are common enough in older OpenShift installations, which is why they deserve to be mentioned.

BuildConfig

OpenShift provides a CRD called BuildConfig that describes the definition and configuration required for the build process of an application.

apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
  name: my-build
spec:
  triggers:
  - type: "GitHub"
  source:
    git:
      uri: "https://github.com/user/project"

The typical outputs for such build processes are container images conveniently stored in the integrated OpenShift container repository for developers to inspect and debug.