1
0
mirror of https://github.com/rancher/rke.git synced 2025-07-10 13:54:04 +00:00

update vendor

This commit is contained in:
Guangbo Chen 2018-12-13 16:54:03 +08:00 committed by Alena Prokharchyk
parent 9cfe5661d8
commit c6a60bfd83
9 changed files with 782 additions and 1 deletions

View File

@ -28,4 +28,4 @@ github.com/matttproud/golang_protobuf_extensions c12348ce28de40eed0136aa2b644d0e
github.com/mattn/go-colorable efa589957cd060542a26d2dd7832fd6a6c6c3ade
github.com/mattn/go-isatty 6ca4dbf54d38eea1a992b3c722a76a5d1c4cb25c
github.com/rancher/norman 0557aa4ff31a3a0f007dcb1b684894f23cda390c
github.com/rancher/types db4a9fe5448517c8006c82199541ebfccf3caaa1
github.com/rancher/types 4bbd2dbd8de1cc906863467777afa2003c81b5cf

View File

@ -0,0 +1,70 @@
package v3
import (
"github.com/rancher/norman/condition"
"github.com/rancher/norman/types"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
const (
BackupConditionCreated condition.Cond = "Created"
BackupConditionCompleted condition.Cond = "Completed"
BackupConditionRestored condition.Cond = "Restored"
)
type BackupConfig struct {
// Backup interval in hours
IntervalHours int `yaml:"interval_hours" json:"intervalHours,omitempty" norman:"default=12"`
// Number of backups to keep
Retention int `yaml:"retention" json:"retention,omitempty" norman:"default=6"`
// s3 target
S3BackupConfig *S3BackupConfig `yaml:",omitempty" json:"s3BackupConfig"`
}
type S3BackupConfig struct {
// Access key ID
AccessKey string `yaml:"access_key" json:"accessKey,omitempty"`
// Secret access key
SecretKey string `yaml:"secret_key" json:"secretKey,omitempty" norman:"required,type=password" `
// name of the bucket to use for backup
BucketName string `yaml:"bucket_name" json:"bucketName,omitempty"`
// AWS Region, AWS spcific
Region string `yaml:"region" json:"region,omitempty"`
// Endpoint is used if this is not an AWS API
Endpoint string `yaml:"endpoint" json:"endpoint"`
}
type EtcdBackup struct {
types.Namespaced
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
// cluster ID
ClusterID string `json:"clusterId,omitempty" norman:"required,type=reference[cluster]"`
// actual file name on the target
Filename string `yaml:"filename" json:"filename,omitempty"`
// backupConfig
BackupConfig BackupConfig `yaml:",omitempty" json:"backupConfig,omitempty"`
// backup status
Status EtcdBackupStatus `yaml:"status" json:"status,omitempty"`
}
type EtcdBackupStatus struct {
Conditions []EtcdBackupCondition `json:"conditions"`
}
type EtcdBackupCondition struct {
// Type of condition.
Type string `json:"type"`
// Status of the condition, one of True, False, Unknown.
Status v1.ConditionStatus `json:"status"`
// The last time this condition was updated.
LastUpdateTime string `json:"lastUpdateTime,omitempty"`
// Last time the condition transitioned from one status to another.
LastTransitionTime string `json:"lastTransitionTime,omitempty"`
// The reason for the condition's last transition.
Reason string `json:"reason,omitempty"`
// Human-readable message indicating details about last transition
Message string `json:"message,omitempty"`
}

View File

@ -237,6 +237,11 @@ type IngressCapabilities struct {
type MonitoringInput struct {
Answers map[string]string `json:"answers,omitempty"`
}
type RestoreFromEtcdBackupInput struct {
EtcdBackupName string `json:"etcdBackupName,omitempty" norman:"type=reference[etcdBackup]"`
}
type RotateCertificateInput struct {
CACertificates bool `json:"caCertificates,omitempty"`
Services []string `json:"services,omitempty" norman:"type=enum,options=etcd|kubelet|kube-apiserver|kube-proxy|kube-scheduler|kube-controller-manager"`

View File

@ -41,6 +41,8 @@ type RancherKubernetesEngineConfig struct {
BastionHost BastionHost `yaml:"bastion_host" json:"bastionHost,omitempty"`
// Monitoring Config
Monitoring MonitoringConfig `yaml:"monitoring" json:"monitoring,omitempty"`
// RestoreCluster flag
Restore RestoreConfig `yaml:"restore" json:"restore,omitempty"`
// Rotating Certificates Option
RotateCertificates *RotateCertificates `yaml:"rotate_certificates,omitempty" json:"rotateCertificates,omitempty"`
}
@ -185,6 +187,8 @@ type ETCDService struct {
Retention string `yaml:"retention" json:"retention,omitempty" norman:"default=72h"`
// Etcd snapshot Creation period
Creation string `yaml:"creation" json:"creation,omitempty" norman:"default=12h"`
// Backup backend for etcd snapshots, used by rke only
BackupConfig *BackupConfig `yaml:"backup_target" json:"backupConfig,omitempty"`
}
type KubeAPIService struct {
@ -583,6 +587,10 @@ type MonitoringConfig struct {
Options map[string]string `yaml:"options" json:"options,omitempty"`
}
type RestoreConfig struct {
Restore bool `yaml:"restore" json:"restore,omitempty"`
SnapshotName string `yaml:"snapshot_name" json:"snapshotName,omitempty"`
}
type RotateCertificates struct {
// Rotate CA Certificates
CACertificates bool `json:"caCertificates,omitempty"`

View File

@ -399,6 +399,27 @@ func (in *AzureCloudProvider) DeepCopy() *AzureCloudProvider {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *BackupConfig) DeepCopyInto(out *BackupConfig) {
*out = *in
if in.S3BackupConfig != nil {
in, out := &in.S3BackupConfig, &out.S3BackupConfig
*out = new(S3BackupConfig)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupConfig.
func (in *BackupConfig) DeepCopy() *BackupConfig {
if in == nil {
return nil
}
out := new(BackupConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *BaseService) DeepCopyInto(out *BaseService) {
*out = *in
@ -2028,6 +2049,11 @@ func (in *ETCDService) DeepCopyInto(out *ETCDService) {
*out = new(bool)
**out = **in
}
if in.BackupConfig != nil {
in, out := &in.BackupConfig, &out.BackupConfig
*out = new(BackupConfig)
(*in).DeepCopyInto(*out)
}
return
}
@ -2057,6 +2083,105 @@ func (in *ElasticsearchConfig) DeepCopy() *ElasticsearchConfig {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *EtcdBackup) DeepCopyInto(out *EtcdBackup) {
*out = *in
out.Namespaced = in.Namespaced
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.BackupConfig.DeepCopyInto(&out.BackupConfig)
in.Status.DeepCopyInto(&out.Status)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EtcdBackup.
func (in *EtcdBackup) DeepCopy() *EtcdBackup {
if in == nil {
return nil
}
out := new(EtcdBackup)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *EtcdBackup) 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 *EtcdBackupCondition) DeepCopyInto(out *EtcdBackupCondition) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EtcdBackupCondition.
func (in *EtcdBackupCondition) DeepCopy() *EtcdBackupCondition {
if in == nil {
return nil
}
out := new(EtcdBackupCondition)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *EtcdBackupList) DeepCopyInto(out *EtcdBackupList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]EtcdBackup, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EtcdBackupList.
func (in *EtcdBackupList) DeepCopy() *EtcdBackupList {
if in == nil {
return nil
}
out := new(EtcdBackupList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *EtcdBackupList) 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 *EtcdBackupStatus) DeepCopyInto(out *EtcdBackupStatus) {
*out = *in
if in.Conditions != nil {
in, out := &in.Conditions, &out.Conditions
*out = make([]EtcdBackupCondition, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EtcdBackupStatus.
func (in *EtcdBackupStatus) DeepCopy() *EtcdBackupStatus {
if in == nil {
return nil
}
out := new(EtcdBackupStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *EventRule) DeepCopyInto(out *EventRule) {
*out = *in
@ -6418,6 +6543,7 @@ func (in *RancherKubernetesEngineConfig) DeepCopyInto(out *RancherKubernetesEngi
in.CloudProvider.DeepCopyInto(&out.CloudProvider)
out.BastionHost = in.BastionHost
in.Monitoring.DeepCopyInto(&out.Monitoring)
out.Restore = in.Restore
if in.RotateCertificates != nil {
in, out := &in.RotateCertificates, &out.RotateCertificates
*out = new(RotateCertificates)
@ -6468,6 +6594,38 @@ func (in *ResourceQuotaLimit) DeepCopy() *ResourceQuotaLimit {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RestoreConfig) DeepCopyInto(out *RestoreConfig) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RestoreConfig.
func (in *RestoreConfig) DeepCopy() *RestoreConfig {
if in == nil {
return nil
}
out := new(RestoreConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RestoreFromEtcdBackupInput) DeepCopyInto(out *RestoreFromEtcdBackupInput) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RestoreFromEtcdBackupInput.
func (in *RestoreFromEtcdBackupInput) DeepCopy() *RestoreFromEtcdBackupInput {
if in == nil {
return nil
}
out := new(RestoreFromEtcdBackupInput)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RoleTemplate) DeepCopyInto(out *RoleTemplate) {
*out = *in
@ -6613,6 +6771,22 @@ func (in *RouteOpenstackOpts) DeepCopy() *RouteOpenstackOpts {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *S3BackupConfig) DeepCopyInto(out *S3BackupConfig) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S3BackupConfig.
func (in *S3BackupConfig) DeepCopy() *S3BackupConfig {
if in == nil {
return nil
}
out := new(S3BackupConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *SMTPConfig) DeepCopyInto(out *SMTPConfig) {
*out = *in

View File

@ -0,0 +1,440 @@
package v3
import (
"context"
"github.com/rancher/norman/controller"
"github.com/rancher/norman/objectclient"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/tools/cache"
)
var (
EtcdBackupGroupVersionKind = schema.GroupVersionKind{
Version: Version,
Group: GroupName,
Kind: "EtcdBackup",
}
EtcdBackupResource = metav1.APIResource{
Name: "etcdbackups",
SingularName: "etcdbackup",
Namespaced: true,
Kind: EtcdBackupGroupVersionKind.Kind,
}
)
func NewEtcdBackup(namespace, name string, obj EtcdBackup) *EtcdBackup {
obj.APIVersion, obj.Kind = EtcdBackupGroupVersionKind.ToAPIVersionAndKind()
obj.Name = name
obj.Namespace = namespace
return &obj
}
type EtcdBackupList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []EtcdBackup
}
type EtcdBackupHandlerFunc func(key string, obj *EtcdBackup) (runtime.Object, error)
type EtcdBackupChangeHandlerFunc func(obj *EtcdBackup) (runtime.Object, error)
type EtcdBackupLister interface {
List(namespace string, selector labels.Selector) (ret []*EtcdBackup, err error)
Get(namespace, name string) (*EtcdBackup, error)
}
type EtcdBackupController interface {
Generic() controller.GenericController
Informer() cache.SharedIndexInformer
Lister() EtcdBackupLister
AddHandler(ctx context.Context, name string, handler EtcdBackupHandlerFunc)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, handler EtcdBackupHandlerFunc)
Enqueue(namespace, name string)
Sync(ctx context.Context) error
Start(ctx context.Context, threadiness int) error
}
type EtcdBackupInterface interface {
ObjectClient() *objectclient.ObjectClient
Create(*EtcdBackup) (*EtcdBackup, error)
GetNamespaced(namespace, name string, opts metav1.GetOptions) (*EtcdBackup, error)
Get(name string, opts metav1.GetOptions) (*EtcdBackup, error)
Update(*EtcdBackup) (*EtcdBackup, error)
Delete(name string, options *metav1.DeleteOptions) error
DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error
List(opts metav1.ListOptions) (*EtcdBackupList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error
Controller() EtcdBackupController
AddHandler(ctx context.Context, name string, sync EtcdBackupHandlerFunc)
AddLifecycle(ctx context.Context, name string, lifecycle EtcdBackupLifecycle)
AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync EtcdBackupHandlerFunc)
AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle EtcdBackupLifecycle)
}
type etcdBackupLister struct {
controller *etcdBackupController
}
func (l *etcdBackupLister) List(namespace string, selector labels.Selector) (ret []*EtcdBackup, err error) {
err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) {
ret = append(ret, obj.(*EtcdBackup))
})
return
}
func (l *etcdBackupLister) Get(namespace, name string) (*EtcdBackup, error) {
var key string
if namespace != "" {
key = namespace + "/" + name
} else {
key = name
}
obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(key)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(schema.GroupResource{
Group: EtcdBackupGroupVersionKind.Group,
Resource: "etcdBackup",
}, key)
}
return obj.(*EtcdBackup), nil
}
type etcdBackupController struct {
controller.GenericController
}
func (c *etcdBackupController) Generic() controller.GenericController {
return c.GenericController
}
func (c *etcdBackupController) Lister() EtcdBackupLister {
return &etcdBackupLister{
controller: c,
}
}
func (c *etcdBackupController) AddHandler(ctx context.Context, name string, handler EtcdBackupHandlerFunc) {
c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {
if obj == nil {
return handler(key, nil)
} else if v, ok := obj.(*EtcdBackup); ok {
return handler(key, v)
} else {
return nil, nil
}
})
}
func (c *etcdBackupController) AddClusterScopedHandler(ctx context.Context, name, cluster string, handler EtcdBackupHandlerFunc) {
c.GenericController.AddHandler(ctx, name, func(key string, obj interface{}) (interface{}, error) {
if obj == nil {
return handler(key, nil)
} else if v, ok := obj.(*EtcdBackup); ok && controller.ObjectInCluster(cluster, obj) {
return handler(key, v)
} else {
return nil, nil
}
})
}
type etcdBackupFactory struct {
}
func (c etcdBackupFactory) Object() runtime.Object {
return &EtcdBackup{}
}
func (c etcdBackupFactory) List() runtime.Object {
return &EtcdBackupList{}
}
func (s *etcdBackupClient) Controller() EtcdBackupController {
s.client.Lock()
defer s.client.Unlock()
c, ok := s.client.etcdBackupControllers[s.ns]
if ok {
return c
}
genericController := controller.NewGenericController(EtcdBackupGroupVersionKind.Kind+"Controller",
s.objectClient)
c = &etcdBackupController{
GenericController: genericController,
}
s.client.etcdBackupControllers[s.ns] = c
s.client.starters = append(s.client.starters, c)
return c
}
type etcdBackupClient struct {
client *Client
ns string
objectClient *objectclient.ObjectClient
controller EtcdBackupController
}
func (s *etcdBackupClient) ObjectClient() *objectclient.ObjectClient {
return s.objectClient
}
func (s *etcdBackupClient) Create(o *EtcdBackup) (*EtcdBackup, error) {
obj, err := s.objectClient.Create(o)
return obj.(*EtcdBackup), err
}
func (s *etcdBackupClient) Get(name string, opts metav1.GetOptions) (*EtcdBackup, error) {
obj, err := s.objectClient.Get(name, opts)
return obj.(*EtcdBackup), err
}
func (s *etcdBackupClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*EtcdBackup, error) {
obj, err := s.objectClient.GetNamespaced(namespace, name, opts)
return obj.(*EtcdBackup), err
}
func (s *etcdBackupClient) Update(o *EtcdBackup) (*EtcdBackup, error) {
obj, err := s.objectClient.Update(o.Name, o)
return obj.(*EtcdBackup), err
}
func (s *etcdBackupClient) Delete(name string, options *metav1.DeleteOptions) error {
return s.objectClient.Delete(name, options)
}
func (s *etcdBackupClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error {
return s.objectClient.DeleteNamespaced(namespace, name, options)
}
func (s *etcdBackupClient) List(opts metav1.ListOptions) (*EtcdBackupList, error) {
obj, err := s.objectClient.List(opts)
return obj.(*EtcdBackupList), err
}
func (s *etcdBackupClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return s.objectClient.Watch(opts)
}
// Patch applies the patch and returns the patched deployment.
func (s *etcdBackupClient) Patch(o *EtcdBackup, patchType types.PatchType, data []byte, subresources ...string) (*EtcdBackup, error) {
obj, err := s.objectClient.Patch(o.Name, o, patchType, data, subresources...)
return obj.(*EtcdBackup), err
}
func (s *etcdBackupClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error {
return s.objectClient.DeleteCollection(deleteOpts, listOpts)
}
func (s *etcdBackupClient) AddHandler(ctx context.Context, name string, sync EtcdBackupHandlerFunc) {
s.Controller().AddHandler(ctx, name, sync)
}
func (s *etcdBackupClient) AddLifecycle(ctx context.Context, name string, lifecycle EtcdBackupLifecycle) {
sync := NewEtcdBackupLifecycleAdapter(name, false, s, lifecycle)
s.Controller().AddHandler(ctx, name, sync)
}
func (s *etcdBackupClient) AddClusterScopedHandler(ctx context.Context, name, clusterName string, sync EtcdBackupHandlerFunc) {
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
func (s *etcdBackupClient) AddClusterScopedLifecycle(ctx context.Context, name, clusterName string, lifecycle EtcdBackupLifecycle) {
sync := NewEtcdBackupLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle)
s.Controller().AddClusterScopedHandler(ctx, name, clusterName, sync)
}
type EtcdBackupIndexer func(obj *EtcdBackup) ([]string, error)
type EtcdBackupClientCache interface {
Get(namespace, name string) (*EtcdBackup, error)
List(namespace string, selector labels.Selector) ([]*EtcdBackup, error)
Index(name string, indexer EtcdBackupIndexer)
GetIndexed(name, key string) ([]*EtcdBackup, error)
}
type EtcdBackupClient interface {
Create(*EtcdBackup) (*EtcdBackup, error)
Get(namespace, name string, opts metav1.GetOptions) (*EtcdBackup, error)
Update(*EtcdBackup) (*EtcdBackup, error)
Delete(namespace, name string, options *metav1.DeleteOptions) error
List(namespace string, opts metav1.ListOptions) (*EtcdBackupList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
Cache() EtcdBackupClientCache
OnCreate(ctx context.Context, name string, sync EtcdBackupChangeHandlerFunc)
OnChange(ctx context.Context, name string, sync EtcdBackupChangeHandlerFunc)
OnRemove(ctx context.Context, name string, sync EtcdBackupChangeHandlerFunc)
Enqueue(namespace, name string)
Generic() controller.GenericController
ObjectClient() *objectclient.ObjectClient
Interface() EtcdBackupInterface
}
type etcdBackupClientCache struct {
client *etcdBackupClient2
}
type etcdBackupClient2 struct {
iface EtcdBackupInterface
controller EtcdBackupController
}
func (n *etcdBackupClient2) Interface() EtcdBackupInterface {
return n.iface
}
func (n *etcdBackupClient2) Generic() controller.GenericController {
return n.iface.Controller().Generic()
}
func (n *etcdBackupClient2) ObjectClient() *objectclient.ObjectClient {
return n.Interface().ObjectClient()
}
func (n *etcdBackupClient2) Enqueue(namespace, name string) {
n.iface.Controller().Enqueue(namespace, name)
}
func (n *etcdBackupClient2) Create(obj *EtcdBackup) (*EtcdBackup, error) {
return n.iface.Create(obj)
}
func (n *etcdBackupClient2) Get(namespace, name string, opts metav1.GetOptions) (*EtcdBackup, error) {
return n.iface.GetNamespaced(namespace, name, opts)
}
func (n *etcdBackupClient2) Update(obj *EtcdBackup) (*EtcdBackup, error) {
return n.iface.Update(obj)
}
func (n *etcdBackupClient2) Delete(namespace, name string, options *metav1.DeleteOptions) error {
return n.iface.DeleteNamespaced(namespace, name, options)
}
func (n *etcdBackupClient2) List(namespace string, opts metav1.ListOptions) (*EtcdBackupList, error) {
return n.iface.List(opts)
}
func (n *etcdBackupClient2) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return n.iface.Watch(opts)
}
func (n *etcdBackupClientCache) Get(namespace, name string) (*EtcdBackup, error) {
return n.client.controller.Lister().Get(namespace, name)
}
func (n *etcdBackupClientCache) List(namespace string, selector labels.Selector) ([]*EtcdBackup, error) {
return n.client.controller.Lister().List(namespace, selector)
}
func (n *etcdBackupClient2) Cache() EtcdBackupClientCache {
n.loadController()
return &etcdBackupClientCache{
client: n,
}
}
func (n *etcdBackupClient2) OnCreate(ctx context.Context, name string, sync EtcdBackupChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name+"-create", &etcdBackupLifecycleDelegate{create: sync})
}
func (n *etcdBackupClient2) OnChange(ctx context.Context, name string, sync EtcdBackupChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name+"-change", &etcdBackupLifecycleDelegate{update: sync})
}
func (n *etcdBackupClient2) OnRemove(ctx context.Context, name string, sync EtcdBackupChangeHandlerFunc) {
n.loadController()
n.iface.AddLifecycle(ctx, name, &etcdBackupLifecycleDelegate{remove: sync})
}
func (n *etcdBackupClientCache) Index(name string, indexer EtcdBackupIndexer) {
err := n.client.controller.Informer().GetIndexer().AddIndexers(map[string]cache.IndexFunc{
name: func(obj interface{}) ([]string, error) {
if v, ok := obj.(*EtcdBackup); ok {
return indexer(v)
}
return nil, nil
},
})
if err != nil {
panic(err)
}
}
func (n *etcdBackupClientCache) GetIndexed(name, key string) ([]*EtcdBackup, error) {
var result []*EtcdBackup
objs, err := n.client.controller.Informer().GetIndexer().ByIndex(name, key)
if err != nil {
return nil, err
}
for _, obj := range objs {
if v, ok := obj.(*EtcdBackup); ok {
result = append(result, v)
}
}
return result, nil
}
func (n *etcdBackupClient2) loadController() {
if n.controller == nil {
n.controller = n.iface.Controller()
}
}
type etcdBackupLifecycleDelegate struct {
create EtcdBackupChangeHandlerFunc
update EtcdBackupChangeHandlerFunc
remove EtcdBackupChangeHandlerFunc
}
func (n *etcdBackupLifecycleDelegate) HasCreate() bool {
return n.create != nil
}
func (n *etcdBackupLifecycleDelegate) Create(obj *EtcdBackup) (runtime.Object, error) {
if n.create == nil {
return obj, nil
}
return n.create(obj)
}
func (n *etcdBackupLifecycleDelegate) HasFinalize() bool {
return n.remove != nil
}
func (n *etcdBackupLifecycleDelegate) Remove(obj *EtcdBackup) (runtime.Object, error) {
if n.remove == nil {
return obj, nil
}
return n.remove(obj)
}
func (n *etcdBackupLifecycleDelegate) Updated(obj *EtcdBackup) (runtime.Object, error) {
if n.update == nil {
return obj, nil
}
return n.update(obj)
}

View File

@ -0,0 +1,62 @@
package v3
import (
"github.com/rancher/norman/lifecycle"
"k8s.io/apimachinery/pkg/runtime"
)
type EtcdBackupLifecycle interface {
Create(obj *EtcdBackup) (runtime.Object, error)
Remove(obj *EtcdBackup) (runtime.Object, error)
Updated(obj *EtcdBackup) (runtime.Object, error)
}
type etcdBackupLifecycleAdapter struct {
lifecycle EtcdBackupLifecycle
}
func (w *etcdBackupLifecycleAdapter) HasCreate() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasCreate()
}
func (w *etcdBackupLifecycleAdapter) HasFinalize() bool {
o, ok := w.lifecycle.(lifecycle.ObjectLifecycleCondition)
return !ok || o.HasFinalize()
}
func (w *etcdBackupLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Create(obj.(*EtcdBackup))
if o == nil {
return nil, err
}
return o, err
}
func (w *etcdBackupLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Remove(obj.(*EtcdBackup))
if o == nil {
return nil, err
}
return o, err
}
func (w *etcdBackupLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) {
o, err := w.lifecycle.Updated(obj.(*EtcdBackup))
if o == nil {
return nil, err
}
return o, err
}
func NewEtcdBackupLifecycleAdapter(name string, clusterScoped bool, client EtcdBackupInterface, l EtcdBackupLifecycle) EtcdBackupHandlerFunc {
adapter := &etcdBackupLifecycleAdapter{lifecycle: l}
syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient())
return func(key string, obj *EtcdBackup) (runtime.Object, error) {
newObj, err := syncFn(key, obj)
if o, ok := newObj.(runtime.Object); ok {
return o, err
}
return nil, err
}
}

View File

@ -67,6 +67,7 @@ type Interface interface {
GlobalDNSsGetter
GlobalDNSProvidersGetter
KontainerDriversGetter
EtcdBackupsGetter
MonitorMetricsGetter
ClusterMonitorGraphsGetter
ProjectMonitorGraphsGetter
@ -122,6 +123,7 @@ type Clients struct {
GlobalDNS GlobalDNSClient
GlobalDNSProvider GlobalDNSProviderClient
KontainerDriver KontainerDriverClient
EtcdBackup EtcdBackupClient
MonitorMetric MonitorMetricClient
ClusterMonitorGraph ClusterMonitorGraphClient
ProjectMonitorGraph ProjectMonitorGraphClient
@ -179,6 +181,7 @@ type Client struct {
globalDnsControllers map[string]GlobalDNSController
globalDnsProviderControllers map[string]GlobalDNSProviderController
kontainerDriverControllers map[string]KontainerDriverController
etcdBackupControllers map[string]EtcdBackupController
monitorMetricControllers map[string]MonitorMetricController
clusterMonitorGraphControllers map[string]ClusterMonitorGraphController
projectMonitorGraphControllers map[string]ProjectMonitorGraphController
@ -358,6 +361,9 @@ func NewClientsFromInterface(iface Interface) *Clients {
KontainerDriver: &kontainerDriverClient2{
iface: iface.KontainerDrivers(""),
},
EtcdBackup: &etcdBackupClient2{
iface: iface.EtcdBackups(""),
},
MonitorMetric: &monitorMetricClient2{
iface: iface.MonitorMetrics(""),
},
@ -430,6 +436,7 @@ func NewForConfig(config rest.Config) (Interface, error) {
globalDnsControllers: map[string]GlobalDNSController{},
globalDnsProviderControllers: map[string]GlobalDNSProviderController{},
kontainerDriverControllers: map[string]KontainerDriverController{},
etcdBackupControllers: map[string]EtcdBackupController{},
monitorMetricControllers: map[string]MonitorMetricController{},
clusterMonitorGraphControllers: map[string]ClusterMonitorGraphController{},
projectMonitorGraphControllers: map[string]ProjectMonitorGraphController{},
@ -1059,6 +1066,19 @@ func (c *Client) KontainerDrivers(namespace string) KontainerDriverInterface {
}
}
type EtcdBackupsGetter interface {
EtcdBackups(namespace string) EtcdBackupInterface
}
func (c *Client) EtcdBackups(namespace string) EtcdBackupInterface {
objectClient := objectclient.NewObjectClient(namespace, c.restClient, &EtcdBackupResource, EtcdBackupGroupVersionKind, etcdBackupFactory{})
return &etcdBackupClient{
ns: namespace,
client: c,
objectClient: objectClient,
}
}
type MonitorMetricsGetter interface {
MonitorMetrics(namespace string) MonitorMetricInterface
}

View File

@ -126,6 +126,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&GlobalDNSProviderList{},
&KontainerDriver{},
&KontainerDriverList{},
&EtcdBackup{},
&EtcdBackupList{},
&MonitorMetric{},
&MonitorMetricList{},
&ClusterMonitorGraph{},