• Stars
    star
    113
  • Rank 298,979 (Top 7 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created about 4 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Boskos is a resource management service that provides reservation and lifecycle management of a variety of different kinds of resources.

boskos

Background

Ξ²ΞΏΟƒΞΊΟŒΟ‚ - shepherd in greek!

boskos is a resource manager service, that handles and manages different kind of resources and transition between different states.

Introduction

Boskos is inited with a config of resources, a list of resources by names. It's passed in by -config, usually as a config map.

Boskos supports 2 types of resources, static and dynamic resources. Static resources are the one that depends on actual physical resources, meaning someone needs to physically create it, and add it to the list. Dynamic resources may depend on static resources. In the example bellow , aws-account is static resource, and aws-cluster is a dynamic resource that depends on having an aws-account. Once a cluster is created, AWS are in used, so admin might want to always have a minimum cluster available for testing, and might allow for more cluster to be created for spike usage.

---
resources:
  # Static
  - type: "aws-account"
    state: free
    names:
    - "account1"
    - "account2"
  # Dynamic
  - type: "aws-cluster"
    state: dirty
    min-count: 1
    max-count: 2
    lifespan: 48h
    needs:
      aws-account: 1
    config:
      type: AWSClusterCreator
      content: "..."

Type can be GCPProject, cluster, or even a dota2 server, anything that you want to be a group of resources. Name is a unique identifier of the resource. State is a string that tells the current status of the resource.

User Data is here for customization. In Mason as an example, we create new resources from existing ones (creating a cluster inside a GCP project), but in order to acquire the right resources, we need to store some information in the final resource UserData. It is up to the implementation to parse the string into the right struct. UserData can be updated using the update API call. All resource user data is returned as part of acquisition (calling acquire or acquirebystate)

Dynamic Resources

As explain in the introduction, dynamic resources were introduced to reduce cost.

If all resources are currently being used, and the count of resources is bellow Max, boskos will create new resources on Acquire. In order to take advantage of this, users need to specify a request ID in Acquire and keep using the same requestID until the resource is available.

Boskos will take care of naming and creating resources (if the current count is below min-count) and deleting the resources if they are expired (lifetime option) or over max-count.

All resource being deleted (due to config update or expiration) will be marked as ToBeDeleted. The cleaner component will mark them as Tombstone such that they can be safely deleted by Boskos. The cleaner will ensure that dynamic resources release other leased resources associated with it to prevent leaks.

API

POST /acquire

Use /acquire when you want to get hold of some resource.

Required Parameters

Name Type Description
type string type of requested resource
state string current state of the requested resource
dest string destination state of the requested resource
owner string requester of the resource

Optional Parameters

Name Type Description
request_id string request id to use to keep your priority rank

Example: /acquire?type=gce-project&state=free&dest=busy&owner=user.

On a successful request, /acquire will return HTTP 200 and a valid Resource JSON object.

POST /acquirebystate

Use /acquirebystate when you want to get hold of a set of resources in a given state.

Required Parameters

Name Type Description
state string current state of the requested resource
dest string destination state of the requested resource
owner string requester of the resource
names string comma separated list of resource names

Example: /acquirebystate?state=free&dest=busy&owner=user&names=res1,res2.

On a successful request, /acquirebystate will return HTTP 200 and a valid list of Resources JSON object.

POST /release

Use /release when you finish use some resource. Owner need to match current owner.

Required Parameters

Name Type Description
name string name of finished resource
owner string owner of the resource
dest string destination state of the released resource

Example: /release?name=k8s-jkns-foo&dest=dirty&owner=user

POST /update

Use /update to update resource last-update timestamp. Owner need to match current owner.

Required Parameters

Name Type Description
name string name of target resource
owner string owner of the resource
state string current state of the resource

Optional Parameters

In order to update user data, just marshall the user data into the request body.

Example: /update?name=k8s-jkns-foo&state=free&owner=user

POST /reset

Use /reset to reset a group of expired resource to certain state.

Required Parameters

Name Type Description
type string type of resource in interest
state string current state of the expired resource
dest string destination state of the expired resource
expire durationStr resource has not been updated since before expire

Note: durationStr is any string can be parsed by time.ParseDuration()

On a successful request, /reset will return HTTP 200 and a list of [Owner:Resource] pairs, which can be unmarshalled into map[string]string{}

Example: /reset?type=gce-project&state=busy&dest=dirty&expire=20m

GET /metric

Use /metric to retrieve a metric.

Required Parameters

Name Type Description
type string type of requested resource

On a successful request, /metric will return HTTP 200 and a JSON object containing the count of projects in each state, the count of projects with each owner (or without an owner), and the sum of state moved to after /done (Todo). A sample object will look like:

{
        "type" : "project",
        "Current":
        {
                "total"   : 35,
                "free"    : 20,
                "dirty"   : 10,
                "injured" : 5
        },
        "Owners":
        {
                "fejta" : 1,
                "Senlu" : 1,
                "sig-testing" : 20,
                "Janitor" : 10,
                "None" : 20
        }
}

Config update:

  1. Edit resources.yaml, and send a PR.

  2. After PR is LG'd, make sure your branch is synced up with master.

  3. run make update-config to update the configmap.

  4. Boskos updates its config every 10min. Newly added resources will be available after next update cycle. Newly deleted resource will be removed in a future update cycle if the resource is not owned by any user.

Other Components:

Reaper looks for resources that owned by someone, but have not been updated for a period of time, and reset the stale resources to dirty state for the Janitor component to pick up. It will prevent state leaks if a client process is killed unexpectedly.

Janitor looks for dirty resources from boskos, and will kick off sub-janitor process to clean up the resource, finally return them back to boskos in a free state.

Metrics is a separate service, which can display json metric results, and has HTTP endpoint opened for prometheus monitoring.

Mason updates virtual resources with existing resources. An example would be a cluster. In order to create a GKE cluster you need a GCP Project. Mason will look for specific resources and release leased resources as dirty (such that Janitor can pick it up) and ask for brand new resources in order to convert them in the final resource states. Mason comes with its own client to ease usage. The mason client takes care of acquiring and release all the right resources from the User Data information.

Cleaner Mark resource with status ToBeDeleted as Tombstone such they can be safely deleted by Boskos. This is important for dynamic resources such that all associated resources can be released before deletion to prevent leak.

Storage There could be multiple implementation on how resources and mason config are stored. Since we have multiple components with storage needs, we have now shared storage implementation. In memory and in Cluster via k8s custom resource definition.

crds General client library to store data on k8s custom resource definition. In theory those could be use outside of Boskos.

For the boskos server that handles k8s e2e jobs, the status is available from the Prow monitoring dashboard

Adding UserData to a resource

  1. Check it out:

    curl -X POST "http://localhost:8080/acquire?type=my-resource&state=free&dest=busy&owner=$(whoami)"
    {"type":"my-resource","name":"resource1","state":"busy","owner":"user","lastupdate":"2019-02-07T22:33:38.01350902Z","userdata":null}
  2. Add the data:

    curl -X POST -d '{"access-key-id":"17","secret-access-key":"18"}' "http://localhost:8080/update?name=resource1&state=busy&owner=$(whoami)"
  3. Check it back in:

    curl -X POST 'http://localhost:8080/release?name=liz2&dest=free&owner=user'

Local test:

  1. Start boskos with a fake config.yaml, with go run boskos.go -in_memory -config=/path/to/config.yaml

  2. Sent some local requests to boskos:

curl 'http://127.0.0.1:8080/acquire?type=project&state=free&dest=busy&owner=user'

K8s test:

  1. Create and navigate to your own cluster

  2. make server-deployment

  3. make service

  4. kubectl create configmap -n test-pods resources --from-file=config=cfg.yaml See boskos-resources.yaml for an example of how the config file should look

  5. kubectl describe svc -n test-pods boskos to make sure boskos is running

  6. Test from another pod within the cluster

kubectl run curl --image=radial/busyboxplus:curl -i --tty
Waiting for pod default/curl-XXXXX to be running, status is Pending, pod ready: false
If you don't see a command prompt, try pressing enter.
[ root@curl-XXXXX:/ ]$ curl -X POST 'http://boskos.test-pods.svc.cluster.local/acquire?type=project&state=free&dest=busy&owner=user'

Community, discussion, contribution, and support

Learn how to engage with the Kubernetes community on the community page.

You can reach the maintainers of this project at:

Code of conduct

Participation in the Kubernetes community is governed by the Kubernetes Code of Conduct.

More Repositories

1

kubespray

Deploy a Production Ready Kubernetes Cluster
Jinja
14,679
star
2

kind

Kubernetes IN Docker - local clusters for testing Kubernetes
Go
12,623
star
3

kustomize

Customization of kubernetes YAML configurations
Go
10,363
star
4

kubebuilder

Kubebuilder - SDK for building Kubernetes APIs using CRDs
Go
7,298
star
5

external-dns

Configure external DNS servers (AWS Route53, Google CloudDNS and others) for Kubernetes Ingresses and Services
Go
6,672
star
6

krew

πŸ“¦ Find and install kubectl plugins
Go
6,009
star
7

metrics-server

Scalable and efficient source of container resource metrics for Kubernetes built-in autoscaling pipelines.
Go
4,761
star
8

aws-load-balancer-controller

A Kubernetes controller for Elastic Load Balancers
Go
3,703
star
9

descheduler

Descheduler for Kubernetes
Go
3,444
star
10

cluster-api

Home for Cluster API, a subproject of sig-cluster-lifecycle
Go
2,944
star
11

kui

A hybrid command-line/UI development experience for cloud-native development
TypeScript
2,701
star
12

nfs-subdir-external-provisioner

Dynamic sub-dir volume provisioner on a remote NFS server.
Shell
2,244
star
13

controller-runtime

Repo for the controller-runtime subproject of kubebuilder (sig-apimachinery)
Go
2,240
star
14

kwok

Kubernetes WithOut Kubelet - Simulates thousands of Nodes and Clusters.
Go
2,182
star
15

aws-iam-authenticator

A tool to use AWS IAM credentials to authenticate to a Kubernetes cluster
Go
2,008
star
16

prometheus-adapter

An implementation of the custom.metrics.k8s.io API using Prometheus
Go
1,662
star
17

gateway-api

Repository for the next iteration of composite service (e.g. Ingress) and load balancing APIs.
Go
1,452
star
18

cri-tools

CLI and validation tools for Kubelet Container Runtime Interface (CRI) .
Go
1,333
star
19

secrets-store-csi-driver

Secrets Store CSI driver for Kubernetes secrets - Integrates secrets stores with Kubernetes via a CSI volume.
Go
1,139
star
20

kueue

Kubernetes-native Job Queueing
Go
986
star
21

sig-storage-local-static-provisioner

Static provisioner of local volumes
Go
973
star
22

scheduler-plugins

Repository for out-of-tree scheduler plugins based on scheduler framework.
Go
957
star
23

aws-ebs-csi-driver

CSI driver for Amazon EBS https://aws.amazon.com/ebs/
Go
883
star
24

apiserver-builder-alpha

apiserver-builder-alpha implements libraries and tools to quickly and easily build Kubernetes apiservers/controllers to support custom resource types based on APIServer Aggregation
Go
764
star
25

etcdadm

Go
748
star
26

kube-scheduler-simulator

The simulator for the Kubernetes scheduler
Go
706
star
27

aws-efs-csi-driver

CSI Driver for Amazon EFS https://aws.amazon.com/efs/
Go
668
star
28

controller-tools

Tools to use with the controller-runtime libraries
Go
655
star
29

krew-index

Plugin index for https://github.com/kubernetes-sigs/krew. This repo is for plugin maintainers.
624
star
30

security-profiles-operator

The Kubernetes Security Profiles Operator
C
622
star
31

node-feature-discovery

Node feature discovery for Kubernetes
Go
595
star
32

cluster-api-provider-aws

Kubernetes Cluster API Provider AWS provides consistent deployment and day 2 operations of "self-managed" and EKS Kubernetes clusters on AWS.
Go
592
star
33

hierarchical-namespaces

Home of the Hierarchical Namespace Controller (HNC). Adds hierarchical policies and delegated creation to Kubernetes namespaces for improved in-cluster multitenancy.
Go
532
star
34

cluster-proportional-autoscaler

Kubernetes Cluster Proportional Autoscaler Container
Go
519
star
35

sig-storage-lib-external-provisioner

Go
502
star
36

alibaba-cloud-csi-driver

CSI Plugin for Kubernetes, Support Alibaba Cloud EBS/NAS/OSS/CPFS/LVM.
Go
500
star
37

application

Application metadata descriptor CRD
Go
488
star
38

custom-metrics-apiserver

Framework for implementing custom metrics support for Kubernetes
Go
457
star
39

e2e-framework

A Go framework for end-to-end testing of components running in Kubernetes clusters.
Go
395
star
40

cluster-capacity

Cluster capacity analysis
Go
390
star
41

nfs-ganesha-server-and-external-provisioner

NFS Ganesha Server and Volume Provisioner.
Shell
384
star
42

apiserver-network-proxy

Go
344
star
43

cluster-api-provider-vsphere

Go
339
star
44

image-builder

Tools for building Kubernetes disk images
Shell
325
star
45

kubetest2

Kubetest2 is the framework for launching and running end-to-end tests on Kubernetes.
Go
312
star
46

cluster-api-provider-nested

Cluster API Provider for Nested Clusters
Go
289
star
47

cluster-api-provider-azure

Cluster API implementation for Microsoft Azure
Go
283
star
48

bom

A utility to generate SPDX-compliant Bill of Materials manifests
Go
279
star
49

vsphere-csi-driver

vSphere storage Container Storage Interface (CSI) plugin
Go
278
star
50

cluster-api-provider-openstack

Go
255
star
51

karpenter

Karpenter is a Kubernetes Node Autoscaler built for flexibility, performance, and simplicity.
Go
255
star
52

kubebuilder-declarative-pattern

A toolkit for building declarative operators with kubebuilder
Go
242
star
53

kpng

Reworking kube-proxy's architecture
Go
235
star
54

ingress2gateway

Convert Ingress resources to Gateway API resources
Go
225
star
55

cloud-provider-azure

Cloud provider for Azure
Go
222
star
56

blixt

Layer 4 Kubernetes load-balancer
Rust
220
star
57

aws-encryption-provider

APIServer encryption provider, backed by AWS KMS
Go
192
star
58

mcs-api

This repository hosts the Multi-Cluster Service APIs. Providers can import packages in this repo to ensure their multi-cluster service controller implementations will be compatible with MCS data planes.
Go
184
star
59

ip-masq-agent

Manage IP masquerade on nodes
Go
180
star
60

zeitgeist

Zeitgeist: the language-agnostic dependency checker
Go
168
star
61

cluster-api-provider-gcp

The GCP provider implementation for Cluster API
Go
165
star
62

contributor-playground

Dockerfile
163
star
63

cluster-addons

Addon operators for Kubernetes clusters.
Go
153
star
64

gcp-compute-persistent-disk-csi-driver

The Google Compute Engine Persistent Disk (GCE PD) Container Storage Interface (CSI) Storage Plugin.
Go
151
star
65

azurefile-csi-driver

Azure File CSI Driver
Go
145
star
66

promo-tools

Container and file artifact promotion tooling for the Kubernetes project
Go
136
star
67

cli-utils

This repo contains binaries that built from libraries in cli-runtime.
Go
134
star
68

azuredisk-csi-driver

Azure Disk CSI Driver
Go
132
star
69

kube-storage-version-migrator

Go
125
star
70

blob-csi-driver

Azure Blob Storage CSI driver
Go
116
star
71

usage-metrics-collector

High fidelity and scalable capacity and usage metrics for Kubernetes clusters
Go
116
star
72

aws-fsx-csi-driver

CSI Driver of Amazon FSx for Lustre https://aws.amazon.com/fsx/lustre/
Go
115
star
73

downloadkubernetes

Download kubernetes binaries more easily
Go
110
star
74

sig-windows-tools

Repository for tools and artifacts related to the sig-windows charter in Kubernetes. Scripts to assist kubeadm and wincat and flannel will be hosted here.
PowerShell
108
star
75

cluster-api-operator

Home for Cluster API Operator, a subproject of sig-cluster-lifecycle
Go
107
star
76

cluster-api-provider-digitalocean

The DigitalOcean provider implementation of the Cluster Management API
Go
106
star
77

cluster-api-provider-kubevirt

Cluster API Provider for KubeVirt
Go
96
star
78

cluster-api-provider-packet

Cluster API Provider Packet (now Equinix Metal)
Go
94
star
79

structured-merge-diff

Test cases and implementation for "server-side apply"
Go
92
star
80

slack-infra

Tooling for kubernetes.slack.com
Go
90
star
81

dashboard-metrics-scraper

Container to scrape, store, and retrieve a window of time from the Metrics Server.
Go
84
star
82

apiserver-runtime

Libraries for implementing aggregated apiservers
Go
81
star
83

cli-experimental

Experimental Kubectl libraries and commands.
Go
79
star
84

lwkd

Last Week in Kubernetes Development
HTML
78
star
85

gcp-filestore-csi-driver

The Google Cloud Filestore Container Storage Interface (CSI) Plugin.
Go
78
star
86

kube-scheduler-wasm-extension

All the things to make the scheduler extendable with wasm.
Go
77
star
87

container-object-storage-interface-controller

Container Object Storage Interface (COSI) controller responsible to manage lifecycle of COSI objects.
Go
74
star
88

jobset

JobSet: An API for managing a group of Jobs as a unit
Go
73
star
89

sig-windows-dev-tools

This is a batteries included local development environment for Kubernetes on Windows.
PowerShell
73
star
90

cluster-api-addon-provider-helm

Cluster API Add-on Provider for Helm is a extends the functionality of Cluster API by providing a solution for managing the installation, configuration, upgrade, and deletion of Cluster add-ons using Helm charts.
Go
70
star
91

cloud-provider-equinix-metal

Kubernetes Cloud Provider for Equinix Metal (formerly Packet Cloud Controller Manager)
Go
70
star
92

kernel-module-management

The kernel module management operator builds, signs and loads kernel modules in Kubernetes clusters..
Go
70
star
93

reference-docs

Tools to build reference documentation for Kubernetes APIs and CLIs.
HTML
69
star
94

cluster-api-provider-ibmcloud

Cluster API Provider for IBM Cloud
Go
59
star
95

community-images

kubectl plugin that displays images running in a Kubernetes cluster that were pulled from community owned repositories and warn the user to switch repositories if needed
Go
58
star
96

wg-policy-prototypes

A place for policy work group related proposals and prototypes.
Go
58
star
97

container-object-storage-interface-spec

Container Object Storage (COSI) Specification
Shell
57
star
98

container-object-storage-interface-api

Container Object Storage Interface (COSI) API responsible to define API for COSI objects.
Go
55
star
99

lws

LeaderWorkerSet: An API for deploying a group of pods as a unit of replication
Go
55
star
100

kubectl-validate

Go
54
star