Giter Club home page Giter Club logo

cicd-openshift's Introduction

CI/CD infrastructure setup on Openshift

This repository contains all the components needed to setup the CI/CD infrastructure. This has been tested with Minishift and CDK for Rhel based images.

CI/CD architecture in Openshift

Application in Openshift will be segregated in many projects, each project is isolated from other.

CI/CD Architecture

Openshift project

This is the default project that comes by default with a classic Openshift installation. It contains images and templates supported by RedHat.

My-Openshift project

The idea of this project is to mimic what is Openshift project but for our specific needs. It will contains base image, templates, and secrets for private registry.

CICD project

It will contain the entire CI/CD infrastructure such as Jenkins, Nexus, Sonarqube, a Selenium grid, chartmuseum and whatever else is necessary to build, test and deliver our applications and improve our code quality. This will use helm without tiller by applying the result of helm template.

Dev project

Dev project is where the released image for each cell will be pushed and tagged from each cell project when developer feel confident with. This project will also be used by developers to make some tests in an integrated environment.

Staging project

This is where business e2e tests are run. If tests passed, the cell can be promoted to OPT.

Prod project

This project will be used for user acceptance before going to OPS.

Setup

My project

Similarly to the Openshift project, we will create a my-openshift project to store our custom templates and eventually our images from our private registry.

oc new-project my-openshift
oc secrets new-dockercfg my-registry --docker-server="<url>" --docker-username="<username>" --docker-password="<password>" --docker-email="<email>"
oc secrets link default my-registry --for=pull
# to build an image
oc secrets link builder my-registry

Then when we want to import an image from our private registry, we will use the reference policy local, so other pod will not fetch image from it directly, instead the image will be cached in the openshift internal registry and the other pod will retrieve their image from it.

This configuration allow us to not provide docker secret in each project and so we can enforce which service account has the right to pull an image from our private registry without sharing the secret in every project.

oc import-image ${image}:${version} --from=${image}:${version} -n my-openshift -reference-policy=local --confirm

Once we have imported the image, we have to allow other project to pull image from the my-openshift project.

To simplify this management, we can also add the ability to all service account in project project-a to pull image from project my-openshift:

oc policy add-role-to-group system:image-puller system:serviceaccounts:project-a -n my-openshift

Helm installation

First, you need to download and install helm client: https://github.com/kubernetes/helm/blob/master/docs/install.md

Then we will initialize helm without tiller:

helm init --client-only

NOTE:

Unless helm 3 is released without tiller server, we will use helm 2 without tiller by applying the result of helm template with kubectl apply. Check https://jenkins-x.io/news/helm-without-tiller/ to see what it matters.


CI/CD project

We will create a cicd project to install our Jenkins, Nexus and SonarQube and whatever else is necessary for our CI/CD infrastructure. The cicd project should be able to retrieve image from this project.

oc new-project cicd
oc policy add-role-to-group system:image-puller system:serviceaccounts:cicd -n my-openshift

The rest of this documentation assumes you run command in the project cicd. To ensure it, run: oc project cidc

Components installation

  1. Jenkins
  2. Nexus 3
  3. SonarQube
  4. Zalenium (recommended to better leverage Kubernetes cluster) or Selenium Grid
  5. Chart museum

cicd-openshift's People

Contributors

arnaud-deprez avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cicd-openshift's Issues

Make the selenium grid scalable

Currently, the selenium grid is statically scalable, meaning you have to define in advance the number of nodes you want for each browser.
It would be nicer to better use what Kubernetes can offer it and make it dynamic like jenkins slaves.

2 projects to consider so far:

Zalenium is occicially mentionned in the Selenium Grid project and has a higher community, so it shall be more relevant to consider it first.

Use Helm Package Manager

It should be nice to use helm instead of openshift templates for this cicd infrastructure so we can manage the whole infrastructure dependencies make it easy to use.

It will also make it easy to use these openshift compliant images with jenkins-x

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.