Giter Site home page Giter Site logo

sbawaska / cnab-k8s-installer-base Goto Github PK

View Code? Open in Web Editor NEW

This project forked from projectriff-archive/cnab-k8s-installer-base

0.0 1.0 0.0 7.83 MB

A CNAB bundle that allows creation of other declarative CNAB bundles

License: Apache License 2.0

Shell 1.01% Go 96.20% Makefile 2.30% Dockerfile 0.49%

cnab-k8s-installer-base's Introduction

Build Status codecov

KAB - Kubernetes Application Bundle

A CNAB bundle that allows creation of other declarative CNAB bundles

Background

CNAB is a spec for installing and managing cloud native applications in a cloud agnostic manner.

The spec also has a section about Declarative Invocation Images which states the following:

By providing a run tool (/cnab/app/run), a middleware image can remove the necessity to write the imperative portions of a CNAB bundle, essentially allowing construction of declarative CNAB bundles. In this model, the middleware image provides the tooling necessary for handling CNAB actions. Images layered on top of this middleware merely need to describe what entities are being installed, uninstalled, or upgraded.

This project is an implementation of this "Declarative Invocation Image" for applications that want to target kubernetes as the deployment platform.

Structure of manifest file

This project expects the following structure of the declarative manifest file:

apiVersion: projectriff.io/v1alpha1
kind: Manifest
metadata:
  name: riff-install
  namespace: default
spec:
  resources:
  - name: istio
    path: https://storage.googleapis.com/knative-releases/serving/previous/v0.3.0/istio.yaml
    checks:
    - jsonpath: .status.phase
      kind: Pod
      namespace: istio-system
      pattern: Running
      selector:
        matchLabels:
          istio: sidecar-injector
  - name: riff-build-template
    path: https://storage.googleapis.com/projectriff/riff-buildtemplate/riff-cnb-clusterbuildtemplate-0.2.0-snapshot-ci-63cd05079e1f.yaml

The .spec.resources section expects a list of resources that make up your product. The resource to be installed could either be a url or its contents can be inlined in the manifest. Please see types.go for the complete structure of the manifest.

Resource Dependencies

Please ensure that a resource's dependencies are defined before the resource itself. To ensure that the resource has been successfully installed, you can add a checks section as shown above. The above example check will ensure that the sidecar-injector Pod is running before the next resource is installed. At the moment only Pod checks are supported.

Custom Resource Definition

This base bundle defines a CRD named manifests.projectriff.io, and it will create objects of this CRD for all bundles that extend this bundle. This will allow your product's configuration to be stored in the k8s cluster itself. This project also defines a golang client so that your product's config can be looked up programmatically.

Steps for creating your installer bundle

Install and setup the duffle cli. To bootstrap your project run:

$ duffle create foo

This should create a directory for your project with the following structure:

$ tree
.
├── cnab
│   ├── Dockerfile
│   └── app
│       └── run
└── duffle.json

Change the Dockerfile to extend from the image for this base bundle and to copy your product's installation template to /cnab/app/kab, something like this:

FROM projectriff/cnab-k8s-installer-base:edge

COPY Dockerfile /cnab
COPY app/kab /cnab/app/kab

Finally, create your application's manifest as defined above under app/kab.

Developing

Please refer to the developer's guide.

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.