Skip to content

Commit

Permalink
add area-oncall-scheduler-0.16.2-335d634e3ad0875d19d65d9498c376dc3fc2…
Browse files Browse the repository at this point in the history
…25ce.tgz

area-oncall-scheduler-0.16.2-335d634e3ad0875d19d65d9498c376dc3fc225ce.tgz-meta/README.md
area-oncall-scheduler-0.16.2-335d634e3ad0875d19d65d9498c376dc3fc225ce.tgz-meta/main.yaml
area-oncall-scheduler-0.16.2-335d634e3ad0875d19d65d9498c376dc3fc225ce.tgz-meta/values.schema.json
  • Loading branch information
catalogbot committed Oct 31, 2024
1 parent 04cd711 commit b0d86e5
Show file tree
Hide file tree
Showing 5 changed files with 281 additions and 1 deletion.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
[![CircleCI](https://circleci.com/gh/giantswarm/area-oncall-scheduler/tree/master.svg?style=svg)](https://circleci.com/gh/giantswarm/area-oncall-scheduler/tree/master)

# Area on-call shift scheduler

This project is meant to automatically schedule on-call shifts according to a set of rules.
The rules are hardcoded for `cloud-kaas` area, but it should be modular enough to allow full configurability
and to be used by any area or team. See the `How does it work?` section below for technical details.

To simulate scheduling for a range of dates, run:

```
go run main.go
--start 2021-08-01 \
--end 2021-08-01 \
--scheduler-opsgenie-api-key dbb7ac1b-... \
--scheduler-opsgenie-schedule-name cloud_kaas_schedule \
--scheduler-opsgenie-rotation-id da8b2f62-... \
-v 3 \
--logtostderr=true \
--unavailability-strategies=AFK \
--unavailability-afk-google-calendar-id=giantswarm.io_...@group.calendar.google.com \
--unavailability-afk-allow-nightshift-pattern '(^|[\s:\-[(])(P32|p32)([\s:\-\])]|$)' \
--unavailability-strategies=ConsecutiveWeekends \
--unavailability-consecutive-weekends-cooldown-count=2 \
--unavailability-consecutive-weekends-include-fridays=false \
--unavailability-strategies=MinWait \
--unavailability-minwait-user-config [email protected]:12 \
--prioritizers=lastshift:1 \
--notifiers=oncallcalendar \
--notifier-oncallcalendar-google-calendar-id=c_g1...@group.calendar.google.com \
--notifier-oncallcalendar-impersonation-user-email=user@giantswarm.io \
--notifiers=slack \
--notifier-slack-token=xoxb-... \
--notifier-slack-channel-id=XXXXXXX \
```

To apply the shifts to opsgenie, add the `--write` flag

## How does it work?

This project uses interfaces to abstract business logic. The building blocks are:

- `Schedulers`: this is an abstraction over an external shift management tool. The goal of this interface is to
have knowledge about who is in the rotation, when everybody's last shift was and to schedule shifts.
The only implementation so far uses `Opsgenie` as a backend.
See `docs/schedulers` for more details.
- `Unavailability`: this interface defines an abstraction over reasons why one person should not be scheduled in a given date.
There are a few implementations fo this interface. One example is the `AFK` calendar that connects to Google Calendar and
considers a person unavailable for oncall on a specific date if there is a calendar event starting which title start
with the person's name.
See `docs/unavailability` for more details.
- `Priority`: this interface makes it possible to rank available engineers in order of priority to be able to choose
who should be scheduled on a given date. The only implementation considers the number of days since last shift as
the priority.
See `docs/priority` for more details.
- `Notifier`: this interface allows sending oncallers informations about their shifts. It can be a message, the creation
of a calendar entry or anything else.
See `docs/notifier` for more details.

This is a diagram that describe the above interfaces and their interactions:

![Block diagram](diagram.png?raw=true "Block diagram")

1. Get a list of members of the rotation from Opsgenie
2. Apply `unavailability strategies` to check which users are available for the shift
3. Apply the `priority strategies` among available users to rank people according to scheduling rules
4. Write shift override to Opsgenie
5. Add entry in the area oncall calendar (through a `Notifier`)
6. Generate Report about the shift.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
annotations:
application.giantswarm.io/metadata: https://giantswarm.github.io/giantswarm-operations-platform-test-catalog/area-oncall-scheduler-0.16.2-335d634e3ad0875d19d65d9498c376dc3fc225ce.tgz-meta/main.yaml
application.giantswarm.io/readme: https://giantswarm.github.io/giantswarm-operations-platform-test-catalog/area-oncall-scheduler-0.16.2-335d634e3ad0875d19d65d9498c376dc3fc225ce.tgz-meta/README.md
application.giantswarm.io/team: phoenix
application.giantswarm.io/values-schema: https://giantswarm.github.io/giantswarm-operations-platform-test-catalog/area-oncall-scheduler-0.16.2-335d634e3ad0875d19d65d9498c376dc3fc225ce.tgz-meta/values.schema.json
chartApiVersion: v2
chartFile: area-oncall-scheduler-0.16.2-335d634e3ad0875d19d65d9498c376dc3fc225ce.tgz
dateCreated: '2024-10-31T22:41:49.372535Z'
digest: 693ac08d41f2bd3a1a81e4002faa42d8bec7a3f4b318bba5b100ceaebff842eb
home: https://github.com/giantswarm/area-oncall-scheduler
icon: https://s.giantswarm.io/app-icons/giantswarm/1/dark.svg
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
{
"$schema": "http://json-schema.org/schema#",
"type": "object",
"properties": {
"BackoffLimit": {
"type": "integer"
},
"Cronjobs": {
"type": "array",
"items": {
"type": "object",
"properties": {
"EndDateCmd": {
"type": "string"
},
"Schedule": {
"type": "string"
},
"StartDateCmd": {
"type": "string"
},
"Suspend": {
"type": "boolean"
}
}
}
},
"Flags": {
"type": "array",
"items": {
"type": "string"
}
},
"Installation": {
"type": "object",
"properties": {
"V1": {
"type": "object",
"properties": {
"Registry": {
"type": "object",
"properties": {
"Domain": {
"type": "string"
}
}
}
}
}
}
},
"Resources": {
"type": "object",
"properties": {
"limits": {
"type": "object",
"properties": {
"cpu": {
"type": "string"
},
"memory": {
"type": "string"
}
}
},
"requests": {
"type": "object",
"properties": {
"cpu": {
"type": "string"
},
"memory": {
"type": "string"
}
}
}
}
},
"Secrets": {
"type": "array",
"items": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"key": {
"type": "string"
},
"value": {
"type": "string"
}
}
}
},
"name": {
"type": "string"
}
}
}
},
"SuspendAll": {
"type": "boolean"
},
"VolumeMounts": {
"type": "array",
"items": {
"type": "object",
"properties": {
"mountPath": {
"type": "string"
},
"name": {
"type": "string"
},
"subPath": {
"type": "string"
}
}
}
},
"Volumes": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"secret": {
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"key": {
"type": "string"
},
"path": {
"type": "string"
}
}
}
},
"secretName": {
"type": "string"
}
}
}
}
}
},
"global": {
"type": "object",
"properties": {
"podSecurityStandards": {
"type": "object",
"properties": {
"enforced": {
"type": "boolean"
}
}
}
}
},
"image": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"tag": {
"type": "null"
}
}
}
}
}
20 changes: 19 additions & 1 deletion index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,24 @@ entries:
urls:
- https://giantswarm.github.io/giantswarm-operations-platform-test-catalog/area-oncall-scheduler-0.16.2.tgz
version: 0.16.2
- annotations:
application.giantswarm.io/metadata: https://giantswarm.github.io/giantswarm-operations-platform-test-catalog/area-oncall-scheduler-0.16.2-335d634e3ad0875d19d65d9498c376dc3fc225ce.tgz-meta/main.yaml
application.giantswarm.io/readme: https://giantswarm.github.io/giantswarm-operations-platform-test-catalog/area-oncall-scheduler-0.16.2-335d634e3ad0875d19d65d9498c376dc3fc225ce.tgz-meta/README.md
application.giantswarm.io/team: phoenix
application.giantswarm.io/values-schema: https://giantswarm.github.io/giantswarm-operations-platform-test-catalog/area-oncall-scheduler-0.16.2-335d634e3ad0875d19d65d9498c376dc3fc225ce.tgz-meta/values.schema.json
apiVersion: v2
appVersion: 0.16.2-335d634e3ad0875d19d65d9498c376dc3fc225ce
created: "2024-10-31T22:41:51.497089815Z"
description: A Helm chart for area-oncall-scheduler
digest: 693ac08d41f2bd3a1a81e4002faa42d8bec7a3f4b318bba5b100ceaebff842eb
home: https://github.com/giantswarm/area-oncall-scheduler
icon: https://s.giantswarm.io/app-icons/giantswarm/1/dark.svg
name: area-oncall-scheduler
sources:
- https://github.com/giantswarm/area-oncall-scheduler
urls:
- https://giantswarm.github.io/giantswarm-operations-platform-test-catalog/area-oncall-scheduler-0.16.2-335d634e3ad0875d19d65d9498c376dc3fc225ce.tgz
version: 0.16.2-335d634e3ad0875d19d65d9498c376dc3fc225ce
- annotations:
application.giantswarm.io/metadata: https://giantswarm.github.io/giantswarm-operations-platform-test-catalog/area-oncall-scheduler-0.16.1.tgz-meta/main.yaml
application.giantswarm.io/readme: https://giantswarm.github.io/giantswarm-operations-platform-test-catalog/area-oncall-scheduler-0.16.1.tgz-meta/README.md
Expand Down Expand Up @@ -13009,4 +13027,4 @@ entries:
urls:
- https://giantswarm.github.io/giantswarm-operations-platform-test-catalog/web-assets-app-0.12.0-46217536c43528ae0b7258e7d339dbd12921fc3b.tgz
version: 0.12.0-46217536c43528ae0b7258e7d339dbd12921fc3b
generated: "2024-10-31T19:21:46.571489811Z"
generated: "2024-10-31T22:41:51.496354827Z"

0 comments on commit b0d86e5

Please sign in to comment.