This repository has been archived by the owner on Jul 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 279
/
types.go
77 lines (60 loc) · 2.2 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Package providers implements generic certificate provider related functionality
package providers
import (
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"github.com/openservicemesh/osm/pkg/configurator"
"github.com/openservicemesh/osm/pkg/logger"
)
var log = logger.New("cert-provider-util")
// Kind specifies the certificate provider kind
type Kind string
// String returns the Kind as a string
func (p Kind) String() string {
return string(p)
}
const (
// TresorKind represents Tresor, an internal package which leverages Kubernetes secrets and signs certs on the OSM pod
TresorKind Kind = "tresor"
// VaultKind represents Hashi Vault; OSM is pointed to an external Vault; signing of certs happens on Vault
VaultKind Kind = "vault"
// CertManagerKind represents cert-manager.io; certificates are requested using cert-manager
CertManagerKind Kind = "cert-manager"
)
var (
// ValidCertificateProviders is the list of supported certificate providers
ValidCertificateProviders = []Kind{TresorKind, VaultKind, CertManagerKind}
)
// Config is a type that stores config related to certificate providers and implements generic utility functions
type Config struct {
kubeClient kubernetes.Interface
kubeConfig *rest.Config
cfg configurator.Configurator
providerKind Kind
providerNamespace string
caBundleSecretName string
// tresorOptions is the options for 'Tresor' certificate provider
tresorOptions TresorOptions
// vaultOptions is the options for 'Hashicorp Vault' certificate provider
vaultOptions VaultOptions
// certManagerOptions is the options for 'cert-manager.io' certiticate provider
certManagerOptions CertManagerOptions
}
// TresorOptions is a type that specifies 'Tresor' certificate provider options
type TresorOptions struct {
// No options at the moment
}
// VaultOptions is a type that specifies 'Hashicorp Vault' certificate provider options
type VaultOptions struct {
VaultProtocol string
VaultHost string
VaultToken string
VaultRole string
VaultPort int
}
// CertManagerOptions is a type that specifies 'cert-manager.io' certificate provider options
type CertManagerOptions struct {
IssuerName string
IssuerKind string
IssuerGroup string
}