Skip to content

dtaniwaki/cluster-lending-manager

Repository files navigation

ClusterLendingManager

Go Reference Coverage Status

ClusterLendingManager is an operator to manage muti-tenant cluster's resources.

Here's a LendingConfig example.

apiVersion: clusterlendingmanager.dtaniwaki.github.com/v1alpha1
kind: LendingConfig
metadata:
  name: lending-config-sample
spec:
  targets:
  - kind: Deployment
    apiVersion: apps/v1
  - kind: Rollout
    apiVersion: argoproj.io/v1alpha1
  timezone: "Asia/Tokyo"
  schedule:
    always: false
    default:
      hours:
      - start: "10:00"
        end: "20:00"
    friday:
      hours:
      - start: "10:00"
        end: "17:00" # Happy Friday!
    saturday:
      hours: [] # Ofcourse, no work!
    sunday:
      hours: [] # Ofcourse, no work!

Prerequisites

Build

Build and load the Docker image to your cluster.

$ make docker-build

# run a command to load the image to your cluster.

If you use a kind cluster, there's a useful shortcut.

$ make kind-load

Deployment

Install the CRD to the cluster.

$ make install

Deploy a controller to the cluster.

$ make deploy

Usage

Now, deploy the samples.

$ make deploy-samples

You will see sample Deployment and deployment in the current context, maybe default depending on your env. The Deployment resource gets updated periodically by the ClusterLendingManager.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Copyright

Copyright (c) 2021 Daisuke Taniwaki. See LICENSE for details.