Add CA field to Issuer

This commit is contained in:
James Munnelly 2017-09-10 20:38:07 +01:00
parent fbe7f542bd
commit c2cbbe0145
2 changed files with 86 additions and 51 deletions

View File

@ -47,6 +47,62 @@ type IssuerList struct {
// configuration required for the issuer.
type IssuerSpec struct {
ACME *ACMEIssuer `json:"acme,omitempty"`
CA *CAIssuer `json:"ca,omitempty"`
}
type CAIssuer struct {
SecretRef LocalObjectReference `json:"secretRef"`
}
// ACMEIssuer contains the specification for an ACME issuer
type ACMEIssuer struct {
// Email is the email for this account
Email string `json:"email"`
// Server is the ACME server URL
Server string `json:"server"`
// PrivateKey is the name of a secret containing the private key for this
// user account.
PrivateKey string `json:"privateKey"`
// DNS-01 config
DNS01 *ACMEIssuerDNS01Config `json:"dns-01"`
}
// ACMEIssuerDNS01Config is a structure containing the ACME DNS configuration
// option. One and only one of the fields within it should be set, when the
// ACME challenge type is set to dns-01
type ACMEIssuerDNS01Config struct {
Providers []ACMEIssuerDNS01Provider `json:"providers"`
}
type ACMEIssuerDNS01Provider struct {
Name string `json:"name"`
CloudDNS *ACMEIssuerDNS01ProviderCloudDNS `json:"clouddns,omitempty"`
Cloudflare *ACMEIssuerDNS01ProviderCloudflare `json:"cloudflare,omitempty"`
Route53 *ACMEIssuerDNS01ProviderRoute53 `json:"route53,omitempty"`
}
// ACMEIssuerDNS01ProviderCloudDNS is a structure containing the DNS
// configuration for Google Cloud DNS
type ACMEIssuerDNS01ProviderCloudDNS struct {
ServiceAccount SecretKeySelector `json:"serviceAccount"`
Project string `json:"project"`
}
// ACMEIssuerDNS01ProviderCloudflare is a structure containing the DNS
// configuration for Cloudflare
type ACMEIssuerDNS01ProviderCloudflare struct {
Email string `json:"email"`
APIKey SecretKeySelector `json:"apiKey"`
}
// ACMEIssuerDNS01ProviderRoute53 is a structure containing the Route 53
// configuration for AWS
type ACMEIssuerDNS01ProviderRoute53 struct {
AccessKeyID string `json:"accessKeyID"`
SecretAccessKey SecretKeySelector `json:"secretAccessKey"`
HostedZoneID string `json:"hostedZoneID"`
Region string `json:"region"`
}
// IssuerStatus contains status information about an Issuer
@ -104,57 +160,6 @@ const (
ConditionUnknown ConditionStatus = "Unknown"
)
// ACMEIssuer contains the specification for an ACME issuer
type ACMEIssuer struct {
// Email is the email for this account
Email string `json:"email"`
// Server is the ACME server URL
Server string `json:"server"`
// PrivateKey is the name of a secret containing the private key for this
// user account.
PrivateKey string `json:"privateKey"`
// DNS-01 config
DNS01 *ACMEIssuerDNS01Config `json:"dns-01"`
}
// ACMEIssuerDNS01Config is a structure containing the ACME DNS configuration
// option. One and only one of the fields within it should be set, when the
// ACME challenge type is set to dns-01
type ACMEIssuerDNS01Config struct {
Providers []ACMEIssuerDNS01Provider `json:"providers"`
}
type ACMEIssuerDNS01Provider struct {
Name string `json:"name"`
CloudDNS *ACMEIssuerDNS01ProviderCloudDNS `json:"clouddns,omitempty"`
Cloudflare *ACMEIssuerDNS01ProviderCloudflare `json:"cloudflare,omitempty"`
Route53 *ACMEIssuerDNS01ProviderRoute53 `json:"route53,omitempty"`
}
// ACMEIssuerDNS01ProviderCloudDNS is a structure containing the DNS
// configuration for Google Cloud DNS
type ACMEIssuerDNS01ProviderCloudDNS struct {
ServiceAccount SecretKeySelector `json:"serviceAccount"`
Project string `json:"project"`
}
// ACMEIssuerDNS01ProviderCloudflare is a structure containing the DNS
// configuration for Cloudflare
type ACMEIssuerDNS01ProviderCloudflare struct {
Email string `json:"email"`
APIKey SecretKeySelector `json:"apiKey"`
}
// ACMEIssuerDNS01ProviderRoute53 is a structure containing the Route 53
// configuration for AWS
type ACMEIssuerDNS01ProviderRoute53 struct {
AccessKeyID string `json:"accessKeyID"`
SecretAccessKey SecretKeySelector `json:"secretAccessKey"`
HostedZoneID string `json:"hostedZoneID"`
Region string `json:"region"`
}
type ACMEIssuerStatus struct {
// URI is the unique account identifier, which can also be used to retrieve
// account details from the CA

View File

@ -84,6 +84,10 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
in.(*ACMEIssuerStatus).DeepCopyInto(out.(*ACMEIssuerStatus))
return nil
}, InType: reflect.TypeOf(&ACMEIssuerStatus{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*CAIssuer).DeepCopyInto(out.(*CAIssuer))
return nil
}, InType: reflect.TypeOf(&CAIssuer{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*Certificate).DeepCopyInto(out.(*Certificate))
return nil
@ -416,6 +420,23 @@ func (in *ACMEIssuerStatus) DeepCopy() *ACMEIssuerStatus {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CAIssuer) DeepCopyInto(out *CAIssuer) {
*out = *in
out.SecretRef = in.SecretRef
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CAIssuer.
func (in *CAIssuer) DeepCopy() *CAIssuer {
if in == nil {
return nil
}
out := new(CAIssuer)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Certificate) DeepCopyInto(out *Certificate) {
*out = *in
@ -664,6 +685,15 @@ func (in *IssuerSpec) DeepCopyInto(out *IssuerSpec) {
(*in).DeepCopyInto(*out)
}
}
if in.CA != nil {
in, out := &in.CA, &out.CA
if *in == nil {
*out = nil
} else {
*out = new(CAIssuer)
**out = **in
}
}
return
}