Giter Site home page Giter Site logo

vshn / crossplane-service-broker Goto Github PK

View Code? Open in Web Editor NEW
19.0 13.0 0.0 505 KB

Crossplane Open Service Broker API

Home Page: https://kb.vshn.ch/app-catalog/explanations/crossplane_service_broker.html

License: BSD 3-Clause "New" or "Revised" License

Dockerfile 0.06% Makefile 4.68% Go 87.24% Shell 8.02%
crossplane-service-broker crossplane service-broker redis mariadb vshn-team-schedar vshn-project-ignore

crossplane-service-broker's Introduction

Build Go version Version GitHub downloads Docker image License

Crossplane Service Broker

Open Service Broker API which provisions Redis and MariaDB instances via crossplane.

Documentation

Most of the explanation on how this all works together currently lives in the VSHN Knowledgebase.

Contributing

You'll need:

  • A running kubernetes cluster (minishift, minikube, k3s, ... you name it) with crossplane installed
  • kubectl and kustomize
  • Go development environment
  • Your favorite IDE (with a Go plugin)
  • docker
  • make

These are the most common make targets: build, test, docker-build, run.

Folder structure overview

.
├── cmd
│   └── crossplane-service-broker    # main file
├── deploy
│   └── base                         # deployment files
├── docs                             # antora docs
├── e2e                              # e2e testing files
├── pkg
│   ├── api                          # exposed HTTP API server
│   ├── brokerapi                    # service broker implementation
│   ├── config                       # app config
│   ├── crossplane                   # crossplane service layer
│   ├── integration                  # utilities for integration tests
│   └── reqcontext                   # request context mapping
└── testdata                         # integration testing files

Run the service broker

You can run the operator in different ways:

  1. using make run (provide your own env variables)
  2. using make kind-run (uses KIND to install a cluster in docker and provides its own kubeconfig in testbin/)
  3. using a configuration of your favorite IDE (see below for VSCode example)

Example VSCode run configuration:

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Launch",
      "type": "go",
      "request": "launch",
      "mode": "auto",
      "program": "${workspaceFolder}/cmd/crossplane-service-broker/main.go",
      "env": {
        "KUBECONFIG": "path/to/kubeconfig",
        "OSB_USERNAME": "test",
        "OSB_PASSWORD": "TEST",
        "OSB_SERVICE_IDS": "PROVIDE-SERVICE-UUIDS-HERE",
        "OSB_NAMESPACE": "test",
        "OSB_PLAN_UPDATE_SIZE_RULES": "xsmall>small|xsmall>medium|small>medium"
      },
      "args": []
    }
  ]
}

Run integration tests

"Integration" testing is done using envtest and crossplane's integration test helper.

make integration-test

Example VSCode run configuration (to be able to debug things):

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Integration tests",
      "type": "go",
      "request": "launch",
      "mode": "test",
      "program": "${workspaceFolder}/pkg/brokerapi",
      "env": {
        "KUBEBUILDER_ASSETS": "../../testdata/bin",
        "DEBUG": "true" // optional
      },
      "args": [],
      "buildFlags": "-tags=integration"
    }
  ]
}

Run E2E tests

The e2e tests currently only test if the deployment works. They do not represent a real e2e test as of now but are meant as a base to build upon.

You need node and npm to run the tests, as it runs with DETIK.

To run e2e tests for newer K8s versions run

make e2e-test

To remove the local KIND cluster and other resources, run

make clean

Integration tests

The integration tests aren't very clever yet and will need some improvements to catch issues. They set the boundary at Kubernetes and avoid therefore the need to have a working crossplane installation with all the custom resources necessary set up.

This means that certain kinds of bugs can't be catched (interaction between crossplane provisioner and this code).

