feat(go-traefik-certmanager): initial commit
This commit is contained in:
parent
913eaceaa4
commit
c10b760c0b
14 changed files with 835 additions and 0 deletions
41
pkg/certmanager/client.go
Normal file
41
pkg/certmanager/client.go
Normal 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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue