Giter Club home page Giter Club logo

ocp4-offline-operator-mirror's Introduction

OpenShift4 Offline Operator Mirror and Upgrade

โ— Red Hat support cannot assist with problems with this Repo.

This script will create a custom operator catalog based on the desired operators and mirror the images to a local registry, useful for air-gapped (disconnected) or restricted networks. Tested with OpenShift 4.6.3.

What is the purpose of this?

Because the current catalog build and mirror (https://docs.openshift.com/container-platform/4.6/operators/olm-restricted-networks.html) takes 1-5 hours to create and more than 50% of the catalog is not usable offline anyways. This tool allows you to create a custom catalog with only the operators you need/want.

Prerequisites

Be sure you have registry authentication tokens setup, it makes life easier. https://access.redhat.com/RegistryAuthentication https://access.redhat.com/terms-based-registry/

Requirements

It is assumed you already have a registry setup locally to mirror operator content to. See the section Local Docker Registry for an example implementation.

This tool was tested with the following versions of the runtime and utilities:

  1. RHEL 8.2
  2. Podman v1.9.3 (If you use anything below 1.8, you might run into issues with multi-arch manifests)
  3. Skopeo 1.0.0 (If you use anything below 1.0 you might have issue with the newer manifests)
  4. OPM CLI

Please note this ideally works best with operators that meet the following criteria:

  1. Have a ClusterServiceVersion (CSV) in the manifest that contains a full list of related images
  2. The related images are tagged with a SHA

For a full list of operators that work offline please see link below https://access.redhat.com/articles/4740011

Installing OPM CLI

  1. oc image extract registry.redhat.io/openshift4/ose-operator-registry:v4.6 --registry-config='~/openshift/pull-secret-full.json' --path /usr/bin/opm:. --confirm
  2. sudo chmod +x opm
  3. sudo mv opm /usr/local/bin

Running the script

  1. git clone this repository
  2. Install the tools listed in the requirements section
  3. Login to your offline registry using podman (This is the registry where you will be publishing the catalog and related images)
  4. Login to registry.redhat.io using podman
  5. Modify variables to suit your environment in the script olm-operator.sh.
  6. Launch the script passing an argument to do either a mirror or an upgrade. See https://access.redhat.com/articles/4740011 for list of supported offline operators that can be mirrored.
./olm-operator.sh mirror|upgrade
  1. Disable default operator source. This only needs to be done once for a cluster.
oc patch OperatorHub cluster --type json -p '[{"op": "add", "path": "/spec/disableAllDefaultSources", "value": true}]'
  1. Apply the two yaml files in the redhat-operator-index-manifests folder via oc apply -f. The image content source policy will create a new MCO render, which will start a rolling reboot of your cluster nodes. You have to wait until that is complete before attempting to install operators from the catalog.

Script Notes

Placeholders have been left for other Operator catalogs.

Local Docker Registry

If you need a to create a local secured registry, follow the instructions from this link: https://docs.openshift.com/container-platform/4.6/installing/install_config/installing-restricted-networks-preparations.html#installing-restricted-networks-preparations

Acknowledgements

PRs welcome!

ocp4-offline-operator-mirror's People

Contributors

novacain1 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.