GithubHelp home page GithubHelp logo

marketplace-utilities's Introduction

Marketplace Utilities

What is it for

This library is intended for automation of operator deployment on OpenShift 4 via OpenShift Marketplace.

How to use

Example of usage below:

Quay

First it's necessary to create project on quay:

QuayUser quayUser = new QuayUser(
        userName,
        password,
        organization, // namespace
        authToken
);

QuayService quayService = new QuayService(
    quayUser,
    operatorImage,
    envVars);

quayProject = quayService.createQuayProject();
  • operatorImage is an image we want to install
  • envVars is a map of environment variables we want to set for this image

This method returns name of project on Quay (it's based on operator name). It's necessary in the next steps.

OpenShift

When project on Quay is created, we can get to deploying on OpenShift

OpenShiftUser regularUser = new OpenShiftUser(
        regularUserUsername,
        regularUserPassword,
        openShiftApiUrl
);
OpenShiftUser adminUser = new OpenShiftUser(
        adminUsername,
        adminPassword,
        openShiftApiUrl
);
OpenShiftConfiguration openShiftConfiguration = new OpenShiftConfiguration(
        openShiftNamespace,
        pullSecretName,
        pullSecret,
        quayOperatorsourceToken
);
OpenShiftService openShiftService = new OpenShiftService(
        quayNamespace,
        quayProject, // this is from before
        openShiftConfiguration,
        adminUser,
        defaultUser
);

openShiftService.deployOperator();

Regular user object can be null in case it is not needed. Pull secret can be null in case not needed either.

Opsrc token

The opsrc token needs to be used if quay starts to return 404 pages. It can be obtained by creating a robot account in your namespace (also set the default permissions of the robot). Then to obtain the token encode your : in Base64. This Base64 result needs to be encoded again with the word 'basic' prefixing it.

In example:

  • fuseorg+robot:token123 -> ZnVzZW9yZytyb2JvdDp0b2tlbjEyMw==

  • basic ZnVzZW9yZytyb2JvdDp0b2tlbjEyMw== -> YmFzaWMgWm5WelpXOXlaeXR5YjJKdmREcDBiMnRsYmpFeU13PT0=

  • YmFzaWMgWm5WelpXOXlaeXR5YjJKdmREcDBiMnRsYmpFeU13PT0= is the opsrc token

Cleanup

After everything done it's recommended to clean Operatorsource and it's token:

openShiftService.deleteOpsrcToken();
openShiftService.deleteOperatorSource();
quayService.deleteQuayProject();

Both services are stateful, so it's necessary to use same objects for cleanup.

marketplace-utilities's People

Contributors

apupier avatar avano avatar jsafarik avatar mmajerni avatar mmuzikar 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.