Giter VIP home page Giter VIP logo

openshift-tekton-pipeline's Introduction

This repo contains assets to ease deploying openshift on kubernetes/openshift using kubevirt vms, all through a tekton pipeline

Requisites

  • kubernetes/openshift cluster (with admin creds)
  • tekton/openshift pipelines and kubevirt/openshift virtualization deployed
  • storage in place (for the disks of the vms)

Configuration

On kubernetes

PROJECT=myproject
kubectl config set-context --current --namespace=$PROJECT
kubectl create -f tekton.yml

On openshift

PROJECT=myproject
oc new-project $PROJECT
oc adm policy add-cluster-role-to-user cluster-admin -z pipeline -n $PROJECT
oc adm policy add-scc-to-user anyuid -z pipeline

On both

mkdir /tmp/creds
cp ~/.ssh/*pub /tmp/creds
cp openshift_pull.json /tmp/creds
kubectl create configmap credentials --from-file=/tmp/creds
rm -rf /tmp/creds
kubectl create -f pipeline.yml

Note that the pipeline can easily be extended with the parameters available here

Launch a deployment

oc create -f pipelinerun.yml

Parameters

Parameter Default Value
cluster testk
version stable
tag 4.9
masters 3
workers 0
numcpus 8
memory 8192
disk_size 30
network_type OVNKubernetes
async false

Retrieve credentials

Credentials will be available shortly after the pipeline runs, before completion.

Gathering task output

The following command will print all the information needed to access the cluster:

  • /etc/hosts entry
  • kubeadmin password
  • full kubeconfig
POD=$(oc get pod --sort-by={'.metadata.creationTimestamp'} -o custom-columns=NAME:.metadata.name --no-headers | grep deploy-openshift | tail -1)
oc logs $POD

Gathering task results

You can also gather kubeadmin password and the /etc/hosts entry as results of the pipeline

PIPELINERUN=$(oc get pipelinerun --sort-by={'.metadata.creationTimestamp'} -o name | tail -1)
KUBEADMIN_PASSWORD=$(oc get $PIPELINERUN -o jsonpath='{.status.pipelineResults[0].value}')
echo $KUBEADMIN_PASSWORD
PIPELINERUN=$(oc get pipelinerun --sort-by={'.metadata.creationTimestamp'} -o name | tail -1
oc get $PIPELINERUN -o jsonpath='{.status.pipelineResults[1].value}'

Kubeconfig can't be gathered this way (because of the size of the data preventing to store this way)

Note that during a run, if not running in async mode, you can copy kubeconfig with the following command:

CLUSTER=magic
POD=$(oc get pod --sort-by={'.metadata.creationTimestamp'} -o custom-columns=NAME:.metadata.name --no-headers | grep deploy-openshift | tail -1)
oc cp $POD:/root/.kcli/clusters/$CLUSTER/auth/kubeconfig kubeconfig.$CLUSTER

Screenshots

wizard

exec

details

openshift-tekton-pipeline's People

Contributors

karmab avatar yuvalk avatar

Watchers

James Cloos avatar  avatar

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.