projectatomic/openshift2nulecule

Name: openshift2nulecule

Owner: Project Atomic

Description: Create Nulecule application from OpenShift project

Created: 2016-02-17 16:02:10.0

Updated: 2018-02-02 03:46:50.0

Pushed: 2016-05-12 13:22:32.0

Homepage: null

Size: 115

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

OpenShift2Nulecule

This tool creates a Nulecule application that has Kubernetes and OpenShift artifacts based on an existing OpenShift project.

OpenShift2Nulecule creates a nulecule file with artifacts. Images are not exported or included in the application. Images are optionally able to be exported from the OpenShift registry to another registry.

Limitations
Exported Artifacts

OpenShift2Nulecule creates only the following Kubernetes configurations:

OpenShift2Nulecule creates only the following OpenShift configurations:

Specifically, OpenShift2Nulecule does not export these OpenShift configurations:

You advised to carefully review the created artifacts and change hostnames and ip addresses.

For more information about OpenShift object types, please see the OpenShift Documentation on this topic.

Kubernetes Usage

OpenShift applications exported for use with Kubernetes by OpenShift2Nulecule will not be setup to be built from source (s2i). They will export the last successfully built images from OpenShift to be launched by Kubernetes.

External Dependencies

The OpenShift client (oc) has to be installed and configured to connect to OpenShift server. Additionally, the workstation running openshift2nulecule must have a working copy of the docker cli installed.

You can provide the path to oc binary using --oc argument. If you need to pass a --config option to the oc binary, use the --oc-config option.

Usage

Before running OpenShift2Nulecule you have to be authenticated to OpenShift using the oc login command. For more information, see Basic Setup and Login.

Export A Whole Project
shift2nulecule --output /path/to/new/myapp --project myproject

This will export the whole OpenShift project, myproject, and create a new Nulecule application in the /path/to/new/myapp directory.

Selectively Export an Application Based on Labels
shift2nulecule --output ~/exported/hexboard --project hexboard --selector app=sketchpod

This will export the just the sketchpod application from the OpenShift project, myproject, and create a new Nulecule application in the /path/to/new/myapp directory.

Exporting Images From OpenShift

This tool has also support for exporting images from the OpenShift internal registry. To use this you need to secure and expose the OpenShift internal registry using route. For instructions please see the official OpenShift documentation.

The following example will export all images that are used in the project and push them to the registry at localhost:5000.

shift2nulecule --output ./myapp --project mlb --oc-registry-host docker-registry.cdk.10.2.2.2.xip.io --export-images all --registry-host localhost:5000 

For testing you might want to skip push stage. You can do this by adding --skip-push option. With this option openshift2nulecule will only pull images to you local docker cache.

Arguments

General Arguments:

The following arguments are related to exporting images:

Installation

RPMs for use with Fedora, CentOS, and Red Hat Enterprise Linux are available in COPR at:

https://copr.fedorainfracloud.org/coprs/tkral/openshift2nulecle/

Specific Operating System instructions are below

CentOS 7 and CentOS Atomic Developer Bundle (ADB)
able epel
install epel-release

d tkral/openshift2nulecle copr repository
  https://copr.fedorainfracloud.org/coprs/tkral/openshift2nulecle/repo/epel-7/tkral-openshift2nulecle-epel-7.repo > /etc/yum.repos.d/tkral-openshift2nulecle-epel-7.repo

stall openshift2nulecule
install openshift2nulecule
Red Hat Enterprise Linux Container Development Kit (CDK)

Installed by default.

Red Hat Enterprise Linux 7
able optional repositories
cription-manager repos --enable rhel-7-server-optional-rpms 

able extras repositories
cription-manager repos --enable rhel-7-server-extras-rpms

d EPEL repositories
s://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

d tkral/openshift2nulecle copr repository
  https://copr.fedorainfracloud.org/coprs/tkral/openshift2nulecle/repo/epel-7/tkral-openshift2nulecle-epel-7.repo > /etc/yum.repos.d/tkral-openshift2nulecle-epel-7.repo

stall openshift2nulecule
install openshift2nulecule
Running as Docker container

OpenShift2Nulecule can also be run in a Docker container. It is easier to do when using the Atomic CLI.

ic run tomaskral/openshift2nulecule \
project testing \
output $HOME/mytest \
oc-config=$HOME/.kube/config \
oc-registry-host 172.30.22.38:5000 \
export-images all \
registry-host my_registry:5000

Note: When running openshift2nulecule in a container, you must always specify the path to the oc configuration file using the --oc-config argument. In most cases, the default value of $HOME/.kube/config should work.

Example of running the openshift2nulecule container without the Atomic CLI:

er run -it --rm --privileged --net=host \
 /var/run/docker.sock:/var/run/docker.sock \
 /:/host \
maskral/openshift2nulecule \
project testing \
output $HOME/mytest \
oc-config=$HOME/.kube/config
oc-registry-host 172.30.22.38:5000 \
export-images all \
registry-host my_registry:5000

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.