Skip to content

Latest commit

 

History

History
62 lines (49 loc) · 2.22 KB

File metadata and controls

62 lines (49 loc) · 2.22 KB

OpenShift Deployment Template

This guide summarizes the required files and configuration to deploy a project on OpenShift. Replace the placeholders with values specific to your application.

Required Files

  • Dockerfile – adjusted for OpenShift, sets permissions and environment variables.
  • openshift/deployment.yaml – defines the Deployment for {{APP_NAME}} in {{NAMESPACE}}.
  • openshift/service.yaml – exposes the application internally.
  • openshift/route.yaml – optional external route for the Service.
  • openshift/network-policy.yaml – network access rules.
  • openshift/pipeline/pipeline.yaml – Tekton Pipeline definition.
  • openshift/pipeline/pipeline-pvc.yaml – persistent volume claim for the pipeline.
  • openshift/pipeline/pipeline-run.yaml – sample pipeline run.

Dockerfile Adjustments

Ensure the Dockerfile includes OpenShift-friendly settings:

  • Create /opt/app-root/src, /opt/app-root/home, and /tmp directories.
  • Set environment variables:
    • HOME=/opt/app-root/home
    • NODE_ENV=production
    • PORT=8080
    • NPM_CONFIG_CACHE=/opt/app-root/home/.npm
    • NODE_OPTIONS=--max-old-space-size=384
    • NPM_RUN=build
  • Grant write permissions for UID range {{UID_RANGE}}.
  • Switch to an unprivileged user (e.g., USER 1002290000).
  • Apply OpenShift labels such as io.openshift.expose-services="8080:http".

Environment Variables

Configure these variables in your Deployment manifest:

- name: NODE_ENV
  value: production
- name: PORT
  value: "8080"
- name: HOME
  value: /opt/app-root/home
- name: NPM_CONFIG_CACHE
  value: /opt/app-root/home/.npm
- name: NODE_OPTIONS
  value: "--max-old-space-size=384"
- name: NPM_RUN
  value: build

Add additional variables as required by your project.

Placeholders

  • {{APP_NAME}} – application name
  • {{NAMESPACE}} – target OpenShift project/namespace
  • {{UID_RANGE}} – allowed UID range for the security context (e.g., 1002290000-1002300000)
  • {{MCS_LABELS}} – MCS labels (e.g., s0:c48,c17)
  • {{SUPPLEMENTAL_GROUPS}} – supplemental groups (e.g., 1002290000/10000)
  • {{SCC}} – security context constraint name

Use this template as a starting point when adapting the deployment for a new project.