Implement an operator that will allow creating/editing a github issue.
Please make sure you have a basic understanding of the following concepts before you continue to read.
The kubernetes GithubIssue object must have those fields in its spec:
repo
: to represent the url to the github repo - e.g https://github.com/rgolangh/dotfilestitle
: the title of the issuedescription
: used as the description of the issue
The status field of the object must contain this fields:
conditions
([ ]metav1.Condition
): for each condition make sure to havelastTransitionTimestamp
. Follow those guidelines to describe those conditions:- issue has a PR
- issue is open
- Fetch the object
- Fetch all the github issues of the repository. Find one with the exact title you need:
- If it doesn't exist -> create a github issue with the title and description.
- If it exists -> update the description (if needed).
- Update the k8s status with the real github issue state.
- Implement deletion behaviour: a delete of the k8s object, triggers closing the github issue.
- Tweak the resync period to every 1 minute.
- Store the GitHub token you use in a secret and use it in the code by reading an env variable.
- Add validation in the CRD level - an attempt to create a CRD with malformed 'repo' will fail
- Writing unit tests. Those test cases should pass and cover:
- Failed attempt to create a real github issue
- Failed attempt to update an issue
- Create if issue not exist
- Close issues on delete
This repo contains a go project you can fork it and use it as a template, also you will need:
- GitHub API Interaction for communicating with the GitHub API
- Kind for creating local cluster
- Go your operator should be written in Go
- Kubebuilder for creating the operator and crd template
- Operator-SDK for documentation about controllers and syntax
- Ginkgo for testing