remove Config-related code
Signed-off-by: Steve Kriss <steve@heptio.com>pull/949/head
parent
17b3a3b073
commit
c36131a024
|
@ -1,51 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2017 the Heptio Ark 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 v1
|
|
||||||
|
|
||||||
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
|
||||||
|
|
||||||
// ConfigList is a list of Configs.
|
|
||||||
type ConfigList struct {
|
|
||||||
metav1.TypeMeta `json:",inline"`
|
|
||||||
metav1.ListMeta `json:"metadata"`
|
|
||||||
|
|
||||||
Items []Config `json:"items"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// +genclient
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
|
||||||
|
|
||||||
// Config is an Ark resource that captures configuration information to be
|
|
||||||
// used for running the Ark server.
|
|
||||||
type Config struct {
|
|
||||||
metav1.TypeMeta `json:",inline"`
|
|
||||||
metav1.ObjectMeta `json:"metadata"`
|
|
||||||
|
|
||||||
// PersistentVolumeProvider is the configuration information for the cloud where
|
|
||||||
// the cluster is running and has PersistentVolumes to snapshot or restore. Optional.
|
|
||||||
PersistentVolumeProvider *CloudProviderConfig `json:"persistentVolumeProvider"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// CloudProviderConfig is configuration information about how to connect
|
|
||||||
// to a particular cloud.
|
|
||||||
type CloudProviderConfig struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
|
|
||||||
Config map[string]string `json:"config"`
|
|
||||||
}
|
|
|
@ -62,7 +62,6 @@ func CustomResources() map[string]typeInfo {
|
||||||
"Backup": newTypeInfo("backups", &Backup{}, &BackupList{}),
|
"Backup": newTypeInfo("backups", &Backup{}, &BackupList{}),
|
||||||
"Restore": newTypeInfo("restores", &Restore{}, &RestoreList{}),
|
"Restore": newTypeInfo("restores", &Restore{}, &RestoreList{}),
|
||||||
"Schedule": newTypeInfo("schedules", &Schedule{}, &ScheduleList{}),
|
"Schedule": newTypeInfo("schedules", &Schedule{}, &ScheduleList{}),
|
||||||
"Config": newTypeInfo("configs", &Config{}, &ConfigList{}),
|
|
||||||
"DownloadRequest": newTypeInfo("downloadrequests", &DownloadRequest{}, &DownloadRequestList{}),
|
"DownloadRequest": newTypeInfo("downloadrequests", &DownloadRequest{}, &DownloadRequestList{}),
|
||||||
"DeleteBackupRequest": newTypeInfo("deletebackuprequests", &DeleteBackupRequest{}, &DeleteBackupRequestList{}),
|
"DeleteBackupRequest": newTypeInfo("deletebackuprequests", &DeleteBackupRequest{}, &DeleteBackupRequestList{}),
|
||||||
"PodVolumeBackup": newTypeInfo("podvolumebackups", &PodVolumeBackup{}, &PodVolumeBackupList{}),
|
"PodVolumeBackup": newTypeInfo("podvolumebackups", &PodVolumeBackup{}, &PodVolumeBackupList{}),
|
||||||
|
|
|
@ -408,97 +408,6 @@ func (in *BackupStorageLocationStatus) DeepCopy() *BackupStorageLocationStatus {
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *CloudProviderConfig) DeepCopyInto(out *CloudProviderConfig) {
|
|
||||||
*out = *in
|
|
||||||
if in.Config != nil {
|
|
||||||
in, out := &in.Config, &out.Config
|
|
||||||
*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 CloudProviderConfig.
|
|
||||||
func (in *CloudProviderConfig) DeepCopy() *CloudProviderConfig {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(CloudProviderConfig)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *Config) DeepCopyInto(out *Config) {
|
|
||||||
*out = *in
|
|
||||||
out.TypeMeta = in.TypeMeta
|
|
||||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
|
||||||
if in.PersistentVolumeProvider != nil {
|
|
||||||
in, out := &in.PersistentVolumeProvider, &out.PersistentVolumeProvider
|
|
||||||
if *in == nil {
|
|
||||||
*out = nil
|
|
||||||
} else {
|
|
||||||
*out = new(CloudProviderConfig)
|
|
||||||
(*in).DeepCopyInto(*out)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Config.
|
|
||||||
func (in *Config) DeepCopy() *Config {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(Config)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
|
||||||
func (in *Config) 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 *ConfigList) DeepCopyInto(out *ConfigList) {
|
|
||||||
*out = *in
|
|
||||||
out.TypeMeta = in.TypeMeta
|
|
||||||
out.ListMeta = in.ListMeta
|
|
||||||
if in.Items != nil {
|
|
||||||
in, out := &in.Items, &out.Items
|
|
||||||
*out = make([]Config, len(*in))
|
|
||||||
for i := range *in {
|
|
||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigList.
|
|
||||||
func (in *ConfigList) DeepCopy() *ConfigList {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(ConfigList)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
|
||||||
func (in *ConfigList) 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.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *DeleteBackupRequest) DeepCopyInto(out *DeleteBackupRequest) {
|
func (in *DeleteBackupRequest) DeepCopyInto(out *DeleteBackupRequest) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
|
|
@ -24,7 +24,6 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"reflect"
|
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
@ -74,6 +73,9 @@ import (
|
||||||
const (
|
const (
|
||||||
// the port where prometheus metrics are exposed
|
// the port where prometheus metrics are exposed
|
||||||
defaultMetricsAddress = ":8085"
|
defaultMetricsAddress = ":8085"
|
||||||
|
|
||||||
|
defaultBackupSyncPeriod = time.Minute
|
||||||
|
defaultPodVolumeOperationTimeout = 60 * time.Minute
|
||||||
)
|
)
|
||||||
|
|
||||||
type serverConfig struct {
|
type serverConfig struct {
|
||||||
|
@ -267,19 +269,7 @@ func (s *server) run() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
originalConfig, err := s.loadConfig()
|
if _, err := s.arkClient.ArkV1().BackupStorageLocations(s.namespace).Get(s.config.defaultBackupLocation, metav1.GetOptions{}); err != nil {
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// watchConfig needs to examine the unmodified original config, so we keep that around as a
|
|
||||||
// separate object, and instead apply defaults to a clone.
|
|
||||||
config := originalConfig.DeepCopy()
|
|
||||||
s.applyConfigDefaults(config)
|
|
||||||
|
|
||||||
s.watchConfig(originalConfig)
|
|
||||||
|
|
||||||
if _, err = s.arkClient.ArkV1().BackupStorageLocations(s.namespace).Get(s.config.defaultBackupLocation, metav1.GetOptions{}); err != nil {
|
|
||||||
s.logger.WithError(errors.WithStack(err)).
|
s.logger.WithError(errors.WithStack(err)).
|
||||||
Warnf("Default backup storage location %q not found; backups must explicitly specify a location", s.config.defaultBackupLocation)
|
Warnf("Default backup storage location %q not found; backups must explicitly specify a location", s.config.defaultBackupLocation)
|
||||||
}
|
}
|
||||||
|
@ -293,7 +283,7 @@ func (s *server) run() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := s.runControllers(config, defaultVolumeSnapshotLocations); err != nil {
|
if err := s.runControllers(defaultVolumeSnapshotLocations); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -338,23 +328,6 @@ func getDefaultVolumeSnapshotLocations(arkClient clientset.Interface, namespace
|
||||||
return providerDefaults, nil
|
return providerDefaults, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *server) applyConfigDefaults(c *api.Config) {
|
|
||||||
if s.config.backupSyncPeriod == 0 {
|
|
||||||
s.config.backupSyncPeriod = defaultBackupSyncPeriod
|
|
||||||
}
|
|
||||||
|
|
||||||
if s.config.podVolumeOperationTimeout == 0 {
|
|
||||||
s.config.podVolumeOperationTimeout = defaultPodVolumeOperationTimeout
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(s.config.restoreResourcePriorities) == 0 {
|
|
||||||
s.config.restoreResourcePriorities = defaultRestorePriorities
|
|
||||||
s.logger.WithField("priorities", s.config.restoreResourcePriorities).Info("Using default resource priorities")
|
|
||||||
} else {
|
|
||||||
s.logger.WithField("priorities", s.config.restoreResourcePriorities).Info("Using given resource priorities")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// namespaceExists returns nil if namespace can be successfully
|
// namespaceExists returns nil if namespace can be successfully
|
||||||
// gotten from the kubernetes API, or an error otherwise.
|
// gotten from the kubernetes API, or an error otherwise.
|
||||||
func (s *server) namespaceExists(namespace string) error {
|
func (s *server) namespaceExists(namespace string) error {
|
||||||
|
@ -464,34 +437,6 @@ func (s *server) validateBackupStorageLocations() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *server) loadConfig() (*api.Config, error) {
|
|
||||||
s.logger.Info("Retrieving Ark configuration")
|
|
||||||
var (
|
|
||||||
config *api.Config
|
|
||||||
err error
|
|
||||||
)
|
|
||||||
for {
|
|
||||||
config, err = s.arkClient.ArkV1().Configs(s.namespace).Get("default", metav1.GetOptions{})
|
|
||||||
if err == nil {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
if !apierrors.IsNotFound(err) {
|
|
||||||
s.logger.WithError(err).Error("Error retrieving configuration")
|
|
||||||
} else {
|
|
||||||
s.logger.Info("Configuration not found")
|
|
||||||
}
|
|
||||||
s.logger.Info("Will attempt to retrieve configuration again in 5 seconds")
|
|
||||||
time.Sleep(5 * time.Second)
|
|
||||||
}
|
|
||||||
s.logger.Info("Successfully retrieved Ark configuration")
|
|
||||||
return config, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
const (
|
|
||||||
defaultBackupSyncPeriod = time.Minute
|
|
||||||
defaultPodVolumeOperationTimeout = 60 * time.Minute
|
|
||||||
)
|
|
||||||
|
|
||||||
// - Namespaces go first because all namespaced resources depend on them.
|
// - Namespaces go first because all namespaced resources depend on them.
|
||||||
// - PVs go before PVCs because PVCs depend on them.
|
// - PVs go before PVCs because PVCs depend on them.
|
||||||
// - PVCs go before pods or controllers so they can be mounted as volumes.
|
// - PVCs go before pods or controllers so they can be mounted as volumes.
|
||||||
|
@ -513,39 +458,6 @@ var defaultRestorePriorities = []string{
|
||||||
"replicaset",
|
"replicaset",
|
||||||
}
|
}
|
||||||
|
|
||||||
// watchConfig adds an update event handler to the Config shared informer, invoking s.cancelFunc
|
|
||||||
// when it sees a change.
|
|
||||||
func (s *server) watchConfig(config *api.Config) {
|
|
||||||
s.sharedInformerFactory.Ark().V1().Configs().Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
|
|
||||||
UpdateFunc: func(oldObj, newObj interface{}) {
|
|
||||||
updated := newObj.(*api.Config)
|
|
||||||
s.logger.WithField("name", kube.NamespaceAndName(updated)).Debug("received updated config")
|
|
||||||
|
|
||||||
if updated.Name != config.Name {
|
|
||||||
s.logger.WithField("name", updated.Name).Debug("Config watch channel received other config")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Objects retrieved via Get() don't have their Kind or APIVersion set. Objects retrieved via
|
|
||||||
// Watch(), including those from shared informer event handlers, DO have their Kind and
|
|
||||||
// APIVersion set. To prevent the DeepEqual() call below from considering Kind or APIVersion
|
|
||||||
// as the source of a change, set config.Kind and config.APIVersion to match the values from
|
|
||||||
// the updated Config.
|
|
||||||
if config.Kind != updated.Kind {
|
|
||||||
config.Kind = updated.Kind
|
|
||||||
}
|
|
||||||
if config.APIVersion != updated.APIVersion {
|
|
||||||
config.APIVersion = updated.APIVersion
|
|
||||||
}
|
|
||||||
|
|
||||||
if !reflect.DeepEqual(config, updated) {
|
|
||||||
s.logger.Info("Detected a config change. Gracefully shutting down")
|
|
||||||
s.cancelFunc()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *server) initRestic() error {
|
func (s *server) initRestic() error {
|
||||||
// warn if restic daemonset does not exist
|
// warn if restic daemonset does not exist
|
||||||
if _, err := s.kubeClient.AppsV1().DaemonSets(s.namespace).Get(restic.DaemonSet, metav1.GetOptions{}); apierrors.IsNotFound(err) {
|
if _, err := s.kubeClient.AppsV1().DaemonSets(s.namespace).Get(restic.DaemonSet, metav1.GetOptions{}); apierrors.IsNotFound(err) {
|
||||||
|
@ -594,7 +506,7 @@ func (s *server) initRestic() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *server) runControllers(config *api.Config, defaultVolumeSnapshotLocations map[string]*api.VolumeSnapshotLocation) error {
|
func (s *server) runControllers(defaultVolumeSnapshotLocations map[string]*api.VolumeSnapshotLocation) error {
|
||||||
s.logger.Info("Starting controllers")
|
s.logger.Info("Starting controllers")
|
||||||
|
|
||||||
ctx := s.ctx
|
ctx := s.ctx
|
||||||
|
|
|
@ -18,7 +18,6 @@ package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
|
@ -29,32 +28,6 @@ import (
|
||||||
arktest "github.com/heptio/ark/pkg/util/test"
|
arktest "github.com/heptio/ark/pkg/util/test"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestApplyConfigDefaults(t *testing.T) {
|
|
||||||
var (
|
|
||||||
c = &v1.Config{}
|
|
||||||
server = &server{
|
|
||||||
logger: arktest.NewLogger(),
|
|
||||||
config: serverConfig{},
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
// test defaulting
|
|
||||||
server.applyConfigDefaults(c)
|
|
||||||
assert.Equal(t, defaultBackupSyncPeriod, server.config.backupSyncPeriod)
|
|
||||||
assert.Equal(t, defaultPodVolumeOperationTimeout, server.config.podVolumeOperationTimeout)
|
|
||||||
assert.Equal(t, defaultRestorePriorities, server.config.restoreResourcePriorities)
|
|
||||||
|
|
||||||
// // make sure defaulting doesn't overwrite real values
|
|
||||||
server.config.backupSyncPeriod = 4 * time.Minute
|
|
||||||
server.config.podVolumeOperationTimeout = 5 * time.Second
|
|
||||||
server.config.restoreResourcePriorities = []string{"a", "b"}
|
|
||||||
|
|
||||||
server.applyConfigDefaults(c)
|
|
||||||
assert.Equal(t, 4*time.Minute, server.config.backupSyncPeriod)
|
|
||||||
assert.Equal(t, 5*time.Second, server.config.podVolumeOperationTimeout)
|
|
||||||
assert.Equal(t, []string{"a", "b"}, server.config.restoreResourcePriorities)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestArkResourcesExist(t *testing.T) {
|
func TestArkResourcesExist(t *testing.T) {
|
||||||
var (
|
var (
|
||||||
fakeDiscoveryHelper = &arktest.FakeDiscoveryHelper{}
|
fakeDiscoveryHelper = &arktest.FakeDiscoveryHelper{}
|
||||||
|
|
|
@ -29,7 +29,6 @@ type ArkV1Interface interface {
|
||||||
RESTClient() rest.Interface
|
RESTClient() rest.Interface
|
||||||
BackupsGetter
|
BackupsGetter
|
||||||
BackupStorageLocationsGetter
|
BackupStorageLocationsGetter
|
||||||
ConfigsGetter
|
|
||||||
DeleteBackupRequestsGetter
|
DeleteBackupRequestsGetter
|
||||||
DownloadRequestsGetter
|
DownloadRequestsGetter
|
||||||
PodVolumeBackupsGetter
|
PodVolumeBackupsGetter
|
||||||
|
@ -53,10 +52,6 @@ func (c *ArkV1Client) BackupStorageLocations(namespace string) BackupStorageLoca
|
||||||
return newBackupStorageLocations(c, namespace)
|
return newBackupStorageLocations(c, namespace)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ArkV1Client) Configs(namespace string) ConfigInterface {
|
|
||||||
return newConfigs(c, namespace)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *ArkV1Client) DeleteBackupRequests(namespace string) DeleteBackupRequestInterface {
|
func (c *ArkV1Client) DeleteBackupRequests(namespace string) DeleteBackupRequestInterface {
|
||||||
return newDeleteBackupRequests(c, namespace)
|
return newDeleteBackupRequests(c, namespace)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,157 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2018 the Heptio Ark 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 v1
|
|
||||||
|
|
||||||
import (
|
|
||||||
v1 "github.com/heptio/ark/pkg/apis/ark/v1"
|
|
||||||
scheme "github.com/heptio/ark/pkg/generated/clientset/versioned/scheme"
|
|
||||||
meta_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"
|
|
||||||
)
|
|
||||||
|
|
||||||
// ConfigsGetter has a method to return a ConfigInterface.
|
|
||||||
// A group's client should implement this interface.
|
|
||||||
type ConfigsGetter interface {
|
|
||||||
Configs(namespace string) ConfigInterface
|
|
||||||
}
|
|
||||||
|
|
||||||
// ConfigInterface has methods to work with Config resources.
|
|
||||||
type ConfigInterface interface {
|
|
||||||
Create(*v1.Config) (*v1.Config, error)
|
|
||||||
Update(*v1.Config) (*v1.Config, error)
|
|
||||||
Delete(name string, options *meta_v1.DeleteOptions) error
|
|
||||||
DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error
|
|
||||||
Get(name string, options meta_v1.GetOptions) (*v1.Config, error)
|
|
||||||
List(opts meta_v1.ListOptions) (*v1.ConfigList, error)
|
|
||||||
Watch(opts meta_v1.ListOptions) (watch.Interface, error)
|
|
||||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Config, err error)
|
|
||||||
ConfigExpansion
|
|
||||||
}
|
|
||||||
|
|
||||||
// configs implements ConfigInterface
|
|
||||||
type configs struct {
|
|
||||||
client rest.Interface
|
|
||||||
ns string
|
|
||||||
}
|
|
||||||
|
|
||||||
// newConfigs returns a Configs
|
|
||||||
func newConfigs(c *ArkV1Client, namespace string) *configs {
|
|
||||||
return &configs{
|
|
||||||
client: c.RESTClient(),
|
|
||||||
ns: namespace,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get takes name of the config, and returns the corresponding config object, and an error if there is any.
|
|
||||||
func (c *configs) Get(name string, options meta_v1.GetOptions) (result *v1.Config, err error) {
|
|
||||||
result = &v1.Config{}
|
|
||||||
err = c.client.Get().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("configs").
|
|
||||||
Name(name).
|
|
||||||
VersionedParams(&options, scheme.ParameterCodec).
|
|
||||||
Do().
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// List takes label and field selectors, and returns the list of Configs that match those selectors.
|
|
||||||
func (c *configs) List(opts meta_v1.ListOptions) (result *v1.ConfigList, err error) {
|
|
||||||
result = &v1.ConfigList{}
|
|
||||||
err = c.client.Get().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("configs").
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Do().
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Watch returns a watch.Interface that watches the requested configs.
|
|
||||||
func (c *configs) Watch(opts meta_v1.ListOptions) (watch.Interface, error) {
|
|
||||||
opts.Watch = true
|
|
||||||
return c.client.Get().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("configs").
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Watch()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create takes the representation of a config and creates it. Returns the server's representation of the config, and an error, if there is any.
|
|
||||||
func (c *configs) Create(config *v1.Config) (result *v1.Config, err error) {
|
|
||||||
result = &v1.Config{}
|
|
||||||
err = c.client.Post().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("configs").
|
|
||||||
Body(config).
|
|
||||||
Do().
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update takes the representation of a config and updates it. Returns the server's representation of the config, and an error, if there is any.
|
|
||||||
func (c *configs) Update(config *v1.Config) (result *v1.Config, err error) {
|
|
||||||
result = &v1.Config{}
|
|
||||||
err = c.client.Put().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("configs").
|
|
||||||
Name(config.Name).
|
|
||||||
Body(config).
|
|
||||||
Do().
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete takes name of the config and deletes it. Returns an error if one occurs.
|
|
||||||
func (c *configs) Delete(name string, options *meta_v1.DeleteOptions) error {
|
|
||||||
return c.client.Delete().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("configs").
|
|
||||||
Name(name).
|
|
||||||
Body(options).
|
|
||||||
Do().
|
|
||||||
Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteCollection deletes a collection of objects.
|
|
||||||
func (c *configs) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error {
|
|
||||||
return c.client.Delete().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("configs").
|
|
||||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
|
||||||
Body(options).
|
|
||||||
Do().
|
|
||||||
Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Patch applies the patch and returns the patched config.
|
|
||||||
func (c *configs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Config, err error) {
|
|
||||||
result = &v1.Config{}
|
|
||||||
err = c.client.Patch(pt).
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("configs").
|
|
||||||
SubResource(subresources...).
|
|
||||||
Name(name).
|
|
||||||
Body(data).
|
|
||||||
Do().
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
|
@ -36,10 +36,6 @@ func (c *FakeArkV1) BackupStorageLocations(namespace string) v1.BackupStorageLoc
|
||||||
return &FakeBackupStorageLocations{c, namespace}
|
return &FakeBackupStorageLocations{c, namespace}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeArkV1) Configs(namespace string) v1.ConfigInterface {
|
|
||||||
return &FakeConfigs{c, namespace}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeArkV1) DeleteBackupRequests(namespace string) v1.DeleteBackupRequestInterface {
|
func (c *FakeArkV1) DeleteBackupRequests(namespace string) v1.DeleteBackupRequestInterface {
|
||||||
return &FakeDeleteBackupRequests{c, namespace}
|
return &FakeDeleteBackupRequests{c, namespace}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,128 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2018 the Heptio Ark 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 (
|
|
||||||
ark_v1 "github.com/heptio/ark/pkg/apis/ark/v1"
|
|
||||||
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"
|
|
||||||
)
|
|
||||||
|
|
||||||
// FakeConfigs implements ConfigInterface
|
|
||||||
type FakeConfigs struct {
|
|
||||||
Fake *FakeArkV1
|
|
||||||
ns string
|
|
||||||
}
|
|
||||||
|
|
||||||
var configsResource = schema.GroupVersionResource{Group: "ark.heptio.com", Version: "v1", Resource: "configs"}
|
|
||||||
|
|
||||||
var configsKind = schema.GroupVersionKind{Group: "ark.heptio.com", Version: "v1", Kind: "Config"}
|
|
||||||
|
|
||||||
// Get takes name of the config, and returns the corresponding config object, and an error if there is any.
|
|
||||||
func (c *FakeConfigs) Get(name string, options v1.GetOptions) (result *ark_v1.Config, err error) {
|
|
||||||
obj, err := c.Fake.
|
|
||||||
Invokes(testing.NewGetAction(configsResource, c.ns, name), &ark_v1.Config{})
|
|
||||||
|
|
||||||
if obj == nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return obj.(*ark_v1.Config), err
|
|
||||||
}
|
|
||||||
|
|
||||||
// List takes label and field selectors, and returns the list of Configs that match those selectors.
|
|
||||||
func (c *FakeConfigs) List(opts v1.ListOptions) (result *ark_v1.ConfigList, err error) {
|
|
||||||
obj, err := c.Fake.
|
|
||||||
Invokes(testing.NewListAction(configsResource, configsKind, c.ns, opts), &ark_v1.ConfigList{})
|
|
||||||
|
|
||||||
if obj == nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
|
||||||
if label == nil {
|
|
||||||
label = labels.Everything()
|
|
||||||
}
|
|
||||||
list := &ark_v1.ConfigList{ListMeta: obj.(*ark_v1.ConfigList).ListMeta}
|
|
||||||
for _, item := range obj.(*ark_v1.ConfigList).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 configs.
|
|
||||||
func (c *FakeConfigs) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
|
||||||
return c.Fake.
|
|
||||||
InvokesWatch(testing.NewWatchAction(configsResource, c.ns, opts))
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create takes the representation of a config and creates it. Returns the server's representation of the config, and an error, if there is any.
|
|
||||||
func (c *FakeConfigs) Create(config *ark_v1.Config) (result *ark_v1.Config, err error) {
|
|
||||||
obj, err := c.Fake.
|
|
||||||
Invokes(testing.NewCreateAction(configsResource, c.ns, config), &ark_v1.Config{})
|
|
||||||
|
|
||||||
if obj == nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return obj.(*ark_v1.Config), err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update takes the representation of a config and updates it. Returns the server's representation of the config, and an error, if there is any.
|
|
||||||
func (c *FakeConfigs) Update(config *ark_v1.Config) (result *ark_v1.Config, err error) {
|
|
||||||
obj, err := c.Fake.
|
|
||||||
Invokes(testing.NewUpdateAction(configsResource, c.ns, config), &ark_v1.Config{})
|
|
||||||
|
|
||||||
if obj == nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return obj.(*ark_v1.Config), err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete takes name of the config and deletes it. Returns an error if one occurs.
|
|
||||||
func (c *FakeConfigs) Delete(name string, options *v1.DeleteOptions) error {
|
|
||||||
_, err := c.Fake.
|
|
||||||
Invokes(testing.NewDeleteAction(configsResource, c.ns, name), &ark_v1.Config{})
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteCollection deletes a collection of objects.
|
|
||||||
func (c *FakeConfigs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
|
||||||
action := testing.NewDeleteCollectionAction(configsResource, c.ns, listOptions)
|
|
||||||
|
|
||||||
_, err := c.Fake.Invokes(action, &ark_v1.ConfigList{})
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Patch applies the patch and returns the patched config.
|
|
||||||
func (c *FakeConfigs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *ark_v1.Config, err error) {
|
|
||||||
obj, err := c.Fake.
|
|
||||||
Invokes(testing.NewPatchSubresourceAction(configsResource, c.ns, name, data, subresources...), &ark_v1.Config{})
|
|
||||||
|
|
||||||
if obj == nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return obj.(*ark_v1.Config), err
|
|
||||||
}
|
|
|
@ -22,8 +22,6 @@ type BackupExpansion interface{}
|
||||||
|
|
||||||
type BackupStorageLocationExpansion interface{}
|
type BackupStorageLocationExpansion interface{}
|
||||||
|
|
||||||
type ConfigExpansion interface{}
|
|
||||||
|
|
||||||
type DeleteBackupRequestExpansion interface{}
|
type DeleteBackupRequestExpansion interface{}
|
||||||
|
|
||||||
type DownloadRequestExpansion interface{}
|
type DownloadRequestExpansion interface{}
|
||||||
|
|
|
@ -1,89 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2018 the Heptio Ark 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 v1
|
|
||||||
|
|
||||||
import (
|
|
||||||
time "time"
|
|
||||||
|
|
||||||
ark_v1 "github.com/heptio/ark/pkg/apis/ark/v1"
|
|
||||||
versioned "github.com/heptio/ark/pkg/generated/clientset/versioned"
|
|
||||||
internalinterfaces "github.com/heptio/ark/pkg/generated/informers/externalversions/internalinterfaces"
|
|
||||||
v1 "github.com/heptio/ark/pkg/generated/listers/ark/v1"
|
|
||||||
meta_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"
|
|
||||||
)
|
|
||||||
|
|
||||||
// ConfigInformer provides access to a shared informer and lister for
|
|
||||||
// Configs.
|
|
||||||
type ConfigInformer interface {
|
|
||||||
Informer() cache.SharedIndexInformer
|
|
||||||
Lister() v1.ConfigLister
|
|
||||||
}
|
|
||||||
|
|
||||||
type configInformer struct {
|
|
||||||
factory internalinterfaces.SharedInformerFactory
|
|
||||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
|
||||||
namespace string
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewConfigInformer constructs a new informer for Config 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 NewConfigInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
|
||||||
return NewFilteredConfigInformer(client, namespace, resyncPeriod, indexers, nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewFilteredConfigInformer constructs a new informer for Config 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 NewFilteredConfigInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
|
||||||
return cache.NewSharedIndexInformer(
|
|
||||||
&cache.ListWatch{
|
|
||||||
ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) {
|
|
||||||
if tweakListOptions != nil {
|
|
||||||
tweakListOptions(&options)
|
|
||||||
}
|
|
||||||
return client.ArkV1().Configs(namespace).List(options)
|
|
||||||
},
|
|
||||||
WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) {
|
|
||||||
if tweakListOptions != nil {
|
|
||||||
tweakListOptions(&options)
|
|
||||||
}
|
|
||||||
return client.ArkV1().Configs(namespace).Watch(options)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
&ark_v1.Config{},
|
|
||||||
resyncPeriod,
|
|
||||||
indexers,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *configInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
|
||||||
return NewFilteredConfigInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *configInformer) Informer() cache.SharedIndexInformer {
|
|
||||||
return f.factory.InformerFor(&ark_v1.Config{}, f.defaultInformer)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *configInformer) Lister() v1.ConfigLister {
|
|
||||||
return v1.NewConfigLister(f.Informer().GetIndexer())
|
|
||||||
}
|
|
|
@ -28,8 +28,6 @@ type Interface interface {
|
||||||
Backups() BackupInformer
|
Backups() BackupInformer
|
||||||
// BackupStorageLocations returns a BackupStorageLocationInformer.
|
// BackupStorageLocations returns a BackupStorageLocationInformer.
|
||||||
BackupStorageLocations() BackupStorageLocationInformer
|
BackupStorageLocations() BackupStorageLocationInformer
|
||||||
// Configs returns a ConfigInformer.
|
|
||||||
Configs() ConfigInformer
|
|
||||||
// DeleteBackupRequests returns a DeleteBackupRequestInformer.
|
// DeleteBackupRequests returns a DeleteBackupRequestInformer.
|
||||||
DeleteBackupRequests() DeleteBackupRequestInformer
|
DeleteBackupRequests() DeleteBackupRequestInformer
|
||||||
// DownloadRequests returns a DownloadRequestInformer.
|
// DownloadRequests returns a DownloadRequestInformer.
|
||||||
|
@ -69,11 +67,6 @@ func (v *version) BackupStorageLocations() BackupStorageLocationInformer {
|
||||||
return &backupStorageLocationInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
return &backupStorageLocationInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configs returns a ConfigInformer.
|
|
||||||
func (v *version) Configs() ConfigInformer {
|
|
||||||
return &configInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteBackupRequests returns a DeleteBackupRequestInformer.
|
// DeleteBackupRequests returns a DeleteBackupRequestInformer.
|
||||||
func (v *version) DeleteBackupRequests() DeleteBackupRequestInformer {
|
func (v *version) DeleteBackupRequests() DeleteBackupRequestInformer {
|
||||||
return &deleteBackupRequestInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
return &deleteBackupRequestInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||||
|
|
|
@ -57,8 +57,6 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
|
||||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Ark().V1().Backups().Informer()}, nil
|
return &genericInformer{resource: resource.GroupResource(), informer: f.Ark().V1().Backups().Informer()}, nil
|
||||||
case v1.SchemeGroupVersion.WithResource("backupstoragelocations"):
|
case v1.SchemeGroupVersion.WithResource("backupstoragelocations"):
|
||||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Ark().V1().BackupStorageLocations().Informer()}, nil
|
return &genericInformer{resource: resource.GroupResource(), informer: f.Ark().V1().BackupStorageLocations().Informer()}, nil
|
||||||
case v1.SchemeGroupVersion.WithResource("configs"):
|
|
||||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Ark().V1().Configs().Informer()}, nil
|
|
||||||
case v1.SchemeGroupVersion.WithResource("deletebackuprequests"):
|
case v1.SchemeGroupVersion.WithResource("deletebackuprequests"):
|
||||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Ark().V1().DeleteBackupRequests().Informer()}, nil
|
return &genericInformer{resource: resource.GroupResource(), informer: f.Ark().V1().DeleteBackupRequests().Informer()}, nil
|
||||||
case v1.SchemeGroupVersion.WithResource("downloadrequests"):
|
case v1.SchemeGroupVersion.WithResource("downloadrequests"):
|
||||||
|
|
|
@ -1,94 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2018 the Heptio Ark 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 v1
|
|
||||||
|
|
||||||
import (
|
|
||||||
v1 "github.com/heptio/ark/pkg/apis/ark/v1"
|
|
||||||
"k8s.io/apimachinery/pkg/api/errors"
|
|
||||||
"k8s.io/apimachinery/pkg/labels"
|
|
||||||
"k8s.io/client-go/tools/cache"
|
|
||||||
)
|
|
||||||
|
|
||||||
// ConfigLister helps list Configs.
|
|
||||||
type ConfigLister interface {
|
|
||||||
// List lists all Configs in the indexer.
|
|
||||||
List(selector labels.Selector) (ret []*v1.Config, err error)
|
|
||||||
// Configs returns an object that can list and get Configs.
|
|
||||||
Configs(namespace string) ConfigNamespaceLister
|
|
||||||
ConfigListerExpansion
|
|
||||||
}
|
|
||||||
|
|
||||||
// configLister implements the ConfigLister interface.
|
|
||||||
type configLister struct {
|
|
||||||
indexer cache.Indexer
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewConfigLister returns a new ConfigLister.
|
|
||||||
func NewConfigLister(indexer cache.Indexer) ConfigLister {
|
|
||||||
return &configLister{indexer: indexer}
|
|
||||||
}
|
|
||||||
|
|
||||||
// List lists all Configs in the indexer.
|
|
||||||
func (s *configLister) List(selector labels.Selector) (ret []*v1.Config, err error) {
|
|
||||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
|
||||||
ret = append(ret, m.(*v1.Config))
|
|
||||||
})
|
|
||||||
return ret, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Configs returns an object that can list and get Configs.
|
|
||||||
func (s *configLister) Configs(namespace string) ConfigNamespaceLister {
|
|
||||||
return configNamespaceLister{indexer: s.indexer, namespace: namespace}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ConfigNamespaceLister helps list and get Configs.
|
|
||||||
type ConfigNamespaceLister interface {
|
|
||||||
// List lists all Configs in the indexer for a given namespace.
|
|
||||||
List(selector labels.Selector) (ret []*v1.Config, err error)
|
|
||||||
// Get retrieves the Config from the indexer for a given namespace and name.
|
|
||||||
Get(name string) (*v1.Config, error)
|
|
||||||
ConfigNamespaceListerExpansion
|
|
||||||
}
|
|
||||||
|
|
||||||
// configNamespaceLister implements the ConfigNamespaceLister
|
|
||||||
// interface.
|
|
||||||
type configNamespaceLister struct {
|
|
||||||
indexer cache.Indexer
|
|
||||||
namespace string
|
|
||||||
}
|
|
||||||
|
|
||||||
// List lists all Configs in the indexer for a given namespace.
|
|
||||||
func (s configNamespaceLister) List(selector labels.Selector) (ret []*v1.Config, err error) {
|
|
||||||
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
|
|
||||||
ret = append(ret, m.(*v1.Config))
|
|
||||||
})
|
|
||||||
return ret, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get retrieves the Config from the indexer for a given namespace and name.
|
|
||||||
func (s configNamespaceLister) Get(name string) (*v1.Config, error) {
|
|
||||||
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if !exists {
|
|
||||||
return nil, errors.NewNotFound(v1.Resource("config"), name)
|
|
||||||
}
|
|
||||||
return obj.(*v1.Config), nil
|
|
||||||
}
|
|
|
@ -34,14 +34,6 @@ type BackupStorageLocationListerExpansion interface{}
|
||||||
// BackupStorageLocationNamespaceLister.
|
// BackupStorageLocationNamespaceLister.
|
||||||
type BackupStorageLocationNamespaceListerExpansion interface{}
|
type BackupStorageLocationNamespaceListerExpansion interface{}
|
||||||
|
|
||||||
// ConfigListerExpansion allows custom methods to be added to
|
|
||||||
// ConfigLister.
|
|
||||||
type ConfigListerExpansion interface{}
|
|
||||||
|
|
||||||
// ConfigNamespaceListerExpansion allows custom methods to be added to
|
|
||||||
// ConfigNamespaceLister.
|
|
||||||
type ConfigNamespaceListerExpansion interface{}
|
|
||||||
|
|
||||||
// DeleteBackupRequestListerExpansion allows custom methods to be added to
|
// DeleteBackupRequestListerExpansion allows custom methods to be added to
|
||||||
// DeleteBackupRequestLister.
|
// DeleteBackupRequestLister.
|
||||||
type DeleteBackupRequestListerExpansion interface{}
|
type DeleteBackupRequestListerExpansion interface{}
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2018 the Heptio Ark 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 install
|
|
||||||
|
|
||||||
import (
|
|
||||||
arkv1 "github.com/heptio/ark/pkg/apis/ark/v1"
|
|
||||||
)
|
|
||||||
|
|
||||||
func Config(
|
|
||||||
namespace string,
|
|
||||||
pvCloudProviderName string,
|
|
||||||
pvCloudProviderConfig map[string]string,
|
|
||||||
) *arkv1.Config {
|
|
||||||
return &arkv1.Config{
|
|
||||||
ObjectMeta: objectMeta(namespace, "default"),
|
|
||||||
PersistentVolumeProvider: &arkv1.CloudProviderConfig{
|
|
||||||
Name: pvCloudProviderName,
|
|
||||||
Config: pvCloudProviderConfig,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue