:toc: macro

ifdef::env-github[]
:tip-caption: :bulb:
:note-caption: :information_source:
:important-caption: :heavy_exclamation_mark:
:caution-caption: :fire:
:warning-caption: :warning:
endif::[]

toc::[]
:idprefix:
:idseparator: -
:reproducible:
:source-highlighter: rouge
:listing-caption: Listing

= Docker Configuration

== Introduction

OpenShift is a docker container orchestrator built on top Kubernetes.

=== Overview

This template allow you to configure Jenkins in order to work with OpenShift.

It will:

* Add OpenShift client as custom tool.
* Configure an OpenShift cluster to work with.

== Prerequisites

In order to execute this template, you need the following plugins installed in your Jenkins:

- link:https://wiki.jenkins.io/display/JENKINS/OpenShift+Client+Plugin[OpenShift Client Plugin]

NOTE: The initialize instance template will install all plugins if you select `Openshift` or `Docker+Openshift` in the `installDeploymentPlugins` parameter

== Template

This template will be automatically created in your jenkins after executing the `Initialize_Instance` template inside the `UTILS` folder with the name `Openshift_Configuration`.

For manual creation see: link:how-to-add-a-template[How to add a Template]

IMPORTANT: This template needs the link:https://github.com/devonfw/production-line-shared-lib[devonfw Production Line Shared Lib]

=== Parameters

The required parameters are:

- `ocName`: The name of the OpenShift connection. You can define multiple OpenShift connections by changing the name.
- `ocUrl`: The OpenShift URL.
- `ocProject`: The OpenShift Project.
- `ocToken`: The OpenShift token. In order to have a long-term token, this token should be a service account token.

=== Execution

. Press the Build with Parameters button
. Insert the parameters.
. If the OpenShift token is not added as credential, please add a new entry.
. Press the `Build` button.
. Wait until the pipeline ends.

WARNING: If a cluster already exists with the provided name, it will not modify anything.

image::images/openshift-configuration/openshift-configuration.png[]
image::images/openshift-configuration/openshift-configuration2.png[]
image::images/openshift-configuration/openshift-configuration3.png[]

You can add more clusters by executing the template again or in Jenkins -> Manage Jenkins -> Configure System

image::images/openshift-configuration/openshift-clusters.png[]
