Verify default and deepcopy code. Remove internal listers.

This commit is contained in:
James Munnelly 2017-08-22 12:22:58 +01:00
parent 95aa3aab95
commit d5394b5096
6 changed files with 18 additions and 242 deletions

View File

@ -2,7 +2,7 @@ ACCOUNT=jetstackexperimental
APP_NAME=cert-manager
REGISTRY=docker.io
PACKAGE_NAME=github.com/${ACCOUNT}/${APP_NAME}
PACKAGE_NAME=github.com/jetstack-experimental/cert-manager
GO_VERSION=1.8
GOOS := linux
@ -131,19 +131,5 @@ $(BINDIR)/%:
# Regenerate all files if the gen exes changed or any "types.go" files changed
.generate_files: .generate_exes $(TYPES_FILES)
# Generate defaults
$(BINDIR)/defaulter-gen \
--v 1 --logtostderr \
--go-header-file "$${GOPATH}/src/github.com/kubernetes/repo-infra/verify/boilerplate/boilerplate.go.txt" \
--input-dirs "$(PACKAGE_NAME)/pkg/apis/certmanager/v1alpha1" \
--extra-peer-dirs "$(PACKAGE_NAME)/pkg/apis/certmanager/v1alpha1" \
--output-file-base "zz_generated.defaults"
# Generate deep copies
$(BINDIR)/deepcopy-gen \
--v 1 --logtostderr \
--go-header-file "$${GOPATH}/src/github.com/kubernetes/repo-infra/verify/boilerplate/boilerplate.go.txt" \
--input-dirs "$(PACKAGE_NAME)/pkg/apis/certmanager/v1alpha1" \
--bounding-dirs "github.com/openshift/open-service-broker-sdk" \
--output-file-base zz_generated.deepcopy
# generate all pkg/client contents
$(HACK_DIR)/update-client-gen.sh

View File

@ -9,6 +9,19 @@ set -o pipefail
REPO_ROOT=$(dirname "${BASH_SOURCE}")/..
BINDIR=${REPO_ROOT}/bin
# Generate defaults
${BINDIR}/defaulter-gen \
--v 1 --logtostderr \
--go-header-file "${GOPATH}/src/github.com/kubernetes/repo-infra/verify/boilerplate/boilerplate.go.txt" \
--input-dirs "github.com/jetstack-experimental/cert-manager/pkg/apis/certmanager/v1alpha1" \
--extra-peer-dirs "github.com/jetstack-experimental/cert-manager/pkg/apis/certmanager/v1alpha1" \
--output-file-base "zz_generated.defaults"
# Generate deep copies
${BINDIR}/deepcopy-gen \
--v 1 --logtostderr \
--go-header-file "${GOPATH}/src/github.com/kubernetes/repo-infra/verify/boilerplate/boilerplate.go.txt" \
--input-dirs "github.com/jetstack-experimental/cert-manager/pkg/apis/certmanager/v1alpha1" \
--output-file-base zz_generated.deepcopy
# Generate the versioned clientset (pkg/client/clientset_generated/clientset)
${BINDIR}/client-gen "$@" \
--input-base "github.com/jetstack-experimental/cert-manager/pkg/apis/" \

View File

@ -382,13 +382,13 @@ func (in *ACMEIssuerDNS01ProviderRoute53) DeepCopyInto(out *ACMEIssuerDNS01Provi
return
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, creating a new ACMEIssuerDNS01ProviderRoute53.
func (x *ACMEIssuerDNS01ProviderRoute53) DeepCopy() *ACMEIssuerDNS01ProviderRoute53 {
if x == nil {
// 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)
x.DeepCopyInto(out)
in.DeepCopyInto(out)
return out
}

View File

@ -1,94 +0,0 @@
/*
Copyright 2017 The Kubernetes Authors.
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.
*/
// This file was automatically generated by lister-gen
package internalversion
import (
certmanager "github.com/jetstack-experimental/cert-manager/pkg/apis/certmanager"
"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 []*certmanager.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 []*certmanager.Certificate, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*certmanager.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 []*certmanager.Certificate, err error)
// Get retrieves the Certificate from the indexer for a given namespace and name.
Get(name string) (*certmanager.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 []*certmanager.Certificate, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*certmanager.Certificate))
})
return ret, err
}
// Get retrieves the Certificate from the indexer for a given namespace and name.
func (s certificateNamespaceLister) Get(name string) (*certmanager.Certificate, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(certmanager.Resource("certificate"), name)
}
return obj.(*certmanager.Certificate), nil
}

View File

@ -1,35 +0,0 @@
/*
Copyright 2017 The Kubernetes Authors.
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.
*/
// This file was automatically generated by lister-gen
package internalversion
// CertificateListerExpansion allows custom methods to be added to
// CertificateLister.
type CertificateListerExpansion interface{}
// CertificateNamespaceListerExpansion allows custom methods to be added to
// CertificateNamespaceLister.
type CertificateNamespaceListerExpansion 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{}

View File

@ -1,94 +0,0 @@
/*
Copyright 2017 The Kubernetes Authors.
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.
*/
// This file was automatically generated by lister-gen
package internalversion
import (
certmanager "github.com/jetstack-experimental/cert-manager/pkg/apis/certmanager"
"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 []*certmanager.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 []*certmanager.Issuer, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*certmanager.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 []*certmanager.Issuer, err error)
// Get retrieves the Issuer from the indexer for a given namespace and name.
Get(name string) (*certmanager.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 []*certmanager.Issuer, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*certmanager.Issuer))
})
return ret, err
}
// Get retrieves the Issuer from the indexer for a given namespace and name.
func (s issuerNamespaceLister) Get(name string) (*certmanager.Issuer, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(certmanager.Resource("issuer"), name)
}
return obj.(*certmanager.Issuer), nil
}