1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-11-21 05:55:35 +00:00
catalog/task/openshift-uninstall/0.1
Quan Zhang e294e1246b [TEP-0110] Update Tekton Catalog installation instructions
Prior to this change, the installation instructions directly use the resource urls in the Catalog repo, which results in tight coupling between the organization and how users fetch resources (as described in TEP-0110). This commit updates the installation guide to install Tekton Catalog resources via Tekton Hub Api: https://github.com/tektoncd/hub/pull/539

This change decouples the Tekton Catalog organization from resouces resolution, which enables Tekton Catalog reorganization.
2022-08-16 16:25:52 +01:00
..
samples Removed unwanted examples from tasks dir 2020-11-18 17:55:28 +00:00
openshift-uninstall.yaml Add linux/amd64 platform annotation to the rest of the tasks 2021-10-29 17:08:38 +01:00
README.md [TEP-0110] Update Tekton Catalog installation instructions 2022-08-16 16:25:52 +01:00

OpenShift Provisioning

The following task helps you to provision the Openshift cluster using the Installer Provided Infrastructure on the desired cloud platform. Supported cloud platforms are :-

  • AWS
  • GCP

Guide to provision a cluster on AWS can be found here and for GCP can be found here

OpenShift-Destroy

Install the Task

kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/openshift-uninstall/0.1/raw

Workspaces

  • install-dir: The PersistentVolume workspace which will contain all the files generated by the openshift-install which later can be used at the time of destroying the cluster.

Parameters

  • OPENSHIFT_INSTALLER_IMAGE: OpenShift installer base image for UPI installation (default: quay.io/openshift/origin-upi-installer:4.6)

Platforms

The Task can be run on linux/amd64 platform.

Usage

Taking example of AWS :-

  1. Create the PVC
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: install-dir
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 2Gi
  1. Create the secrets (taking an example of mouting AWS credentials and config)
apiVersion: v1
kind: Secret
metadata:
  name: openshift-install
type: Opaque
stringData:
  pull-secret: $(pull-secret)
  public-ssh-key: $(public-ssh-key)

The secrets for the respected cloud platform can be mounted as (taking aws as an example):-

apiVersion: v1
kind: Secret
metadata:
  name: aws-credentials
type: Opaque
stringData:
  credentials: |-
    [profile-name]
    aws_access_key_id     = $(access-key-id)
    aws_secret_access_key = $(secret-access-key)
    [default]
    aws_access_key_id     = $(access-key-id)
    aws_secret_access_key = $(secret-access-key)
  config: |-
    [profile profile-name]
    region = $(region)
    output = json
  1. Creating TaskRun for the OpenShift Create:
apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
  name: install-run
spec:
  taskRef:
    name: openshift-install
  params:
    - name: PLATFORM
      value: aws
    - name: CLUSTER_NAME
      value: test-cluster
    - name: BASE_DOMAIN
      value: devcluster.openshift.com
    - name: REPLICAS
      value: 3
    - name: REGION
      value: us-east-2
  workspaces:
    - name: install-dir
      persistentvolumeclaim:
        claimName: install-dir
    - name: secrets
      secret:
        secretName: aws-credentials

NOTE

  • To access the cluster created in other tasks we need to use the same Workspace and keep the workingDir: $(workspaces.workspaces-name.path) and to login into the cluster in the next Tekton Task do the following :-
    export KUBECONFIG=auth/kubeconfig
    
    and to get the URL for OpenShift webconsole do the following :-
    cat auth/webaccess
    
  • In order to destroy the cluster, it is mandatory to keep the volume which is used at the time of creating the cluster, else deletion of cluster will not be possible. This is because volume contains neccesary files that we get once we get the cluster created and these files are required during deletion of the cluster.