All integration tests are currently within the brokerapi package. envtest is used to setup a Kubernetes API server, and an etcd instance. Public CRDs from crossplane are being downloaded on first run, while the CRDs for this service broker are manually copied in and live within testdata/crds/*.syn.tools.yaml.

If tests for CRDs within the syn.tools API group are written, ensure the corresponding CRD definition is within the aforementioned directory.

crossplane-service-broker's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

crossplane-service-broker's Issues

Upstream Authentication Middleware implementation

Summary

As maintainer of this project
I want to rely on upstream code as much as possible
So that I can keep up with upstream changes without unnecessary effort.

Context

We copied parts of the upstream brokerapi code, so that we can implement JWT Bearer Token authentication alongside the Basic Auth scheme.
When doing so, we asked the upstream implementation if they would welcome such an API that is more flexible regarding it's auth middleware: pivotal-cf/brokerapi#158

As they agreed, we like to upstream our implementation and replace ours with the future-upstream one.

Out of Scope

  • Upstream the handling of the JWTs

Further links

Acceptance criteria

Given the code is upstreamed and our implementation is updated
When we run our tests
Then nothing breaks.

Implementation Ideas

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • Update actions/cache action to v4
  • Update actions/checkout action to v4
  • Update actions/setup-go action to v5
  • Update goreleaser/goreleaser-action action to v5
  • Update mikepenz/action-junit-report action to v4
  • Update mikepenz/release-changelog-builder-action action to v4
  • Update module github.com/crossplane/crossplane-runtime to v1
  • Update module github.com/pivotal-cf/brokerapi/v8 to v10
  • Update paambaati/codeclimate-action action to v5
  • 🔐 Create all rate-limited PRs at once 🔐

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

dockerfile
Dockerfile
github-actions
.github/workflows/e2e.yml
  • actions/checkout v3
  • actions/setup-go v3
  • actions/cache v3
  • mikepenz/action-junit-report v3
.github/workflows/lint.yml
  • actions/checkout v3
  • actions/setup-go v3
  • actions/cache v3
.github/workflows/master.yml
  • actions/checkout v3
  • actions/setup-go v3
  • actions/cache v3
.github/workflows/release.yml
  • actions/checkout v3
  • actions/setup-go v3
  • actions/cache v3
  • mikepenz/release-changelog-builder-action v2
  • goreleaser/goreleaser-action v2
.github/workflows/test.yml
  • actions/checkout v3
  • actions/setup-go v3
  • actions/cache v3
  • paambaati/codeclimate-action v3.0.0
gomod
go.mod
  • go 1.16
  • code.cloudfoundry.org/lager v2.0.0+incompatible
  • github.com/crossplane/crossplane v1.6.1
  • github.com/crossplane/crossplane-runtime v0.15.1-0.20211029211307-c72bcdd922eb@c72bcdd922eb
  • github.com/go-logr/zapr v0.4.0
  • github.com/gorilla/mux v1.8.0
  • github.com/hashicorp/go-cleanhttp v0.5.2
  • github.com/pascaldekloe/jwt v1.10.0
  • github.com/pivotal-cf/brokerapi/v8 v8.2.1
  • github.com/prometheus/client_golang v1.12.2
  • github.com/stretchr/testify v1.7.2
  • go.uber.org/zap v1.21.0
npm
e2e/package.json
  • bats 1.7.0

  • Check this box to trigger a request for Renovate to run again on this repository

Implement Async Bindings

Summary

As a service broker user
I want bindings to report an accurate status
So that I can rely on this status to know if a binding is ready and usable

Context

Currently bindings are always done synchronously. Using the accepts_incomplete query parameter a client can allow async bindings. Especially if it takes several minutes for the binding to become ready (e.g. user/grant provisioned) it's helpful to reflect the current state of a binding: https://github.com/openservicebrokerapi/servicebroker/blob/master/spec.md#polling-last-operation-for-service-bindings

https://github.com/openservicebrokerapi/servicebroker/blob/master/spec.md#request-creating-a-service-binding

It's important to still support sync bindings as well since not all clients support async bindings yet.

Out of Scope

  • List aspects that are explicitly not part of this feature

Further links

Acceptance criteria

Given a client specifies accepts_incomplete=true
When a binding is created
Then it's being done in an asynchronous manner and the status is reported

Implementation Ideas

  • Same as the implementation of async instance provisioning
    • Create the Composite instance
    • Poll the composite's status via /last_operation
    • Return credentials once the composite is ready

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.