Merge pull request #47 from jetstack-experimental/testing
Enable golang tests
This commit is contained in:
commit
41beb069d4
5
Makefile
5
Makefile
@ -53,7 +53,7 @@ depend:
|
||||
mkdir $(BUILD_DIR)/
|
||||
|
||||
verify: .hack_verify
|
||||
test:
|
||||
test: go_test
|
||||
|
||||
build_%: depend version
|
||||
CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) go build \
|
||||
@ -62,6 +62,9 @@ build_%: depend version
|
||||
-ldflags "-X main.AppGitState=${GIT_STATE} -X main.AppGitCommit=${GIT_COMMIT} -X main.AppVersion=${APP_VERSION}" \
|
||||
./cmd/$*
|
||||
|
||||
go_test:
|
||||
go test $$(go list ./... | grep -v '/vendor/')
|
||||
|
||||
build: build_controller build_acmesolver
|
||||
|
||||
docker: docker_all
|
||||
|
||||
@ -1,9 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"k8s.io/apiserver/pkg/server"
|
||||
)
|
||||
|
||||
func main() {
|
||||
server.GenericAPIServer
|
||||
}
|
||||
@ -20,6 +20,7 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// +genclient=true
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
type Issuer struct {
|
||||
@ -95,6 +96,7 @@ type ACMEIssuerDNS01ProviderCloudflare struct {
|
||||
APIKey SecretKeySelector
|
||||
}
|
||||
|
||||
// +genclient=true
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// Certificate is a type to represent a Certificate from ACME
|
||||
|
||||
@ -0,0 +1,172 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
package internalversion
|
||||
|
||||
import (
|
||||
certmanager "github.com/jetstack-experimental/cert-manager/pkg/apis/certmanager"
|
||||
scheme "github.com/jetstack-experimental/cert-manager/pkg/client/internalclientset/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(*certmanager.Certificate) (*certmanager.Certificate, error)
|
||||
Update(*certmanager.Certificate) (*certmanager.Certificate, error)
|
||||
UpdateStatus(*certmanager.Certificate) (*certmanager.Certificate, error)
|
||||
Delete(name string, options *v1.DeleteOptions) error
|
||||
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
|
||||
Get(name string, options v1.GetOptions) (*certmanager.Certificate, error)
|
||||
List(opts v1.ListOptions) (*certmanager.CertificateList, error)
|
||||
Watch(opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *certmanager.Certificate, err error)
|
||||
CertificateExpansion
|
||||
}
|
||||
|
||||
// certificates implements CertificateInterface
|
||||
type certificates struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newCertificates returns a Certificates
|
||||
func newCertificates(c *CertmanagerClient, namespace string) *certificates {
|
||||
return &certificates{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// 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 *certmanager.Certificate) (result *certmanager.Certificate, err error) {
|
||||
result = &certmanager.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 *certmanager.Certificate) (result *certmanager.Certificate, err error) {
|
||||
result = &certmanager.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 +genclientstatus=false comment above the type to avoid generating UpdateStatus().
|
||||
|
||||
func (c *certificates) UpdateStatus(certificate *certmanager.Certificate) (result *certmanager.Certificate, err error) {
|
||||
result = &certmanager.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 {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("certificates").
|
||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// 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 *certmanager.Certificate, err error) {
|
||||
result = &certmanager.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 *certmanager.CertificateList, err error) {
|
||||
result = &certmanager.CertificateList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("certificates").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested certificates.
|
||||
func (c *certificates) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("certificates").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Watch()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched certificate.
|
||||
func (c *certificates) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *certmanager.Certificate, err error) {
|
||||
result = &certmanager.Certificate{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("certificates").
|
||||
SubResource(subresources...).
|
||||
Name(name).
|
||||
Body(data).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
@ -18,4 +18,87 @@ package internalversion
|
||||
|
||||
import (
|
||||
"github.com/jetstack-experimental/cert-manager/pkg/client/internalclientset/scheme"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
type CertmanagerInterface interface {
|
||||
RESTClient() rest.Interface
|
||||
CertificatesGetter
|
||||
IssuersGetter
|
||||
}
|
||||
|
||||
// CertmanagerClient is used to interact with features provided by the certmanager group.
|
||||
type CertmanagerClient struct {
|
||||
restClient rest.Interface
|
||||
}
|
||||
|
||||
func (c *CertmanagerClient) Certificates(namespace string) CertificateInterface {
|
||||
return newCertificates(c, namespace)
|
||||
}
|
||||
|
||||
func (c *CertmanagerClient) Issuers(namespace string) IssuerInterface {
|
||||
return newIssuers(c, namespace)
|
||||
}
|
||||
|
||||
// NewForConfig creates a new CertmanagerClient for the given config.
|
||||
func NewForConfig(c *rest.Config) (*CertmanagerClient, error) {
|
||||
config := *c
|
||||
if err := setConfigDefaults(&config); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client, err := rest.RESTClientFor(&config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &CertmanagerClient{client}, nil
|
||||
}
|
||||
|
||||
// NewForConfigOrDie creates a new CertmanagerClient for the given config and
|
||||
// panics if there is an error in the config.
|
||||
func NewForConfigOrDie(c *rest.Config) *CertmanagerClient {
|
||||
client, err := NewForConfig(c)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return client
|
||||
}
|
||||
|
||||
// New creates a new CertmanagerClient for the given RESTClient.
|
||||
func New(c rest.Interface) *CertmanagerClient {
|
||||
return &CertmanagerClient{c}
|
||||
}
|
||||
|
||||
func setConfigDefaults(config *rest.Config) error {
|
||||
g, err := scheme.Registry.Group("certmanager")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
config.APIPath = "/apis"
|
||||
if config.UserAgent == "" {
|
||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||
}
|
||||
if config.GroupVersion == nil || config.GroupVersion.Group != g.GroupVersion.Group {
|
||||
gv := g.GroupVersion
|
||||
config.GroupVersion = &gv
|
||||
}
|
||||
config.NegotiatedSerializer = scheme.Codecs
|
||||
|
||||
if config.QPS == 0 {
|
||||
config.QPS = 5
|
||||
}
|
||||
if config.Burst == 0 {
|
||||
config.Burst = 10
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *CertmanagerClient) RESTClient() rest.Interface {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
return c.restClient
|
||||
}
|
||||
|
||||
@ -0,0 +1,130 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
certmanager "github.com/jetstack-experimental/cert-manager/pkg/apis/certmanager"
|
||||
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 *FakeCertmanager
|
||||
ns string
|
||||
}
|
||||
|
||||
var certificatesResource = schema.GroupVersionResource{Group: "certmanager", Version: "", Resource: "certificates"}
|
||||
|
||||
var certificatesKind = schema.GroupVersionKind{Group: "certmanager", Version: "", Kind: "Certificate"}
|
||||
|
||||
func (c *FakeCertificates) Create(certificate *certmanager.Certificate) (result *certmanager.Certificate, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(certificatesResource, c.ns, certificate), &certmanager.Certificate{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*certmanager.Certificate), err
|
||||
}
|
||||
|
||||
func (c *FakeCertificates) Update(certificate *certmanager.Certificate) (result *certmanager.Certificate, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(certificatesResource, c.ns, certificate), &certmanager.Certificate{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*certmanager.Certificate), err
|
||||
}
|
||||
|
||||
func (c *FakeCertificates) UpdateStatus(certificate *certmanager.Certificate) (*certmanager.Certificate, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(certificatesResource, "status", c.ns, certificate), &certmanager.Certificate{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*certmanager.Certificate), err
|
||||
}
|
||||
|
||||
func (c *FakeCertificates) Delete(name string, options *v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteAction(certificatesResource, c.ns, name), &certmanager.Certificate{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *FakeCertificates) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(certificatesResource, c.ns, listOptions)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &certmanager.CertificateList{})
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *FakeCertificates) Get(name string, options v1.GetOptions) (result *certmanager.Certificate, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(certificatesResource, c.ns, name), &certmanager.Certificate{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*certmanager.Certificate), err
|
||||
}
|
||||
|
||||
func (c *FakeCertificates) List(opts v1.ListOptions) (result *certmanager.CertificateList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(certificatesResource, certificatesKind, c.ns, opts), &certmanager.CertificateList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &certmanager.CertificateList{}
|
||||
for _, item := range obj.(*certmanager.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))
|
||||
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched certificate.
|
||||
func (c *FakeCertificates) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *certmanager.Certificate, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(certificatesResource, c.ns, name, data, subresources...), &certmanager.Certificate{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*certmanager.Certificate), err
|
||||
}
|
||||
@ -18,4 +18,25 @@ package fake
|
||||
|
||||
import (
|
||||
internalversion "github.com/jetstack-experimental/cert-manager/pkg/client/internalclientset/typed/certmanager/internalversion"
|
||||
rest "k8s.io/client-go/rest"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
type FakeCertmanager struct {
|
||||
*testing.Fake
|
||||
}
|
||||
|
||||
func (c *FakeCertmanager) Certificates(namespace string) internalversion.CertificateInterface {
|
||||
return &FakeCertificates{c, namespace}
|
||||
}
|
||||
|
||||
func (c *FakeCertmanager) Issuers(namespace string) internalversion.IssuerInterface {
|
||||
return &FakeIssuers{c, namespace}
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *FakeCertmanager) RESTClient() rest.Interface {
|
||||
var ret *rest.RESTClient
|
||||
return ret
|
||||
}
|
||||
|
||||
@ -0,0 +1,130 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
certmanager "github.com/jetstack-experimental/cert-manager/pkg/apis/certmanager"
|
||||
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 *FakeCertmanager
|
||||
ns string
|
||||
}
|
||||
|
||||
var issuersResource = schema.GroupVersionResource{Group: "certmanager", Version: "", Resource: "issuers"}
|
||||
|
||||
var issuersKind = schema.GroupVersionKind{Group: "certmanager", Version: "", Kind: "Issuer"}
|
||||
|
||||
func (c *FakeIssuers) Create(issuer *certmanager.Issuer) (result *certmanager.Issuer, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(issuersResource, c.ns, issuer), &certmanager.Issuer{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*certmanager.Issuer), err
|
||||
}
|
||||
|
||||
func (c *FakeIssuers) Update(issuer *certmanager.Issuer) (result *certmanager.Issuer, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(issuersResource, c.ns, issuer), &certmanager.Issuer{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*certmanager.Issuer), err
|
||||
}
|
||||
|
||||
func (c *FakeIssuers) UpdateStatus(issuer *certmanager.Issuer) (*certmanager.Issuer, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(issuersResource, "status", c.ns, issuer), &certmanager.Issuer{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*certmanager.Issuer), err
|
||||
}
|
||||
|
||||
func (c *FakeIssuers) Delete(name string, options *v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteAction(issuersResource, c.ns, name), &certmanager.Issuer{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *FakeIssuers) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(issuersResource, c.ns, listOptions)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &certmanager.IssuerList{})
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *FakeIssuers) Get(name string, options v1.GetOptions) (result *certmanager.Issuer, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(issuersResource, c.ns, name), &certmanager.Issuer{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*certmanager.Issuer), err
|
||||
}
|
||||
|
||||
func (c *FakeIssuers) List(opts v1.ListOptions) (result *certmanager.IssuerList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(issuersResource, issuersKind, c.ns, opts), &certmanager.IssuerList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &certmanager.IssuerList{}
|
||||
for _, item := range obj.(*certmanager.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))
|
||||
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched issuer.
|
||||
func (c *FakeIssuers) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *certmanager.Issuer, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(issuersResource, c.ns, name, data, subresources...), &certmanager.Issuer{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*certmanager.Issuer), err
|
||||
}
|
||||
@ -15,3 +15,7 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
package internalversion
|
||||
|
||||
type CertificateExpansion interface{}
|
||||
|
||||
type IssuerExpansion interface{}
|
||||
|
||||
@ -0,0 +1,172 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
package internalversion
|
||||
|
||||
import (
|
||||
certmanager "github.com/jetstack-experimental/cert-manager/pkg/apis/certmanager"
|
||||
scheme "github.com/jetstack-experimental/cert-manager/pkg/client/internalclientset/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(*certmanager.Issuer) (*certmanager.Issuer, error)
|
||||
Update(*certmanager.Issuer) (*certmanager.Issuer, error)
|
||||
UpdateStatus(*certmanager.Issuer) (*certmanager.Issuer, error)
|
||||
Delete(name string, options *v1.DeleteOptions) error
|
||||
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
|
||||
Get(name string, options v1.GetOptions) (*certmanager.Issuer, error)
|
||||
List(opts v1.ListOptions) (*certmanager.IssuerList, error)
|
||||
Watch(opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *certmanager.Issuer, err error)
|
||||
IssuerExpansion
|
||||
}
|
||||
|
||||
// issuers implements IssuerInterface
|
||||
type issuers struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newIssuers returns a Issuers
|
||||
func newIssuers(c *CertmanagerClient, namespace string) *issuers {
|
||||
return &issuers{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// 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 *certmanager.Issuer) (result *certmanager.Issuer, err error) {
|
||||
result = &certmanager.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 *certmanager.Issuer) (result *certmanager.Issuer, err error) {
|
||||
result = &certmanager.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 +genclientstatus=false comment above the type to avoid generating UpdateStatus().
|
||||
|
||||
func (c *issuers) UpdateStatus(issuer *certmanager.Issuer) (result *certmanager.Issuer, err error) {
|
||||
result = &certmanager.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 {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("issuers").
|
||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// 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 *certmanager.Issuer, err error) {
|
||||
result = &certmanager.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 *certmanager.IssuerList, err error) {
|
||||
result = &certmanager.IssuerList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("issuers").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested issuers.
|
||||
func (c *issuers) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("issuers").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Watch()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched issuer.
|
||||
func (c *issuers) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *certmanager.Issuer, err error) {
|
||||
result = &certmanager.Issuer{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("issuers").
|
||||
SubResource(subresources...).
|
||||
Name(name).
|
||||
Body(data).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
44
pkg/informers/internalversion/certmanager/interface.go
Normal file
44
pkg/informers/internalversion/certmanager/interface.go
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
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 informer-gen
|
||||
|
||||
package certmanager
|
||||
|
||||
import (
|
||||
internalversion "github.com/jetstack-experimental/cert-manager/pkg/informers/internalversion/certmanager/internalversion"
|
||||
internalinterfaces "github.com/jetstack-experimental/cert-manager/pkg/informers/internalversion/internalinterfaces"
|
||||
)
|
||||
|
||||
// Interface provides access to each of this group's versions.
|
||||
type Interface interface {
|
||||
// InternalVersion provides access to shared informers for resources in InternalVersion.
|
||||
InternalVersion() internalversion.Interface
|
||||
}
|
||||
|
||||
type group struct {
|
||||
internalinterfaces.SharedInformerFactory
|
||||
}
|
||||
|
||||
// New returns a new Interface.
|
||||
func New(f internalinterfaces.SharedInformerFactory) Interface {
|
||||
return &group{f}
|
||||
}
|
||||
|
||||
// InternalVersion returns a new internalversion.Interface.
|
||||
func (g *group) InternalVersion() internalversion.Interface {
|
||||
return internalversion.New(g.SharedInformerFactory)
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
/*
|
||||
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 informer-gen
|
||||
|
||||
package internalversion
|
||||
|
||||
import (
|
||||
certmanager "github.com/jetstack-experimental/cert-manager/pkg/apis/certmanager"
|
||||
internalclientset "github.com/jetstack-experimental/cert-manager/pkg/client/internalclientset"
|
||||
internalinterfaces "github.com/jetstack-experimental/cert-manager/pkg/informers/internalversion/internalinterfaces"
|
||||
internalversion "github.com/jetstack-experimental/cert-manager/pkg/listers/certmanager/internalversion"
|
||||
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"
|
||||
time "time"
|
||||
)
|
||||
|
||||
// CertificateInformer provides access to a shared informer and lister for
|
||||
// Certificates.
|
||||
type CertificateInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() internalversion.CertificateLister
|
||||
}
|
||||
|
||||
type certificateInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
}
|
||||
|
||||
func newCertificateInformer(client internalclientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
sharedIndexInformer := cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
||||
return client.Certmanager().Certificates(v1.NamespaceAll).List(options)
|
||||
},
|
||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||
return client.Certmanager().Certificates(v1.NamespaceAll).Watch(options)
|
||||
},
|
||||
},
|
||||
&certmanager.Certificate{},
|
||||
resyncPeriod,
|
||||
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc},
|
||||
)
|
||||
|
||||
return sharedIndexInformer
|
||||
}
|
||||
|
||||
func (f *certificateInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&certmanager.Certificate{}, newCertificateInformer)
|
||||
}
|
||||
|
||||
func (f *certificateInformer) Lister() internalversion.CertificateLister {
|
||||
return internalversion.NewCertificateLister(f.Informer().GetIndexer())
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
/*
|
||||
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 informer-gen
|
||||
|
||||
package internalversion
|
||||
|
||||
import (
|
||||
internalinterfaces "github.com/jetstack-experimental/cert-manager/pkg/informers/internalversion/internalinterfaces"
|
||||
)
|
||||
|
||||
// Interface provides access to all the informers in this group version.
|
||||
type Interface interface {
|
||||
// Certificates returns a CertificateInformer.
|
||||
Certificates() CertificateInformer
|
||||
// Issuers returns a IssuerInformer.
|
||||
Issuers() IssuerInformer
|
||||
}
|
||||
|
||||
type version struct {
|
||||
internalinterfaces.SharedInformerFactory
|
||||
}
|
||||
|
||||
// New returns a new Interface.
|
||||
func New(f internalinterfaces.SharedInformerFactory) Interface {
|
||||
return &version{f}
|
||||
}
|
||||
|
||||
// Certificates returns a CertificateInformer.
|
||||
func (v *version) Certificates() CertificateInformer {
|
||||
return &certificateInformer{factory: v.SharedInformerFactory}
|
||||
}
|
||||
|
||||
// Issuers returns a IssuerInformer.
|
||||
func (v *version) Issuers() IssuerInformer {
|
||||
return &issuerInformer{factory: v.SharedInformerFactory}
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
/*
|
||||
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 informer-gen
|
||||
|
||||
package internalversion
|
||||
|
||||
import (
|
||||
certmanager "github.com/jetstack-experimental/cert-manager/pkg/apis/certmanager"
|
||||
internalclientset "github.com/jetstack-experimental/cert-manager/pkg/client/internalclientset"
|
||||
internalinterfaces "github.com/jetstack-experimental/cert-manager/pkg/informers/internalversion/internalinterfaces"
|
||||
internalversion "github.com/jetstack-experimental/cert-manager/pkg/listers/certmanager/internalversion"
|
||||
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"
|
||||
time "time"
|
||||
)
|
||||
|
||||
// IssuerInformer provides access to a shared informer and lister for
|
||||
// Issuers.
|
||||
type IssuerInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() internalversion.IssuerLister
|
||||
}
|
||||
|
||||
type issuerInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
}
|
||||
|
||||
func newIssuerInformer(client internalclientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
sharedIndexInformer := cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
||||
return client.Certmanager().Issuers(v1.NamespaceAll).List(options)
|
||||
},
|
||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||
return client.Certmanager().Issuers(v1.NamespaceAll).Watch(options)
|
||||
},
|
||||
},
|
||||
&certmanager.Issuer{},
|
||||
resyncPeriod,
|
||||
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc},
|
||||
)
|
||||
|
||||
return sharedIndexInformer
|
||||
}
|
||||
|
||||
func (f *issuerInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&certmanager.Issuer{}, newIssuerInformer)
|
||||
}
|
||||
|
||||
func (f *issuerInformer) Lister() internalversion.IssuerLister {
|
||||
return internalversion.NewIssuerLister(f.Informer().GetIndexer())
|
||||
}
|
||||
@ -20,6 +20,7 @@ package internalversion
|
||||
|
||||
import (
|
||||
internalclientset "github.com/jetstack-experimental/cert-manager/pkg/client/internalclientset"
|
||||
certmanager "github.com/jetstack-experimental/cert-manager/pkg/informers/internalversion/certmanager"
|
||||
internalinterfaces "github.com/jetstack-experimental/cert-manager/pkg/informers/internalversion/internalinterfaces"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
@ -108,4 +109,10 @@ type SharedInformerFactory interface {
|
||||
internalinterfaces.SharedInformerFactory
|
||||
ForResource(resource schema.GroupVersionResource) (GenericInformer, error)
|
||||
WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool
|
||||
|
||||
Certmanager() certmanager.Interface
|
||||
}
|
||||
|
||||
func (f *sharedInformerFactory) Certmanager() certmanager.Interface {
|
||||
return certmanager.New(f)
|
||||
}
|
||||
|
||||
@ -20,6 +20,7 @@ package internalversion
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
certmanager "github.com/jetstack-experimental/cert-manager/pkg/apis/certmanager"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
)
|
||||
@ -50,6 +51,12 @@ func (f *genericInformer) Lister() cache.GenericLister {
|
||||
// TODO extend this to unknown resources with a client pool
|
||||
func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) {
|
||||
switch resource {
|
||||
// Group=Certmanager, Version=InternalVersion
|
||||
case certmanager.SchemeGroupVersion.WithResource("certificates"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Certmanager().InternalVersion().Certificates().Informer()}, nil
|
||||
case certmanager.SchemeGroupVersion.WithResource("issuers"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Certmanager().InternalVersion().Issuers().Informer()}, nil
|
||||
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("no informer found for %v", resource)
|
||||
|
||||
94
pkg/listers/certmanager/internalversion/certificate.go
Normal file
94
pkg/listers/certmanager/internalversion/certificate.go
Normal file
@ -0,0 +1,94 @@
|
||||
/*
|
||||
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
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
/*
|
||||
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{}
|
||||
94
pkg/listers/certmanager/internalversion/issuer.go
Normal file
94
pkg/listers/certmanager/internalversion/issuer.go
Normal file
@ -0,0 +1,94 @@
|
||||
/*
|
||||
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
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user