Skip to content

Commit

Permalink
Improvement: Documentation (#42)
Browse files Browse the repository at this point in the history
* Updated docs

* This is the most of it

* kscale to nightscaler

* fix shields

* Update README.md

Co-authored-by: Peter Brøndum <[email protected]>

---------

Co-authored-by: Peter Brøndum <[email protected]>
  • Loading branch information
OrKarstoft and brondum authored May 22, 2024
1 parent 35ce237 commit ec953f4
Showing 1 changed file with 58 additions and 1 deletion.
59 changes: 58 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,69 @@
# Nightscaler

![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/bestseller/nightscaler?sort=semver&style=flat-square)
![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/bestseller/nightscaler?style=flat-square)

Nightscaler is an application designed to annotate Kubernetes namespaces based
on Pub/Sub messages. It serves as an extension to [kube-downscaler](https://codeberg.org/hjacobs/kube-downscaler), providing
additional functionality for managing forced-uptime periods within namespaces.

## Overview

Kubernetes clusters often utilize kube-downscaler to scale down namespaces and
conserve resources. However, this scaling-down process can render services
within a namespace temporarily inaccessible. Nightscaler addresses this
limitation by enabling the annotation of forced-uptime periods, instructing
kube-downscaler to scale up the affected namespaces during specific time frames.

## Features

- Annotations based on Pub/Sub messages: Nightscaler listens for Pub/Sub
messages and expects specific attributes (`action`, `namespace`, `cluster`,
and `duration`) to be present in each message.
- Forced-uptime annotations: When a relevant Pub/Sub message is received,
nightscaler adds an annotation to the targeted namespace, specifying a
forced-uptime period using the `downscaler/force-uptime` key-value pair.
- Integration with kube-downscaler: The annotations created by nightscaler
trigger kube-downscaler to scale up the namespace during the annotated
forced-uptime period, ensuring the availability of services.

## Getting Started

### Prerequisites

- Kubernetes cluster
- Google Cloud Pub/Sub
- Service Account with Pub/Sub permissions and Workload Identity enabled
- Helm

### Installation

To be added.

## Running locally

First you need to start the Pub/Sub emulator, to do so have a look at the [.hack](./.hack/README.md) folder.
First you need to start the Pub/Sub emulator, to do so have a look at the
[.hack](./.hack/README.md) folder.

```shell
export PUBSUB_PROJECT_ID=es-standalone-cb21
export PUBSUB_EMULATOR_HOST=localhost:8085

go run .
```

### Usage

1. Create an interface (e.g., a website) that allows users to trigger actions
that require forced-uptime periods.
2. Configure the interface to send Pub/Sub messages with the required attributes
(action, namespace, cluster, and duration) to the nightscaler application.
3. Nightscaler will receive the Pub/Sub messages, process them, and add
annotations to the specified namespaces accordingly.
4. kube-downscaler will respond to the annotations created by nightscaler,
scaling up the namespaces during the forced-uptime periods.

## Contributing

Contributions are welcome! If you have any ideas, suggestions, or bug reports,
please open an issue or submit a pull request.

0 comments on commit ec953f4

Please sign in to comment.