webhosting-operator

module
v0.0.0-...-5a141c6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2023 License: Apache-2.0

README

webhosting-operator

webhosting-operator is a simple operator developed using kubebuilder. It is built for demonstrating and evaluating the implemented sharding design for Kubernetes controllers.

Sample Operator Requirements

To demonstrate and evaluate the proposed sharding design, an operator is needed that fulfills the following requirements:

  • it should be composed of a single controller for one (custom) resource
  • in addition to watching its own resources, it needs to watch other relevant objects (e.g. owned objects) as well
    • sharding is more difficult here, so add it as a challenge
  • it needs to deal with cluster-scoped objects (that are relevant for multiple namespaced objects)
    • this adds side effects (duplicated cache) which need to be taken care of

Idea / Introduction

The idea behind this operator is simple: we want to build a web hosting platform on top of Kubernetes. This means we want to be able to configure websites for our customers in a declarative manner. The desired state is configured via Kubernetes (custom) resources and the operator takes care to spin up websites and expose them.

There are three resources involved:

  • Namespace
    • each customer project gets its own namespace
  • Theme (webhosting.timebertt.dev, cluster-scoped)
    • represents an offered theme for customer websites (managed by service admin)
    • configures a font family and color for websites
  • Website (webhosting.timebertt.dev, namespaced)
    • represents a single website a customer orders (managed by the customer in a project namespace)
    • website simply displays the website's name (static)
    • each website references exactly one theme
    • deploys and configures a simple nginx deployment
    • exposes the website via service and ingress

Setup

To test controller sharding with the webhosting-operator as an example controller, follow this guide.

Directories

Path Synopsis
cmd
pkg
apis/config/v1alpha1
Package v1alpha1 contains API Schema definitions for the config v1alpha1 API group +kubebuilder:object:generate=true +groupName=config.webhosting.timebertt.dev
Package v1alpha1 contains API Schema definitions for the config v1alpha1 API group +kubebuilder:object:generate=true +groupName=config.webhosting.timebertt.dev
apis/webhosting/v1alpha1
Package v1alpha1 contains API Schema definitions for the webhosting v1alpha1 API group +kubebuilder:object:generate=true +groupName=webhosting.timebertt.dev
Package v1alpha1 contains API Schema definitions for the webhosting v1alpha1 API group +kubebuilder:object:generate=true +groupName=webhosting.timebertt.dev
experiment/scenario/all
Package all imports all scenarios.
Package all imports all scenarios.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL