Refactor to use meta api group

Signed-off-by: James Munnelly <james@munnelly.eu>
This commit is contained in:
James Munnelly 2019-09-20 12:37:48 +01:00
parent 5c3dc85390
commit d99d4fb59a
8 changed files with 37 additions and 72 deletions

View File

@ -19,6 +19,7 @@ filegroup(
srcs = [
":package-srcs",
"//pkg/apis/certmanager:all-srcs",
"//pkg/apis/meta:all-srcs",
],
tags = ["automanaged"],
visibility = ["//visibility:public"],

View File

@ -19,6 +19,7 @@ go_library(
visibility = ["//visibility:public"],
deps = [
"//pkg/apis/certmanager:go_default_library",
"//pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/api/core/v1:go_default_library",
"//vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",

View File

@ -16,7 +16,11 @@ limitations under the License.
package v1alpha2
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
cmmeta "github.com/jetstack/cert-manager/pkg/apis/meta/v1"
)
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
@ -106,7 +110,7 @@ type CertificateSpec struct {
// If the 'kind' field is set to 'ClusterIssuer', a ClusterIssuer with the
// provided name will be used.
// The 'name' field in this stanza is required at all times.
IssuerRef ObjectReference `json:"issuerRef"`
IssuerRef cmmeta.ObjectReference `json:"issuerRef"`
// IsCA will mark this Certificate as valid for signing.
// This implies that the 'cert sign' usage is set
@ -159,7 +163,7 @@ type CertificateCondition struct {
Type CertificateConditionType `json:"type"`
// Status of the condition, one of ('True', 'False', 'Unknown').
Status ConditionStatus `json:"status"`
Status cmmeta.ConditionStatus `json:"status"`
// LastTransitionTime is the timestamp corresponding to the last status
// change of this condition.

View File

@ -18,6 +18,8 @@ package v1alpha2
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
cmmeta "github.com/jetstack/cert-manager/pkg/apis/meta/v1"
)
const (
@ -67,7 +69,7 @@ type CertificateRequestSpec struct {
// the provided name will be used. The 'name' field in this stanza is
// required at all times. The group field refers to the API group of the
// issuer which defaults to 'certmanager.k8s.io' if empty.
IssuerRef ObjectReference `json:"issuerRef"`
IssuerRef cmmeta.ObjectReference `json:"issuerRef"`
// Byte slice containing the PEM encoded CertificateSigningRequest
// +optional
@ -112,7 +114,7 @@ type CertificateRequestCondition struct {
Type CertificateRequestConditionType `json:"type"`
// Status of the condition, one of ('True', 'False', 'Unknown').
Status ConditionStatus `json:"status"`
Status cmmeta.ConditionStatus `json:"status"`
// LastTransitionTime is the timestamp corresponding to the last status
// change of this condition.

View File

@ -18,6 +18,8 @@ package v1alpha2
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
cmmeta "github.com/jetstack/cert-manager/pkg/apis/meta/v1"
)
// TODO: these types should be moved into their own API group once we have a loose
@ -90,7 +92,7 @@ type ChallengeSpec struct {
// If the Issuer does not exist, processing will be retried.
// If the Issuer is not an 'ACME' Issuer, an error will be returned and the
// Challenge will be marked as failed.
IssuerRef ObjectReference `json:"issuerRef"`
IssuerRef cmmeta.ObjectReference `json:"issuerRef"`
}
type ChallengeStatus struct {

View File

@ -20,6 +20,8 @@ import (
corev1 "k8s.io/api/core/v1"
apiext "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
cmmeta "github.com/jetstack/cert-manager/pkg/apis/meta/v1"
)
// +genclient
@ -119,7 +121,7 @@ type VenafiTPP struct {
// CredentialsRef is a reference to a Secret containing the username and
// password for the TPP server.
// The secret must contain two keys, 'username' and 'password'.
CredentialsRef LocalObjectReference `json:"credentialsRef"`
CredentialsRef cmmeta.LocalObjectReference `json:"credentialsRef"`
// CABundle is a PEM encoded TLS certifiate to use to verify connections to
// the TPP instance.
@ -137,7 +139,7 @@ type VenafiCloud struct {
URL string `json:"url"`
// APITokenSecretRef is a secret key selector for the Venafi Cloud API token.
APITokenSecretRef SecretKeySelector `json:"apiTokenSecretRef"`
APITokenSecretRef cmmeta.SecretKeySelector `json:"apiTokenSecretRef"`
}
type SelfSignedIssuer struct{}
@ -167,7 +169,7 @@ type VaultIssuer struct {
type VaultAuth struct {
// This Secret contains the Vault token key
// +optional
TokenSecretRef SecretKeySelector `json:"tokenSecretRef,omitempty"`
TokenSecretRef cmmeta.SecretKeySelector `json:"tokenSecretRef,omitempty"`
// This Secret contains a AppRole and Secret
// +optional
@ -179,7 +181,7 @@ type VaultAppRole struct {
Path string `json:"path"`
RoleId string `json:"roleId"`
SecretRef SecretKeySelector `json:"secretRef"`
SecretRef cmmeta.SecretKeySelector `json:"secretRef"`
}
type CAIssuer struct {
@ -203,7 +205,7 @@ type ACMEIssuer struct {
// PrivateKey is the name of a secret containing the private key for this
// user account.
PrivateKey SecretKeySelector `json:"privateKeySecretRef"`
PrivateKey cmmeta.SecretKeySelector `json:"privateKeySecretRef"`
// Solvers is a list of challenge solvers that will be used to solve
// ACME challenges for the matching domains.
@ -383,15 +385,15 @@ const (
// configuration for Akamai DNS—Zone Record Management API
type ACMEIssuerDNS01ProviderAkamai struct {
ServiceConsumerDomain string `json:"serviceConsumerDomain"`
ClientToken SecretKeySelector `json:"clientTokenSecretRef"`
ClientSecret SecretKeySelector `json:"clientSecretSecretRef"`
AccessToken SecretKeySelector `json:"accessTokenSecretRef"`
ClientToken cmmeta.SecretKeySelector `json:"clientTokenSecretRef"`
ClientSecret cmmeta.SecretKeySelector `json:"clientSecretSecretRef"`
AccessToken cmmeta.SecretKeySelector `json:"accessTokenSecretRef"`
}
// ACMEIssuerDNS01ProviderCloudDNS is a structure containing the DNS
// configuration for Google Cloud DNS
type ACMEIssuerDNS01ProviderCloudDNS struct {
ServiceAccount SecretKeySelector `json:"serviceAccountSecretRef"`
ServiceAccount cmmeta.SecretKeySelector `json:"serviceAccountSecretRef"`
Project string `json:"project"`
}
@ -399,13 +401,13 @@ type ACMEIssuerDNS01ProviderCloudDNS struct {
// configuration for Cloudflare
type ACMEIssuerDNS01ProviderCloudflare struct {
Email string `json:"email"`
APIKey SecretKeySelector `json:"apiKeySecretRef"`
APIKey cmmeta.SecretKeySelector `json:"apiKeySecretRef"`
}
// ACMEIssuerDNS01ProviderDigitalOcean is a structure containing the DNS
// configuration for DigitalOcean Domains
type ACMEIssuerDNS01ProviderDigitalOcean struct {
Token SecretKeySelector `json:"tokenSecretRef"`
Token cmmeta.SecretKeySelector `json:"tokenSecretRef"`
}
// ACMEIssuerDNS01ProviderRoute53 is a structure containing the Route 53
@ -419,7 +421,7 @@ type ACMEIssuerDNS01ProviderRoute53 struct {
// The SecretAccessKey is used for authentication. If not set we fall-back to using env vars, shared credentials file or AWS Instance metadata
// https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html#specifying-credentials
// +optional
SecretAccessKey SecretKeySelector `json:"secretAccessKeySecretRef"`
SecretAccessKey cmmeta.SecretKeySelector `json:"secretAccessKeySecretRef"`
// Role is a Role ARN which the Route53 provider will assume using either the explicit credentials AccessKeyID/SecretAccessKey
// or the inferred credentials from environment variables, shared credentials file or AWS Instance metadata
@ -439,7 +441,7 @@ type ACMEIssuerDNS01ProviderRoute53 struct {
type ACMEIssuerDNS01ProviderAzureDNS struct {
ClientID string `json:"clientID"`
ClientSecret SecretKeySelector `json:"clientSecretSecretRef"`
ClientSecret cmmeta.SecretKeySelector `json:"clientSecretSecretRef"`
SubscriptionID string `json:"subscriptionID"`
@ -469,7 +471,7 @@ const (
type ACMEIssuerDNS01ProviderAcmeDNS struct {
Host string `json:"host"`
AccountSecret SecretKeySelector `json:"accountSecretRef"`
AccountSecret cmmeta.SecretKeySelector `json:"accountSecretRef"`
}
// ACMEIssuerDNS01ProviderRFC2136 is a structure containing the
@ -482,7 +484,7 @@ type ACMEIssuerDNS01ProviderRFC2136 struct {
// The name of the secret containing the TSIG value.
// If ``tsigKeyName`` is defined, this field is required.
// +optional
TSIGSecret SecretKeySelector `json:"tsigSecretSecretRef,omitempty"`
TSIGSecret cmmeta.SecretKeySelector `json:"tsigSecretSecretRef,omitempty"`
// The TSIG Key name configured in the DNS.
// If ``tsigSecretSecretRef`` is defined, this field is required.
@ -551,7 +553,7 @@ type IssuerCondition struct {
Type IssuerConditionType `json:"type"`
// Status of the condition, one of ('True', 'False', 'Unknown').
Status ConditionStatus `json:"status"`
Status cmmeta.ConditionStatus `json:"status"`
// LastTransitionTime is the timestamp corresponding to the last status
// change of this condition.

View File

@ -18,6 +18,8 @@ package v1alpha2
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
cmmeta "github.com/jetstack/cert-manager/pkg/apis/meta/v1"
)
// TODO: these types should be moved into their own API group once we have a loose
@ -62,7 +64,7 @@ type OrderSpec struct {
// If the Issuer does not exist, processing will be retried.
// If the Issuer is not an 'ACME' Issuer, an error will be returned and the
// Order will be marked as failed.
IssuerRef ObjectReference `json:"issuerRef"`
IssuerRef cmmeta.ObjectReference `json:"issuerRef"`
// CommonName is the common name as specified on the DER encoded CSR.
// If CommonName is not specified, the first DNSName specified will be used

View File

@ -1140,38 +1140,6 @@ func (in *IssuerStatus) DeepCopy() *IssuerStatus {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *LocalObjectReference) DeepCopyInto(out *LocalObjectReference) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LocalObjectReference.
func (in *LocalObjectReference) DeepCopy() *LocalObjectReference {
if in == nil {
return nil
}
out := new(LocalObjectReference)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ObjectReference.
func (in *ObjectReference) DeepCopy() *ObjectReference {
if in == nil {
return nil
}
out := new(ObjectReference)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Order) DeepCopyInto(out *Order) {
*out = *in
@ -1292,23 +1260,6 @@ func (in *OrderStatus) DeepCopy() *OrderStatus {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *SecretKeySelector) DeepCopyInto(out *SecretKeySelector) {
*out = *in
out.LocalObjectReference = in.LocalObjectReference
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretKeySelector.
func (in *SecretKeySelector) DeepCopy() *SecretKeySelector {
if in == nil {
return nil
}
out := new(SecretKeySelector)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *SelfSignedIssuer) DeepCopyInto(out *SelfSignedIssuer) {
*out = *in