$ kubebuilder init --domain johnliu55.tw --repo johnliu55.tw/todo
$ kubebuilder create api --group todo --version v1 --kind Todo
- Create Resource: y
- Create Controller: y
Edit todo/api/v1/todo_types.go
type TodoSpec struct {
Summary string `json:"summary"`
Complete bool `json:"complete"`
NotifyEmail string `json:"notifyEmail,omitempty"`
NotifyAt *metav1.Time `json:"notifyAt,omitempty"`
}
type TodoStatus struct {
Notified bool `json:"notified"`
}
- Edit
todo/config/samples/todo_v1_todo.yaml
- Test it:
$ kubectl apply -f todo/config/samples/todo_v1_todo.yaml
TODO:
- Notification job failed
- Schedule too close
State Machine
- Updated
- ShouldSchedule
- ShouldNotify
- Notifying
- Notified
- ERROR!!!