- Kubernetes: v1.14.8
- Etcd: v3.2.26
https://github.com/kubernetes-incubator/kube-aws/releases/tag/v0.14.2
package leaderelection | |
import ( | |
"context" | |
"time" | |
coordinationv1 "k8s.io/api/coordination/v1" | |
"k8s.io/apimachinery/pkg/api/errors" | |
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | |
"k8s.io/apimachinery/pkg/util/wait" |
https://github.com/kubernetes-incubator/kube-aws/releases/tag/v0.14.2
git remote add upstream https://github.com/foo/bar.git
git fetch upstream
git checkout master
git merge --ff upstream/master
git push origin master
>ライブラリやツールなど、自分以外の人間が「ユーザ」となる開発では、その Interface / Experience が重要であり、生産性や開発の楽しさにも直結します。本セッションでは、自身のこれまでの経験・まわりからのフィードバックから集めた、Developer にとってより良い Interface / Experience なライブラリ・ツールを作るための Tips や考え方を紹介します。
// from: https://github.com/kubernetes/kubernetes/blob/87f9429087d4e31201412548517d36e83abebc8d/pkg/controller/cronjob/utils.go#L89-L149 | |
// getRecentUnmetScheduleTimes gets a slice of times (from oldest to latest) that have passed when a Job should have started but did not. | |
// | |
// If there are too many (>100) unstarted times, just give up and return an empty slice. | |
// If there were missed times prior to the last known start time, then those are not returned. | |
func getRecentUnmetScheduleTimes(sj batchv1beta1.CronJob, now time.Time) ([]time.Time, error) { | |
starts := []time.Time{} | |
sched, err := cron.ParseStandard(sj.Spec.Schedule) | |
if err != nil { |
// from: https://github.com/kubernetes/kubernetes/blob/87f9429087d4e31201412548517d36e83abebc8d/pkg/controller/cronjob/cronjob_controller.go#L248-L261 | |
times, err := getRecentUnmetScheduleTimes(*sj, now) | |
if err != nil { | |
recorder.Eventf(sj, v1.EventTypeWarning, "FailedNeedsStart", "Cannot determine if job needs to be started: %v", err) | |
klog.Errorf("Cannot determine if %s needs to be started: %v", nameForLog, err) | |
return | |
} | |
// TODO: handle multiple unmet start times, from oldest to newest, updating status as needed. | |
if len(times) == 0 { |