diff --git a/BUILD.bazel b/BUILD.bazel index d5c2b42bc..f4125270a 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -57,7 +57,9 @@ filegroup( "//pkg/client/clientset/versioned:all-srcs", "//pkg/client/informers/externalversions:all-srcs", "//pkg/client/listers/acme/v1alpha2:all-srcs", + "//pkg/client/listers/acme/v1alpha3:all-srcs", "//pkg/client/listers/certmanager/v1alpha2:all-srcs", + "//pkg/client/listers/certmanager/v1alpha3:all-srcs", "//pkg/controller:all-srcs", "//pkg/feature:all-srcs", "//pkg/internal:all-srcs", diff --git a/cmd/webhook/main.go b/cmd/webhook/main.go index 47a5e8adc..d6d20afcb 100644 --- a/cmd/webhook/main.go +++ b/cmd/webhook/main.go @@ -46,7 +46,7 @@ func init() { flag.StringVar(&tlsKeyFile, "tls-private-key-file", "", "path to the file containing the TLS private key to serve with") } -var validationHook handlers.ValidatingAdmissionHook = handlers.NewFuncBackedValidator(logs.Log, webhook.Scheme, webhook.Validators) +var validationHook handlers.ValidatingAdmissionHook = handlers.NewRegistryBackedValidator(logs.Log, webhook.Scheme, webhook.ValidationRegistry) var mutationHook handlers.MutatingAdmissionHook = handlers.NewSchemeBackedDefaulter(logs.Log, webhook.Scheme) var conversionHook handlers.ConversionHook = handlers.NewSchemeBackedConverter(logs.Log, webhook.Scheme) diff --git a/hack/update-all.sh b/hack/update-all.sh index 73360214b..a67797196 100755 --- a/hack/update-all.sh +++ b/hack/update-all.sh @@ -28,4 +28,3 @@ hack=$(dirname "${BASH_SOURCE[0]}") # This is already run automatically by update-deps.sh #"$hack"/update-deps-licenses.sh "$hack"/update-gofmt.sh -"$hack"/update-reference-docs.sh diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index dcc7bc8d2..e0863ee03 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -36,8 +36,10 @@ module_name="github.com/jetstack/cert-manager" # Generate deepcopy functions for all internal and external APIs deepcopy_inputs=( pkg/apis/certmanager/v1alpha2 \ + pkg/apis/certmanager/v1alpha3 \ pkg/internal/apis/certmanager \ pkg/apis/acme/v1alpha2 \ + pkg/apis/acme/v1alpha3 \ pkg/internal/apis/acme \ pkg/apis/meta/v1 \ pkg/internal/apis/meta \ @@ -52,13 +54,17 @@ client_package="${module_name}/${client_subpackage}" # Generate clientsets, listers and informers for user-facing API types client_inputs=( pkg/apis/certmanager/v1alpha2 \ + pkg/apis/certmanager/v1alpha3 \ pkg/apis/acme/v1alpha2 \ + pkg/apis/acme/v1alpha3 \ ) # Generate defaulting functions to be used by the mutating webhook defaulter_inputs=( pkg/internal/apis/certmanager/v1alpha2 \ + pkg/internal/apis/certmanager/v1alpha3 \ pkg/internal/apis/acme/v1alpha2 \ + pkg/internal/apis/acme/v1alpha3 \ pkg/internal/apis/meta/v1 \ pkg/webhook/handlers/testdata/apis/testgroup/v2 \ pkg/webhook/handlers/testdata/apis/testgroup/v1 \ @@ -67,7 +73,9 @@ defaulter_inputs=( # Generate conversion functions to be used by the conversion webhook conversion_inputs=( pkg/internal/apis/certmanager/v1alpha2 \ + pkg/internal/apis/certmanager/v1alpha3 \ pkg/internal/apis/acme/v1alpha2 \ + pkg/internal/apis/acme/v1alpha3 \ pkg/internal/apis/meta/v1 \ pkg/webhook/handlers/testdata/apis/testgroup/v2 \ pkg/webhook/handlers/testdata/apis/testgroup/v1 \ @@ -121,6 +129,15 @@ clean() { find "$path" -name "$name" -delete } +mkcp() { + src="$1" + dst="$2" + mkdir -p "$(dirname "$dst")" + cp "$src" "$dst" +} +# Export mkcp for use in sub-shells +export -f mkcp + copyfiles() { # Don't copy data if the workspace directory is already within the GOPATH if [ "${BUILD_WORKSPACE_DIRECTORY:0:${#GOPATH}}" = "$GOPATH" ]; then @@ -134,7 +151,8 @@ copyfiles() { fi ( cd "$GOPATH/src/$module_name/$path" - find "." -name "$name" -exec cp {} "$BUILD_WORKSPACE_DIRECTORY/$path/{}" \; + + find "." -name "$name" -exec bash -c "mkcp {} \"$BUILD_WORKSPACE_DIRECTORY/$path/{}\"" \; ) } diff --git a/pkg/api/BUILD.bazel b/pkg/api/BUILD.bazel index fb2bdb435..b750e0113 100644 --- a/pkg/api/BUILD.bazel +++ b/pkg/api/BUILD.bazel @@ -8,7 +8,9 @@ go_library( deps = [ "//pkg/acme/webhook/apis/acme/v1alpha1:go_default_library", "//pkg/apis/acme/v1alpha2:go_default_library", + "//pkg/apis/acme/v1alpha3:go_default_library", "//pkg/apis/certmanager/v1alpha2:go_default_library", + "//pkg/apis/certmanager/v1alpha3:go_default_library", "//pkg/apis/meta/v1:go_default_library", "@io_k8s_apiextensions_apiserver//pkg/apis/apiextensions/v1beta1:go_default_library", "@io_k8s_apimachinery//pkg/apis/meta/v1:go_default_library", diff --git a/pkg/api/scheme.go b/pkg/api/scheme.go index e4ddc715c..b47ff48af 100644 --- a/pkg/api/scheme.go +++ b/pkg/api/scheme.go @@ -28,7 +28,9 @@ import ( whapi "github.com/jetstack/cert-manager/pkg/acme/webhook/apis/acme/v1alpha1" cmacme "github.com/jetstack/cert-manager/pkg/apis/acme/v1alpha2" + cmacmev1alpha3 "github.com/jetstack/cert-manager/pkg/apis/acme/v1alpha3" cmapi "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha2" + cmapiv1alpha3 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha3" cmmeta "github.com/jetstack/cert-manager/pkg/apis/meta/v1" ) @@ -46,7 +48,9 @@ var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ cmapi.AddToScheme, + cmapiv1alpha3.AddToScheme, cmacme.AddToScheme, + cmacmev1alpha3.AddToScheme, cmmeta.AddToScheme, whapi.AddToScheme, kscheme.AddToScheme, diff --git a/pkg/apis/acme/BUILD.bazel b/pkg/apis/acme/BUILD.bazel index 089c5cfb3..378a84bdb 100644 --- a/pkg/apis/acme/BUILD.bazel +++ b/pkg/apis/acme/BUILD.bazel @@ -19,6 +19,7 @@ filegroup( srcs = [ ":package-srcs", "//pkg/apis/acme/v1alpha2:all-srcs", + "//pkg/apis/acme/v1alpha3:all-srcs", ], tags = ["automanaged"], visibility = ["//visibility:public"], diff --git a/pkg/apis/acme/v1alpha3/BUILD.bazel b/pkg/apis/acme/v1alpha3/BUILD.bazel new file mode 100644 index 000000000..a5d50ff80 --- /dev/null +++ b/pkg/apis/acme/v1alpha3/BUILD.bazel @@ -0,0 +1,40 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "const.go", + "doc.go", + "register.go", + "types.go", + "types_challenge.go", + "types_issuer.go", + "types_order.go", + "zz_generated.deepcopy.go", + ], + importpath = "github.com/jetstack/cert-manager/pkg/apis/acme/v1alpha3", + visibility = ["//visibility:public"], + deps = [ + "//pkg/apis/acme:go_default_library", + "//pkg/apis/meta/v1:go_default_library", + "@io_k8s_api//core/v1:go_default_library", + "@io_k8s_apiextensions_apiserver//pkg/apis/apiextensions/v1beta1:go_default_library", + "@io_k8s_apimachinery//pkg/apis/meta/v1:go_default_library", + "@io_k8s_apimachinery//pkg/runtime:go_default_library", + "@io_k8s_apimachinery//pkg/runtime/schema:go_default_library", + ], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/pkg/apis/acme/v1alpha3/const.go b/pkg/apis/acme/v1alpha3/const.go new file mode 100644 index 000000000..e168ee5d6 --- /dev/null +++ b/pkg/apis/acme/v1alpha3/const.go @@ -0,0 +1,21 @@ +/* +Copyright 2019 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha3 + +const ( + ACMEFinalizer = "finalizer.acme.cert-manager.io" +) diff --git a/pkg/apis/acme/v1alpha3/doc.go b/pkg/apis/acme/v1alpha3/doc.go new file mode 100644 index 000000000..9f8e6a177 --- /dev/null +++ b/pkg/apis/acme/v1alpha3/doc.go @@ -0,0 +1,23 @@ +/* +Copyright 2019 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package v1alpha3 is the v1alpha3 version of the API. +// +k8s:deepcopy-gen=package,register +// +k8s:conversion-gen=github.com/jetstack/cert-manager/pkg/apis/acme +// +k8s:openapi-gen=true +// +k8s:defaulter-gen=TypeMeta +// +groupName=acme.cert-manager.io +package v1alpha3 diff --git a/pkg/apis/acme/v1alpha3/register.go b/pkg/apis/acme/v1alpha3/register.go new file mode 100644 index 000000000..765dc1b15 --- /dev/null +++ b/pkg/apis/acme/v1alpha3/register.go @@ -0,0 +1,58 @@ +/* +Copyright 2019 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha3 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + + "github.com/jetstack/cert-manager/pkg/apis/acme" +) + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: acme.GroupName, Version: "v1alpha3"} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + SchemeBuilder runtime.SchemeBuilder + localSchemeBuilder = &SchemeBuilder + AddToScheme = localSchemeBuilder.AddToScheme +) + +func init() { + // We only register manually written functions here. The registration of the + // generated functions takes place in the generated files. The separation + // makes the code compile even when the generated files are missing. + localSchemeBuilder.Register(addKnownTypes) +} + +// Adds the list of known types to api.Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &Order{}, + &OrderList{}, + &Challenge{}, + &ChallengeList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/pkg/apis/acme/v1alpha3/types.go b/pkg/apis/acme/v1alpha3/types.go new file mode 100644 index 000000000..8ffed20b1 --- /dev/null +++ b/pkg/apis/acme/v1alpha3/types.go @@ -0,0 +1,43 @@ +/* +Copyright 2019 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha3 + +const ( + // If this annotation is specified on a Certificate or Order resource when + // using the HTTP01 solver type, the ingress.name field of the HTTP01 + // solver's configuration will be set to the value given here. + // This is especially useful for users of Ingress controllers that maintain + // a 1:1 mapping between endpoint IP and Ingress resource. + ACMECertificateHTTP01IngressNameOverride = "acme.cert-manager.io/http01-override-ingress-name" + + // If this annotation is specified on a Certificate or Order resource when + // using the HTTP01 solver type, the ingress.class field of the HTTP01 + // solver's configuration will be set to the value given here. + // This is especially useful for users deploying many different ingress + // classes into a single cluster that want to be able to re-use a single + // solver for each ingress class. + ACMECertificateHTTP01IngressClassOverride = "acme.cert-manager.io/http01-override-ingress-class" + + // IngressEditInPlaceAnnotation is used to toggle the use of ingressClass instead + // of ingress on the created Certificate resource + IngressEditInPlaceAnnotationKey = "acme.cert-manager.io/http01-edit-in-place" +) + +const ( + OrderKind = "Order" + ChallengeKind = "Challenge" +) diff --git a/pkg/apis/acme/v1alpha3/types_challenge.go b/pkg/apis/acme/v1alpha3/types_challenge.go new file mode 100644 index 000000000..c682991d1 --- /dev/null +++ b/pkg/apis/acme/v1alpha3/types_challenge.go @@ -0,0 +1,122 @@ +/* +Copyright 2019 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha3 + +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 + +// Challenge is a type to represent a Challenge request with an ACME server +// +k8s:openapi-gen=true +// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.state" +// +kubebuilder:printcolumn:name="Domain",type="string",JSONPath=".spec.dnsName" +// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.reason",description="",priority=1 +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC." +// +kubebuilder:subresource:status +// +kubebuilder:resource:path=challenges +type Challenge struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata"` + + Spec ChallengeSpec `json:"spec,omitempty"` + Status ChallengeStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ChallengeList is a list of Challenges +type ChallengeList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []Challenge `json:"items"` +} + +type ChallengeSpec struct { + // AuthzURL is the URL to the ACME Authorization resource that this + // challenge is a part of. + AuthzURL string `json:"authzURL"` + + // Type is the type of ACME challenge this resource represents, e.g. "dns01" + // or "http01" + Type ACMEChallengeType `json:"type"` + + // URL is the URL of the ACME Challenge resource for this challenge. + // This can be used to lookup details about the status of this challenge. + URL string `json:"url"` + + // DNSName is the identifier that this challenge is for, e.g. example.com. + DNSName string `json:"dnsName"` + + // Token is the ACME challenge token for this challenge. + Token string `json:"token"` + + // Key is the ACME challenge key for this challenge + Key string `json:"key"` + + // Wildcard will be true if this challenge is for a wildcard identifier, + // for example '*.example.com' + // +optional + Wildcard bool `json:"wildcard"` + + // Solver contains the domain solving configuration that should be used to + // solve this challenge resource. + Solver *ACMEChallengeSolver `json:"solver,omitempty"` + + // IssuerRef references a properly configured ACME-type Issuer which should + // be used to create this Challenge. + // 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 cmmeta.ObjectReference `json:"issuerRef"` +} + +type ChallengeStatus struct { + // Processing is used to denote whether this challenge should be processed + // or not. + // This field will only be set to true by the 'scheduling' component. + // It will only be set to false by the 'challenges' controller, after the + // challenge has reached a final state or timed out. + // If this field is set to false, the challenge controller will not take + // any more action. + // +optional + Processing bool `json:"processing"` + + // Presented will be set to true if the challenge values for this challenge + // are currently 'presented'. + // This *does not* imply the self check is passing. Only that the values + // have been 'submitted' for the appropriate challenge mechanism (i.e. the + // DNS01 TXT record has been presented, or the HTTP01 configuration has been + // configured). + // +optional + Presented bool `json:"presented"` + + // Reason contains human readable information on why the Challenge is in the + // current state. + // +optional + Reason string `json:"reason"` + + // State contains the current 'state' of the challenge. + // If not set, the state of the challenge is unknown. + // +optional + State State `json:"state,omitempty"` +} diff --git a/pkg/apis/acme/v1alpha3/types_issuer.go b/pkg/apis/acme/v1alpha3/types_issuer.go new file mode 100644 index 000000000..3165c219f --- /dev/null +++ b/pkg/apis/acme/v1alpha3/types_issuer.go @@ -0,0 +1,417 @@ +/* +Copyright 2019 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha3 + +import ( + corev1 "k8s.io/api/core/v1" + apiext "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" + + cmmeta "github.com/jetstack/cert-manager/pkg/apis/meta/v1" +) + +// ACMEIssuer contains the specification for an ACME issuer +type ACMEIssuer struct { + // Email is the email for this account + // +optional + Email string `json:"email,omitempty"` + + // Server is the ACME server URL + Server string `json:"server"` + + // If true, skip verifying the ACME server TLS certificate + // +optional + SkipTLSVerify bool `json:"skipTLSVerify,omitempty"` + + // ExternalAcccountBinding is a reference to a CA external account of the ACME + // server. + // +optional + ExternalAccountBinding *ACMEExternalAccountBinding `json:"externalAccountBinding,omitempty"` + + // PrivateKey is the name of a secret containing the private key for this + // user account. + PrivateKey cmmeta.SecretKeySelector `json:"privateKeySecretRef"` + + // Solvers is a list of challenge solvers that will be used to solve + // ACME challenges for the matching domains. + // +optional + Solvers []ACMEChallengeSolver `json:"solvers,omitempty"` +} + +// ACMEExternalAcccountBinding is a reference to a CA external account of the ACME +// server. +type ACMEExternalAccountBinding struct { + // keyID is the ID of the CA key that the External Account is bound to. + KeyID string `json:"keyID"` + + // keySecretRef is a Secret Key Selector referencing a data item in a Kubernetes + // Secret which holds the symmetric MAC key of the External Account Binding. + // The `key` is the index string that is paired with the key data in the + // Secret and should not be confused with the key data itself, or indeed with + // the External Account Binding keyID above. + // The secret key stored in the Secret **must** be un-padded, base64 URL + // encoded data. + Key cmmeta.SecretKeySelector `json:"keySecretRef"` + + // keyAlgorithm is the MAC key algorithm that the key is used for. Valid + // values are "HS256", "HS384" and "HS512". + KeyAlgorithm HMACKeyAlgorithm `json:"keyAlgorithm"` +} + +// HMACKeyAlgorithm is the name of a key algorithm used for HMAC encryption +// +kubebuilder:validation:Enum=HS256;HS384;HS512 +type HMACKeyAlgorithm string + +const ( + HS256 HMACKeyAlgorithm = "HS256" + HS384 HMACKeyAlgorithm = "HS384" + HS512 HMACKeyAlgorithm = "HS512" +) + +type ACMEChallengeSolver struct { + // Selector selects a set of DNSNames on the Certificate resource that + // should be solved using this challenge solver. + Selector *CertificateDNSNameSelector `json:"selector,omitempty"` + + // +optional + HTTP01 *ACMEChallengeSolverHTTP01 `json:"http01,omitempty"` + + // +optional + DNS01 *ACMEChallengeSolverDNS01 `json:"dns01,omitempty"` +} + +// CertificateDomainSelector selects certificates using a label selector, and +// can optionally select individual DNS names within those certificates. +// If both MatchLabels and DNSNames are empty, this selector will match all +// certificates and DNS names within them. +type CertificateDNSNameSelector struct { + // A label selector that is used to refine the set of certificate's that + // this challenge solver will apply to. + // +optional + MatchLabels map[string]string `json:"matchLabels,omitempty"` + + // List of DNSNames that this solver will be used to solve. + // If specified and a match is found, a dnsNames selector will take + // precedence over a dnsZones selector. + // If multiple solvers match with the same dnsNames value, the solver + // with the most matching labels in matchLabels will be selected. + // If neither has more matches, the solver defined earlier in the list + // will be selected. + // +optional + DNSNames []string `json:"dnsNames,omitempty"` + + // List of DNSZones that this solver will be used to solve. + // The most specific DNS zone match specified here will take precedence + // over other DNS zone matches, so a solver specifying sys.example.com + // will be selected over one specifying example.com for the domain + // www.sys.example.com. + // If multiple solvers match with the same dnsZones value, the solver + // with the most matching labels in matchLabels will be selected. + // If neither has more matches, the solver defined earlier in the list + // will be selected. + // +optional + DNSZones []string `json:"dnsZones,omitempty"` +} + +// ACMEChallengeSolverHTTP01 contains configuration detailing how to solve +// HTTP01 challenges within a Kubernetes cluster. +// Typically this is accomplished through creating 'routes' of some description +// that configure ingress controllers to direct traffic to 'solver pods', which +// are responsible for responding to the ACME server's HTTP requests. +type ACMEChallengeSolverHTTP01 struct { + // The ingress based HTTP01 challenge solver will solve challenges by + // creating or modifying Ingress resources in order to route requests for + // '/.well-known/acme-challenge/XYZ' to 'challenge solver' pods that are + // provisioned by cert-manager for each Challenge to be completed. + // +optional + Ingress *ACMEChallengeSolverHTTP01Ingress `json:"ingress"` +} + +type ACMEChallengeSolverHTTP01Ingress struct { + // Optional service type for Kubernetes solver service + // +optional + ServiceType corev1.ServiceType `json:"serviceType,omitempty"` + + // The ingress class to use when creating Ingress resources to solve ACME + // challenges that use this challenge solver. + // Only one of 'class' or 'name' may be specified. + // +optional + Class *string `json:"class,omitempty"` + + // The name of the ingress resource that should have ACME challenge solving + // routes inserted into it in order to solve HTTP01 challenges. + // This is typically used in conjunction with ingress controllers like + // ingress-gce, which maintains a 1:1 mapping between external IPs and + // ingress resources. + // +optional + Name string `json:"name,omitempty"` + + // Optional pod template used to configure the ACME challenge solver pods + // used for HTTP01 challenges + // +optional + PodTemplate *ACMEChallengeSolverHTTP01IngressPodTemplate `json:"podTemplate,omitempty"` +} + +type ACMEChallengeSolverHTTP01IngressPodTemplate struct { + // ObjectMeta overrides for the pod used to solve HTTP01 challenges. + // Only the 'labels' and 'annotations' fields may be set. + // If labels or annotations overlap with in-built values, the values here + // will override the in-built values. + // +optional + ACMEChallengeSolverHTTP01IngressPodObjectMeta `json:"metadata,omitempty"` + + // PodSpec defines overrides for the HTTP01 challenge solver pod. + // Only the 'nodeSelector', 'affinity' and 'tolerations' fields are + // supported currently. All other fields will be ignored. + // +optional + Spec ACMEChallengeSolverHTTP01IngressPodSpec `json:"spec,omitempty"` +} + +type ACMEChallengeSolverHTTP01IngressPodObjectMeta struct { + // Annotations that should be added to the create ACME HTTP01 solver pods. + Annotations map[string]string `json:"annotations,omitempty"` + + // Labels that should be added to the created ACME HTTP01 solver pods. + Labels map[string]string `json:"labels,omitempty"` +} + +type ACMEChallengeSolverHTTP01IngressPodSpec struct { + // NodeSelector is a selector which must be true for the pod to fit on a node. + // Selector which must match a node's labels for the pod to be scheduled on that node. + // More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ + // +optional + NodeSelector map[string]string `json:"nodeSelector,omitempty"` + + // If specified, the pod's scheduling constraints + // +optional + Affinity *corev1.Affinity `json:"affinity,omitempty"` + + // If specified, the pod's tolerations. + // +optional + Tolerations []corev1.Toleration `json:"tolerations,omitempty"` +} + +type ACMEChallengeSolverDNS01 struct { + // CNAMEStrategy configures how the DNS01 provider should handle CNAME + // records when found in DNS zones. + // +optional + CNAMEStrategy CNAMEStrategy `json:"cnameStrategy,omitempty"` + + // +optional + Akamai *ACMEIssuerDNS01ProviderAkamai `json:"akamai,omitempty"` + + // +optional + CloudDNS *ACMEIssuerDNS01ProviderCloudDNS `json:"clouddns,omitempty"` + + // +optional + Cloudflare *ACMEIssuerDNS01ProviderCloudflare `json:"cloudflare,omitempty"` + + // +optional + Route53 *ACMEIssuerDNS01ProviderRoute53 `json:"route53,omitempty"` + + // +optional + AzureDNS *ACMEIssuerDNS01ProviderAzureDNS `json:"azuredns,omitempty"` + + // +optional + DigitalOcean *ACMEIssuerDNS01ProviderDigitalOcean `json:"digitalocean,omitempty"` + + // +optional + AcmeDNS *ACMEIssuerDNS01ProviderAcmeDNS `json:"acmedns,omitempty"` + + // +optional + RFC2136 *ACMEIssuerDNS01ProviderRFC2136 `json:"rfc2136,omitempty"` + + // +optional + Webhook *ACMEIssuerDNS01ProviderWebhook `json:"webhook,omitempty"` +} + +// CNAMEStrategy configures how the DNS01 provider should handle CNAME records +// when found in DNS zones. +// By default, the None strategy will be applied (i.e. do not follow CNAMEs). +// +kubebuilder:validation:Enum=None;Follow +type CNAMEStrategy string + +const ( + // NoneStrategy indicates that no CNAME resolution strategy should be used + // when determining which DNS zone to update during DNS01 challenges. + NoneStrategy = "None" + + // FollowStrategy will cause cert-manager to recurse through CNAMEs in + // order to determine which DNS zone to update during DNS01 challenges. + // This is useful if you do not want to grant cert-manager access to your + // root DNS zone, and instead delegate the _acme-challenge.example.com + // subdomain to some other, less privileged domain. + FollowStrategy = "Follow" +) + +// ACMEIssuerDNS01ProviderAkamai is a structure containing the DNS +// configuration for Akamai DNS—Zone Record Management API +type ACMEIssuerDNS01ProviderAkamai struct { + ServiceConsumerDomain string `json:"serviceConsumerDomain"` + 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 { + // +optional + ServiceAccount *cmmeta.SecretKeySelector `json:"serviceAccountSecretRef,omitempty"` + Project string `json:"project"` +} + +// ACMEIssuerDNS01ProviderCloudflare is a structure containing the DNS +// configuration for Cloudflare +type ACMEIssuerDNS01ProviderCloudflare struct { + Email string `json:"email"` + APIKey *cmmeta.SecretKeySelector `json:"apiKeySecretRef,omitempty"` + APIToken *cmmeta.SecretKeySelector `json:"apiTokenSecretRef,omitempty"` +} + +// ACMEIssuerDNS01ProviderDigitalOcean is a structure containing the DNS +// configuration for DigitalOcean Domains +type ACMEIssuerDNS01ProviderDigitalOcean struct { + Token cmmeta.SecretKeySelector `json:"tokenSecretRef"` +} + +// ACMEIssuerDNS01ProviderRoute53 is a structure containing the Route 53 +// configuration for AWS +type ACMEIssuerDNS01ProviderRoute53 struct { + // The AccessKeyID is used for authentication. If not set we fall-back to using env vars, shared credentials file or AWS Instance metadata + // see: https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html#specifying-credentials + // +optional + AccessKeyID string `json:"accessKeyID"` + + // 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 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 + // +optional + Role string `json:"role"` + + // If set, the provider will manage only this zone in Route53 and will not do an lookup using the route53:ListHostedZonesByName api call. + // +optional + HostedZoneID string `json:"hostedZoneID,omitempty"` + + // Always set the region when using AccessKeyID and SecretAccessKey + Region string `json:"region"` +} + +// ACMEIssuerDNS01ProviderAzureDNS is a structure containing the +// configuration for Azure DNS +type ACMEIssuerDNS01ProviderAzureDNS struct { + ClientID string `json:"clientID"` + + ClientSecret cmmeta.SecretKeySelector `json:"clientSecretSecretRef"` + + SubscriptionID string `json:"subscriptionID"` + + TenantID string `json:"tenantID"` + + ResourceGroupName string `json:"resourceGroupName"` + + // +optional + HostedZoneName string `json:"hostedZoneName,omitempty"` + + // +optional + Environment AzureDNSEnvironment `json:"environment,omitempty"` +} + +// +kubebuilder:validation:Enum=AzurePublicCloud;AzureChinaCloud;AzureGermanCloud;AzureUSGovernmentCloud +type AzureDNSEnvironment string + +const ( + AzurePublicCloud AzureDNSEnvironment = "AzurePublicCloud" + AzureChinaCloud AzureDNSEnvironment = "AzureChinaCloud" + AzureGermanCloud AzureDNSEnvironment = "AzureGermanCloud" + AzureUSGovernmentCloud AzureDNSEnvironment = "AzureUSGovernmentCloud" +) + +// ACMEIssuerDNS01ProviderAcmeDNS is a structure containing the +// configuration for ACME-DNS servers +type ACMEIssuerDNS01ProviderAcmeDNS struct { + Host string `json:"host"` + + AccountSecret cmmeta.SecretKeySelector `json:"accountSecretRef"` +} + +// ACMEIssuerDNS01ProviderRFC2136 is a structure containing the +// configuration for RFC2136 DNS +type ACMEIssuerDNS01ProviderRFC2136 struct { + // The IP address of the DNS supporting RFC2136. Required. + // Note: FQDN is not a valid value, only IP. + Nameserver string `json:"nameserver"` + + // The name of the secret containing the TSIG value. + // If ``tsigKeyName`` is defined, this field is required. + // +optional + TSIGSecret cmmeta.SecretKeySelector `json:"tsigSecretSecretRef,omitempty"` + + // The TSIG Key name configured in the DNS. + // If ``tsigSecretSecretRef`` is defined, this field is required. + // +optional + TSIGKeyName string `json:"tsigKeyName,omitempty"` + + // The TSIG Algorithm configured in the DNS supporting RFC2136. Used only + // when ``tsigSecretSecretRef`` and ``tsigKeyName`` are defined. + // Supported values are (case-insensitive): ``HMACMD5`` (default), + // ``HMACSHA1``, ``HMACSHA256`` or ``HMACSHA512``. + // +optional + TSIGAlgorithm string `json:"tsigAlgorithm,omitempty"` +} + +// ACMEIssuerDNS01ProviderWebhook specifies configuration for a webhook DNS01 +// provider, including where to POST ChallengePayload resources. +type ACMEIssuerDNS01ProviderWebhook struct { + // The API group name that should be used when POSTing ChallengePayload + // resources to the webhook apiserver. + // This should be the same as the GroupName specified in the webhook + // provider implementation. + GroupName string `json:"groupName"` + + // The name of the solver to use, as defined in the webhook provider + // implementation. + // This will typically be the name of the provider, e.g. 'cloudflare'. + SolverName string `json:"solverName"` + + // Additional configuration that should be passed to the webhook apiserver + // when challenges are processed. + // This can contain arbitrary JSON data. + // Secret values should not be specified in this stanza. + // If secret values are needed (e.g. credentials for a DNS service), you + // should use a SecretKeySelector to reference a Secret resource. + // For details on the schema of this field, consult the webhook provider + // implementation's documentation. + // +optional + Config *apiext.JSON `json:"config,omitempty"` +} + +type ACMEIssuerStatus struct { + // URI is the unique account identifier, which can also be used to retrieve + // account details from the CA + // +optional + URI string `json:"uri,omitempty"` + + // LastRegisteredEmail is the email associated with the latest registered + // ACME account, in order to track changes made to registered account + // associated with the Issuer + // +optional + LastRegisteredEmail string `json:"lastRegisteredEmail,omitempty"` +} diff --git a/pkg/apis/acme/v1alpha3/types_order.go b/pkg/apis/acme/v1alpha3/types_order.go new file mode 100644 index 000000000..618f2a6a5 --- /dev/null +++ b/pkg/apis/acme/v1alpha3/types_order.go @@ -0,0 +1,237 @@ +/* +Copyright 2019 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha3 + +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 +// coupling between ACME Issuers and their solver configurations (see: Solver proposal) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Order is a type to represent an Order with an ACME server +// +k8s:openapi-gen=true +// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.state" +// +kubebuilder:printcolumn:name="Issuer",type="string",JSONPath=".spec.issuerRef.name",description="",priority=1 +// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.reason",description="",priority=1 +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC." +// +kubebuilder:subresource:status +// +kubebuilder:resource:path=orders +type Order struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata"` + + Spec OrderSpec `json:"spec,omitempty"` + Status OrderStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// OrderList is a list of Orders +type OrderList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []Order `json:"items"` +} + +type OrderSpec struct { + // Certificate signing request bytes in DER encoding. + // This will be used when finalizing the order. + // This field must be set on the order. + CSR []byte `json:"csr"` + + // IssuerRef references a properly configured ACME-type Issuer which should + // be used to create this Order. + // 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 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 + // as the CommonName. + // At least one of CommonName or a DNSNames must be set. + // This field must match the corresponding field on the DER encoded CSR. + // +optional + CommonName string `json:"commonName,omitempty"` + + // DNSNames is a list of DNS names that should be included as part of the Order + // validation process. + // If CommonName is not specified, the first DNSName specified will be used + // as the CommonName. + // At least one of CommonName or a DNSNames must be set. + // This field must match the corresponding field on the DER encoded CSR. + // +optional + DNSNames []string `json:"dnsNames,omitempty"` +} + +type OrderStatus struct { + // URL of the Order. + // This will initially be empty when the resource is first created. + // The Order controller will populate this field when the Order is first processed. + // This field will be immutable after it is initially set. + // +optional + URL string `json:"url,omitempty"` + + // FinalizeURL of the Order. + // This is used to obtain certificates for this order once it has been completed. + // +optional + FinalizeURL string `json:"finalizeURL,omitempty"` + + // Authorizations contains data returned from the ACME server on what + // authoriations must be completed in order to validate the DNS names + // specified on the Order. + // +optional + Authorizations []ACMEAuthorization `json:"authorizations,omitempty"` + + // Certificate is a copy of the PEM encoded certificate for this Order. + // This field will be populated after the order has been successfully + // finalized with the ACME server, and the order has transitioned to the + // 'valid' state. + // +optional + Certificate []byte `json:"certificate,omitempty"` + + // State contains the current state of this Order resource. + // States 'success' and 'expired' are 'final' + // +optional + State State `json:"state,omitempty"` + + // Reason optionally provides more information about a why the order is in + // the current state. + // +optional + Reason string `json:"reason,omitempty"` + + // FailureTime stores the time that this order failed. + // This is used to influence garbage collection and back-off. + // +optional + FailureTime *metav1.Time `json:"failureTime,omitempty"` +} + +// ACMEAuthorization contains data returned from the ACME server on an +// authorization that must be completed in order validate a DNS name on an ACME +// Order resource. +type ACMEAuthorization struct { + // URL is the URL of the Authorization that must be completed + URL string `json:"url"` + + // Identifier is the DNS name to be validated as part of this authorization + // +optional + Identifier string `json:"identifier,omitempty"` + + // Wildcard will be true if this authorization is for a wildcard DNS name. + // If this is true, the identifier will be the *non-wildcard* version of + // the DNS name. + // For example, if '*.example.com' is the DNS name being validated, this + // field will be 'true' and the 'identifier' field will be 'example.com'. + // +optional + Wildcard *bool `json:"wildcard,omitempty"` + + // Challenges specifies the challenge types offered by the ACME server. + // One of these challenge types will be selected when validating the DNS + // name and an appropriate Challenge resource will be created to perform + // the ACME challenge process. + // +optional + Challenges []ACMEChallenge `json:"challenges,omitempty"` +} + +// Challenge specifies a challenge offered by the ACME server for an Order. +// An appropriate Challenge resource can be created to perform the ACME +// challenge process. +type ACMEChallenge struct { + // URL is the URL of this challenge. It can be used to retrieve additional + // metadata about the Challenge from the ACME server. + URL string `json:"url"` + + // Token is the token that must be presented for this challenge. + // This is used to compute the 'key' that must also be presented. + Token string `json:"token"` + + // Type is the type of challenge being offered, e.g. http-01, dns-01 + Type ACMEChallengeType `json:"type"` +} + +// ACMEChallengeType denotes a type of ACME challenge +type ACMEChallengeType string + +const ( + // ACMEChallengeTypeHTTP01 denotes a Challenge is of type http-01 + ACMEChallengeTypeHTTP01 ACMEChallengeType = "http-01" + + // ACMEChallengeTypeDNS01 denotes a Challenge is of type dns-01 + ACMEChallengeTypeDNS01 ACMEChallengeType = "dns-01" +) + +// State represents the state of an ACME resource, such as an Order. +// The possible options here map to the corresponding values in the +// ACME specification. +// Full details of these values can be found here: https://tools.ietf.org/html/draft-ietf-acme-acme-15#section-7.1.6 +// Clients utilising this type must also gracefully handle unknown +// values, as the contents of this enumeration may be added to over time. +// +kubebuilder:validation:Enum=valid;ready;pending;processing;invalid;expired;errored +type State string + +const ( + // Unknown is not a real state as part of the ACME spec. + // It is used to represent an unrecognised value. + Unknown State = "" + + // Valid signifies that an ACME resource is in a valid state. + // If an order is 'valid', it has been finalized with the ACME server and + // the certificate can be retrieved from the ACME server using the + // certificate URL stored in the Order's status subresource. + // This is a final state. + Valid State = "valid" + + // Ready signifies that an ACME resource is in a ready state. + // If an order is 'ready', all of its challenges have been completed + // successfully and the order is ready to be finalized. + // Once finalized, it will transition to the Valid state. + // This is a transient state. + Ready State = "ready" + + // Pending signifies that an ACME resource is still pending and is not yet ready. + // If an Order is marked 'Pending', the validations for that Order are still in progress. + // This is a transient state. + Pending State = "pending" + + // Processing signifies that an ACME resource is being processed by the server. + // If an Order is marked 'Processing', the validations for that Order are currently being processed. + // This is a transient state. + Processing State = "processing" + + // Invalid signifies that an ACME resource is invalid for some reason. + // If an Order is marked 'invalid', one of its validations be have invalid for some reason. + // This is a final state. + Invalid State = "invalid" + + // Expired signifies that an ACME resource has expired. + // If an Order is marked 'Expired', one of its validations may have expired or the Order itself. + // This is a final state. + Expired State = "expired" + + // Errored signifies that the ACME resource has errored for some reason. + // This is a catch-all state, and is used for marking internal cert-manager + // errors such as validation failures. + // This is a final state. + Errored State = "errored" +) diff --git a/pkg/apis/acme/v1alpha3/zz_generated.deepcopy.go b/pkg/apis/acme/v1alpha3/zz_generated.deepcopy.go new file mode 100644 index 000000000..c24ce7fab --- /dev/null +++ b/pkg/apis/acme/v1alpha3/zz_generated.deepcopy.go @@ -0,0 +1,778 @@ +// +build !ignore_autogenerated + +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + metav1 "github.com/jetstack/cert-manager/pkg/apis/meta/v1" + v1 "k8s.io/api/core/v1" + v1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ACMEAuthorization) DeepCopyInto(out *ACMEAuthorization) { + *out = *in + if in.Wildcard != nil { + in, out := &in.Wildcard, &out.Wildcard + *out = new(bool) + **out = **in + } + if in.Challenges != nil { + in, out := &in.Challenges, &out.Challenges + *out = make([]ACMEChallenge, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ACMEAuthorization. +func (in *ACMEAuthorization) DeepCopy() *ACMEAuthorization { + if in == nil { + return nil + } + out := new(ACMEAuthorization) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ACMEChallenge) DeepCopyInto(out *ACMEChallenge) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ACMEChallenge. +func (in *ACMEChallenge) DeepCopy() *ACMEChallenge { + if in == nil { + return nil + } + out := new(ACMEChallenge) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ACMEChallengeSolver) DeepCopyInto(out *ACMEChallengeSolver) { + *out = *in + if in.Selector != nil { + in, out := &in.Selector, &out.Selector + *out = new(CertificateDNSNameSelector) + (*in).DeepCopyInto(*out) + } + if in.HTTP01 != nil { + in, out := &in.HTTP01, &out.HTTP01 + *out = new(ACMEChallengeSolverHTTP01) + (*in).DeepCopyInto(*out) + } + if in.DNS01 != nil { + in, out := &in.DNS01, &out.DNS01 + *out = new(ACMEChallengeSolverDNS01) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ACMEChallengeSolver. +func (in *ACMEChallengeSolver) DeepCopy() *ACMEChallengeSolver { + if in == nil { + return nil + } + out := new(ACMEChallengeSolver) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ACMEChallengeSolverDNS01) DeepCopyInto(out *ACMEChallengeSolverDNS01) { + *out = *in + if in.Akamai != nil { + in, out := &in.Akamai, &out.Akamai + *out = new(ACMEIssuerDNS01ProviderAkamai) + **out = **in + } + if in.CloudDNS != nil { + in, out := &in.CloudDNS, &out.CloudDNS + *out = new(ACMEIssuerDNS01ProviderCloudDNS) + (*in).DeepCopyInto(*out) + } + if in.Cloudflare != nil { + in, out := &in.Cloudflare, &out.Cloudflare + *out = new(ACMEIssuerDNS01ProviderCloudflare) + (*in).DeepCopyInto(*out) + } + if in.Route53 != nil { + in, out := &in.Route53, &out.Route53 + *out = new(ACMEIssuerDNS01ProviderRoute53) + **out = **in + } + if in.AzureDNS != nil { + in, out := &in.AzureDNS, &out.AzureDNS + *out = new(ACMEIssuerDNS01ProviderAzureDNS) + **out = **in + } + if in.DigitalOcean != nil { + in, out := &in.DigitalOcean, &out.DigitalOcean + *out = new(ACMEIssuerDNS01ProviderDigitalOcean) + **out = **in + } + if in.AcmeDNS != nil { + in, out := &in.AcmeDNS, &out.AcmeDNS + *out = new(ACMEIssuerDNS01ProviderAcmeDNS) + **out = **in + } + if in.RFC2136 != nil { + in, out := &in.RFC2136, &out.RFC2136 + *out = new(ACMEIssuerDNS01ProviderRFC2136) + **out = **in + } + if in.Webhook != nil { + in, out := &in.Webhook, &out.Webhook + *out = new(ACMEIssuerDNS01ProviderWebhook) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ACMEChallengeSolverDNS01. +func (in *ACMEChallengeSolverDNS01) DeepCopy() *ACMEChallengeSolverDNS01 { + if in == nil { + return nil + } + out := new(ACMEChallengeSolverDNS01) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ACMEChallengeSolverHTTP01) DeepCopyInto(out *ACMEChallengeSolverHTTP01) { + *out = *in + if in.Ingress != nil { + in, out := &in.Ingress, &out.Ingress + *out = new(ACMEChallengeSolverHTTP01Ingress) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ACMEChallengeSolverHTTP01. +func (in *ACMEChallengeSolverHTTP01) DeepCopy() *ACMEChallengeSolverHTTP01 { + if in == nil { + return nil + } + out := new(ACMEChallengeSolverHTTP01) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ACMEChallengeSolverHTTP01Ingress) DeepCopyInto(out *ACMEChallengeSolverHTTP01Ingress) { + *out = *in + if in.Class != nil { + in, out := &in.Class, &out.Class + *out = new(string) + **out = **in + } + if in.PodTemplate != nil { + in, out := &in.PodTemplate, &out.PodTemplate + *out = new(ACMEChallengeSolverHTTP01IngressPodTemplate) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ACMEChallengeSolverHTTP01Ingress. +func (in *ACMEChallengeSolverHTTP01Ingress) DeepCopy() *ACMEChallengeSolverHTTP01Ingress { + if in == nil { + return nil + } + out := new(ACMEChallengeSolverHTTP01Ingress) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ACMEChallengeSolverHTTP01IngressPodObjectMeta) DeepCopyInto(out *ACMEChallengeSolverHTTP01IngressPodObjectMeta) { + *out = *in + if in.Annotations != nil { + in, out := &in.Annotations, &out.Annotations + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ACMEChallengeSolverHTTP01IngressPodObjectMeta. +func (in *ACMEChallengeSolverHTTP01IngressPodObjectMeta) DeepCopy() *ACMEChallengeSolverHTTP01IngressPodObjectMeta { + if in == nil { + return nil + } + out := new(ACMEChallengeSolverHTTP01IngressPodObjectMeta) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ACMEChallengeSolverHTTP01IngressPodSpec) DeepCopyInto(out *ACMEChallengeSolverHTTP01IngressPodSpec) { + *out = *in + if in.NodeSelector != nil { + in, out := &in.NodeSelector, &out.NodeSelector + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Affinity != nil { + in, out := &in.Affinity, &out.Affinity + *out = new(v1.Affinity) + (*in).DeepCopyInto(*out) + } + if in.Tolerations != nil { + in, out := &in.Tolerations, &out.Tolerations + *out = make([]v1.Toleration, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ACMEChallengeSolverHTTP01IngressPodSpec. +func (in *ACMEChallengeSolverHTTP01IngressPodSpec) DeepCopy() *ACMEChallengeSolverHTTP01IngressPodSpec { + if in == nil { + return nil + } + out := new(ACMEChallengeSolverHTTP01IngressPodSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ACMEChallengeSolverHTTP01IngressPodTemplate) DeepCopyInto(out *ACMEChallengeSolverHTTP01IngressPodTemplate) { + *out = *in + in.ACMEChallengeSolverHTTP01IngressPodObjectMeta.DeepCopyInto(&out.ACMEChallengeSolverHTTP01IngressPodObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ACMEChallengeSolverHTTP01IngressPodTemplate. +func (in *ACMEChallengeSolverHTTP01IngressPodTemplate) DeepCopy() *ACMEChallengeSolverHTTP01IngressPodTemplate { + if in == nil { + return nil + } + out := new(ACMEChallengeSolverHTTP01IngressPodTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ACMEExternalAccountBinding) DeepCopyInto(out *ACMEExternalAccountBinding) { + *out = *in + out.Key = in.Key + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ACMEExternalAccountBinding. +func (in *ACMEExternalAccountBinding) DeepCopy() *ACMEExternalAccountBinding { + if in == nil { + return nil + } + out := new(ACMEExternalAccountBinding) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ACMEIssuer) DeepCopyInto(out *ACMEIssuer) { + *out = *in + if in.ExternalAccountBinding != nil { + in, out := &in.ExternalAccountBinding, &out.ExternalAccountBinding + *out = new(ACMEExternalAccountBinding) + **out = **in + } + out.PrivateKey = in.PrivateKey + if in.Solvers != nil { + in, out := &in.Solvers, &out.Solvers + *out = make([]ACMEChallengeSolver, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ACMEIssuer. +func (in *ACMEIssuer) DeepCopy() *ACMEIssuer { + if in == nil { + return nil + } + out := new(ACMEIssuer) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ACMEIssuerDNS01ProviderAcmeDNS) DeepCopyInto(out *ACMEIssuerDNS01ProviderAcmeDNS) { + *out = *in + out.AccountSecret = in.AccountSecret + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ACMEIssuerDNS01ProviderAcmeDNS. +func (in *ACMEIssuerDNS01ProviderAcmeDNS) DeepCopy() *ACMEIssuerDNS01ProviderAcmeDNS { + if in == nil { + return nil + } + out := new(ACMEIssuerDNS01ProviderAcmeDNS) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ACMEIssuerDNS01ProviderAkamai) DeepCopyInto(out *ACMEIssuerDNS01ProviderAkamai) { + *out = *in + out.ClientToken = in.ClientToken + out.ClientSecret = in.ClientSecret + out.AccessToken = in.AccessToken + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ACMEIssuerDNS01ProviderAkamai. +func (in *ACMEIssuerDNS01ProviderAkamai) DeepCopy() *ACMEIssuerDNS01ProviderAkamai { + if in == nil { + return nil + } + out := new(ACMEIssuerDNS01ProviderAkamai) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ACMEIssuerDNS01ProviderAzureDNS) DeepCopyInto(out *ACMEIssuerDNS01ProviderAzureDNS) { + *out = *in + out.ClientSecret = in.ClientSecret + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ACMEIssuerDNS01ProviderAzureDNS. +func (in *ACMEIssuerDNS01ProviderAzureDNS) DeepCopy() *ACMEIssuerDNS01ProviderAzureDNS { + if in == nil { + return nil + } + out := new(ACMEIssuerDNS01ProviderAzureDNS) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ACMEIssuerDNS01ProviderCloudDNS) DeepCopyInto(out *ACMEIssuerDNS01ProviderCloudDNS) { + *out = *in + if in.ServiceAccount != nil { + in, out := &in.ServiceAccount, &out.ServiceAccount + *out = new(metav1.SecretKeySelector) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ACMEIssuerDNS01ProviderCloudDNS. +func (in *ACMEIssuerDNS01ProviderCloudDNS) DeepCopy() *ACMEIssuerDNS01ProviderCloudDNS { + if in == nil { + return nil + } + out := new(ACMEIssuerDNS01ProviderCloudDNS) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ACMEIssuerDNS01ProviderCloudflare) DeepCopyInto(out *ACMEIssuerDNS01ProviderCloudflare) { + *out = *in + if in.APIKey != nil { + in, out := &in.APIKey, &out.APIKey + *out = new(metav1.SecretKeySelector) + **out = **in + } + if in.APIToken != nil { + in, out := &in.APIToken, &out.APIToken + *out = new(metav1.SecretKeySelector) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ACMEIssuerDNS01ProviderCloudflare. +func (in *ACMEIssuerDNS01ProviderCloudflare) DeepCopy() *ACMEIssuerDNS01ProviderCloudflare { + if in == nil { + return nil + } + out := new(ACMEIssuerDNS01ProviderCloudflare) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ACMEIssuerDNS01ProviderDigitalOcean) DeepCopyInto(out *ACMEIssuerDNS01ProviderDigitalOcean) { + *out = *in + out.Token = in.Token + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ACMEIssuerDNS01ProviderDigitalOcean. +func (in *ACMEIssuerDNS01ProviderDigitalOcean) DeepCopy() *ACMEIssuerDNS01ProviderDigitalOcean { + if in == nil { + return nil + } + out := new(ACMEIssuerDNS01ProviderDigitalOcean) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ACMEIssuerDNS01ProviderRFC2136) DeepCopyInto(out *ACMEIssuerDNS01ProviderRFC2136) { + *out = *in + out.TSIGSecret = in.TSIGSecret + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ACMEIssuerDNS01ProviderRFC2136. +func (in *ACMEIssuerDNS01ProviderRFC2136) DeepCopy() *ACMEIssuerDNS01ProviderRFC2136 { + if in == nil { + return nil + } + out := new(ACMEIssuerDNS01ProviderRFC2136) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ACMEIssuerDNS01ProviderRoute53) DeepCopyInto(out *ACMEIssuerDNS01ProviderRoute53) { + *out = *in + out.SecretAccessKey = in.SecretAccessKey + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ACMEIssuerDNS01ProviderRoute53. +func (in *ACMEIssuerDNS01ProviderRoute53) DeepCopy() *ACMEIssuerDNS01ProviderRoute53 { + if in == nil { + return nil + } + out := new(ACMEIssuerDNS01ProviderRoute53) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ACMEIssuerDNS01ProviderWebhook) DeepCopyInto(out *ACMEIssuerDNS01ProviderWebhook) { + *out = *in + if in.Config != nil { + in, out := &in.Config, &out.Config + *out = new(v1beta1.JSON) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ACMEIssuerDNS01ProviderWebhook. +func (in *ACMEIssuerDNS01ProviderWebhook) DeepCopy() *ACMEIssuerDNS01ProviderWebhook { + if in == nil { + return nil + } + out := new(ACMEIssuerDNS01ProviderWebhook) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ACMEIssuerStatus) DeepCopyInto(out *ACMEIssuerStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ACMEIssuerStatus. +func (in *ACMEIssuerStatus) DeepCopy() *ACMEIssuerStatus { + if in == nil { + return nil + } + out := new(ACMEIssuerStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CertificateDNSNameSelector) DeepCopyInto(out *CertificateDNSNameSelector) { + *out = *in + if in.MatchLabels != nil { + in, out := &in.MatchLabels, &out.MatchLabels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.DNSNames != nil { + in, out := &in.DNSNames, &out.DNSNames + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.DNSZones != nil { + in, out := &in.DNSZones, &out.DNSZones + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CertificateDNSNameSelector. +func (in *CertificateDNSNameSelector) DeepCopy() *CertificateDNSNameSelector { + if in == nil { + return nil + } + out := new(CertificateDNSNameSelector) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Challenge) DeepCopyInto(out *Challenge) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Challenge. +func (in *Challenge) DeepCopy() *Challenge { + if in == nil { + return nil + } + out := new(Challenge) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Challenge) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ChallengeList) DeepCopyInto(out *ChallengeList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Challenge, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ChallengeList. +func (in *ChallengeList) DeepCopy() *ChallengeList { + if in == nil { + return nil + } + out := new(ChallengeList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ChallengeList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ChallengeSpec) DeepCopyInto(out *ChallengeSpec) { + *out = *in + if in.Solver != nil { + in, out := &in.Solver, &out.Solver + *out = new(ACMEChallengeSolver) + (*in).DeepCopyInto(*out) + } + out.IssuerRef = in.IssuerRef + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ChallengeSpec. +func (in *ChallengeSpec) DeepCopy() *ChallengeSpec { + if in == nil { + return nil + } + out := new(ChallengeSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ChallengeStatus) DeepCopyInto(out *ChallengeStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ChallengeStatus. +func (in *ChallengeStatus) DeepCopy() *ChallengeStatus { + if in == nil { + return nil + } + out := new(ChallengeStatus) + 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 + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Order. +func (in *Order) DeepCopy() *Order { + if in == nil { + return nil + } + out := new(Order) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Order) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OrderList) DeepCopyInto(out *OrderList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Order, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OrderList. +func (in *OrderList) DeepCopy() *OrderList { + if in == nil { + return nil + } + out := new(OrderList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OrderList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OrderSpec) DeepCopyInto(out *OrderSpec) { + *out = *in + if in.CSR != nil { + in, out := &in.CSR, &out.CSR + *out = make([]byte, len(*in)) + copy(*out, *in) + } + out.IssuerRef = in.IssuerRef + if in.DNSNames != nil { + in, out := &in.DNSNames, &out.DNSNames + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OrderSpec. +func (in *OrderSpec) DeepCopy() *OrderSpec { + if in == nil { + return nil + } + out := new(OrderSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OrderStatus) DeepCopyInto(out *OrderStatus) { + *out = *in + if in.Authorizations != nil { + in, out := &in.Authorizations, &out.Authorizations + *out = make([]ACMEAuthorization, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Certificate != nil { + in, out := &in.Certificate, &out.Certificate + *out = make([]byte, len(*in)) + copy(*out, *in) + } + if in.FailureTime != nil { + in, out := &in.FailureTime, &out.FailureTime + *out = (*in).DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OrderStatus. +func (in *OrderStatus) DeepCopy() *OrderStatus { + if in == nil { + return nil + } + out := new(OrderStatus) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/apis/certmanager/BUILD.bazel b/pkg/apis/certmanager/BUILD.bazel index a801c7862..37898df46 100644 --- a/pkg/apis/certmanager/BUILD.bazel +++ b/pkg/apis/certmanager/BUILD.bazel @@ -19,6 +19,7 @@ filegroup( srcs = [ ":package-srcs", "//pkg/apis/certmanager/v1alpha2:all-srcs", + "//pkg/apis/certmanager/v1alpha3:all-srcs", ], tags = ["automanaged"], visibility = ["//visibility:public"], diff --git a/pkg/apis/certmanager/v1alpha3/BUILD.bazel b/pkg/apis/certmanager/v1alpha3/BUILD.bazel new file mode 100644 index 000000000..7311853e3 --- /dev/null +++ b/pkg/apis/certmanager/v1alpha3/BUILD.bazel @@ -0,0 +1,40 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "const.go", + "doc.go", + "generic_issuer.go", + "register.go", + "types.go", + "types_certificate.go", + "types_certificaterequest.go", + "types_issuer.go", + "zz_generated.deepcopy.go", + ], + importpath = "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha3", + visibility = ["//visibility:public"], + deps = [ + "//pkg/apis/acme/v1alpha3:go_default_library", + "//pkg/apis/certmanager:go_default_library", + "//pkg/apis/meta/v1:go_default_library", + "@io_k8s_apimachinery//pkg/apis/meta/v1:go_default_library", + "@io_k8s_apimachinery//pkg/runtime:go_default_library", + "@io_k8s_apimachinery//pkg/runtime/schema:go_default_library", + ], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/pkg/apis/certmanager/v1alpha3/const.go b/pkg/apis/certmanager/v1alpha3/const.go new file mode 100644 index 000000000..370c49c4e --- /dev/null +++ b/pkg/apis/certmanager/v1alpha3/const.go @@ -0,0 +1,43 @@ +/* +Copyright 2019 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha3 + +import "time" + +const ( + // minimum permitted certificate duration by cert-manager + MinimumCertificateDuration = time.Hour + + // default certificate duration if Issuer.spec.duration is not set + DefaultCertificateDuration = time.Hour * 24 * 90 + + // minimum certificate duration before certificate expiration + MinimumRenewBefore = time.Minute * 5 + + // Default duration before certificate expiration if Issuer.spec.renewBefore is not set + DefaultRenewBefore = time.Hour * 24 * 30 +) + +const ( + // Default index key for the Secret reference for Token authentication + DefaultVaultTokenAuthSecretKey = "token" + + // Default mount path location for Kubernetes ServiceAccount authentication + // (/v1/auth/kubernetes). The endpoint will then be called at `/login`, so + // left as the default, `/v1/auth/kubernetes/login` will be called. + DefaultVaultKubernetesAuthMountPath = "/v1/auth/kubernetes" +) diff --git a/pkg/apis/certmanager/v1alpha3/doc.go b/pkg/apis/certmanager/v1alpha3/doc.go new file mode 100644 index 000000000..fc19684b5 --- /dev/null +++ b/pkg/apis/certmanager/v1alpha3/doc.go @@ -0,0 +1,24 @@ +/* +Copyright 2019 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package v1alpha3 is the v1alpha3 version of the API. +// +k8s:deepcopy-gen=package,register +// +k8s:conversion-gen=github.com/jetstack/cert-manager/pkg/apis/certmanager +// +k8s:openapi-gen=true +// +k8s:defaulter-gen=TypeMeta +// +groupName=cert-manager.io +// +groupGoName=Certmanager +package v1alpha3 diff --git a/pkg/apis/certmanager/v1alpha3/generic_issuer.go b/pkg/apis/certmanager/v1alpha3/generic_issuer.go new file mode 100644 index 000000000..04ed44467 --- /dev/null +++ b/pkg/apis/certmanager/v1alpha3/generic_issuer.go @@ -0,0 +1,85 @@ +/* +Copyright 2019 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha3 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + + cmacme "github.com/jetstack/cert-manager/pkg/apis/acme/v1alpha3" +) + +type GenericIssuer interface { + runtime.Object + metav1.Object + + GetObjectMeta() *metav1.ObjectMeta + GetSpec() *IssuerSpec + GetStatus() *IssuerStatus +} + +var _ GenericIssuer = &Issuer{} +var _ GenericIssuer = &ClusterIssuer{} + +func (c *ClusterIssuer) GetObjectMeta() *metav1.ObjectMeta { + return &c.ObjectMeta +} +func (c *ClusterIssuer) GetSpec() *IssuerSpec { + return &c.Spec +} +func (c *ClusterIssuer) GetStatus() *IssuerStatus { + return &c.Status +} +func (c *ClusterIssuer) SetSpec(spec IssuerSpec) { + c.Spec = spec +} +func (c *ClusterIssuer) SetStatus(status IssuerStatus) { + c.Status = status +} +func (c *ClusterIssuer) Copy() GenericIssuer { + return c.DeepCopy() +} +func (c *Issuer) GetObjectMeta() *metav1.ObjectMeta { + return &c.ObjectMeta +} +func (c *Issuer) GetSpec() *IssuerSpec { + return &c.Spec +} +func (c *Issuer) GetStatus() *IssuerStatus { + return &c.Status +} +func (c *Issuer) SetSpec(spec IssuerSpec) { + c.Spec = spec +} +func (c *Issuer) SetStatus(status IssuerStatus) { + c.Status = status +} +func (c *Issuer) Copy() GenericIssuer { + return c.DeepCopy() +} + +// TODO: refactor these functions away +func (i *IssuerStatus) ACMEStatus() *cmacme.ACMEIssuerStatus { + // this is an edge case, but this will prevent panics + if i == nil { + return &cmacme.ACMEIssuerStatus{} + } + if i.ACME == nil { + i.ACME = &cmacme.ACMEIssuerStatus{} + } + return i.ACME +} diff --git a/pkg/apis/certmanager/v1alpha3/register.go b/pkg/apis/certmanager/v1alpha3/register.go new file mode 100644 index 000000000..7e3ce2a81 --- /dev/null +++ b/pkg/apis/certmanager/v1alpha3/register.go @@ -0,0 +1,62 @@ +/* +Copyright 2019 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha3 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + + "github.com/jetstack/cert-manager/pkg/apis/certmanager" +) + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: certmanager.GroupName, Version: "v1alpha3"} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + SchemeBuilder runtime.SchemeBuilder + localSchemeBuilder = &SchemeBuilder + AddToScheme = localSchemeBuilder.AddToScheme +) + +func init() { + // We only register manually written functions here. The registration of the + // generated functions takes place in the generated files. The separation + // makes the code compile even when the generated files are missing. + localSchemeBuilder.Register(addKnownTypes) +} + +// Adds the list of known types to api.Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &Certificate{}, + &CertificateList{}, + &Issuer{}, + &IssuerList{}, + &ClusterIssuer{}, + &ClusterIssuerList{}, + &CertificateRequest{}, + &CertificateRequestList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/pkg/apis/certmanager/v1alpha3/types.go b/pkg/apis/certmanager/v1alpha3/types.go new file mode 100644 index 000000000..4eec7b05c --- /dev/null +++ b/pkg/apis/certmanager/v1alpha3/types.go @@ -0,0 +1,162 @@ +/* +Copyright 2019 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha3 + +// Annotation names for Secrets +const ( + AltNamesAnnotationKey = "cert-manager.io/alt-names" + IPSANAnnotationKey = "cert-manager.io/ip-sans" + URISANAnnotationKey = "cert-manager.io/uri-sans" + CommonNameAnnotationKey = "cert-manager.io/common-name" + IssuerNameAnnotationKey = "cert-manager.io/issuer-name" + IssuerKindAnnotationKey = "cert-manager.io/issuer-kind" + IssuerGroupAnnotationKey = "cert-manager.io/issuer-group" + CertificateNameKey = "cert-manager.io/certificate-name" +) + +// Deprecated annotation names for Secrets +const ( + DeprecatedIssuerNameAnnotationKey = "certmanager.k8s.io/issuer-name" + DeprecatedIssuerKindAnnotationKey = "certmanager.k8s.io/issuer-kind" +) + +const ( + // issuerNameAnnotation can be used to override the issuer specified on the + // created Certificate resource. + IngressIssuerNameAnnotationKey = "cert-manager.io/issuer" + // clusterIssuerNameAnnotation can be used to override the issuer specified on the + // created Certificate resource. The Certificate will reference the + // specified *ClusterIssuer* instead of normal issuer. + IngressClusterIssuerNameAnnotationKey = "cert-manager.io/cluster-issuer" + // acmeIssuerHTTP01IngressClassAnnotation can be used to override the http01 ingressClass + // if the challenge type is set to http01 + IngressACMEIssuerHTTP01IngressClassAnnotationKey = "acme.cert-manager.io/http01-ingress-class" + + // IngessClassAnnotationKey picks a specific "class" for the Ingress. The + // controller only processes Ingresses with this annotation either unset, or + // set to either the configured value or the empty string. + IngressClassAnnotationKey = "kubernetes.io/ingress.class" +) + +// Annotation names for CertificateRequests +const ( + CRPrivateKeyAnnotationKey = "cert-manager.io/private-key-secret-name" +) + +const ( + // IssueTemporaryCertificateAnnotation is an annotation that can be added to + // Certificate resources. + // If it is present, a temporary internally signed certificate will be + // stored in the target Secret resource whilst the real Issuer is processing + // the certificate request. + IssueTemporaryCertificateAnnotation = "cert-manager.io/issue-temporary-certificate" +) + +const ( + ClusterIssuerKind = "ClusterIssuer" + IssuerKind = "Issuer" + CertificateKind = "Certificate" + CertificateRequestKind = "CertificateRequest" +) + +const ( + // WantInjectAnnotation is the annotation that specifies that a particular + // object wants injection of CAs. It takes the form of a reference to a certificate + // as namespace/name. The certificate is expected to have the is-serving-for annotations. + WantInjectAnnotation = "cert-manager.io/inject-ca-from" + + // WantInjectAPIServerCAAnnotation, if set to "true", will make the cainjector + // inject the CA certificate for the Kubernetes apiserver into the resource. + // It discovers the apiserver's CA by inspecting the service account credentials + // mounted into the cainjector pod. + WantInjectAPIServerCAAnnotation = "cert-manager.io/inject-apiserver-ca" + + // WantInjectFromSecretAnnotation is the annotation that specifies that a particular + // object wants injection of CAs. It takes the form of a reference to a Secret + // as namespace/name. + WantInjectFromSecretAnnotation = "cert-manager.io/inject-ca-from-secret" + + // AllowsInjectionFromSecretAnnotation is an annotation that must be added + // to Secret resource that want to denote that they can be directly + // injected into injectables that have a `inject-ca-from-secret` annotation. + // If an injectable references a Secret that does NOT have this annotation, + // the cainjector will refuse to inject the secret. + AllowsInjectionFromSecretAnnotation = "cert-manager.io/allow-direct-injection" +) + +// KeyUsage specifies valid usage contexts for keys. +// See: https://tools.ietf.org/html/rfc5280#section-4.2.1.3 +// https://tools.ietf.org/html/rfc5280#section-4.2.1.12 +// Valid KeyUsage values are as follows: +// "signing", +// "digital signature", +// "content commitment", +// "key encipherment", +// "key agreement", +// "data encipherment", +// "cert sign", +// "crl sign", +// "encipher only", +// "decipher only", +// "any", +// "server auth", +// "client auth", +// "code signing", +// "email protection", +// "s/mime", +// "ipsec end system", +// "ipsec tunnel", +// "ipsec user", +// "timestamping", +// "ocsp signing", +// "microsoft sgc", +// "netscape sgc" +// +kubebuilder:validation:Enum="signing";"digital signature";"content commitment";"key encipherment";"key agreement";"data encipherment";"cert sign";"crl sign";"encipher only";"decipher only";"any";"server auth";"client auth";"code signing";"email protection";"s/mime";"ipsec end system";"ipsec tunnel";"ipsec user";"timestamping";"ocsp signing";"microsoft sgc";"netscape sgc" +type KeyUsage string + +const ( + UsageSigning KeyUsage = "signing" + UsageDigitalSignature KeyUsage = "digital signature" + UsageContentCommittment KeyUsage = "content commitment" + UsageKeyEncipherment KeyUsage = "key encipherment" + UsageKeyAgreement KeyUsage = "key agreement" + UsageDataEncipherment KeyUsage = "data encipherment" + UsageCertSign KeyUsage = "cert sign" + UsageCRLSign KeyUsage = "crl sign" + UsageEncipherOnly KeyUsage = "encipher only" + UsageDecipherOnly KeyUsage = "decipher only" + UsageAny KeyUsage = "any" + UsageServerAuth KeyUsage = "server auth" + UsageClientAuth KeyUsage = "client auth" + UsageCodeSigning KeyUsage = "code signing" + UsageEmailProtection KeyUsage = "email protection" + UsageSMIME KeyUsage = "s/mime" + UsageIPsecEndSystem KeyUsage = "ipsec end system" + UsageIPsecTunnel KeyUsage = "ipsec tunnel" + UsageIPsecUser KeyUsage = "ipsec user" + UsageTimestamping KeyUsage = "timestamping" + UsageOCSPSigning KeyUsage = "ocsp signing" + UsageMicrosoftSGC KeyUsage = "microsoft sgc" + UsageNetscapSGC KeyUsage = "netscape sgc" +) + +// DefaultKeyUsages contains the default list of key usages +func DefaultKeyUsages() []KeyUsage { + // The serverAuth EKU is required as of Mac OS Catalina: https://support.apple.com/en-us/HT210176 + // Without this usage, certificates will _always_ flag a warning in newer Mac OS browsers. + return []KeyUsage{UsageDigitalSignature, UsageKeyEncipherment, UsageServerAuth} +} diff --git a/pkg/apis/certmanager/v1alpha3/types_certificate.go b/pkg/apis/certmanager/v1alpha3/types_certificate.go new file mode 100644 index 000000000..64c457815 --- /dev/null +++ b/pkg/apis/certmanager/v1alpha3/types_certificate.go @@ -0,0 +1,226 @@ +/* +Copyright 2019 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha3 + +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 + +// Certificate is a type to represent a Certificate from ACME +// +k8s:openapi-gen=true +// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].status",description="" +// +kubebuilder:printcolumn:name="Secret",type="string",JSONPath=".spec.secretName",description="" +// +kubebuilder:printcolumn:name="Issuer",type="string",JSONPath=".spec.issuerRef.name",description="",priority=1 +// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].message",priority=1 +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC." +// +kubebuilder:subresource:status +// +kubebuilder:resource:path=certificates,shortName=cert;certs +type Certificate struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec CertificateSpec `json:"spec,omitempty"` + Status CertificateStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// CertificateList is a list of Certificates +type CertificateList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []Certificate `json:"items"` +} + +// +kubebuilder:validation:Enum=rsa;ecdsa +type KeyAlgorithm string + +const ( + RSAKeyAlgorithm KeyAlgorithm = "rsa" + ECDSAKeyAlgorithm KeyAlgorithm = "ecdsa" +) + +// +kubebuilder:validation:Enum=pkcs1;pkcs8 +type KeyEncoding string + +const ( + PKCS1 KeyEncoding = "pkcs1" + PKCS8 KeyEncoding = "pkcs8" +) + +// CertificateSpec defines the desired state of Certificate. +// A valid Certificate requires at least one of a CommonName, DNSName, or +// URISAN to be valid. +type CertificateSpec struct { + // Full X509 name specification (https://golang.org/pkg/crypto/x509/pkix/#Name). + // +optional + Subject *X509Subject `json:"subject,omitempty"` + + // CommonName is a common name to be used on the Certificate. + // The CommonName should have a length of 64 characters or fewer to avoid + // generating invalid CSRs. + // +optional + CommonName string `json:"commonName,omitempty"` + + // Organization is the organization to be used on the Certificate + // +optional + Organization []string `json:"organization,omitempty"` + + // Certificate default Duration + // +optional + Duration *metav1.Duration `json:"duration,omitempty"` + + // Certificate renew before expiration duration + // +optional + RenewBefore *metav1.Duration `json:"renewBefore,omitempty"` + + // DNSNames is a list of subject alt names to be used on the Certificate. + // +optional + DNSNames []string `json:"dnsNames,omitempty"` + + // IPAddresses is a list of IP addresses to be used on the Certificate + // +optional + IPAddresses []string `json:"ipAddresses,omitempty"` + + // URISANs is a list of URI Subject Alternative Names to be set on this + // Certificate. + // +optional + URISANs []string `json:"uriSANs,omitempty"` + + // SecretName is the name of the secret resource to store this secret in + SecretName string `json:"secretName"` + + // IssuerRef is a reference to the issuer for this certificate. + // If the 'kind' field is not set, or set to 'Issuer', an Issuer resource + // with the given name in the same namespace as the Certificate will be used. + // 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 cmmeta.ObjectReference `json:"issuerRef"` + + // IsCA will mark this Certificate as valid for signing. + // This implies that the 'cert sign' usage is set + // +optional + IsCA bool `json:"isCA,omitempty"` + + // Usages is the set of x509 actions that are enabled for a given key. Defaults are ('digital signature', 'key encipherment') if empty + // +optional + Usages []KeyUsage `json:"usages,omitempty"` + + // KeySize is the key bit size of the corresponding private key for this certificate. + // If provided, value must be between 2048 and 8192 inclusive when KeyAlgorithm is + // empty or is set to "rsa", and value must be one of (256, 384, 521) when + // KeyAlgorithm is set to "ecdsa". + // +optional + KeySize int `json:"keySize,omitempty"` + + // KeyAlgorithm is the private key algorithm of the corresponding private key + // for this certificate. If provided, allowed values are either "rsa" or "ecdsa" + // If KeyAlgorithm is specified and KeySize is not provided, + // key size of 256 will be used for "ecdsa" key algorithm and + // key size of 2048 will be used for "rsa" key algorithm. + // +optional + KeyAlgorithm KeyAlgorithm `json:"keyAlgorithm,omitempty"` + + // KeyEncoding is the private key cryptography standards (PKCS) + // for this certificate's private key to be encoded in. If provided, allowed + // values are "pkcs1" and "pkcs8" standing for PKCS#1 and PKCS#8, respectively. + // If KeyEncoding is not specified, then PKCS#1 will be used by default. + KeyEncoding KeyEncoding `json:"keyEncoding,omitempty"` +} + +// X509Subject Full X509 name specification +type X509Subject struct { + // Countries to be used on the Certificate. + // +optional + Countries []string `json:"countries,omitempty"` + // Organizational Units to be used on the Certificate. + // +optional + OrganizationalUnits []string `json:"organizationalUnits,omitempty"` + // Cities to be used on the Certificate. + // +optional + Localities []string `json:"localities,omitempty"` + // State/Provinces to be used on the Certificate. + // +optional + Provinces []string `json:"provinces,omitempty"` + // Street addresses to be used on the Certificate. + // +optional + StreetAddresses []string `json:"streetAddresses,omitempty"` + // Postal codes to be used on the Certificate. + // +optional + PostalCodes []string `json:"postalCodes,omitempty"` + // Serial number to be used on the Certificate. + // +optional + SerialNumber string `json:"serialNumber,omitempty"` +} + +// CertificateStatus defines the observed state of Certificate +type CertificateStatus struct { + // +optional + Conditions []CertificateCondition `json:"conditions,omitempty"` + + // +optional + LastFailureTime *metav1.Time `json:"lastFailureTime,omitempty"` + + // The expiration time of the certificate stored in the secret named + // by this resource in spec.secretName. + // +optional + NotAfter *metav1.Time `json:"notAfter,omitempty"` +} + +// CertificateCondition contains condition information for an Certificate. +type CertificateCondition struct { + // Type of the condition, currently ('Ready'). + Type CertificateConditionType `json:"type"` + + // Status of the condition, one of ('True', 'False', 'Unknown'). + Status cmmeta.ConditionStatus `json:"status"` + + // LastTransitionTime is the timestamp corresponding to the last status + // change of this condition. + // +optional + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` + + // Reason is a brief machine readable explanation for the condition's last + // transition. + // +optional + Reason string `json:"reason,omitempty"` + + // Message is a human readable description of the details of the last + // transition, complementing reason. + // +optional + Message string `json:"message,omitempty"` +} + +// CertificateConditionType represents an Certificate condition value. +type CertificateConditionType string + +const ( + // CertificateConditionReady indicates that a certificate is ready for use. + // This is defined as: + // - The target secret exists + // - The target secret contains a certificate that has not expired + // - The target secret contains a private key valid for the certificate + // - The commonName and dnsNames attributes match those specified on the Certificate + CertificateConditionReady CertificateConditionType = "Ready" +) diff --git a/pkg/apis/certmanager/v1alpha3/types_certificaterequest.go b/pkg/apis/certmanager/v1alpha3/types_certificaterequest.go new file mode 100644 index 000000000..69bcfe1c3 --- /dev/null +++ b/pkg/apis/certmanager/v1alpha3/types_certificaterequest.go @@ -0,0 +1,143 @@ +/* +Copyright 2019 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha3 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + cmmeta "github.com/jetstack/cert-manager/pkg/apis/meta/v1" +) + +const ( + CertificateRequestReasonPending = "Pending" + CertificateRequestReasonFailed = "Failed" + CertificateRequestReasonIssued = "Issued" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// CertificateRequest is a type to represent a Certificate Signing Request +// +k8s:openapi-gen=true +// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].status",description="" +// +kubebuilder:printcolumn:name="Issuer",type="string",JSONPath=".spec.issuerRef.name",description="",priority=1 +// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].message",priority=1 +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC." +// +kubebuilder:subresource:status +// +kubebuilder:resource:path=certificaterequests,shortName=cr;crs +type CertificateRequest struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec CertificateRequestSpec `json:"spec,omitempty"` + Status CertificateRequestStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// CertificateRequestList is a list of Certificates +type CertificateRequestList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []CertificateRequest `json:"items"` +} + +// CertificateRequestSpec defines the desired state of CertificateRequest +type CertificateRequestSpec struct { + // Requested certificate default Duration + // +optional + Duration *metav1.Duration `json:"duration,omitempty"` + + // IssuerRef is a reference to the issuer for this CertificateRequest. If + // the 'kind' field is not set, or set to 'Issuer', an Issuer resource with + // the given name in the same namespace as the CertificateRequest will be + // used. 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. The group field refers to the API group of the + // issuer which defaults to 'cert-manager.io' if empty. + IssuerRef cmmeta.ObjectReference `json:"issuerRef"` + + // Byte slice containing the PEM encoded CertificateSigningRequest + CSRPEM []byte `json:"csr"` + + // IsCA will mark the resulting certificate as valid for signing. This + // implies that the 'cert sign' usage is set + // +optional + IsCA bool `json:"isCA,omitempty"` + + // Usages is the set of x509 actions that are enabled for a given key. + // Defaults are ('digital signature', 'key encipherment') if empty + // +optional + Usages []KeyUsage `json:"usages,omitempty"` +} + +// CertificateStatus defines the observed state of CertificateRequest and +// resulting signed certificate. +type CertificateRequestStatus struct { + // +optional + Conditions []CertificateRequestCondition `json:"conditions,omitempty"` + + // Byte slice containing a PEM encoded signed certificate resulting from the + // given certificate signing request. + // +optional + Certificate []byte `json:"certificate,omitempty"` + + // Byte slice containing the PEM encoded certificate authority of the signed + // certificate. + // +optional + CA []byte `json:"ca,omitempty"` + + // FailureTime stores the time that this CertificateRequest failed. This is + // used to influence garbage collection and back-off. + // +optional + FailureTime *metav1.Time `json:"failureTime,omitempty"` +} + +// CertificateRequestCondition contains condition information for a CertificateRequest. +type CertificateRequestCondition struct { + // Type of the condition, currently ('Ready'). + Type CertificateRequestConditionType `json:"type"` + + // Status of the condition, one of ('True', 'False', 'Unknown'). + Status cmmeta.ConditionStatus `json:"status"` + + // LastTransitionTime is the timestamp corresponding to the last status + // change of this condition. + // +optional + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` + + // Reason is a brief machine readable explanation for the condition's last + // transition. + // +optional + Reason string `json:"reason,omitempty"` + + // Message is a human readable description of the details of the last + // transition, complementing reason. + // +optional + Message string `json:"message,omitempty"` +} + +// CertificateRequestConditionType represents an Certificate condition value. +type CertificateRequestConditionType string + +const ( + // CertificateRequestConditionReady indicates that a certificate is ready for use. + // This is defined as: + // - The target certificate exists in CertificateRequest.Status + CertificateRequestConditionReady CertificateRequestConditionType = "Ready" +) diff --git a/pkg/apis/certmanager/v1alpha3/types_issuer.go b/pkg/apis/certmanager/v1alpha3/types_issuer.go new file mode 100644 index 000000000..c87f0171f --- /dev/null +++ b/pkg/apis/certmanager/v1alpha3/types_issuer.go @@ -0,0 +1,262 @@ +/* +Copyright 2019 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha3 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + cmacme "github.com/jetstack/cert-manager/pkg/apis/acme/v1alpha3" + cmmeta "github.com/jetstack/cert-manager/pkg/apis/meta/v1" +) + +// +genclient +// +genclient:nonNamespaced +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// +kubebuilder:subresource:status +// +kubebuilder:resource:path=clusterissuers,scope=Cluster +type ClusterIssuer struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec IssuerSpec `json:"spec,omitempty"` + Status IssuerStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ClusterIssuerList is a list of Issuers +type ClusterIssuerList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []ClusterIssuer `json:"items"` +} + +// +genclient +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].status",description="" +// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].message",description="" +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC." +// +kubebuilder:subresource:status +// +kubebuilder:resource:path=issuers +type Issuer struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec IssuerSpec `json:"spec,omitempty"` + Status IssuerStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// IssuerList is a list of Issuers +type IssuerList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []Issuer `json:"items"` +} + +// IssuerSpec is the specification of an Issuer. This includes any +// configuration required for the issuer. +type IssuerSpec struct { + IssuerConfig `json:",inline"` +} + +type IssuerConfig struct { + // +optional + ACME *cmacme.ACMEIssuer `json:"acme,omitempty"` + + // +optional + CA *CAIssuer `json:"ca,omitempty"` + + // +optional + Vault *VaultIssuer `json:"vault,omitempty"` + + // +optional + SelfSigned *SelfSignedIssuer `json:"selfSigned,omitempty"` + + // +optional + Venafi *VenafiIssuer `json:"venafi,omitempty"` +} + +// VenafiIssuer describes issuer configuration details for Venafi Cloud. +type VenafiIssuer struct { + // Zone is the Venafi Policy Zone to use for this issuer. + // All requests made to the Venafi platform will be restricted by the named + // zone policy. + // This field is required. + Zone string `json:"zone"` + + // TPP specifies Trust Protection Platform configuration settings. + // Only one of TPP or Cloud may be specified. + // +optional + TPP *VenafiTPP `json:"tpp,omitempty"` + + // Cloud specifies the Venafi cloud configuration settings. + // Only one of TPP or Cloud may be specified. + // +optional + Cloud *VenafiCloud `json:"cloud,omitempty"` +} + +// VenafiTPP defines connection configuration details for a Venafi TPP instance +type VenafiTPP struct { + // URL is the base URL for the Venafi TPP instance + URL string `json:"url"` + + // 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 cmmeta.LocalObjectReference `json:"credentialsRef"` + + // CABundle is a PEM encoded TLS certifiate to use to verify connections to + // the TPP instance. + // If specified, system roots will not be used and the issuing CA for the + // TPP instance must be verifiable using the provided root. + // If not specified, the connection will be verified using the cert-manager + // system root certificates. + // +optional + CABundle []byte `json:"caBundle,omitempty"` +} + +// VenafiCloud defines connection configuration details for Venafi Cloud +type VenafiCloud struct { + // URL is the base URL for Venafi Cloud + URL string `json:"url"` + + // APITokenSecretRef is a secret key selector for the Venafi Cloud API token. + APITokenSecretRef cmmeta.SecretKeySelector `json:"apiTokenSecretRef"` +} + +type SelfSignedIssuer struct{} + +type VaultIssuer struct { + // Vault authentication + Auth VaultAuth `json:"auth"` + + // Server is the vault connection address + Server string `json:"server"` + + // Vault URL path to the certificate role + Path string `json:"path"` + + // Base64 encoded CA bundle to validate Vault server certificate. Only used + // if the Server URL is using HTTPS protocol. This parameter is ignored for + // plain HTTP protocol connection. If not set the system root certificates + // are used to validate the TLS connection. + // +optional + CABundle []byte `json:"caBundle,omitempty"` +} + +// Vault authentication can be configured: +// - With a secret containing a token. Cert-manager is using this token as-is. +// - With a secret containing a AppRole. This AppRole is used to authenticate to +// Vault and retrieve a token. +type VaultAuth struct { + // This Secret contains the Vault token key + // +optional + TokenSecretRef *cmmeta.SecretKeySelector `json:"tokenSecretRef,omitempty"` + + // This Secret contains a AppRole and Secret + // +optional + AppRole *VaultAppRole `json:"appRole,omitempty"` + + // This contains a Role and Secret with a ServiceAccount token to + // authenticate with vault. + // +optional + Kubernetes *VaultKubernetesAuth `json:"kubernetes,omitempty"` +} + +type VaultAppRole struct { + // Where the authentication path is mounted in Vault. + Path string `json:"path"` + + RoleId string `json:"roleId"` + SecretRef cmmeta.SecretKeySelector `json:"secretRef"` +} + +// Authenticate against Vault using a Kubernetes ServiceAccount token stored in +// a Secret. +type VaultKubernetesAuth struct { + // The Vault mountPath here is the mount path to use when authenticating with + // Vault. For example, setting a value to `/v1/auth/foo`, will use the path + // `/v1/auth/foo/login` to authenticate with Vault. If unspecified, the + // default value "/v1/auth/kubernetes" will be used. + // +optional + Path string `json:"mountPath,omitempty"` + + // The required Secret field containing a Kubernetes ServiceAccount JWT used + // for authenticating with Vault. Use of 'ambient credentials' is not + // supported. + SecretRef cmmeta.SecretKeySelector `json:"secretRef"` + + // A required field containing the Vault Role to assume. A Role binds a + // Kubernetes ServiceAccount with a set of Vault policies. + Role string `json:"role"` +} + +type CAIssuer struct { + // SecretName is the name of the secret used to sign Certificates issued + // by this Issuer. + SecretName string `json:"secretName"` +} + +// IssuerStatus contains status information about an Issuer +type IssuerStatus struct { + // +optional + Conditions []IssuerCondition `json:"conditions,omitempty"` + + // +optional + ACME *cmacme.ACMEIssuerStatus `json:"acme,omitempty"` +} + +// IssuerCondition contains condition information for an Issuer. +type IssuerCondition struct { + // Type of the condition, currently ('Ready'). + Type IssuerConditionType `json:"type"` + + // Status of the condition, one of ('True', 'False', 'Unknown'). + Status cmmeta.ConditionStatus `json:"status"` + + // LastTransitionTime is the timestamp corresponding to the last status + // change of this condition. + // +optional + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` + + // Reason is a brief machine readable explanation for the condition's last + // transition. + // +optional + Reason string `json:"reason,omitempty"` + + // Message is a human readable description of the details of the last + // transition, complementing reason. + // +optional + Message string `json:"message,omitempty"` +} + +// IssuerConditionType represents an Issuer condition value. +type IssuerConditionType string + +const ( + // IssuerConditionReady represents the fact that a given Issuer condition + // is in ready state. + IssuerConditionReady IssuerConditionType = "Ready" +) diff --git a/pkg/apis/certmanager/v1alpha3/zz_generated.deepcopy.go b/pkg/apis/certmanager/v1alpha3/zz_generated.deepcopy.go new file mode 100644 index 000000000..093891b76 --- /dev/null +++ b/pkg/apis/certmanager/v1alpha3/zz_generated.deepcopy.go @@ -0,0 +1,805 @@ +// +build !ignore_autogenerated + +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + acmev1alpha3 "github.com/jetstack/cert-manager/pkg/apis/acme/v1alpha3" + metav1 "github.com/jetstack/cert-manager/pkg/apis/meta/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// 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 + 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 + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Certificate. +func (in *Certificate) DeepCopy() *Certificate { + if in == nil { + return nil + } + out := new(Certificate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Certificate) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CertificateCondition) DeepCopyInto(out *CertificateCondition) { + *out = *in + if in.LastTransitionTime != nil { + in, out := &in.LastTransitionTime, &out.LastTransitionTime + *out = (*in).DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CertificateCondition. +func (in *CertificateCondition) DeepCopy() *CertificateCondition { + if in == nil { + return nil + } + out := new(CertificateCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CertificateList) DeepCopyInto(out *CertificateList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Certificate, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CertificateList. +func (in *CertificateList) DeepCopy() *CertificateList { + if in == nil { + return nil + } + out := new(CertificateList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CertificateList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CertificateRequest) DeepCopyInto(out *CertificateRequest) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CertificateRequest. +func (in *CertificateRequest) DeepCopy() *CertificateRequest { + if in == nil { + return nil + } + out := new(CertificateRequest) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CertificateRequest) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CertificateRequestCondition) DeepCopyInto(out *CertificateRequestCondition) { + *out = *in + if in.LastTransitionTime != nil { + in, out := &in.LastTransitionTime, &out.LastTransitionTime + *out = (*in).DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CertificateRequestCondition. +func (in *CertificateRequestCondition) DeepCopy() *CertificateRequestCondition { + if in == nil { + return nil + } + out := new(CertificateRequestCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CertificateRequestList) DeepCopyInto(out *CertificateRequestList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]CertificateRequest, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CertificateRequestList. +func (in *CertificateRequestList) DeepCopy() *CertificateRequestList { + if in == nil { + return nil + } + out := new(CertificateRequestList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CertificateRequestList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CertificateRequestSpec) DeepCopyInto(out *CertificateRequestSpec) { + *out = *in + if in.Duration != nil { + in, out := &in.Duration, &out.Duration + *out = new(v1.Duration) + **out = **in + } + out.IssuerRef = in.IssuerRef + if in.CSRPEM != nil { + in, out := &in.CSRPEM, &out.CSRPEM + *out = make([]byte, len(*in)) + copy(*out, *in) + } + if in.Usages != nil { + in, out := &in.Usages, &out.Usages + *out = make([]KeyUsage, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CertificateRequestSpec. +func (in *CertificateRequestSpec) DeepCopy() *CertificateRequestSpec { + if in == nil { + return nil + } + out := new(CertificateRequestSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CertificateRequestStatus) DeepCopyInto(out *CertificateRequestStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]CertificateRequestCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Certificate != nil { + in, out := &in.Certificate, &out.Certificate + *out = make([]byte, len(*in)) + copy(*out, *in) + } + if in.CA != nil { + in, out := &in.CA, &out.CA + *out = make([]byte, len(*in)) + copy(*out, *in) + } + if in.FailureTime != nil { + in, out := &in.FailureTime, &out.FailureTime + *out = (*in).DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CertificateRequestStatus. +func (in *CertificateRequestStatus) DeepCopy() *CertificateRequestStatus { + if in == nil { + return nil + } + out := new(CertificateRequestStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CertificateSpec) DeepCopyInto(out *CertificateSpec) { + *out = *in + if in.Subject != nil { + in, out := &in.Subject, &out.Subject + *out = new(X509Subject) + (*in).DeepCopyInto(*out) + } + if in.Organization != nil { + in, out := &in.Organization, &out.Organization + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Duration != nil { + in, out := &in.Duration, &out.Duration + *out = new(v1.Duration) + **out = **in + } + if in.RenewBefore != nil { + in, out := &in.RenewBefore, &out.RenewBefore + *out = new(v1.Duration) + **out = **in + } + if in.DNSNames != nil { + in, out := &in.DNSNames, &out.DNSNames + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.IPAddresses != nil { + in, out := &in.IPAddresses, &out.IPAddresses + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.URISANs != nil { + in, out := &in.URISANs, &out.URISANs + *out = make([]string, len(*in)) + copy(*out, *in) + } + out.IssuerRef = in.IssuerRef + if in.Usages != nil { + in, out := &in.Usages, &out.Usages + *out = make([]KeyUsage, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CertificateSpec. +func (in *CertificateSpec) DeepCopy() *CertificateSpec { + if in == nil { + return nil + } + out := new(CertificateSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CertificateStatus) DeepCopyInto(out *CertificateStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]CertificateCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.LastFailureTime != nil { + in, out := &in.LastFailureTime, &out.LastFailureTime + *out = (*in).DeepCopy() + } + if in.NotAfter != nil { + in, out := &in.NotAfter, &out.NotAfter + *out = (*in).DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CertificateStatus. +func (in *CertificateStatus) DeepCopy() *CertificateStatus { + if in == nil { + return nil + } + out := new(CertificateStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterIssuer) DeepCopyInto(out *ClusterIssuer) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterIssuer. +func (in *ClusterIssuer) DeepCopy() *ClusterIssuer { + if in == nil { + return nil + } + out := new(ClusterIssuer) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterIssuer) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterIssuerList) DeepCopyInto(out *ClusterIssuerList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ClusterIssuer, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterIssuerList. +func (in *ClusterIssuerList) DeepCopy() *ClusterIssuerList { + if in == nil { + return nil + } + out := new(ClusterIssuerList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterIssuerList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Issuer) DeepCopyInto(out *Issuer) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Issuer. +func (in *Issuer) DeepCopy() *Issuer { + if in == nil { + return nil + } + out := new(Issuer) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Issuer) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IssuerCondition) DeepCopyInto(out *IssuerCondition) { + *out = *in + if in.LastTransitionTime != nil { + in, out := &in.LastTransitionTime, &out.LastTransitionTime + *out = (*in).DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IssuerCondition. +func (in *IssuerCondition) DeepCopy() *IssuerCondition { + if in == nil { + return nil + } + out := new(IssuerCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IssuerConfig) DeepCopyInto(out *IssuerConfig) { + *out = *in + if in.ACME != nil { + in, out := &in.ACME, &out.ACME + *out = new(acmev1alpha3.ACMEIssuer) + (*in).DeepCopyInto(*out) + } + if in.CA != nil { + in, out := &in.CA, &out.CA + *out = new(CAIssuer) + **out = **in + } + if in.Vault != nil { + in, out := &in.Vault, &out.Vault + *out = new(VaultIssuer) + (*in).DeepCopyInto(*out) + } + if in.SelfSigned != nil { + in, out := &in.SelfSigned, &out.SelfSigned + *out = new(SelfSignedIssuer) + **out = **in + } + if in.Venafi != nil { + in, out := &in.Venafi, &out.Venafi + *out = new(VenafiIssuer) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IssuerConfig. +func (in *IssuerConfig) DeepCopy() *IssuerConfig { + if in == nil { + return nil + } + out := new(IssuerConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IssuerList) DeepCopyInto(out *IssuerList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Issuer, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IssuerList. +func (in *IssuerList) DeepCopy() *IssuerList { + if in == nil { + return nil + } + out := new(IssuerList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *IssuerList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IssuerSpec) DeepCopyInto(out *IssuerSpec) { + *out = *in + in.IssuerConfig.DeepCopyInto(&out.IssuerConfig) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IssuerSpec. +func (in *IssuerSpec) DeepCopy() *IssuerSpec { + if in == nil { + return nil + } + out := new(IssuerSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IssuerStatus) DeepCopyInto(out *IssuerStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]IssuerCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ACME != nil { + in, out := &in.ACME, &out.ACME + *out = new(acmev1alpha3.ACMEIssuerStatus) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IssuerStatus. +func (in *IssuerStatus) DeepCopy() *IssuerStatus { + if in == nil { + return nil + } + out := new(IssuerStatus) + 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 + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SelfSignedIssuer. +func (in *SelfSignedIssuer) DeepCopy() *SelfSignedIssuer { + if in == nil { + return nil + } + out := new(SelfSignedIssuer) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VaultAppRole) DeepCopyInto(out *VaultAppRole) { + *out = *in + out.SecretRef = in.SecretRef + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VaultAppRole. +func (in *VaultAppRole) DeepCopy() *VaultAppRole { + if in == nil { + return nil + } + out := new(VaultAppRole) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VaultAuth) DeepCopyInto(out *VaultAuth) { + *out = *in + if in.TokenSecretRef != nil { + in, out := &in.TokenSecretRef, &out.TokenSecretRef + *out = new(metav1.SecretKeySelector) + **out = **in + } + if in.AppRole != nil { + in, out := &in.AppRole, &out.AppRole + *out = new(VaultAppRole) + **out = **in + } + if in.Kubernetes != nil { + in, out := &in.Kubernetes, &out.Kubernetes + *out = new(VaultKubernetesAuth) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VaultAuth. +func (in *VaultAuth) DeepCopy() *VaultAuth { + if in == nil { + return nil + } + out := new(VaultAuth) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VaultIssuer) DeepCopyInto(out *VaultIssuer) { + *out = *in + in.Auth.DeepCopyInto(&out.Auth) + if in.CABundle != nil { + in, out := &in.CABundle, &out.CABundle + *out = make([]byte, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VaultIssuer. +func (in *VaultIssuer) DeepCopy() *VaultIssuer { + if in == nil { + return nil + } + out := new(VaultIssuer) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VaultKubernetesAuth) DeepCopyInto(out *VaultKubernetesAuth) { + *out = *in + out.SecretRef = in.SecretRef + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VaultKubernetesAuth. +func (in *VaultKubernetesAuth) DeepCopy() *VaultKubernetesAuth { + if in == nil { + return nil + } + out := new(VaultKubernetesAuth) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VenafiCloud) DeepCopyInto(out *VenafiCloud) { + *out = *in + out.APITokenSecretRef = in.APITokenSecretRef + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VenafiCloud. +func (in *VenafiCloud) DeepCopy() *VenafiCloud { + if in == nil { + return nil + } + out := new(VenafiCloud) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VenafiIssuer) DeepCopyInto(out *VenafiIssuer) { + *out = *in + if in.TPP != nil { + in, out := &in.TPP, &out.TPP + *out = new(VenafiTPP) + (*in).DeepCopyInto(*out) + } + if in.Cloud != nil { + in, out := &in.Cloud, &out.Cloud + *out = new(VenafiCloud) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VenafiIssuer. +func (in *VenafiIssuer) DeepCopy() *VenafiIssuer { + if in == nil { + return nil + } + out := new(VenafiIssuer) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VenafiTPP) DeepCopyInto(out *VenafiTPP) { + *out = *in + out.CredentialsRef = in.CredentialsRef + if in.CABundle != nil { + in, out := &in.CABundle, &out.CABundle + *out = make([]byte, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VenafiTPP. +func (in *VenafiTPP) DeepCopy() *VenafiTPP { + if in == nil { + return nil + } + out := new(VenafiTPP) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *X509Subject) DeepCopyInto(out *X509Subject) { + *out = *in + if in.Countries != nil { + in, out := &in.Countries, &out.Countries + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.OrganizationalUnits != nil { + in, out := &in.OrganizationalUnits, &out.OrganizationalUnits + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Localities != nil { + in, out := &in.Localities, &out.Localities + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Provinces != nil { + in, out := &in.Provinces, &out.Provinces + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.StreetAddresses != nil { + in, out := &in.StreetAddresses, &out.StreetAddresses + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.PostalCodes != nil { + in, out := &in.PostalCodes, &out.PostalCodes + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new X509Subject. +func (in *X509Subject) DeepCopy() *X509Subject { + if in == nil { + return nil + } + out := new(X509Subject) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/client/clientset/versioned/BUILD.bazel b/pkg/client/clientset/versioned/BUILD.bazel index b42628f48..55bac753c 100644 --- a/pkg/client/clientset/versioned/BUILD.bazel +++ b/pkg/client/clientset/versioned/BUILD.bazel @@ -10,7 +10,9 @@ go_library( visibility = ["//visibility:public"], deps = [ "//pkg/client/clientset/versioned/typed/acme/v1alpha2:go_default_library", + "//pkg/client/clientset/versioned/typed/acme/v1alpha3:go_default_library", "//pkg/client/clientset/versioned/typed/certmanager/v1alpha2:go_default_library", + "//pkg/client/clientset/versioned/typed/certmanager/v1alpha3:go_default_library", "@io_k8s_client_go//discovery:go_default_library", "@io_k8s_client_go//rest:go_default_library", "@io_k8s_client_go//util/flowcontrol:go_default_library", @@ -31,7 +33,9 @@ filegroup( "//pkg/client/clientset/versioned/fake:all-srcs", "//pkg/client/clientset/versioned/scheme:all-srcs", "//pkg/client/clientset/versioned/typed/acme/v1alpha2:all-srcs", + "//pkg/client/clientset/versioned/typed/acme/v1alpha3:all-srcs", "//pkg/client/clientset/versioned/typed/certmanager/v1alpha2:all-srcs", + "//pkg/client/clientset/versioned/typed/certmanager/v1alpha3:all-srcs", ], tags = ["automanaged"], visibility = ["//visibility:public"], diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go index e80d3f91d..dc74f6da4 100644 --- a/pkg/client/clientset/versioned/clientset.go +++ b/pkg/client/clientset/versioned/clientset.go @@ -22,7 +22,9 @@ import ( "fmt" acmev1alpha2 "github.com/jetstack/cert-manager/pkg/client/clientset/versioned/typed/acme/v1alpha2" + acmev1alpha3 "github.com/jetstack/cert-manager/pkg/client/clientset/versioned/typed/acme/v1alpha3" certmanagerv1alpha2 "github.com/jetstack/cert-manager/pkg/client/clientset/versioned/typed/certmanager/v1alpha2" + certmanagerv1alpha3 "github.com/jetstack/cert-manager/pkg/client/clientset/versioned/typed/certmanager/v1alpha3" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" @@ -31,7 +33,9 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface AcmeV1alpha2() acmev1alpha2.AcmeV1alpha2Interface + AcmeV1alpha3() acmev1alpha3.AcmeV1alpha3Interface CertmanagerV1alpha2() certmanagerv1alpha2.CertmanagerV1alpha2Interface + CertmanagerV1alpha3() certmanagerv1alpha3.CertmanagerV1alpha3Interface } // Clientset contains the clients for groups. Each group has exactly one @@ -39,7 +43,9 @@ type Interface interface { type Clientset struct { *discovery.DiscoveryClient acmeV1alpha2 *acmev1alpha2.AcmeV1alpha2Client + acmeV1alpha3 *acmev1alpha3.AcmeV1alpha3Client certmanagerV1alpha2 *certmanagerv1alpha2.CertmanagerV1alpha2Client + certmanagerV1alpha3 *certmanagerv1alpha3.CertmanagerV1alpha3Client } // AcmeV1alpha2 retrieves the AcmeV1alpha2Client @@ -47,11 +53,21 @@ func (c *Clientset) AcmeV1alpha2() acmev1alpha2.AcmeV1alpha2Interface { return c.acmeV1alpha2 } +// AcmeV1alpha3 retrieves the AcmeV1alpha3Client +func (c *Clientset) AcmeV1alpha3() acmev1alpha3.AcmeV1alpha3Interface { + return c.acmeV1alpha3 +} + // CertmanagerV1alpha2 retrieves the CertmanagerV1alpha2Client func (c *Clientset) CertmanagerV1alpha2() certmanagerv1alpha2.CertmanagerV1alpha2Interface { return c.certmanagerV1alpha2 } +// CertmanagerV1alpha3 retrieves the CertmanagerV1alpha3Client +func (c *Clientset) CertmanagerV1alpha3() certmanagerv1alpha3.CertmanagerV1alpha3Interface { + return c.certmanagerV1alpha3 +} + // Discovery retrieves the DiscoveryClient func (c *Clientset) Discovery() discovery.DiscoveryInterface { if c == nil { @@ -77,10 +93,18 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { if err != nil { return nil, err } + cs.acmeV1alpha3, err = acmev1alpha3.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } cs.certmanagerV1alpha2, err = certmanagerv1alpha2.NewForConfig(&configShallowCopy) if err != nil { return nil, err } + cs.certmanagerV1alpha3, err = certmanagerv1alpha3.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) if err != nil { @@ -94,7 +118,9 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { func NewForConfigOrDie(c *rest.Config) *Clientset { var cs Clientset cs.acmeV1alpha2 = acmev1alpha2.NewForConfigOrDie(c) + cs.acmeV1alpha3 = acmev1alpha3.NewForConfigOrDie(c) cs.certmanagerV1alpha2 = certmanagerv1alpha2.NewForConfigOrDie(c) + cs.certmanagerV1alpha3 = certmanagerv1alpha3.NewForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) return &cs @@ -104,7 +130,9 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { func New(c rest.Interface) *Clientset { var cs Clientset cs.acmeV1alpha2 = acmev1alpha2.New(c) + cs.acmeV1alpha3 = acmev1alpha3.New(c) cs.certmanagerV1alpha2 = certmanagerv1alpha2.New(c) + cs.certmanagerV1alpha3 = certmanagerv1alpha3.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/pkg/client/clientset/versioned/fake/BUILD.bazel b/pkg/client/clientset/versioned/fake/BUILD.bazel index 44bed6176..bbe323554 100644 --- a/pkg/client/clientset/versioned/fake/BUILD.bazel +++ b/pkg/client/clientset/versioned/fake/BUILD.bazel @@ -11,12 +11,18 @@ go_library( visibility = ["//visibility:public"], deps = [ "//pkg/apis/acme/v1alpha2:go_default_library", + "//pkg/apis/acme/v1alpha3:go_default_library", "//pkg/apis/certmanager/v1alpha2:go_default_library", + "//pkg/apis/certmanager/v1alpha3:go_default_library", "//pkg/client/clientset/versioned:go_default_library", "//pkg/client/clientset/versioned/typed/acme/v1alpha2:go_default_library", "//pkg/client/clientset/versioned/typed/acme/v1alpha2/fake:go_default_library", + "//pkg/client/clientset/versioned/typed/acme/v1alpha3:go_default_library", + "//pkg/client/clientset/versioned/typed/acme/v1alpha3/fake:go_default_library", "//pkg/client/clientset/versioned/typed/certmanager/v1alpha2:go_default_library", "//pkg/client/clientset/versioned/typed/certmanager/v1alpha2/fake:go_default_library", + "//pkg/client/clientset/versioned/typed/certmanager/v1alpha3:go_default_library", + "//pkg/client/clientset/versioned/typed/certmanager/v1alpha3/fake:go_default_library", "@io_k8s_apimachinery//pkg/apis/meta/v1:go_default_library", "@io_k8s_apimachinery//pkg/runtime:go_default_library", "@io_k8s_apimachinery//pkg/runtime/schema:go_default_library", diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index 4b989eb6b..f18bf83bb 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -22,8 +22,12 @@ import ( clientset "github.com/jetstack/cert-manager/pkg/client/clientset/versioned" acmev1alpha2 "github.com/jetstack/cert-manager/pkg/client/clientset/versioned/typed/acme/v1alpha2" fakeacmev1alpha2 "github.com/jetstack/cert-manager/pkg/client/clientset/versioned/typed/acme/v1alpha2/fake" + acmev1alpha3 "github.com/jetstack/cert-manager/pkg/client/clientset/versioned/typed/acme/v1alpha3" + fakeacmev1alpha3 "github.com/jetstack/cert-manager/pkg/client/clientset/versioned/typed/acme/v1alpha3/fake" certmanagerv1alpha2 "github.com/jetstack/cert-manager/pkg/client/clientset/versioned/typed/certmanager/v1alpha2" fakecertmanagerv1alpha2 "github.com/jetstack/cert-manager/pkg/client/clientset/versioned/typed/certmanager/v1alpha2/fake" + certmanagerv1alpha3 "github.com/jetstack/cert-manager/pkg/client/clientset/versioned/typed/certmanager/v1alpha3" + fakecertmanagerv1alpha3 "github.com/jetstack/cert-manager/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/fake" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" @@ -83,7 +87,17 @@ func (c *Clientset) AcmeV1alpha2() acmev1alpha2.AcmeV1alpha2Interface { return &fakeacmev1alpha2.FakeAcmeV1alpha2{Fake: &c.Fake} } +// AcmeV1alpha3 retrieves the AcmeV1alpha3Client +func (c *Clientset) AcmeV1alpha3() acmev1alpha3.AcmeV1alpha3Interface { + return &fakeacmev1alpha3.FakeAcmeV1alpha3{Fake: &c.Fake} +} + // CertmanagerV1alpha2 retrieves the CertmanagerV1alpha2Client func (c *Clientset) CertmanagerV1alpha2() certmanagerv1alpha2.CertmanagerV1alpha2Interface { return &fakecertmanagerv1alpha2.FakeCertmanagerV1alpha2{Fake: &c.Fake} } + +// CertmanagerV1alpha3 retrieves the CertmanagerV1alpha3Client +func (c *Clientset) CertmanagerV1alpha3() certmanagerv1alpha3.CertmanagerV1alpha3Interface { + return &fakecertmanagerv1alpha3.FakeCertmanagerV1alpha3{Fake: &c.Fake} +} diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index 266b286ee..f89484209 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -20,7 +20,9 @@ package fake import ( acmev1alpha2 "github.com/jetstack/cert-manager/pkg/apis/acme/v1alpha2" + acmev1alpha3 "github.com/jetstack/cert-manager/pkg/apis/acme/v1alpha3" certmanagerv1alpha2 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha2" + certmanagerv1alpha3 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha3" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -33,7 +35,9 @@ var codecs = serializer.NewCodecFactory(scheme) var parameterCodec = runtime.NewParameterCodec(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ acmev1alpha2.AddToScheme, + acmev1alpha3.AddToScheme, certmanagerv1alpha2.AddToScheme, + certmanagerv1alpha3.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/client/clientset/versioned/scheme/BUILD.bazel b/pkg/client/clientset/versioned/scheme/BUILD.bazel index b6827d01e..2b0c2c6be 100644 --- a/pkg/client/clientset/versioned/scheme/BUILD.bazel +++ b/pkg/client/clientset/versioned/scheme/BUILD.bazel @@ -10,7 +10,9 @@ go_library( visibility = ["//visibility:public"], deps = [ "//pkg/apis/acme/v1alpha2:go_default_library", + "//pkg/apis/acme/v1alpha3:go_default_library", "//pkg/apis/certmanager/v1alpha2:go_default_library", + "//pkg/apis/certmanager/v1alpha3:go_default_library", "@io_k8s_apimachinery//pkg/apis/meta/v1:go_default_library", "@io_k8s_apimachinery//pkg/runtime:go_default_library", "@io_k8s_apimachinery//pkg/runtime/schema:go_default_library", diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index bfa871f61..f302e9e48 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -20,7 +20,9 @@ package scheme import ( acmev1alpha2 "github.com/jetstack/cert-manager/pkg/apis/acme/v1alpha2" + acmev1alpha3 "github.com/jetstack/cert-manager/pkg/apis/acme/v1alpha3" certmanagerv1alpha2 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha2" + certmanagerv1alpha3 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha3" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -33,7 +35,9 @@ var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ acmev1alpha2.AddToScheme, + acmev1alpha3.AddToScheme, certmanagerv1alpha2.AddToScheme, + certmanagerv1alpha3.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/client/clientset/versioned/typed/acme/v1alpha3/BUILD.bazel b/pkg/client/clientset/versioned/typed/acme/v1alpha3/BUILD.bazel new file mode 100644 index 000000000..cb4325155 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/acme/v1alpha3/BUILD.bazel @@ -0,0 +1,39 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "acme_client.go", + "challenge.go", + "doc.go", + "generated_expansion.go", + "order.go", + ], + importpath = "github.com/jetstack/cert-manager/pkg/client/clientset/versioned/typed/acme/v1alpha3", + visibility = ["//visibility:public"], + deps = [ + "//pkg/apis/acme/v1alpha3:go_default_library", + "//pkg/client/clientset/versioned/scheme:go_default_library", + "@io_k8s_apimachinery//pkg/apis/meta/v1:go_default_library", + "@io_k8s_apimachinery//pkg/types:go_default_library", + "@io_k8s_apimachinery//pkg/watch:go_default_library", + "@io_k8s_client_go//rest:go_default_library", + ], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [ + ":package-srcs", + "//pkg/client/clientset/versioned/typed/acme/v1alpha3/fake:all-srcs", + ], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/pkg/client/clientset/versioned/typed/acme/v1alpha3/acme_client.go b/pkg/client/clientset/versioned/typed/acme/v1alpha3/acme_client.go new file mode 100644 index 000000000..19f301128 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/acme/v1alpha3/acme_client.go @@ -0,0 +1,94 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + v1alpha3 "github.com/jetstack/cert-manager/pkg/apis/acme/v1alpha3" + "github.com/jetstack/cert-manager/pkg/client/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" +) + +type AcmeV1alpha3Interface interface { + RESTClient() rest.Interface + ChallengesGetter + OrdersGetter +} + +// AcmeV1alpha3Client is used to interact with features provided by the acme.cert-manager.io group. +type AcmeV1alpha3Client struct { + restClient rest.Interface +} + +func (c *AcmeV1alpha3Client) Challenges(namespace string) ChallengeInterface { + return newChallenges(c, namespace) +} + +func (c *AcmeV1alpha3Client) Orders(namespace string) OrderInterface { + return newOrders(c, namespace) +} + +// NewForConfig creates a new AcmeV1alpha3Client for the given config. +func NewForConfig(c *rest.Config) (*AcmeV1alpha3Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &AcmeV1alpha3Client{client}, nil +} + +// NewForConfigOrDie creates a new AcmeV1alpha3Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *AcmeV1alpha3Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new AcmeV1alpha3Client for the given RESTClient. +func New(c rest.Interface) *AcmeV1alpha3Client { + return &AcmeV1alpha3Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha3.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *AcmeV1alpha3Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/client/clientset/versioned/typed/acme/v1alpha3/challenge.go b/pkg/client/clientset/versioned/typed/acme/v1alpha3/challenge.go new file mode 100644 index 000000000..66f0df87c --- /dev/null +++ b/pkg/client/clientset/versioned/typed/acme/v1alpha3/challenge.go @@ -0,0 +1,191 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + "time" + + v1alpha3 "github.com/jetstack/cert-manager/pkg/apis/acme/v1alpha3" + scheme "github.com/jetstack/cert-manager/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ChallengesGetter has a method to return a ChallengeInterface. +// A group's client should implement this interface. +type ChallengesGetter interface { + Challenges(namespace string) ChallengeInterface +} + +// ChallengeInterface has methods to work with Challenge resources. +type ChallengeInterface interface { + Create(*v1alpha3.Challenge) (*v1alpha3.Challenge, error) + Update(*v1alpha3.Challenge) (*v1alpha3.Challenge, error) + UpdateStatus(*v1alpha3.Challenge) (*v1alpha3.Challenge, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha3.Challenge, error) + List(opts v1.ListOptions) (*v1alpha3.ChallengeList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.Challenge, err error) + ChallengeExpansion +} + +// challenges implements ChallengeInterface +type challenges struct { + client rest.Interface + ns string +} + +// newChallenges returns a Challenges +func newChallenges(c *AcmeV1alpha3Client, namespace string) *challenges { + return &challenges{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the challenge, and returns the corresponding challenge object, and an error if there is any. +func (c *challenges) Get(name string, options v1.GetOptions) (result *v1alpha3.Challenge, err error) { + result = &v1alpha3.Challenge{} + err = c.client.Get(). + Namespace(c.ns). + Resource("challenges"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Challenges that match those selectors. +func (c *challenges) List(opts v1.ListOptions) (result *v1alpha3.ChallengeList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha3.ChallengeList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("challenges"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested challenges. +func (c *challenges) Watch(opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("challenges"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch() +} + +// Create takes the representation of a challenge and creates it. Returns the server's representation of the challenge, and an error, if there is any. +func (c *challenges) Create(challenge *v1alpha3.Challenge) (result *v1alpha3.Challenge, err error) { + result = &v1alpha3.Challenge{} + err = c.client.Post(). + Namespace(c.ns). + Resource("challenges"). + Body(challenge). + Do(). + Into(result) + return +} + +// Update takes the representation of a challenge and updates it. Returns the server's representation of the challenge, and an error, if there is any. +func (c *challenges) Update(challenge *v1alpha3.Challenge) (result *v1alpha3.Challenge, err error) { + result = &v1alpha3.Challenge{} + err = c.client.Put(). + Namespace(c.ns). + Resource("challenges"). + Name(challenge.Name). + Body(challenge). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *challenges) UpdateStatus(challenge *v1alpha3.Challenge) (result *v1alpha3.Challenge, err error) { + result = &v1alpha3.Challenge{} + err = c.client.Put(). + Namespace(c.ns). + Resource("challenges"). + Name(challenge.Name). + SubResource("status"). + Body(challenge). + Do(). + Into(result) + return +} + +// Delete takes name of the challenge and deletes it. Returns an error if one occurs. +func (c *challenges) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("challenges"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *challenges) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("challenges"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched challenge. +func (c *challenges) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.Challenge, err error) { + result = &v1alpha3.Challenge{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("challenges"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/acme/v1alpha3/doc.go b/pkg/client/clientset/versioned/typed/acme/v1alpha3/doc.go new file mode 100644 index 000000000..8a82b3649 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/acme/v1alpha3/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1alpha3 diff --git a/pkg/client/clientset/versioned/typed/acme/v1alpha3/fake/BUILD.bazel b/pkg/client/clientset/versioned/typed/acme/v1alpha3/fake/BUILD.bazel new file mode 100644 index 000000000..056f284c2 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/acme/v1alpha3/fake/BUILD.bazel @@ -0,0 +1,38 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "doc.go", + "fake_acme_client.go", + "fake_challenge.go", + "fake_order.go", + ], + importpath = "github.com/jetstack/cert-manager/pkg/client/clientset/versioned/typed/acme/v1alpha3/fake", + visibility = ["//visibility:public"], + deps = [ + "//pkg/apis/acme/v1alpha3:go_default_library", + "//pkg/client/clientset/versioned/typed/acme/v1alpha3:go_default_library", + "@io_k8s_apimachinery//pkg/apis/meta/v1:go_default_library", + "@io_k8s_apimachinery//pkg/labels:go_default_library", + "@io_k8s_apimachinery//pkg/runtime/schema:go_default_library", + "@io_k8s_apimachinery//pkg/types:go_default_library", + "@io_k8s_apimachinery//pkg/watch:go_default_library", + "@io_k8s_client_go//rest:go_default_library", + "@io_k8s_client_go//testing:go_default_library", + ], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/pkg/client/clientset/versioned/typed/acme/v1alpha3/fake/doc.go b/pkg/client/clientset/versioned/typed/acme/v1alpha3/fake/doc.go new file mode 100644 index 000000000..4fe6bab38 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/acme/v1alpha3/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/client/clientset/versioned/typed/acme/v1alpha3/fake/fake_acme_client.go b/pkg/client/clientset/versioned/typed/acme/v1alpha3/fake/fake_acme_client.go new file mode 100644 index 000000000..f032d3565 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/acme/v1alpha3/fake/fake_acme_client.go @@ -0,0 +1,44 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha3 "github.com/jetstack/cert-manager/pkg/client/clientset/versioned/typed/acme/v1alpha3" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeAcmeV1alpha3 struct { + *testing.Fake +} + +func (c *FakeAcmeV1alpha3) Challenges(namespace string) v1alpha3.ChallengeInterface { + return &FakeChallenges{c, namespace} +} + +func (c *FakeAcmeV1alpha3) Orders(namespace string) v1alpha3.OrderInterface { + return &FakeOrders{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeAcmeV1alpha3) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/client/clientset/versioned/typed/acme/v1alpha3/fake/fake_challenge.go b/pkg/client/clientset/versioned/typed/acme/v1alpha3/fake/fake_challenge.go new file mode 100644 index 000000000..869f72146 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/acme/v1alpha3/fake/fake_challenge.go @@ -0,0 +1,140 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha3 "github.com/jetstack/cert-manager/pkg/apis/acme/v1alpha3" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeChallenges implements ChallengeInterface +type FakeChallenges struct { + Fake *FakeAcmeV1alpha3 + ns string +} + +var challengesResource = schema.GroupVersionResource{Group: "acme.cert-manager.io", Version: "v1alpha3", Resource: "challenges"} + +var challengesKind = schema.GroupVersionKind{Group: "acme.cert-manager.io", Version: "v1alpha3", Kind: "Challenge"} + +// Get takes name of the challenge, and returns the corresponding challenge object, and an error if there is any. +func (c *FakeChallenges) Get(name string, options v1.GetOptions) (result *v1alpha3.Challenge, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(challengesResource, c.ns, name), &v1alpha3.Challenge{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.Challenge), err +} + +// List takes label and field selectors, and returns the list of Challenges that match those selectors. +func (c *FakeChallenges) List(opts v1.ListOptions) (result *v1alpha3.ChallengeList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(challengesResource, challengesKind, c.ns, opts), &v1alpha3.ChallengeList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha3.ChallengeList{ListMeta: obj.(*v1alpha3.ChallengeList).ListMeta} + for _, item := range obj.(*v1alpha3.ChallengeList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested challenges. +func (c *FakeChallenges) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(challengesResource, c.ns, opts)) + +} + +// Create takes the representation of a challenge and creates it. Returns the server's representation of the challenge, and an error, if there is any. +func (c *FakeChallenges) Create(challenge *v1alpha3.Challenge) (result *v1alpha3.Challenge, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(challengesResource, c.ns, challenge), &v1alpha3.Challenge{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.Challenge), err +} + +// Update takes the representation of a challenge and updates it. Returns the server's representation of the challenge, and an error, if there is any. +func (c *FakeChallenges) Update(challenge *v1alpha3.Challenge) (result *v1alpha3.Challenge, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(challengesResource, c.ns, challenge), &v1alpha3.Challenge{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.Challenge), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeChallenges) UpdateStatus(challenge *v1alpha3.Challenge) (*v1alpha3.Challenge, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(challengesResource, "status", c.ns, challenge), &v1alpha3.Challenge{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.Challenge), err +} + +// Delete takes name of the challenge and deletes it. Returns an error if one occurs. +func (c *FakeChallenges) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(challengesResource, c.ns, name), &v1alpha3.Challenge{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeChallenges) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(challengesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha3.ChallengeList{}) + return err +} + +// Patch applies the patch and returns the patched challenge. +func (c *FakeChallenges) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.Challenge, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(challengesResource, c.ns, name, pt, data, subresources...), &v1alpha3.Challenge{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.Challenge), err +} diff --git a/pkg/client/clientset/versioned/typed/acme/v1alpha3/fake/fake_order.go b/pkg/client/clientset/versioned/typed/acme/v1alpha3/fake/fake_order.go new file mode 100644 index 000000000..8063f10a9 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/acme/v1alpha3/fake/fake_order.go @@ -0,0 +1,140 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha3 "github.com/jetstack/cert-manager/pkg/apis/acme/v1alpha3" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeOrders implements OrderInterface +type FakeOrders struct { + Fake *FakeAcmeV1alpha3 + ns string +} + +var ordersResource = schema.GroupVersionResource{Group: "acme.cert-manager.io", Version: "v1alpha3", Resource: "orders"} + +var ordersKind = schema.GroupVersionKind{Group: "acme.cert-manager.io", Version: "v1alpha3", Kind: "Order"} + +// Get takes name of the order, and returns the corresponding order object, and an error if there is any. +func (c *FakeOrders) Get(name string, options v1.GetOptions) (result *v1alpha3.Order, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(ordersResource, c.ns, name), &v1alpha3.Order{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.Order), err +} + +// List takes label and field selectors, and returns the list of Orders that match those selectors. +func (c *FakeOrders) List(opts v1.ListOptions) (result *v1alpha3.OrderList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(ordersResource, ordersKind, c.ns, opts), &v1alpha3.OrderList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha3.OrderList{ListMeta: obj.(*v1alpha3.OrderList).ListMeta} + for _, item := range obj.(*v1alpha3.OrderList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested orders. +func (c *FakeOrders) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(ordersResource, c.ns, opts)) + +} + +// Create takes the representation of a order and creates it. Returns the server's representation of the order, and an error, if there is any. +func (c *FakeOrders) Create(order *v1alpha3.Order) (result *v1alpha3.Order, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(ordersResource, c.ns, order), &v1alpha3.Order{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.Order), err +} + +// Update takes the representation of a order and updates it. Returns the server's representation of the order, and an error, if there is any. +func (c *FakeOrders) Update(order *v1alpha3.Order) (result *v1alpha3.Order, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(ordersResource, c.ns, order), &v1alpha3.Order{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.Order), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeOrders) UpdateStatus(order *v1alpha3.Order) (*v1alpha3.Order, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(ordersResource, "status", c.ns, order), &v1alpha3.Order{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.Order), err +} + +// Delete takes name of the order and deletes it. Returns an error if one occurs. +func (c *FakeOrders) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(ordersResource, c.ns, name), &v1alpha3.Order{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeOrders) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(ordersResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha3.OrderList{}) + return err +} + +// Patch applies the patch and returns the patched order. +func (c *FakeOrders) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.Order, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(ordersResource, c.ns, name, pt, data, subresources...), &v1alpha3.Order{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.Order), err +} diff --git a/pkg/client/clientset/versioned/typed/acme/v1alpha3/generated_expansion.go b/pkg/client/clientset/versioned/typed/acme/v1alpha3/generated_expansion.go new file mode 100644 index 000000000..d47afca54 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/acme/v1alpha3/generated_expansion.go @@ -0,0 +1,23 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha3 + +type ChallengeExpansion interface{} + +type OrderExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/acme/v1alpha3/order.go b/pkg/client/clientset/versioned/typed/acme/v1alpha3/order.go new file mode 100644 index 000000000..5a4b65906 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/acme/v1alpha3/order.go @@ -0,0 +1,191 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + "time" + + v1alpha3 "github.com/jetstack/cert-manager/pkg/apis/acme/v1alpha3" + scheme "github.com/jetstack/cert-manager/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// OrdersGetter has a method to return a OrderInterface. +// A group's client should implement this interface. +type OrdersGetter interface { + Orders(namespace string) OrderInterface +} + +// OrderInterface has methods to work with Order resources. +type OrderInterface interface { + Create(*v1alpha3.Order) (*v1alpha3.Order, error) + Update(*v1alpha3.Order) (*v1alpha3.Order, error) + UpdateStatus(*v1alpha3.Order) (*v1alpha3.Order, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha3.Order, error) + List(opts v1.ListOptions) (*v1alpha3.OrderList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.Order, err error) + OrderExpansion +} + +// orders implements OrderInterface +type orders struct { + client rest.Interface + ns string +} + +// newOrders returns a Orders +func newOrders(c *AcmeV1alpha3Client, namespace string) *orders { + return &orders{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the order, and returns the corresponding order object, and an error if there is any. +func (c *orders) Get(name string, options v1.GetOptions) (result *v1alpha3.Order, err error) { + result = &v1alpha3.Order{} + err = c.client.Get(). + Namespace(c.ns). + Resource("orders"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Orders that match those selectors. +func (c *orders) List(opts v1.ListOptions) (result *v1alpha3.OrderList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha3.OrderList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("orders"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested orders. +func (c *orders) Watch(opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("orders"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch() +} + +// Create takes the representation of a order and creates it. Returns the server's representation of the order, and an error, if there is any. +func (c *orders) Create(order *v1alpha3.Order) (result *v1alpha3.Order, err error) { + result = &v1alpha3.Order{} + err = c.client.Post(). + Namespace(c.ns). + Resource("orders"). + Body(order). + Do(). + Into(result) + return +} + +// Update takes the representation of a order and updates it. Returns the server's representation of the order, and an error, if there is any. +func (c *orders) Update(order *v1alpha3.Order) (result *v1alpha3.Order, err error) { + result = &v1alpha3.Order{} + err = c.client.Put(). + Namespace(c.ns). + Resource("orders"). + Name(order.Name). + Body(order). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *orders) UpdateStatus(order *v1alpha3.Order) (result *v1alpha3.Order, err error) { + result = &v1alpha3.Order{} + err = c.client.Put(). + Namespace(c.ns). + Resource("orders"). + Name(order.Name). + SubResource("status"). + Body(order). + Do(). + Into(result) + return +} + +// Delete takes name of the order and deletes it. Returns an error if one occurs. +func (c *orders) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("orders"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *orders) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("orders"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched order. +func (c *orders) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.Order, err error) { + result = &v1alpha3.Order{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("orders"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/BUILD.bazel b/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/BUILD.bazel new file mode 100644 index 000000000..ceaeb976c --- /dev/null +++ b/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/BUILD.bazel @@ -0,0 +1,41 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "certificate.go", + "certificaterequest.go", + "certmanager_client.go", + "clusterissuer.go", + "doc.go", + "generated_expansion.go", + "issuer.go", + ], + importpath = "github.com/jetstack/cert-manager/pkg/client/clientset/versioned/typed/certmanager/v1alpha3", + visibility = ["//visibility:public"], + deps = [ + "//pkg/apis/certmanager/v1alpha3:go_default_library", + "//pkg/client/clientset/versioned/scheme:go_default_library", + "@io_k8s_apimachinery//pkg/apis/meta/v1:go_default_library", + "@io_k8s_apimachinery//pkg/types:go_default_library", + "@io_k8s_apimachinery//pkg/watch:go_default_library", + "@io_k8s_client_go//rest:go_default_library", + ], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [ + ":package-srcs", + "//pkg/client/clientset/versioned/typed/certmanager/v1alpha3/fake:all-srcs", + ], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/certificate.go b/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/certificate.go new file mode 100644 index 000000000..880c7ed23 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/certificate.go @@ -0,0 +1,191 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + "time" + + v1alpha3 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha3" + scheme "github.com/jetstack/cert-manager/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// CertificatesGetter has a method to return a CertificateInterface. +// A group's client should implement this interface. +type CertificatesGetter interface { + Certificates(namespace string) CertificateInterface +} + +// CertificateInterface has methods to work with Certificate resources. +type CertificateInterface interface { + Create(*v1alpha3.Certificate) (*v1alpha3.Certificate, error) + Update(*v1alpha3.Certificate) (*v1alpha3.Certificate, error) + UpdateStatus(*v1alpha3.Certificate) (*v1alpha3.Certificate, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha3.Certificate, error) + List(opts v1.ListOptions) (*v1alpha3.CertificateList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.Certificate, err error) + CertificateExpansion +} + +// certificates implements CertificateInterface +type certificates struct { + client rest.Interface + ns string +} + +// newCertificates returns a Certificates +func newCertificates(c *CertmanagerV1alpha3Client, namespace string) *certificates { + return &certificates{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the certificate, and returns the corresponding certificate object, and an error if there is any. +func (c *certificates) Get(name string, options v1.GetOptions) (result *v1alpha3.Certificate, err error) { + result = &v1alpha3.Certificate{} + err = c.client.Get(). + Namespace(c.ns). + Resource("certificates"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Certificates that match those selectors. +func (c *certificates) List(opts v1.ListOptions) (result *v1alpha3.CertificateList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha3.CertificateList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("certificates"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested certificates. +func (c *certificates) Watch(opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("certificates"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch() +} + +// Create takes the representation of a certificate and creates it. Returns the server's representation of the certificate, and an error, if there is any. +func (c *certificates) Create(certificate *v1alpha3.Certificate) (result *v1alpha3.Certificate, err error) { + result = &v1alpha3.Certificate{} + err = c.client.Post(). + Namespace(c.ns). + Resource("certificates"). + Body(certificate). + Do(). + Into(result) + return +} + +// Update takes the representation of a certificate and updates it. Returns the server's representation of the certificate, and an error, if there is any. +func (c *certificates) Update(certificate *v1alpha3.Certificate) (result *v1alpha3.Certificate, err error) { + result = &v1alpha3.Certificate{} + err = c.client.Put(). + Namespace(c.ns). + Resource("certificates"). + Name(certificate.Name). + Body(certificate). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *certificates) UpdateStatus(certificate *v1alpha3.Certificate) (result *v1alpha3.Certificate, err error) { + result = &v1alpha3.Certificate{} + err = c.client.Put(). + Namespace(c.ns). + Resource("certificates"). + Name(certificate.Name). + SubResource("status"). + Body(certificate). + Do(). + Into(result) + return +} + +// Delete takes name of the certificate and deletes it. Returns an error if one occurs. +func (c *certificates) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("certificates"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *certificates) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("certificates"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched certificate. +func (c *certificates) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.Certificate, err error) { + result = &v1alpha3.Certificate{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("certificates"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/certificaterequest.go b/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/certificaterequest.go new file mode 100644 index 000000000..1334ce2c4 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/certificaterequest.go @@ -0,0 +1,191 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + "time" + + v1alpha3 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha3" + scheme "github.com/jetstack/cert-manager/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// CertificateRequestsGetter has a method to return a CertificateRequestInterface. +// A group's client should implement this interface. +type CertificateRequestsGetter interface { + CertificateRequests(namespace string) CertificateRequestInterface +} + +// CertificateRequestInterface has methods to work with CertificateRequest resources. +type CertificateRequestInterface interface { + Create(*v1alpha3.CertificateRequest) (*v1alpha3.CertificateRequest, error) + Update(*v1alpha3.CertificateRequest) (*v1alpha3.CertificateRequest, error) + UpdateStatus(*v1alpha3.CertificateRequest) (*v1alpha3.CertificateRequest, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha3.CertificateRequest, error) + List(opts v1.ListOptions) (*v1alpha3.CertificateRequestList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.CertificateRequest, err error) + CertificateRequestExpansion +} + +// certificateRequests implements CertificateRequestInterface +type certificateRequests struct { + client rest.Interface + ns string +} + +// newCertificateRequests returns a CertificateRequests +func newCertificateRequests(c *CertmanagerV1alpha3Client, namespace string) *certificateRequests { + return &certificateRequests{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the certificateRequest, and returns the corresponding certificateRequest object, and an error if there is any. +func (c *certificateRequests) Get(name string, options v1.GetOptions) (result *v1alpha3.CertificateRequest, err error) { + result = &v1alpha3.CertificateRequest{} + err = c.client.Get(). + Namespace(c.ns). + Resource("certificaterequests"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of CertificateRequests that match those selectors. +func (c *certificateRequests) List(opts v1.ListOptions) (result *v1alpha3.CertificateRequestList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha3.CertificateRequestList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("certificaterequests"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested certificateRequests. +func (c *certificateRequests) Watch(opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("certificaterequests"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch() +} + +// Create takes the representation of a certificateRequest and creates it. Returns the server's representation of the certificateRequest, and an error, if there is any. +func (c *certificateRequests) Create(certificateRequest *v1alpha3.CertificateRequest) (result *v1alpha3.CertificateRequest, err error) { + result = &v1alpha3.CertificateRequest{} + err = c.client.Post(). + Namespace(c.ns). + Resource("certificaterequests"). + Body(certificateRequest). + Do(). + Into(result) + return +} + +// Update takes the representation of a certificateRequest and updates it. Returns the server's representation of the certificateRequest, and an error, if there is any. +func (c *certificateRequests) Update(certificateRequest *v1alpha3.CertificateRequest) (result *v1alpha3.CertificateRequest, err error) { + result = &v1alpha3.CertificateRequest{} + err = c.client.Put(). + Namespace(c.ns). + Resource("certificaterequests"). + Name(certificateRequest.Name). + Body(certificateRequest). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *certificateRequests) UpdateStatus(certificateRequest *v1alpha3.CertificateRequest) (result *v1alpha3.CertificateRequest, err error) { + result = &v1alpha3.CertificateRequest{} + err = c.client.Put(). + Namespace(c.ns). + Resource("certificaterequests"). + Name(certificateRequest.Name). + SubResource("status"). + Body(certificateRequest). + Do(). + Into(result) + return +} + +// Delete takes name of the certificateRequest and deletes it. Returns an error if one occurs. +func (c *certificateRequests) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("certificaterequests"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *certificateRequests) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("certificaterequests"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched certificateRequest. +func (c *certificateRequests) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.CertificateRequest, err error) { + result = &v1alpha3.CertificateRequest{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("certificaterequests"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/certmanager_client.go b/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/certmanager_client.go new file mode 100644 index 000000000..edafba88a --- /dev/null +++ b/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/certmanager_client.go @@ -0,0 +1,104 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + v1alpha3 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha3" + "github.com/jetstack/cert-manager/pkg/client/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" +) + +type CertmanagerV1alpha3Interface interface { + RESTClient() rest.Interface + CertificatesGetter + CertificateRequestsGetter + ClusterIssuersGetter + IssuersGetter +} + +// CertmanagerV1alpha3Client is used to interact with features provided by the cert-manager.io group. +type CertmanagerV1alpha3Client struct { + restClient rest.Interface +} + +func (c *CertmanagerV1alpha3Client) Certificates(namespace string) CertificateInterface { + return newCertificates(c, namespace) +} + +func (c *CertmanagerV1alpha3Client) CertificateRequests(namespace string) CertificateRequestInterface { + return newCertificateRequests(c, namespace) +} + +func (c *CertmanagerV1alpha3Client) ClusterIssuers() ClusterIssuerInterface { + return newClusterIssuers(c) +} + +func (c *CertmanagerV1alpha3Client) Issuers(namespace string) IssuerInterface { + return newIssuers(c, namespace) +} + +// NewForConfig creates a new CertmanagerV1alpha3Client for the given config. +func NewForConfig(c *rest.Config) (*CertmanagerV1alpha3Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &CertmanagerV1alpha3Client{client}, nil +} + +// NewForConfigOrDie creates a new CertmanagerV1alpha3Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *CertmanagerV1alpha3Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new CertmanagerV1alpha3Client for the given RESTClient. +func New(c rest.Interface) *CertmanagerV1alpha3Client { + return &CertmanagerV1alpha3Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha3.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *CertmanagerV1alpha3Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/clusterissuer.go b/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/clusterissuer.go new file mode 100644 index 000000000..c72a14586 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/clusterissuer.go @@ -0,0 +1,180 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + "time" + + v1alpha3 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha3" + scheme "github.com/jetstack/cert-manager/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ClusterIssuersGetter has a method to return a ClusterIssuerInterface. +// A group's client should implement this interface. +type ClusterIssuersGetter interface { + ClusterIssuers() ClusterIssuerInterface +} + +// ClusterIssuerInterface has methods to work with ClusterIssuer resources. +type ClusterIssuerInterface interface { + Create(*v1alpha3.ClusterIssuer) (*v1alpha3.ClusterIssuer, error) + Update(*v1alpha3.ClusterIssuer) (*v1alpha3.ClusterIssuer, error) + UpdateStatus(*v1alpha3.ClusterIssuer) (*v1alpha3.ClusterIssuer, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha3.ClusterIssuer, error) + List(opts v1.ListOptions) (*v1alpha3.ClusterIssuerList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.ClusterIssuer, err error) + ClusterIssuerExpansion +} + +// clusterIssuers implements ClusterIssuerInterface +type clusterIssuers struct { + client rest.Interface +} + +// newClusterIssuers returns a ClusterIssuers +func newClusterIssuers(c *CertmanagerV1alpha3Client) *clusterIssuers { + return &clusterIssuers{ + client: c.RESTClient(), + } +} + +// Get takes name of the clusterIssuer, and returns the corresponding clusterIssuer object, and an error if there is any. +func (c *clusterIssuers) Get(name string, options v1.GetOptions) (result *v1alpha3.ClusterIssuer, err error) { + result = &v1alpha3.ClusterIssuer{} + err = c.client.Get(). + Resource("clusterissuers"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ClusterIssuers that match those selectors. +func (c *clusterIssuers) List(opts v1.ListOptions) (result *v1alpha3.ClusterIssuerList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha3.ClusterIssuerList{} + err = c.client.Get(). + Resource("clusterissuers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested clusterIssuers. +func (c *clusterIssuers) Watch(opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("clusterissuers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch() +} + +// Create takes the representation of a clusterIssuer and creates it. Returns the server's representation of the clusterIssuer, and an error, if there is any. +func (c *clusterIssuers) Create(clusterIssuer *v1alpha3.ClusterIssuer) (result *v1alpha3.ClusterIssuer, err error) { + result = &v1alpha3.ClusterIssuer{} + err = c.client.Post(). + Resource("clusterissuers"). + Body(clusterIssuer). + Do(). + Into(result) + return +} + +// Update takes the representation of a clusterIssuer and updates it. Returns the server's representation of the clusterIssuer, and an error, if there is any. +func (c *clusterIssuers) Update(clusterIssuer *v1alpha3.ClusterIssuer) (result *v1alpha3.ClusterIssuer, err error) { + result = &v1alpha3.ClusterIssuer{} + err = c.client.Put(). + Resource("clusterissuers"). + Name(clusterIssuer.Name). + Body(clusterIssuer). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *clusterIssuers) UpdateStatus(clusterIssuer *v1alpha3.ClusterIssuer) (result *v1alpha3.ClusterIssuer, err error) { + result = &v1alpha3.ClusterIssuer{} + err = c.client.Put(). + Resource("clusterissuers"). + Name(clusterIssuer.Name). + SubResource("status"). + Body(clusterIssuer). + Do(). + Into(result) + return +} + +// Delete takes name of the clusterIssuer and deletes it. Returns an error if one occurs. +func (c *clusterIssuers) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Resource("clusterissuers"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *clusterIssuers) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("clusterissuers"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched clusterIssuer. +func (c *clusterIssuers) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.ClusterIssuer, err error) { + result = &v1alpha3.ClusterIssuer{} + err = c.client.Patch(pt). + Resource("clusterissuers"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/doc.go b/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/doc.go new file mode 100644 index 000000000..8a82b3649 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1alpha3 diff --git a/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/fake/BUILD.bazel b/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/fake/BUILD.bazel new file mode 100644 index 000000000..2427c1a43 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/fake/BUILD.bazel @@ -0,0 +1,40 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "doc.go", + "fake_certificate.go", + "fake_certificaterequest.go", + "fake_certmanager_client.go", + "fake_clusterissuer.go", + "fake_issuer.go", + ], + importpath = "github.com/jetstack/cert-manager/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/fake", + visibility = ["//visibility:public"], + deps = [ + "//pkg/apis/certmanager/v1alpha3:go_default_library", + "//pkg/client/clientset/versioned/typed/certmanager/v1alpha3:go_default_library", + "@io_k8s_apimachinery//pkg/apis/meta/v1:go_default_library", + "@io_k8s_apimachinery//pkg/labels:go_default_library", + "@io_k8s_apimachinery//pkg/runtime/schema:go_default_library", + "@io_k8s_apimachinery//pkg/types:go_default_library", + "@io_k8s_apimachinery//pkg/watch:go_default_library", + "@io_k8s_client_go//rest:go_default_library", + "@io_k8s_client_go//testing:go_default_library", + ], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/fake/doc.go b/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/fake/doc.go new file mode 100644 index 000000000..4fe6bab38 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/fake/fake_certificate.go b/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/fake/fake_certificate.go new file mode 100644 index 000000000..e3db1e1f3 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/fake/fake_certificate.go @@ -0,0 +1,140 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha3 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha3" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeCertificates implements CertificateInterface +type FakeCertificates struct { + Fake *FakeCertmanagerV1alpha3 + ns string +} + +var certificatesResource = schema.GroupVersionResource{Group: "cert-manager.io", Version: "v1alpha3", Resource: "certificates"} + +var certificatesKind = schema.GroupVersionKind{Group: "cert-manager.io", Version: "v1alpha3", Kind: "Certificate"} + +// Get takes name of the certificate, and returns the corresponding certificate object, and an error if there is any. +func (c *FakeCertificates) Get(name string, options v1.GetOptions) (result *v1alpha3.Certificate, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(certificatesResource, c.ns, name), &v1alpha3.Certificate{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.Certificate), err +} + +// List takes label and field selectors, and returns the list of Certificates that match those selectors. +func (c *FakeCertificates) List(opts v1.ListOptions) (result *v1alpha3.CertificateList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(certificatesResource, certificatesKind, c.ns, opts), &v1alpha3.CertificateList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha3.CertificateList{ListMeta: obj.(*v1alpha3.CertificateList).ListMeta} + for _, item := range obj.(*v1alpha3.CertificateList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested certificates. +func (c *FakeCertificates) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(certificatesResource, c.ns, opts)) + +} + +// Create takes the representation of a certificate and creates it. Returns the server's representation of the certificate, and an error, if there is any. +func (c *FakeCertificates) Create(certificate *v1alpha3.Certificate) (result *v1alpha3.Certificate, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(certificatesResource, c.ns, certificate), &v1alpha3.Certificate{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.Certificate), err +} + +// Update takes the representation of a certificate and updates it. Returns the server's representation of the certificate, and an error, if there is any. +func (c *FakeCertificates) Update(certificate *v1alpha3.Certificate) (result *v1alpha3.Certificate, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(certificatesResource, c.ns, certificate), &v1alpha3.Certificate{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.Certificate), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeCertificates) UpdateStatus(certificate *v1alpha3.Certificate) (*v1alpha3.Certificate, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(certificatesResource, "status", c.ns, certificate), &v1alpha3.Certificate{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.Certificate), err +} + +// Delete takes name of the certificate and deletes it. Returns an error if one occurs. +func (c *FakeCertificates) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(certificatesResource, c.ns, name), &v1alpha3.Certificate{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeCertificates) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(certificatesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha3.CertificateList{}) + return err +} + +// Patch applies the patch and returns the patched certificate. +func (c *FakeCertificates) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.Certificate, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(certificatesResource, c.ns, name, pt, data, subresources...), &v1alpha3.Certificate{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.Certificate), err +} diff --git a/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/fake/fake_certificaterequest.go b/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/fake/fake_certificaterequest.go new file mode 100644 index 000000000..1ead87741 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/fake/fake_certificaterequest.go @@ -0,0 +1,140 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha3 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha3" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeCertificateRequests implements CertificateRequestInterface +type FakeCertificateRequests struct { + Fake *FakeCertmanagerV1alpha3 + ns string +} + +var certificaterequestsResource = schema.GroupVersionResource{Group: "cert-manager.io", Version: "v1alpha3", Resource: "certificaterequests"} + +var certificaterequestsKind = schema.GroupVersionKind{Group: "cert-manager.io", Version: "v1alpha3", Kind: "CertificateRequest"} + +// Get takes name of the certificateRequest, and returns the corresponding certificateRequest object, and an error if there is any. +func (c *FakeCertificateRequests) Get(name string, options v1.GetOptions) (result *v1alpha3.CertificateRequest, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(certificaterequestsResource, c.ns, name), &v1alpha3.CertificateRequest{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.CertificateRequest), err +} + +// List takes label and field selectors, and returns the list of CertificateRequests that match those selectors. +func (c *FakeCertificateRequests) List(opts v1.ListOptions) (result *v1alpha3.CertificateRequestList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(certificaterequestsResource, certificaterequestsKind, c.ns, opts), &v1alpha3.CertificateRequestList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha3.CertificateRequestList{ListMeta: obj.(*v1alpha3.CertificateRequestList).ListMeta} + for _, item := range obj.(*v1alpha3.CertificateRequestList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested certificateRequests. +func (c *FakeCertificateRequests) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(certificaterequestsResource, c.ns, opts)) + +} + +// Create takes the representation of a certificateRequest and creates it. Returns the server's representation of the certificateRequest, and an error, if there is any. +func (c *FakeCertificateRequests) Create(certificateRequest *v1alpha3.CertificateRequest) (result *v1alpha3.CertificateRequest, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(certificaterequestsResource, c.ns, certificateRequest), &v1alpha3.CertificateRequest{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.CertificateRequest), err +} + +// Update takes the representation of a certificateRequest and updates it. Returns the server's representation of the certificateRequest, and an error, if there is any. +func (c *FakeCertificateRequests) Update(certificateRequest *v1alpha3.CertificateRequest) (result *v1alpha3.CertificateRequest, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(certificaterequestsResource, c.ns, certificateRequest), &v1alpha3.CertificateRequest{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.CertificateRequest), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeCertificateRequests) UpdateStatus(certificateRequest *v1alpha3.CertificateRequest) (*v1alpha3.CertificateRequest, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(certificaterequestsResource, "status", c.ns, certificateRequest), &v1alpha3.CertificateRequest{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.CertificateRequest), err +} + +// Delete takes name of the certificateRequest and deletes it. Returns an error if one occurs. +func (c *FakeCertificateRequests) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(certificaterequestsResource, c.ns, name), &v1alpha3.CertificateRequest{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeCertificateRequests) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(certificaterequestsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha3.CertificateRequestList{}) + return err +} + +// Patch applies the patch and returns the patched certificateRequest. +func (c *FakeCertificateRequests) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.CertificateRequest, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(certificaterequestsResource, c.ns, name, pt, data, subresources...), &v1alpha3.CertificateRequest{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.CertificateRequest), err +} diff --git a/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/fake/fake_certmanager_client.go b/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/fake/fake_certmanager_client.go new file mode 100644 index 000000000..581cfba85 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/fake/fake_certmanager_client.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha3 "github.com/jetstack/cert-manager/pkg/client/clientset/versioned/typed/certmanager/v1alpha3" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeCertmanagerV1alpha3 struct { + *testing.Fake +} + +func (c *FakeCertmanagerV1alpha3) Certificates(namespace string) v1alpha3.CertificateInterface { + return &FakeCertificates{c, namespace} +} + +func (c *FakeCertmanagerV1alpha3) CertificateRequests(namespace string) v1alpha3.CertificateRequestInterface { + return &FakeCertificateRequests{c, namespace} +} + +func (c *FakeCertmanagerV1alpha3) ClusterIssuers() v1alpha3.ClusterIssuerInterface { + return &FakeClusterIssuers{c} +} + +func (c *FakeCertmanagerV1alpha3) Issuers(namespace string) v1alpha3.IssuerInterface { + return &FakeIssuers{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeCertmanagerV1alpha3) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/fake/fake_clusterissuer.go b/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/fake/fake_clusterissuer.go new file mode 100644 index 000000000..d210feeb1 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/fake/fake_clusterissuer.go @@ -0,0 +1,131 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha3 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha3" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeClusterIssuers implements ClusterIssuerInterface +type FakeClusterIssuers struct { + Fake *FakeCertmanagerV1alpha3 +} + +var clusterissuersResource = schema.GroupVersionResource{Group: "cert-manager.io", Version: "v1alpha3", Resource: "clusterissuers"} + +var clusterissuersKind = schema.GroupVersionKind{Group: "cert-manager.io", Version: "v1alpha3", Kind: "ClusterIssuer"} + +// Get takes name of the clusterIssuer, and returns the corresponding clusterIssuer object, and an error if there is any. +func (c *FakeClusterIssuers) Get(name string, options v1.GetOptions) (result *v1alpha3.ClusterIssuer, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(clusterissuersResource, name), &v1alpha3.ClusterIssuer{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.ClusterIssuer), err +} + +// List takes label and field selectors, and returns the list of ClusterIssuers that match those selectors. +func (c *FakeClusterIssuers) List(opts v1.ListOptions) (result *v1alpha3.ClusterIssuerList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(clusterissuersResource, clusterissuersKind, opts), &v1alpha3.ClusterIssuerList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha3.ClusterIssuerList{ListMeta: obj.(*v1alpha3.ClusterIssuerList).ListMeta} + for _, item := range obj.(*v1alpha3.ClusterIssuerList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested clusterIssuers. +func (c *FakeClusterIssuers) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(clusterissuersResource, opts)) +} + +// Create takes the representation of a clusterIssuer and creates it. Returns the server's representation of the clusterIssuer, and an error, if there is any. +func (c *FakeClusterIssuers) Create(clusterIssuer *v1alpha3.ClusterIssuer) (result *v1alpha3.ClusterIssuer, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(clusterissuersResource, clusterIssuer), &v1alpha3.ClusterIssuer{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.ClusterIssuer), err +} + +// Update takes the representation of a clusterIssuer and updates it. Returns the server's representation of the clusterIssuer, and an error, if there is any. +func (c *FakeClusterIssuers) Update(clusterIssuer *v1alpha3.ClusterIssuer) (result *v1alpha3.ClusterIssuer, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(clusterissuersResource, clusterIssuer), &v1alpha3.ClusterIssuer{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.ClusterIssuer), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeClusterIssuers) UpdateStatus(clusterIssuer *v1alpha3.ClusterIssuer) (*v1alpha3.ClusterIssuer, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(clusterissuersResource, "status", clusterIssuer), &v1alpha3.ClusterIssuer{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.ClusterIssuer), err +} + +// Delete takes name of the clusterIssuer and deletes it. Returns an error if one occurs. +func (c *FakeClusterIssuers) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(clusterissuersResource, name), &v1alpha3.ClusterIssuer{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeClusterIssuers) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(clusterissuersResource, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha3.ClusterIssuerList{}) + return err +} + +// Patch applies the patch and returns the patched clusterIssuer. +func (c *FakeClusterIssuers) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.ClusterIssuer, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(clusterissuersResource, name, pt, data, subresources...), &v1alpha3.ClusterIssuer{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.ClusterIssuer), err +} diff --git a/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/fake/fake_issuer.go b/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/fake/fake_issuer.go new file mode 100644 index 000000000..0a18b816c --- /dev/null +++ b/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/fake/fake_issuer.go @@ -0,0 +1,140 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha3 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha3" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeIssuers implements IssuerInterface +type FakeIssuers struct { + Fake *FakeCertmanagerV1alpha3 + ns string +} + +var issuersResource = schema.GroupVersionResource{Group: "cert-manager.io", Version: "v1alpha3", Resource: "issuers"} + +var issuersKind = schema.GroupVersionKind{Group: "cert-manager.io", Version: "v1alpha3", Kind: "Issuer"} + +// Get takes name of the issuer, and returns the corresponding issuer object, and an error if there is any. +func (c *FakeIssuers) Get(name string, options v1.GetOptions) (result *v1alpha3.Issuer, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(issuersResource, c.ns, name), &v1alpha3.Issuer{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.Issuer), err +} + +// List takes label and field selectors, and returns the list of Issuers that match those selectors. +func (c *FakeIssuers) List(opts v1.ListOptions) (result *v1alpha3.IssuerList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(issuersResource, issuersKind, c.ns, opts), &v1alpha3.IssuerList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha3.IssuerList{ListMeta: obj.(*v1alpha3.IssuerList).ListMeta} + for _, item := range obj.(*v1alpha3.IssuerList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested issuers. +func (c *FakeIssuers) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(issuersResource, c.ns, opts)) + +} + +// Create takes the representation of a issuer and creates it. Returns the server's representation of the issuer, and an error, if there is any. +func (c *FakeIssuers) Create(issuer *v1alpha3.Issuer) (result *v1alpha3.Issuer, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(issuersResource, c.ns, issuer), &v1alpha3.Issuer{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.Issuer), err +} + +// Update takes the representation of a issuer and updates it. Returns the server's representation of the issuer, and an error, if there is any. +func (c *FakeIssuers) Update(issuer *v1alpha3.Issuer) (result *v1alpha3.Issuer, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(issuersResource, c.ns, issuer), &v1alpha3.Issuer{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.Issuer), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeIssuers) UpdateStatus(issuer *v1alpha3.Issuer) (*v1alpha3.Issuer, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(issuersResource, "status", c.ns, issuer), &v1alpha3.Issuer{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.Issuer), err +} + +// Delete takes name of the issuer and deletes it. Returns an error if one occurs. +func (c *FakeIssuers) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(issuersResource, c.ns, name), &v1alpha3.Issuer{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeIssuers) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(issuersResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha3.IssuerList{}) + return err +} + +// Patch applies the patch and returns the patched issuer. +func (c *FakeIssuers) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.Issuer, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(issuersResource, c.ns, name, pt, data, subresources...), &v1alpha3.Issuer{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha3.Issuer), err +} diff --git a/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/generated_expansion.go b/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/generated_expansion.go new file mode 100644 index 000000000..39b04bd05 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/generated_expansion.go @@ -0,0 +1,27 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha3 + +type CertificateExpansion interface{} + +type CertificateRequestExpansion interface{} + +type ClusterIssuerExpansion interface{} + +type IssuerExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/issuer.go b/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/issuer.go new file mode 100644 index 000000000..4840f1138 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/certmanager/v1alpha3/issuer.go @@ -0,0 +1,191 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + "time" + + v1alpha3 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha3" + scheme "github.com/jetstack/cert-manager/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// IssuersGetter has a method to return a IssuerInterface. +// A group's client should implement this interface. +type IssuersGetter interface { + Issuers(namespace string) IssuerInterface +} + +// IssuerInterface has methods to work with Issuer resources. +type IssuerInterface interface { + Create(*v1alpha3.Issuer) (*v1alpha3.Issuer, error) + Update(*v1alpha3.Issuer) (*v1alpha3.Issuer, error) + UpdateStatus(*v1alpha3.Issuer) (*v1alpha3.Issuer, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha3.Issuer, error) + List(opts v1.ListOptions) (*v1alpha3.IssuerList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.Issuer, err error) + IssuerExpansion +} + +// issuers implements IssuerInterface +type issuers struct { + client rest.Interface + ns string +} + +// newIssuers returns a Issuers +func newIssuers(c *CertmanagerV1alpha3Client, namespace string) *issuers { + return &issuers{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the issuer, and returns the corresponding issuer object, and an error if there is any. +func (c *issuers) Get(name string, options v1.GetOptions) (result *v1alpha3.Issuer, err error) { + result = &v1alpha3.Issuer{} + err = c.client.Get(). + Namespace(c.ns). + Resource("issuers"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Issuers that match those selectors. +func (c *issuers) List(opts v1.ListOptions) (result *v1alpha3.IssuerList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha3.IssuerList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("issuers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested issuers. +func (c *issuers) Watch(opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("issuers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch() +} + +// Create takes the representation of a issuer and creates it. Returns the server's representation of the issuer, and an error, if there is any. +func (c *issuers) Create(issuer *v1alpha3.Issuer) (result *v1alpha3.Issuer, err error) { + result = &v1alpha3.Issuer{} + err = c.client.Post(). + Namespace(c.ns). + Resource("issuers"). + Body(issuer). + Do(). + Into(result) + return +} + +// Update takes the representation of a issuer and updates it. Returns the server's representation of the issuer, and an error, if there is any. +func (c *issuers) Update(issuer *v1alpha3.Issuer) (result *v1alpha3.Issuer, err error) { + result = &v1alpha3.Issuer{} + err = c.client.Put(). + Namespace(c.ns). + Resource("issuers"). + Name(issuer.Name). + Body(issuer). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *issuers) UpdateStatus(issuer *v1alpha3.Issuer) (result *v1alpha3.Issuer, err error) { + result = &v1alpha3.Issuer{} + err = c.client.Put(). + Namespace(c.ns). + Resource("issuers"). + Name(issuer.Name). + SubResource("status"). + Body(issuer). + Do(). + Into(result) + return +} + +// Delete takes name of the issuer and deletes it. Returns an error if one occurs. +func (c *issuers) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("issuers"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *issuers) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("issuers"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched issuer. +func (c *issuers) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha3.Issuer, err error) { + result = &v1alpha3.Issuer{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("issuers"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/informers/externalversions/BUILD.bazel b/pkg/client/informers/externalversions/BUILD.bazel index 172f54295..e33afbc73 100644 --- a/pkg/client/informers/externalversions/BUILD.bazel +++ b/pkg/client/informers/externalversions/BUILD.bazel @@ -10,7 +10,9 @@ go_library( visibility = ["//visibility:public"], deps = [ "//pkg/apis/acme/v1alpha2:go_default_library", + "//pkg/apis/acme/v1alpha3:go_default_library", "//pkg/apis/certmanager/v1alpha2:go_default_library", + "//pkg/apis/certmanager/v1alpha3:go_default_library", "//pkg/client/clientset/versioned:go_default_library", "//pkg/client/informers/externalversions/acme:go_default_library", "//pkg/client/informers/externalversions/certmanager:go_default_library", diff --git a/pkg/client/informers/externalversions/acme/BUILD.bazel b/pkg/client/informers/externalversions/acme/BUILD.bazel index 4b2fdc601..871172cbb 100644 --- a/pkg/client/informers/externalversions/acme/BUILD.bazel +++ b/pkg/client/informers/externalversions/acme/BUILD.bazel @@ -7,6 +7,7 @@ go_library( visibility = ["//visibility:public"], deps = [ "//pkg/client/informers/externalversions/acme/v1alpha2:go_default_library", + "//pkg/client/informers/externalversions/acme/v1alpha3:go_default_library", "//pkg/client/informers/externalversions/internalinterfaces:go_default_library", ], ) @@ -23,6 +24,7 @@ filegroup( srcs = [ ":package-srcs", "//pkg/client/informers/externalversions/acme/v1alpha2:all-srcs", + "//pkg/client/informers/externalversions/acme/v1alpha3:all-srcs", ], tags = ["automanaged"], visibility = ["//visibility:public"], diff --git a/pkg/client/informers/externalversions/acme/interface.go b/pkg/client/informers/externalversions/acme/interface.go index 05de2561a..abcf54ff3 100644 --- a/pkg/client/informers/externalversions/acme/interface.go +++ b/pkg/client/informers/externalversions/acme/interface.go @@ -20,6 +20,7 @@ package acme import ( v1alpha2 "github.com/jetstack/cert-manager/pkg/client/informers/externalversions/acme/v1alpha2" + v1alpha3 "github.com/jetstack/cert-manager/pkg/client/informers/externalversions/acme/v1alpha3" internalinterfaces "github.com/jetstack/cert-manager/pkg/client/informers/externalversions/internalinterfaces" ) @@ -27,6 +28,8 @@ import ( type Interface interface { // V1alpha2 provides access to shared informers for resources in V1alpha2. V1alpha2() v1alpha2.Interface + // V1alpha3 provides access to shared informers for resources in V1alpha3. + V1alpha3() v1alpha3.Interface } type group struct { @@ -44,3 +47,8 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList func (g *group) V1alpha2() v1alpha2.Interface { return v1alpha2.New(g.factory, g.namespace, g.tweakListOptions) } + +// V1alpha3 returns a new v1alpha3.Interface. +func (g *group) V1alpha3() v1alpha3.Interface { + return v1alpha3.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/client/informers/externalversions/acme/v1alpha3/BUILD.bazel b/pkg/client/informers/externalversions/acme/v1alpha3/BUILD.bazel new file mode 100644 index 000000000..228d2c115 --- /dev/null +++ b/pkg/client/informers/externalversions/acme/v1alpha3/BUILD.bazel @@ -0,0 +1,36 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "challenge.go", + "interface.go", + "order.go", + ], + importpath = "github.com/jetstack/cert-manager/pkg/client/informers/externalversions/acme/v1alpha3", + visibility = ["//visibility:public"], + deps = [ + "//pkg/apis/acme/v1alpha3:go_default_library", + "//pkg/client/clientset/versioned:go_default_library", + "//pkg/client/informers/externalversions/internalinterfaces:go_default_library", + "//pkg/client/listers/acme/v1alpha3:go_default_library", + "@io_k8s_apimachinery//pkg/apis/meta/v1:go_default_library", + "@io_k8s_apimachinery//pkg/runtime:go_default_library", + "@io_k8s_apimachinery//pkg/watch:go_default_library", + "@io_k8s_client_go//tools/cache:go_default_library", + ], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/pkg/client/informers/externalversions/acme/v1alpha3/challenge.go b/pkg/client/informers/externalversions/acme/v1alpha3/challenge.go new file mode 100644 index 000000000..386c58f90 --- /dev/null +++ b/pkg/client/informers/externalversions/acme/v1alpha3/challenge.go @@ -0,0 +1,89 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + time "time" + + acmev1alpha3 "github.com/jetstack/cert-manager/pkg/apis/acme/v1alpha3" + versioned "github.com/jetstack/cert-manager/pkg/client/clientset/versioned" + internalinterfaces "github.com/jetstack/cert-manager/pkg/client/informers/externalversions/internalinterfaces" + v1alpha3 "github.com/jetstack/cert-manager/pkg/client/listers/acme/v1alpha3" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// ChallengeInformer provides access to a shared informer and lister for +// Challenges. +type ChallengeInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha3.ChallengeLister +} + +type challengeInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewChallengeInformer constructs a new informer for Challenge type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewChallengeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredChallengeInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredChallengeInformer constructs a new informer for Challenge type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredChallengeInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AcmeV1alpha3().Challenges(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AcmeV1alpha3().Challenges(namespace).Watch(options) + }, + }, + &acmev1alpha3.Challenge{}, + resyncPeriod, + indexers, + ) +} + +func (f *challengeInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredChallengeInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *challengeInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&acmev1alpha3.Challenge{}, f.defaultInformer) +} + +func (f *challengeInformer) Lister() v1alpha3.ChallengeLister { + return v1alpha3.NewChallengeLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/acme/v1alpha3/interface.go b/pkg/client/informers/externalversions/acme/v1alpha3/interface.go new file mode 100644 index 000000000..3efa59a17 --- /dev/null +++ b/pkg/client/informers/externalversions/acme/v1alpha3/interface.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + internalinterfaces "github.com/jetstack/cert-manager/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Challenges returns a ChallengeInformer. + Challenges() ChallengeInformer + // Orders returns a OrderInformer. + Orders() OrderInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Challenges returns a ChallengeInformer. +func (v *version) Challenges() ChallengeInformer { + return &challengeInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Orders returns a OrderInformer. +func (v *version) Orders() OrderInformer { + return &orderInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/client/informers/externalversions/acme/v1alpha3/order.go b/pkg/client/informers/externalversions/acme/v1alpha3/order.go new file mode 100644 index 000000000..a9cede9a6 --- /dev/null +++ b/pkg/client/informers/externalversions/acme/v1alpha3/order.go @@ -0,0 +1,89 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + time "time" + + acmev1alpha3 "github.com/jetstack/cert-manager/pkg/apis/acme/v1alpha3" + versioned "github.com/jetstack/cert-manager/pkg/client/clientset/versioned" + internalinterfaces "github.com/jetstack/cert-manager/pkg/client/informers/externalversions/internalinterfaces" + v1alpha3 "github.com/jetstack/cert-manager/pkg/client/listers/acme/v1alpha3" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// OrderInformer provides access to a shared informer and lister for +// Orders. +type OrderInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha3.OrderLister +} + +type orderInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewOrderInformer constructs a new informer for Order type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewOrderInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredOrderInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredOrderInformer constructs a new informer for Order type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredOrderInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AcmeV1alpha3().Orders(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AcmeV1alpha3().Orders(namespace).Watch(options) + }, + }, + &acmev1alpha3.Order{}, + resyncPeriod, + indexers, + ) +} + +func (f *orderInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredOrderInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *orderInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&acmev1alpha3.Order{}, f.defaultInformer) +} + +func (f *orderInformer) Lister() v1alpha3.OrderLister { + return v1alpha3.NewOrderLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/certmanager/BUILD.bazel b/pkg/client/informers/externalversions/certmanager/BUILD.bazel index 7badc727e..82f2ccfb2 100644 --- a/pkg/client/informers/externalversions/certmanager/BUILD.bazel +++ b/pkg/client/informers/externalversions/certmanager/BUILD.bazel @@ -7,6 +7,7 @@ go_library( visibility = ["//visibility:public"], deps = [ "//pkg/client/informers/externalversions/certmanager/v1alpha2:go_default_library", + "//pkg/client/informers/externalversions/certmanager/v1alpha3:go_default_library", "//pkg/client/informers/externalversions/internalinterfaces:go_default_library", ], ) @@ -23,6 +24,7 @@ filegroup( srcs = [ ":package-srcs", "//pkg/client/informers/externalversions/certmanager/v1alpha2:all-srcs", + "//pkg/client/informers/externalversions/certmanager/v1alpha3:all-srcs", ], tags = ["automanaged"], visibility = ["//visibility:public"], diff --git a/pkg/client/informers/externalversions/certmanager/interface.go b/pkg/client/informers/externalversions/certmanager/interface.go index bb5caa59d..fefe91f66 100644 --- a/pkg/client/informers/externalversions/certmanager/interface.go +++ b/pkg/client/informers/externalversions/certmanager/interface.go @@ -20,6 +20,7 @@ package certmanager import ( v1alpha2 "github.com/jetstack/cert-manager/pkg/client/informers/externalversions/certmanager/v1alpha2" + v1alpha3 "github.com/jetstack/cert-manager/pkg/client/informers/externalversions/certmanager/v1alpha3" internalinterfaces "github.com/jetstack/cert-manager/pkg/client/informers/externalversions/internalinterfaces" ) @@ -27,6 +28,8 @@ import ( type Interface interface { // V1alpha2 provides access to shared informers for resources in V1alpha2. V1alpha2() v1alpha2.Interface + // V1alpha3 provides access to shared informers for resources in V1alpha3. + V1alpha3() v1alpha3.Interface } type group struct { @@ -44,3 +47,8 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList func (g *group) V1alpha2() v1alpha2.Interface { return v1alpha2.New(g.factory, g.namespace, g.tweakListOptions) } + +// V1alpha3 returns a new v1alpha3.Interface. +func (g *group) V1alpha3() v1alpha3.Interface { + return v1alpha3.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/client/informers/externalversions/certmanager/v1alpha3/BUILD.bazel b/pkg/client/informers/externalversions/certmanager/v1alpha3/BUILD.bazel new file mode 100644 index 000000000..58d7a944b --- /dev/null +++ b/pkg/client/informers/externalversions/certmanager/v1alpha3/BUILD.bazel @@ -0,0 +1,38 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "certificate.go", + "certificaterequest.go", + "clusterissuer.go", + "interface.go", + "issuer.go", + ], + importpath = "github.com/jetstack/cert-manager/pkg/client/informers/externalversions/certmanager/v1alpha3", + visibility = ["//visibility:public"], + deps = [ + "//pkg/apis/certmanager/v1alpha3:go_default_library", + "//pkg/client/clientset/versioned:go_default_library", + "//pkg/client/informers/externalversions/internalinterfaces:go_default_library", + "//pkg/client/listers/certmanager/v1alpha3:go_default_library", + "@io_k8s_apimachinery//pkg/apis/meta/v1:go_default_library", + "@io_k8s_apimachinery//pkg/runtime:go_default_library", + "@io_k8s_apimachinery//pkg/watch:go_default_library", + "@io_k8s_client_go//tools/cache:go_default_library", + ], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/pkg/client/informers/externalversions/certmanager/v1alpha3/certificate.go b/pkg/client/informers/externalversions/certmanager/v1alpha3/certificate.go new file mode 100644 index 000000000..0d8d4ba7e --- /dev/null +++ b/pkg/client/informers/externalversions/certmanager/v1alpha3/certificate.go @@ -0,0 +1,89 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + time "time" + + certmanagerv1alpha3 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha3" + versioned "github.com/jetstack/cert-manager/pkg/client/clientset/versioned" + internalinterfaces "github.com/jetstack/cert-manager/pkg/client/informers/externalversions/internalinterfaces" + v1alpha3 "github.com/jetstack/cert-manager/pkg/client/listers/certmanager/v1alpha3" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// CertificateInformer provides access to a shared informer and lister for +// Certificates. +type CertificateInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha3.CertificateLister +} + +type certificateInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewCertificateInformer constructs a new informer for Certificate type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCertificateInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCertificateInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredCertificateInformer constructs a new informer for Certificate type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCertificateInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CertmanagerV1alpha3().Certificates(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CertmanagerV1alpha3().Certificates(namespace).Watch(options) + }, + }, + &certmanagerv1alpha3.Certificate{}, + resyncPeriod, + indexers, + ) +} + +func (f *certificateInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCertificateInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *certificateInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&certmanagerv1alpha3.Certificate{}, f.defaultInformer) +} + +func (f *certificateInformer) Lister() v1alpha3.CertificateLister { + return v1alpha3.NewCertificateLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/certmanager/v1alpha3/certificaterequest.go b/pkg/client/informers/externalversions/certmanager/v1alpha3/certificaterequest.go new file mode 100644 index 000000000..0274baa9d --- /dev/null +++ b/pkg/client/informers/externalversions/certmanager/v1alpha3/certificaterequest.go @@ -0,0 +1,89 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + time "time" + + certmanagerv1alpha3 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha3" + versioned "github.com/jetstack/cert-manager/pkg/client/clientset/versioned" + internalinterfaces "github.com/jetstack/cert-manager/pkg/client/informers/externalversions/internalinterfaces" + v1alpha3 "github.com/jetstack/cert-manager/pkg/client/listers/certmanager/v1alpha3" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// CertificateRequestInformer provides access to a shared informer and lister for +// CertificateRequests. +type CertificateRequestInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha3.CertificateRequestLister +} + +type certificateRequestInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewCertificateRequestInformer constructs a new informer for CertificateRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCertificateRequestInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCertificateRequestInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredCertificateRequestInformer constructs a new informer for CertificateRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCertificateRequestInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CertmanagerV1alpha3().CertificateRequests(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CertmanagerV1alpha3().CertificateRequests(namespace).Watch(options) + }, + }, + &certmanagerv1alpha3.CertificateRequest{}, + resyncPeriod, + indexers, + ) +} + +func (f *certificateRequestInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCertificateRequestInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *certificateRequestInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&certmanagerv1alpha3.CertificateRequest{}, f.defaultInformer) +} + +func (f *certificateRequestInformer) Lister() v1alpha3.CertificateRequestLister { + return v1alpha3.NewCertificateRequestLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/certmanager/v1alpha3/clusterissuer.go b/pkg/client/informers/externalversions/certmanager/v1alpha3/clusterissuer.go new file mode 100644 index 000000000..f46b2981c --- /dev/null +++ b/pkg/client/informers/externalversions/certmanager/v1alpha3/clusterissuer.go @@ -0,0 +1,88 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + time "time" + + certmanagerv1alpha3 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha3" + versioned "github.com/jetstack/cert-manager/pkg/client/clientset/versioned" + internalinterfaces "github.com/jetstack/cert-manager/pkg/client/informers/externalversions/internalinterfaces" + v1alpha3 "github.com/jetstack/cert-manager/pkg/client/listers/certmanager/v1alpha3" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// ClusterIssuerInformer provides access to a shared informer and lister for +// ClusterIssuers. +type ClusterIssuerInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha3.ClusterIssuerLister +} + +type clusterIssuerInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewClusterIssuerInformer constructs a new informer for ClusterIssuer type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterIssuerInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredClusterIssuerInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredClusterIssuerInformer constructs a new informer for ClusterIssuer type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredClusterIssuerInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CertmanagerV1alpha3().ClusterIssuers().List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CertmanagerV1alpha3().ClusterIssuers().Watch(options) + }, + }, + &certmanagerv1alpha3.ClusterIssuer{}, + resyncPeriod, + indexers, + ) +} + +func (f *clusterIssuerInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredClusterIssuerInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *clusterIssuerInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&certmanagerv1alpha3.ClusterIssuer{}, f.defaultInformer) +} + +func (f *clusterIssuerInformer) Lister() v1alpha3.ClusterIssuerLister { + return v1alpha3.NewClusterIssuerLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/certmanager/v1alpha3/interface.go b/pkg/client/informers/externalversions/certmanager/v1alpha3/interface.go new file mode 100644 index 000000000..220194402 --- /dev/null +++ b/pkg/client/informers/externalversions/certmanager/v1alpha3/interface.go @@ -0,0 +1,66 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + internalinterfaces "github.com/jetstack/cert-manager/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Certificates returns a CertificateInformer. + Certificates() CertificateInformer + // CertificateRequests returns a CertificateRequestInformer. + CertificateRequests() CertificateRequestInformer + // ClusterIssuers returns a ClusterIssuerInformer. + ClusterIssuers() ClusterIssuerInformer + // Issuers returns a IssuerInformer. + Issuers() IssuerInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Certificates returns a CertificateInformer. +func (v *version) Certificates() CertificateInformer { + return &certificateInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// CertificateRequests returns a CertificateRequestInformer. +func (v *version) CertificateRequests() CertificateRequestInformer { + return &certificateRequestInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ClusterIssuers returns a ClusterIssuerInformer. +func (v *version) ClusterIssuers() ClusterIssuerInformer { + return &clusterIssuerInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// Issuers returns a IssuerInformer. +func (v *version) Issuers() IssuerInformer { + return &issuerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/client/informers/externalversions/certmanager/v1alpha3/issuer.go b/pkg/client/informers/externalversions/certmanager/v1alpha3/issuer.go new file mode 100644 index 000000000..fcdeaafd7 --- /dev/null +++ b/pkg/client/informers/externalversions/certmanager/v1alpha3/issuer.go @@ -0,0 +1,89 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + time "time" + + certmanagerv1alpha3 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha3" + versioned "github.com/jetstack/cert-manager/pkg/client/clientset/versioned" + internalinterfaces "github.com/jetstack/cert-manager/pkg/client/informers/externalversions/internalinterfaces" + v1alpha3 "github.com/jetstack/cert-manager/pkg/client/listers/certmanager/v1alpha3" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// IssuerInformer provides access to a shared informer and lister for +// Issuers. +type IssuerInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha3.IssuerLister +} + +type issuerInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewIssuerInformer constructs a new informer for Issuer type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewIssuerInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredIssuerInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredIssuerInformer constructs a new informer for Issuer type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredIssuerInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CertmanagerV1alpha3().Issuers(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CertmanagerV1alpha3().Issuers(namespace).Watch(options) + }, + }, + &certmanagerv1alpha3.Issuer{}, + resyncPeriod, + indexers, + ) +} + +func (f *issuerInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredIssuerInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *issuerInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&certmanagerv1alpha3.Issuer{}, f.defaultInformer) +} + +func (f *issuerInformer) Lister() v1alpha3.IssuerLister { + return v1alpha3.NewIssuerLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index 92ee6cc49..3ab4f3ef7 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -22,7 +22,9 @@ import ( "fmt" v1alpha2 "github.com/jetstack/cert-manager/pkg/apis/acme/v1alpha2" + v1alpha3 "github.com/jetstack/cert-manager/pkg/apis/acme/v1alpha3" certmanagerv1alpha2 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha2" + certmanagerv1alpha3 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha3" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" ) @@ -59,6 +61,12 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case v1alpha2.SchemeGroupVersion.WithResource("orders"): return &genericInformer{resource: resource.GroupResource(), informer: f.Acme().V1alpha2().Orders().Informer()}, nil + // Group=acme.cert-manager.io, Version=v1alpha3 + case v1alpha3.SchemeGroupVersion.WithResource("challenges"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Acme().V1alpha3().Challenges().Informer()}, nil + case v1alpha3.SchemeGroupVersion.WithResource("orders"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Acme().V1alpha3().Orders().Informer()}, nil + // Group=cert-manager.io, Version=v1alpha2 case certmanagerv1alpha2.SchemeGroupVersion.WithResource("certificates"): return &genericInformer{resource: resource.GroupResource(), informer: f.Certmanager().V1alpha2().Certificates().Informer()}, nil @@ -69,6 +77,16 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case certmanagerv1alpha2.SchemeGroupVersion.WithResource("issuers"): return &genericInformer{resource: resource.GroupResource(), informer: f.Certmanager().V1alpha2().Issuers().Informer()}, nil + // Group=cert-manager.io, Version=v1alpha3 + case certmanagerv1alpha3.SchemeGroupVersion.WithResource("certificates"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Certmanager().V1alpha3().Certificates().Informer()}, nil + case certmanagerv1alpha3.SchemeGroupVersion.WithResource("certificaterequests"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Certmanager().V1alpha3().CertificateRequests().Informer()}, nil + case certmanagerv1alpha3.SchemeGroupVersion.WithResource("clusterissuers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Certmanager().V1alpha3().ClusterIssuers().Informer()}, nil + case certmanagerv1alpha3.SchemeGroupVersion.WithResource("issuers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Certmanager().V1alpha3().Issuers().Informer()}, nil + } return nil, fmt.Errorf("no informer found for %v", resource) diff --git a/pkg/client/listers/acme/v1alpha3/BUILD.bazel b/pkg/client/listers/acme/v1alpha3/BUILD.bazel new file mode 100644 index 000000000..160fe6906 --- /dev/null +++ b/pkg/client/listers/acme/v1alpha3/BUILD.bazel @@ -0,0 +1,32 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "challenge.go", + "expansion_generated.go", + "order.go", + ], + importpath = "github.com/jetstack/cert-manager/pkg/client/listers/acme/v1alpha3", + visibility = ["//visibility:public"], + deps = [ + "//pkg/apis/acme/v1alpha3:go_default_library", + "@io_k8s_apimachinery//pkg/api/errors:go_default_library", + "@io_k8s_apimachinery//pkg/labels:go_default_library", + "@io_k8s_client_go//tools/cache:go_default_library", + ], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/pkg/client/listers/acme/v1alpha3/challenge.go b/pkg/client/listers/acme/v1alpha3/challenge.go new file mode 100644 index 000000000..a3381c8f0 --- /dev/null +++ b/pkg/client/listers/acme/v1alpha3/challenge.go @@ -0,0 +1,94 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + v1alpha3 "github.com/jetstack/cert-manager/pkg/apis/acme/v1alpha3" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ChallengeLister helps list Challenges. +type ChallengeLister interface { + // List lists all Challenges in the indexer. + List(selector labels.Selector) (ret []*v1alpha3.Challenge, err error) + // Challenges returns an object that can list and get Challenges. + Challenges(namespace string) ChallengeNamespaceLister + ChallengeListerExpansion +} + +// challengeLister implements the ChallengeLister interface. +type challengeLister struct { + indexer cache.Indexer +} + +// NewChallengeLister returns a new ChallengeLister. +func NewChallengeLister(indexer cache.Indexer) ChallengeLister { + return &challengeLister{indexer: indexer} +} + +// List lists all Challenges in the indexer. +func (s *challengeLister) List(selector labels.Selector) (ret []*v1alpha3.Challenge, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha3.Challenge)) + }) + return ret, err +} + +// Challenges returns an object that can list and get Challenges. +func (s *challengeLister) Challenges(namespace string) ChallengeNamespaceLister { + return challengeNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ChallengeNamespaceLister helps list and get Challenges. +type ChallengeNamespaceLister interface { + // List lists all Challenges in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha3.Challenge, err error) + // Get retrieves the Challenge from the indexer for a given namespace and name. + Get(name string) (*v1alpha3.Challenge, error) + ChallengeNamespaceListerExpansion +} + +// challengeNamespaceLister implements the ChallengeNamespaceLister +// interface. +type challengeNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Challenges in the indexer for a given namespace. +func (s challengeNamespaceLister) List(selector labels.Selector) (ret []*v1alpha3.Challenge, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha3.Challenge)) + }) + return ret, err +} + +// Get retrieves the Challenge from the indexer for a given namespace and name. +func (s challengeNamespaceLister) Get(name string) (*v1alpha3.Challenge, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha3.Resource("challenge"), name) + } + return obj.(*v1alpha3.Challenge), nil +} diff --git a/pkg/client/listers/acme/v1alpha3/expansion_generated.go b/pkg/client/listers/acme/v1alpha3/expansion_generated.go new file mode 100644 index 000000000..523cb5cc6 --- /dev/null +++ b/pkg/client/listers/acme/v1alpha3/expansion_generated.go @@ -0,0 +1,35 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha3 + +// ChallengeListerExpansion allows custom methods to be added to +// ChallengeLister. +type ChallengeListerExpansion interface{} + +// ChallengeNamespaceListerExpansion allows custom methods to be added to +// ChallengeNamespaceLister. +type ChallengeNamespaceListerExpansion interface{} + +// OrderListerExpansion allows custom methods to be added to +// OrderLister. +type OrderListerExpansion interface{} + +// OrderNamespaceListerExpansion allows custom methods to be added to +// OrderNamespaceLister. +type OrderNamespaceListerExpansion interface{} diff --git a/pkg/client/listers/acme/v1alpha3/order.go b/pkg/client/listers/acme/v1alpha3/order.go new file mode 100644 index 000000000..6f96e037b --- /dev/null +++ b/pkg/client/listers/acme/v1alpha3/order.go @@ -0,0 +1,94 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + v1alpha3 "github.com/jetstack/cert-manager/pkg/apis/acme/v1alpha3" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// OrderLister helps list Orders. +type OrderLister interface { + // List lists all Orders in the indexer. + List(selector labels.Selector) (ret []*v1alpha3.Order, err error) + // Orders returns an object that can list and get Orders. + Orders(namespace string) OrderNamespaceLister + OrderListerExpansion +} + +// orderLister implements the OrderLister interface. +type orderLister struct { + indexer cache.Indexer +} + +// NewOrderLister returns a new OrderLister. +func NewOrderLister(indexer cache.Indexer) OrderLister { + return &orderLister{indexer: indexer} +} + +// List lists all Orders in the indexer. +func (s *orderLister) List(selector labels.Selector) (ret []*v1alpha3.Order, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha3.Order)) + }) + return ret, err +} + +// Orders returns an object that can list and get Orders. +func (s *orderLister) Orders(namespace string) OrderNamespaceLister { + return orderNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// OrderNamespaceLister helps list and get Orders. +type OrderNamespaceLister interface { + // List lists all Orders in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha3.Order, err error) + // Get retrieves the Order from the indexer for a given namespace and name. + Get(name string) (*v1alpha3.Order, error) + OrderNamespaceListerExpansion +} + +// orderNamespaceLister implements the OrderNamespaceLister +// interface. +type orderNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Orders in the indexer for a given namespace. +func (s orderNamespaceLister) List(selector labels.Selector) (ret []*v1alpha3.Order, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha3.Order)) + }) + return ret, err +} + +// Get retrieves the Order from the indexer for a given namespace and name. +func (s orderNamespaceLister) Get(name string) (*v1alpha3.Order, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha3.Resource("order"), name) + } + return obj.(*v1alpha3.Order), nil +} diff --git a/pkg/client/listers/certmanager/v1alpha3/BUILD.bazel b/pkg/client/listers/certmanager/v1alpha3/BUILD.bazel new file mode 100644 index 000000000..6ea1a3a81 --- /dev/null +++ b/pkg/client/listers/certmanager/v1alpha3/BUILD.bazel @@ -0,0 +1,34 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "certificate.go", + "certificaterequest.go", + "clusterissuer.go", + "expansion_generated.go", + "issuer.go", + ], + importpath = "github.com/jetstack/cert-manager/pkg/client/listers/certmanager/v1alpha3", + visibility = ["//visibility:public"], + deps = [ + "//pkg/apis/certmanager/v1alpha3:go_default_library", + "@io_k8s_apimachinery//pkg/api/errors:go_default_library", + "@io_k8s_apimachinery//pkg/labels:go_default_library", + "@io_k8s_client_go//tools/cache:go_default_library", + ], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/pkg/client/listers/certmanager/v1alpha3/certificate.go b/pkg/client/listers/certmanager/v1alpha3/certificate.go new file mode 100644 index 000000000..70f09f297 --- /dev/null +++ b/pkg/client/listers/certmanager/v1alpha3/certificate.go @@ -0,0 +1,94 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + v1alpha3 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha3" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CertificateLister helps list Certificates. +type CertificateLister interface { + // List lists all Certificates in the indexer. + List(selector labels.Selector) (ret []*v1alpha3.Certificate, err error) + // Certificates returns an object that can list and get Certificates. + Certificates(namespace string) CertificateNamespaceLister + CertificateListerExpansion +} + +// certificateLister implements the CertificateLister interface. +type certificateLister struct { + indexer cache.Indexer +} + +// NewCertificateLister returns a new CertificateLister. +func NewCertificateLister(indexer cache.Indexer) CertificateLister { + return &certificateLister{indexer: indexer} +} + +// List lists all Certificates in the indexer. +func (s *certificateLister) List(selector labels.Selector) (ret []*v1alpha3.Certificate, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha3.Certificate)) + }) + return ret, err +} + +// Certificates returns an object that can list and get Certificates. +func (s *certificateLister) Certificates(namespace string) CertificateNamespaceLister { + return certificateNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// CertificateNamespaceLister helps list and get Certificates. +type CertificateNamespaceLister interface { + // List lists all Certificates in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha3.Certificate, err error) + // Get retrieves the Certificate from the indexer for a given namespace and name. + Get(name string) (*v1alpha3.Certificate, error) + CertificateNamespaceListerExpansion +} + +// certificateNamespaceLister implements the CertificateNamespaceLister +// interface. +type certificateNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Certificates in the indexer for a given namespace. +func (s certificateNamespaceLister) List(selector labels.Selector) (ret []*v1alpha3.Certificate, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha3.Certificate)) + }) + return ret, err +} + +// Get retrieves the Certificate from the indexer for a given namespace and name. +func (s certificateNamespaceLister) Get(name string) (*v1alpha3.Certificate, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha3.Resource("certificate"), name) + } + return obj.(*v1alpha3.Certificate), nil +} diff --git a/pkg/client/listers/certmanager/v1alpha3/certificaterequest.go b/pkg/client/listers/certmanager/v1alpha3/certificaterequest.go new file mode 100644 index 000000000..f91325585 --- /dev/null +++ b/pkg/client/listers/certmanager/v1alpha3/certificaterequest.go @@ -0,0 +1,94 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + v1alpha3 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha3" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CertificateRequestLister helps list CertificateRequests. +type CertificateRequestLister interface { + // List lists all CertificateRequests in the indexer. + List(selector labels.Selector) (ret []*v1alpha3.CertificateRequest, err error) + // CertificateRequests returns an object that can list and get CertificateRequests. + CertificateRequests(namespace string) CertificateRequestNamespaceLister + CertificateRequestListerExpansion +} + +// certificateRequestLister implements the CertificateRequestLister interface. +type certificateRequestLister struct { + indexer cache.Indexer +} + +// NewCertificateRequestLister returns a new CertificateRequestLister. +func NewCertificateRequestLister(indexer cache.Indexer) CertificateRequestLister { + return &certificateRequestLister{indexer: indexer} +} + +// List lists all CertificateRequests in the indexer. +func (s *certificateRequestLister) List(selector labels.Selector) (ret []*v1alpha3.CertificateRequest, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha3.CertificateRequest)) + }) + return ret, err +} + +// CertificateRequests returns an object that can list and get CertificateRequests. +func (s *certificateRequestLister) CertificateRequests(namespace string) CertificateRequestNamespaceLister { + return certificateRequestNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// CertificateRequestNamespaceLister helps list and get CertificateRequests. +type CertificateRequestNamespaceLister interface { + // List lists all CertificateRequests in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha3.CertificateRequest, err error) + // Get retrieves the CertificateRequest from the indexer for a given namespace and name. + Get(name string) (*v1alpha3.CertificateRequest, error) + CertificateRequestNamespaceListerExpansion +} + +// certificateRequestNamespaceLister implements the CertificateRequestNamespaceLister +// interface. +type certificateRequestNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all CertificateRequests in the indexer for a given namespace. +func (s certificateRequestNamespaceLister) List(selector labels.Selector) (ret []*v1alpha3.CertificateRequest, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha3.CertificateRequest)) + }) + return ret, err +} + +// Get retrieves the CertificateRequest from the indexer for a given namespace and name. +func (s certificateRequestNamespaceLister) Get(name string) (*v1alpha3.CertificateRequest, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha3.Resource("certificaterequest"), name) + } + return obj.(*v1alpha3.CertificateRequest), nil +} diff --git a/pkg/client/listers/certmanager/v1alpha3/clusterissuer.go b/pkg/client/listers/certmanager/v1alpha3/clusterissuer.go new file mode 100644 index 000000000..a996fd1c2 --- /dev/null +++ b/pkg/client/listers/certmanager/v1alpha3/clusterissuer.go @@ -0,0 +1,65 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + v1alpha3 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha3" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ClusterIssuerLister helps list ClusterIssuers. +type ClusterIssuerLister interface { + // List lists all ClusterIssuers in the indexer. + List(selector labels.Selector) (ret []*v1alpha3.ClusterIssuer, err error) + // Get retrieves the ClusterIssuer from the index for a given name. + Get(name string) (*v1alpha3.ClusterIssuer, error) + ClusterIssuerListerExpansion +} + +// clusterIssuerLister implements the ClusterIssuerLister interface. +type clusterIssuerLister struct { + indexer cache.Indexer +} + +// NewClusterIssuerLister returns a new ClusterIssuerLister. +func NewClusterIssuerLister(indexer cache.Indexer) ClusterIssuerLister { + return &clusterIssuerLister{indexer: indexer} +} + +// List lists all ClusterIssuers in the indexer. +func (s *clusterIssuerLister) List(selector labels.Selector) (ret []*v1alpha3.ClusterIssuer, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha3.ClusterIssuer)) + }) + return ret, err +} + +// Get retrieves the ClusterIssuer from the index for a given name. +func (s *clusterIssuerLister) Get(name string) (*v1alpha3.ClusterIssuer, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha3.Resource("clusterissuer"), name) + } + return obj.(*v1alpha3.ClusterIssuer), nil +} diff --git a/pkg/client/listers/certmanager/v1alpha3/expansion_generated.go b/pkg/client/listers/certmanager/v1alpha3/expansion_generated.go new file mode 100644 index 000000000..6f2843cb6 --- /dev/null +++ b/pkg/client/listers/certmanager/v1alpha3/expansion_generated.go @@ -0,0 +1,47 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha3 + +// CertificateListerExpansion allows custom methods to be added to +// CertificateLister. +type CertificateListerExpansion interface{} + +// CertificateNamespaceListerExpansion allows custom methods to be added to +// CertificateNamespaceLister. +type CertificateNamespaceListerExpansion interface{} + +// CertificateRequestListerExpansion allows custom methods to be added to +// CertificateRequestLister. +type CertificateRequestListerExpansion interface{} + +// CertificateRequestNamespaceListerExpansion allows custom methods to be added to +// CertificateRequestNamespaceLister. +type CertificateRequestNamespaceListerExpansion interface{} + +// ClusterIssuerListerExpansion allows custom methods to be added to +// ClusterIssuerLister. +type ClusterIssuerListerExpansion interface{} + +// IssuerListerExpansion allows custom methods to be added to +// IssuerLister. +type IssuerListerExpansion interface{} + +// IssuerNamespaceListerExpansion allows custom methods to be added to +// IssuerNamespaceLister. +type IssuerNamespaceListerExpansion interface{} diff --git a/pkg/client/listers/certmanager/v1alpha3/issuer.go b/pkg/client/listers/certmanager/v1alpha3/issuer.go new file mode 100644 index 000000000..a6fd260d2 --- /dev/null +++ b/pkg/client/listers/certmanager/v1alpha3/issuer.go @@ -0,0 +1,94 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + v1alpha3 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha3" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// IssuerLister helps list Issuers. +type IssuerLister interface { + // List lists all Issuers in the indexer. + List(selector labels.Selector) (ret []*v1alpha3.Issuer, err error) + // Issuers returns an object that can list and get Issuers. + Issuers(namespace string) IssuerNamespaceLister + IssuerListerExpansion +} + +// issuerLister implements the IssuerLister interface. +type issuerLister struct { + indexer cache.Indexer +} + +// NewIssuerLister returns a new IssuerLister. +func NewIssuerLister(indexer cache.Indexer) IssuerLister { + return &issuerLister{indexer: indexer} +} + +// List lists all Issuers in the indexer. +func (s *issuerLister) List(selector labels.Selector) (ret []*v1alpha3.Issuer, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha3.Issuer)) + }) + return ret, err +} + +// Issuers returns an object that can list and get Issuers. +func (s *issuerLister) Issuers(namespace string) IssuerNamespaceLister { + return issuerNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// IssuerNamespaceLister helps list and get Issuers. +type IssuerNamespaceLister interface { + // List lists all Issuers in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha3.Issuer, err error) + // Get retrieves the Issuer from the indexer for a given namespace and name. + Get(name string) (*v1alpha3.Issuer, error) + IssuerNamespaceListerExpansion +} + +// issuerNamespaceLister implements the IssuerNamespaceLister +// interface. +type issuerNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Issuers in the indexer for a given namespace. +func (s issuerNamespaceLister) List(selector labels.Selector) (ret []*v1alpha3.Issuer, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha3.Issuer)) + }) + return ret, err +} + +// Get retrieves the Issuer from the indexer for a given namespace and name. +func (s issuerNamespaceLister) Get(name string) (*v1alpha3.Issuer, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha3.Resource("issuer"), name) + } + return obj.(*v1alpha3.Issuer), nil +} diff --git a/pkg/controller/certificaterequests/BUILD.bazel b/pkg/controller/certificaterequests/BUILD.bazel index 7842aa6ff..a2496f889 100644 --- a/pkg/controller/certificaterequests/BUILD.bazel +++ b/pkg/controller/certificaterequests/BUILD.bazel @@ -18,11 +18,12 @@ go_library( "//pkg/client/listers/certmanager/v1alpha2:go_default_library", "//pkg/controller:go_default_library", "//pkg/controller/certificaterequests/util:go_default_library", - "//pkg/internal/apis/certmanager/validation:go_default_library", + "//pkg/internal/apis/certmanager:go_default_library", "//pkg/issuer:go_default_library", "//pkg/logs:go_default_library", "//pkg/metrics:go_default_library", "//pkg/util/pki:go_default_library", + "//pkg/webhook:go_default_library", "@com_github_go_logr_logr//:go_default_library", "@com_github_kr_pretty//:go_default_library", "@io_k8s_apimachinery//pkg/api/errors:go_default_library", diff --git a/pkg/controller/certificaterequests/sync.go b/pkg/controller/certificaterequests/sync.go index 90ba48b7e..e1604d405 100644 --- a/pkg/controller/certificaterequests/sync.go +++ b/pkg/controller/certificaterequests/sync.go @@ -30,9 +30,10 @@ import ( "github.com/jetstack/cert-manager/pkg/apis/certmanager" "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha2" cmmeta "github.com/jetstack/cert-manager/pkg/apis/meta/v1" - "github.com/jetstack/cert-manager/pkg/internal/apis/certmanager/validation" + internalapi "github.com/jetstack/cert-manager/pkg/internal/apis/certmanager" logf "github.com/jetstack/cert-manager/pkg/logs" "github.com/jetstack/cert-manager/pkg/util/pki" + "github.com/jetstack/cert-manager/pkg/webhook" ) var ( @@ -112,7 +113,7 @@ func (c *Controller) Sync(ctx context.Context, cr *v1alpha2.CertificateRequest) dbg.Info("validating CertificateRequest resource object") - el := validation.ValidateCertificateRequest(crCopy) + el := webhook.ValidationRegistry.Validate(crCopy, internalapi.SchemeGroupVersion.WithKind("CertificateRequest")) if len(el) > 0 { c.reporter.Failed(crCopy, el.ToAggregate(), "BadConfig", "Resource validation failed") diff --git a/pkg/controller/clusterissuers/BUILD.bazel b/pkg/controller/clusterissuers/BUILD.bazel index ea1b46ab8..ffbfd64b6 100644 --- a/pkg/controller/clusterissuers/BUILD.bazel +++ b/pkg/controller/clusterissuers/BUILD.bazel @@ -16,10 +16,11 @@ go_library( "//pkg/client/clientset/versioned:go_default_library", "//pkg/client/listers/certmanager/v1alpha2:go_default_library", "//pkg/controller:go_default_library", - "//pkg/internal/apis/certmanager/validation:go_default_library", + "//pkg/internal/apis/certmanager:go_default_library", "//pkg/issuer:go_default_library", "//pkg/logs:go_default_library", "//pkg/metrics:go_default_library", + "//pkg/webhook:go_default_library", "@com_github_go_logr_logr//:go_default_library", "@io_k8s_api//core/v1:go_default_library", "@io_k8s_apimachinery//pkg/api/errors:go_default_library", diff --git a/pkg/controller/clusterissuers/sync.go b/pkg/controller/clusterissuers/sync.go index 088555e37..cb158f4c0 100644 --- a/pkg/controller/clusterissuers/sync.go +++ b/pkg/controller/clusterissuers/sync.go @@ -27,9 +27,10 @@ import ( apiutil "github.com/jetstack/cert-manager/pkg/api/util" "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha2" cmmeta "github.com/jetstack/cert-manager/pkg/apis/meta/v1" - "github.com/jetstack/cert-manager/pkg/internal/apis/certmanager/validation" + internalapi "github.com/jetstack/cert-manager/pkg/internal/apis/certmanager" logf "github.com/jetstack/cert-manager/pkg/logs" "github.com/jetstack/cert-manager/pkg/metrics" + "github.com/jetstack/cert-manager/pkg/webhook" ) const ( @@ -51,7 +52,7 @@ func (c *controller) Sync(ctx context.Context, iss *v1alpha2.ClusterIssuer) (err } }() - el := validation.ValidateClusterIssuer(issuerCopy) + el := webhook.ValidationRegistry.Validate(issuerCopy, internalapi.SchemeGroupVersion.WithKind("ClusterIssuer")) if len(el) > 0 { msg := fmt.Sprintf("Resource validation failed: %v", el.ToAggregate()) apiutil.SetIssuerCondition(issuerCopy, v1alpha2.IssuerConditionReady, cmmeta.ConditionFalse, errorConfig, msg) diff --git a/pkg/controller/issuers/BUILD.bazel b/pkg/controller/issuers/BUILD.bazel index fb415c41d..eb125ff67 100644 --- a/pkg/controller/issuers/BUILD.bazel +++ b/pkg/controller/issuers/BUILD.bazel @@ -16,10 +16,11 @@ go_library( "//pkg/client/clientset/versioned:go_default_library", "//pkg/client/listers/certmanager/v1alpha2:go_default_library", "//pkg/controller:go_default_library", - "//pkg/internal/apis/certmanager/validation:go_default_library", + "//pkg/internal/apis/certmanager:go_default_library", "//pkg/issuer:go_default_library", "//pkg/logs:go_default_library", "//pkg/metrics:go_default_library", + "//pkg/webhook:go_default_library", "@com_github_go_logr_logr//:go_default_library", "@io_k8s_api//core/v1:go_default_library", "@io_k8s_apimachinery//pkg/api/errors:go_default_library", diff --git a/pkg/controller/issuers/sync.go b/pkg/controller/issuers/sync.go index 475cf48e1..6c6636d1c 100644 --- a/pkg/controller/issuers/sync.go +++ b/pkg/controller/issuers/sync.go @@ -27,9 +27,10 @@ import ( apiutil "github.com/jetstack/cert-manager/pkg/api/util" "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha2" cmmeta "github.com/jetstack/cert-manager/pkg/apis/meta/v1" - "github.com/jetstack/cert-manager/pkg/internal/apis/certmanager/validation" + internalapi "github.com/jetstack/cert-manager/pkg/internal/apis/certmanager" logf "github.com/jetstack/cert-manager/pkg/logs" "github.com/jetstack/cert-manager/pkg/metrics" + "github.com/jetstack/cert-manager/pkg/webhook" ) const ( @@ -51,7 +52,7 @@ func (c *controller) Sync(ctx context.Context, iss *v1alpha2.Issuer) (err error) } }() - el := validation.ValidateIssuer(issuerCopy) + el := webhook.ValidationRegistry.Validate(issuerCopy, internalapi.SchemeGroupVersion.WithKind("Issuer")) if len(el) > 0 { msg := fmt.Sprintf("Resource validation failed: %v", el.ToAggregate()) apiutil.SetIssuerCondition(issuerCopy, v1alpha2.IssuerConditionReady, cmmeta.ConditionFalse, errorConfig, msg) diff --git a/pkg/internal/BUILD.bazel b/pkg/internal/BUILD.bazel index 5a1339179..0a3e94ed3 100644 --- a/pkg/internal/BUILD.bazel +++ b/pkg/internal/BUILD.bazel @@ -9,6 +9,7 @@ filegroup( name = "all-srcs", srcs = [ ":package-srcs", + "//pkg/internal/api/validation:all-srcs", "//pkg/internal/apis/acme:all-srcs", "//pkg/internal/apis/certmanager:all-srcs", "//pkg/internal/apis/meta:all-srcs", diff --git a/pkg/internal/api/validation/BUILD.bazel b/pkg/internal/api/validation/BUILD.bazel new file mode 100644 index 000000000..e19111aec --- /dev/null +++ b/pkg/internal/api/validation/BUILD.bazel @@ -0,0 +1,42 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "go_default_library", + srcs = ["registry.go"], + importpath = "github.com/jetstack/cert-manager/pkg/internal/api/validation", + visibility = ["//pkg:__subpackages__"], + deps = [ + "@io_k8s_apimachinery//pkg/runtime:go_default_library", + "@io_k8s_apimachinery//pkg/runtime/schema:go_default_library", + "@io_k8s_apimachinery//pkg/util/validation/field:go_default_library", + ], +) + +go_test( + name = "go_default_test", + srcs = ["registry_test.go"], + embed = [":go_default_library"], + deps = [ + "//pkg/apis/certmanager/v1alpha2:go_default_library", + "//pkg/internal/apis/certmanager:go_default_library", + "//pkg/webhook:go_default_library", + "@io_k8s_api//core/v1:go_default_library", + "@io_k8s_apimachinery//pkg/runtime:go_default_library", + "@io_k8s_apimachinery//pkg/util/runtime:go_default_library", + "@io_k8s_apimachinery//pkg/util/validation/field:go_default_library", + ], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/pkg/internal/api/validation/registry.go b/pkg/internal/api/validation/registry.go new file mode 100644 index 000000000..91e2679df --- /dev/null +++ b/pkg/internal/api/validation/registry.go @@ -0,0 +1,220 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package validation allows a caller to automatically register, lookup and +// call API validation functions. +// It is similar to runtime.Scheme and is designed to make writing and +// consuming API validation functions easier. +package validation + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +// Registry is used to store and lookup references to validation functions for +// given Kubernetes API types. +type Registry struct { + scheme *runtime.Scheme + validateRegister map[schema.GroupVersionKind]ValidateFunc + validateUpdateRegister map[schema.GroupVersionKind]ValidateUpdateFunc +} + +type ValidateFunc func(obj runtime.Object) field.ErrorList +type ValidateUpdateFunc func(oldObj, obj runtime.Object) field.ErrorList + +// NewRegistry creates a new empty registry, backed by the provided Scheme. +func NewRegistry(scheme *runtime.Scheme) *Registry { + return &Registry{ + scheme: scheme, + validateRegister: make(map[schema.GroupVersionKind]ValidateFunc), + validateUpdateRegister: make(map[schema.GroupVersionKind]ValidateUpdateFunc), + } +} + +// AddValidateFunc will add a new validation function to the register. +// The function will be run whenever Validate is called with a requestVersion +// set to any recognised GroupVersionKinds for this object. +// If obj is part of an internal API version, the validation function will be +// called on all calls to Validate regardless of version. +// If obj cannot be recognised using the registry's scheme, an error will be +// returned. +func (r *Registry) AddValidateFunc(obj runtime.Object, fn ValidateFunc) error { + gvks, _, err := r.scheme.ObjectKinds(obj) + if err != nil { + return err + } + + for _, gvk := range gvks { + r.appendValidate(gvk, fn) + } + + return nil +} + +// AddValidateUpdateFunc will add a new validation function to the register. +// The function will be run whenever ValidateUpdate is called with a +// requestVersion set to any recognised GroupVersionKinds for this object. +// If obj is part of an internal API version, the validation function will be +// called on all calls to Validate regardless of version. +// If obj cannot be recognised using the registry's scheme, an error will be +// returned. +func (r *Registry) AddValidateUpdateFunc(obj runtime.Object, fn ValidateUpdateFunc) error { + gvks, _, err := r.scheme.ObjectKinds(obj) + if err != nil { + return err + } + + for _, gvk := range gvks { + r.appendValidateUpdate(gvk, fn) + } + + return nil +} + +// Validate will run all validation functions registered for the given object. +// If the passed obj is *not* of the same version as the provided +// requestVersion, the registry will attempt to convert the object before +// calling the validation functions. +// Any validation functions registered for the objects internal API version +// will be run against the object regardless of version. +func (r *Registry) Validate(obj runtime.Object, requestVersion schema.GroupVersionKind) field.ErrorList { + versioned, internal := r.lookupValidateFuncs(requestVersion) + if versioned == nil && internal == nil { + return nil + } + + targetObj, internalObj, err := r.convert(obj, requestVersion) + if err != nil { + return internalError(err) + } + + el := field.ErrorList{} + if versioned != nil { + el = append(el, versioned(targetObj)...) + } + if internal != nil { + el = append(el, internal(internalObj)...) + } + + return el +} + +// ValidateUpdate will run all update validation functions registered for the +// given object. +// If the passed objects are *not* of the same version as the provided +// requestVersion, the registry will attempt to convert the objects before +// calling the validation functions. +// Any validation functions registered for the objects internal API version +// will be run against the object regardless of version. +func (r *Registry) ValidateUpdate(oldObj, obj runtime.Object, requestVersion schema.GroupVersionKind) field.ErrorList { + versioned, internal := r.lookupValidateUpdateFuncs(requestVersion) + if versioned == nil && internal == nil { + return nil + } + + targetOldObj, internalOldObj, err := r.convert(oldObj, requestVersion) + if err != nil { + return internalError(err) + } + + targetObj, internalObj, err := r.convert(obj, requestVersion) + if err != nil { + return internalError(err) + } + + el := field.ErrorList{} + if versioned != nil { + el = append(el, versioned(targetOldObj, targetObj)...) + } + if internal != nil { + el = append(el, internal(internalOldObj, internalObj)...) + } + + return el +} + +func (r *Registry) lookupValidateFuncs(gvk schema.GroupVersionKind) (versioned ValidateFunc, internal ValidateFunc) { + versioned = r.validateRegister[gvk] + gvk.Version = runtime.APIVersionInternal + internal = r.validateRegister[gvk] + return versioned, internal +} + +func (r *Registry) lookupValidateUpdateFuncs(gvk schema.GroupVersionKind) (versioned ValidateUpdateFunc, internal ValidateUpdateFunc) { + versioned = r.validateUpdateRegister[gvk] + gvk.Version = runtime.APIVersionInternal + internal = r.validateUpdateRegister[gvk] + return versioned, internal +} + +func (r *Registry) appendValidate(gvk schema.GroupVersionKind, fn ValidateFunc) { + existing, ok := r.validateRegister[gvk] + if !ok { + r.validateRegister[gvk] = fn + return + } + + r.validateRegister[gvk] = func(obj runtime.Object) field.ErrorList { + return append(existing(obj), fn(obj)...) + } +} + +func (r *Registry) appendValidateUpdate(gvk schema.GroupVersionKind, fn ValidateUpdateFunc) { + existing, ok := r.validateUpdateRegister[gvk] + if !ok { + r.validateUpdateRegister[gvk] = fn + return + } + + r.validateUpdateRegister[gvk] = func(oldObj, obj runtime.Object) field.ErrorList { + return append(existing(oldObj, obj), fn(oldObj, obj)...) + } +} + +// convert will convert the given obj into the requestVersion as well as +// returning the internal representation of the object. +func (r *Registry) convert(obj runtime.Object, requestVersion schema.GroupVersionKind) (targetObj, internalObj runtime.Object, err error) { + // create a new object in the desired version + targetObj, err = r.scheme.New(requestVersion) + if err != nil { + return nil, nil, err + } + // create a new object in the 'internal' version + internalVersion := requestVersion + internalVersion.Version = runtime.APIVersionInternal + internalObj, err = r.scheme.New(internalVersion) + if err != nil { + return nil, nil, err + } + + // convert the obj into the internalVersion first + if err := r.scheme.Convert(obj, internalObj, nil); err != nil { + return nil, nil, err + } + + // convert the internalObj into the requestVersion + if err := r.scheme.Convert(internalObj, targetObj, nil); err != nil { + return nil, nil, err + } + + return targetObj, internalObj, nil +} + +func internalError(err error) field.ErrorList { + return field.ErrorList{field.InternalError(nil, err)} +} diff --git a/pkg/internal/api/validation/registry_test.go b/pkg/internal/api/validation/registry_test.go new file mode 100644 index 000000000..5847f3bc6 --- /dev/null +++ b/pkg/internal/api/validation/registry_test.go @@ -0,0 +1,199 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package validation_test + +import ( + "fmt" + "testing" + + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/runtime" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" + "k8s.io/apimachinery/pkg/util/validation/field" + + cmapi "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha2" + "github.com/jetstack/cert-manager/pkg/internal/api/validation" + cmapiinternal "github.com/jetstack/cert-manager/pkg/internal/apis/certmanager" + "github.com/jetstack/cert-manager/pkg/webhook" +) + +var ( + // use the webhook's Scheme during test fixtures as it has all internal and + // external cert-manager kinds registered + scheme = webhook.Scheme +) + +func TestValidateType(t *testing.T) { + reg := validation.NewRegistry(scheme) + called := false + utilruntime.Must(reg.AddValidateFunc(&cmapi.Certificate{}, func(obj runtime.Object) field.ErrorList { + called = true + return nil + })) + errs := reg.Validate(&cmapi.Certificate{}, cmapi.SchemeGroupVersion.WithKind("Certificate")) + if len(errs) > 0 { + t.Errorf("expected to not get an error but got: %v", errs.ToAggregate()) + } + if !called { + t.Errorf("expected registered validation function to run but it did not") + } +} + +func TestValidateTypeMultiple(t *testing.T) { + reg := validation.NewRegistry(scheme) + called1 := false + called2 := false + calledInternal := false + utilruntime.Must(reg.AddValidateFunc(&cmapi.Certificate{}, func(obj runtime.Object) field.ErrorList { + called1 = true + return nil + })) + utilruntime.Must(reg.AddValidateFunc(&cmapi.Certificate{}, func(obj runtime.Object) field.ErrorList { + called2 = true + return nil + })) + utilruntime.Must(reg.AddValidateFunc(&cmapiinternal.Certificate{}, func(obj runtime.Object) field.ErrorList { + calledInternal = true + return nil + })) + errs := reg.Validate(&cmapi.Certificate{}, cmapi.SchemeGroupVersion.WithKind("Certificate")) + if len(errs) > 0 { + t.Errorf("expected to not get an error but got: %v", errs.ToAggregate()) + } + if !called1 || !called2 { + t.Errorf("expected registered validation function to run but it did not") + } + if !calledInternal { + t.Errorf("expected registered internal validation function to run against external type but it did not") + } +} + +func TestValidateUpdateTypeMultiple(t *testing.T) { + reg := validation.NewRegistry(scheme) + called1 := false + called2 := false + calledInternal := false + utilruntime.Must(reg.AddValidateUpdateFunc(&cmapi.Certificate{}, func(_, _ runtime.Object) field.ErrorList { + called1 = true + return nil + })) + utilruntime.Must(reg.AddValidateUpdateFunc(&cmapi.Certificate{}, func(_, _ runtime.Object) field.ErrorList { + called2 = true + return nil + })) + utilruntime.Must(reg.AddValidateUpdateFunc(&cmapiinternal.Certificate{}, func(_, _ runtime.Object) field.ErrorList { + calledInternal = true + return nil + })) + errs := reg.ValidateUpdate(&cmapi.Certificate{}, &cmapi.Certificate{}, cmapi.SchemeGroupVersion.WithKind("Certificate")) + if len(errs) > 0 { + t.Errorf("expected to not get an error but got: %v", errs.ToAggregate()) + } + if !called1 || !called2 { + t.Errorf("expected registered validation function to run but it did not") + } + if !calledInternal { + t.Errorf("expected registered internal validation function to run against external type but it did not") + } +} + +func TestValidateUpdateType(t *testing.T) { + reg := validation.NewRegistry(scheme) + called := false + utilruntime.Must(reg.AddValidateUpdateFunc(&cmapi.Certificate{}, func(oldObj, obj runtime.Object) field.ErrorList { + called = true + return nil + })) + errs := reg.ValidateUpdate(&cmapi.Certificate{}, &cmapi.Certificate{}, cmapi.SchemeGroupVersion.WithKind("Certificate")) + if len(errs) > 0 { + t.Errorf("expected to not get an error but got: %v", errs.ToAggregate()) + } + if !called { + t.Errorf("expected registered validation function to run but it did not") + } +} + +func TestValidateTypeReturnsErrors(t *testing.T) { + reg := validation.NewRegistry(scheme) + called := false + expectedErr := field.InternalError(nil, fmt.Errorf("failed")) + utilruntime.Must(reg.AddValidateFunc(&cmapi.Certificate{}, func(obj runtime.Object) field.ErrorList { + called = true + return field.ErrorList{expectedErr} + })) + errs := reg.Validate(&cmapi.Certificate{}, cmapi.SchemeGroupVersion.WithKind("Certificate")) + if len(errs) != 1 { + t.Error("expected to get an error but got none") + } else if err := errs[0]; err.Error() != expectedErr.Error() { + t.Errorf("expected error to be %q but got %q", expectedErr.Error(), err.Error()) + } + if !called { + t.Errorf("expected registered validation function to run but it did not") + } +} + +func TestValidateInternalType(t *testing.T) { + reg := validation.NewRegistry(scheme) + called := false + utilruntime.Must(reg.AddValidateFunc(&cmapiinternal.Certificate{}, func(obj runtime.Object) field.ErrorList { + called = true + return nil + })) + errs := reg.Validate(&cmapi.Certificate{}, cmapi.SchemeGroupVersion.WithKind("Certificate")) + if len(errs) > 0 { + t.Errorf("expected to not get an error but got: %v", errs.ToAggregate()) + } + if !called { + t.Errorf("expected registered internal validation function to run for external type but it did not") + } +} + +func TestValidateNoErrorNoneRegistered(t *testing.T) { + reg := validation.NewRegistry(scheme) + errs := reg.Validate(&cmapi.Certificate{}, cmapi.SchemeGroupVersion.WithKind("Certificate")) + if len(errs) > 0 { + t.Errorf("expected to not get an error but got: %v", errs.ToAggregate()) + } +} + +func TestValidateUpdateNoErrorNoneRegistered(t *testing.T) { + reg := validation.NewRegistry(scheme) + errs := reg.ValidateUpdate(&cmapi.Certificate{}, &cmapi.Certificate{}, cmapi.SchemeGroupVersion.WithKind("Certificate")) + if len(errs) > 0 { + t.Errorf("expected to not get an error but got: %v", errs.ToAggregate()) + } +} + +func TestValidateUnrecognisedType(t *testing.T) { + reg := validation.NewRegistry(scheme) + err := reg.AddValidateFunc(&corev1.Pod{}, func(obj runtime.Object) field.ErrorList { + return nil + }) + if err == nil { + t.Errorf("expected to get an error but did not") + } +} + +func TestValidateUpdateUnrecognisedType(t *testing.T) { + reg := validation.NewRegistry(scheme) + err := reg.AddValidateUpdateFunc(&corev1.Pod{}, func(oldObj, obj runtime.Object) field.ErrorList { + return nil + }) + if err == nil { + t.Errorf("expected to get an error but did not") + } +} diff --git a/pkg/internal/apis/acme/BUILD.bazel b/pkg/internal/apis/acme/BUILD.bazel index 7049635bc..7107f1d6c 100644 --- a/pkg/internal/apis/acme/BUILD.bazel +++ b/pkg/internal/apis/acme/BUILD.bazel @@ -37,6 +37,7 @@ filegroup( "//pkg/internal/apis/acme/fuzzer:all-srcs", "//pkg/internal/apis/acme/install:all-srcs", "//pkg/internal/apis/acme/v1alpha2:all-srcs", + "//pkg/internal/apis/acme/v1alpha3:all-srcs", "//pkg/internal/apis/acme/validation:all-srcs", ], tags = ["automanaged"], diff --git a/pkg/internal/apis/acme/install/BUILD.bazel b/pkg/internal/apis/acme/install/BUILD.bazel index ed8ebfc2b..cf30033b3 100644 --- a/pkg/internal/apis/acme/install/BUILD.bazel +++ b/pkg/internal/apis/acme/install/BUILD.bazel @@ -6,8 +6,11 @@ go_library( importpath = "github.com/jetstack/cert-manager/pkg/internal/apis/acme/install", visibility = ["//visibility:public"], deps = [ + "//pkg/internal/api/validation:go_default_library", "//pkg/internal/apis/acme:go_default_library", "//pkg/internal/apis/acme/v1alpha2:go_default_library", + "//pkg/internal/apis/acme/v1alpha3:go_default_library", + "//pkg/internal/apis/acme/validation:go_default_library", "@io_k8s_apimachinery//pkg/runtime:go_default_library", "@io_k8s_apimachinery//pkg/util/runtime:go_default_library", ], diff --git a/pkg/internal/apis/acme/install/install.go b/pkg/internal/apis/acme/install/install.go index bfe270bec..4493a24e1 100644 --- a/pkg/internal/apis/acme/install/install.go +++ b/pkg/internal/apis/acme/install/install.go @@ -22,12 +22,22 @@ import ( "k8s.io/apimachinery/pkg/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime" + "github.com/jetstack/cert-manager/pkg/internal/api/validation" "github.com/jetstack/cert-manager/pkg/internal/apis/acme" "github.com/jetstack/cert-manager/pkg/internal/apis/acme/v1alpha2" + "github.com/jetstack/cert-manager/pkg/internal/apis/acme/v1alpha3" + acmevalidation "github.com/jetstack/cert-manager/pkg/internal/apis/acme/validation" ) // Install registers the API group and adds types to a scheme func Install(scheme *runtime.Scheme) { utilruntime.Must(acme.AddToScheme(scheme)) utilruntime.Must(v1alpha2.AddToScheme(scheme)) + utilruntime.Must(v1alpha3.AddToScheme(scheme)) +} + +// InstallValidation registers validation functions for the API group with a +// validation registry +func InstallValidation(registry *validation.Registry) { + utilruntime.Must(acmevalidation.AddToValidationRegistry(registry)) } diff --git a/pkg/internal/apis/acme/v1alpha3/BUILD.bazel b/pkg/internal/apis/acme/v1alpha3/BUILD.bazel new file mode 100644 index 000000000..e870afc8d --- /dev/null +++ b/pkg/internal/apis/acme/v1alpha3/BUILD.bazel @@ -0,0 +1,41 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "defaults.go", + "doc.go", + "register.go", + "zz_generated.conversion.go", + "zz_generated.defaults.go", + ], + importpath = "github.com/jetstack/cert-manager/pkg/internal/apis/acme/v1alpha3", + visibility = ["//pkg:__subpackages__"], + deps = [ + "//pkg/apis/acme:go_default_library", + "//pkg/apis/acme/v1alpha3:go_default_library", + "//pkg/apis/meta/v1:go_default_library", + "//pkg/internal/apis/acme:go_default_library", + "//pkg/internal/apis/meta:go_default_library", + "@io_k8s_api//core/v1:go_default_library", + "@io_k8s_apiextensions_apiserver//pkg/apis/apiextensions/v1beta1:go_default_library", + "@io_k8s_apimachinery//pkg/apis/meta/v1:go_default_library", + "@io_k8s_apimachinery//pkg/conversion:go_default_library", + "@io_k8s_apimachinery//pkg/runtime:go_default_library", + "@io_k8s_apimachinery//pkg/runtime/schema:go_default_library", + ], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/pkg/internal/apis/acme/v1alpha3/defaults.go b/pkg/internal/apis/acme/v1alpha3/defaults.go new file mode 100644 index 000000000..553de4ab9 --- /dev/null +++ b/pkg/internal/apis/acme/v1alpha3/defaults.go @@ -0,0 +1,25 @@ +/* +Copyright 2019 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha3 + +import ( + "k8s.io/apimachinery/pkg/runtime" +) + +func addDefaultingFuncs(scheme *runtime.Scheme) error { + return RegisterDefaults(scheme) +} diff --git a/pkg/internal/apis/acme/v1alpha3/doc.go b/pkg/internal/apis/acme/v1alpha3/doc.go new file mode 100644 index 000000000..e8077cfcb --- /dev/null +++ b/pkg/internal/apis/acme/v1alpha3/doc.go @@ -0,0 +1,23 @@ +/* +Copyright 2019 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +k8s:conversion-gen=github.com/jetstack/cert-manager/pkg/internal/apis/acme +// +k8s:conversion-gen-external-types=github.com/jetstack/cert-manager/pkg/apis/acme/v1alpha3 +// +k8s:defaulter-gen=TypeMeta +// +k8s:defaulter-gen-input=../../../../apis/acme/v1alpha3 + +// +groupName=acme.cert-manager.io +package v1alpha3 diff --git a/pkg/internal/apis/acme/v1alpha3/register.go b/pkg/internal/apis/acme/v1alpha3/register.go new file mode 100644 index 000000000..50b460fad --- /dev/null +++ b/pkg/internal/apis/acme/v1alpha3/register.go @@ -0,0 +1,44 @@ +/* +Copyright 2019 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha3 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + + "github.com/jetstack/cert-manager/pkg/apis/acme" + cmacme "github.com/jetstack/cert-manager/pkg/apis/acme/v1alpha3" +) + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: acme.GroupName, Version: "v1alpha3"} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + localSchemeBuilder = &cmacme.SchemeBuilder + AddToScheme = localSchemeBuilder.AddToScheme +) + +func init() { + // We only register manually written functions here. The registration of the + // generated functions takes place in the generated files. The separation + // makes the code compile even when the generated files are missing. + localSchemeBuilder.Register(addDefaultingFuncs) +} diff --git a/pkg/internal/apis/acme/v1alpha3/zz_generated.conversion.go b/pkg/internal/apis/acme/v1alpha3/zz_generated.conversion.go new file mode 100644 index 000000000..4b3b20b2f --- /dev/null +++ b/pkg/internal/apis/acme/v1alpha3/zz_generated.conversion.go @@ -0,0 +1,1223 @@ +// +build !ignore_autogenerated + +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by conversion-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + unsafe "unsafe" + + v1alpha3 "github.com/jetstack/cert-manager/pkg/apis/acme/v1alpha3" + metav1 "github.com/jetstack/cert-manager/pkg/apis/meta/v1" + acme "github.com/jetstack/cert-manager/pkg/internal/apis/acme" + meta "github.com/jetstack/cert-manager/pkg/internal/apis/meta" + v1 "k8s.io/api/core/v1" + v1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" + apismetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +func init() { + localSchemeBuilder.Register(RegisterConversions) +} + +// RegisterConversions adds conversion functions to the given scheme. +// Public to allow building arbitrary schemes. +func RegisterConversions(s *runtime.Scheme) error { + if err := s.AddGeneratedConversionFunc((*v1alpha3.ACMEAuthorization)(nil), (*acme.ACMEAuthorization)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ACMEAuthorization_To_acme_ACMEAuthorization(a.(*v1alpha3.ACMEAuthorization), b.(*acme.ACMEAuthorization), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*acme.ACMEAuthorization)(nil), (*v1alpha3.ACMEAuthorization)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_acme_ACMEAuthorization_To_v1alpha3_ACMEAuthorization(a.(*acme.ACMEAuthorization), b.(*v1alpha3.ACMEAuthorization), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.ACMEChallenge)(nil), (*acme.ACMEChallenge)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ACMEChallenge_To_acme_ACMEChallenge(a.(*v1alpha3.ACMEChallenge), b.(*acme.ACMEChallenge), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*acme.ACMEChallenge)(nil), (*v1alpha3.ACMEChallenge)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_acme_ACMEChallenge_To_v1alpha3_ACMEChallenge(a.(*acme.ACMEChallenge), b.(*v1alpha3.ACMEChallenge), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.ACMEChallengeSolver)(nil), (*acme.ACMEChallengeSolver)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ACMEChallengeSolver_To_acme_ACMEChallengeSolver(a.(*v1alpha3.ACMEChallengeSolver), b.(*acme.ACMEChallengeSolver), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*acme.ACMEChallengeSolver)(nil), (*v1alpha3.ACMEChallengeSolver)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_acme_ACMEChallengeSolver_To_v1alpha3_ACMEChallengeSolver(a.(*acme.ACMEChallengeSolver), b.(*v1alpha3.ACMEChallengeSolver), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.ACMEChallengeSolverDNS01)(nil), (*acme.ACMEChallengeSolverDNS01)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ACMEChallengeSolverDNS01_To_acme_ACMEChallengeSolverDNS01(a.(*v1alpha3.ACMEChallengeSolverDNS01), b.(*acme.ACMEChallengeSolverDNS01), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*acme.ACMEChallengeSolverDNS01)(nil), (*v1alpha3.ACMEChallengeSolverDNS01)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_acme_ACMEChallengeSolverDNS01_To_v1alpha3_ACMEChallengeSolverDNS01(a.(*acme.ACMEChallengeSolverDNS01), b.(*v1alpha3.ACMEChallengeSolverDNS01), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.ACMEChallengeSolverHTTP01)(nil), (*acme.ACMEChallengeSolverHTTP01)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ACMEChallengeSolverHTTP01_To_acme_ACMEChallengeSolverHTTP01(a.(*v1alpha3.ACMEChallengeSolverHTTP01), b.(*acme.ACMEChallengeSolverHTTP01), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*acme.ACMEChallengeSolverHTTP01)(nil), (*v1alpha3.ACMEChallengeSolverHTTP01)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_acme_ACMEChallengeSolverHTTP01_To_v1alpha3_ACMEChallengeSolverHTTP01(a.(*acme.ACMEChallengeSolverHTTP01), b.(*v1alpha3.ACMEChallengeSolverHTTP01), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.ACMEChallengeSolverHTTP01Ingress)(nil), (*acme.ACMEChallengeSolverHTTP01Ingress)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ACMEChallengeSolverHTTP01Ingress_To_acme_ACMEChallengeSolverHTTP01Ingress(a.(*v1alpha3.ACMEChallengeSolverHTTP01Ingress), b.(*acme.ACMEChallengeSolverHTTP01Ingress), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*acme.ACMEChallengeSolverHTTP01Ingress)(nil), (*v1alpha3.ACMEChallengeSolverHTTP01Ingress)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_acme_ACMEChallengeSolverHTTP01Ingress_To_v1alpha3_ACMEChallengeSolverHTTP01Ingress(a.(*acme.ACMEChallengeSolverHTTP01Ingress), b.(*v1alpha3.ACMEChallengeSolverHTTP01Ingress), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.ACMEChallengeSolverHTTP01IngressPodObjectMeta)(nil), (*acme.ACMEChallengeSolverHTTP01IngressPodObjectMeta)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ACMEChallengeSolverHTTP01IngressPodObjectMeta_To_acme_ACMEChallengeSolverHTTP01IngressPodObjectMeta(a.(*v1alpha3.ACMEChallengeSolverHTTP01IngressPodObjectMeta), b.(*acme.ACMEChallengeSolverHTTP01IngressPodObjectMeta), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*acme.ACMEChallengeSolverHTTP01IngressPodObjectMeta)(nil), (*v1alpha3.ACMEChallengeSolverHTTP01IngressPodObjectMeta)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_acme_ACMEChallengeSolverHTTP01IngressPodObjectMeta_To_v1alpha3_ACMEChallengeSolverHTTP01IngressPodObjectMeta(a.(*acme.ACMEChallengeSolverHTTP01IngressPodObjectMeta), b.(*v1alpha3.ACMEChallengeSolverHTTP01IngressPodObjectMeta), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.ACMEChallengeSolverHTTP01IngressPodSpec)(nil), (*acme.ACMEChallengeSolverHTTP01IngressPodSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ACMEChallengeSolverHTTP01IngressPodSpec_To_acme_ACMEChallengeSolverHTTP01IngressPodSpec(a.(*v1alpha3.ACMEChallengeSolverHTTP01IngressPodSpec), b.(*acme.ACMEChallengeSolverHTTP01IngressPodSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*acme.ACMEChallengeSolverHTTP01IngressPodSpec)(nil), (*v1alpha3.ACMEChallengeSolverHTTP01IngressPodSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_acme_ACMEChallengeSolverHTTP01IngressPodSpec_To_v1alpha3_ACMEChallengeSolverHTTP01IngressPodSpec(a.(*acme.ACMEChallengeSolverHTTP01IngressPodSpec), b.(*v1alpha3.ACMEChallengeSolverHTTP01IngressPodSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.ACMEChallengeSolverHTTP01IngressPodTemplate)(nil), (*acme.ACMEChallengeSolverHTTP01IngressPodTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ACMEChallengeSolverHTTP01IngressPodTemplate_To_acme_ACMEChallengeSolverHTTP01IngressPodTemplate(a.(*v1alpha3.ACMEChallengeSolverHTTP01IngressPodTemplate), b.(*acme.ACMEChallengeSolverHTTP01IngressPodTemplate), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*acme.ACMEChallengeSolverHTTP01IngressPodTemplate)(nil), (*v1alpha3.ACMEChallengeSolverHTTP01IngressPodTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_acme_ACMEChallengeSolverHTTP01IngressPodTemplate_To_v1alpha3_ACMEChallengeSolverHTTP01IngressPodTemplate(a.(*acme.ACMEChallengeSolverHTTP01IngressPodTemplate), b.(*v1alpha3.ACMEChallengeSolverHTTP01IngressPodTemplate), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.ACMEExternalAccountBinding)(nil), (*acme.ACMEExternalAccountBinding)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ACMEExternalAccountBinding_To_acme_ACMEExternalAccountBinding(a.(*v1alpha3.ACMEExternalAccountBinding), b.(*acme.ACMEExternalAccountBinding), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*acme.ACMEExternalAccountBinding)(nil), (*v1alpha3.ACMEExternalAccountBinding)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_acme_ACMEExternalAccountBinding_To_v1alpha3_ACMEExternalAccountBinding(a.(*acme.ACMEExternalAccountBinding), b.(*v1alpha3.ACMEExternalAccountBinding), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.ACMEIssuer)(nil), (*acme.ACMEIssuer)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ACMEIssuer_To_acme_ACMEIssuer(a.(*v1alpha3.ACMEIssuer), b.(*acme.ACMEIssuer), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*acme.ACMEIssuer)(nil), (*v1alpha3.ACMEIssuer)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_acme_ACMEIssuer_To_v1alpha3_ACMEIssuer(a.(*acme.ACMEIssuer), b.(*v1alpha3.ACMEIssuer), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.ACMEIssuerDNS01ProviderAcmeDNS)(nil), (*acme.ACMEIssuerDNS01ProviderAcmeDNS)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ACMEIssuerDNS01ProviderAcmeDNS_To_acme_ACMEIssuerDNS01ProviderAcmeDNS(a.(*v1alpha3.ACMEIssuerDNS01ProviderAcmeDNS), b.(*acme.ACMEIssuerDNS01ProviderAcmeDNS), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*acme.ACMEIssuerDNS01ProviderAcmeDNS)(nil), (*v1alpha3.ACMEIssuerDNS01ProviderAcmeDNS)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_acme_ACMEIssuerDNS01ProviderAcmeDNS_To_v1alpha3_ACMEIssuerDNS01ProviderAcmeDNS(a.(*acme.ACMEIssuerDNS01ProviderAcmeDNS), b.(*v1alpha3.ACMEIssuerDNS01ProviderAcmeDNS), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.ACMEIssuerDNS01ProviderAkamai)(nil), (*acme.ACMEIssuerDNS01ProviderAkamai)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ACMEIssuerDNS01ProviderAkamai_To_acme_ACMEIssuerDNS01ProviderAkamai(a.(*v1alpha3.ACMEIssuerDNS01ProviderAkamai), b.(*acme.ACMEIssuerDNS01ProviderAkamai), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*acme.ACMEIssuerDNS01ProviderAkamai)(nil), (*v1alpha3.ACMEIssuerDNS01ProviderAkamai)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_acme_ACMEIssuerDNS01ProviderAkamai_To_v1alpha3_ACMEIssuerDNS01ProviderAkamai(a.(*acme.ACMEIssuerDNS01ProviderAkamai), b.(*v1alpha3.ACMEIssuerDNS01ProviderAkamai), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.ACMEIssuerDNS01ProviderAzureDNS)(nil), (*acme.ACMEIssuerDNS01ProviderAzureDNS)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ACMEIssuerDNS01ProviderAzureDNS_To_acme_ACMEIssuerDNS01ProviderAzureDNS(a.(*v1alpha3.ACMEIssuerDNS01ProviderAzureDNS), b.(*acme.ACMEIssuerDNS01ProviderAzureDNS), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*acme.ACMEIssuerDNS01ProviderAzureDNS)(nil), (*v1alpha3.ACMEIssuerDNS01ProviderAzureDNS)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_acme_ACMEIssuerDNS01ProviderAzureDNS_To_v1alpha3_ACMEIssuerDNS01ProviderAzureDNS(a.(*acme.ACMEIssuerDNS01ProviderAzureDNS), b.(*v1alpha3.ACMEIssuerDNS01ProviderAzureDNS), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.ACMEIssuerDNS01ProviderCloudDNS)(nil), (*acme.ACMEIssuerDNS01ProviderCloudDNS)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ACMEIssuerDNS01ProviderCloudDNS_To_acme_ACMEIssuerDNS01ProviderCloudDNS(a.(*v1alpha3.ACMEIssuerDNS01ProviderCloudDNS), b.(*acme.ACMEIssuerDNS01ProviderCloudDNS), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*acme.ACMEIssuerDNS01ProviderCloudDNS)(nil), (*v1alpha3.ACMEIssuerDNS01ProviderCloudDNS)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_acme_ACMEIssuerDNS01ProviderCloudDNS_To_v1alpha3_ACMEIssuerDNS01ProviderCloudDNS(a.(*acme.ACMEIssuerDNS01ProviderCloudDNS), b.(*v1alpha3.ACMEIssuerDNS01ProviderCloudDNS), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.ACMEIssuerDNS01ProviderCloudflare)(nil), (*acme.ACMEIssuerDNS01ProviderCloudflare)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ACMEIssuerDNS01ProviderCloudflare_To_acme_ACMEIssuerDNS01ProviderCloudflare(a.(*v1alpha3.ACMEIssuerDNS01ProviderCloudflare), b.(*acme.ACMEIssuerDNS01ProviderCloudflare), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*acme.ACMEIssuerDNS01ProviderCloudflare)(nil), (*v1alpha3.ACMEIssuerDNS01ProviderCloudflare)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_acme_ACMEIssuerDNS01ProviderCloudflare_To_v1alpha3_ACMEIssuerDNS01ProviderCloudflare(a.(*acme.ACMEIssuerDNS01ProviderCloudflare), b.(*v1alpha3.ACMEIssuerDNS01ProviderCloudflare), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.ACMEIssuerDNS01ProviderDigitalOcean)(nil), (*acme.ACMEIssuerDNS01ProviderDigitalOcean)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ACMEIssuerDNS01ProviderDigitalOcean_To_acme_ACMEIssuerDNS01ProviderDigitalOcean(a.(*v1alpha3.ACMEIssuerDNS01ProviderDigitalOcean), b.(*acme.ACMEIssuerDNS01ProviderDigitalOcean), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*acme.ACMEIssuerDNS01ProviderDigitalOcean)(nil), (*v1alpha3.ACMEIssuerDNS01ProviderDigitalOcean)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_acme_ACMEIssuerDNS01ProviderDigitalOcean_To_v1alpha3_ACMEIssuerDNS01ProviderDigitalOcean(a.(*acme.ACMEIssuerDNS01ProviderDigitalOcean), b.(*v1alpha3.ACMEIssuerDNS01ProviderDigitalOcean), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.ACMEIssuerDNS01ProviderRFC2136)(nil), (*acme.ACMEIssuerDNS01ProviderRFC2136)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ACMEIssuerDNS01ProviderRFC2136_To_acme_ACMEIssuerDNS01ProviderRFC2136(a.(*v1alpha3.ACMEIssuerDNS01ProviderRFC2136), b.(*acme.ACMEIssuerDNS01ProviderRFC2136), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*acme.ACMEIssuerDNS01ProviderRFC2136)(nil), (*v1alpha3.ACMEIssuerDNS01ProviderRFC2136)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_acme_ACMEIssuerDNS01ProviderRFC2136_To_v1alpha3_ACMEIssuerDNS01ProviderRFC2136(a.(*acme.ACMEIssuerDNS01ProviderRFC2136), b.(*v1alpha3.ACMEIssuerDNS01ProviderRFC2136), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.ACMEIssuerDNS01ProviderRoute53)(nil), (*acme.ACMEIssuerDNS01ProviderRoute53)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ACMEIssuerDNS01ProviderRoute53_To_acme_ACMEIssuerDNS01ProviderRoute53(a.(*v1alpha3.ACMEIssuerDNS01ProviderRoute53), b.(*acme.ACMEIssuerDNS01ProviderRoute53), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*acme.ACMEIssuerDNS01ProviderRoute53)(nil), (*v1alpha3.ACMEIssuerDNS01ProviderRoute53)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_acme_ACMEIssuerDNS01ProviderRoute53_To_v1alpha3_ACMEIssuerDNS01ProviderRoute53(a.(*acme.ACMEIssuerDNS01ProviderRoute53), b.(*v1alpha3.ACMEIssuerDNS01ProviderRoute53), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.ACMEIssuerDNS01ProviderWebhook)(nil), (*acme.ACMEIssuerDNS01ProviderWebhook)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ACMEIssuerDNS01ProviderWebhook_To_acme_ACMEIssuerDNS01ProviderWebhook(a.(*v1alpha3.ACMEIssuerDNS01ProviderWebhook), b.(*acme.ACMEIssuerDNS01ProviderWebhook), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*acme.ACMEIssuerDNS01ProviderWebhook)(nil), (*v1alpha3.ACMEIssuerDNS01ProviderWebhook)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_acme_ACMEIssuerDNS01ProviderWebhook_To_v1alpha3_ACMEIssuerDNS01ProviderWebhook(a.(*acme.ACMEIssuerDNS01ProviderWebhook), b.(*v1alpha3.ACMEIssuerDNS01ProviderWebhook), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.ACMEIssuerStatus)(nil), (*acme.ACMEIssuerStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ACMEIssuerStatus_To_acme_ACMEIssuerStatus(a.(*v1alpha3.ACMEIssuerStatus), b.(*acme.ACMEIssuerStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*acme.ACMEIssuerStatus)(nil), (*v1alpha3.ACMEIssuerStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_acme_ACMEIssuerStatus_To_v1alpha3_ACMEIssuerStatus(a.(*acme.ACMEIssuerStatus), b.(*v1alpha3.ACMEIssuerStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.CertificateDNSNameSelector)(nil), (*acme.CertificateDNSNameSelector)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_CertificateDNSNameSelector_To_acme_CertificateDNSNameSelector(a.(*v1alpha3.CertificateDNSNameSelector), b.(*acme.CertificateDNSNameSelector), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*acme.CertificateDNSNameSelector)(nil), (*v1alpha3.CertificateDNSNameSelector)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_acme_CertificateDNSNameSelector_To_v1alpha3_CertificateDNSNameSelector(a.(*acme.CertificateDNSNameSelector), b.(*v1alpha3.CertificateDNSNameSelector), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.Challenge)(nil), (*acme.Challenge)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_Challenge_To_acme_Challenge(a.(*v1alpha3.Challenge), b.(*acme.Challenge), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*acme.Challenge)(nil), (*v1alpha3.Challenge)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_acme_Challenge_To_v1alpha3_Challenge(a.(*acme.Challenge), b.(*v1alpha3.Challenge), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.ChallengeList)(nil), (*acme.ChallengeList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ChallengeList_To_acme_ChallengeList(a.(*v1alpha3.ChallengeList), b.(*acme.ChallengeList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*acme.ChallengeList)(nil), (*v1alpha3.ChallengeList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_acme_ChallengeList_To_v1alpha3_ChallengeList(a.(*acme.ChallengeList), b.(*v1alpha3.ChallengeList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.ChallengeSpec)(nil), (*acme.ChallengeSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ChallengeSpec_To_acme_ChallengeSpec(a.(*v1alpha3.ChallengeSpec), b.(*acme.ChallengeSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*acme.ChallengeSpec)(nil), (*v1alpha3.ChallengeSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_acme_ChallengeSpec_To_v1alpha3_ChallengeSpec(a.(*acme.ChallengeSpec), b.(*v1alpha3.ChallengeSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.ChallengeStatus)(nil), (*acme.ChallengeStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ChallengeStatus_To_acme_ChallengeStatus(a.(*v1alpha3.ChallengeStatus), b.(*acme.ChallengeStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*acme.ChallengeStatus)(nil), (*v1alpha3.ChallengeStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_acme_ChallengeStatus_To_v1alpha3_ChallengeStatus(a.(*acme.ChallengeStatus), b.(*v1alpha3.ChallengeStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.Order)(nil), (*acme.Order)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_Order_To_acme_Order(a.(*v1alpha3.Order), b.(*acme.Order), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*acme.Order)(nil), (*v1alpha3.Order)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_acme_Order_To_v1alpha3_Order(a.(*acme.Order), b.(*v1alpha3.Order), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.OrderList)(nil), (*acme.OrderList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_OrderList_To_acme_OrderList(a.(*v1alpha3.OrderList), b.(*acme.OrderList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*acme.OrderList)(nil), (*v1alpha3.OrderList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_acme_OrderList_To_v1alpha3_OrderList(a.(*acme.OrderList), b.(*v1alpha3.OrderList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.OrderSpec)(nil), (*acme.OrderSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_OrderSpec_To_acme_OrderSpec(a.(*v1alpha3.OrderSpec), b.(*acme.OrderSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*acme.OrderSpec)(nil), (*v1alpha3.OrderSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_acme_OrderSpec_To_v1alpha3_OrderSpec(a.(*acme.OrderSpec), b.(*v1alpha3.OrderSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.OrderStatus)(nil), (*acme.OrderStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_OrderStatus_To_acme_OrderStatus(a.(*v1alpha3.OrderStatus), b.(*acme.OrderStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*acme.OrderStatus)(nil), (*v1alpha3.OrderStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_acme_OrderStatus_To_v1alpha3_OrderStatus(a.(*acme.OrderStatus), b.(*v1alpha3.OrderStatus), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1alpha3_ACMEAuthorization_To_acme_ACMEAuthorization(in *v1alpha3.ACMEAuthorization, out *acme.ACMEAuthorization, s conversion.Scope) error { + out.URL = in.URL + out.Identifier = in.Identifier + out.Wildcard = (*bool)(unsafe.Pointer(in.Wildcard)) + out.Challenges = *(*[]acme.ACMEChallenge)(unsafe.Pointer(&in.Challenges)) + return nil +} + +// Convert_v1alpha3_ACMEAuthorization_To_acme_ACMEAuthorization is an autogenerated conversion function. +func Convert_v1alpha3_ACMEAuthorization_To_acme_ACMEAuthorization(in *v1alpha3.ACMEAuthorization, out *acme.ACMEAuthorization, s conversion.Scope) error { + return autoConvert_v1alpha3_ACMEAuthorization_To_acme_ACMEAuthorization(in, out, s) +} + +func autoConvert_acme_ACMEAuthorization_To_v1alpha3_ACMEAuthorization(in *acme.ACMEAuthorization, out *v1alpha3.ACMEAuthorization, s conversion.Scope) error { + out.URL = in.URL + out.Identifier = in.Identifier + out.Wildcard = (*bool)(unsafe.Pointer(in.Wildcard)) + out.Challenges = *(*[]v1alpha3.ACMEChallenge)(unsafe.Pointer(&in.Challenges)) + return nil +} + +// Convert_acme_ACMEAuthorization_To_v1alpha3_ACMEAuthorization is an autogenerated conversion function. +func Convert_acme_ACMEAuthorization_To_v1alpha3_ACMEAuthorization(in *acme.ACMEAuthorization, out *v1alpha3.ACMEAuthorization, s conversion.Scope) error { + return autoConvert_acme_ACMEAuthorization_To_v1alpha3_ACMEAuthorization(in, out, s) +} + +func autoConvert_v1alpha3_ACMEChallenge_To_acme_ACMEChallenge(in *v1alpha3.ACMEChallenge, out *acme.ACMEChallenge, s conversion.Scope) error { + out.URL = in.URL + out.Token = in.Token + out.Type = acme.ACMEChallengeType(in.Type) + return nil +} + +// Convert_v1alpha3_ACMEChallenge_To_acme_ACMEChallenge is an autogenerated conversion function. +func Convert_v1alpha3_ACMEChallenge_To_acme_ACMEChallenge(in *v1alpha3.ACMEChallenge, out *acme.ACMEChallenge, s conversion.Scope) error { + return autoConvert_v1alpha3_ACMEChallenge_To_acme_ACMEChallenge(in, out, s) +} + +func autoConvert_acme_ACMEChallenge_To_v1alpha3_ACMEChallenge(in *acme.ACMEChallenge, out *v1alpha3.ACMEChallenge, s conversion.Scope) error { + out.URL = in.URL + out.Token = in.Token + out.Type = v1alpha3.ACMEChallengeType(in.Type) + return nil +} + +// Convert_acme_ACMEChallenge_To_v1alpha3_ACMEChallenge is an autogenerated conversion function. +func Convert_acme_ACMEChallenge_To_v1alpha3_ACMEChallenge(in *acme.ACMEChallenge, out *v1alpha3.ACMEChallenge, s conversion.Scope) error { + return autoConvert_acme_ACMEChallenge_To_v1alpha3_ACMEChallenge(in, out, s) +} + +func autoConvert_v1alpha3_ACMEChallengeSolver_To_acme_ACMEChallengeSolver(in *v1alpha3.ACMEChallengeSolver, out *acme.ACMEChallengeSolver, s conversion.Scope) error { + out.Selector = (*acme.CertificateDNSNameSelector)(unsafe.Pointer(in.Selector)) + out.HTTP01 = (*acme.ACMEChallengeSolverHTTP01)(unsafe.Pointer(in.HTTP01)) + out.DNS01 = (*acme.ACMEChallengeSolverDNS01)(unsafe.Pointer(in.DNS01)) + return nil +} + +// Convert_v1alpha3_ACMEChallengeSolver_To_acme_ACMEChallengeSolver is an autogenerated conversion function. +func Convert_v1alpha3_ACMEChallengeSolver_To_acme_ACMEChallengeSolver(in *v1alpha3.ACMEChallengeSolver, out *acme.ACMEChallengeSolver, s conversion.Scope) error { + return autoConvert_v1alpha3_ACMEChallengeSolver_To_acme_ACMEChallengeSolver(in, out, s) +} + +func autoConvert_acme_ACMEChallengeSolver_To_v1alpha3_ACMEChallengeSolver(in *acme.ACMEChallengeSolver, out *v1alpha3.ACMEChallengeSolver, s conversion.Scope) error { + out.Selector = (*v1alpha3.CertificateDNSNameSelector)(unsafe.Pointer(in.Selector)) + out.HTTP01 = (*v1alpha3.ACMEChallengeSolverHTTP01)(unsafe.Pointer(in.HTTP01)) + out.DNS01 = (*v1alpha3.ACMEChallengeSolverDNS01)(unsafe.Pointer(in.DNS01)) + return nil +} + +// Convert_acme_ACMEChallengeSolver_To_v1alpha3_ACMEChallengeSolver is an autogenerated conversion function. +func Convert_acme_ACMEChallengeSolver_To_v1alpha3_ACMEChallengeSolver(in *acme.ACMEChallengeSolver, out *v1alpha3.ACMEChallengeSolver, s conversion.Scope) error { + return autoConvert_acme_ACMEChallengeSolver_To_v1alpha3_ACMEChallengeSolver(in, out, s) +} + +func autoConvert_v1alpha3_ACMEChallengeSolverDNS01_To_acme_ACMEChallengeSolverDNS01(in *v1alpha3.ACMEChallengeSolverDNS01, out *acme.ACMEChallengeSolverDNS01, s conversion.Scope) error { + out.CNAMEStrategy = acme.CNAMEStrategy(in.CNAMEStrategy) + out.Akamai = (*acme.ACMEIssuerDNS01ProviderAkamai)(unsafe.Pointer(in.Akamai)) + out.CloudDNS = (*acme.ACMEIssuerDNS01ProviderCloudDNS)(unsafe.Pointer(in.CloudDNS)) + out.Cloudflare = (*acme.ACMEIssuerDNS01ProviderCloudflare)(unsafe.Pointer(in.Cloudflare)) + out.Route53 = (*acme.ACMEIssuerDNS01ProviderRoute53)(unsafe.Pointer(in.Route53)) + out.AzureDNS = (*acme.ACMEIssuerDNS01ProviderAzureDNS)(unsafe.Pointer(in.AzureDNS)) + out.DigitalOcean = (*acme.ACMEIssuerDNS01ProviderDigitalOcean)(unsafe.Pointer(in.DigitalOcean)) + out.AcmeDNS = (*acme.ACMEIssuerDNS01ProviderAcmeDNS)(unsafe.Pointer(in.AcmeDNS)) + out.RFC2136 = (*acme.ACMEIssuerDNS01ProviderRFC2136)(unsafe.Pointer(in.RFC2136)) + out.Webhook = (*acme.ACMEIssuerDNS01ProviderWebhook)(unsafe.Pointer(in.Webhook)) + return nil +} + +// Convert_v1alpha3_ACMEChallengeSolverDNS01_To_acme_ACMEChallengeSolverDNS01 is an autogenerated conversion function. +func Convert_v1alpha3_ACMEChallengeSolverDNS01_To_acme_ACMEChallengeSolverDNS01(in *v1alpha3.ACMEChallengeSolverDNS01, out *acme.ACMEChallengeSolverDNS01, s conversion.Scope) error { + return autoConvert_v1alpha3_ACMEChallengeSolverDNS01_To_acme_ACMEChallengeSolverDNS01(in, out, s) +} + +func autoConvert_acme_ACMEChallengeSolverDNS01_To_v1alpha3_ACMEChallengeSolverDNS01(in *acme.ACMEChallengeSolverDNS01, out *v1alpha3.ACMEChallengeSolverDNS01, s conversion.Scope) error { + out.CNAMEStrategy = v1alpha3.CNAMEStrategy(in.CNAMEStrategy) + out.Akamai = (*v1alpha3.ACMEIssuerDNS01ProviderAkamai)(unsafe.Pointer(in.Akamai)) + out.CloudDNS = (*v1alpha3.ACMEIssuerDNS01ProviderCloudDNS)(unsafe.Pointer(in.CloudDNS)) + out.Cloudflare = (*v1alpha3.ACMEIssuerDNS01ProviderCloudflare)(unsafe.Pointer(in.Cloudflare)) + out.Route53 = (*v1alpha3.ACMEIssuerDNS01ProviderRoute53)(unsafe.Pointer(in.Route53)) + out.AzureDNS = (*v1alpha3.ACMEIssuerDNS01ProviderAzureDNS)(unsafe.Pointer(in.AzureDNS)) + out.DigitalOcean = (*v1alpha3.ACMEIssuerDNS01ProviderDigitalOcean)(unsafe.Pointer(in.DigitalOcean)) + out.AcmeDNS = (*v1alpha3.ACMEIssuerDNS01ProviderAcmeDNS)(unsafe.Pointer(in.AcmeDNS)) + out.RFC2136 = (*v1alpha3.ACMEIssuerDNS01ProviderRFC2136)(unsafe.Pointer(in.RFC2136)) + out.Webhook = (*v1alpha3.ACMEIssuerDNS01ProviderWebhook)(unsafe.Pointer(in.Webhook)) + return nil +} + +// Convert_acme_ACMEChallengeSolverDNS01_To_v1alpha3_ACMEChallengeSolverDNS01 is an autogenerated conversion function. +func Convert_acme_ACMEChallengeSolverDNS01_To_v1alpha3_ACMEChallengeSolverDNS01(in *acme.ACMEChallengeSolverDNS01, out *v1alpha3.ACMEChallengeSolverDNS01, s conversion.Scope) error { + return autoConvert_acme_ACMEChallengeSolverDNS01_To_v1alpha3_ACMEChallengeSolverDNS01(in, out, s) +} + +func autoConvert_v1alpha3_ACMEChallengeSolverHTTP01_To_acme_ACMEChallengeSolverHTTP01(in *v1alpha3.ACMEChallengeSolverHTTP01, out *acme.ACMEChallengeSolverHTTP01, s conversion.Scope) error { + out.Ingress = (*acme.ACMEChallengeSolverHTTP01Ingress)(unsafe.Pointer(in.Ingress)) + return nil +} + +// Convert_v1alpha3_ACMEChallengeSolverHTTP01_To_acme_ACMEChallengeSolverHTTP01 is an autogenerated conversion function. +func Convert_v1alpha3_ACMEChallengeSolverHTTP01_To_acme_ACMEChallengeSolverHTTP01(in *v1alpha3.ACMEChallengeSolverHTTP01, out *acme.ACMEChallengeSolverHTTP01, s conversion.Scope) error { + return autoConvert_v1alpha3_ACMEChallengeSolverHTTP01_To_acme_ACMEChallengeSolverHTTP01(in, out, s) +} + +func autoConvert_acme_ACMEChallengeSolverHTTP01_To_v1alpha3_ACMEChallengeSolverHTTP01(in *acme.ACMEChallengeSolverHTTP01, out *v1alpha3.ACMEChallengeSolverHTTP01, s conversion.Scope) error { + out.Ingress = (*v1alpha3.ACMEChallengeSolverHTTP01Ingress)(unsafe.Pointer(in.Ingress)) + return nil +} + +// Convert_acme_ACMEChallengeSolverHTTP01_To_v1alpha3_ACMEChallengeSolverHTTP01 is an autogenerated conversion function. +func Convert_acme_ACMEChallengeSolverHTTP01_To_v1alpha3_ACMEChallengeSolverHTTP01(in *acme.ACMEChallengeSolverHTTP01, out *v1alpha3.ACMEChallengeSolverHTTP01, s conversion.Scope) error { + return autoConvert_acme_ACMEChallengeSolverHTTP01_To_v1alpha3_ACMEChallengeSolverHTTP01(in, out, s) +} + +func autoConvert_v1alpha3_ACMEChallengeSolverHTTP01Ingress_To_acme_ACMEChallengeSolverHTTP01Ingress(in *v1alpha3.ACMEChallengeSolverHTTP01Ingress, out *acme.ACMEChallengeSolverHTTP01Ingress, s conversion.Scope) error { + out.ServiceType = v1.ServiceType(in.ServiceType) + out.Class = (*string)(unsafe.Pointer(in.Class)) + out.Name = in.Name + out.PodTemplate = (*acme.ACMEChallengeSolverHTTP01IngressPodTemplate)(unsafe.Pointer(in.PodTemplate)) + return nil +} + +// Convert_v1alpha3_ACMEChallengeSolverHTTP01Ingress_To_acme_ACMEChallengeSolverHTTP01Ingress is an autogenerated conversion function. +func Convert_v1alpha3_ACMEChallengeSolverHTTP01Ingress_To_acme_ACMEChallengeSolverHTTP01Ingress(in *v1alpha3.ACMEChallengeSolverHTTP01Ingress, out *acme.ACMEChallengeSolverHTTP01Ingress, s conversion.Scope) error { + return autoConvert_v1alpha3_ACMEChallengeSolverHTTP01Ingress_To_acme_ACMEChallengeSolverHTTP01Ingress(in, out, s) +} + +func autoConvert_acme_ACMEChallengeSolverHTTP01Ingress_To_v1alpha3_ACMEChallengeSolverHTTP01Ingress(in *acme.ACMEChallengeSolverHTTP01Ingress, out *v1alpha3.ACMEChallengeSolverHTTP01Ingress, s conversion.Scope) error { + out.ServiceType = v1.ServiceType(in.ServiceType) + out.Class = (*string)(unsafe.Pointer(in.Class)) + out.Name = in.Name + out.PodTemplate = (*v1alpha3.ACMEChallengeSolverHTTP01IngressPodTemplate)(unsafe.Pointer(in.PodTemplate)) + return nil +} + +// Convert_acme_ACMEChallengeSolverHTTP01Ingress_To_v1alpha3_ACMEChallengeSolverHTTP01Ingress is an autogenerated conversion function. +func Convert_acme_ACMEChallengeSolverHTTP01Ingress_To_v1alpha3_ACMEChallengeSolverHTTP01Ingress(in *acme.ACMEChallengeSolverHTTP01Ingress, out *v1alpha3.ACMEChallengeSolverHTTP01Ingress, s conversion.Scope) error { + return autoConvert_acme_ACMEChallengeSolverHTTP01Ingress_To_v1alpha3_ACMEChallengeSolverHTTP01Ingress(in, out, s) +} + +func autoConvert_v1alpha3_ACMEChallengeSolverHTTP01IngressPodObjectMeta_To_acme_ACMEChallengeSolverHTTP01IngressPodObjectMeta(in *v1alpha3.ACMEChallengeSolverHTTP01IngressPodObjectMeta, out *acme.ACMEChallengeSolverHTTP01IngressPodObjectMeta, s conversion.Scope) error { + out.Annotations = *(*map[string]string)(unsafe.Pointer(&in.Annotations)) + out.Labels = *(*map[string]string)(unsafe.Pointer(&in.Labels)) + return nil +} + +// Convert_v1alpha3_ACMEChallengeSolverHTTP01IngressPodObjectMeta_To_acme_ACMEChallengeSolverHTTP01IngressPodObjectMeta is an autogenerated conversion function. +func Convert_v1alpha3_ACMEChallengeSolverHTTP01IngressPodObjectMeta_To_acme_ACMEChallengeSolverHTTP01IngressPodObjectMeta(in *v1alpha3.ACMEChallengeSolverHTTP01IngressPodObjectMeta, out *acme.ACMEChallengeSolverHTTP01IngressPodObjectMeta, s conversion.Scope) error { + return autoConvert_v1alpha3_ACMEChallengeSolverHTTP01IngressPodObjectMeta_To_acme_ACMEChallengeSolverHTTP01IngressPodObjectMeta(in, out, s) +} + +func autoConvert_acme_ACMEChallengeSolverHTTP01IngressPodObjectMeta_To_v1alpha3_ACMEChallengeSolverHTTP01IngressPodObjectMeta(in *acme.ACMEChallengeSolverHTTP01IngressPodObjectMeta, out *v1alpha3.ACMEChallengeSolverHTTP01IngressPodObjectMeta, s conversion.Scope) error { + out.Annotations = *(*map[string]string)(unsafe.Pointer(&in.Annotations)) + out.Labels = *(*map[string]string)(unsafe.Pointer(&in.Labels)) + return nil +} + +// Convert_acme_ACMEChallengeSolverHTTP01IngressPodObjectMeta_To_v1alpha3_ACMEChallengeSolverHTTP01IngressPodObjectMeta is an autogenerated conversion function. +func Convert_acme_ACMEChallengeSolverHTTP01IngressPodObjectMeta_To_v1alpha3_ACMEChallengeSolverHTTP01IngressPodObjectMeta(in *acme.ACMEChallengeSolverHTTP01IngressPodObjectMeta, out *v1alpha3.ACMEChallengeSolverHTTP01IngressPodObjectMeta, s conversion.Scope) error { + return autoConvert_acme_ACMEChallengeSolverHTTP01IngressPodObjectMeta_To_v1alpha3_ACMEChallengeSolverHTTP01IngressPodObjectMeta(in, out, s) +} + +func autoConvert_v1alpha3_ACMEChallengeSolverHTTP01IngressPodSpec_To_acme_ACMEChallengeSolverHTTP01IngressPodSpec(in *v1alpha3.ACMEChallengeSolverHTTP01IngressPodSpec, out *acme.ACMEChallengeSolverHTTP01IngressPodSpec, s conversion.Scope) error { + out.NodeSelector = *(*map[string]string)(unsafe.Pointer(&in.NodeSelector)) + out.Affinity = (*v1.Affinity)(unsafe.Pointer(in.Affinity)) + out.Tolerations = *(*[]v1.Toleration)(unsafe.Pointer(&in.Tolerations)) + return nil +} + +// Convert_v1alpha3_ACMEChallengeSolverHTTP01IngressPodSpec_To_acme_ACMEChallengeSolverHTTP01IngressPodSpec is an autogenerated conversion function. +func Convert_v1alpha3_ACMEChallengeSolverHTTP01IngressPodSpec_To_acme_ACMEChallengeSolverHTTP01IngressPodSpec(in *v1alpha3.ACMEChallengeSolverHTTP01IngressPodSpec, out *acme.ACMEChallengeSolverHTTP01IngressPodSpec, s conversion.Scope) error { + return autoConvert_v1alpha3_ACMEChallengeSolverHTTP01IngressPodSpec_To_acme_ACMEChallengeSolverHTTP01IngressPodSpec(in, out, s) +} + +func autoConvert_acme_ACMEChallengeSolverHTTP01IngressPodSpec_To_v1alpha3_ACMEChallengeSolverHTTP01IngressPodSpec(in *acme.ACMEChallengeSolverHTTP01IngressPodSpec, out *v1alpha3.ACMEChallengeSolverHTTP01IngressPodSpec, s conversion.Scope) error { + out.NodeSelector = *(*map[string]string)(unsafe.Pointer(&in.NodeSelector)) + out.Affinity = (*v1.Affinity)(unsafe.Pointer(in.Affinity)) + out.Tolerations = *(*[]v1.Toleration)(unsafe.Pointer(&in.Tolerations)) + return nil +} + +// Convert_acme_ACMEChallengeSolverHTTP01IngressPodSpec_To_v1alpha3_ACMEChallengeSolverHTTP01IngressPodSpec is an autogenerated conversion function. +func Convert_acme_ACMEChallengeSolverHTTP01IngressPodSpec_To_v1alpha3_ACMEChallengeSolverHTTP01IngressPodSpec(in *acme.ACMEChallengeSolverHTTP01IngressPodSpec, out *v1alpha3.ACMEChallengeSolverHTTP01IngressPodSpec, s conversion.Scope) error { + return autoConvert_acme_ACMEChallengeSolverHTTP01IngressPodSpec_To_v1alpha3_ACMEChallengeSolverHTTP01IngressPodSpec(in, out, s) +} + +func autoConvert_v1alpha3_ACMEChallengeSolverHTTP01IngressPodTemplate_To_acme_ACMEChallengeSolverHTTP01IngressPodTemplate(in *v1alpha3.ACMEChallengeSolverHTTP01IngressPodTemplate, out *acme.ACMEChallengeSolverHTTP01IngressPodTemplate, s conversion.Scope) error { + if err := Convert_v1alpha3_ACMEChallengeSolverHTTP01IngressPodObjectMeta_To_acme_ACMEChallengeSolverHTTP01IngressPodObjectMeta(&in.ACMEChallengeSolverHTTP01IngressPodObjectMeta, &out.ACMEChallengeSolverHTTP01IngressPodObjectMeta, s); err != nil { + return err + } + if err := Convert_v1alpha3_ACMEChallengeSolverHTTP01IngressPodSpec_To_acme_ACMEChallengeSolverHTTP01IngressPodSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_ACMEChallengeSolverHTTP01IngressPodTemplate_To_acme_ACMEChallengeSolverHTTP01IngressPodTemplate is an autogenerated conversion function. +func Convert_v1alpha3_ACMEChallengeSolverHTTP01IngressPodTemplate_To_acme_ACMEChallengeSolverHTTP01IngressPodTemplate(in *v1alpha3.ACMEChallengeSolverHTTP01IngressPodTemplate, out *acme.ACMEChallengeSolverHTTP01IngressPodTemplate, s conversion.Scope) error { + return autoConvert_v1alpha3_ACMEChallengeSolverHTTP01IngressPodTemplate_To_acme_ACMEChallengeSolverHTTP01IngressPodTemplate(in, out, s) +} + +func autoConvert_acme_ACMEChallengeSolverHTTP01IngressPodTemplate_To_v1alpha3_ACMEChallengeSolverHTTP01IngressPodTemplate(in *acme.ACMEChallengeSolverHTTP01IngressPodTemplate, out *v1alpha3.ACMEChallengeSolverHTTP01IngressPodTemplate, s conversion.Scope) error { + if err := Convert_acme_ACMEChallengeSolverHTTP01IngressPodObjectMeta_To_v1alpha3_ACMEChallengeSolverHTTP01IngressPodObjectMeta(&in.ACMEChallengeSolverHTTP01IngressPodObjectMeta, &out.ACMEChallengeSolverHTTP01IngressPodObjectMeta, s); err != nil { + return err + } + if err := Convert_acme_ACMEChallengeSolverHTTP01IngressPodSpec_To_v1alpha3_ACMEChallengeSolverHTTP01IngressPodSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_acme_ACMEChallengeSolverHTTP01IngressPodTemplate_To_v1alpha3_ACMEChallengeSolverHTTP01IngressPodTemplate is an autogenerated conversion function. +func Convert_acme_ACMEChallengeSolverHTTP01IngressPodTemplate_To_v1alpha3_ACMEChallengeSolverHTTP01IngressPodTemplate(in *acme.ACMEChallengeSolverHTTP01IngressPodTemplate, out *v1alpha3.ACMEChallengeSolverHTTP01IngressPodTemplate, s conversion.Scope) error { + return autoConvert_acme_ACMEChallengeSolverHTTP01IngressPodTemplate_To_v1alpha3_ACMEChallengeSolverHTTP01IngressPodTemplate(in, out, s) +} + +func autoConvert_v1alpha3_ACMEExternalAccountBinding_To_acme_ACMEExternalAccountBinding(in *v1alpha3.ACMEExternalAccountBinding, out *acme.ACMEExternalAccountBinding, s conversion.Scope) error { + out.KeyID = in.KeyID + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.Key, &out.Key, 0); err != nil { + return err + } + out.KeyAlgorithm = acme.HMACKeyAlgorithm(in.KeyAlgorithm) + return nil +} + +// Convert_v1alpha3_ACMEExternalAccountBinding_To_acme_ACMEExternalAccountBinding is an autogenerated conversion function. +func Convert_v1alpha3_ACMEExternalAccountBinding_To_acme_ACMEExternalAccountBinding(in *v1alpha3.ACMEExternalAccountBinding, out *acme.ACMEExternalAccountBinding, s conversion.Scope) error { + return autoConvert_v1alpha3_ACMEExternalAccountBinding_To_acme_ACMEExternalAccountBinding(in, out, s) +} + +func autoConvert_acme_ACMEExternalAccountBinding_To_v1alpha3_ACMEExternalAccountBinding(in *acme.ACMEExternalAccountBinding, out *v1alpha3.ACMEExternalAccountBinding, s conversion.Scope) error { + out.KeyID = in.KeyID + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.Key, &out.Key, 0); err != nil { + return err + } + out.KeyAlgorithm = v1alpha3.HMACKeyAlgorithm(in.KeyAlgorithm) + return nil +} + +// Convert_acme_ACMEExternalAccountBinding_To_v1alpha3_ACMEExternalAccountBinding is an autogenerated conversion function. +func Convert_acme_ACMEExternalAccountBinding_To_v1alpha3_ACMEExternalAccountBinding(in *acme.ACMEExternalAccountBinding, out *v1alpha3.ACMEExternalAccountBinding, s conversion.Scope) error { + return autoConvert_acme_ACMEExternalAccountBinding_To_v1alpha3_ACMEExternalAccountBinding(in, out, s) +} + +func autoConvert_v1alpha3_ACMEIssuer_To_acme_ACMEIssuer(in *v1alpha3.ACMEIssuer, out *acme.ACMEIssuer, s conversion.Scope) error { + out.Email = in.Email + out.Server = in.Server + out.SkipTLSVerify = in.SkipTLSVerify + out.ExternalAccountBinding = (*acme.ACMEExternalAccountBinding)(unsafe.Pointer(in.ExternalAccountBinding)) + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.PrivateKey, &out.PrivateKey, 0); err != nil { + return err + } + out.Solvers = *(*[]acme.ACMEChallengeSolver)(unsafe.Pointer(&in.Solvers)) + return nil +} + +// Convert_v1alpha3_ACMEIssuer_To_acme_ACMEIssuer is an autogenerated conversion function. +func Convert_v1alpha3_ACMEIssuer_To_acme_ACMEIssuer(in *v1alpha3.ACMEIssuer, out *acme.ACMEIssuer, s conversion.Scope) error { + return autoConvert_v1alpha3_ACMEIssuer_To_acme_ACMEIssuer(in, out, s) +} + +func autoConvert_acme_ACMEIssuer_To_v1alpha3_ACMEIssuer(in *acme.ACMEIssuer, out *v1alpha3.ACMEIssuer, s conversion.Scope) error { + out.Email = in.Email + out.Server = in.Server + out.SkipTLSVerify = in.SkipTLSVerify + out.ExternalAccountBinding = (*v1alpha3.ACMEExternalAccountBinding)(unsafe.Pointer(in.ExternalAccountBinding)) + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.PrivateKey, &out.PrivateKey, 0); err != nil { + return err + } + out.Solvers = *(*[]v1alpha3.ACMEChallengeSolver)(unsafe.Pointer(&in.Solvers)) + return nil +} + +// Convert_acme_ACMEIssuer_To_v1alpha3_ACMEIssuer is an autogenerated conversion function. +func Convert_acme_ACMEIssuer_To_v1alpha3_ACMEIssuer(in *acme.ACMEIssuer, out *v1alpha3.ACMEIssuer, s conversion.Scope) error { + return autoConvert_acme_ACMEIssuer_To_v1alpha3_ACMEIssuer(in, out, s) +} + +func autoConvert_v1alpha3_ACMEIssuerDNS01ProviderAcmeDNS_To_acme_ACMEIssuerDNS01ProviderAcmeDNS(in *v1alpha3.ACMEIssuerDNS01ProviderAcmeDNS, out *acme.ACMEIssuerDNS01ProviderAcmeDNS, s conversion.Scope) error { + out.Host = in.Host + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.AccountSecret, &out.AccountSecret, 0); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_ACMEIssuerDNS01ProviderAcmeDNS_To_acme_ACMEIssuerDNS01ProviderAcmeDNS is an autogenerated conversion function. +func Convert_v1alpha3_ACMEIssuerDNS01ProviderAcmeDNS_To_acme_ACMEIssuerDNS01ProviderAcmeDNS(in *v1alpha3.ACMEIssuerDNS01ProviderAcmeDNS, out *acme.ACMEIssuerDNS01ProviderAcmeDNS, s conversion.Scope) error { + return autoConvert_v1alpha3_ACMEIssuerDNS01ProviderAcmeDNS_To_acme_ACMEIssuerDNS01ProviderAcmeDNS(in, out, s) +} + +func autoConvert_acme_ACMEIssuerDNS01ProviderAcmeDNS_To_v1alpha3_ACMEIssuerDNS01ProviderAcmeDNS(in *acme.ACMEIssuerDNS01ProviderAcmeDNS, out *v1alpha3.ACMEIssuerDNS01ProviderAcmeDNS, s conversion.Scope) error { + out.Host = in.Host + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.AccountSecret, &out.AccountSecret, 0); err != nil { + return err + } + return nil +} + +// Convert_acme_ACMEIssuerDNS01ProviderAcmeDNS_To_v1alpha3_ACMEIssuerDNS01ProviderAcmeDNS is an autogenerated conversion function. +func Convert_acme_ACMEIssuerDNS01ProviderAcmeDNS_To_v1alpha3_ACMEIssuerDNS01ProviderAcmeDNS(in *acme.ACMEIssuerDNS01ProviderAcmeDNS, out *v1alpha3.ACMEIssuerDNS01ProviderAcmeDNS, s conversion.Scope) error { + return autoConvert_acme_ACMEIssuerDNS01ProviderAcmeDNS_To_v1alpha3_ACMEIssuerDNS01ProviderAcmeDNS(in, out, s) +} + +func autoConvert_v1alpha3_ACMEIssuerDNS01ProviderAkamai_To_acme_ACMEIssuerDNS01ProviderAkamai(in *v1alpha3.ACMEIssuerDNS01ProviderAkamai, out *acme.ACMEIssuerDNS01ProviderAkamai, s conversion.Scope) error { + out.ServiceConsumerDomain = in.ServiceConsumerDomain + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.ClientToken, &out.ClientToken, 0); err != nil { + return err + } + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.ClientSecret, &out.ClientSecret, 0); err != nil { + return err + } + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.AccessToken, &out.AccessToken, 0); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_ACMEIssuerDNS01ProviderAkamai_To_acme_ACMEIssuerDNS01ProviderAkamai is an autogenerated conversion function. +func Convert_v1alpha3_ACMEIssuerDNS01ProviderAkamai_To_acme_ACMEIssuerDNS01ProviderAkamai(in *v1alpha3.ACMEIssuerDNS01ProviderAkamai, out *acme.ACMEIssuerDNS01ProviderAkamai, s conversion.Scope) error { + return autoConvert_v1alpha3_ACMEIssuerDNS01ProviderAkamai_To_acme_ACMEIssuerDNS01ProviderAkamai(in, out, s) +} + +func autoConvert_acme_ACMEIssuerDNS01ProviderAkamai_To_v1alpha3_ACMEIssuerDNS01ProviderAkamai(in *acme.ACMEIssuerDNS01ProviderAkamai, out *v1alpha3.ACMEIssuerDNS01ProviderAkamai, s conversion.Scope) error { + out.ServiceConsumerDomain = in.ServiceConsumerDomain + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.ClientToken, &out.ClientToken, 0); err != nil { + return err + } + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.ClientSecret, &out.ClientSecret, 0); err != nil { + return err + } + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.AccessToken, &out.AccessToken, 0); err != nil { + return err + } + return nil +} + +// Convert_acme_ACMEIssuerDNS01ProviderAkamai_To_v1alpha3_ACMEIssuerDNS01ProviderAkamai is an autogenerated conversion function. +func Convert_acme_ACMEIssuerDNS01ProviderAkamai_To_v1alpha3_ACMEIssuerDNS01ProviderAkamai(in *acme.ACMEIssuerDNS01ProviderAkamai, out *v1alpha3.ACMEIssuerDNS01ProviderAkamai, s conversion.Scope) error { + return autoConvert_acme_ACMEIssuerDNS01ProviderAkamai_To_v1alpha3_ACMEIssuerDNS01ProviderAkamai(in, out, s) +} + +func autoConvert_v1alpha3_ACMEIssuerDNS01ProviderAzureDNS_To_acme_ACMEIssuerDNS01ProviderAzureDNS(in *v1alpha3.ACMEIssuerDNS01ProviderAzureDNS, out *acme.ACMEIssuerDNS01ProviderAzureDNS, s conversion.Scope) error { + out.ClientID = in.ClientID + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.ClientSecret, &out.ClientSecret, 0); err != nil { + return err + } + out.SubscriptionID = in.SubscriptionID + out.TenantID = in.TenantID + out.ResourceGroupName = in.ResourceGroupName + out.HostedZoneName = in.HostedZoneName + out.Environment = acme.AzureDNSEnvironment(in.Environment) + return nil +} + +// Convert_v1alpha3_ACMEIssuerDNS01ProviderAzureDNS_To_acme_ACMEIssuerDNS01ProviderAzureDNS is an autogenerated conversion function. +func Convert_v1alpha3_ACMEIssuerDNS01ProviderAzureDNS_To_acme_ACMEIssuerDNS01ProviderAzureDNS(in *v1alpha3.ACMEIssuerDNS01ProviderAzureDNS, out *acme.ACMEIssuerDNS01ProviderAzureDNS, s conversion.Scope) error { + return autoConvert_v1alpha3_ACMEIssuerDNS01ProviderAzureDNS_To_acme_ACMEIssuerDNS01ProviderAzureDNS(in, out, s) +} + +func autoConvert_acme_ACMEIssuerDNS01ProviderAzureDNS_To_v1alpha3_ACMEIssuerDNS01ProviderAzureDNS(in *acme.ACMEIssuerDNS01ProviderAzureDNS, out *v1alpha3.ACMEIssuerDNS01ProviderAzureDNS, s conversion.Scope) error { + out.ClientID = in.ClientID + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.ClientSecret, &out.ClientSecret, 0); err != nil { + return err + } + out.SubscriptionID = in.SubscriptionID + out.TenantID = in.TenantID + out.ResourceGroupName = in.ResourceGroupName + out.HostedZoneName = in.HostedZoneName + out.Environment = v1alpha3.AzureDNSEnvironment(in.Environment) + return nil +} + +// Convert_acme_ACMEIssuerDNS01ProviderAzureDNS_To_v1alpha3_ACMEIssuerDNS01ProviderAzureDNS is an autogenerated conversion function. +func Convert_acme_ACMEIssuerDNS01ProviderAzureDNS_To_v1alpha3_ACMEIssuerDNS01ProviderAzureDNS(in *acme.ACMEIssuerDNS01ProviderAzureDNS, out *v1alpha3.ACMEIssuerDNS01ProviderAzureDNS, s conversion.Scope) error { + return autoConvert_acme_ACMEIssuerDNS01ProviderAzureDNS_To_v1alpha3_ACMEIssuerDNS01ProviderAzureDNS(in, out, s) +} + +func autoConvert_v1alpha3_ACMEIssuerDNS01ProviderCloudDNS_To_acme_ACMEIssuerDNS01ProviderCloudDNS(in *v1alpha3.ACMEIssuerDNS01ProviderCloudDNS, out *acme.ACMEIssuerDNS01ProviderCloudDNS, s conversion.Scope) error { + out.ServiceAccount = (*meta.SecretKeySelector)(unsafe.Pointer(in.ServiceAccount)) + out.Project = in.Project + return nil +} + +// Convert_v1alpha3_ACMEIssuerDNS01ProviderCloudDNS_To_acme_ACMEIssuerDNS01ProviderCloudDNS is an autogenerated conversion function. +func Convert_v1alpha3_ACMEIssuerDNS01ProviderCloudDNS_To_acme_ACMEIssuerDNS01ProviderCloudDNS(in *v1alpha3.ACMEIssuerDNS01ProviderCloudDNS, out *acme.ACMEIssuerDNS01ProviderCloudDNS, s conversion.Scope) error { + return autoConvert_v1alpha3_ACMEIssuerDNS01ProviderCloudDNS_To_acme_ACMEIssuerDNS01ProviderCloudDNS(in, out, s) +} + +func autoConvert_acme_ACMEIssuerDNS01ProviderCloudDNS_To_v1alpha3_ACMEIssuerDNS01ProviderCloudDNS(in *acme.ACMEIssuerDNS01ProviderCloudDNS, out *v1alpha3.ACMEIssuerDNS01ProviderCloudDNS, s conversion.Scope) error { + out.ServiceAccount = (*metav1.SecretKeySelector)(unsafe.Pointer(in.ServiceAccount)) + out.Project = in.Project + return nil +} + +// Convert_acme_ACMEIssuerDNS01ProviderCloudDNS_To_v1alpha3_ACMEIssuerDNS01ProviderCloudDNS is an autogenerated conversion function. +func Convert_acme_ACMEIssuerDNS01ProviderCloudDNS_To_v1alpha3_ACMEIssuerDNS01ProviderCloudDNS(in *acme.ACMEIssuerDNS01ProviderCloudDNS, out *v1alpha3.ACMEIssuerDNS01ProviderCloudDNS, s conversion.Scope) error { + return autoConvert_acme_ACMEIssuerDNS01ProviderCloudDNS_To_v1alpha3_ACMEIssuerDNS01ProviderCloudDNS(in, out, s) +} + +func autoConvert_v1alpha3_ACMEIssuerDNS01ProviderCloudflare_To_acme_ACMEIssuerDNS01ProviderCloudflare(in *v1alpha3.ACMEIssuerDNS01ProviderCloudflare, out *acme.ACMEIssuerDNS01ProviderCloudflare, s conversion.Scope) error { + out.Email = in.Email + out.APIKey = (*meta.SecretKeySelector)(unsafe.Pointer(in.APIKey)) + out.APIToken = (*meta.SecretKeySelector)(unsafe.Pointer(in.APIToken)) + return nil +} + +// Convert_v1alpha3_ACMEIssuerDNS01ProviderCloudflare_To_acme_ACMEIssuerDNS01ProviderCloudflare is an autogenerated conversion function. +func Convert_v1alpha3_ACMEIssuerDNS01ProviderCloudflare_To_acme_ACMEIssuerDNS01ProviderCloudflare(in *v1alpha3.ACMEIssuerDNS01ProviderCloudflare, out *acme.ACMEIssuerDNS01ProviderCloudflare, s conversion.Scope) error { + return autoConvert_v1alpha3_ACMEIssuerDNS01ProviderCloudflare_To_acme_ACMEIssuerDNS01ProviderCloudflare(in, out, s) +} + +func autoConvert_acme_ACMEIssuerDNS01ProviderCloudflare_To_v1alpha3_ACMEIssuerDNS01ProviderCloudflare(in *acme.ACMEIssuerDNS01ProviderCloudflare, out *v1alpha3.ACMEIssuerDNS01ProviderCloudflare, s conversion.Scope) error { + out.Email = in.Email + out.APIKey = (*metav1.SecretKeySelector)(unsafe.Pointer(in.APIKey)) + out.APIToken = (*metav1.SecretKeySelector)(unsafe.Pointer(in.APIToken)) + return nil +} + +// Convert_acme_ACMEIssuerDNS01ProviderCloudflare_To_v1alpha3_ACMEIssuerDNS01ProviderCloudflare is an autogenerated conversion function. +func Convert_acme_ACMEIssuerDNS01ProviderCloudflare_To_v1alpha3_ACMEIssuerDNS01ProviderCloudflare(in *acme.ACMEIssuerDNS01ProviderCloudflare, out *v1alpha3.ACMEIssuerDNS01ProviderCloudflare, s conversion.Scope) error { + return autoConvert_acme_ACMEIssuerDNS01ProviderCloudflare_To_v1alpha3_ACMEIssuerDNS01ProviderCloudflare(in, out, s) +} + +func autoConvert_v1alpha3_ACMEIssuerDNS01ProviderDigitalOcean_To_acme_ACMEIssuerDNS01ProviderDigitalOcean(in *v1alpha3.ACMEIssuerDNS01ProviderDigitalOcean, out *acme.ACMEIssuerDNS01ProviderDigitalOcean, s conversion.Scope) error { + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.Token, &out.Token, 0); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_ACMEIssuerDNS01ProviderDigitalOcean_To_acme_ACMEIssuerDNS01ProviderDigitalOcean is an autogenerated conversion function. +func Convert_v1alpha3_ACMEIssuerDNS01ProviderDigitalOcean_To_acme_ACMEIssuerDNS01ProviderDigitalOcean(in *v1alpha3.ACMEIssuerDNS01ProviderDigitalOcean, out *acme.ACMEIssuerDNS01ProviderDigitalOcean, s conversion.Scope) error { + return autoConvert_v1alpha3_ACMEIssuerDNS01ProviderDigitalOcean_To_acme_ACMEIssuerDNS01ProviderDigitalOcean(in, out, s) +} + +func autoConvert_acme_ACMEIssuerDNS01ProviderDigitalOcean_To_v1alpha3_ACMEIssuerDNS01ProviderDigitalOcean(in *acme.ACMEIssuerDNS01ProviderDigitalOcean, out *v1alpha3.ACMEIssuerDNS01ProviderDigitalOcean, s conversion.Scope) error { + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.Token, &out.Token, 0); err != nil { + return err + } + return nil +} + +// Convert_acme_ACMEIssuerDNS01ProviderDigitalOcean_To_v1alpha3_ACMEIssuerDNS01ProviderDigitalOcean is an autogenerated conversion function. +func Convert_acme_ACMEIssuerDNS01ProviderDigitalOcean_To_v1alpha3_ACMEIssuerDNS01ProviderDigitalOcean(in *acme.ACMEIssuerDNS01ProviderDigitalOcean, out *v1alpha3.ACMEIssuerDNS01ProviderDigitalOcean, s conversion.Scope) error { + return autoConvert_acme_ACMEIssuerDNS01ProviderDigitalOcean_To_v1alpha3_ACMEIssuerDNS01ProviderDigitalOcean(in, out, s) +} + +func autoConvert_v1alpha3_ACMEIssuerDNS01ProviderRFC2136_To_acme_ACMEIssuerDNS01ProviderRFC2136(in *v1alpha3.ACMEIssuerDNS01ProviderRFC2136, out *acme.ACMEIssuerDNS01ProviderRFC2136, s conversion.Scope) error { + out.Nameserver = in.Nameserver + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.TSIGSecret, &out.TSIGSecret, 0); err != nil { + return err + } + out.TSIGKeyName = in.TSIGKeyName + out.TSIGAlgorithm = in.TSIGAlgorithm + return nil +} + +// Convert_v1alpha3_ACMEIssuerDNS01ProviderRFC2136_To_acme_ACMEIssuerDNS01ProviderRFC2136 is an autogenerated conversion function. +func Convert_v1alpha3_ACMEIssuerDNS01ProviderRFC2136_To_acme_ACMEIssuerDNS01ProviderRFC2136(in *v1alpha3.ACMEIssuerDNS01ProviderRFC2136, out *acme.ACMEIssuerDNS01ProviderRFC2136, s conversion.Scope) error { + return autoConvert_v1alpha3_ACMEIssuerDNS01ProviderRFC2136_To_acme_ACMEIssuerDNS01ProviderRFC2136(in, out, s) +} + +func autoConvert_acme_ACMEIssuerDNS01ProviderRFC2136_To_v1alpha3_ACMEIssuerDNS01ProviderRFC2136(in *acme.ACMEIssuerDNS01ProviderRFC2136, out *v1alpha3.ACMEIssuerDNS01ProviderRFC2136, s conversion.Scope) error { + out.Nameserver = in.Nameserver + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.TSIGSecret, &out.TSIGSecret, 0); err != nil { + return err + } + out.TSIGKeyName = in.TSIGKeyName + out.TSIGAlgorithm = in.TSIGAlgorithm + return nil +} + +// Convert_acme_ACMEIssuerDNS01ProviderRFC2136_To_v1alpha3_ACMEIssuerDNS01ProviderRFC2136 is an autogenerated conversion function. +func Convert_acme_ACMEIssuerDNS01ProviderRFC2136_To_v1alpha3_ACMEIssuerDNS01ProviderRFC2136(in *acme.ACMEIssuerDNS01ProviderRFC2136, out *v1alpha3.ACMEIssuerDNS01ProviderRFC2136, s conversion.Scope) error { + return autoConvert_acme_ACMEIssuerDNS01ProviderRFC2136_To_v1alpha3_ACMEIssuerDNS01ProviderRFC2136(in, out, s) +} + +func autoConvert_v1alpha3_ACMEIssuerDNS01ProviderRoute53_To_acme_ACMEIssuerDNS01ProviderRoute53(in *v1alpha3.ACMEIssuerDNS01ProviderRoute53, out *acme.ACMEIssuerDNS01ProviderRoute53, s conversion.Scope) error { + out.AccessKeyID = in.AccessKeyID + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.SecretAccessKey, &out.SecretAccessKey, 0); err != nil { + return err + } + out.Role = in.Role + out.HostedZoneID = in.HostedZoneID + out.Region = in.Region + return nil +} + +// Convert_v1alpha3_ACMEIssuerDNS01ProviderRoute53_To_acme_ACMEIssuerDNS01ProviderRoute53 is an autogenerated conversion function. +func Convert_v1alpha3_ACMEIssuerDNS01ProviderRoute53_To_acme_ACMEIssuerDNS01ProviderRoute53(in *v1alpha3.ACMEIssuerDNS01ProviderRoute53, out *acme.ACMEIssuerDNS01ProviderRoute53, s conversion.Scope) error { + return autoConvert_v1alpha3_ACMEIssuerDNS01ProviderRoute53_To_acme_ACMEIssuerDNS01ProviderRoute53(in, out, s) +} + +func autoConvert_acme_ACMEIssuerDNS01ProviderRoute53_To_v1alpha3_ACMEIssuerDNS01ProviderRoute53(in *acme.ACMEIssuerDNS01ProviderRoute53, out *v1alpha3.ACMEIssuerDNS01ProviderRoute53, s conversion.Scope) error { + out.AccessKeyID = in.AccessKeyID + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.SecretAccessKey, &out.SecretAccessKey, 0); err != nil { + return err + } + out.Role = in.Role + out.HostedZoneID = in.HostedZoneID + out.Region = in.Region + return nil +} + +// Convert_acme_ACMEIssuerDNS01ProviderRoute53_To_v1alpha3_ACMEIssuerDNS01ProviderRoute53 is an autogenerated conversion function. +func Convert_acme_ACMEIssuerDNS01ProviderRoute53_To_v1alpha3_ACMEIssuerDNS01ProviderRoute53(in *acme.ACMEIssuerDNS01ProviderRoute53, out *v1alpha3.ACMEIssuerDNS01ProviderRoute53, s conversion.Scope) error { + return autoConvert_acme_ACMEIssuerDNS01ProviderRoute53_To_v1alpha3_ACMEIssuerDNS01ProviderRoute53(in, out, s) +} + +func autoConvert_v1alpha3_ACMEIssuerDNS01ProviderWebhook_To_acme_ACMEIssuerDNS01ProviderWebhook(in *v1alpha3.ACMEIssuerDNS01ProviderWebhook, out *acme.ACMEIssuerDNS01ProviderWebhook, s conversion.Scope) error { + out.GroupName = in.GroupName + out.SolverName = in.SolverName + out.Config = (*v1beta1.JSON)(unsafe.Pointer(in.Config)) + return nil +} + +// Convert_v1alpha3_ACMEIssuerDNS01ProviderWebhook_To_acme_ACMEIssuerDNS01ProviderWebhook is an autogenerated conversion function. +func Convert_v1alpha3_ACMEIssuerDNS01ProviderWebhook_To_acme_ACMEIssuerDNS01ProviderWebhook(in *v1alpha3.ACMEIssuerDNS01ProviderWebhook, out *acme.ACMEIssuerDNS01ProviderWebhook, s conversion.Scope) error { + return autoConvert_v1alpha3_ACMEIssuerDNS01ProviderWebhook_To_acme_ACMEIssuerDNS01ProviderWebhook(in, out, s) +} + +func autoConvert_acme_ACMEIssuerDNS01ProviderWebhook_To_v1alpha3_ACMEIssuerDNS01ProviderWebhook(in *acme.ACMEIssuerDNS01ProviderWebhook, out *v1alpha3.ACMEIssuerDNS01ProviderWebhook, s conversion.Scope) error { + out.GroupName = in.GroupName + out.SolverName = in.SolverName + out.Config = (*v1beta1.JSON)(unsafe.Pointer(in.Config)) + return nil +} + +// Convert_acme_ACMEIssuerDNS01ProviderWebhook_To_v1alpha3_ACMEIssuerDNS01ProviderWebhook is an autogenerated conversion function. +func Convert_acme_ACMEIssuerDNS01ProviderWebhook_To_v1alpha3_ACMEIssuerDNS01ProviderWebhook(in *acme.ACMEIssuerDNS01ProviderWebhook, out *v1alpha3.ACMEIssuerDNS01ProviderWebhook, s conversion.Scope) error { + return autoConvert_acme_ACMEIssuerDNS01ProviderWebhook_To_v1alpha3_ACMEIssuerDNS01ProviderWebhook(in, out, s) +} + +func autoConvert_v1alpha3_ACMEIssuerStatus_To_acme_ACMEIssuerStatus(in *v1alpha3.ACMEIssuerStatus, out *acme.ACMEIssuerStatus, s conversion.Scope) error { + out.URI = in.URI + out.LastRegisteredEmail = in.LastRegisteredEmail + return nil +} + +// Convert_v1alpha3_ACMEIssuerStatus_To_acme_ACMEIssuerStatus is an autogenerated conversion function. +func Convert_v1alpha3_ACMEIssuerStatus_To_acme_ACMEIssuerStatus(in *v1alpha3.ACMEIssuerStatus, out *acme.ACMEIssuerStatus, s conversion.Scope) error { + return autoConvert_v1alpha3_ACMEIssuerStatus_To_acme_ACMEIssuerStatus(in, out, s) +} + +func autoConvert_acme_ACMEIssuerStatus_To_v1alpha3_ACMEIssuerStatus(in *acme.ACMEIssuerStatus, out *v1alpha3.ACMEIssuerStatus, s conversion.Scope) error { + out.URI = in.URI + out.LastRegisteredEmail = in.LastRegisteredEmail + return nil +} + +// Convert_acme_ACMEIssuerStatus_To_v1alpha3_ACMEIssuerStatus is an autogenerated conversion function. +func Convert_acme_ACMEIssuerStatus_To_v1alpha3_ACMEIssuerStatus(in *acme.ACMEIssuerStatus, out *v1alpha3.ACMEIssuerStatus, s conversion.Scope) error { + return autoConvert_acme_ACMEIssuerStatus_To_v1alpha3_ACMEIssuerStatus(in, out, s) +} + +func autoConvert_v1alpha3_CertificateDNSNameSelector_To_acme_CertificateDNSNameSelector(in *v1alpha3.CertificateDNSNameSelector, out *acme.CertificateDNSNameSelector, s conversion.Scope) error { + out.MatchLabels = *(*map[string]string)(unsafe.Pointer(&in.MatchLabels)) + out.DNSNames = *(*[]string)(unsafe.Pointer(&in.DNSNames)) + out.DNSZones = *(*[]string)(unsafe.Pointer(&in.DNSZones)) + return nil +} + +// Convert_v1alpha3_CertificateDNSNameSelector_To_acme_CertificateDNSNameSelector is an autogenerated conversion function. +func Convert_v1alpha3_CertificateDNSNameSelector_To_acme_CertificateDNSNameSelector(in *v1alpha3.CertificateDNSNameSelector, out *acme.CertificateDNSNameSelector, s conversion.Scope) error { + return autoConvert_v1alpha3_CertificateDNSNameSelector_To_acme_CertificateDNSNameSelector(in, out, s) +} + +func autoConvert_acme_CertificateDNSNameSelector_To_v1alpha3_CertificateDNSNameSelector(in *acme.CertificateDNSNameSelector, out *v1alpha3.CertificateDNSNameSelector, s conversion.Scope) error { + out.MatchLabels = *(*map[string]string)(unsafe.Pointer(&in.MatchLabels)) + out.DNSNames = *(*[]string)(unsafe.Pointer(&in.DNSNames)) + out.DNSZones = *(*[]string)(unsafe.Pointer(&in.DNSZones)) + return nil +} + +// Convert_acme_CertificateDNSNameSelector_To_v1alpha3_CertificateDNSNameSelector is an autogenerated conversion function. +func Convert_acme_CertificateDNSNameSelector_To_v1alpha3_CertificateDNSNameSelector(in *acme.CertificateDNSNameSelector, out *v1alpha3.CertificateDNSNameSelector, s conversion.Scope) error { + return autoConvert_acme_CertificateDNSNameSelector_To_v1alpha3_CertificateDNSNameSelector(in, out, s) +} + +func autoConvert_v1alpha3_Challenge_To_acme_Challenge(in *v1alpha3.Challenge, out *acme.Challenge, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha3_ChallengeSpec_To_acme_ChallengeSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha3_ChallengeStatus_To_acme_ChallengeStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_Challenge_To_acme_Challenge is an autogenerated conversion function. +func Convert_v1alpha3_Challenge_To_acme_Challenge(in *v1alpha3.Challenge, out *acme.Challenge, s conversion.Scope) error { + return autoConvert_v1alpha3_Challenge_To_acme_Challenge(in, out, s) +} + +func autoConvert_acme_Challenge_To_v1alpha3_Challenge(in *acme.Challenge, out *v1alpha3.Challenge, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_acme_ChallengeSpec_To_v1alpha3_ChallengeSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_acme_ChallengeStatus_To_v1alpha3_ChallengeStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_acme_Challenge_To_v1alpha3_Challenge is an autogenerated conversion function. +func Convert_acme_Challenge_To_v1alpha3_Challenge(in *acme.Challenge, out *v1alpha3.Challenge, s conversion.Scope) error { + return autoConvert_acme_Challenge_To_v1alpha3_Challenge(in, out, s) +} + +func autoConvert_v1alpha3_ChallengeList_To_acme_ChallengeList(in *v1alpha3.ChallengeList, out *acme.ChallengeList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]acme.Challenge)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha3_ChallengeList_To_acme_ChallengeList is an autogenerated conversion function. +func Convert_v1alpha3_ChallengeList_To_acme_ChallengeList(in *v1alpha3.ChallengeList, out *acme.ChallengeList, s conversion.Scope) error { + return autoConvert_v1alpha3_ChallengeList_To_acme_ChallengeList(in, out, s) +} + +func autoConvert_acme_ChallengeList_To_v1alpha3_ChallengeList(in *acme.ChallengeList, out *v1alpha3.ChallengeList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]v1alpha3.Challenge)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_acme_ChallengeList_To_v1alpha3_ChallengeList is an autogenerated conversion function. +func Convert_acme_ChallengeList_To_v1alpha3_ChallengeList(in *acme.ChallengeList, out *v1alpha3.ChallengeList, s conversion.Scope) error { + return autoConvert_acme_ChallengeList_To_v1alpha3_ChallengeList(in, out, s) +} + +func autoConvert_v1alpha3_ChallengeSpec_To_acme_ChallengeSpec(in *v1alpha3.ChallengeSpec, out *acme.ChallengeSpec, s conversion.Scope) error { + out.AuthzURL = in.AuthzURL + out.Type = string(in.Type) + out.URL = in.URL + out.DNSName = in.DNSName + out.Token = in.Token + out.Key = in.Key + out.Wildcard = in.Wildcard + out.Solver = (*acme.ACMEChallengeSolver)(unsafe.Pointer(in.Solver)) + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.IssuerRef, &out.IssuerRef, 0); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_ChallengeSpec_To_acme_ChallengeSpec is an autogenerated conversion function. +func Convert_v1alpha3_ChallengeSpec_To_acme_ChallengeSpec(in *v1alpha3.ChallengeSpec, out *acme.ChallengeSpec, s conversion.Scope) error { + return autoConvert_v1alpha3_ChallengeSpec_To_acme_ChallengeSpec(in, out, s) +} + +func autoConvert_acme_ChallengeSpec_To_v1alpha3_ChallengeSpec(in *acme.ChallengeSpec, out *v1alpha3.ChallengeSpec, s conversion.Scope) error { + out.AuthzURL = in.AuthzURL + out.Type = v1alpha3.ACMEChallengeType(in.Type) + out.URL = in.URL + out.DNSName = in.DNSName + out.Token = in.Token + out.Key = in.Key + out.Wildcard = in.Wildcard + out.Solver = (*v1alpha3.ACMEChallengeSolver)(unsafe.Pointer(in.Solver)) + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.IssuerRef, &out.IssuerRef, 0); err != nil { + return err + } + return nil +} + +// Convert_acme_ChallengeSpec_To_v1alpha3_ChallengeSpec is an autogenerated conversion function. +func Convert_acme_ChallengeSpec_To_v1alpha3_ChallengeSpec(in *acme.ChallengeSpec, out *v1alpha3.ChallengeSpec, s conversion.Scope) error { + return autoConvert_acme_ChallengeSpec_To_v1alpha3_ChallengeSpec(in, out, s) +} + +func autoConvert_v1alpha3_ChallengeStatus_To_acme_ChallengeStatus(in *v1alpha3.ChallengeStatus, out *acme.ChallengeStatus, s conversion.Scope) error { + out.Processing = in.Processing + out.Presented = in.Presented + out.Reason = in.Reason + out.State = acme.State(in.State) + return nil +} + +// Convert_v1alpha3_ChallengeStatus_To_acme_ChallengeStatus is an autogenerated conversion function. +func Convert_v1alpha3_ChallengeStatus_To_acme_ChallengeStatus(in *v1alpha3.ChallengeStatus, out *acme.ChallengeStatus, s conversion.Scope) error { + return autoConvert_v1alpha3_ChallengeStatus_To_acme_ChallengeStatus(in, out, s) +} + +func autoConvert_acme_ChallengeStatus_To_v1alpha3_ChallengeStatus(in *acme.ChallengeStatus, out *v1alpha3.ChallengeStatus, s conversion.Scope) error { + out.Processing = in.Processing + out.Presented = in.Presented + out.Reason = in.Reason + out.State = v1alpha3.State(in.State) + return nil +} + +// Convert_acme_ChallengeStatus_To_v1alpha3_ChallengeStatus is an autogenerated conversion function. +func Convert_acme_ChallengeStatus_To_v1alpha3_ChallengeStatus(in *acme.ChallengeStatus, out *v1alpha3.ChallengeStatus, s conversion.Scope) error { + return autoConvert_acme_ChallengeStatus_To_v1alpha3_ChallengeStatus(in, out, s) +} + +func autoConvert_v1alpha3_Order_To_acme_Order(in *v1alpha3.Order, out *acme.Order, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha3_OrderSpec_To_acme_OrderSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha3_OrderStatus_To_acme_OrderStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_Order_To_acme_Order is an autogenerated conversion function. +func Convert_v1alpha3_Order_To_acme_Order(in *v1alpha3.Order, out *acme.Order, s conversion.Scope) error { + return autoConvert_v1alpha3_Order_To_acme_Order(in, out, s) +} + +func autoConvert_acme_Order_To_v1alpha3_Order(in *acme.Order, out *v1alpha3.Order, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_acme_OrderSpec_To_v1alpha3_OrderSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_acme_OrderStatus_To_v1alpha3_OrderStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_acme_Order_To_v1alpha3_Order is an autogenerated conversion function. +func Convert_acme_Order_To_v1alpha3_Order(in *acme.Order, out *v1alpha3.Order, s conversion.Scope) error { + return autoConvert_acme_Order_To_v1alpha3_Order(in, out, s) +} + +func autoConvert_v1alpha3_OrderList_To_acme_OrderList(in *v1alpha3.OrderList, out *acme.OrderList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]acme.Order, len(*in)) + for i := range *in { + if err := Convert_v1alpha3_Order_To_acme_Order(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha3_OrderList_To_acme_OrderList is an autogenerated conversion function. +func Convert_v1alpha3_OrderList_To_acme_OrderList(in *v1alpha3.OrderList, out *acme.OrderList, s conversion.Scope) error { + return autoConvert_v1alpha3_OrderList_To_acme_OrderList(in, out, s) +} + +func autoConvert_acme_OrderList_To_v1alpha3_OrderList(in *acme.OrderList, out *v1alpha3.OrderList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v1alpha3.Order, len(*in)) + for i := range *in { + if err := Convert_acme_Order_To_v1alpha3_Order(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_acme_OrderList_To_v1alpha3_OrderList is an autogenerated conversion function. +func Convert_acme_OrderList_To_v1alpha3_OrderList(in *acme.OrderList, out *v1alpha3.OrderList, s conversion.Scope) error { + return autoConvert_acme_OrderList_To_v1alpha3_OrderList(in, out, s) +} + +func autoConvert_v1alpha3_OrderSpec_To_acme_OrderSpec(in *v1alpha3.OrderSpec, out *acme.OrderSpec, s conversion.Scope) error { + out.CSR = *(*[]byte)(unsafe.Pointer(&in.CSR)) + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.IssuerRef, &out.IssuerRef, 0); err != nil { + return err + } + out.CommonName = in.CommonName + out.DNSNames = *(*[]string)(unsafe.Pointer(&in.DNSNames)) + return nil +} + +// Convert_v1alpha3_OrderSpec_To_acme_OrderSpec is an autogenerated conversion function. +func Convert_v1alpha3_OrderSpec_To_acme_OrderSpec(in *v1alpha3.OrderSpec, out *acme.OrderSpec, s conversion.Scope) error { + return autoConvert_v1alpha3_OrderSpec_To_acme_OrderSpec(in, out, s) +} + +func autoConvert_acme_OrderSpec_To_v1alpha3_OrderSpec(in *acme.OrderSpec, out *v1alpha3.OrderSpec, s conversion.Scope) error { + out.CSR = *(*[]byte)(unsafe.Pointer(&in.CSR)) + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.IssuerRef, &out.IssuerRef, 0); err != nil { + return err + } + out.CommonName = in.CommonName + out.DNSNames = *(*[]string)(unsafe.Pointer(&in.DNSNames)) + return nil +} + +// Convert_acme_OrderSpec_To_v1alpha3_OrderSpec is an autogenerated conversion function. +func Convert_acme_OrderSpec_To_v1alpha3_OrderSpec(in *acme.OrderSpec, out *v1alpha3.OrderSpec, s conversion.Scope) error { + return autoConvert_acme_OrderSpec_To_v1alpha3_OrderSpec(in, out, s) +} + +func autoConvert_v1alpha3_OrderStatus_To_acme_OrderStatus(in *v1alpha3.OrderStatus, out *acme.OrderStatus, s conversion.Scope) error { + out.URL = in.URL + out.FinalizeURL = in.FinalizeURL + out.Authorizations = *(*[]acme.ACMEAuthorization)(unsafe.Pointer(&in.Authorizations)) + out.Certificate = *(*[]byte)(unsafe.Pointer(&in.Certificate)) + out.State = acme.State(in.State) + out.Reason = in.Reason + out.FailureTime = (*apismetav1.Time)(unsafe.Pointer(in.FailureTime)) + return nil +} + +// Convert_v1alpha3_OrderStatus_To_acme_OrderStatus is an autogenerated conversion function. +func Convert_v1alpha3_OrderStatus_To_acme_OrderStatus(in *v1alpha3.OrderStatus, out *acme.OrderStatus, s conversion.Scope) error { + return autoConvert_v1alpha3_OrderStatus_To_acme_OrderStatus(in, out, s) +} + +func autoConvert_acme_OrderStatus_To_v1alpha3_OrderStatus(in *acme.OrderStatus, out *v1alpha3.OrderStatus, s conversion.Scope) error { + out.URL = in.URL + out.FinalizeURL = in.FinalizeURL + out.Certificate = *(*[]byte)(unsafe.Pointer(&in.Certificate)) + out.State = v1alpha3.State(in.State) + out.Reason = in.Reason + out.Authorizations = *(*[]v1alpha3.ACMEAuthorization)(unsafe.Pointer(&in.Authorizations)) + out.FailureTime = (*apismetav1.Time)(unsafe.Pointer(in.FailureTime)) + return nil +} + +// Convert_acme_OrderStatus_To_v1alpha3_OrderStatus is an autogenerated conversion function. +func Convert_acme_OrderStatus_To_v1alpha3_OrderStatus(in *acme.OrderStatus, out *v1alpha3.OrderStatus, s conversion.Scope) error { + return autoConvert_acme_OrderStatus_To_v1alpha3_OrderStatus(in, out, s) +} diff --git a/pkg/internal/apis/acme/v1alpha3/zz_generated.defaults.go b/pkg/internal/apis/acme/v1alpha3/zz_generated.defaults.go new file mode 100644 index 000000000..8356dba3d --- /dev/null +++ b/pkg/internal/apis/acme/v1alpha3/zz_generated.defaults.go @@ -0,0 +1,32 @@ +// +build !ignore_autogenerated + +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by defaulter-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// RegisterDefaults adds defaulters functions to the given scheme. +// Public to allow building arbitrary schemes. +// All generated defaulters are covering - they call all nested defaulters. +func RegisterDefaults(scheme *runtime.Scheme) error { + return nil +} diff --git a/pkg/internal/apis/acme/validation/BUILD.bazel b/pkg/internal/apis/acme/validation/BUILD.bazel index 07d4d42f3..b7c9b4503 100644 --- a/pkg/internal/apis/acme/validation/BUILD.bazel +++ b/pkg/internal/apis/acme/validation/BUILD.bazel @@ -5,11 +5,13 @@ go_library( srcs = [ "challenge.go", "order.go", + "register.go", ], importpath = "github.com/jetstack/cert-manager/pkg/internal/apis/acme/validation", visibility = ["//pkg:__subpackages__"], deps = [ - "//pkg/apis/acme/v1alpha2:go_default_library", + "//pkg/internal/api/validation:go_default_library", + "//pkg/internal/apis/acme:go_default_library", "@io_k8s_apimachinery//pkg/runtime:go_default_library", "@io_k8s_apimachinery//pkg/util/validation/field:go_default_library", ], @@ -23,7 +25,7 @@ go_test( ], embed = [":go_default_library"], deps = [ - "//pkg/apis/acme/v1alpha2:go_default_library", + "//pkg/internal/apis/acme:go_default_library", "@io_k8s_apimachinery//pkg/util/validation/field:go_default_library", "@io_k8s_utils//pointer:go_default_library", ], diff --git a/pkg/internal/apis/acme/validation/challenge.go b/pkg/internal/apis/acme/validation/challenge.go index 9cc1dc931..baeea50b3 100644 --- a/pkg/internal/apis/acme/validation/challenge.go +++ b/pkg/internal/apis/acme/validation/challenge.go @@ -22,7 +22,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/validation/field" - cmacme "github.com/jetstack/cert-manager/pkg/apis/acme/v1alpha2" + cmacme "github.com/jetstack/cert-manager/pkg/internal/apis/acme" ) func ValidateChallengeUpdate(oldObj, newObj runtime.Object) field.ErrorList { diff --git a/pkg/internal/apis/acme/validation/challenge_test.go b/pkg/internal/apis/acme/validation/challenge_test.go index 223057f91..3a6a3f658 100644 --- a/pkg/internal/apis/acme/validation/challenge_test.go +++ b/pkg/internal/apis/acme/validation/challenge_test.go @@ -22,7 +22,7 @@ import ( "k8s.io/apimachinery/pkg/util/validation/field" - cmacme "github.com/jetstack/cert-manager/pkg/apis/acme/v1alpha2" + cmacme "github.com/jetstack/cert-manager/pkg/internal/apis/acme" ) func TestValidateChallengeUpdate(t *testing.T) { diff --git a/pkg/internal/apis/acme/validation/order.go b/pkg/internal/apis/acme/validation/order.go index fe2d9bef2..c0491265a 100644 --- a/pkg/internal/apis/acme/validation/order.go +++ b/pkg/internal/apis/acme/validation/order.go @@ -22,7 +22,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/validation/field" - cmacme "github.com/jetstack/cert-manager/pkg/apis/acme/v1alpha2" + cmacme "github.com/jetstack/cert-manager/pkg/internal/apis/acme" ) func ValidateOrderUpdate(oldObj, newObj runtime.Object) field.ErrorList { diff --git a/pkg/internal/apis/acme/validation/order_test.go b/pkg/internal/apis/acme/validation/order_test.go index 7231f0032..a0f1dde27 100644 --- a/pkg/internal/apis/acme/validation/order_test.go +++ b/pkg/internal/apis/acme/validation/order_test.go @@ -23,7 +23,7 @@ import ( "k8s.io/apimachinery/pkg/util/validation/field" - cmacme "github.com/jetstack/cert-manager/pkg/apis/acme/v1alpha2" + cmacme "github.com/jetstack/cert-manager/pkg/internal/apis/acme" ) type testValue string diff --git a/pkg/internal/apis/acme/validation/register.go b/pkg/internal/apis/acme/validation/register.go new file mode 100644 index 000000000..6fff4ad3d --- /dev/null +++ b/pkg/internal/apis/acme/validation/register.go @@ -0,0 +1,32 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package validation + +import ( + "github.com/jetstack/cert-manager/pkg/internal/api/validation" + cmacme "github.com/jetstack/cert-manager/pkg/internal/apis/acme" +) + +func AddToValidationRegistry(reg *validation.Registry) error { + if err := reg.AddValidateUpdateFunc(&cmacme.Challenge{}, ValidateChallengeUpdate); err != nil { + return err + } + if err := reg.AddValidateUpdateFunc(&cmacme.Order{}, ValidateOrderUpdate); err != nil { + return err + } + return nil +} diff --git a/pkg/internal/apis/certmanager/BUILD.bazel b/pkg/internal/apis/certmanager/BUILD.bazel index 71c205215..a381a8d30 100644 --- a/pkg/internal/apis/certmanager/BUILD.bazel +++ b/pkg/internal/apis/certmanager/BUILD.bazel @@ -4,6 +4,7 @@ go_library( name = "go_default_library", srcs = [ "doc.go", + "generic_issuer.go", "register.go", "types.go", "types_certificate.go", @@ -37,6 +38,7 @@ filegroup( "//pkg/internal/apis/certmanager/fuzzer:all-srcs", "//pkg/internal/apis/certmanager/install:all-srcs", "//pkg/internal/apis/certmanager/v1alpha2:all-srcs", + "//pkg/internal/apis/certmanager/v1alpha3:all-srcs", "//pkg/internal/apis/certmanager/validation:all-srcs", ], tags = ["automanaged"], diff --git a/pkg/internal/apis/certmanager/generic_issuer.go b/pkg/internal/apis/certmanager/generic_issuer.go new file mode 100644 index 000000000..038cc825c --- /dev/null +++ b/pkg/internal/apis/certmanager/generic_issuer.go @@ -0,0 +1,85 @@ +/* +Copyright 2019 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package certmanager + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + + cmacme "github.com/jetstack/cert-manager/pkg/internal/apis/acme" +) + +type GenericIssuer interface { + runtime.Object + metav1.Object + + GetObjectMeta() *metav1.ObjectMeta + GetSpec() *IssuerSpec + GetStatus() *IssuerStatus +} + +var _ GenericIssuer = &Issuer{} +var _ GenericIssuer = &ClusterIssuer{} + +func (c *ClusterIssuer) GetObjectMeta() *metav1.ObjectMeta { + return &c.ObjectMeta +} +func (c *ClusterIssuer) GetSpec() *IssuerSpec { + return &c.Spec +} +func (c *ClusterIssuer) GetStatus() *IssuerStatus { + return &c.Status +} +func (c *ClusterIssuer) SetSpec(spec IssuerSpec) { + c.Spec = spec +} +func (c *ClusterIssuer) SetStatus(status IssuerStatus) { + c.Status = status +} +func (c *ClusterIssuer) Copy() GenericIssuer { + return c.DeepCopy() +} +func (c *Issuer) GetObjectMeta() *metav1.ObjectMeta { + return &c.ObjectMeta +} +func (c *Issuer) GetSpec() *IssuerSpec { + return &c.Spec +} +func (c *Issuer) GetStatus() *IssuerStatus { + return &c.Status +} +func (c *Issuer) SetSpec(spec IssuerSpec) { + c.Spec = spec +} +func (c *Issuer) SetStatus(status IssuerStatus) { + c.Status = status +} +func (c *Issuer) Copy() GenericIssuer { + return c.DeepCopy() +} + +// TODO: refactor these functions away +func (i *IssuerStatus) ACMEStatus() *cmacme.ACMEIssuerStatus { + // this is an edge case, but this will prevent panics + if i == nil { + return &cmacme.ACMEIssuerStatus{} + } + if i.ACME == nil { + i.ACME = &cmacme.ACMEIssuerStatus{} + } + return i.ACME +} diff --git a/pkg/internal/apis/certmanager/install/BUILD.bazel b/pkg/internal/apis/certmanager/install/BUILD.bazel index 6f2e90456..015005ca4 100644 --- a/pkg/internal/apis/certmanager/install/BUILD.bazel +++ b/pkg/internal/apis/certmanager/install/BUILD.bazel @@ -6,8 +6,11 @@ go_library( importpath = "github.com/jetstack/cert-manager/pkg/internal/apis/certmanager/install", visibility = ["//visibility:public"], deps = [ + "//pkg/internal/api/validation:go_default_library", "//pkg/internal/apis/certmanager:go_default_library", "//pkg/internal/apis/certmanager/v1alpha2:go_default_library", + "//pkg/internal/apis/certmanager/v1alpha3:go_default_library", + "//pkg/internal/apis/certmanager/validation:go_default_library", "@io_k8s_apimachinery//pkg/runtime:go_default_library", "@io_k8s_apimachinery//pkg/util/runtime:go_default_library", ], diff --git a/pkg/internal/apis/certmanager/install/install.go b/pkg/internal/apis/certmanager/install/install.go index 9f849479b..5a350fb10 100644 --- a/pkg/internal/apis/certmanager/install/install.go +++ b/pkg/internal/apis/certmanager/install/install.go @@ -22,12 +22,22 @@ import ( "k8s.io/apimachinery/pkg/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime" + "github.com/jetstack/cert-manager/pkg/internal/api/validation" "github.com/jetstack/cert-manager/pkg/internal/apis/certmanager" "github.com/jetstack/cert-manager/pkg/internal/apis/certmanager/v1alpha2" + "github.com/jetstack/cert-manager/pkg/internal/apis/certmanager/v1alpha3" + cmvalidation "github.com/jetstack/cert-manager/pkg/internal/apis/certmanager/validation" ) // Install registers the API group and adds types to a scheme func Install(scheme *runtime.Scheme) { utilruntime.Must(certmanager.AddToScheme(scheme)) utilruntime.Must(v1alpha2.AddToScheme(scheme)) + utilruntime.Must(v1alpha3.AddToScheme(scheme)) +} + +// InstallValidation registers validation functions for the API group with a +// validation registry +func InstallValidation(registry *validation.Registry) { + utilruntime.Must(cmvalidation.AddToValidationRegistry(registry)) } diff --git a/pkg/internal/apis/certmanager/v1alpha3/BUILD.bazel b/pkg/internal/apis/certmanager/v1alpha3/BUILD.bazel new file mode 100644 index 000000000..92f4ca045 --- /dev/null +++ b/pkg/internal/apis/certmanager/v1alpha3/BUILD.bazel @@ -0,0 +1,41 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "defaults.go", + "doc.go", + "register.go", + "zz_generated.conversion.go", + "zz_generated.defaults.go", + ], + importpath = "github.com/jetstack/cert-manager/pkg/internal/apis/certmanager/v1alpha3", + visibility = ["//pkg:__subpackages__"], + deps = [ + "//pkg/apis/acme/v1alpha3:go_default_library", + "//pkg/apis/certmanager:go_default_library", + "//pkg/apis/certmanager/v1alpha3:go_default_library", + "//pkg/apis/meta/v1:go_default_library", + "//pkg/internal/apis/acme:go_default_library", + "//pkg/internal/apis/certmanager:go_default_library", + "//pkg/internal/apis/meta:go_default_library", + "@io_k8s_apimachinery//pkg/apis/meta/v1:go_default_library", + "@io_k8s_apimachinery//pkg/conversion:go_default_library", + "@io_k8s_apimachinery//pkg/runtime:go_default_library", + "@io_k8s_apimachinery//pkg/runtime/schema:go_default_library", + ], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/pkg/internal/apis/certmanager/v1alpha3/defaults.go b/pkg/internal/apis/certmanager/v1alpha3/defaults.go new file mode 100644 index 000000000..553de4ab9 --- /dev/null +++ b/pkg/internal/apis/certmanager/v1alpha3/defaults.go @@ -0,0 +1,25 @@ +/* +Copyright 2019 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha3 + +import ( + "k8s.io/apimachinery/pkg/runtime" +) + +func addDefaultingFuncs(scheme *runtime.Scheme) error { + return RegisterDefaults(scheme) +} diff --git a/pkg/internal/apis/certmanager/v1alpha3/doc.go b/pkg/internal/apis/certmanager/v1alpha3/doc.go new file mode 100644 index 000000000..0af203a66 --- /dev/null +++ b/pkg/internal/apis/certmanager/v1alpha3/doc.go @@ -0,0 +1,23 @@ +/* +Copyright 2019 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +k8s:conversion-gen=github.com/jetstack/cert-manager/pkg/internal/apis/certmanager +// +k8s:conversion-gen-external-types=github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha3 +// +k8s:defaulter-gen=TypeMeta +// +k8s:defaulter-gen-input=../../../../apis/certmanager/v1alpha3 + +// +groupName=cert-manager.io +package v1alpha3 diff --git a/pkg/internal/apis/certmanager/v1alpha3/register.go b/pkg/internal/apis/certmanager/v1alpha3/register.go new file mode 100644 index 000000000..b093b8582 --- /dev/null +++ b/pkg/internal/apis/certmanager/v1alpha3/register.go @@ -0,0 +1,44 @@ +/* +Copyright 2019 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha3 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + + "github.com/jetstack/cert-manager/pkg/apis/certmanager" + cmapi "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha3" +) + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: certmanager.GroupName, Version: "v1alpha3"} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + localSchemeBuilder = &cmapi.SchemeBuilder + AddToScheme = localSchemeBuilder.AddToScheme +) + +func init() { + // We only register manually written functions here. The registration of the + // generated functions takes place in the generated files. The separation + // makes the code compile even when the generated files are missing. + localSchemeBuilder.Register(addDefaultingFuncs) +} diff --git a/pkg/internal/apis/certmanager/v1alpha3/zz_generated.conversion.go b/pkg/internal/apis/certmanager/v1alpha3/zz_generated.conversion.go new file mode 100644 index 000000000..ac3fb2281 --- /dev/null +++ b/pkg/internal/apis/certmanager/v1alpha3/zz_generated.conversion.go @@ -0,0 +1,1103 @@ +// +build !ignore_autogenerated + +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by conversion-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + unsafe "unsafe" + + acmev1alpha3 "github.com/jetstack/cert-manager/pkg/apis/acme/v1alpha3" + v1alpha3 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha3" + metav1 "github.com/jetstack/cert-manager/pkg/apis/meta/v1" + acme "github.com/jetstack/cert-manager/pkg/internal/apis/acme" + certmanager "github.com/jetstack/cert-manager/pkg/internal/apis/certmanager" + meta "github.com/jetstack/cert-manager/pkg/internal/apis/meta" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +func init() { + localSchemeBuilder.Register(RegisterConversions) +} + +// RegisterConversions adds conversion functions to the given scheme. +// Public to allow building arbitrary schemes. +func RegisterConversions(s *runtime.Scheme) error { + if err := s.AddGeneratedConversionFunc((*v1alpha3.CAIssuer)(nil), (*certmanager.CAIssuer)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_CAIssuer_To_certmanager_CAIssuer(a.(*v1alpha3.CAIssuer), b.(*certmanager.CAIssuer), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*certmanager.CAIssuer)(nil), (*v1alpha3.CAIssuer)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_certmanager_CAIssuer_To_v1alpha3_CAIssuer(a.(*certmanager.CAIssuer), b.(*v1alpha3.CAIssuer), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.Certificate)(nil), (*certmanager.Certificate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_Certificate_To_certmanager_Certificate(a.(*v1alpha3.Certificate), b.(*certmanager.Certificate), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*certmanager.Certificate)(nil), (*v1alpha3.Certificate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_certmanager_Certificate_To_v1alpha3_Certificate(a.(*certmanager.Certificate), b.(*v1alpha3.Certificate), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.CertificateCondition)(nil), (*certmanager.CertificateCondition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_CertificateCondition_To_certmanager_CertificateCondition(a.(*v1alpha3.CertificateCondition), b.(*certmanager.CertificateCondition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*certmanager.CertificateCondition)(nil), (*v1alpha3.CertificateCondition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_certmanager_CertificateCondition_To_v1alpha3_CertificateCondition(a.(*certmanager.CertificateCondition), b.(*v1alpha3.CertificateCondition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.CertificateList)(nil), (*certmanager.CertificateList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_CertificateList_To_certmanager_CertificateList(a.(*v1alpha3.CertificateList), b.(*certmanager.CertificateList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*certmanager.CertificateList)(nil), (*v1alpha3.CertificateList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_certmanager_CertificateList_To_v1alpha3_CertificateList(a.(*certmanager.CertificateList), b.(*v1alpha3.CertificateList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.CertificateRequest)(nil), (*certmanager.CertificateRequest)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_CertificateRequest_To_certmanager_CertificateRequest(a.(*v1alpha3.CertificateRequest), b.(*certmanager.CertificateRequest), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*certmanager.CertificateRequest)(nil), (*v1alpha3.CertificateRequest)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_certmanager_CertificateRequest_To_v1alpha3_CertificateRequest(a.(*certmanager.CertificateRequest), b.(*v1alpha3.CertificateRequest), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.CertificateRequestCondition)(nil), (*certmanager.CertificateRequestCondition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_CertificateRequestCondition_To_certmanager_CertificateRequestCondition(a.(*v1alpha3.CertificateRequestCondition), b.(*certmanager.CertificateRequestCondition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*certmanager.CertificateRequestCondition)(nil), (*v1alpha3.CertificateRequestCondition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_certmanager_CertificateRequestCondition_To_v1alpha3_CertificateRequestCondition(a.(*certmanager.CertificateRequestCondition), b.(*v1alpha3.CertificateRequestCondition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.CertificateRequestList)(nil), (*certmanager.CertificateRequestList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_CertificateRequestList_To_certmanager_CertificateRequestList(a.(*v1alpha3.CertificateRequestList), b.(*certmanager.CertificateRequestList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*certmanager.CertificateRequestList)(nil), (*v1alpha3.CertificateRequestList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_certmanager_CertificateRequestList_To_v1alpha3_CertificateRequestList(a.(*certmanager.CertificateRequestList), b.(*v1alpha3.CertificateRequestList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.CertificateRequestSpec)(nil), (*certmanager.CertificateRequestSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_CertificateRequestSpec_To_certmanager_CertificateRequestSpec(a.(*v1alpha3.CertificateRequestSpec), b.(*certmanager.CertificateRequestSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*certmanager.CertificateRequestSpec)(nil), (*v1alpha3.CertificateRequestSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_certmanager_CertificateRequestSpec_To_v1alpha3_CertificateRequestSpec(a.(*certmanager.CertificateRequestSpec), b.(*v1alpha3.CertificateRequestSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.CertificateRequestStatus)(nil), (*certmanager.CertificateRequestStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_CertificateRequestStatus_To_certmanager_CertificateRequestStatus(a.(*v1alpha3.CertificateRequestStatus), b.(*certmanager.CertificateRequestStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*certmanager.CertificateRequestStatus)(nil), (*v1alpha3.CertificateRequestStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_certmanager_CertificateRequestStatus_To_v1alpha3_CertificateRequestStatus(a.(*certmanager.CertificateRequestStatus), b.(*v1alpha3.CertificateRequestStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.CertificateSpec)(nil), (*certmanager.CertificateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_CertificateSpec_To_certmanager_CertificateSpec(a.(*v1alpha3.CertificateSpec), b.(*certmanager.CertificateSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*certmanager.CertificateSpec)(nil), (*v1alpha3.CertificateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_certmanager_CertificateSpec_To_v1alpha3_CertificateSpec(a.(*certmanager.CertificateSpec), b.(*v1alpha3.CertificateSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.CertificateStatus)(nil), (*certmanager.CertificateStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_CertificateStatus_To_certmanager_CertificateStatus(a.(*v1alpha3.CertificateStatus), b.(*certmanager.CertificateStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*certmanager.CertificateStatus)(nil), (*v1alpha3.CertificateStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_certmanager_CertificateStatus_To_v1alpha3_CertificateStatus(a.(*certmanager.CertificateStatus), b.(*v1alpha3.CertificateStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.ClusterIssuer)(nil), (*certmanager.ClusterIssuer)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ClusterIssuer_To_certmanager_ClusterIssuer(a.(*v1alpha3.ClusterIssuer), b.(*certmanager.ClusterIssuer), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*certmanager.ClusterIssuer)(nil), (*v1alpha3.ClusterIssuer)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_certmanager_ClusterIssuer_To_v1alpha3_ClusterIssuer(a.(*certmanager.ClusterIssuer), b.(*v1alpha3.ClusterIssuer), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.ClusterIssuerList)(nil), (*certmanager.ClusterIssuerList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ClusterIssuerList_To_certmanager_ClusterIssuerList(a.(*v1alpha3.ClusterIssuerList), b.(*certmanager.ClusterIssuerList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*certmanager.ClusterIssuerList)(nil), (*v1alpha3.ClusterIssuerList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_certmanager_ClusterIssuerList_To_v1alpha3_ClusterIssuerList(a.(*certmanager.ClusterIssuerList), b.(*v1alpha3.ClusterIssuerList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.Issuer)(nil), (*certmanager.Issuer)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_Issuer_To_certmanager_Issuer(a.(*v1alpha3.Issuer), b.(*certmanager.Issuer), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*certmanager.Issuer)(nil), (*v1alpha3.Issuer)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_certmanager_Issuer_To_v1alpha3_Issuer(a.(*certmanager.Issuer), b.(*v1alpha3.Issuer), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.IssuerCondition)(nil), (*certmanager.IssuerCondition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_IssuerCondition_To_certmanager_IssuerCondition(a.(*v1alpha3.IssuerCondition), b.(*certmanager.IssuerCondition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*certmanager.IssuerCondition)(nil), (*v1alpha3.IssuerCondition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_certmanager_IssuerCondition_To_v1alpha3_IssuerCondition(a.(*certmanager.IssuerCondition), b.(*v1alpha3.IssuerCondition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.IssuerConfig)(nil), (*certmanager.IssuerConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_IssuerConfig_To_certmanager_IssuerConfig(a.(*v1alpha3.IssuerConfig), b.(*certmanager.IssuerConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*certmanager.IssuerConfig)(nil), (*v1alpha3.IssuerConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_certmanager_IssuerConfig_To_v1alpha3_IssuerConfig(a.(*certmanager.IssuerConfig), b.(*v1alpha3.IssuerConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.IssuerList)(nil), (*certmanager.IssuerList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_IssuerList_To_certmanager_IssuerList(a.(*v1alpha3.IssuerList), b.(*certmanager.IssuerList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*certmanager.IssuerList)(nil), (*v1alpha3.IssuerList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_certmanager_IssuerList_To_v1alpha3_IssuerList(a.(*certmanager.IssuerList), b.(*v1alpha3.IssuerList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.IssuerSpec)(nil), (*certmanager.IssuerSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_IssuerSpec_To_certmanager_IssuerSpec(a.(*v1alpha3.IssuerSpec), b.(*certmanager.IssuerSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*certmanager.IssuerSpec)(nil), (*v1alpha3.IssuerSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_certmanager_IssuerSpec_To_v1alpha3_IssuerSpec(a.(*certmanager.IssuerSpec), b.(*v1alpha3.IssuerSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.IssuerStatus)(nil), (*certmanager.IssuerStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_IssuerStatus_To_certmanager_IssuerStatus(a.(*v1alpha3.IssuerStatus), b.(*certmanager.IssuerStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*certmanager.IssuerStatus)(nil), (*v1alpha3.IssuerStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_certmanager_IssuerStatus_To_v1alpha3_IssuerStatus(a.(*certmanager.IssuerStatus), b.(*v1alpha3.IssuerStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.SelfSignedIssuer)(nil), (*certmanager.SelfSignedIssuer)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_SelfSignedIssuer_To_certmanager_SelfSignedIssuer(a.(*v1alpha3.SelfSignedIssuer), b.(*certmanager.SelfSignedIssuer), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*certmanager.SelfSignedIssuer)(nil), (*v1alpha3.SelfSignedIssuer)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_certmanager_SelfSignedIssuer_To_v1alpha3_SelfSignedIssuer(a.(*certmanager.SelfSignedIssuer), b.(*v1alpha3.SelfSignedIssuer), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.VaultAppRole)(nil), (*certmanager.VaultAppRole)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_VaultAppRole_To_certmanager_VaultAppRole(a.(*v1alpha3.VaultAppRole), b.(*certmanager.VaultAppRole), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*certmanager.VaultAppRole)(nil), (*v1alpha3.VaultAppRole)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_certmanager_VaultAppRole_To_v1alpha3_VaultAppRole(a.(*certmanager.VaultAppRole), b.(*v1alpha3.VaultAppRole), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.VaultAuth)(nil), (*certmanager.VaultAuth)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_VaultAuth_To_certmanager_VaultAuth(a.(*v1alpha3.VaultAuth), b.(*certmanager.VaultAuth), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*certmanager.VaultAuth)(nil), (*v1alpha3.VaultAuth)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_certmanager_VaultAuth_To_v1alpha3_VaultAuth(a.(*certmanager.VaultAuth), b.(*v1alpha3.VaultAuth), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.VaultIssuer)(nil), (*certmanager.VaultIssuer)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_VaultIssuer_To_certmanager_VaultIssuer(a.(*v1alpha3.VaultIssuer), b.(*certmanager.VaultIssuer), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*certmanager.VaultIssuer)(nil), (*v1alpha3.VaultIssuer)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_certmanager_VaultIssuer_To_v1alpha3_VaultIssuer(a.(*certmanager.VaultIssuer), b.(*v1alpha3.VaultIssuer), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.VaultKubernetesAuth)(nil), (*certmanager.VaultKubernetesAuth)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_VaultKubernetesAuth_To_certmanager_VaultKubernetesAuth(a.(*v1alpha3.VaultKubernetesAuth), b.(*certmanager.VaultKubernetesAuth), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*certmanager.VaultKubernetesAuth)(nil), (*v1alpha3.VaultKubernetesAuth)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_certmanager_VaultKubernetesAuth_To_v1alpha3_VaultKubernetesAuth(a.(*certmanager.VaultKubernetesAuth), b.(*v1alpha3.VaultKubernetesAuth), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.VenafiCloud)(nil), (*certmanager.VenafiCloud)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_VenafiCloud_To_certmanager_VenafiCloud(a.(*v1alpha3.VenafiCloud), b.(*certmanager.VenafiCloud), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*certmanager.VenafiCloud)(nil), (*v1alpha3.VenafiCloud)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_certmanager_VenafiCloud_To_v1alpha3_VenafiCloud(a.(*certmanager.VenafiCloud), b.(*v1alpha3.VenafiCloud), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.VenafiIssuer)(nil), (*certmanager.VenafiIssuer)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_VenafiIssuer_To_certmanager_VenafiIssuer(a.(*v1alpha3.VenafiIssuer), b.(*certmanager.VenafiIssuer), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*certmanager.VenafiIssuer)(nil), (*v1alpha3.VenafiIssuer)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_certmanager_VenafiIssuer_To_v1alpha3_VenafiIssuer(a.(*certmanager.VenafiIssuer), b.(*v1alpha3.VenafiIssuer), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.VenafiTPP)(nil), (*certmanager.VenafiTPP)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_VenafiTPP_To_certmanager_VenafiTPP(a.(*v1alpha3.VenafiTPP), b.(*certmanager.VenafiTPP), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*certmanager.VenafiTPP)(nil), (*v1alpha3.VenafiTPP)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_certmanager_VenafiTPP_To_v1alpha3_VenafiTPP(a.(*certmanager.VenafiTPP), b.(*v1alpha3.VenafiTPP), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha3.X509Subject)(nil), (*certmanager.X509Subject)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_X509Subject_To_certmanager_X509Subject(a.(*v1alpha3.X509Subject), b.(*certmanager.X509Subject), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*certmanager.X509Subject)(nil), (*v1alpha3.X509Subject)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_certmanager_X509Subject_To_v1alpha3_X509Subject(a.(*certmanager.X509Subject), b.(*v1alpha3.X509Subject), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1alpha3_CAIssuer_To_certmanager_CAIssuer(in *v1alpha3.CAIssuer, out *certmanager.CAIssuer, s conversion.Scope) error { + out.SecretName = in.SecretName + return nil +} + +// Convert_v1alpha3_CAIssuer_To_certmanager_CAIssuer is an autogenerated conversion function. +func Convert_v1alpha3_CAIssuer_To_certmanager_CAIssuer(in *v1alpha3.CAIssuer, out *certmanager.CAIssuer, s conversion.Scope) error { + return autoConvert_v1alpha3_CAIssuer_To_certmanager_CAIssuer(in, out, s) +} + +func autoConvert_certmanager_CAIssuer_To_v1alpha3_CAIssuer(in *certmanager.CAIssuer, out *v1alpha3.CAIssuer, s conversion.Scope) error { + out.SecretName = in.SecretName + return nil +} + +// Convert_certmanager_CAIssuer_To_v1alpha3_CAIssuer is an autogenerated conversion function. +func Convert_certmanager_CAIssuer_To_v1alpha3_CAIssuer(in *certmanager.CAIssuer, out *v1alpha3.CAIssuer, s conversion.Scope) error { + return autoConvert_certmanager_CAIssuer_To_v1alpha3_CAIssuer(in, out, s) +} + +func autoConvert_v1alpha3_Certificate_To_certmanager_Certificate(in *v1alpha3.Certificate, out *certmanager.Certificate, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha3_CertificateSpec_To_certmanager_CertificateSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha3_CertificateStatus_To_certmanager_CertificateStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_Certificate_To_certmanager_Certificate is an autogenerated conversion function. +func Convert_v1alpha3_Certificate_To_certmanager_Certificate(in *v1alpha3.Certificate, out *certmanager.Certificate, s conversion.Scope) error { + return autoConvert_v1alpha3_Certificate_To_certmanager_Certificate(in, out, s) +} + +func autoConvert_certmanager_Certificate_To_v1alpha3_Certificate(in *certmanager.Certificate, out *v1alpha3.Certificate, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_certmanager_CertificateSpec_To_v1alpha3_CertificateSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_certmanager_CertificateStatus_To_v1alpha3_CertificateStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_certmanager_Certificate_To_v1alpha3_Certificate is an autogenerated conversion function. +func Convert_certmanager_Certificate_To_v1alpha3_Certificate(in *certmanager.Certificate, out *v1alpha3.Certificate, s conversion.Scope) error { + return autoConvert_certmanager_Certificate_To_v1alpha3_Certificate(in, out, s) +} + +func autoConvert_v1alpha3_CertificateCondition_To_certmanager_CertificateCondition(in *v1alpha3.CertificateCondition, out *certmanager.CertificateCondition, s conversion.Scope) error { + out.Type = certmanager.CertificateConditionType(in.Type) + out.Status = meta.ConditionStatus(in.Status) + out.LastTransitionTime = (*v1.Time)(unsafe.Pointer(in.LastTransitionTime)) + out.Reason = in.Reason + out.Message = in.Message + return nil +} + +// Convert_v1alpha3_CertificateCondition_To_certmanager_CertificateCondition is an autogenerated conversion function. +func Convert_v1alpha3_CertificateCondition_To_certmanager_CertificateCondition(in *v1alpha3.CertificateCondition, out *certmanager.CertificateCondition, s conversion.Scope) error { + return autoConvert_v1alpha3_CertificateCondition_To_certmanager_CertificateCondition(in, out, s) +} + +func autoConvert_certmanager_CertificateCondition_To_v1alpha3_CertificateCondition(in *certmanager.CertificateCondition, out *v1alpha3.CertificateCondition, s conversion.Scope) error { + out.Type = v1alpha3.CertificateConditionType(in.Type) + out.Status = metav1.ConditionStatus(in.Status) + out.LastTransitionTime = (*v1.Time)(unsafe.Pointer(in.LastTransitionTime)) + out.Reason = in.Reason + out.Message = in.Message + return nil +} + +// Convert_certmanager_CertificateCondition_To_v1alpha3_CertificateCondition is an autogenerated conversion function. +func Convert_certmanager_CertificateCondition_To_v1alpha3_CertificateCondition(in *certmanager.CertificateCondition, out *v1alpha3.CertificateCondition, s conversion.Scope) error { + return autoConvert_certmanager_CertificateCondition_To_v1alpha3_CertificateCondition(in, out, s) +} + +func autoConvert_v1alpha3_CertificateList_To_certmanager_CertificateList(in *v1alpha3.CertificateList, out *certmanager.CertificateList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]certmanager.Certificate)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha3_CertificateList_To_certmanager_CertificateList is an autogenerated conversion function. +func Convert_v1alpha3_CertificateList_To_certmanager_CertificateList(in *v1alpha3.CertificateList, out *certmanager.CertificateList, s conversion.Scope) error { + return autoConvert_v1alpha3_CertificateList_To_certmanager_CertificateList(in, out, s) +} + +func autoConvert_certmanager_CertificateList_To_v1alpha3_CertificateList(in *certmanager.CertificateList, out *v1alpha3.CertificateList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]v1alpha3.Certificate)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_certmanager_CertificateList_To_v1alpha3_CertificateList is an autogenerated conversion function. +func Convert_certmanager_CertificateList_To_v1alpha3_CertificateList(in *certmanager.CertificateList, out *v1alpha3.CertificateList, s conversion.Scope) error { + return autoConvert_certmanager_CertificateList_To_v1alpha3_CertificateList(in, out, s) +} + +func autoConvert_v1alpha3_CertificateRequest_To_certmanager_CertificateRequest(in *v1alpha3.CertificateRequest, out *certmanager.CertificateRequest, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha3_CertificateRequestSpec_To_certmanager_CertificateRequestSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha3_CertificateRequestStatus_To_certmanager_CertificateRequestStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_CertificateRequest_To_certmanager_CertificateRequest is an autogenerated conversion function. +func Convert_v1alpha3_CertificateRequest_To_certmanager_CertificateRequest(in *v1alpha3.CertificateRequest, out *certmanager.CertificateRequest, s conversion.Scope) error { + return autoConvert_v1alpha3_CertificateRequest_To_certmanager_CertificateRequest(in, out, s) +} + +func autoConvert_certmanager_CertificateRequest_To_v1alpha3_CertificateRequest(in *certmanager.CertificateRequest, out *v1alpha3.CertificateRequest, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_certmanager_CertificateRequestSpec_To_v1alpha3_CertificateRequestSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_certmanager_CertificateRequestStatus_To_v1alpha3_CertificateRequestStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_certmanager_CertificateRequest_To_v1alpha3_CertificateRequest is an autogenerated conversion function. +func Convert_certmanager_CertificateRequest_To_v1alpha3_CertificateRequest(in *certmanager.CertificateRequest, out *v1alpha3.CertificateRequest, s conversion.Scope) error { + return autoConvert_certmanager_CertificateRequest_To_v1alpha3_CertificateRequest(in, out, s) +} + +func autoConvert_v1alpha3_CertificateRequestCondition_To_certmanager_CertificateRequestCondition(in *v1alpha3.CertificateRequestCondition, out *certmanager.CertificateRequestCondition, s conversion.Scope) error { + out.Type = certmanager.CertificateRequestConditionType(in.Type) + out.Status = meta.ConditionStatus(in.Status) + out.LastTransitionTime = (*v1.Time)(unsafe.Pointer(in.LastTransitionTime)) + out.Reason = in.Reason + out.Message = in.Message + return nil +} + +// Convert_v1alpha3_CertificateRequestCondition_To_certmanager_CertificateRequestCondition is an autogenerated conversion function. +func Convert_v1alpha3_CertificateRequestCondition_To_certmanager_CertificateRequestCondition(in *v1alpha3.CertificateRequestCondition, out *certmanager.CertificateRequestCondition, s conversion.Scope) error { + return autoConvert_v1alpha3_CertificateRequestCondition_To_certmanager_CertificateRequestCondition(in, out, s) +} + +func autoConvert_certmanager_CertificateRequestCondition_To_v1alpha3_CertificateRequestCondition(in *certmanager.CertificateRequestCondition, out *v1alpha3.CertificateRequestCondition, s conversion.Scope) error { + out.Type = v1alpha3.CertificateRequestConditionType(in.Type) + out.Status = metav1.ConditionStatus(in.Status) + out.LastTransitionTime = (*v1.Time)(unsafe.Pointer(in.LastTransitionTime)) + out.Reason = in.Reason + out.Message = in.Message + return nil +} + +// Convert_certmanager_CertificateRequestCondition_To_v1alpha3_CertificateRequestCondition is an autogenerated conversion function. +func Convert_certmanager_CertificateRequestCondition_To_v1alpha3_CertificateRequestCondition(in *certmanager.CertificateRequestCondition, out *v1alpha3.CertificateRequestCondition, s conversion.Scope) error { + return autoConvert_certmanager_CertificateRequestCondition_To_v1alpha3_CertificateRequestCondition(in, out, s) +} + +func autoConvert_v1alpha3_CertificateRequestList_To_certmanager_CertificateRequestList(in *v1alpha3.CertificateRequestList, out *certmanager.CertificateRequestList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]certmanager.CertificateRequest)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha3_CertificateRequestList_To_certmanager_CertificateRequestList is an autogenerated conversion function. +func Convert_v1alpha3_CertificateRequestList_To_certmanager_CertificateRequestList(in *v1alpha3.CertificateRequestList, out *certmanager.CertificateRequestList, s conversion.Scope) error { + return autoConvert_v1alpha3_CertificateRequestList_To_certmanager_CertificateRequestList(in, out, s) +} + +func autoConvert_certmanager_CertificateRequestList_To_v1alpha3_CertificateRequestList(in *certmanager.CertificateRequestList, out *v1alpha3.CertificateRequestList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]v1alpha3.CertificateRequest)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_certmanager_CertificateRequestList_To_v1alpha3_CertificateRequestList is an autogenerated conversion function. +func Convert_certmanager_CertificateRequestList_To_v1alpha3_CertificateRequestList(in *certmanager.CertificateRequestList, out *v1alpha3.CertificateRequestList, s conversion.Scope) error { + return autoConvert_certmanager_CertificateRequestList_To_v1alpha3_CertificateRequestList(in, out, s) +} + +func autoConvert_v1alpha3_CertificateRequestSpec_To_certmanager_CertificateRequestSpec(in *v1alpha3.CertificateRequestSpec, out *certmanager.CertificateRequestSpec, s conversion.Scope) error { + out.Duration = (*v1.Duration)(unsafe.Pointer(in.Duration)) + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.IssuerRef, &out.IssuerRef, 0); err != nil { + return err + } + out.CSRPEM = *(*[]byte)(unsafe.Pointer(&in.CSRPEM)) + out.IsCA = in.IsCA + out.Usages = *(*[]certmanager.KeyUsage)(unsafe.Pointer(&in.Usages)) + return nil +} + +// Convert_v1alpha3_CertificateRequestSpec_To_certmanager_CertificateRequestSpec is an autogenerated conversion function. +func Convert_v1alpha3_CertificateRequestSpec_To_certmanager_CertificateRequestSpec(in *v1alpha3.CertificateRequestSpec, out *certmanager.CertificateRequestSpec, s conversion.Scope) error { + return autoConvert_v1alpha3_CertificateRequestSpec_To_certmanager_CertificateRequestSpec(in, out, s) +} + +func autoConvert_certmanager_CertificateRequestSpec_To_v1alpha3_CertificateRequestSpec(in *certmanager.CertificateRequestSpec, out *v1alpha3.CertificateRequestSpec, s conversion.Scope) error { + out.Duration = (*v1.Duration)(unsafe.Pointer(in.Duration)) + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.IssuerRef, &out.IssuerRef, 0); err != nil { + return err + } + out.CSRPEM = *(*[]byte)(unsafe.Pointer(&in.CSRPEM)) + out.IsCA = in.IsCA + out.Usages = *(*[]v1alpha3.KeyUsage)(unsafe.Pointer(&in.Usages)) + return nil +} + +// Convert_certmanager_CertificateRequestSpec_To_v1alpha3_CertificateRequestSpec is an autogenerated conversion function. +func Convert_certmanager_CertificateRequestSpec_To_v1alpha3_CertificateRequestSpec(in *certmanager.CertificateRequestSpec, out *v1alpha3.CertificateRequestSpec, s conversion.Scope) error { + return autoConvert_certmanager_CertificateRequestSpec_To_v1alpha3_CertificateRequestSpec(in, out, s) +} + +func autoConvert_v1alpha3_CertificateRequestStatus_To_certmanager_CertificateRequestStatus(in *v1alpha3.CertificateRequestStatus, out *certmanager.CertificateRequestStatus, s conversion.Scope) error { + out.Conditions = *(*[]certmanager.CertificateRequestCondition)(unsafe.Pointer(&in.Conditions)) + out.Certificate = *(*[]byte)(unsafe.Pointer(&in.Certificate)) + out.CA = *(*[]byte)(unsafe.Pointer(&in.CA)) + out.FailureTime = (*v1.Time)(unsafe.Pointer(in.FailureTime)) + return nil +} + +// Convert_v1alpha3_CertificateRequestStatus_To_certmanager_CertificateRequestStatus is an autogenerated conversion function. +func Convert_v1alpha3_CertificateRequestStatus_To_certmanager_CertificateRequestStatus(in *v1alpha3.CertificateRequestStatus, out *certmanager.CertificateRequestStatus, s conversion.Scope) error { + return autoConvert_v1alpha3_CertificateRequestStatus_To_certmanager_CertificateRequestStatus(in, out, s) +} + +func autoConvert_certmanager_CertificateRequestStatus_To_v1alpha3_CertificateRequestStatus(in *certmanager.CertificateRequestStatus, out *v1alpha3.CertificateRequestStatus, s conversion.Scope) error { + out.Conditions = *(*[]v1alpha3.CertificateRequestCondition)(unsafe.Pointer(&in.Conditions)) + out.Certificate = *(*[]byte)(unsafe.Pointer(&in.Certificate)) + out.CA = *(*[]byte)(unsafe.Pointer(&in.CA)) + out.FailureTime = (*v1.Time)(unsafe.Pointer(in.FailureTime)) + return nil +} + +// Convert_certmanager_CertificateRequestStatus_To_v1alpha3_CertificateRequestStatus is an autogenerated conversion function. +func Convert_certmanager_CertificateRequestStatus_To_v1alpha3_CertificateRequestStatus(in *certmanager.CertificateRequestStatus, out *v1alpha3.CertificateRequestStatus, s conversion.Scope) error { + return autoConvert_certmanager_CertificateRequestStatus_To_v1alpha3_CertificateRequestStatus(in, out, s) +} + +func autoConvert_v1alpha3_CertificateSpec_To_certmanager_CertificateSpec(in *v1alpha3.CertificateSpec, out *certmanager.CertificateSpec, s conversion.Scope) error { + out.Subject = (*certmanager.X509Subject)(unsafe.Pointer(in.Subject)) + out.CommonName = in.CommonName + out.Organization = *(*[]string)(unsafe.Pointer(&in.Organization)) + out.Duration = (*v1.Duration)(unsafe.Pointer(in.Duration)) + out.RenewBefore = (*v1.Duration)(unsafe.Pointer(in.RenewBefore)) + out.DNSNames = *(*[]string)(unsafe.Pointer(&in.DNSNames)) + out.IPAddresses = *(*[]string)(unsafe.Pointer(&in.IPAddresses)) + out.URISANs = *(*[]string)(unsafe.Pointer(&in.URISANs)) + out.SecretName = in.SecretName + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.IssuerRef, &out.IssuerRef, 0); err != nil { + return err + } + out.IsCA = in.IsCA + out.Usages = *(*[]certmanager.KeyUsage)(unsafe.Pointer(&in.Usages)) + out.KeySize = in.KeySize + out.KeyAlgorithm = certmanager.KeyAlgorithm(in.KeyAlgorithm) + out.KeyEncoding = certmanager.KeyEncoding(in.KeyEncoding) + return nil +} + +// Convert_v1alpha3_CertificateSpec_To_certmanager_CertificateSpec is an autogenerated conversion function. +func Convert_v1alpha3_CertificateSpec_To_certmanager_CertificateSpec(in *v1alpha3.CertificateSpec, out *certmanager.CertificateSpec, s conversion.Scope) error { + return autoConvert_v1alpha3_CertificateSpec_To_certmanager_CertificateSpec(in, out, s) +} + +func autoConvert_certmanager_CertificateSpec_To_v1alpha3_CertificateSpec(in *certmanager.CertificateSpec, out *v1alpha3.CertificateSpec, s conversion.Scope) error { + out.Subject = (*v1alpha3.X509Subject)(unsafe.Pointer(in.Subject)) + out.CommonName = in.CommonName + out.Organization = *(*[]string)(unsafe.Pointer(&in.Organization)) + out.Duration = (*v1.Duration)(unsafe.Pointer(in.Duration)) + out.RenewBefore = (*v1.Duration)(unsafe.Pointer(in.RenewBefore)) + out.DNSNames = *(*[]string)(unsafe.Pointer(&in.DNSNames)) + out.IPAddresses = *(*[]string)(unsafe.Pointer(&in.IPAddresses)) + out.URISANs = *(*[]string)(unsafe.Pointer(&in.URISANs)) + out.SecretName = in.SecretName + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.IssuerRef, &out.IssuerRef, 0); err != nil { + return err + } + out.IsCA = in.IsCA + out.Usages = *(*[]v1alpha3.KeyUsage)(unsafe.Pointer(&in.Usages)) + out.KeySize = in.KeySize + out.KeyAlgorithm = v1alpha3.KeyAlgorithm(in.KeyAlgorithm) + out.KeyEncoding = v1alpha3.KeyEncoding(in.KeyEncoding) + return nil +} + +// Convert_certmanager_CertificateSpec_To_v1alpha3_CertificateSpec is an autogenerated conversion function. +func Convert_certmanager_CertificateSpec_To_v1alpha3_CertificateSpec(in *certmanager.CertificateSpec, out *v1alpha3.CertificateSpec, s conversion.Scope) error { + return autoConvert_certmanager_CertificateSpec_To_v1alpha3_CertificateSpec(in, out, s) +} + +func autoConvert_v1alpha3_CertificateStatus_To_certmanager_CertificateStatus(in *v1alpha3.CertificateStatus, out *certmanager.CertificateStatus, s conversion.Scope) error { + out.Conditions = *(*[]certmanager.CertificateCondition)(unsafe.Pointer(&in.Conditions)) + out.LastFailureTime = (*v1.Time)(unsafe.Pointer(in.LastFailureTime)) + out.NotAfter = (*v1.Time)(unsafe.Pointer(in.NotAfter)) + return nil +} + +// Convert_v1alpha3_CertificateStatus_To_certmanager_CertificateStatus is an autogenerated conversion function. +func Convert_v1alpha3_CertificateStatus_To_certmanager_CertificateStatus(in *v1alpha3.CertificateStatus, out *certmanager.CertificateStatus, s conversion.Scope) error { + return autoConvert_v1alpha3_CertificateStatus_To_certmanager_CertificateStatus(in, out, s) +} + +func autoConvert_certmanager_CertificateStatus_To_v1alpha3_CertificateStatus(in *certmanager.CertificateStatus, out *v1alpha3.CertificateStatus, s conversion.Scope) error { + out.Conditions = *(*[]v1alpha3.CertificateCondition)(unsafe.Pointer(&in.Conditions)) + out.LastFailureTime = (*v1.Time)(unsafe.Pointer(in.LastFailureTime)) + out.NotAfter = (*v1.Time)(unsafe.Pointer(in.NotAfter)) + return nil +} + +// Convert_certmanager_CertificateStatus_To_v1alpha3_CertificateStatus is an autogenerated conversion function. +func Convert_certmanager_CertificateStatus_To_v1alpha3_CertificateStatus(in *certmanager.CertificateStatus, out *v1alpha3.CertificateStatus, s conversion.Scope) error { + return autoConvert_certmanager_CertificateStatus_To_v1alpha3_CertificateStatus(in, out, s) +} + +func autoConvert_v1alpha3_ClusterIssuer_To_certmanager_ClusterIssuer(in *v1alpha3.ClusterIssuer, out *certmanager.ClusterIssuer, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha3_IssuerSpec_To_certmanager_IssuerSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha3_IssuerStatus_To_certmanager_IssuerStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_ClusterIssuer_To_certmanager_ClusterIssuer is an autogenerated conversion function. +func Convert_v1alpha3_ClusterIssuer_To_certmanager_ClusterIssuer(in *v1alpha3.ClusterIssuer, out *certmanager.ClusterIssuer, s conversion.Scope) error { + return autoConvert_v1alpha3_ClusterIssuer_To_certmanager_ClusterIssuer(in, out, s) +} + +func autoConvert_certmanager_ClusterIssuer_To_v1alpha3_ClusterIssuer(in *certmanager.ClusterIssuer, out *v1alpha3.ClusterIssuer, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_certmanager_IssuerSpec_To_v1alpha3_IssuerSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_certmanager_IssuerStatus_To_v1alpha3_IssuerStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_certmanager_ClusterIssuer_To_v1alpha3_ClusterIssuer is an autogenerated conversion function. +func Convert_certmanager_ClusterIssuer_To_v1alpha3_ClusterIssuer(in *certmanager.ClusterIssuer, out *v1alpha3.ClusterIssuer, s conversion.Scope) error { + return autoConvert_certmanager_ClusterIssuer_To_v1alpha3_ClusterIssuer(in, out, s) +} + +func autoConvert_v1alpha3_ClusterIssuerList_To_certmanager_ClusterIssuerList(in *v1alpha3.ClusterIssuerList, out *certmanager.ClusterIssuerList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]certmanager.ClusterIssuer)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha3_ClusterIssuerList_To_certmanager_ClusterIssuerList is an autogenerated conversion function. +func Convert_v1alpha3_ClusterIssuerList_To_certmanager_ClusterIssuerList(in *v1alpha3.ClusterIssuerList, out *certmanager.ClusterIssuerList, s conversion.Scope) error { + return autoConvert_v1alpha3_ClusterIssuerList_To_certmanager_ClusterIssuerList(in, out, s) +} + +func autoConvert_certmanager_ClusterIssuerList_To_v1alpha3_ClusterIssuerList(in *certmanager.ClusterIssuerList, out *v1alpha3.ClusterIssuerList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]v1alpha3.ClusterIssuer)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_certmanager_ClusterIssuerList_To_v1alpha3_ClusterIssuerList is an autogenerated conversion function. +func Convert_certmanager_ClusterIssuerList_To_v1alpha3_ClusterIssuerList(in *certmanager.ClusterIssuerList, out *v1alpha3.ClusterIssuerList, s conversion.Scope) error { + return autoConvert_certmanager_ClusterIssuerList_To_v1alpha3_ClusterIssuerList(in, out, s) +} + +func autoConvert_v1alpha3_Issuer_To_certmanager_Issuer(in *v1alpha3.Issuer, out *certmanager.Issuer, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha3_IssuerSpec_To_certmanager_IssuerSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha3_IssuerStatus_To_certmanager_IssuerStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_Issuer_To_certmanager_Issuer is an autogenerated conversion function. +func Convert_v1alpha3_Issuer_To_certmanager_Issuer(in *v1alpha3.Issuer, out *certmanager.Issuer, s conversion.Scope) error { + return autoConvert_v1alpha3_Issuer_To_certmanager_Issuer(in, out, s) +} + +func autoConvert_certmanager_Issuer_To_v1alpha3_Issuer(in *certmanager.Issuer, out *v1alpha3.Issuer, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_certmanager_IssuerSpec_To_v1alpha3_IssuerSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_certmanager_IssuerStatus_To_v1alpha3_IssuerStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_certmanager_Issuer_To_v1alpha3_Issuer is an autogenerated conversion function. +func Convert_certmanager_Issuer_To_v1alpha3_Issuer(in *certmanager.Issuer, out *v1alpha3.Issuer, s conversion.Scope) error { + return autoConvert_certmanager_Issuer_To_v1alpha3_Issuer(in, out, s) +} + +func autoConvert_v1alpha3_IssuerCondition_To_certmanager_IssuerCondition(in *v1alpha3.IssuerCondition, out *certmanager.IssuerCondition, s conversion.Scope) error { + out.Type = certmanager.IssuerConditionType(in.Type) + out.Status = meta.ConditionStatus(in.Status) + out.LastTransitionTime = (*v1.Time)(unsafe.Pointer(in.LastTransitionTime)) + out.Reason = in.Reason + out.Message = in.Message + return nil +} + +// Convert_v1alpha3_IssuerCondition_To_certmanager_IssuerCondition is an autogenerated conversion function. +func Convert_v1alpha3_IssuerCondition_To_certmanager_IssuerCondition(in *v1alpha3.IssuerCondition, out *certmanager.IssuerCondition, s conversion.Scope) error { + return autoConvert_v1alpha3_IssuerCondition_To_certmanager_IssuerCondition(in, out, s) +} + +func autoConvert_certmanager_IssuerCondition_To_v1alpha3_IssuerCondition(in *certmanager.IssuerCondition, out *v1alpha3.IssuerCondition, s conversion.Scope) error { + out.Type = v1alpha3.IssuerConditionType(in.Type) + out.Status = metav1.ConditionStatus(in.Status) + out.LastTransitionTime = (*v1.Time)(unsafe.Pointer(in.LastTransitionTime)) + out.Reason = in.Reason + out.Message = in.Message + return nil +} + +// Convert_certmanager_IssuerCondition_To_v1alpha3_IssuerCondition is an autogenerated conversion function. +func Convert_certmanager_IssuerCondition_To_v1alpha3_IssuerCondition(in *certmanager.IssuerCondition, out *v1alpha3.IssuerCondition, s conversion.Scope) error { + return autoConvert_certmanager_IssuerCondition_To_v1alpha3_IssuerCondition(in, out, s) +} + +func autoConvert_v1alpha3_IssuerConfig_To_certmanager_IssuerConfig(in *v1alpha3.IssuerConfig, out *certmanager.IssuerConfig, s conversion.Scope) error { + out.ACME = (*acme.ACMEIssuer)(unsafe.Pointer(in.ACME)) + out.CA = (*certmanager.CAIssuer)(unsafe.Pointer(in.CA)) + out.Vault = (*certmanager.VaultIssuer)(unsafe.Pointer(in.Vault)) + out.SelfSigned = (*certmanager.SelfSignedIssuer)(unsafe.Pointer(in.SelfSigned)) + out.Venafi = (*certmanager.VenafiIssuer)(unsafe.Pointer(in.Venafi)) + return nil +} + +// Convert_v1alpha3_IssuerConfig_To_certmanager_IssuerConfig is an autogenerated conversion function. +func Convert_v1alpha3_IssuerConfig_To_certmanager_IssuerConfig(in *v1alpha3.IssuerConfig, out *certmanager.IssuerConfig, s conversion.Scope) error { + return autoConvert_v1alpha3_IssuerConfig_To_certmanager_IssuerConfig(in, out, s) +} + +func autoConvert_certmanager_IssuerConfig_To_v1alpha3_IssuerConfig(in *certmanager.IssuerConfig, out *v1alpha3.IssuerConfig, s conversion.Scope) error { + out.ACME = (*acmev1alpha3.ACMEIssuer)(unsafe.Pointer(in.ACME)) + out.CA = (*v1alpha3.CAIssuer)(unsafe.Pointer(in.CA)) + out.Vault = (*v1alpha3.VaultIssuer)(unsafe.Pointer(in.Vault)) + out.SelfSigned = (*v1alpha3.SelfSignedIssuer)(unsafe.Pointer(in.SelfSigned)) + out.Venafi = (*v1alpha3.VenafiIssuer)(unsafe.Pointer(in.Venafi)) + return nil +} + +// Convert_certmanager_IssuerConfig_To_v1alpha3_IssuerConfig is an autogenerated conversion function. +func Convert_certmanager_IssuerConfig_To_v1alpha3_IssuerConfig(in *certmanager.IssuerConfig, out *v1alpha3.IssuerConfig, s conversion.Scope) error { + return autoConvert_certmanager_IssuerConfig_To_v1alpha3_IssuerConfig(in, out, s) +} + +func autoConvert_v1alpha3_IssuerList_To_certmanager_IssuerList(in *v1alpha3.IssuerList, out *certmanager.IssuerList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]certmanager.Issuer)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha3_IssuerList_To_certmanager_IssuerList is an autogenerated conversion function. +func Convert_v1alpha3_IssuerList_To_certmanager_IssuerList(in *v1alpha3.IssuerList, out *certmanager.IssuerList, s conversion.Scope) error { + return autoConvert_v1alpha3_IssuerList_To_certmanager_IssuerList(in, out, s) +} + +func autoConvert_certmanager_IssuerList_To_v1alpha3_IssuerList(in *certmanager.IssuerList, out *v1alpha3.IssuerList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]v1alpha3.Issuer)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_certmanager_IssuerList_To_v1alpha3_IssuerList is an autogenerated conversion function. +func Convert_certmanager_IssuerList_To_v1alpha3_IssuerList(in *certmanager.IssuerList, out *v1alpha3.IssuerList, s conversion.Scope) error { + return autoConvert_certmanager_IssuerList_To_v1alpha3_IssuerList(in, out, s) +} + +func autoConvert_v1alpha3_IssuerSpec_To_certmanager_IssuerSpec(in *v1alpha3.IssuerSpec, out *certmanager.IssuerSpec, s conversion.Scope) error { + if err := Convert_v1alpha3_IssuerConfig_To_certmanager_IssuerConfig(&in.IssuerConfig, &out.IssuerConfig, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_IssuerSpec_To_certmanager_IssuerSpec is an autogenerated conversion function. +func Convert_v1alpha3_IssuerSpec_To_certmanager_IssuerSpec(in *v1alpha3.IssuerSpec, out *certmanager.IssuerSpec, s conversion.Scope) error { + return autoConvert_v1alpha3_IssuerSpec_To_certmanager_IssuerSpec(in, out, s) +} + +func autoConvert_certmanager_IssuerSpec_To_v1alpha3_IssuerSpec(in *certmanager.IssuerSpec, out *v1alpha3.IssuerSpec, s conversion.Scope) error { + if err := Convert_certmanager_IssuerConfig_To_v1alpha3_IssuerConfig(&in.IssuerConfig, &out.IssuerConfig, s); err != nil { + return err + } + return nil +} + +// Convert_certmanager_IssuerSpec_To_v1alpha3_IssuerSpec is an autogenerated conversion function. +func Convert_certmanager_IssuerSpec_To_v1alpha3_IssuerSpec(in *certmanager.IssuerSpec, out *v1alpha3.IssuerSpec, s conversion.Scope) error { + return autoConvert_certmanager_IssuerSpec_To_v1alpha3_IssuerSpec(in, out, s) +} + +func autoConvert_v1alpha3_IssuerStatus_To_certmanager_IssuerStatus(in *v1alpha3.IssuerStatus, out *certmanager.IssuerStatus, s conversion.Scope) error { + out.Conditions = *(*[]certmanager.IssuerCondition)(unsafe.Pointer(&in.Conditions)) + out.ACME = (*acme.ACMEIssuerStatus)(unsafe.Pointer(in.ACME)) + return nil +} + +// Convert_v1alpha3_IssuerStatus_To_certmanager_IssuerStatus is an autogenerated conversion function. +func Convert_v1alpha3_IssuerStatus_To_certmanager_IssuerStatus(in *v1alpha3.IssuerStatus, out *certmanager.IssuerStatus, s conversion.Scope) error { + return autoConvert_v1alpha3_IssuerStatus_To_certmanager_IssuerStatus(in, out, s) +} + +func autoConvert_certmanager_IssuerStatus_To_v1alpha3_IssuerStatus(in *certmanager.IssuerStatus, out *v1alpha3.IssuerStatus, s conversion.Scope) error { + out.Conditions = *(*[]v1alpha3.IssuerCondition)(unsafe.Pointer(&in.Conditions)) + out.ACME = (*acmev1alpha3.ACMEIssuerStatus)(unsafe.Pointer(in.ACME)) + return nil +} + +// Convert_certmanager_IssuerStatus_To_v1alpha3_IssuerStatus is an autogenerated conversion function. +func Convert_certmanager_IssuerStatus_To_v1alpha3_IssuerStatus(in *certmanager.IssuerStatus, out *v1alpha3.IssuerStatus, s conversion.Scope) error { + return autoConvert_certmanager_IssuerStatus_To_v1alpha3_IssuerStatus(in, out, s) +} + +func autoConvert_v1alpha3_SelfSignedIssuer_To_certmanager_SelfSignedIssuer(in *v1alpha3.SelfSignedIssuer, out *certmanager.SelfSignedIssuer, s conversion.Scope) error { + return nil +} + +// Convert_v1alpha3_SelfSignedIssuer_To_certmanager_SelfSignedIssuer is an autogenerated conversion function. +func Convert_v1alpha3_SelfSignedIssuer_To_certmanager_SelfSignedIssuer(in *v1alpha3.SelfSignedIssuer, out *certmanager.SelfSignedIssuer, s conversion.Scope) error { + return autoConvert_v1alpha3_SelfSignedIssuer_To_certmanager_SelfSignedIssuer(in, out, s) +} + +func autoConvert_certmanager_SelfSignedIssuer_To_v1alpha3_SelfSignedIssuer(in *certmanager.SelfSignedIssuer, out *v1alpha3.SelfSignedIssuer, s conversion.Scope) error { + return nil +} + +// Convert_certmanager_SelfSignedIssuer_To_v1alpha3_SelfSignedIssuer is an autogenerated conversion function. +func Convert_certmanager_SelfSignedIssuer_To_v1alpha3_SelfSignedIssuer(in *certmanager.SelfSignedIssuer, out *v1alpha3.SelfSignedIssuer, s conversion.Scope) error { + return autoConvert_certmanager_SelfSignedIssuer_To_v1alpha3_SelfSignedIssuer(in, out, s) +} + +func autoConvert_v1alpha3_VaultAppRole_To_certmanager_VaultAppRole(in *v1alpha3.VaultAppRole, out *certmanager.VaultAppRole, s conversion.Scope) error { + out.Path = in.Path + out.RoleId = in.RoleId + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.SecretRef, &out.SecretRef, 0); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_VaultAppRole_To_certmanager_VaultAppRole is an autogenerated conversion function. +func Convert_v1alpha3_VaultAppRole_To_certmanager_VaultAppRole(in *v1alpha3.VaultAppRole, out *certmanager.VaultAppRole, s conversion.Scope) error { + return autoConvert_v1alpha3_VaultAppRole_To_certmanager_VaultAppRole(in, out, s) +} + +func autoConvert_certmanager_VaultAppRole_To_v1alpha3_VaultAppRole(in *certmanager.VaultAppRole, out *v1alpha3.VaultAppRole, s conversion.Scope) error { + out.Path = in.Path + out.RoleId = in.RoleId + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.SecretRef, &out.SecretRef, 0); err != nil { + return err + } + return nil +} + +// Convert_certmanager_VaultAppRole_To_v1alpha3_VaultAppRole is an autogenerated conversion function. +func Convert_certmanager_VaultAppRole_To_v1alpha3_VaultAppRole(in *certmanager.VaultAppRole, out *v1alpha3.VaultAppRole, s conversion.Scope) error { + return autoConvert_certmanager_VaultAppRole_To_v1alpha3_VaultAppRole(in, out, s) +} + +func autoConvert_v1alpha3_VaultAuth_To_certmanager_VaultAuth(in *v1alpha3.VaultAuth, out *certmanager.VaultAuth, s conversion.Scope) error { + out.TokenSecretRef = (*meta.SecretKeySelector)(unsafe.Pointer(in.TokenSecretRef)) + out.AppRole = (*certmanager.VaultAppRole)(unsafe.Pointer(in.AppRole)) + out.Kubernetes = (*certmanager.VaultKubernetesAuth)(unsafe.Pointer(in.Kubernetes)) + return nil +} + +// Convert_v1alpha3_VaultAuth_To_certmanager_VaultAuth is an autogenerated conversion function. +func Convert_v1alpha3_VaultAuth_To_certmanager_VaultAuth(in *v1alpha3.VaultAuth, out *certmanager.VaultAuth, s conversion.Scope) error { + return autoConvert_v1alpha3_VaultAuth_To_certmanager_VaultAuth(in, out, s) +} + +func autoConvert_certmanager_VaultAuth_To_v1alpha3_VaultAuth(in *certmanager.VaultAuth, out *v1alpha3.VaultAuth, s conversion.Scope) error { + out.TokenSecretRef = (*metav1.SecretKeySelector)(unsafe.Pointer(in.TokenSecretRef)) + out.AppRole = (*v1alpha3.VaultAppRole)(unsafe.Pointer(in.AppRole)) + out.Kubernetes = (*v1alpha3.VaultKubernetesAuth)(unsafe.Pointer(in.Kubernetes)) + return nil +} + +// Convert_certmanager_VaultAuth_To_v1alpha3_VaultAuth is an autogenerated conversion function. +func Convert_certmanager_VaultAuth_To_v1alpha3_VaultAuth(in *certmanager.VaultAuth, out *v1alpha3.VaultAuth, s conversion.Scope) error { + return autoConvert_certmanager_VaultAuth_To_v1alpha3_VaultAuth(in, out, s) +} + +func autoConvert_v1alpha3_VaultIssuer_To_certmanager_VaultIssuer(in *v1alpha3.VaultIssuer, out *certmanager.VaultIssuer, s conversion.Scope) error { + if err := Convert_v1alpha3_VaultAuth_To_certmanager_VaultAuth(&in.Auth, &out.Auth, s); err != nil { + return err + } + out.Server = in.Server + out.Path = in.Path + out.CABundle = *(*[]byte)(unsafe.Pointer(&in.CABundle)) + return nil +} + +// Convert_v1alpha3_VaultIssuer_To_certmanager_VaultIssuer is an autogenerated conversion function. +func Convert_v1alpha3_VaultIssuer_To_certmanager_VaultIssuer(in *v1alpha3.VaultIssuer, out *certmanager.VaultIssuer, s conversion.Scope) error { + return autoConvert_v1alpha3_VaultIssuer_To_certmanager_VaultIssuer(in, out, s) +} + +func autoConvert_certmanager_VaultIssuer_To_v1alpha3_VaultIssuer(in *certmanager.VaultIssuer, out *v1alpha3.VaultIssuer, s conversion.Scope) error { + if err := Convert_certmanager_VaultAuth_To_v1alpha3_VaultAuth(&in.Auth, &out.Auth, s); err != nil { + return err + } + out.Server = in.Server + out.Path = in.Path + out.CABundle = *(*[]byte)(unsafe.Pointer(&in.CABundle)) + return nil +} + +// Convert_certmanager_VaultIssuer_To_v1alpha3_VaultIssuer is an autogenerated conversion function. +func Convert_certmanager_VaultIssuer_To_v1alpha3_VaultIssuer(in *certmanager.VaultIssuer, out *v1alpha3.VaultIssuer, s conversion.Scope) error { + return autoConvert_certmanager_VaultIssuer_To_v1alpha3_VaultIssuer(in, out, s) +} + +func autoConvert_v1alpha3_VaultKubernetesAuth_To_certmanager_VaultKubernetesAuth(in *v1alpha3.VaultKubernetesAuth, out *certmanager.VaultKubernetesAuth, s conversion.Scope) error { + out.Path = in.Path + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.SecretRef, &out.SecretRef, 0); err != nil { + return err + } + out.Role = in.Role + return nil +} + +// Convert_v1alpha3_VaultKubernetesAuth_To_certmanager_VaultKubernetesAuth is an autogenerated conversion function. +func Convert_v1alpha3_VaultKubernetesAuth_To_certmanager_VaultKubernetesAuth(in *v1alpha3.VaultKubernetesAuth, out *certmanager.VaultKubernetesAuth, s conversion.Scope) error { + return autoConvert_v1alpha3_VaultKubernetesAuth_To_certmanager_VaultKubernetesAuth(in, out, s) +} + +func autoConvert_certmanager_VaultKubernetesAuth_To_v1alpha3_VaultKubernetesAuth(in *certmanager.VaultKubernetesAuth, out *v1alpha3.VaultKubernetesAuth, s conversion.Scope) error { + out.Path = in.Path + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.SecretRef, &out.SecretRef, 0); err != nil { + return err + } + out.Role = in.Role + return nil +} + +// Convert_certmanager_VaultKubernetesAuth_To_v1alpha3_VaultKubernetesAuth is an autogenerated conversion function. +func Convert_certmanager_VaultKubernetesAuth_To_v1alpha3_VaultKubernetesAuth(in *certmanager.VaultKubernetesAuth, out *v1alpha3.VaultKubernetesAuth, s conversion.Scope) error { + return autoConvert_certmanager_VaultKubernetesAuth_To_v1alpha3_VaultKubernetesAuth(in, out, s) +} + +func autoConvert_v1alpha3_VenafiCloud_To_certmanager_VenafiCloud(in *v1alpha3.VenafiCloud, out *certmanager.VenafiCloud, s conversion.Scope) error { + out.URL = in.URL + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.APITokenSecretRef, &out.APITokenSecretRef, 0); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_VenafiCloud_To_certmanager_VenafiCloud is an autogenerated conversion function. +func Convert_v1alpha3_VenafiCloud_To_certmanager_VenafiCloud(in *v1alpha3.VenafiCloud, out *certmanager.VenafiCloud, s conversion.Scope) error { + return autoConvert_v1alpha3_VenafiCloud_To_certmanager_VenafiCloud(in, out, s) +} + +func autoConvert_certmanager_VenafiCloud_To_v1alpha3_VenafiCloud(in *certmanager.VenafiCloud, out *v1alpha3.VenafiCloud, s conversion.Scope) error { + out.URL = in.URL + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.APITokenSecretRef, &out.APITokenSecretRef, 0); err != nil { + return err + } + return nil +} + +// Convert_certmanager_VenafiCloud_To_v1alpha3_VenafiCloud is an autogenerated conversion function. +func Convert_certmanager_VenafiCloud_To_v1alpha3_VenafiCloud(in *certmanager.VenafiCloud, out *v1alpha3.VenafiCloud, s conversion.Scope) error { + return autoConvert_certmanager_VenafiCloud_To_v1alpha3_VenafiCloud(in, out, s) +} + +func autoConvert_v1alpha3_VenafiIssuer_To_certmanager_VenafiIssuer(in *v1alpha3.VenafiIssuer, out *certmanager.VenafiIssuer, s conversion.Scope) error { + out.Zone = in.Zone + out.TPP = (*certmanager.VenafiTPP)(unsafe.Pointer(in.TPP)) + out.Cloud = (*certmanager.VenafiCloud)(unsafe.Pointer(in.Cloud)) + return nil +} + +// Convert_v1alpha3_VenafiIssuer_To_certmanager_VenafiIssuer is an autogenerated conversion function. +func Convert_v1alpha3_VenafiIssuer_To_certmanager_VenafiIssuer(in *v1alpha3.VenafiIssuer, out *certmanager.VenafiIssuer, s conversion.Scope) error { + return autoConvert_v1alpha3_VenafiIssuer_To_certmanager_VenafiIssuer(in, out, s) +} + +func autoConvert_certmanager_VenafiIssuer_To_v1alpha3_VenafiIssuer(in *certmanager.VenafiIssuer, out *v1alpha3.VenafiIssuer, s conversion.Scope) error { + out.Zone = in.Zone + out.TPP = (*v1alpha3.VenafiTPP)(unsafe.Pointer(in.TPP)) + out.Cloud = (*v1alpha3.VenafiCloud)(unsafe.Pointer(in.Cloud)) + return nil +} + +// Convert_certmanager_VenafiIssuer_To_v1alpha3_VenafiIssuer is an autogenerated conversion function. +func Convert_certmanager_VenafiIssuer_To_v1alpha3_VenafiIssuer(in *certmanager.VenafiIssuer, out *v1alpha3.VenafiIssuer, s conversion.Scope) error { + return autoConvert_certmanager_VenafiIssuer_To_v1alpha3_VenafiIssuer(in, out, s) +} + +func autoConvert_v1alpha3_VenafiTPP_To_certmanager_VenafiTPP(in *v1alpha3.VenafiTPP, out *certmanager.VenafiTPP, s conversion.Scope) error { + out.URL = in.URL + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.CredentialsRef, &out.CredentialsRef, 0); err != nil { + return err + } + out.CABundle = *(*[]byte)(unsafe.Pointer(&in.CABundle)) + return nil +} + +// Convert_v1alpha3_VenafiTPP_To_certmanager_VenafiTPP is an autogenerated conversion function. +func Convert_v1alpha3_VenafiTPP_To_certmanager_VenafiTPP(in *v1alpha3.VenafiTPP, out *certmanager.VenafiTPP, s conversion.Scope) error { + return autoConvert_v1alpha3_VenafiTPP_To_certmanager_VenafiTPP(in, out, s) +} + +func autoConvert_certmanager_VenafiTPP_To_v1alpha3_VenafiTPP(in *certmanager.VenafiTPP, out *v1alpha3.VenafiTPP, s conversion.Scope) error { + out.URL = in.URL + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.CredentialsRef, &out.CredentialsRef, 0); err != nil { + return err + } + out.CABundle = *(*[]byte)(unsafe.Pointer(&in.CABundle)) + return nil +} + +// Convert_certmanager_VenafiTPP_To_v1alpha3_VenafiTPP is an autogenerated conversion function. +func Convert_certmanager_VenafiTPP_To_v1alpha3_VenafiTPP(in *certmanager.VenafiTPP, out *v1alpha3.VenafiTPP, s conversion.Scope) error { + return autoConvert_certmanager_VenafiTPP_To_v1alpha3_VenafiTPP(in, out, s) +} + +func autoConvert_v1alpha3_X509Subject_To_certmanager_X509Subject(in *v1alpha3.X509Subject, out *certmanager.X509Subject, s conversion.Scope) error { + out.Countries = *(*[]string)(unsafe.Pointer(&in.Countries)) + out.OrganizationalUnits = *(*[]string)(unsafe.Pointer(&in.OrganizationalUnits)) + out.Localities = *(*[]string)(unsafe.Pointer(&in.Localities)) + out.Provinces = *(*[]string)(unsafe.Pointer(&in.Provinces)) + out.StreetAddresses = *(*[]string)(unsafe.Pointer(&in.StreetAddresses)) + out.PostalCodes = *(*[]string)(unsafe.Pointer(&in.PostalCodes)) + out.SerialNumber = in.SerialNumber + return nil +} + +// Convert_v1alpha3_X509Subject_To_certmanager_X509Subject is an autogenerated conversion function. +func Convert_v1alpha3_X509Subject_To_certmanager_X509Subject(in *v1alpha3.X509Subject, out *certmanager.X509Subject, s conversion.Scope) error { + return autoConvert_v1alpha3_X509Subject_To_certmanager_X509Subject(in, out, s) +} + +func autoConvert_certmanager_X509Subject_To_v1alpha3_X509Subject(in *certmanager.X509Subject, out *v1alpha3.X509Subject, s conversion.Scope) error { + out.Countries = *(*[]string)(unsafe.Pointer(&in.Countries)) + out.OrganizationalUnits = *(*[]string)(unsafe.Pointer(&in.OrganizationalUnits)) + out.Localities = *(*[]string)(unsafe.Pointer(&in.Localities)) + out.Provinces = *(*[]string)(unsafe.Pointer(&in.Provinces)) + out.StreetAddresses = *(*[]string)(unsafe.Pointer(&in.StreetAddresses)) + out.PostalCodes = *(*[]string)(unsafe.Pointer(&in.PostalCodes)) + out.SerialNumber = in.SerialNumber + return nil +} + +// Convert_certmanager_X509Subject_To_v1alpha3_X509Subject is an autogenerated conversion function. +func Convert_certmanager_X509Subject_To_v1alpha3_X509Subject(in *certmanager.X509Subject, out *v1alpha3.X509Subject, s conversion.Scope) error { + return autoConvert_certmanager_X509Subject_To_v1alpha3_X509Subject(in, out, s) +} diff --git a/pkg/internal/apis/certmanager/v1alpha3/zz_generated.defaults.go b/pkg/internal/apis/certmanager/v1alpha3/zz_generated.defaults.go new file mode 100644 index 000000000..8356dba3d --- /dev/null +++ b/pkg/internal/apis/certmanager/v1alpha3/zz_generated.defaults.go @@ -0,0 +1,32 @@ +// +build !ignore_autogenerated + +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by defaulter-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// RegisterDefaults adds defaulters functions to the given scheme. +// Public to allow building arbitrary schemes. +// All generated defaulters are covering - they call all nested defaulters. +func RegisterDefaults(scheme *runtime.Scheme) error { + return nil +} diff --git a/pkg/internal/apis/certmanager/validation/BUILD.bazel b/pkg/internal/apis/certmanager/validation/BUILD.bazel index d7fb13770..d0b7736da 100644 --- a/pkg/internal/apis/certmanager/validation/BUILD.bazel +++ b/pkg/internal/apis/certmanager/validation/BUILD.bazel @@ -8,15 +8,18 @@ go_library( "certificaterequest.go", "clusterissuer.go", "issuer.go", + "register.go", ], importpath = "github.com/jetstack/cert-manager/pkg/internal/apis/certmanager/validation", visibility = ["//visibility:public"], deps = [ "//pkg/api/util:go_default_library", - "//pkg/apis/acme/v1alpha2:go_default_library", "//pkg/apis/certmanager/v1alpha2:go_default_library", - "//pkg/apis/meta/v1:go_default_library", + "//pkg/internal/api/validation:go_default_library", + "//pkg/internal/apis/acme:go_default_library", + "//pkg/internal/apis/certmanager:go_default_library", "//pkg/internal/apis/certmanager/validation/util:go_default_library", + "//pkg/internal/apis/meta:go_default_library", "//pkg/util/pki:go_default_library", "@io_k8s_api//core/v1:go_default_library", "@io_k8s_apimachinery//pkg/runtime:go_default_library", @@ -33,9 +36,10 @@ go_test( ], embed = [":go_default_library"], deps = [ - "//pkg/apis/acme/v1alpha2:go_default_library", "//pkg/apis/certmanager/v1alpha2:go_default_library", - "//pkg/apis/meta/v1:go_default_library", + "//pkg/internal/apis/acme:go_default_library", + "//pkg/internal/apis/certmanager:go_default_library", + "//pkg/internal/apis/meta:go_default_library", "//test/unit/gen:go_default_library", "@io_k8s_api//core/v1:go_default_library", "@io_k8s_apimachinery//pkg/apis/meta/v1:go_default_library", diff --git a/pkg/internal/apis/certmanager/validation/certificate.go b/pkg/internal/apis/certmanager/validation/certificate.go index 349c1df33..e6e3a59cc 100644 --- a/pkg/internal/apis/certmanager/validation/certificate.go +++ b/pkg/internal/apis/certmanager/validation/certificate.go @@ -24,13 +24,14 @@ import ( "k8s.io/apimachinery/pkg/util/validation/field" "github.com/jetstack/cert-manager/pkg/api/util" - "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha2" - cmmeta "github.com/jetstack/cert-manager/pkg/apis/meta/v1" + cmapiv1alpha2 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha2" + cmapi "github.com/jetstack/cert-manager/pkg/internal/apis/certmanager" + cmmeta "github.com/jetstack/cert-manager/pkg/internal/apis/meta" ) -// Validation functions for cert-manager v1alpha2 Certificate types +// Validation functions for cert-manager Certificate types -func ValidateCertificateSpec(crt *v1alpha2.CertificateSpec, fldPath *field.Path) field.ErrorList { +func ValidateCertificateSpec(crt *cmapi.CertificateSpec, fldPath *field.Path) field.ErrorList { el := field.ErrorList{} if crt.SecretName == "" { el = append(el, field.Required(fldPath.Child("secretName"), "must be specified")) @@ -55,12 +56,12 @@ func ValidateCertificateSpec(crt *v1alpha2.CertificateSpec, fldPath *field.Path) el = append(el, field.Invalid(fldPath.Child("keySize"), crt.KeySize, "cannot be less than zero")) } switch crt.KeyAlgorithm { - case v1alpha2.KeyAlgorithm(""): - case v1alpha2.RSAKeyAlgorithm: + case cmapi.KeyAlgorithm(""): + case cmapi.RSAKeyAlgorithm: if crt.KeySize > 0 && (crt.KeySize < 2048 || crt.KeySize > 8192) { el = append(el, field.Invalid(fldPath.Child("keySize"), crt.KeySize, "must be between 2048 & 8192 for rsa keyAlgorithm")) } - case v1alpha2.ECDSAKeyAlgorithm: + case cmapi.ECDSAKeyAlgorithm: if crt.KeySize > 0 && crt.KeySize != 256 && crt.KeySize != 384 && crt.KeySize != 521 { el = append(el, field.NotSupported(fldPath.Child("keySize"), crt.KeySize, []string{"256", "384", "521"})) } @@ -75,7 +76,7 @@ func ValidateCertificateSpec(crt *v1alpha2.CertificateSpec, fldPath *field.Path) el = append(el, validateUsages(crt, fldPath)...) } switch crt.KeyEncoding { - case v1alpha2.KeyEncoding(""), v1alpha2.PKCS1, v1alpha2.PKCS8: + case cmapi.KeyEncoding(""), cmapi.PKCS1, cmapi.PKCS8: default: el = append(el, field.Invalid(fldPath.Child("keyEncoding"), crt.KeyEncoding, "must be either empty or one of pkcs1 or pkcs8")) } @@ -83,7 +84,7 @@ func ValidateCertificateSpec(crt *v1alpha2.CertificateSpec, fldPath *field.Path) } func ValidateCertificate(obj runtime.Object) field.ErrorList { - crt := obj.(*v1alpha2.Certificate) + crt := obj.(*cmapi.Certificate) allErrs := ValidateCertificateSpec(&crt.Spec, field.NewPath("spec")) return allErrs } @@ -95,7 +96,7 @@ func validateIssuerRef(issuerRef cmmeta.ObjectReference, fldPath *field.Path) fi if issuerRef.Name == "" { el = append(el, field.Required(issuerRefPath.Child("name"), "must be specified")) } - if issuerRef.Group == "" || issuerRef.Group == v1alpha2.SchemeGroupVersion.Group { + if issuerRef.Group == "" || issuerRef.Group == cmapi.SchemeGroupVersion.Group { switch issuerRef.Kind { case "": case "Issuer", "ClusterIssuer": @@ -106,7 +107,7 @@ func validateIssuerRef(issuerRef cmmeta.ObjectReference, fldPath *field.Path) fi return el } -func validateIPAddresses(a *v1alpha2.CertificateSpec, fldPath *field.Path) field.ErrorList { +func validateIPAddresses(a *cmapi.CertificateSpec, fldPath *field.Path) field.ErrorList { if len(a.IPAddresses) <= 0 { return nil } @@ -120,11 +121,11 @@ func validateIPAddresses(a *v1alpha2.CertificateSpec, fldPath *field.Path) field return el } -func validateUsages(a *v1alpha2.CertificateSpec, fldPath *field.Path) field.ErrorList { +func validateUsages(a *cmapi.CertificateSpec, fldPath *field.Path) field.ErrorList { el := field.ErrorList{} for i, u := range a.Usages { - _, kok := util.KeyUsageType(u) - _, ekok := util.ExtKeyUsageType(u) + _, kok := util.KeyUsageType(cmapiv1alpha2.KeyUsage(u)) + _, ekok := util.ExtKeyUsageType(cmapiv1alpha2.KeyUsage(u)) if !kok && !ekok { el = append(el, field.Invalid(fldPath.Child("usages").Index(i), u, "unknown keyusage")) } @@ -132,19 +133,19 @@ func validateUsages(a *v1alpha2.CertificateSpec, fldPath *field.Path) field.Erro return el } -func ValidateDuration(crt *v1alpha2.CertificateSpec, fldPath *field.Path) field.ErrorList { +func ValidateDuration(crt *cmapi.CertificateSpec, fldPath *field.Path) field.ErrorList { el := field.ErrorList{} duration := util.DefaultCertDuration(crt.Duration) - renewBefore := v1alpha2.DefaultRenewBefore + renewBefore := cmapiv1alpha2.DefaultRenewBefore if crt.RenewBefore != nil { renewBefore = crt.RenewBefore.Duration } - if duration < v1alpha2.MinimumCertificateDuration { - el = append(el, field.Invalid(fldPath.Child("duration"), duration, fmt.Sprintf("certificate duration must be greater than %s", v1alpha2.MinimumCertificateDuration))) + if duration < cmapiv1alpha2.MinimumCertificateDuration { + el = append(el, field.Invalid(fldPath.Child("duration"), duration, fmt.Sprintf("certificate duration must be greater than %s", cmapiv1alpha2.MinimumCertificateDuration))) } - if renewBefore < v1alpha2.MinimumRenewBefore { - el = append(el, field.Invalid(fldPath.Child("renewBefore"), renewBefore, fmt.Sprintf("certificate renewBefore must be greater than %s", v1alpha2.MinimumRenewBefore))) + if renewBefore < cmapiv1alpha2.MinimumRenewBefore { + el = append(el, field.Invalid(fldPath.Child("renewBefore"), renewBefore, fmt.Sprintf("certificate renewBefore must be greater than %s", cmapiv1alpha2.MinimumRenewBefore))) } if duration <= renewBefore { el = append(el, field.Invalid(fldPath.Child("renewBefore"), renewBefore, fmt.Sprintf("certificate duration %s must be greater than renewBefore %s", duration, renewBefore))) diff --git a/pkg/internal/apis/certmanager/validation/certificate_for_issuer.go b/pkg/internal/apis/certmanager/validation/certificate_for_issuer.go index 9dbc19c12..b40a536de 100644 --- a/pkg/internal/apis/certmanager/validation/certificate_for_issuer.go +++ b/pkg/internal/apis/certmanager/validation/certificate_for_issuer.go @@ -17,40 +17,34 @@ limitations under the License. package validation import ( + "fmt" + "k8s.io/apimachinery/pkg/util/validation/field" - apiutil "github.com/jetstack/cert-manager/pkg/api/util" - "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha2" + cmapi "github.com/jetstack/cert-manager/pkg/internal/apis/certmanager" ) -func ValidateCertificateForIssuer(crt *v1alpha2.Certificate, issuerObj v1alpha2.GenericIssuer) field.ErrorList { +func ValidateCertificateForIssuer(crt *cmapi.Certificate, issuerObj cmapi.GenericIssuer) field.ErrorList { el := field.ErrorList{} path := field.NewPath("spec") - issuerType, err := apiutil.NameForIssuer(issuerObj) - if err != nil { - el = append(el, field.Invalid(path, err.Error(), err.Error())) - return el - } - - switch issuerType { - case apiutil.IssuerACME: + switch { + case issuerObj.GetSpec().ACME != nil: el = append(el, ValidateCertificateForACMEIssuer(&crt.Spec, issuerObj.GetSpec(), path)...) - case apiutil.IssuerCA: - el = append(el, ValidateCertificateForCAIssuer(&crt.Spec, issuerObj.GetSpec(), path)...) - case apiutil.IssuerVault: + case issuerObj.GetSpec().CA != nil: + case issuerObj.GetSpec().Vault != nil: el = append(el, ValidateCertificateForVaultIssuer(&crt.Spec, issuerObj.GetSpec(), path)...) - case apiutil.IssuerSelfSigned: - el = append(el, ValidateCertificateForSelfSignedIssuer(&crt.Spec, issuerObj.GetSpec(), path)...) - case apiutil.IssuerVenafi: - el = append(el, ValidateCertificateForVenafiIssuer(&crt.Spec, issuerObj.GetSpec(), path)...) + case issuerObj.GetSpec().SelfSigned != nil: + case issuerObj.GetSpec().Venafi != nil: + default: + el = append(el, field.Invalid(path, "", fmt.Sprintf("no issuer specified for Issuer '%s/%s'", issuerObj.GetObjectMeta().Namespace, issuerObj.GetObjectMeta().Name))) } return el } -func ValidateCertificateForACMEIssuer(crt *v1alpha2.CertificateSpec, issuer *v1alpha2.IssuerSpec, specPath *field.Path) field.ErrorList { +func ValidateCertificateForACMEIssuer(crt *cmapi.CertificateSpec, issuer *cmapi.IssuerSpec, specPath *field.Path) field.ErrorList { el := field.ErrorList{} if crt.IsCA { @@ -72,13 +66,7 @@ func ValidateCertificateForACMEIssuer(crt *v1alpha2.CertificateSpec, issuer *v1a return el } -func ValidateCertificateForCAIssuer(crt *v1alpha2.CertificateSpec, issuer *v1alpha2.IssuerSpec, specPath *field.Path) field.ErrorList { - el := field.ErrorList{} - - return el -} - -func ValidateCertificateForVaultIssuer(crt *v1alpha2.CertificateSpec, issuer *v1alpha2.IssuerSpec, specPath *field.Path) field.ErrorList { +func ValidateCertificateForVaultIssuer(crt *cmapi.CertificateSpec, issuer *cmapi.IssuerSpec, specPath *field.Path) field.ErrorList { el := field.ErrorList{} if crt.IsCA { @@ -91,15 +79,3 @@ func ValidateCertificateForVaultIssuer(crt *v1alpha2.CertificateSpec, issuer *v1 return el } - -func ValidateCertificateForSelfSignedIssuer(crt *v1alpha2.CertificateSpec, issuer *v1alpha2.IssuerSpec, specPath *field.Path) field.ErrorList { - el := field.ErrorList{} - - return el -} - -func ValidateCertificateForVenafiIssuer(crt *v1alpha2.CertificateSpec, issuer *v1alpha2.IssuerSpec, specPath *field.Path) field.ErrorList { - el := field.ErrorList{} - - return el -} diff --git a/pkg/internal/apis/certmanager/validation/certificate_for_issuer_test.go b/pkg/internal/apis/certmanager/validation/certificate_for_issuer_test.go index 0bfd3b462..1b53a6e82 100644 --- a/pkg/internal/apis/certmanager/validation/certificate_for_issuer_test.go +++ b/pkg/internal/apis/certmanager/validation/certificate_for_issuer_test.go @@ -24,8 +24,8 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/validation/field" - cmacme "github.com/jetstack/cert-manager/pkg/apis/acme/v1alpha2" - "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha2" + cmacme "github.com/jetstack/cert-manager/pkg/internal/apis/acme" + cmapi "github.com/jetstack/cert-manager/pkg/internal/apis/certmanager" "github.com/jetstack/cert-manager/test/unit/gen" ) @@ -37,94 +37,104 @@ const ( func TestValidateCertificateForIssuer(t *testing.T) { fldPath := field.NewPath("spec") - + acmeIssuer := &cmapi.Issuer{ + ObjectMeta: metav1.ObjectMeta{ + Name: defaultTestIssuerName, + Namespace: defaultTestNamespace, + }, + Spec: cmapi.IssuerSpec{ + IssuerConfig: cmapi.IssuerConfig{ + ACME: &cmacme.ACMEIssuer{}, + }, + }, + } scenarios := map[string]struct { - crt *v1alpha2.Certificate - issuer *v1alpha2.Issuer + crt *cmapi.Certificate + issuer *cmapi.Issuer errs []*field.Error }{ "valid basic certificate": { - crt: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + crt: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ IssuerRef: validIssuerRef, }, }, - issuer: gen.Issuer(defaultTestIssuerName, gen.SetIssuerACME(cmacme.ACMEIssuer{})), + issuer: acmeIssuer, }, "certificate with RSA keyAlgorithm for ACME": { - crt: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ - KeyAlgorithm: v1alpha2.RSAKeyAlgorithm, + crt: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ + KeyAlgorithm: cmapi.RSAKeyAlgorithm, IssuerRef: validIssuerRef, }, }, - issuer: gen.Issuer(defaultTestIssuerName, gen.SetIssuerACME(cmacme.ACMEIssuer{})), + issuer: acmeIssuer, }, "certificate with ECDSA keyAlgorithm for ACME": { - crt: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ - KeyAlgorithm: v1alpha2.ECDSAKeyAlgorithm, + crt: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ + KeyAlgorithm: cmapi.ECDSAKeyAlgorithm, IssuerRef: validIssuerRef, }, }, - issuer: gen.Issuer(defaultTestIssuerName, gen.SetIssuerACME(cmacme.ACMEIssuer{})), + issuer: acmeIssuer, }, "acme certificate with organization set": { - crt: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + crt: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ Organization: []string{"shouldfailorg"}, IssuerRef: validIssuerRef, }, }, - issuer: gen.Issuer(defaultTestIssuerName, gen.SetIssuerACME(cmacme.ACMEIssuer{})), + issuer: acmeIssuer, errs: []*field.Error{ field.Invalid(fldPath.Child("organization"), []string{"shouldfailorg"}, "ACME does not support setting the organization name"), }, }, "acme certificate with duration set": { - crt: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + crt: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ Duration: &metav1.Duration{Duration: time.Minute * 60}, IssuerRef: validIssuerRef, }, }, - issuer: gen.Issuer(defaultTestIssuerName, gen.SetIssuerACME(cmacme.ACMEIssuer{})), + issuer: acmeIssuer, errs: []*field.Error{ field.Invalid(fldPath.Child("duration"), &metav1.Duration{Duration: time.Minute * 60}, "ACME does not support certificate durations"), }, }, "acme certificate with ipAddresses set": { - crt: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + crt: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ IPAddresses: []string{"127.0.0.1"}, IssuerRef: validIssuerRef, }, }, - issuer: gen.Issuer(defaultTestIssuerName, gen.SetIssuerACME(cmacme.ACMEIssuer{})), + issuer: acmeIssuer, errs: []*field.Error{ field.Invalid(fldPath.Child("ipAddresses"), []string{"127.0.0.1"}, "ACME does not support certificate ip addresses"), }, }, "acme certificate with renewBefore set": { - crt: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + crt: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ RenewBefore: &metav1.Duration{Duration: time.Minute * 60}, IssuerRef: validIssuerRef, }, }, - issuer: gen.Issuer(defaultTestIssuerName, gen.SetIssuerACME(cmacme.ACMEIssuer{})), + issuer: acmeIssuer, errs: []*field.Error{}, }, "certificate with unspecified issuer type": { - crt: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ - KeyAlgorithm: v1alpha2.ECDSAKeyAlgorithm, + crt: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ + KeyAlgorithm: cmapi.ECDSAKeyAlgorithm, IssuerRef: validIssuerRef, }, }, - issuer: &v1alpha2.Issuer{}, + issuer: &cmapi.Issuer{}, errs: []*field.Error{ - field.Invalid(fldPath, "no issuer specified for Issuer '/'", "no issuer specified for Issuer '/'"), + field.Invalid(fldPath, "", "no issuer specified for Issuer '/'"), }, }, } diff --git a/pkg/internal/apis/certmanager/validation/certificate_test.go b/pkg/internal/apis/certmanager/validation/certificate_test.go index 4740c8d01..2e026f54d 100644 --- a/pkg/internal/apis/certmanager/validation/certificate_test.go +++ b/pkg/internal/apis/certmanager/validation/certificate_test.go @@ -25,8 +25,9 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/validation/field" - "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha2" - cmmeta "github.com/jetstack/cert-manager/pkg/apis/meta/v1" + cmapiv1alpha2 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha2" + cmapi "github.com/jetstack/cert-manager/pkg/internal/apis/certmanager" + cmmeta "github.com/jetstack/cert-manager/pkg/internal/apis/meta" ) var ( @@ -43,12 +44,12 @@ func strPtr(s string) *string { func TestValidateCertificate(t *testing.T) { fldPath := field.NewPath("spec") scenarios := map[string]struct { - cfg *v1alpha2.Certificate + cfg *cmapi.Certificate errs []*field.Error }{ "valid basic certificate": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ CommonName: "testcn", SecretName: "abc", IssuerRef: validIssuerRef, @@ -56,8 +57,8 @@ func TestValidateCertificate(t *testing.T) { }, }, "valid with blank issuerRef kind": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ CommonName: "testcn", SecretName: "abc", IssuerRef: cmmeta.ObjectReference{ @@ -67,8 +68,8 @@ func TestValidateCertificate(t *testing.T) { }, }, "valid with 'Issuer' issuerRef kind": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ CommonName: "testcn", SecretName: "abc", IssuerRef: cmmeta.ObjectReference{ @@ -79,8 +80,8 @@ func TestValidateCertificate(t *testing.T) { }, }, "valid with org set": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ CommonName: "testcn", SecretName: "abc", Organization: []string{"testorg"}, @@ -89,8 +90,8 @@ func TestValidateCertificate(t *testing.T) { }, }, "invalid issuerRef kind": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ CommonName: "testcn", SecretName: "abc", IssuerRef: cmmeta.ObjectReference{ @@ -104,8 +105,8 @@ func TestValidateCertificate(t *testing.T) { }, }, "certificate missing secretName": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ CommonName: "testcn", IssuerRef: validIssuerRef, }, @@ -115,8 +116,8 @@ func TestValidateCertificate(t *testing.T) { }, }, "certificate with no domains, URIs or common name": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ SecretName: "abc", IssuerRef: validIssuerRef, }, @@ -126,8 +127,8 @@ func TestValidateCertificate(t *testing.T) { }, }, "certificate with no issuerRef": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ CommonName: "testcn", SecretName: "abc", }, @@ -137,8 +138,8 @@ func TestValidateCertificate(t *testing.T) { }, }, "valid certificate with only dnsNames": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ DNSNames: []string{"validdnsname"}, SecretName: "abc", IssuerRef: validIssuerRef, @@ -146,94 +147,94 @@ func TestValidateCertificate(t *testing.T) { }, }, "valid certificate with rsa keyAlgorithm specified and no keySize": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ CommonName: "testcn", SecretName: "abc", IssuerRef: validIssuerRef, - KeyAlgorithm: v1alpha2.RSAKeyAlgorithm, + KeyAlgorithm: cmapi.RSAKeyAlgorithm, }, }, }, "valid certificate with rsa keyAlgorithm specified with keySize 2048": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ CommonName: "testcn", SecretName: "abc", IssuerRef: validIssuerRef, - KeyAlgorithm: v1alpha2.RSAKeyAlgorithm, + KeyAlgorithm: cmapi.RSAKeyAlgorithm, KeySize: 2048, }, }, }, "valid certificate with rsa keyAlgorithm specified with keySize 4096": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ CommonName: "testcn", SecretName: "abc", IssuerRef: validIssuerRef, - KeyAlgorithm: v1alpha2.RSAKeyAlgorithm, + KeyAlgorithm: cmapi.RSAKeyAlgorithm, KeySize: 4096, }, }, }, "valid certificate with rsa keyAlgorithm specified with keySize 8192": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ CommonName: "testcn", SecretName: "abc", IssuerRef: validIssuerRef, - KeyAlgorithm: v1alpha2.RSAKeyAlgorithm, + KeyAlgorithm: cmapi.RSAKeyAlgorithm, KeySize: 8192, }, }, }, "valid certificate with ecdsa keyAlgorithm specified and no keySize": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ CommonName: "testcn", SecretName: "abc", IssuerRef: validIssuerRef, - KeyAlgorithm: v1alpha2.ECDSAKeyAlgorithm, + KeyAlgorithm: cmapi.ECDSAKeyAlgorithm, }, }, }, "valid certificate with ecdsa keyAlgorithm specified with keySize 256": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ CommonName: "testcn", SecretName: "abc", IssuerRef: validIssuerRef, - KeyAlgorithm: v1alpha2.ECDSAKeyAlgorithm, + KeyAlgorithm: cmapi.ECDSAKeyAlgorithm, KeySize: 256, }, }, }, "valid certificate with ecdsa keyAlgorithm specified with keySize 384": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ CommonName: "testcn", SecretName: "abc", IssuerRef: validIssuerRef, - KeyAlgorithm: v1alpha2.ECDSAKeyAlgorithm, + KeyAlgorithm: cmapi.ECDSAKeyAlgorithm, KeySize: 384, }, }, }, "valid certificate with ecdsa keyAlgorithm specified with keySize 521": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ CommonName: "testcn", SecretName: "abc", IssuerRef: validIssuerRef, - KeyAlgorithm: v1alpha2.ECDSAKeyAlgorithm, + KeyAlgorithm: cmapi.ECDSAKeyAlgorithm, KeySize: 521, }, }, }, "valid certificate with keyAlgorithm not specified and keySize specified": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ CommonName: "testcn", SecretName: "abc", IssuerRef: validIssuerRef, @@ -242,8 +243,8 @@ func TestValidateCertificate(t *testing.T) { }, }, "certificate with keysize less than zero": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ CommonName: "testcn", SecretName: "abc", IssuerRef: validIssuerRef, @@ -255,12 +256,12 @@ func TestValidateCertificate(t *testing.T) { }, }, "certificate with rsa keyAlgorithm specified and invalid keysize 1024": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ CommonName: "testcn", SecretName: "abc", IssuerRef: validIssuerRef, - KeyAlgorithm: v1alpha2.RSAKeyAlgorithm, + KeyAlgorithm: cmapi.RSAKeyAlgorithm, KeySize: 1024, }, }, @@ -269,12 +270,12 @@ func TestValidateCertificate(t *testing.T) { }, }, "certificate with rsa keyAlgorithm specified and invalid keysize 8196": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ CommonName: "testcn", SecretName: "abc", IssuerRef: validIssuerRef, - KeyAlgorithm: v1alpha2.RSAKeyAlgorithm, + KeyAlgorithm: cmapi.RSAKeyAlgorithm, KeySize: 8196, }, }, @@ -283,12 +284,12 @@ func TestValidateCertificate(t *testing.T) { }, }, "certificate with ecdsa keyAlgorithm specified and invalid keysize": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ CommonName: "testcn", SecretName: "abc", IssuerRef: validIssuerRef, - KeyAlgorithm: v1alpha2.ECDSAKeyAlgorithm, + KeyAlgorithm: cmapi.ECDSAKeyAlgorithm, KeySize: 100, }, }, @@ -297,21 +298,21 @@ func TestValidateCertificate(t *testing.T) { }, }, "certificate with invalid keyAlgorithm": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ CommonName: "testcn", SecretName: "abc", IssuerRef: validIssuerRef, - KeyAlgorithm: v1alpha2.KeyAlgorithm("blah"), + KeyAlgorithm: cmapi.KeyAlgorithm("blah"), }, }, errs: []*field.Error{ - field.Invalid(fldPath.Child("keyAlgorithm"), v1alpha2.KeyAlgorithm("blah"), "must be either empty or one of rsa or ecdsa"), + field.Invalid(fldPath.Child("keyAlgorithm"), cmapi.KeyAlgorithm("blah"), "must be either empty or one of rsa or ecdsa"), }, }, "valid certificate with ipAddresses": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ CommonName: "testcn", IPAddresses: []string{"127.0.0.1"}, SecretName: "abc", @@ -320,8 +321,8 @@ func TestValidateCertificate(t *testing.T) { }, }, "certificate with invalid ipAddresses": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ CommonName: "testcn", IPAddresses: []string{"blah"}, SecretName: "abc", @@ -333,8 +334,8 @@ func TestValidateCertificate(t *testing.T) { }, }, "valid certificate with commonName exactly 64 bytes": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ CommonName: "this-is-a-big-long-string-which-is-exactly-sixty-four-characters", SecretName: "abc", IssuerRef: validIssuerRef, @@ -343,8 +344,8 @@ func TestValidateCertificate(t *testing.T) { errs: []*field.Error{}, }, "invalid certificate with commonName longer than 64 bytes": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ CommonName: "this-is-a-big-long-string-which-has-exactly-sixty-five-characters", SecretName: "abc", IssuerRef: validIssuerRef, @@ -355,8 +356,8 @@ func TestValidateCertificate(t *testing.T) { }, }, "valid certificate with no commonName and second dnsName longer than 64 bytes": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ SecretName: "abc", IssuerRef: validIssuerRef, DNSNames: []string{ @@ -367,8 +368,8 @@ func TestValidateCertificate(t *testing.T) { }, }, "valid certificate with commonName and first dnsName longer than 64 bytes": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ CommonName: "testcn", SecretName: "abc", IssuerRef: validIssuerRef, @@ -380,41 +381,41 @@ func TestValidateCertificate(t *testing.T) { }, }, "valid certificate with basic keyusage": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ CommonName: "testcn", SecretName: "abc", IssuerRef: validIssuerRef, - Usages: []v1alpha2.KeyUsage{"signing"}, + Usages: []cmapi.KeyUsage{"signing"}, }, }, }, "valid certificate with multiple keyusage": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ CommonName: "testcn", SecretName: "abc", IssuerRef: validIssuerRef, - Usages: []v1alpha2.KeyUsage{"signing", "s/mime"}, + Usages: []cmapi.KeyUsage{"signing", "s/mime"}, }, }, }, "invalid certificate with nonexistant keyusage": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ CommonName: "testcn", SecretName: "abc", IssuerRef: validIssuerRef, - Usages: []v1alpha2.KeyUsage{"nonexistant"}, + Usages: []cmapi.KeyUsage{"nonexistant"}, }, }, errs: []*field.Error{ - field.Invalid(fldPath.Child("usages").Index(0), v1alpha2.KeyUsage("nonexistant"), "unknown keyusage"), + field.Invalid(fldPath.Child("usages").Index(0), cmapi.KeyUsage("nonexistant"), "unknown keyusage"), }, }, "valid certificate with only URI SAN name": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ SecretName: "abc", IssuerRef: validIssuerRef, URISANs: []string{ @@ -455,12 +456,12 @@ func TestValidateDuration(t *testing.T) { fldPath := field.NewPath("spec") scenarios := map[string]struct { - cfg *v1alpha2.Certificate + cfg *cmapi.Certificate errs []*field.Error }{ "default duration and renewBefore": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ CommonName: "testcn", SecretName: "abc", IssuerRef: validIssuerRef, @@ -468,8 +469,8 @@ func TestValidateDuration(t *testing.T) { }, }, "valid duration and renewBefore": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ Duration: usefulDurations["one year"], RenewBefore: usefulDurations["half year"], CommonName: "testcn", @@ -479,8 +480,8 @@ func TestValidateDuration(t *testing.T) { }, }, "unset duration, valid renewBefore for default": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ RenewBefore: usefulDurations["one month"], CommonName: "testcn", SecretName: "abc", @@ -489,8 +490,8 @@ func TestValidateDuration(t *testing.T) { }, }, "unset renewBefore, valid duration for default": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ Duration: usefulDurations["one year"], CommonName: "testcn", SecretName: "abc", @@ -499,30 +500,30 @@ func TestValidateDuration(t *testing.T) { }, }, "renewBefore is bigger than the default duration": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ RenewBefore: usefulDurations["ten years"], CommonName: "testcn", SecretName: "abc", IssuerRef: validIssuerRef, }, }, - errs: []*field.Error{field.Invalid(fldPath.Child("renewBefore"), usefulDurations["ten years"].Duration, fmt.Sprintf("certificate duration %s must be greater than renewBefore %s", v1alpha2.DefaultCertificateDuration, usefulDurations["ten years"].Duration))}, + errs: []*field.Error{field.Invalid(fldPath.Child("renewBefore"), usefulDurations["ten years"].Duration, fmt.Sprintf("certificate duration %s must be greater than renewBefore %s", cmapiv1alpha2.DefaultCertificateDuration, usefulDurations["ten years"].Duration))}, }, "default renewBefore is bigger than the set duration": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ Duration: usefulDurations["one hour"], CommonName: "testcn", SecretName: "abc", IssuerRef: validIssuerRef, }, }, - errs: []*field.Error{field.Invalid(fldPath.Child("renewBefore"), v1alpha2.DefaultRenewBefore, fmt.Sprintf("certificate duration %s must be greater than renewBefore %s", usefulDurations["one hour"].Duration, v1alpha2.DefaultRenewBefore))}, + errs: []*field.Error{field.Invalid(fldPath.Child("renewBefore"), cmapiv1alpha2.DefaultRenewBefore, fmt.Sprintf("certificate duration %s must be greater than renewBefore %s", usefulDurations["one hour"].Duration, cmapiv1alpha2.DefaultRenewBefore))}, }, "renewBefore is bigger than the duration": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ Duration: usefulDurations["one month"], RenewBefore: usefulDurations["one year"], CommonName: "testcn", @@ -533,19 +534,19 @@ func TestValidateDuration(t *testing.T) { errs: []*field.Error{field.Invalid(fldPath.Child("renewBefore"), usefulDurations["one year"].Duration, fmt.Sprintf("certificate duration %s must be greater than renewBefore %s", usefulDurations["one month"].Duration, usefulDurations["one year"].Duration))}, }, "renewBefore is less than the minimum permitted value": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ RenewBefore: usefulDurations["one second"], CommonName: "testcn", SecretName: "abc", IssuerRef: validIssuerRef, }, }, - errs: []*field.Error{field.Invalid(fldPath.Child("renewBefore"), usefulDurations["one second"].Duration, fmt.Sprintf("certificate renewBefore must be greater than %s", v1alpha2.MinimumRenewBefore))}, + errs: []*field.Error{field.Invalid(fldPath.Child("renewBefore"), usefulDurations["one second"].Duration, fmt.Sprintf("certificate renewBefore must be greater than %s", cmapiv1alpha2.MinimumRenewBefore))}, }, "duration is less than the minimum permitted value": { - cfg: &v1alpha2.Certificate{ - Spec: v1alpha2.CertificateSpec{ + cfg: &cmapi.Certificate{ + Spec: cmapi.CertificateSpec{ Duration: usefulDurations["half hour"], RenewBefore: usefulDurations["ten minutes"], CommonName: "testcn", @@ -553,7 +554,7 @@ func TestValidateDuration(t *testing.T) { IssuerRef: validIssuerRef, }, }, - errs: []*field.Error{field.Invalid(fldPath.Child("duration"), usefulDurations["half hour"].Duration, fmt.Sprintf("certificate duration must be greater than %s", v1alpha2.MinimumCertificateDuration))}, + errs: []*field.Error{field.Invalid(fldPath.Child("duration"), usefulDurations["half hour"].Duration, fmt.Sprintf("certificate duration must be greater than %s", cmapiv1alpha2.MinimumCertificateDuration))}, }, } for n, s := range scenarios { diff --git a/pkg/internal/apis/certmanager/validation/certificaterequest.go b/pkg/internal/apis/certmanager/validation/certificaterequest.go index 8b59fe012..2c36df1c9 100644 --- a/pkg/internal/apis/certmanager/validation/certificaterequest.go +++ b/pkg/internal/apis/certmanager/validation/certificaterequest.go @@ -22,17 +22,17 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/validation/field" - "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha2" + cmapi "github.com/jetstack/cert-manager/pkg/internal/apis/certmanager" "github.com/jetstack/cert-manager/pkg/util/pki" ) func ValidateCertificateRequest(obj runtime.Object) field.ErrorList { - cr := obj.(*v1alpha2.CertificateRequest) + cr := obj.(*cmapi.CertificateRequest) allErrs := ValidateCertificateRequestSpec(&cr.Spec, field.NewPath("spec")) return allErrs } -func ValidateCertificateRequestSpec(crSpec *v1alpha2.CertificateRequestSpec, fldPath *field.Path) field.ErrorList { +func ValidateCertificateRequestSpec(crSpec *cmapi.CertificateRequestSpec, fldPath *field.Path) field.ErrorList { el := field.ErrorList{} el = append(el, validateIssuerRef(crSpec.IssuerRef, fldPath)...) diff --git a/pkg/internal/apis/certmanager/validation/clusterissuer.go b/pkg/internal/apis/certmanager/validation/clusterissuer.go index 755f2c067..50ae3e050 100644 --- a/pkg/internal/apis/certmanager/validation/clusterissuer.go +++ b/pkg/internal/apis/certmanager/validation/clusterissuer.go @@ -20,13 +20,13 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/validation/field" - "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha2" + cmapi "github.com/jetstack/cert-manager/pkg/internal/apis/certmanager" ) // Validation functions for cert-manager v1alpha2 ClusterIssuer types func ValidateClusterIssuer(obj runtime.Object) field.ErrorList { - iss := obj.(*v1alpha2.ClusterIssuer) + iss := obj.(*cmapi.ClusterIssuer) allErrs := ValidateIssuerSpec(&iss.Spec, field.NewPath("spec")) return allErrs } diff --git a/pkg/internal/apis/certmanager/validation/issuer.go b/pkg/internal/apis/certmanager/validation/issuer.go index c76347d16..9a2477c99 100644 --- a/pkg/internal/apis/certmanager/validation/issuer.go +++ b/pkg/internal/apis/certmanager/validation/issuer.go @@ -25,27 +25,27 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/validation/field" - cmacme "github.com/jetstack/cert-manager/pkg/apis/acme/v1alpha2" - "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha2" - cmmeta "github.com/jetstack/cert-manager/pkg/apis/meta/v1" + cmacme "github.com/jetstack/cert-manager/pkg/internal/apis/acme" + "github.com/jetstack/cert-manager/pkg/internal/apis/certmanager" "github.com/jetstack/cert-manager/pkg/internal/apis/certmanager/validation/util" + cmmeta "github.com/jetstack/cert-manager/pkg/internal/apis/meta" ) // Validation functions for cert-manager v1alpha2 Issuer types func ValidateIssuer(obj runtime.Object) field.ErrorList { - iss := obj.(*v1alpha2.Issuer) + iss := obj.(*certmanager.Issuer) allErrs := ValidateIssuerSpec(&iss.Spec, field.NewPath("spec")) return allErrs } -func ValidateIssuerSpec(iss *v1alpha2.IssuerSpec, fldPath *field.Path) field.ErrorList { +func ValidateIssuerSpec(iss *certmanager.IssuerSpec, fldPath *field.Path) field.ErrorList { el := field.ErrorList{} el = ValidateIssuerConfig(&iss.IssuerConfig, fldPath) return el } -func ValidateIssuerConfig(iss *v1alpha2.IssuerConfig, fldPath *field.Path) field.ErrorList { +func ValidateIssuerConfig(iss *certmanager.IssuerConfig, fldPath *field.Path) field.ErrorList { numConfigs := 0 el := field.ErrorList{} if iss.ACME != nil { @@ -177,7 +177,7 @@ func ValidateACMEIssuerChallengeSolverHTTP01IngressConfig(ingress *cmacme.ACMECh return el } -func ValidateCAIssuerConfig(iss *v1alpha2.CAIssuer, fldPath *field.Path) field.ErrorList { +func ValidateCAIssuerConfig(iss *certmanager.CAIssuer, fldPath *field.Path) field.ErrorList { el := field.ErrorList{} if len(iss.SecretName) == 0 { el = append(el, field.Required(fldPath.Child("secretName"), "")) @@ -185,11 +185,11 @@ func ValidateCAIssuerConfig(iss *v1alpha2.CAIssuer, fldPath *field.Path) field.E return el } -func ValidateSelfSignedIssuerConfig(iss *v1alpha2.SelfSignedIssuer, fldPath *field.Path) field.ErrorList { +func ValidateSelfSignedIssuerConfig(iss *certmanager.SelfSignedIssuer, fldPath *field.Path) field.ErrorList { return nil } -func ValidateVaultIssuerConfig(iss *v1alpha2.VaultIssuer, fldPath *field.Path) field.ErrorList { +func ValidateVaultIssuerConfig(iss *certmanager.VaultIssuer, fldPath *field.Path) field.ErrorList { el := field.ErrorList{} if len(iss.Server) == 0 { el = append(el, field.Required(fldPath.Child("server"), "")) @@ -212,7 +212,7 @@ func ValidateVaultIssuerConfig(iss *v1alpha2.VaultIssuer, fldPath *field.Path) f // TODO: add validation for Vault authentication types } -func ValidateVenafiIssuerConfig(iss *v1alpha2.VenafiIssuer, fldPath *field.Path) field.ErrorList { +func ValidateVenafiIssuerConfig(iss *certmanager.VenafiIssuer, fldPath *field.Path) field.ErrorList { //TODO: make extended validation fro fake\tpp\cloud modes return nil } diff --git a/pkg/internal/apis/certmanager/validation/issuer_test.go b/pkg/internal/apis/certmanager/validation/issuer_test.go index 2d65cc6d9..88b0c8c4f 100644 --- a/pkg/internal/apis/certmanager/validation/issuer_test.go +++ b/pkg/internal/apis/certmanager/validation/issuer_test.go @@ -23,9 +23,9 @@ import ( corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/util/validation/field" - cmacme "github.com/jetstack/cert-manager/pkg/apis/acme/v1alpha2" - "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha2" - cmmeta "github.com/jetstack/cert-manager/pkg/apis/meta/v1" + cmacme "github.com/jetstack/cert-manager/pkg/internal/apis/acme" + cmapi "github.com/jetstack/cert-manager/pkg/internal/apis/certmanager" + cmmeta "github.com/jetstack/cert-manager/pkg/internal/apis/meta" ) var ( @@ -48,8 +48,8 @@ var ( Server: "valid-server", PrivateKey: validSecretKeyRef, } - validVaultIssuer = v1alpha2.VaultIssuer{ - Auth: v1alpha2.VaultAuth{ + validVaultIssuer = cmapi.VaultIssuer{ + Auth: cmapi.VaultAuth{ TokenSecretRef: &validSecretKeyRef, }, Server: "something", @@ -60,21 +60,21 @@ var ( func TestValidateVaultIssuerConfig(t *testing.T) { fldPath := field.NewPath("") scenarios := map[string]struct { - spec *v1alpha2.VaultIssuer + spec *cmapi.VaultIssuer errs []*field.Error }{ "valid vault issuer": { spec: &validVaultIssuer, }, "vault issuer with missing fields": { - spec: &v1alpha2.VaultIssuer{}, + spec: &cmapi.VaultIssuer{}, errs: []*field.Error{ field.Required(fldPath.Child("server"), ""), field.Required(fldPath.Child("path"), ""), }, }, "vault issuer with invalid fields": { - spec: &v1alpha2.VaultIssuer{ + spec: &cmapi.VaultIssuer{ Server: "something", Path: "a/b/c", CABundle: []byte("invalid"), @@ -296,60 +296,60 @@ func TestValidateACMEIssuerConfig(t *testing.T) { func TestValidateIssuerSpec(t *testing.T) { fldPath := field.NewPath("") scenarios := map[string]struct { - spec *v1alpha2.IssuerSpec + spec *cmapi.IssuerSpec errs []*field.Error }{ "valid ca issuer": { - spec: &v1alpha2.IssuerSpec{ - IssuerConfig: v1alpha2.IssuerConfig{ - CA: &v1alpha2.CAIssuer{ + spec: &cmapi.IssuerSpec{ + IssuerConfig: cmapi.IssuerConfig{ + CA: &cmapi.CAIssuer{ SecretName: "valid", }, }, }, }, "ca issuer without secret name specified": { - spec: &v1alpha2.IssuerSpec{ - IssuerConfig: v1alpha2.IssuerConfig{ - CA: &v1alpha2.CAIssuer{}, + spec: &cmapi.IssuerSpec{ + IssuerConfig: cmapi.IssuerConfig{ + CA: &cmapi.CAIssuer{}, }, }, errs: []*field.Error{field.Required(fldPath.Child("ca", "secretName"), "")}, }, "valid self signed issuer": { - spec: &v1alpha2.IssuerSpec{ - IssuerConfig: v1alpha2.IssuerConfig{ - SelfSigned: &v1alpha2.SelfSignedIssuer{}, + spec: &cmapi.IssuerSpec{ + IssuerConfig: cmapi.IssuerConfig{ + SelfSigned: &cmapi.SelfSignedIssuer{}, }, }, }, "valid acme issuer": { - spec: &v1alpha2.IssuerSpec{ - IssuerConfig: v1alpha2.IssuerConfig{ + spec: &cmapi.IssuerSpec{ + IssuerConfig: cmapi.IssuerConfig{ ACME: &validACMEIssuer, }, }, }, "valid vault issuer": { - spec: &v1alpha2.IssuerSpec{ - IssuerConfig: v1alpha2.IssuerConfig{ + spec: &cmapi.IssuerSpec{ + IssuerConfig: cmapi.IssuerConfig{ Vault: &validVaultIssuer, }, }, }, "missing issuer config": { - spec: &v1alpha2.IssuerSpec{ - IssuerConfig: v1alpha2.IssuerConfig{}, + spec: &cmapi.IssuerSpec{ + IssuerConfig: cmapi.IssuerConfig{}, }, errs: []*field.Error{ field.Required(fldPath, "at least one issuer must be configured"), }, }, "multiple issuers configured": { - spec: &v1alpha2.IssuerSpec{ - IssuerConfig: v1alpha2.IssuerConfig{ - SelfSigned: &v1alpha2.SelfSignedIssuer{}, - CA: &v1alpha2.CAIssuer{ + spec: &cmapi.IssuerSpec{ + IssuerConfig: cmapi.IssuerConfig{ + SelfSigned: &cmapi.SelfSignedIssuer{}, + CA: &cmapi.CAIssuer{ SecretName: "valid", }, }, diff --git a/pkg/internal/apis/certmanager/validation/register.go b/pkg/internal/apis/certmanager/validation/register.go new file mode 100644 index 000000000..45db77bac --- /dev/null +++ b/pkg/internal/apis/certmanager/validation/register.go @@ -0,0 +1,38 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package validation + +import ( + "github.com/jetstack/cert-manager/pkg/internal/api/validation" + cmapi "github.com/jetstack/cert-manager/pkg/internal/apis/certmanager" +) + +func AddToValidationRegistry(reg *validation.Registry) error { + if err := reg.AddValidateFunc(&cmapi.Certificate{}, ValidateCertificate); err != nil { + return err + } + if err := reg.AddValidateFunc(&cmapi.CertificateRequest{}, ValidateCertificateRequest); err != nil { + return err + } + if err := reg.AddValidateFunc(&cmapi.ClusterIssuer{}, ValidateClusterIssuer); err != nil { + return err + } + if err := reg.AddValidateFunc(&cmapi.Issuer{}, ValidateIssuer); err != nil { + return err + } + return nil +} diff --git a/pkg/webhook/BUILD.bazel b/pkg/webhook/BUILD.bazel index ee8c120bd..19b174918 100644 --- a/pkg/webhook/BUILD.bazel +++ b/pkg/webhook/BUILD.bazel @@ -2,23 +2,15 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "go_default_library", - srcs = [ - "certmanager.go", - "scheme.go", - ], + srcs = ["scheme.go"], importpath = "github.com/jetstack/cert-manager/pkg/webhook", visibility = ["//visibility:public"], deps = [ - "//pkg/apis/acme/v1alpha2:go_default_library", - "//pkg/apis/certmanager/v1alpha2:go_default_library", + "//pkg/internal/api/validation:go_default_library", "//pkg/internal/apis/acme/install:go_default_library", - "//pkg/internal/apis/acme/validation:go_default_library", "//pkg/internal/apis/certmanager/install:go_default_library", - "//pkg/internal/apis/certmanager/validation:go_default_library", "//pkg/internal/apis/meta/install:go_default_library", - "//pkg/webhook/handlers:go_default_library", "@io_k8s_apimachinery//pkg/runtime:go_default_library", - "@io_k8s_apimachinery//pkg/runtime/schema:go_default_library", ], ) diff --git a/pkg/webhook/certmanager.go b/pkg/webhook/certmanager.go deleted file mode 100644 index 5bf500102..000000000 --- a/pkg/webhook/certmanager.go +++ /dev/null @@ -1,52 +0,0 @@ -/* -Copyright 2019 The Jetstack cert-manager contributors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package webhook - -import ( - "k8s.io/apimachinery/pkg/runtime/schema" - - cmacme "github.com/jetstack/cert-manager/pkg/apis/acme/v1alpha2" - cmapi "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha2" - acmeval "github.com/jetstack/cert-manager/pkg/internal/apis/acme/validation" - "github.com/jetstack/cert-manager/pkg/internal/apis/certmanager/validation" - "github.com/jetstack/cert-manager/pkg/webhook/handlers" -) - -var Validators = map[schema.GroupKind]handlers.Validator{ - gk(cmapi.SchemeGroupVersion, cmapi.CertificateKind): certificateValidator, - gk(cmapi.SchemeGroupVersion, cmapi.CertificateRequestKind): certificateRequestValidator, - gk(cmapi.SchemeGroupVersion, cmapi.IssuerKind): issuerValidator, - gk(cmapi.SchemeGroupVersion, cmapi.ClusterIssuerKind): clusterIssuerValidator, - gk(cmacme.SchemeGroupVersion, cmacme.OrderKind): orderValidator, - gk(cmacme.SchemeGroupVersion, cmacme.ChallengeKind): challengeValidator, -} - -var ( - certificateValidator = handlers.ValidatorFunc(&cmapi.Certificate{}, validation.ValidateCertificate, nil) - certificateRequestValidator = handlers.ValidatorFunc(&cmapi.CertificateRequest{}, validation.ValidateCertificateRequest, nil) - issuerValidator = handlers.ValidatorFunc(&cmapi.Issuer{}, validation.ValidateIssuer, nil) - clusterIssuerValidator = handlers.ValidatorFunc(&cmapi.ClusterIssuer{}, validation.ValidateClusterIssuer, nil) - orderValidator = handlers.ValidatorFunc(&cmacme.Order{}, nil, acmeval.ValidateOrderUpdate) - challengeValidator = handlers.ValidatorFunc(&cmacme.Challenge{}, nil, acmeval.ValidateChallengeUpdate) -) - -func gk(gv schema.GroupVersion, kind string) schema.GroupKind { - return schema.GroupKind{ - Group: gv.Group, - Kind: kind, - } -} diff --git a/pkg/webhook/handlers/BUILD.bazel b/pkg/webhook/handlers/BUILD.bazel index bda8504c2..88e030420 100644 --- a/pkg/webhook/handlers/BUILD.bazel +++ b/pkg/webhook/handlers/BUILD.bazel @@ -11,6 +11,7 @@ go_library( importpath = "github.com/jetstack/cert-manager/pkg/webhook/handlers", visibility = ["//visibility:public"], deps = [ + "//pkg/internal/api/validation:go_default_library", "@com_github_go_logr_logr//:go_default_library", "@com_github_mattbaird_jsonpatch//:go_default_library", "@io_k8s_api//admission/v1beta1:go_default_library", @@ -34,16 +35,16 @@ go_test( ], embed = [":go_default_library"], deps = [ + "//pkg/internal/api/validation:go_default_library", "//pkg/webhook/handlers/testdata/apis/testgroup:go_default_library", "//pkg/webhook/handlers/testdata/apis/testgroup/install:go_default_library", "//pkg/webhook/handlers/testdata/apis/testgroup/v1:go_default_library", - "//pkg/webhook/handlers/testdata/apis/testgroup/validation:go_default_library", + "//pkg/webhook/handlers/testdata/apis/testgroup/v2:go_default_library", "@com_github_mattbaird_jsonpatch//:go_default_library", "@io_k8s_api//admission/v1beta1:go_default_library", "@io_k8s_apiextensions_apiserver//pkg/apis/apiextensions/v1beta1:go_default_library", "@io_k8s_apimachinery//pkg/apis/meta/v1:go_default_library", "@io_k8s_apimachinery//pkg/runtime:go_default_library", - "@io_k8s_apimachinery//pkg/runtime/schema:go_default_library", "@io_k8s_apimachinery//pkg/types:go_default_library", "@io_k8s_klog//klogr:go_default_library", "@io_k8s_utils//diff:go_default_library", diff --git a/pkg/webhook/handlers/testdata/apis/testgroup/install/BUILD.bazel b/pkg/webhook/handlers/testdata/apis/testgroup/install/BUILD.bazel index ddf471a60..a831aec56 100644 --- a/pkg/webhook/handlers/testdata/apis/testgroup/install/BUILD.bazel +++ b/pkg/webhook/handlers/testdata/apis/testgroup/install/BUILD.bazel @@ -6,9 +6,11 @@ go_library( importpath = "github.com/jetstack/cert-manager/pkg/webhook/handlers/testdata/apis/testgroup/install", visibility = ["//visibility:public"], deps = [ + "//pkg/internal/api/validation:go_default_library", "//pkg/webhook/handlers/testdata/apis/testgroup:go_default_library", "//pkg/webhook/handlers/testdata/apis/testgroup/v1:go_default_library", "//pkg/webhook/handlers/testdata/apis/testgroup/v2:go_default_library", + "//pkg/webhook/handlers/testdata/apis/testgroup/validation:go_default_library", "@io_k8s_apimachinery//pkg/runtime:go_default_library", "@io_k8s_apimachinery//pkg/util/runtime:go_default_library", ], diff --git a/pkg/webhook/handlers/testdata/apis/testgroup/install/install.go b/pkg/webhook/handlers/testdata/apis/testgroup/install/install.go index 27bf86185..43f94b0a2 100644 --- a/pkg/webhook/handlers/testdata/apis/testgroup/install/install.go +++ b/pkg/webhook/handlers/testdata/apis/testgroup/install/install.go @@ -22,9 +22,11 @@ import ( "k8s.io/apimachinery/pkg/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime" + "github.com/jetstack/cert-manager/pkg/internal/api/validation" "github.com/jetstack/cert-manager/pkg/webhook/handlers/testdata/apis/testgroup" "github.com/jetstack/cert-manager/pkg/webhook/handlers/testdata/apis/testgroup/v1" "github.com/jetstack/cert-manager/pkg/webhook/handlers/testdata/apis/testgroup/v2" + testval "github.com/jetstack/cert-manager/pkg/webhook/handlers/testdata/apis/testgroup/validation" ) // Install registers the API group and adds types to a scheme @@ -33,3 +35,8 @@ func Install(scheme *runtime.Scheme) { utilruntime.Must(v1.AddToScheme(scheme)) utilruntime.Must(v2.AddToScheme(scheme)) } + +func InstallValidations(registry *validation.Registry) { + utilruntime.Must(testval.Register(registry)) + utilruntime.Must(v2.RegisterValidations(registry)) +} diff --git a/pkg/webhook/handlers/testdata/apis/testgroup/v2/BUILD.bazel b/pkg/webhook/handlers/testdata/apis/testgroup/v2/BUILD.bazel index a70c461d4..668e6e3b0 100644 --- a/pkg/webhook/handlers/testdata/apis/testgroup/v2/BUILD.bazel +++ b/pkg/webhook/handlers/testdata/apis/testgroup/v2/BUILD.bazel @@ -8,6 +8,7 @@ go_library( "doc.go", "register.go", "types.go", + "validation.go", "zz_generated.conversion.go", "zz_generated.deepcopy.go", "zz_generated.defaults.go", @@ -15,11 +16,13 @@ go_library( importpath = "github.com/jetstack/cert-manager/pkg/webhook/handlers/testdata/apis/testgroup/v2", visibility = ["//visibility:public"], deps = [ + "//pkg/internal/api/validation:go_default_library", "//pkg/webhook/handlers/testdata/apis/testgroup:go_default_library", "@io_k8s_apimachinery//pkg/apis/meta/v1:go_default_library", "@io_k8s_apimachinery//pkg/conversion:go_default_library", "@io_k8s_apimachinery//pkg/runtime:go_default_library", "@io_k8s_apimachinery//pkg/runtime/schema:go_default_library", + "@io_k8s_apimachinery//pkg/util/validation/field:go_default_library", "@io_k8s_utils//pointer:go_default_library", ], ) diff --git a/pkg/webhook/handlers/testdata/apis/testgroup/v2/register.go b/pkg/webhook/handlers/testdata/apis/testgroup/v2/register.go index 5ebbf2498..56a4ad3fc 100644 --- a/pkg/webhook/handlers/testdata/apis/testgroup/v2/register.go +++ b/pkg/webhook/handlers/testdata/apis/testgroup/v2/register.go @@ -21,6 +21,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" + "github.com/jetstack/cert-manager/pkg/internal/api/validation" "github.com/jetstack/cert-manager/pkg/webhook/handlers/testdata/apis/testgroup" ) @@ -38,6 +39,13 @@ var ( AddToScheme = localSchemeBuilder.AddToScheme ) +func RegisterValidations(reg *validation.Registry) error { + if err := reg.AddValidateFunc(&TestType{}, ValidateTestType); err != nil { + return err + } + return nil +} + func init() { // We only register manually written functions here. The registration of the // generated functions takes place in the generated files. The separation diff --git a/pkg/webhook/handlers/testdata/apis/testgroup/v2/types.go b/pkg/webhook/handlers/testdata/apis/testgroup/v2/types.go index acb5dd4a1..d210c049b 100644 --- a/pkg/webhook/handlers/testdata/apis/testgroup/v2/types.go +++ b/pkg/webhook/handlers/testdata/apis/testgroup/v2/types.go @@ -36,3 +36,7 @@ type TestType struct { // TestFieldImmutable cannot be changed after being set to a non-zero value TestFieldImmutable string `json:"testFieldImmutable"` } + +const ( + DisallowedTestFieldValue = "not-allowed-in-v2" +) diff --git a/pkg/webhook/handlers/testdata/apis/testgroup/v2/validation.go b/pkg/webhook/handlers/testdata/apis/testgroup/v2/validation.go new file mode 100644 index 000000000..4d6c4d513 --- /dev/null +++ b/pkg/webhook/handlers/testdata/apis/testgroup/v2/validation.go @@ -0,0 +1,31 @@ +/* +Copyright 2019 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v2 + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +func ValidateTestType(obj runtime.Object) field.ErrorList { + el := field.ErrorList{} + tt := obj.(*TestType) + if tt.TestField == DisallowedTestFieldValue { + el = append(el, field.Invalid(field.NewPath("testField"), tt.TestField, "value not allowed")) + } + return el +} diff --git a/pkg/webhook/handlers/testdata/apis/testgroup/validation/BUILD.bazel b/pkg/webhook/handlers/testdata/apis/testgroup/validation/BUILD.bazel index 5feb53a62..ea76bb36a 100644 --- a/pkg/webhook/handlers/testdata/apis/testgroup/validation/BUILD.bazel +++ b/pkg/webhook/handlers/testdata/apis/testgroup/validation/BUILD.bazel @@ -2,10 +2,15 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") go_library( name = "go_default_library", - srcs = ["validation.go"], + srcs = [ + "register.go", + "validation.go", + ], importpath = "github.com/jetstack/cert-manager/pkg/webhook/handlers/testdata/apis/testgroup/validation", visibility = ["//visibility:public"], deps = [ + "//pkg/internal/api/validation:go_default_library", + "//pkg/webhook/handlers/testdata/apis/testgroup:go_default_library", "//pkg/webhook/handlers/testdata/apis/testgroup/v1:go_default_library", "@io_k8s_apimachinery//pkg/runtime:go_default_library", "@io_k8s_apimachinery//pkg/util/validation/field:go_default_library", @@ -17,6 +22,7 @@ go_test( srcs = ["validation_test.go"], embed = [":go_default_library"], deps = [ + "//pkg/webhook/handlers/testdata/apis/testgroup:go_default_library", "//pkg/webhook/handlers/testdata/apis/testgroup/v1:go_default_library", "@io_k8s_apimachinery//pkg/util/validation/field:go_default_library", ], diff --git a/pkg/webhook/handlers/testdata/apis/testgroup/validation/register.go b/pkg/webhook/handlers/testdata/apis/testgroup/validation/register.go new file mode 100644 index 000000000..ce6202a43 --- /dev/null +++ b/pkg/webhook/handlers/testdata/apis/testgroup/validation/register.go @@ -0,0 +1,32 @@ +/* +Copyright 2020 The Jetstack cert-manager contributors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package validation + +import ( + "github.com/jetstack/cert-manager/pkg/internal/api/validation" + "github.com/jetstack/cert-manager/pkg/webhook/handlers/testdata/apis/testgroup" +) + +func Register(reg *validation.Registry) error { + if err := reg.AddValidateFunc(&testgroup.TestType{}, ValidateTestType); err != nil { + return err + } + if err := reg.AddValidateUpdateFunc(&testgroup.TestType{}, ValidateTestTypeUpdate); err != nil { + return err + } + return nil +} diff --git a/pkg/webhook/handlers/testdata/apis/testgroup/validation/validation.go b/pkg/webhook/handlers/testdata/apis/testgroup/validation/validation.go index 0c93c4020..349960f69 100644 --- a/pkg/webhook/handlers/testdata/apis/testgroup/validation/validation.go +++ b/pkg/webhook/handlers/testdata/apis/testgroup/validation/validation.go @@ -20,11 +20,12 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/validation/field" - v1 "github.com/jetstack/cert-manager/pkg/webhook/handlers/testdata/apis/testgroup/v1" + "github.com/jetstack/cert-manager/pkg/webhook/handlers/testdata/apis/testgroup" + "github.com/jetstack/cert-manager/pkg/webhook/handlers/testdata/apis/testgroup/v1" ) func ValidateTestType(obj runtime.Object) field.ErrorList { - testType := obj.(*v1.TestType) + testType := obj.(*testgroup.TestType) el := field.ErrorList{} if testType.TestField == v1.TestFieldValueNotAllowed { el = append(el, field.Invalid(field.NewPath("testField"), testType.TestField, "invalid value")) @@ -33,8 +34,8 @@ func ValidateTestType(obj runtime.Object) field.ErrorList { } func ValidateTestTypeUpdate(oldObj, newObj runtime.Object) field.ErrorList { - old, ok := oldObj.(*v1.TestType) - new := newObj.(*v1.TestType) + old, ok := oldObj.(*testgroup.TestType) + new := newObj.(*testgroup.TestType) // if oldObj is not set, the Update operation is always valid. if !ok || old == nil { return nil diff --git a/pkg/webhook/handlers/testdata/apis/testgroup/validation/validation_test.go b/pkg/webhook/handlers/testdata/apis/testgroup/validation/validation_test.go index dfda8f877..9d907447e 100644 --- a/pkg/webhook/handlers/testdata/apis/testgroup/validation/validation_test.go +++ b/pkg/webhook/handlers/testdata/apis/testgroup/validation/validation_test.go @@ -22,16 +22,17 @@ import ( "k8s.io/apimachinery/pkg/util/validation/field" + "github.com/jetstack/cert-manager/pkg/webhook/handlers/testdata/apis/testgroup" v1 "github.com/jetstack/cert-manager/pkg/webhook/handlers/testdata/apis/testgroup/v1" ) func TestValidateTestType(t *testing.T) { scenarios := map[string]struct { - obj *v1.TestType + obj *testgroup.TestType errs []*field.Error }{ "does not allow testField to be TestFieldValueNotAllowed": { - obj: &v1.TestType{ + obj: &testgroup.TestType{ TestField: v1.TestFieldValueNotAllowed, }, errs: []*field.Error{ @@ -57,16 +58,16 @@ func TestValidateTestType(t *testing.T) { } func TestValidateTestTypeUpdate(t *testing.T) { - testImmutableTestTypeField(t, field.NewPath("testFieldImmutable"), func(obj *v1.TestType, s testValue) { + testImmutableTestTypeField(t, field.NewPath("testFieldImmutable"), func(obj *testgroup.TestType, s testValue) { obj.TestFieldImmutable = string(s) }) scenarios := map[string]struct { - old, new *v1.TestType + old, new *testgroup.TestType errs []*field.Error }{ "allows all updates if old is nil": { - new: &v1.TestType{ + new: &testgroup.TestType{ TestFieldImmutable: "abc", }, }, @@ -99,13 +100,13 @@ const ( // testImmutableOrderField will test that the field at path fldPath does // not allow changes after being set, but does allow changes if the old field // is not set. -func testImmutableTestTypeField(t *testing.T, fldPath *field.Path, setter func(*v1.TestType, testValue)) { +func testImmutableTestTypeField(t *testing.T, fldPath *field.Path, setter func(*testgroup.TestType, testValue)) { t.Run("should reject updates to "+fldPath.String(), func(t *testing.T) { expectedErrs := []*field.Error{ field.Forbidden(fldPath, "field is immutable once set"), } - old := &v1.TestType{} - new := &v1.TestType{} + old := &testgroup.TestType{} + new := &testgroup.TestType{} setter(old, testValueOptionOne) setter(new, testValueOptionTwo) errs := ValidateTestTypeUpdate(old, new) @@ -122,8 +123,8 @@ func testImmutableTestTypeField(t *testing.T, fldPath *field.Path, setter func(* }) t.Run("should allow updates to "+fldPath.String()+" if not already set", func(t *testing.T) { expectedErrs := []*field.Error{} - old := &v1.TestType{} - new := &v1.TestType{} + old := &testgroup.TestType{} + new := &testgroup.TestType{} setter(old, testValueNone) setter(new, testValueOptionOne) errs := ValidateTestTypeUpdate(old, new) diff --git a/pkg/webhook/handlers/validation.go b/pkg/webhook/handlers/validation.go index 7d396397b..9406605e4 100644 --- a/pkg/webhook/handlers/validation.go +++ b/pkg/webhook/handlers/validation.go @@ -26,82 +26,31 @@ import ( "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/serializer" "k8s.io/apimachinery/pkg/util/validation/field" + + "github.com/jetstack/cert-manager/pkg/internal/api/validation" ) -type Validator interface { - // NewObject should return the runtime.Object that should be decoded into - // before validating the resource. - NewObject() runtime.Object - - // Validate will validate the given resource - Validate(runtime.Object) field.ErrorList - - // ValidateUpdate will validate the given resource for an update - ValidateUpdate(old, new runtime.Object) field.ErrorList +type registryBackedValidator struct { + log logr.Logger + decoder runtime.Decoder + registry *validation.Registry } -type validatorFunc struct { - obj runtime.Object - validate func(runtime.Object) field.ErrorList - validateUpdate func(runtime.Object, runtime.Object) field.ErrorList -} - -var _ Validator = &validatorFunc{} - -func (v *validatorFunc) NewObject() runtime.Object { - return v.obj.DeepCopyObject() -} - -func (v *validatorFunc) Validate(obj runtime.Object) field.ErrorList { - if v.validate == nil { - return nil - } - return v.validate(obj) -} - -func (v *validatorFunc) ValidateUpdate(old, new runtime.Object) field.ErrorList { - if v.validateUpdate == nil { - return nil - } - return v.validateUpdate(old, new) -} - -func ValidatorFunc(obj runtime.Object, validate func(runtime.Object) field.ErrorList, validateUpdate func(runtime.Object, runtime.Object) field.ErrorList) Validator { - return &validatorFunc{ - obj: obj, - validate: validate, - validateUpdate: validateUpdate, - } -} - -type funcBackedValidator struct { - log logr.Logger - decoder runtime.Decoder - validators map[schema.GroupKind]Validator -} - -func NewFuncBackedValidator(log logr.Logger, scheme *runtime.Scheme, validators map[schema.GroupKind]Validator) *funcBackedValidator { +func NewRegistryBackedValidator(log logr.Logger, scheme *runtime.Scheme, registry *validation.Registry) *registryBackedValidator { factory := serializer.NewCodecFactory(scheme) - return &funcBackedValidator{ - log: log, - decoder: factory.UniversalDecoder(), - validators: validators, + return ®istryBackedValidator{ + log: log, + decoder: factory.UniversalDecoder(), + registry: registry, } } -type ValidationFunc func(obj runtime.Object) field.ErrorList -type UpdateValidationFunc func(old, new runtime.Object) field.ErrorList - -func (c *funcBackedValidator) Validate(admissionSpec *admissionv1beta1.AdmissionRequest) *admissionv1beta1.AdmissionResponse { +func (r *registryBackedValidator) Validate(admissionSpec *admissionv1beta1.AdmissionRequest) *admissionv1beta1.AdmissionResponse { status := &admissionv1beta1.AdmissionResponse{} status.UID = admissionSpec.UID - gk := schema.GroupKind{Group: admissionSpec.Kind.Group, Kind: admissionSpec.Kind.Kind} - validator := c.validators[gk] - - obj := validator.NewObject() // decode new version of object - _, _, err := c.decoder.Decode(admissionSpec.Object.Raw, nil, obj) + obj, _, err := r.decoder.Decode(admissionSpec.Object.Raw, nil, nil) if err != nil { status.Allowed = false status.Result = &metav1.Status{ @@ -114,8 +63,7 @@ func (c *funcBackedValidator) Validate(admissionSpec *admissionv1beta1.Admission // attempt to decode old object var oldObj runtime.Object if len(admissionSpec.OldObject.Raw) > 0 { - oldObj = validator.NewObject() - _, _, err = c.decoder.Decode(admissionSpec.OldObject.Raw, nil, oldObj) + oldObj, _, err = r.decoder.Decode(admissionSpec.OldObject.Raw, nil, nil) if err != nil { status.Allowed = false status.Result = &metav1.Status{ @@ -126,12 +74,18 @@ func (c *funcBackedValidator) Validate(admissionSpec *admissionv1beta1.Admission } } + requestGVK := schema.GroupVersionKind{ + Group: admissionSpec.RequestKind.Group, + Version: admissionSpec.RequestKind.Version, + Kind: admissionSpec.RequestKind.Kind, + } errs := field.ErrorList{} // perform validation on new version of resource - errs = append(errs, validator.Validate(obj)...) - // perform update validation on resource - errs = append(errs, validator.ValidateUpdate(oldObj, obj)...) - + errs = append(errs, r.registry.Validate(obj, requestGVK)...) + if oldObj != nil { + // perform update validation on resource + errs = append(errs, r.registry.ValidateUpdate(oldObj, obj, requestGVK)...) + } // return with allowed = false if any errors occurred if err := errs.ToAggregate(); err != nil { status.Allowed = false diff --git a/pkg/webhook/handlers/validation_test.go b/pkg/webhook/handlers/validation_test.go index f746bcc8e..16d5a1d99 100644 --- a/pkg/webhook/handlers/validation_test.go +++ b/pkg/webhook/handlers/validation_test.go @@ -24,34 +24,38 @@ import ( admissionv1beta1 "k8s.io/api/admission/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" "k8s.io/klog/klogr" - "github.com/jetstack/cert-manager/pkg/webhook/handlers/testdata/apis/testgroup" + "github.com/jetstack/cert-manager/pkg/internal/api/validation" "github.com/jetstack/cert-manager/pkg/webhook/handlers/testdata/apis/testgroup/install" "github.com/jetstack/cert-manager/pkg/webhook/handlers/testdata/apis/testgroup/v1" - "github.com/jetstack/cert-manager/pkg/webhook/handlers/testdata/apis/testgroup/validation" + "github.com/jetstack/cert-manager/pkg/webhook/handlers/testdata/apis/testgroup/v2" ) -func TestFuncBackedValidator(t *testing.T) { +func TestRegistryBackedValidator(t *testing.T) { scheme := runtime.NewScheme() + registry := validation.NewRegistry(scheme) install.Install(scheme) + install.InstallValidations(registry) log := klogr.New() - c := NewFuncBackedValidator(log, scheme, map[schema.GroupKind]Validator{ - {Group: testgroup.GroupName, Kind: "TestType"}: ValidatorFunc(&v1.TestType{}, validation.ValidateTestType, validation.ValidateTestTypeUpdate), - }) - testTypeGVK := metav1.GroupVersionKind{ + c := NewRegistryBackedValidator(log, scheme, registry) + testTypeGVK := &metav1.GroupVersionKind{ Group: v1.SchemeGroupVersion.Group, Version: v1.SchemeGroupVersion.Version, Kind: "TestType", } + testTypeGVKV2 := &metav1.GroupVersionKind{ + Group: v2.SchemeGroupVersion.Group, + Version: v2.SchemeGroupVersion.Version, + Kind: "TestType", + } tests := map[string]admissionTestT{ "should not allow invalid value for 'testField' field": { inputRequest: admissionv1beta1.AdmissionRequest{ - UID: types.UID("abc"), - Kind: testTypeGVK, + UID: types.UID("abc"), + RequestKind: testTypeGVK, Object: runtime.RawExtension{ Raw: []byte(fmt.Sprintf(` { @@ -78,7 +82,7 @@ func TestFuncBackedValidator(t *testing.T) { }, "should allow setting immutable field if it is not already set": { inputRequest: admissionv1beta1.AdmissionRequest{ - Kind: testTypeGVK, + RequestKind: testTypeGVK, OldObject: runtime.RawExtension{ Raw: []byte(fmt.Sprintf(` { @@ -113,7 +117,7 @@ func TestFuncBackedValidator(t *testing.T) { }, "should not allow setting immutable field if it is already set": { inputRequest: admissionv1beta1.AdmissionRequest{ - Kind: testTypeGVK, + RequestKind: testTypeGVK, OldObject: runtime.RawExtension{ Raw: []byte(fmt.Sprintf(` { @@ -151,6 +155,98 @@ func TestFuncBackedValidator(t *testing.T) { }, }, }, + "should not allow setting immutable field if it is already set (v2)": { + inputRequest: admissionv1beta1.AdmissionRequest{ + RequestKind: testTypeGVKV2, + OldObject: runtime.RawExtension{ + Raw: []byte(fmt.Sprintf(` +{ + "apiVersion": "testgroup.testing.cert-manager.io/v2", + "kind": "TestType", + "metadata": { + "name": "testing", + "namespace": "abc", + "creationTimestamp": null + }, + "testFieldImmutable": "oldvalue" +} +`)), + }, + Object: runtime.RawExtension{ + Raw: []byte(fmt.Sprintf(` +{ + "apiVersion": "testgroup.testing.cert-manager.io/v2", + "kind": "TestType", + "metadata": { + "name": "testing", + "namespace": "abc", + "creationTimestamp": null + }, + "testFieldImmutable": "abc" +} +`)), + }, + }, + expectedResponse: admissionv1beta1.AdmissionResponse{ + Allowed: false, + Result: &metav1.Status{ + Status: metav1.StatusFailure, Code: http.StatusNotAcceptable, Reason: metav1.StatusReasonNotAcceptable, + Message: "testFieldImmutable: Forbidden: field is immutable once set", + }, + }, + }, + "should not allow invalid value for 'testField' field in v2": { + inputRequest: admissionv1beta1.AdmissionRequest{ + UID: types.UID("abc"), + RequestKind: testTypeGVKV2, + Object: runtime.RawExtension{ + Raw: []byte(fmt.Sprintf(` +{ + "apiVersion": "testgroup.testing.cert-manager.io/v2", + "kind": "TestType", + "metadata": { + "name": "testing", + "namespace": "abc", + "creationTimestamp": null + }, + "testField": "%s" +} +`, v2.DisallowedTestFieldValue)), + }, + }, + expectedResponse: admissionv1beta1.AdmissionResponse{ + UID: types.UID("abc"), + Allowed: false, + Result: &metav1.Status{ + Status: metav1.StatusFailure, Code: http.StatusNotAcceptable, Reason: metav1.StatusReasonNotAcceptable, + Message: "testField: Invalid value: \"not-allowed-in-v2\": value not allowed", + }, + }, + }, + "should allow value for 'testField' field in v2 if requestKind is v1": { + inputRequest: admissionv1beta1.AdmissionRequest{ + UID: types.UID("abc"), + RequestKind: testTypeGVK, + Object: runtime.RawExtension{ + Raw: []byte(fmt.Sprintf(` +{ + "apiVersion": "testgroup.testing.cert-manager.io/v2", + "kind": "TestType", + "metadata": { + "name": "testing", + "namespace": "abc", + "creationTimestamp": null + }, + "testField": "%s" +} +`, v2.DisallowedTestFieldValue)), + }, + }, + expectedResponse: admissionv1beta1.AdmissionResponse{ + UID: types.UID("abc"), + Allowed: true, + }, + }, } for n, test := range tests { diff --git a/pkg/webhook/scheme.go b/pkg/webhook/scheme.go index a94878e24..8c121494b 100644 --- a/pkg/webhook/scheme.go +++ b/pkg/webhook/scheme.go @@ -19,6 +19,7 @@ package webhook import ( "k8s.io/apimachinery/pkg/runtime" + "github.com/jetstack/cert-manager/pkg/internal/api/validation" acmeinstall "github.com/jetstack/cert-manager/pkg/internal/apis/acme/install" cminstall "github.com/jetstack/cert-manager/pkg/internal/apis/certmanager/install" metainstall "github.com/jetstack/cert-manager/pkg/internal/apis/meta/install" @@ -32,11 +33,20 @@ import ( // cert-manager APIs should have a consistent view of all API kinds. var ( + // Scheme is a Kubernetes runtime.Scheme with all internal and external API + // versions for cert-manager types registered. Scheme = runtime.NewScheme() + + // ValidationRegistry is a validation registry with all required + // validations that should be enforced by the webhook component. + ValidationRegistry = validation.NewRegistry(Scheme) ) func init() { cminstall.Install(Scheme) acmeinstall.Install(Scheme) metainstall.Install(Scheme) + + cminstall.InstallValidation(ValidationRegistry) + acmeinstall.InstallValidation(ValidationRegistry) }