2020-09-16 14:19:51 +00:00
|
|
|
// Copyright 2020 the Pinniped contributors. All Rights Reserved.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
2020-07-06 18:40:48 +00:00
|
|
|
|
2020-07-03 00:05:59 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2020-07-08 17:06:44 +00:00
|
|
|
"os"
|
2020-09-08 16:29:34 +00:00
|
|
|
"time"
|
2020-07-07 19:54:14 +00:00
|
|
|
|
2020-07-23 15:05:21 +00:00
|
|
|
genericapiserver "k8s.io/apiserver/pkg/server"
|
2020-07-20 04:21:47 +00:00
|
|
|
"k8s.io/client-go/pkg/version"
|
|
|
|
"k8s.io/client-go/rest"
|
2020-07-23 15:05:21 +00:00
|
|
|
"k8s.io/component-base/logs"
|
2020-07-20 04:21:47 +00:00
|
|
|
"k8s.io/klog/v2"
|
|
|
|
|
2020-09-18 19:56:24 +00:00
|
|
|
"go.pinniped.dev/internal/server"
|
2020-07-03 00:05:59 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2020-07-23 15:05:21 +00:00
|
|
|
logs.InitLogs()
|
|
|
|
defer logs.FlushLogs()
|
|
|
|
|
2020-09-08 16:29:34 +00:00
|
|
|
// Dump out the time since compile (mostly useful for benchmarking our local development cycle latency).
|
|
|
|
var timeSinceCompile time.Duration
|
|
|
|
if buildDate, err := time.Parse(time.RFC3339, version.Get().BuildDate); err == nil {
|
|
|
|
timeSinceCompile = time.Since(buildDate).Round(time.Second)
|
|
|
|
}
|
|
|
|
klog.Infof("Running %s at %#v (%s since build)", rest.DefaultKubernetesUserAgent(), version.Get(), timeSinceCompile)
|
2020-07-23 15:05:21 +00:00
|
|
|
|
|
|
|
ctx := genericapiserver.SetupSignalContext()
|
|
|
|
|
2020-07-27 20:32:14 +00:00
|
|
|
if err := server.New(ctx, os.Args[1:], os.Stdout, os.Stderr).Run(); err != nil {
|
2020-07-23 15:05:21 +00:00
|
|
|
klog.Fatal(err)
|
2020-07-08 17:06:44 +00:00
|
|
|
}
|
2020-07-03 00:05:59 +00:00
|
|
|
}
|