Giter Club home page Giter Club logo

simple-apb's Introduction

Simple APB

A simple apb example designed to showcase the creation of an apb instanciating ressources in two namespaces.

In this example, we will create a servicemonitor object in a namespace with an operator-deployed prometheus.

The goal is to showcase how an apb can be used to auto register an application with a prometheus in order to gather metrics.

Prerequisites

  • oc client
  • Openshift with a prometheus deployed via the prometheus operator in this scenario, the namespace is named app-monitoring

Scenario

Create a new namespace

oc new-project simple-apb

Allow all namespaces to pull images from the apb namespace

oc adm policy add-role-to-group system:image-puller system:serviceaccounts -n simple-apb 

Build the sample application image in the simple-apb namespace This image is a sample python project that will expose metrics on /metrics with two custom metrics ws_srv_func and ws_srv_is_now_even The source code is available at https://github.com/christophefarges/flask-prometheus-ex

oc create -f sample-image

Configure the ansible-service-broker with the following

  • set the role as admin as we will create a role in the namespace
    openshift:
        ...
        sandbox_role: admin
  • add the following registry to the ansible-service-broker
    registry:
    -   name: localregistry
        namespaces:
        - simple-apb
        type: local_openshift
        white_list:
        - .*-apb

build the apb in this project

oc new-build --binary=true --name simple-apb -n simple-apb

oc start-build --follow --from-dir . simple-apb -n simple-apb

Allow all the serviceaccounts to create servicemonitors objects in the app-monitoring namespace

oc create clusterrole service-monitor-editor --verb=get,create,update,delete --resource=servicemonitors.monitoring.coreos.com -n app-monitoring                                                                                              โŽ
oc adm policy add-cluster-role-to-group service-monitor-editor system:serviceaccounts -n app-monitoring

Create a new simple-apb application from the service catalog, enable the monitoring and specify the namespace where prometheus in running (app-monitoring by default)

License

BSD

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.