feat(go-traefik-certmanager): initial commit
This commit is contained in:
parent
913eaceaa4
commit
c10b760c0b
14 changed files with 835 additions and 0 deletions
51
main.go
Normal file
51
main.go
Normal file
|
@ -0,0 +1,51 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
"git.ar21.de/yolokube/go-traefik-certmanager/internal/cmd"
|
||||
"git.ar21.de/yolokube/go-traefik-certmanager/pkg/certmanager"
|
||||
"git.ar21.de/yolokube/go-traefik-certmanager/pkg/ingressroute"
|
||||
"k8s.io/client-go/dynamic"
|
||||
"k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
func main() {
|
||||
cli := cmd.CLI{}
|
||||
appSettings := cli.Parse()
|
||||
|
||||
config, err := rest.InClusterConfig()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
client, err := dynamic.NewForConfig(config)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
cmClient := certmanager.NewClient(
|
||||
*client,
|
||||
certmanager.WithCertIssuerKind(appSettings.CertIssuerKind),
|
||||
certmanager.WithCertIssuerName(appSettings.CertIssuerName),
|
||||
)
|
||||
|
||||
irClient := ingressroute.NewClient(
|
||||
*client,
|
||||
cmClient,
|
||||
ingressroute.WithCertCleanup(),
|
||||
)
|
||||
|
||||
stopCh := make(chan struct{})
|
||||
defer close(stopCh)
|
||||
|
||||
go irClient.IngressRoutes.Watch(stopCh)
|
||||
|
||||
signalCh := make(chan os.Signal, 1)
|
||||
signal.Notify(signalCh, syscall.SIGINT, syscall.SIGTERM)
|
||||
<-signalCh
|
||||
log.Print("Shutting down gracefully")
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue