37 lines
716 B
Go
37 lines
716 B
Go
package ingressroute
|
|
|
|
import (
|
|
"git.ar21.de/yolokube/go-traefik-certmanager/pkg/certmanager"
|
|
"k8s.io/client-go/dynamic"
|
|
)
|
|
|
|
type Client struct {
|
|
crdClient dynamic.DynamicClient
|
|
certmanager *certmanager.Client
|
|
certCleanup bool
|
|
|
|
IngressRoutes ingressRouteClient
|
|
}
|
|
|
|
type ClientOption func(*Client)
|
|
|
|
func WithCertCleanup() ClientOption {
|
|
return func(c *Client) {
|
|
c.certCleanup = true
|
|
}
|
|
}
|
|
|
|
func NewClient(crdClient dynamic.DynamicClient, cmClient *certmanager.Client, options ...ClientOption) *Client {
|
|
client := &Client{
|
|
crdClient: crdClient,
|
|
certmanager: cmClient,
|
|
}
|
|
|
|
for _, option := range options {
|
|
option(client)
|
|
}
|
|
|
|
client.IngressRoutes = ingressRouteClient{client: client}
|
|
|
|
return client
|
|
}
|