feat(go-traefik-certmanager): initial commit

This commit is contained in:
Tom Neuber 2025-01-21 21:29:51 +01:00
parent 913eaceaa4
commit c10b760c0b
Signed by: tom
GPG key ID: F17EFE4272D89FF6
14 changed files with 835 additions and 0 deletions

41
pkg/certmanager/client.go Normal file
View file

@ -0,0 +1,41 @@
package certmanager
import (
"k8s.io/client-go/dynamic"
)
type Client struct {
crdClient dynamic.DynamicClient
certIssuerName string
certIssuerKind string
Certificates certificateClient
}
type ClientOption func(*Client)
func WithCertIssuerName(name string) ClientOption {
return func(c *Client) {
c.certIssuerName = name
}
}
func WithCertIssuerKind(kind string) ClientOption {
return func(c *Client) {
c.certIssuerKind = kind
}
}
func NewClient(crdClient dynamic.DynamicClient, options ...ClientOption) *Client {
client := &Client{
crdClient: crdClient,
}
for _, option := range options {
option(client)
}
client.Certificates = newCertificateClient(client)
return client
}