-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add area-oncall-scheduler-0.16.2-335d634e3ad0875d19d65d9498c376dc3fc2…
…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
1 parent
04cd711
commit b0d86e5
Showing
5 changed files
with
281 additions
and
1 deletion.
There are no files selected for viewing
Binary file added
BIN
+3.83 KB
area-oncall-scheduler-0.16.2-335d634e3ad0875d19d65d9498c376dc3fc225ce.tgz
Binary file not shown.
69 changes: 69 additions & 0 deletions
69
...ll-scheduler-0.16.2-335d634e3ad0875d19d65d9498c376dc3fc225ce.tgz-meta/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
11 changes: 11 additions & 0 deletions
11
area-oncall-scheduler-0.16.2-335d634e3ad0875d19d65d9498c376dc3fc225ce.tgz-meta/main.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
182 changes: 182 additions & 0 deletions
182
...all-scheduler-0.16.2-335d634e3ad0875d19d65d9498c376dc3fc225ce.tgz-meta/values.schema.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters