custom alerting resolve conflicts
Signed-off-by: junotx <junotx@126.com>
This commit is contained in:
@@ -17,16 +17,17 @@ limitations under the License.
|
|||||||
package informers
|
package informers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
snapshotinformer "github.com/kubernetes-csi/external-snapshotter/client/v3/informers/externalversions"
|
||||||
prominformers "github.com/prometheus-operator/prometheus-operator/pkg/client/informers/externalversions"
|
prominformers "github.com/prometheus-operator/prometheus-operator/pkg/client/informers/externalversions"
|
||||||
promfake "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned/fake"
|
promfake "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned/fake"
|
||||||
snapshotinformer "github.com/kubernetes-csi/external-snapshotter/client/v3/informers/externalversions"
|
|
||||||
istioinformers "istio.io/client-go/pkg/informers/externalversions"
|
istioinformers "istio.io/client-go/pkg/informers/externalversions"
|
||||||
apiextensionsinformers "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions"
|
apiextensionsinformers "k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions"
|
||||||
"k8s.io/client-go/informers"
|
"k8s.io/client-go/informers"
|
||||||
"k8s.io/client-go/kubernetes/fake"
|
"k8s.io/client-go/kubernetes/fake"
|
||||||
ksfake "kubesphere.io/kubesphere/pkg/client/clientset/versioned/fake"
|
ksfake "kubesphere.io/kubesphere/pkg/client/clientset/versioned/fake"
|
||||||
ksinformers "kubesphere.io/kubesphere/pkg/client/informers/externalversions"
|
ksinformers "kubesphere.io/kubesphere/pkg/client/informers/externalversions"
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type nullInformerFactory struct {
|
type nullInformerFactory struct {
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ limitations under the License.
|
|||||||
package v1alpha1
|
package v1alpha1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
promresourcesclient "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned"
|
|
||||||
"github.com/emicklei/go-restful"
|
"github.com/emicklei/go-restful"
|
||||||
|
promresourcesclient "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned"
|
||||||
"k8s.io/klog"
|
"k8s.io/klog"
|
||||||
ksapi "kubesphere.io/kubesphere/pkg/api"
|
ksapi "kubesphere.io/kubesphere/pkg/api"
|
||||||
"kubesphere.io/kubesphere/pkg/api/customalerting/v1alpha1"
|
"kubesphere.io/kubesphere/pkg/api/customalerting/v1alpha1"
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ package v1alpha1
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
promresourcesclient "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned"
|
|
||||||
"github.com/emicklei/go-restful"
|
"github.com/emicklei/go-restful"
|
||||||
restfulspec "github.com/emicklei/go-restful-openapi"
|
restfulspec "github.com/emicklei/go-restful-openapi"
|
||||||
|
promresourcesclient "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned"
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
ksapi "kubesphere.io/kubesphere/pkg/api"
|
ksapi "kubesphere.io/kubesphere/pkg/api"
|
||||||
customalertingv1alpha1 "kubesphere.io/kubesphere/pkg/api/customalerting/v1alpha1"
|
customalertingv1alpha1 "kubesphere.io/kubesphere/pkg/api/customalerting/v1alpha1"
|
||||||
|
|||||||
@@ -1,147 +0,0 @@
|
|||||||
package v1alpha1
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
|
||||||
"net/http"
|
|
||||||
"os"
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/emicklei/go-restful"
|
|
||||||
restfulspec "github.com/emicklei/go-restful-openapi"
|
|
||||||
"github.com/go-openapi/spec"
|
|
||||||
promresourcesclient "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned"
|
|
||||||
"github.com/prometheus/prometheus/promql/parser"
|
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
|
||||||
"k8s.io/client-go/kubernetes"
|
|
||||||
"k8s.io/client-go/tools/clientcmd"
|
|
||||||
"kubesphere.io/kubesphere/pkg/apiserver/runtime"
|
|
||||||
"kubesphere.io/kubesphere/pkg/constants"
|
|
||||||
"kubesphere.io/kubesphere/pkg/informers"
|
|
||||||
"kubesphere.io/kubesphere/pkg/simple/client/customalerting"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestTest(t *testing.T) {
|
|
||||||
expr := `increase((max by(job) (etcd_server_leader_changes_seen_total{job=~".*etcd.*"}) or 0 * absent(etcd_server_leader_changes_seen_total{job=~".*etcd.*"}))[15m:1m]) >= 3`
|
|
||||||
//expr = `absent_over_time(sum(nonexistent{job="myjob"})[1h:])`
|
|
||||||
|
|
||||||
pexpr, err := parser.ParseExpr(expr)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
fmt.Println(pexpr.String())
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestApis(t *testing.T) {
|
|
||||||
kubeconfig := "D:/ks/conf/ks3-config"
|
|
||||||
|
|
||||||
config, err := clientcmd.BuildConfigFromFlags("", kubeconfig)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
k8sClient := kubernetes.NewForConfigOrDie(config)
|
|
||||||
promResourcesClient := promresourcesclient.NewForConfigOrDie(config)
|
|
||||||
|
|
||||||
option := &customalerting.Options{
|
|
||||||
PrometheusEndpoint: "http://139.198.112.79:39090/",
|
|
||||||
ThanosRulerEndpoint: "http://139.198.112.79:39091/",
|
|
||||||
ThanosRuleResourceLabels: "role=thanos-alerting-rules,thanosruler:thanos-ruler",
|
|
||||||
}
|
|
||||||
ruleClient, err := customalerting.NewRuleClient(option)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
stopCh := make(chan struct{})
|
|
||||||
|
|
||||||
informerFactory := informers.NewInformerFactories(k8sClient, nil, nil, nil, nil, promResourcesClient)
|
|
||||||
k8sGVRs := []schema.GroupVersionResource{
|
|
||||||
{Group: "", Version: "v1", Resource: "namespaces"},
|
|
||||||
}
|
|
||||||
for _, gvr := range k8sGVRs {
|
|
||||||
_, err = informerFactory.KubernetesSharedInformerFactory().ForResource(gvr)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
prometheusGVRs := []schema.GroupVersionResource{
|
|
||||||
{Group: "monitoring.coreos.com", Version: "v1", Resource: "prometheuses"},
|
|
||||||
{Group: "monitoring.coreos.com", Version: "v1", Resource: "prometheusrules"},
|
|
||||||
{Group: "monitoring.coreos.com", Version: "v1", Resource: "thanosrulers"},
|
|
||||||
}
|
|
||||||
for _, gvr := range prometheusGVRs {
|
|
||||||
_, err = informerFactory.PrometheusSharedInformerFactory().ForResource(gvr)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
informerFactory.Start(stopCh)
|
|
||||||
informerFactory.KubernetesSharedInformerFactory().WaitForCacheSync(stopCh)
|
|
||||||
informerFactory.PrometheusSharedInformerFactory().WaitForCacheSync(stopCh)
|
|
||||||
informerFactory.Start(stopCh)
|
|
||||||
|
|
||||||
container := restful.NewContainer()
|
|
||||||
AddToContainer(container, informerFactory, promResourcesClient, ruleClient, option)
|
|
||||||
server := &http.Server{}
|
|
||||||
server.Handler = container
|
|
||||||
if err := server.ListenAndServe(); err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestGenSwaggerJson(t *testing.T) {
|
|
||||||
container := runtime.Container
|
|
||||||
|
|
||||||
informerFactory := informers.NewNullInformerFactory()
|
|
||||||
|
|
||||||
AddToContainer(container, informerFactory, nil, nil, nil)
|
|
||||||
|
|
||||||
swagger := restfulspec.BuildSwagger(restfulspec.Config{
|
|
||||||
WebServices: container.RegisteredWebServices(),
|
|
||||||
PostBuildSwaggerObjectHandler: enrichSwaggerObject,
|
|
||||||
})
|
|
||||||
|
|
||||||
swagger.Info.Extensions = make(spec.Extensions)
|
|
||||||
swagger.Info.Extensions.Add("x-tagGroups", []struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
Tags []string `json:"tags"`
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
Name: "Custom Alerting",
|
|
||||||
Tags: []string{constants.CustomAlertingTag},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
enc := json.NewEncoder(os.Stdout)
|
|
||||||
enc.SetIndent("", "\t")
|
|
||||||
enc.Encode(swagger)
|
|
||||||
}
|
|
||||||
|
|
||||||
func enrichSwaggerObject(swo *spec.Swagger) {
|
|
||||||
swo.Info = &spec.Info{
|
|
||||||
InfoProps: spec.InfoProps{
|
|
||||||
Title: "KubeSphere",
|
|
||||||
Description: "KubeSphere OpenAPI",
|
|
||||||
Contact: &spec.ContactInfo{
|
|
||||||
ContactInfoProps: spec.ContactInfoProps{
|
|
||||||
Name: "KubeSphere",
|
|
||||||
URL: "https://kubesphere.io/",
|
|
||||||
Email: "kubesphere@yunify.com",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
License: &spec.License{
|
|
||||||
LicenseProps: spec.LicenseProps{
|
|
||||||
Name: "Apache 2.0",
|
|
||||||
URL: "https://www.apache.org/licenses/LICENSE-2.0.html",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Version: "0.1.0",
|
|
||||||
}}
|
|
||||||
|
|
||||||
// setup security definitions
|
|
||||||
swo.SecurityDefinitions = map[string]*spec.SecurityScheme{
|
|
||||||
"jwt": spec.APIKeyAuth("Authorization", "header"),
|
|
||||||
}
|
|
||||||
swo.Security = []map[string][]string{{"jwt": []string{}}}
|
|
||||||
}
|
|
||||||
@@ -5,10 +5,10 @@ import (
|
|||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/pkg/errors"
|
||||||
promresourcesv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
|
promresourcesv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
|
||||||
prominformersv1 "github.com/prometheus-operator/prometheus-operator/pkg/client/informers/externalversions/monitoring/v1"
|
prominformersv1 "github.com/prometheus-operator/prometheus-operator/pkg/client/informers/externalversions/monitoring/v1"
|
||||||
promresourcesclient "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned"
|
promresourcesclient "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned"
|
||||||
"github.com/pkg/errors"
|
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/labels"
|
"k8s.io/apimachinery/pkg/labels"
|
||||||
"k8s.io/apimachinery/pkg/util/intstr"
|
"k8s.io/apimachinery/pkg/util/intstr"
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ func NewRuleCache(ruleResourceInformer prominformersv1.PrometheusRuleInformer) *
|
|||||||
rc := RuleCache{
|
rc := RuleCache{
|
||||||
namespaces: make(map[string]*namespaceRuleCache),
|
namespaces: make(map[string]*namespaceRuleCache),
|
||||||
}
|
}
|
||||||
|
|
||||||
ruleResourceInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
|
ruleResourceInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
|
||||||
AddFunc: rc.addCache,
|
AddFunc: rc.addCache,
|
||||||
UpdateFunc: func(oldObj, newObj interface{}) {
|
UpdateFunc: func(oldObj, newObj interface{}) {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ const (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
maxSecretSize = corev1.MaxSecretSize
|
maxSecretSize = corev1.MaxSecretSize
|
||||||
maxConfigMapDataSize = int(float64(maxSecretSize) * 0.3)
|
maxConfigMapDataSize = int(float64(maxSecretSize) * 0.45)
|
||||||
|
|
||||||
errOutOfConfigMapSize = errors.New("out of config map size")
|
errOutOfConfigMapSize = errors.New("out of config map size")
|
||||||
)
|
)
|
||||||
@@ -124,7 +124,7 @@ func (r *ruleResource) updateAlertingRule(groupName string, rule *promresourcesv
|
|||||||
}
|
}
|
||||||
|
|
||||||
npr.Spec.Groups = groups
|
npr.Spec.Groups = groups
|
||||||
content, err := yaml.Marshal(npr)
|
content, err := yaml.Marshal(npr.Spec)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, errors.Wrap(err, "failed to unmarshal content")
|
return false, errors.Wrap(err, "failed to unmarshal content")
|
||||||
}
|
}
|
||||||
@@ -160,7 +160,7 @@ func (r *ruleResource) addAlertingRule(group string, rule *promresourcesv1.Rule)
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
content, err := yaml.Marshal(npr)
|
content, err := yaml.Marshal(npr.Spec)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, errors.Wrap(err, "failed to unmarshal content")
|
return false, errors.Wrap(err, "failed to unmarshal content")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,8 +17,10 @@ limitations under the License.
|
|||||||
package k8s
|
package k8s
|
||||||
|
|
||||||
import (
|
import (
|
||||||
promresourcesclient "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned"
|
"strings"
|
||||||
|
|
||||||
snapshotclient "github.com/kubernetes-csi/external-snapshotter/client/v3/clientset/versioned"
|
snapshotclient "github.com/kubernetes-csi/external-snapshotter/client/v3/clientset/versioned"
|
||||||
|
promresourcesclient "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned"
|
||||||
istioclient "istio.io/client-go/pkg/clientset/versioned"
|
istioclient "istio.io/client-go/pkg/clientset/versioned"
|
||||||
apiextensionsclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
|
apiextensionsclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
|
||||||
"k8s.io/client-go/discovery"
|
"k8s.io/client-go/discovery"
|
||||||
@@ -26,7 +28,6 @@ import (
|
|||||||
"k8s.io/client-go/rest"
|
"k8s.io/client-go/rest"
|
||||||
"k8s.io/client-go/tools/clientcmd"
|
"k8s.io/client-go/tools/clientcmd"
|
||||||
kubesphere "kubesphere.io/kubesphere/pkg/client/clientset/versioned"
|
kubesphere "kubesphere.io/kubesphere/pkg/client/clientset/versioned"
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Client interface {
|
type Client interface {
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ limitations under the License.
|
|||||||
package k8s
|
package k8s
|
||||||
|
|
||||||
import (
|
import (
|
||||||
promresourcesclient "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned"
|
|
||||||
snapshotclient "github.com/kubernetes-csi/external-snapshotter/client/v3/clientset/versioned"
|
snapshotclient "github.com/kubernetes-csi/external-snapshotter/client/v3/clientset/versioned"
|
||||||
|
promresourcesclient "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned"
|
||||||
istio "istio.io/client-go/pkg/clientset/versioned"
|
istio "istio.io/client-go/pkg/clientset/versioned"
|
||||||
apiextensionsclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
|
apiextensionsclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
|
||||||
"k8s.io/client-go/discovery"
|
"k8s.io/client-go/discovery"
|
||||||
|
|||||||
201
vendor/github.com/kubernetes-csi/external-snapshotter/v2/LICENSE
generated
vendored
201
vendor/github.com/kubernetes-csi/external-snapshotter/v2/LICENSE
generated
vendored
@@ -1,201 +0,0 @@
|
|||||||
Apache License
|
|
||||||
Version 2.0, January 2004
|
|
||||||
http://www.apache.org/licenses/
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
||||||
|
|
||||||
1. Definitions.
|
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction,
|
|
||||||
and distribution as defined by Sections 1 through 9 of this document.
|
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by
|
|
||||||
the copyright owner that is granting the License.
|
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all
|
|
||||||
other entities that control, are controlled by, or are under common
|
|
||||||
control with that entity. For the purposes of this definition,
|
|
||||||
"control" means (i) the power, direct or indirect, to cause the
|
|
||||||
direction or management of such entity, whether by contract or
|
|
||||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity
|
|
||||||
exercising permissions granted by this License.
|
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications,
|
|
||||||
including but not limited to software source code, documentation
|
|
||||||
source, and configuration files.
|
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical
|
|
||||||
transformation or translation of a Source form, including but
|
|
||||||
not limited to compiled object code, generated documentation,
|
|
||||||
and conversions to other media types.
|
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or
|
|
||||||
Object form, made available under the License, as indicated by a
|
|
||||||
copyright notice that is included in or attached to the work
|
|
||||||
(an example is provided in the Appendix below).
|
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object
|
|
||||||
form, that is based on (or derived from) the Work and for which the
|
|
||||||
editorial revisions, annotations, elaborations, or other modifications
|
|
||||||
represent, as a whole, an original work of authorship. For the purposes
|
|
||||||
of this License, Derivative Works shall not include works that remain
|
|
||||||
separable from, or merely link (or bind by name) to the interfaces of,
|
|
||||||
the Work and Derivative Works thereof.
|
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including
|
|
||||||
the original version of the Work and any modifications or additions
|
|
||||||
to that Work or Derivative Works thereof, that is intentionally
|
|
||||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
||||||
or by an individual or Legal Entity authorized to submit on behalf of
|
|
||||||
the copyright owner. For the purposes of this definition, "submitted"
|
|
||||||
means any form of electronic, verbal, or written communication sent
|
|
||||||
to the Licensor or its representatives, including but not limited to
|
|
||||||
communication on electronic mailing lists, source code control systems,
|
|
||||||
and issue tracking systems that are managed by, or on behalf of, the
|
|
||||||
Licensor for the purpose of discussing and improving the Work, but
|
|
||||||
excluding communication that is conspicuously marked or otherwise
|
|
||||||
designated in writing by the copyright owner as "Not a Contribution."
|
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
||||||
on behalf of whom a Contribution has been received by Licensor and
|
|
||||||
subsequently incorporated within the Work.
|
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
copyright license to reproduce, prepare Derivative Works of,
|
|
||||||
publicly display, publicly perform, sublicense, and distribute the
|
|
||||||
Work and such Derivative Works in Source or Object form.
|
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
(except as stated in this section) patent license to make, have made,
|
|
||||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
||||||
where such license applies only to those patent claims licensable
|
|
||||||
by such Contributor that are necessarily infringed by their
|
|
||||||
Contribution(s) alone or by combination of their Contribution(s)
|
|
||||||
with the Work to which such Contribution(s) was submitted. If You
|
|
||||||
institute patent litigation against any entity (including a
|
|
||||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
||||||
or a Contribution incorporated within the Work constitutes direct
|
|
||||||
or contributory patent infringement, then any patent licenses
|
|
||||||
granted to You under this License for that Work shall terminate
|
|
||||||
as of the date such litigation is filed.
|
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the
|
|
||||||
Work or Derivative Works thereof in any medium, with or without
|
|
||||||
modifications, and in Source or Object form, provided that You
|
|
||||||
meet the following conditions:
|
|
||||||
|
|
||||||
(a) You must give any other recipients of the Work or
|
|
||||||
Derivative Works a copy of this License; and
|
|
||||||
|
|
||||||
(b) You must cause any modified files to carry prominent notices
|
|
||||||
stating that You changed the files; and
|
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works
|
|
||||||
that You distribute, all copyright, patent, trademark, and
|
|
||||||
attribution notices from the Source form of the Work,
|
|
||||||
excluding those notices that do not pertain to any part of
|
|
||||||
the Derivative Works; and
|
|
||||||
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its
|
|
||||||
distribution, then any Derivative Works that You distribute must
|
|
||||||
include a readable copy of the attribution notices contained
|
|
||||||
within such NOTICE file, excluding those notices that do not
|
|
||||||
pertain to any part of the Derivative Works, in at least one
|
|
||||||
of the following places: within a NOTICE text file distributed
|
|
||||||
as part of the Derivative Works; within the Source form or
|
|
||||||
documentation, if provided along with the Derivative Works; or,
|
|
||||||
within a display generated by the Derivative Works, if and
|
|
||||||
wherever such third-party notices normally appear. The contents
|
|
||||||
of the NOTICE file are for informational purposes only and
|
|
||||||
do not modify the License. You may add Your own attribution
|
|
||||||
notices within Derivative Works that You distribute, alongside
|
|
||||||
or as an addendum to the NOTICE text from the Work, provided
|
|
||||||
that such additional attribution notices cannot be construed
|
|
||||||
as modifying the License.
|
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and
|
|
||||||
may provide additional or different license terms and conditions
|
|
||||||
for use, reproduction, or distribution of Your modifications, or
|
|
||||||
for any such Derivative Works as a whole, provided Your use,
|
|
||||||
reproduction, and distribution of the Work otherwise complies with
|
|
||||||
the conditions stated in this License.
|
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
||||||
any Contribution intentionally submitted for inclusion in the Work
|
|
||||||
by You to the Licensor shall be under the terms and conditions of
|
|
||||||
this License, without any additional terms or conditions.
|
|
||||||
Notwithstanding the above, nothing herein shall supersede or modify
|
|
||||||
the terms of any separate license agreement you may have executed
|
|
||||||
with Licensor regarding such Contributions.
|
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade
|
|
||||||
names, trademarks, service marks, or product names of the Licensor,
|
|
||||||
except as required for reasonable and customary use in describing the
|
|
||||||
origin of the Work and reproducing the content of the NOTICE file.
|
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
||||||
agreed to in writing, Licensor provides the Work (and each
|
|
||||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
||||||
implied, including, without limitation, any warranties or conditions
|
|
||||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
||||||
appropriateness of using or redistributing the Work and assume any
|
|
||||||
risks associated with Your exercise of permissions under this License.
|
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory,
|
|
||||||
whether in tort (including negligence), contract, or otherwise,
|
|
||||||
unless required by applicable law (such as deliberate and grossly
|
|
||||||
negligent acts) or agreed to in writing, shall any Contributor be
|
|
||||||
liable to You for damages, including any direct, indirect, special,
|
|
||||||
incidental, or consequential damages of any character arising as a
|
|
||||||
result of this License or out of the use or inability to use the
|
|
||||||
Work (including but not limited to damages for loss of goodwill,
|
|
||||||
work stoppage, computer failure or malfunction, or any and all
|
|
||||||
other commercial damages or losses), even if such Contributor
|
|
||||||
has been advised of the possibility of such damages.
|
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing
|
|
||||||
the Work or Derivative Works thereof, You may choose to offer,
|
|
||||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
||||||
or other liability obligations and/or rights consistent with this
|
|
||||||
License. However, in accepting such obligations, You may act only
|
|
||||||
on Your own behalf and on Your sole responsibility, not on behalf
|
|
||||||
of any other Contributor, and only if You agree to indemnify,
|
|
||||||
defend, and hold each Contributor harmless for any liability
|
|
||||||
incurred by, or claims asserted against, such Contributor by reason
|
|
||||||
of your accepting any such warranty or additional liability.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
APPENDIX: How to apply the Apache License to your work.
|
|
||||||
|
|
||||||
To apply the Apache License to your work, attach the following
|
|
||||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
||||||
replaced with your own identifying information. (Don't include
|
|
||||||
the brackets!) The text should be enclosed in the appropriate
|
|
||||||
comment syntax for the file format. We also recommend that a
|
|
||||||
file or class name and description of purpose be included on the
|
|
||||||
same "printed page" as the copyright notice for easier
|
|
||||||
identification within third-party archives.
|
|
||||||
|
|
||||||
Copyright [yyyy] [name of copyright owner]
|
|
||||||
|
|
||||||
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.
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2018 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// +k8s:deepcopy-gen=package
|
|
||||||
// +groupName=snapshot.storage.k8s.io
|
|
||||||
|
|
||||||
package v1beta1
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2018 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 v1beta1
|
|
||||||
|
|
||||||
import (
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
|
||||||
)
|
|
||||||
|
|
||||||
// GroupName is the group name use in this package.
|
|
||||||
const GroupName = "snapshot.storage.k8s.io"
|
|
||||||
|
|
||||||
var (
|
|
||||||
// SchemeBuilder is the new scheme builder
|
|
||||||
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
|
|
||||||
// AddToScheme adds to scheme
|
|
||||||
AddToScheme = SchemeBuilder.AddToScheme
|
|
||||||
// SchemeGroupVersion is the group version used to register these objects.
|
|
||||||
SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"}
|
|
||||||
)
|
|
||||||
|
|
||||||
// Resource takes an unqualified resource and returns a Group-qualified GroupResource.
|
|
||||||
func Resource(resource string) schema.GroupResource {
|
|
||||||
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
// We only register manually written functions here. The registration of the
|
|
||||||
// generated functions takes place in the generated files. The separation
|
|
||||||
// makes the code compile even when the generated files are missing.
|
|
||||||
SchemeBuilder.Register(addKnownTypes)
|
|
||||||
}
|
|
||||||
|
|
||||||
// addKnownTypes adds the set of types defined in this package to the supplied scheme.
|
|
||||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
|
||||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
|
||||||
&VolumeSnapshotClass{},
|
|
||||||
&VolumeSnapshotClassList{},
|
|
||||||
&VolumeSnapshot{},
|
|
||||||
&VolumeSnapshotList{},
|
|
||||||
&VolumeSnapshotContent{},
|
|
||||||
&VolumeSnapshotContentList{},
|
|
||||||
)
|
|
||||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
@@ -1,395 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2019 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// +kubebuilder:object:generate=true
|
|
||||||
package v1beta1
|
|
||||||
|
|
||||||
import (
|
|
||||||
core_v1 "k8s.io/api/core/v1"
|
|
||||||
"k8s.io/apimachinery/pkg/api/resource"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
)
|
|
||||||
|
|
||||||
// +genclient
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
|
||||||
|
|
||||||
// VolumeSnapshot is a user's request for either creating a point-in-time
|
|
||||||
// snapshot of a persistent volume, or binding to a pre-existing snapshot.
|
|
||||||
// +kubebuilder:object:root=true
|
|
||||||
// +kubebuilder:resource:scope=Namespaced
|
|
||||||
// +kubebuilder:subresource:status
|
|
||||||
// +kubebuilder:printcolumn:name="ReadyToUse",type=boolean,JSONPath=`.status.readyToUse`,description="Indicates if a snapshot is ready to be used to restore a volume."
|
|
||||||
// +kubebuilder:printcolumn:name="SourcePVC",type=string,JSONPath=`.spec.source.persistentVolumeClaimName`,description="Name of the source PVC from where a dynamically taken snapshot will be created."
|
|
||||||
// +kubebuilder:printcolumn:name="SourceSnapshotContent",type=string,JSONPath=`.spec.source.volumeSnapshotContentName`,description="Name of the VolumeSnapshotContent which represents a pre-provisioned snapshot."
|
|
||||||
// +kubebuilder:printcolumn:name="RestoreSize",type=string,JSONPath=`.status.restoreSize`,description="Represents the complete size of the snapshot."
|
|
||||||
// +kubebuilder:printcolumn:name="SnapshotClass",type=string,JSONPath=`.spec.volumeSnapshotClassName`,description="The name of the VolumeSnapshotClass requested by the VolumeSnapshot."
|
|
||||||
// +kubebuilder:printcolumn:name="SnapshotContent",type=string,JSONPath=`.status.boundVolumeSnapshotContentName`,description="The name of the VolumeSnapshotContent to which this VolumeSnapshot is bound."
|
|
||||||
// +kubebuilder:printcolumn:name="CreationTime",type=date,JSONPath=`.status.creationTime`,description="Timestamp when the point-in-time snapshot is taken by the underlying storage system."
|
|
||||||
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
|
|
||||||
type VolumeSnapshot struct {
|
|
||||||
metav1.TypeMeta `json:",inline"`
|
|
||||||
// Standard object's metadata.
|
|
||||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
|
|
||||||
// +optional
|
|
||||||
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
|
||||||
|
|
||||||
// spec defines the desired characteristics of a snapshot requested by a user.
|
|
||||||
// More info: https://kubernetes.io/docs/concepts/storage/volume-snapshots#volumesnapshots
|
|
||||||
// Required.
|
|
||||||
Spec VolumeSnapshotSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"`
|
|
||||||
|
|
||||||
// status represents the current information of a snapshot.
|
|
||||||
// NOTE: status can be modified by sources other than system controllers,
|
|
||||||
// and must not be depended upon for accuracy.
|
|
||||||
// Controllers should only use information from the VolumeSnapshotContent object
|
|
||||||
// after verifying that the binding is accurate and complete.
|
|
||||||
// +optional
|
|
||||||
Status *VolumeSnapshotStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
|
||||||
// VolumeSnapshotList is a list of VolumeSnapshot objects
|
|
||||||
type VolumeSnapshotList struct {
|
|
||||||
metav1.TypeMeta `json:",inline"`
|
|
||||||
// +optional
|
|
||||||
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
|
||||||
|
|
||||||
// List of VolumeSnapshots
|
|
||||||
Items []VolumeSnapshot `json:"items" protobuf:"bytes,2,rep,name=items"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// VolumeSnapshotSpec describes the common attributes of a volume snapshot.
|
|
||||||
type VolumeSnapshotSpec struct {
|
|
||||||
// source specifies where a snapshot will be created from.
|
|
||||||
// This field is immutable after creation.
|
|
||||||
// Required.
|
|
||||||
Source VolumeSnapshotSource `json:"source" protobuf:"bytes,1,opt,name=source"`
|
|
||||||
|
|
||||||
// volumeSnapshotClassName is the name of the VolumeSnapshotClass requested by the VolumeSnapshot.
|
|
||||||
// If not specified, the default snapshot class will be used if one exists.
|
|
||||||
// If not specified, and there is no default snapshot class, dynamic snapshot creation will fail.
|
|
||||||
// Empty string is not allowed for this field.
|
|
||||||
// TODO(xiangqian): a webhook validation on empty string.
|
|
||||||
// More info: https://kubernetes.io/docs/concepts/storage/volume-snapshot-classes
|
|
||||||
// +optional
|
|
||||||
VolumeSnapshotClassName *string `json:"volumeSnapshotClassName,omitempty" protobuf:"bytes,2,opt,name=volumeSnapshotClassName"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// VolumeSnapshotSource specifies whether the underlying snapshot should be
|
|
||||||
// dynamically taken upon creation or if a pre-existing VolumeSnapshotContent
|
|
||||||
// object should be used.
|
|
||||||
// Exactly one of its members must be set.
|
|
||||||
// Members in VolumeSnapshotSource are immutable.
|
|
||||||
// TODO(xiangqian): Add a webhook to ensure that VolumeSnapshotSource members
|
|
||||||
// will not be updated once specified.
|
|
||||||
type VolumeSnapshotSource struct {
|
|
||||||
// persistentVolumeClaimName specifies the name of the PersistentVolumeClaim
|
|
||||||
// object in the same namespace as the VolumeSnapshot object where the
|
|
||||||
// snapshot should be dynamically taken from.
|
|
||||||
// This field is immutable.
|
|
||||||
// +optional
|
|
||||||
PersistentVolumeClaimName *string `json:"persistentVolumeClaimName,omitempty" protobuf:"bytes,1,opt,name=persistentVolumeClaimName"`
|
|
||||||
|
|
||||||
// volumeSnapshotContentName specifies the name of a pre-existing VolumeSnapshotContent
|
|
||||||
// object.
|
|
||||||
// This field is immutable.
|
|
||||||
// +optional
|
|
||||||
VolumeSnapshotContentName *string `json:"volumeSnapshotContentName,omitempty" protobuf:"bytes,2,opt,name=volumeSnapshotContentName"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// VolumeSnapshotStatus is the status of the VolumeSnapshot
|
|
||||||
type VolumeSnapshotStatus struct {
|
|
||||||
// boundVolumeSnapshotContentName represents the name of the VolumeSnapshotContent
|
|
||||||
// object to which the VolumeSnapshot object is bound.
|
|
||||||
// If not specified, it indicates that the VolumeSnapshot object has not been
|
|
||||||
// successfully bound to a VolumeSnapshotContent object yet.
|
|
||||||
// NOTE: Specified boundVolumeSnapshotContentName alone does not mean binding
|
|
||||||
// is valid. Controllers MUST always verify bidirectional binding between
|
|
||||||
// VolumeSnapshot and VolumeSnapshotContent to avoid possible security issues.
|
|
||||||
// +optional
|
|
||||||
BoundVolumeSnapshotContentName *string `json:"boundVolumeSnapshotContentName,omitempty" protobuf:"bytes,1,opt,name=boundVolumeSnapshotContentName"`
|
|
||||||
|
|
||||||
// creationTime is the timestamp when the point-in-time snapshot is taken
|
|
||||||
// by the underlying storage system.
|
|
||||||
// In dynamic snapshot creation case, this field will be filled in with the
|
|
||||||
// "creation_time" value returned from CSI "CreateSnapshotRequest" gRPC call.
|
|
||||||
// For a pre-existing snapshot, this field will be filled with the "creation_time"
|
|
||||||
// value returned from the CSI "ListSnapshots" gRPC call if the driver supports it.
|
|
||||||
// If not specified, it indicates that the creation time of the snapshot is unknown.
|
|
||||||
// +optional
|
|
||||||
CreationTime *metav1.Time `json:"creationTime,omitempty" protobuf:"bytes,2,opt,name=creationTime"`
|
|
||||||
|
|
||||||
// readyToUse indicates if a snapshot is ready to be used to restore a volume.
|
|
||||||
// In dynamic snapshot creation case, this field will be filled in with the
|
|
||||||
// "ready_to_use" value returned from CSI "CreateSnapshotRequest" gRPC call.
|
|
||||||
// For a pre-existing snapshot, this field will be filled with the "ready_to_use"
|
|
||||||
// value returned from the CSI "ListSnapshots" gRPC call if the driver supports it,
|
|
||||||
// otherwise, this field will be set to "True".
|
|
||||||
// If not specified, it means the readiness of a snapshot is unknown.
|
|
||||||
// +optional
|
|
||||||
ReadyToUse *bool `json:"readyToUse,omitempty" protobuf:"varint,3,opt,name=readyToUse"`
|
|
||||||
|
|
||||||
// restoreSize represents the complete size of the snapshot in bytes.
|
|
||||||
// In dynamic snapshot creation case, this field will be filled in with the
|
|
||||||
// "size_bytes" value returned from CSI "CreateSnapshotRequest" gRPC call.
|
|
||||||
// For a pre-existing snapshot, this field will be filled with the "size_bytes"
|
|
||||||
// value returned from the CSI "ListSnapshots" gRPC call if the driver supports it.
|
|
||||||
// When restoring a volume from this snapshot, the size of the volume MUST NOT
|
|
||||||
// be smaller than the restoreSize if it is specified, otherwise the restoration will fail.
|
|
||||||
// If not specified, it indicates that the size is unknown.
|
|
||||||
// +optional
|
|
||||||
RestoreSize *resource.Quantity `json:"restoreSize,omitempty" protobuf:"bytes,4,opt,name=restoreSize"`
|
|
||||||
|
|
||||||
// error is the last observed error during snapshot creation, if any.
|
|
||||||
// This field could be helpful to upper level controllers(i.e., application controller)
|
|
||||||
// to decide whether they should continue on waiting for the snapshot to be created
|
|
||||||
// based on the type of error reported.
|
|
||||||
// +optional
|
|
||||||
Error *VolumeSnapshotError `json:"error,omitempty" protobuf:"bytes,5,opt,name=error,casttype=VolumeSnapshotError"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// +genclient
|
|
||||||
// +genclient:nonNamespaced
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
|
||||||
|
|
||||||
// VolumeSnapshotClass specifies parameters that a underlying storage system uses when
|
|
||||||
// creating a volume snapshot. A specific VolumeSnapshotClass is used by specifying its
|
|
||||||
// name in a VolumeSnapshot object.
|
|
||||||
// VolumeSnapshotClasses are non-namespaced
|
|
||||||
// +kubebuilder:object:root=true
|
|
||||||
// +kubebuilder:resource:scope=Cluster
|
|
||||||
// +kubebuilder:printcolumn:name="Driver",type=string,JSONPath=`.driver`
|
|
||||||
// +kubebuilder:printcolumn:name="DeletionPolicy",type=string,JSONPath=`.deletionPolicy`,description="Determines whether a VolumeSnapshotContent created through the VolumeSnapshotClass should be deleted when its bound VolumeSnapshot is deleted."
|
|
||||||
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
|
|
||||||
type VolumeSnapshotClass struct {
|
|
||||||
metav1.TypeMeta `json:",inline"`
|
|
||||||
// Standard object's metadata.
|
|
||||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
|
|
||||||
// +optional
|
|
||||||
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
|
||||||
|
|
||||||
// driver is the name of the storage driver that handles this VolumeSnapshotClass.
|
|
||||||
// Required.
|
|
||||||
Driver string `json:"driver" protobuf:"bytes,2,opt,name=driver"`
|
|
||||||
|
|
||||||
// parameters is a key-value map with storage driver specific parameters for creating snapshots.
|
|
||||||
// These values are opaque to Kubernetes.
|
|
||||||
// +optional
|
|
||||||
Parameters map[string]string `json:"parameters,omitempty" protobuf:"bytes,3,rep,name=parameters"`
|
|
||||||
|
|
||||||
// deletionPolicy determines whether a VolumeSnapshotContent created through
|
|
||||||
// the VolumeSnapshotClass should be deleted when its bound VolumeSnapshot is deleted.
|
|
||||||
// Supported values are "Retain" and "Delete".
|
|
||||||
// "Retain" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are kept.
|
|
||||||
// "Delete" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are deleted.
|
|
||||||
// Required.
|
|
||||||
DeletionPolicy DeletionPolicy `json:"deletionPolicy" protobuf:"bytes,4,opt,name=deletionPolicy"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
|
||||||
|
|
||||||
// VolumeSnapshotClassList is a collection of VolumeSnapshotClasses.
|
|
||||||
// +kubebuilder:object:root=true
|
|
||||||
type VolumeSnapshotClassList struct {
|
|
||||||
metav1.TypeMeta `json:",inline"`
|
|
||||||
// Standard list metadata
|
|
||||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
|
|
||||||
// +optional
|
|
||||||
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
|
||||||
|
|
||||||
// items is the list of VolumeSnapshotClasses
|
|
||||||
Items []VolumeSnapshotClass `json:"items" protobuf:"bytes,2,rep,name=items"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// +genclient
|
|
||||||
// +genclient:nonNamespaced
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
|
||||||
|
|
||||||
// VolumeSnapshotContent represents the actual "on-disk" snapshot object in the
|
|
||||||
// underlying storage system
|
|
||||||
// +kubebuilder:object:root=true
|
|
||||||
// +kubebuilder:resource:scope=Cluster
|
|
||||||
// +kubebuilder:subresource:status
|
|
||||||
// +kubebuilder:printcolumn:name="ReadyToUse",type=boolean,JSONPath=`.status.readyToUse`,description="Indicates if a snapshot is ready to be used to restore a volume."
|
|
||||||
// +kubebuilder:printcolumn:name="RestoreSize",type=integer,JSONPath=`.status.restoreSize`,description="Represents the complete size of the snapshot in bytes"
|
|
||||||
// +kubebuilder:printcolumn:name="DeletionPolicy",type=string,JSONPath=`.spec.deletionPolicy`,description="Determines whether this VolumeSnapshotContent and its physical snapshot on the underlying storage system should be deleted when its bound VolumeSnapshot is deleted."
|
|
||||||
// +kubebuilder:printcolumn:name="Driver",type=string,JSONPath=`.spec.driver`,description="Name of the CSI driver used to create the physical snapshot on the underlying storage system."
|
|
||||||
// +kubebuilder:printcolumn:name="VolumeSnapshotClass",type=string,JSONPath=`.spec.volumeSnapshotClassName`,description="Name of the VolumeSnapshotClass to which this snapshot belongs."
|
|
||||||
// +kubebuilder:printcolumn:name="VolumeSnapshot",type=string,JSONPath=`.spec.volumeSnapshotRef.name`,description="Name of the VolumeSnapshot object to which this VolumeSnapshotContent object is bound."
|
|
||||||
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
|
|
||||||
type VolumeSnapshotContent struct {
|
|
||||||
metav1.TypeMeta `json:",inline"`
|
|
||||||
// Standard object's metadata.
|
|
||||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
|
|
||||||
// +optional
|
|
||||||
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
|
||||||
|
|
||||||
// spec defines properties of a VolumeSnapshotContent created by the underlying storage system.
|
|
||||||
// Required.
|
|
||||||
Spec VolumeSnapshotContentSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"`
|
|
||||||
|
|
||||||
// status represents the current information of a snapshot.
|
|
||||||
// +optional
|
|
||||||
Status *VolumeSnapshotContentStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
|
||||||
|
|
||||||
// VolumeSnapshotContentList is a list of VolumeSnapshotContent objects
|
|
||||||
// +kubebuilder:object:root=true
|
|
||||||
type VolumeSnapshotContentList struct {
|
|
||||||
metav1.TypeMeta `json:",inline"`
|
|
||||||
// +optional
|
|
||||||
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
|
||||||
|
|
||||||
// items is the list of VolumeSnapshotContents
|
|
||||||
Items []VolumeSnapshotContent `json:"items" protobuf:"bytes,2,rep,name=items"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// VolumeSnapshotContentSpec is the specification of a VolumeSnapshotContent
|
|
||||||
type VolumeSnapshotContentSpec struct {
|
|
||||||
// volumeSnapshotRef specifies the VolumeSnapshot object to which this
|
|
||||||
// VolumeSnapshotContent object is bound.
|
|
||||||
// VolumeSnapshot.Spec.VolumeSnapshotContentName field must reference to
|
|
||||||
// this VolumeSnapshotContent's name for the bidirectional binding to be valid.
|
|
||||||
// For a pre-existing VolumeSnapshotContent object, name and namespace of the
|
|
||||||
// VolumeSnapshot object MUST be provided for binding to happen.
|
|
||||||
// This field is immutable after creation.
|
|
||||||
// Required.
|
|
||||||
VolumeSnapshotRef core_v1.ObjectReference `json:"volumeSnapshotRef" protobuf:"bytes,1,opt,name=volumeSnapshotRef"`
|
|
||||||
|
|
||||||
// deletionPolicy determines whether this VolumeSnapshotContent and its physical snapshot on
|
|
||||||
// the underlying storage system should be deleted when its bound VolumeSnapshot is deleted.
|
|
||||||
// Supported values are "Retain" and "Delete".
|
|
||||||
// "Retain" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are kept.
|
|
||||||
// "Delete" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are deleted.
|
|
||||||
// In dynamic snapshot creation case, this field will be filled in with the "DeletionPolicy" field defined in the
|
|
||||||
// VolumeSnapshotClass the VolumeSnapshot refers to.
|
|
||||||
// For pre-existing snapshots, users MUST specify this field when creating the VolumeSnapshotContent object.
|
|
||||||
// Required.
|
|
||||||
DeletionPolicy DeletionPolicy `json:"deletionPolicy" protobuf:"bytes,2,opt,name=deletionPolicy"`
|
|
||||||
|
|
||||||
// driver is the name of the CSI driver used to create the physical snapshot on
|
|
||||||
// the underlying storage system.
|
|
||||||
// This MUST be the same as the name returned by the CSI GetPluginName() call for
|
|
||||||
// that driver.
|
|
||||||
// Required.
|
|
||||||
Driver string `json:"driver" protobuf:"bytes,3,opt,name=driver"`
|
|
||||||
|
|
||||||
// name of the VolumeSnapshotClass to which this snapshot belongs.
|
|
||||||
// +optional
|
|
||||||
VolumeSnapshotClassName *string `json:"volumeSnapshotClassName,omitempty" protobuf:"bytes,4,opt,name=volumeSnapshotClassName"`
|
|
||||||
|
|
||||||
// source specifies from where a snapshot will be created.
|
|
||||||
// This field is immutable after creation.
|
|
||||||
// Required.
|
|
||||||
Source VolumeSnapshotContentSource `json:"source" protobuf:"bytes,5,opt,name=source"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// VolumeSnapshotContentSource represents the CSI source of a snapshot.
|
|
||||||
// Exactly one of its members must be set.
|
|
||||||
// Members in VolumeSnapshotContentSource are immutable.
|
|
||||||
// TODO(xiangqian): Add a webhook to ensure that VolumeSnapshotContentSource members
|
|
||||||
// will be immutable once specified.
|
|
||||||
type VolumeSnapshotContentSource struct {
|
|
||||||
// volumeHandle specifies the CSI "volume_id" of the volume from which a snapshot
|
|
||||||
// should be dynamically taken from.
|
|
||||||
// This field is immutable.
|
|
||||||
// +optional
|
|
||||||
VolumeHandle *string `json:"volumeHandle,omitempty" protobuf:"bytes,1,opt,name=volumeHandle"`
|
|
||||||
|
|
||||||
// snapshotHandle specifies the CSI "snapshot_id" of a pre-existing snapshot on
|
|
||||||
// the underlying storage system.
|
|
||||||
// This field is immutable.
|
|
||||||
// +optional
|
|
||||||
SnapshotHandle *string `json:"snapshotHandle,omitempty" protobuf:"bytes,2,opt,name=snapshotHandle"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// VolumeSnapshotContentStatus is the status of a VolumeSnapshotContent object
|
|
||||||
type VolumeSnapshotContentStatus struct {
|
|
||||||
// snapshotHandle is the CSI "snapshot_id" of a snapshot on the underlying storage system.
|
|
||||||
// If not specified, it indicates that dynamic snapshot creation has either failed
|
|
||||||
// or it is still in progress.
|
|
||||||
// +optional
|
|
||||||
SnapshotHandle *string `json:"snapshotHandle,omitempty" protobuf:"bytes,1,opt,name=snapshotHandle"`
|
|
||||||
|
|
||||||
// creationTime is the timestamp when the point-in-time snapshot is taken
|
|
||||||
// by the underlying storage system.
|
|
||||||
// In dynamic snapshot creation case, this field will be filled in with the
|
|
||||||
// "creation_time" value returned from CSI "CreateSnapshotRequest" gRPC call.
|
|
||||||
// For a pre-existing snapshot, this field will be filled with the "creation_time"
|
|
||||||
// value returned from the CSI "ListSnapshots" gRPC call if the driver supports it.
|
|
||||||
// If not specified, it indicates the creation time is unknown.
|
|
||||||
// The format of this field is a Unix nanoseconds time encoded as an int64.
|
|
||||||
// On Unix, the command `date +%s%N` returns the current time in nanoseconds
|
|
||||||
// since 1970-01-01 00:00:00 UTC.
|
|
||||||
// +optional
|
|
||||||
CreationTime *int64 `json:"creationTime,omitempty" protobuf:"varint,2,opt,name=creationTime"`
|
|
||||||
|
|
||||||
// restoreSize represents the complete size of the snapshot in bytes.
|
|
||||||
// In dynamic snapshot creation case, this field will be filled in with the
|
|
||||||
// "size_bytes" value returned from CSI "CreateSnapshotRequest" gRPC call.
|
|
||||||
// For a pre-existing snapshot, this field will be filled with the "size_bytes"
|
|
||||||
// value returned from the CSI "ListSnapshots" gRPC call if the driver supports it.
|
|
||||||
// When restoring a volume from this snapshot, the size of the volume MUST NOT
|
|
||||||
// be smaller than the restoreSize if it is specified, otherwise the restoration will fail.
|
|
||||||
// If not specified, it indicates that the size is unknown.
|
|
||||||
// +kubebuilder:validation:Minimum=0
|
|
||||||
// +optional
|
|
||||||
RestoreSize *int64 `json:"restoreSize,omitempty" protobuf:"bytes,3,opt,name=restoreSize"`
|
|
||||||
|
|
||||||
// readyToUse indicates if a snapshot is ready to be used to restore a volume.
|
|
||||||
// In dynamic snapshot creation case, this field will be filled in with the
|
|
||||||
// "ready_to_use" value returned from CSI "CreateSnapshotRequest" gRPC call.
|
|
||||||
// For a pre-existing snapshot, this field will be filled with the "ready_to_use"
|
|
||||||
// value returned from the CSI "ListSnapshots" gRPC call if the driver supports it,
|
|
||||||
// otherwise, this field will be set to "True".
|
|
||||||
// If not specified, it means the readiness of a snapshot is unknown.
|
|
||||||
// +optional.
|
|
||||||
ReadyToUse *bool `json:"readyToUse,omitempty" protobuf:"varint,4,opt,name=readyToUse"`
|
|
||||||
|
|
||||||
// error is the latest observed error during snapshot creation, if any.
|
|
||||||
// +optional
|
|
||||||
Error *VolumeSnapshotError `json:"error,omitempty" protobuf:"bytes,5,opt,name=error,casttype=VolumeSnapshotError"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeletionPolicy describes a policy for end-of-life maintenance of volume snapshot contents
|
|
||||||
// +kubebuilder:validation:Enum=Delete;Retain
|
|
||||||
type DeletionPolicy string
|
|
||||||
|
|
||||||
const (
|
|
||||||
// volumeSnapshotContentDelete means the snapshot will be deleted from the
|
|
||||||
// underlying storage system on release from its volume snapshot.
|
|
||||||
VolumeSnapshotContentDelete DeletionPolicy = "Delete"
|
|
||||||
|
|
||||||
// volumeSnapshotContentRetain means the snapshot will be left in its current
|
|
||||||
// state on release from its volume snapshot.
|
|
||||||
VolumeSnapshotContentRetain DeletionPolicy = "Retain"
|
|
||||||
)
|
|
||||||
|
|
||||||
// VolumeSnapshotError describes an error encountered during snapshot creation.
|
|
||||||
type VolumeSnapshotError struct {
|
|
||||||
// time is the timestamp when the error was encountered.
|
|
||||||
// +optional
|
|
||||||
Time *metav1.Time `json:"time,omitempty" protobuf:"bytes,1,opt,name=time"`
|
|
||||||
|
|
||||||
// message is a string detailing the encountered error during snapshot
|
|
||||||
// creation if specified.
|
|
||||||
// NOTE: message may be logged, and it should not contain sensitive
|
|
||||||
// information.
|
|
||||||
// +optional
|
|
||||||
Message *string `json:"message,omitempty" protobuf:"bytes,2,opt,name=message"`
|
|
||||||
}
|
|
||||||
@@ -1,424 +0,0 @@
|
|||||||
// +build !ignore_autogenerated
|
|
||||||
|
|
||||||
/*
|
|
||||||
Copyright 2019 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by deepcopy-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package v1beta1
|
|
||||||
|
|
||||||
import (
|
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
|
||||||
)
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *VolumeSnapshot) DeepCopyInto(out *VolumeSnapshot) {
|
|
||||||
*out = *in
|
|
||||||
out.TypeMeta = in.TypeMeta
|
|
||||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
|
||||||
in.Spec.DeepCopyInto(&out.Spec)
|
|
||||||
if in.Status != nil {
|
|
||||||
in, out := &in.Status, &out.Status
|
|
||||||
*out = new(VolumeSnapshotStatus)
|
|
||||||
(*in).DeepCopyInto(*out)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshot.
|
|
||||||
func (in *VolumeSnapshot) DeepCopy() *VolumeSnapshot {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(VolumeSnapshot)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
|
||||||
func (in *VolumeSnapshot) 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 *VolumeSnapshotClass) DeepCopyInto(out *VolumeSnapshotClass) {
|
|
||||||
*out = *in
|
|
||||||
out.TypeMeta = in.TypeMeta
|
|
||||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
|
||||||
if in.Parameters != nil {
|
|
||||||
in, out := &in.Parameters, &out.Parameters
|
|
||||||
*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 VolumeSnapshotClass.
|
|
||||||
func (in *VolumeSnapshotClass) DeepCopy() *VolumeSnapshotClass {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(VolumeSnapshotClass)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
|
||||||
func (in *VolumeSnapshotClass) 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 *VolumeSnapshotClassList) DeepCopyInto(out *VolumeSnapshotClassList) {
|
|
||||||
*out = *in
|
|
||||||
out.TypeMeta = in.TypeMeta
|
|
||||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
|
||||||
if in.Items != nil {
|
|
||||||
in, out := &in.Items, &out.Items
|
|
||||||
*out = make([]VolumeSnapshotClass, len(*in))
|
|
||||||
for i := range *in {
|
|
||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotClassList.
|
|
||||||
func (in *VolumeSnapshotClassList) DeepCopy() *VolumeSnapshotClassList {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(VolumeSnapshotClassList)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
|
||||||
func (in *VolumeSnapshotClassList) 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 *VolumeSnapshotContent) DeepCopyInto(out *VolumeSnapshotContent) {
|
|
||||||
*out = *in
|
|
||||||
out.TypeMeta = in.TypeMeta
|
|
||||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
|
||||||
in.Spec.DeepCopyInto(&out.Spec)
|
|
||||||
if in.Status != nil {
|
|
||||||
in, out := &in.Status, &out.Status
|
|
||||||
*out = new(VolumeSnapshotContentStatus)
|
|
||||||
(*in).DeepCopyInto(*out)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotContent.
|
|
||||||
func (in *VolumeSnapshotContent) DeepCopy() *VolumeSnapshotContent {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(VolumeSnapshotContent)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
|
||||||
func (in *VolumeSnapshotContent) 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 *VolumeSnapshotContentList) DeepCopyInto(out *VolumeSnapshotContentList) {
|
|
||||||
*out = *in
|
|
||||||
out.TypeMeta = in.TypeMeta
|
|
||||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
|
||||||
if in.Items != nil {
|
|
||||||
in, out := &in.Items, &out.Items
|
|
||||||
*out = make([]VolumeSnapshotContent, len(*in))
|
|
||||||
for i := range *in {
|
|
||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotContentList.
|
|
||||||
func (in *VolumeSnapshotContentList) DeepCopy() *VolumeSnapshotContentList {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(VolumeSnapshotContentList)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
|
||||||
func (in *VolumeSnapshotContentList) 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 *VolumeSnapshotContentSource) DeepCopyInto(out *VolumeSnapshotContentSource) {
|
|
||||||
*out = *in
|
|
||||||
if in.VolumeHandle != nil {
|
|
||||||
in, out := &in.VolumeHandle, &out.VolumeHandle
|
|
||||||
*out = new(string)
|
|
||||||
**out = **in
|
|
||||||
}
|
|
||||||
if in.SnapshotHandle != nil {
|
|
||||||
in, out := &in.SnapshotHandle, &out.SnapshotHandle
|
|
||||||
*out = new(string)
|
|
||||||
**out = **in
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotContentSource.
|
|
||||||
func (in *VolumeSnapshotContentSource) DeepCopy() *VolumeSnapshotContentSource {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(VolumeSnapshotContentSource)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *VolumeSnapshotContentSpec) DeepCopyInto(out *VolumeSnapshotContentSpec) {
|
|
||||||
*out = *in
|
|
||||||
out.VolumeSnapshotRef = in.VolumeSnapshotRef
|
|
||||||
if in.VolumeSnapshotClassName != nil {
|
|
||||||
in, out := &in.VolumeSnapshotClassName, &out.VolumeSnapshotClassName
|
|
||||||
*out = new(string)
|
|
||||||
**out = **in
|
|
||||||
}
|
|
||||||
in.Source.DeepCopyInto(&out.Source)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotContentSpec.
|
|
||||||
func (in *VolumeSnapshotContentSpec) DeepCopy() *VolumeSnapshotContentSpec {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(VolumeSnapshotContentSpec)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *VolumeSnapshotContentStatus) DeepCopyInto(out *VolumeSnapshotContentStatus) {
|
|
||||||
*out = *in
|
|
||||||
if in.SnapshotHandle != nil {
|
|
||||||
in, out := &in.SnapshotHandle, &out.SnapshotHandle
|
|
||||||
*out = new(string)
|
|
||||||
**out = **in
|
|
||||||
}
|
|
||||||
if in.CreationTime != nil {
|
|
||||||
in, out := &in.CreationTime, &out.CreationTime
|
|
||||||
*out = new(int64)
|
|
||||||
**out = **in
|
|
||||||
}
|
|
||||||
if in.RestoreSize != nil {
|
|
||||||
in, out := &in.RestoreSize, &out.RestoreSize
|
|
||||||
*out = new(int64)
|
|
||||||
**out = **in
|
|
||||||
}
|
|
||||||
if in.ReadyToUse != nil {
|
|
||||||
in, out := &in.ReadyToUse, &out.ReadyToUse
|
|
||||||
*out = new(bool)
|
|
||||||
**out = **in
|
|
||||||
}
|
|
||||||
if in.Error != nil {
|
|
||||||
in, out := &in.Error, &out.Error
|
|
||||||
*out = new(VolumeSnapshotError)
|
|
||||||
(*in).DeepCopyInto(*out)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotContentStatus.
|
|
||||||
func (in *VolumeSnapshotContentStatus) DeepCopy() *VolumeSnapshotContentStatus {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(VolumeSnapshotContentStatus)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *VolumeSnapshotError) DeepCopyInto(out *VolumeSnapshotError) {
|
|
||||||
*out = *in
|
|
||||||
if in.Time != nil {
|
|
||||||
in, out := &in.Time, &out.Time
|
|
||||||
*out = (*in).DeepCopy()
|
|
||||||
}
|
|
||||||
if in.Message != nil {
|
|
||||||
in, out := &in.Message, &out.Message
|
|
||||||
*out = new(string)
|
|
||||||
**out = **in
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotError.
|
|
||||||
func (in *VolumeSnapshotError) DeepCopy() *VolumeSnapshotError {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(VolumeSnapshotError)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *VolumeSnapshotList) DeepCopyInto(out *VolumeSnapshotList) {
|
|
||||||
*out = *in
|
|
||||||
out.TypeMeta = in.TypeMeta
|
|
||||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
|
||||||
if in.Items != nil {
|
|
||||||
in, out := &in.Items, &out.Items
|
|
||||||
*out = make([]VolumeSnapshot, len(*in))
|
|
||||||
for i := range *in {
|
|
||||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotList.
|
|
||||||
func (in *VolumeSnapshotList) DeepCopy() *VolumeSnapshotList {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(VolumeSnapshotList)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
|
||||||
func (in *VolumeSnapshotList) 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 *VolumeSnapshotSource) DeepCopyInto(out *VolumeSnapshotSource) {
|
|
||||||
*out = *in
|
|
||||||
if in.PersistentVolumeClaimName != nil {
|
|
||||||
in, out := &in.PersistentVolumeClaimName, &out.PersistentVolumeClaimName
|
|
||||||
*out = new(string)
|
|
||||||
**out = **in
|
|
||||||
}
|
|
||||||
if in.VolumeSnapshotContentName != nil {
|
|
||||||
in, out := &in.VolumeSnapshotContentName, &out.VolumeSnapshotContentName
|
|
||||||
*out = new(string)
|
|
||||||
**out = **in
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotSource.
|
|
||||||
func (in *VolumeSnapshotSource) DeepCopy() *VolumeSnapshotSource {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(VolumeSnapshotSource)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *VolumeSnapshotSpec) DeepCopyInto(out *VolumeSnapshotSpec) {
|
|
||||||
*out = *in
|
|
||||||
in.Source.DeepCopyInto(&out.Source)
|
|
||||||
if in.VolumeSnapshotClassName != nil {
|
|
||||||
in, out := &in.VolumeSnapshotClassName, &out.VolumeSnapshotClassName
|
|
||||||
*out = new(string)
|
|
||||||
**out = **in
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotSpec.
|
|
||||||
func (in *VolumeSnapshotSpec) DeepCopy() *VolumeSnapshotSpec {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(VolumeSnapshotSpec)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *VolumeSnapshotStatus) DeepCopyInto(out *VolumeSnapshotStatus) {
|
|
||||||
*out = *in
|
|
||||||
if in.BoundVolumeSnapshotContentName != nil {
|
|
||||||
in, out := &in.BoundVolumeSnapshotContentName, &out.BoundVolumeSnapshotContentName
|
|
||||||
*out = new(string)
|
|
||||||
**out = **in
|
|
||||||
}
|
|
||||||
if in.CreationTime != nil {
|
|
||||||
in, out := &in.CreationTime, &out.CreationTime
|
|
||||||
*out = (*in).DeepCopy()
|
|
||||||
}
|
|
||||||
if in.ReadyToUse != nil {
|
|
||||||
in, out := &in.ReadyToUse, &out.ReadyToUse
|
|
||||||
*out = new(bool)
|
|
||||||
**out = **in
|
|
||||||
}
|
|
||||||
if in.RestoreSize != nil {
|
|
||||||
in, out := &in.RestoreSize, &out.RestoreSize
|
|
||||||
x := (*in).DeepCopy()
|
|
||||||
*out = &x
|
|
||||||
}
|
|
||||||
if in.Error != nil {
|
|
||||||
in, out := &in.Error, &out.Error
|
|
||||||
*out = new(VolumeSnapshotError)
|
|
||||||
(*in).DeepCopyInto(*out)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotStatus.
|
|
||||||
func (in *VolumeSnapshotStatus) DeepCopy() *VolumeSnapshotStatus {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(VolumeSnapshotStatus)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2019 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by client-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package versioned
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
snapshotv1beta1 "github.com/kubernetes-csi/external-snapshotter/v2/pkg/client/clientset/versioned/typed/volumesnapshot/v1beta1"
|
|
||||||
discovery "k8s.io/client-go/discovery"
|
|
||||||
rest "k8s.io/client-go/rest"
|
|
||||||
flowcontrol "k8s.io/client-go/util/flowcontrol"
|
|
||||||
)
|
|
||||||
|
|
||||||
type Interface interface {
|
|
||||||
Discovery() discovery.DiscoveryInterface
|
|
||||||
SnapshotV1beta1() snapshotv1beta1.SnapshotV1beta1Interface
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clientset contains the clients for groups. Each group has exactly one
|
|
||||||
// version included in a Clientset.
|
|
||||||
type Clientset struct {
|
|
||||||
*discovery.DiscoveryClient
|
|
||||||
snapshotV1beta1 *snapshotv1beta1.SnapshotV1beta1Client
|
|
||||||
}
|
|
||||||
|
|
||||||
// SnapshotV1beta1 retrieves the SnapshotV1beta1Client
|
|
||||||
func (c *Clientset) SnapshotV1beta1() snapshotv1beta1.SnapshotV1beta1Interface {
|
|
||||||
return c.snapshotV1beta1
|
|
||||||
}
|
|
||||||
|
|
||||||
// Discovery retrieves the DiscoveryClient
|
|
||||||
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
|
|
||||||
if c == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return c.DiscoveryClient
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewForConfig creates a new Clientset for the given config.
|
|
||||||
// If config's RateLimiter is not set and QPS and Burst are acceptable,
|
|
||||||
// NewForConfig will generate a rate-limiter in configShallowCopy.
|
|
||||||
func NewForConfig(c *rest.Config) (*Clientset, error) {
|
|
||||||
configShallowCopy := *c
|
|
||||||
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
|
|
||||||
if configShallowCopy.Burst <= 0 {
|
|
||||||
return nil, fmt.Errorf("Burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0")
|
|
||||||
}
|
|
||||||
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
|
|
||||||
}
|
|
||||||
var cs Clientset
|
|
||||||
var err error
|
|
||||||
cs.snapshotV1beta1, err = snapshotv1beta1.NewForConfig(&configShallowCopy)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return &cs, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewForConfigOrDie creates a new Clientset for the given config and
|
|
||||||
// panics if there is an error in the config.
|
|
||||||
func NewForConfigOrDie(c *rest.Config) *Clientset {
|
|
||||||
var cs Clientset
|
|
||||||
cs.snapshotV1beta1 = snapshotv1beta1.NewForConfigOrDie(c)
|
|
||||||
|
|
||||||
cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
|
|
||||||
return &cs
|
|
||||||
}
|
|
||||||
|
|
||||||
// New creates a new Clientset for the given RESTClient.
|
|
||||||
func New(c rest.Interface) *Clientset {
|
|
||||||
var cs Clientset
|
|
||||||
cs.snapshotV1beta1 = snapshotv1beta1.New(c)
|
|
||||||
|
|
||||||
cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
|
|
||||||
return &cs
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2019 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by client-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
// This package has the automatically generated clientset.
|
|
||||||
package versioned
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2019 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by client-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
// This package contains the scheme of the automatically generated clientset.
|
|
||||||
package scheme
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2019 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by client-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package scheme
|
|
||||||
|
|
||||||
import (
|
|
||||||
snapshotv1beta1 "github.com/kubernetes-csi/external-snapshotter/v2/pkg/apis/volumesnapshot/v1beta1"
|
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
|
||||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
|
||||||
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
|
||||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
|
||||||
)
|
|
||||||
|
|
||||||
var Scheme = runtime.NewScheme()
|
|
||||||
var Codecs = serializer.NewCodecFactory(Scheme)
|
|
||||||
var ParameterCodec = runtime.NewParameterCodec(Scheme)
|
|
||||||
var localSchemeBuilder = runtime.SchemeBuilder{
|
|
||||||
snapshotv1beta1.AddToScheme,
|
|
||||||
}
|
|
||||||
|
|
||||||
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
|
|
||||||
// of clientsets, like in:
|
|
||||||
//
|
|
||||||
// import (
|
|
||||||
// "k8s.io/client-go/kubernetes"
|
|
||||||
// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
|
|
||||||
// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
|
|
||||||
// )
|
|
||||||
//
|
|
||||||
// kclientset, _ := kubernetes.NewForConfig(c)
|
|
||||||
// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
|
|
||||||
//
|
|
||||||
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
|
|
||||||
// correctly.
|
|
||||||
var AddToScheme = localSchemeBuilder.AddToScheme
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"})
|
|
||||||
utilruntime.Must(AddToScheme(Scheme))
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2019 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by client-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
// This package has the automatically generated typed clients.
|
|
||||||
package v1beta1
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2019 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by client-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package v1beta1
|
|
||||||
|
|
||||||
type VolumeSnapshotExpansion interface{}
|
|
||||||
|
|
||||||
type VolumeSnapshotClassExpansion interface{}
|
|
||||||
|
|
||||||
type VolumeSnapshotContentExpansion interface{}
|
|
||||||
@@ -1,191 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2019 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by client-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package v1beta1
|
|
||||||
|
|
||||||
import (
|
|
||||||
"time"
|
|
||||||
|
|
||||||
v1beta1 "github.com/kubernetes-csi/external-snapshotter/v2/pkg/apis/volumesnapshot/v1beta1"
|
|
||||||
scheme "github.com/kubernetes-csi/external-snapshotter/v2/pkg/client/clientset/versioned/scheme"
|
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
|
||||||
watch "k8s.io/apimachinery/pkg/watch"
|
|
||||||
rest "k8s.io/client-go/rest"
|
|
||||||
)
|
|
||||||
|
|
||||||
// VolumeSnapshotsGetter has a method to return a VolumeSnapshotInterface.
|
|
||||||
// A group's client should implement this interface.
|
|
||||||
type VolumeSnapshotsGetter interface {
|
|
||||||
VolumeSnapshots(namespace string) VolumeSnapshotInterface
|
|
||||||
}
|
|
||||||
|
|
||||||
// VolumeSnapshotInterface has methods to work with VolumeSnapshot resources.
|
|
||||||
type VolumeSnapshotInterface interface {
|
|
||||||
Create(*v1beta1.VolumeSnapshot) (*v1beta1.VolumeSnapshot, error)
|
|
||||||
Update(*v1beta1.VolumeSnapshot) (*v1beta1.VolumeSnapshot, error)
|
|
||||||
UpdateStatus(*v1beta1.VolumeSnapshot) (*v1beta1.VolumeSnapshot, error)
|
|
||||||
Delete(name string, options *v1.DeleteOptions) error
|
|
||||||
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
|
|
||||||
Get(name string, options v1.GetOptions) (*v1beta1.VolumeSnapshot, error)
|
|
||||||
List(opts v1.ListOptions) (*v1beta1.VolumeSnapshotList, error)
|
|
||||||
Watch(opts v1.ListOptions) (watch.Interface, error)
|
|
||||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.VolumeSnapshot, err error)
|
|
||||||
VolumeSnapshotExpansion
|
|
||||||
}
|
|
||||||
|
|
||||||
// volumeSnapshots implements VolumeSnapshotInterface
|
|
||||||
type volumeSnapshots struct {
|
|
||||||
client rest.Interface
|
|
||||||
ns string
|
|
||||||
}
|
|
||||||
|
|
||||||
// newVolumeSnapshots returns a VolumeSnapshots
|
|
||||||
func newVolumeSnapshots(c *SnapshotV1beta1Client, namespace string) *volumeSnapshots {
|
|
||||||
return &volumeSnapshots{
|
|
||||||
client: c.RESTClient(),
|
|
||||||
ns: namespace,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get takes name of the volumeSnapshot, and returns the corresponding volumeSnapshot object, and an error if there is any.
|
|
||||||
func (c *volumeSnapshots) Get(name string, options v1.GetOptions) (result *v1beta1.VolumeSnapshot, err error) {
|
|
||||||
result = &v1beta1.VolumeSnapshot{}
|
|
||||||
err = c.client.Get().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("volumesnapshots").
|
|
||||||
Name(name).
|
|
||||||
VersionedParams(&options, scheme.ParameterCodec).
|
|
||||||
Do().
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// List takes label and field selectors, and returns the list of VolumeSnapshots that match those selectors.
|
|
||||||
func (c *volumeSnapshots) List(opts v1.ListOptions) (result *v1beta1.VolumeSnapshotList, err error) {
|
|
||||||
var timeout time.Duration
|
|
||||||
if opts.TimeoutSeconds != nil {
|
|
||||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
|
||||||
}
|
|
||||||
result = &v1beta1.VolumeSnapshotList{}
|
|
||||||
err = c.client.Get().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("volumesnapshots").
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Timeout(timeout).
|
|
||||||
Do().
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Watch returns a watch.Interface that watches the requested volumeSnapshots.
|
|
||||||
func (c *volumeSnapshots) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
|
||||||
var timeout time.Duration
|
|
||||||
if opts.TimeoutSeconds != nil {
|
|
||||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
|
||||||
}
|
|
||||||
opts.Watch = true
|
|
||||||
return c.client.Get().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("volumesnapshots").
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Timeout(timeout).
|
|
||||||
Watch()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create takes the representation of a volumeSnapshot and creates it. Returns the server's representation of the volumeSnapshot, and an error, if there is any.
|
|
||||||
func (c *volumeSnapshots) Create(volumeSnapshot *v1beta1.VolumeSnapshot) (result *v1beta1.VolumeSnapshot, err error) {
|
|
||||||
result = &v1beta1.VolumeSnapshot{}
|
|
||||||
err = c.client.Post().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("volumesnapshots").
|
|
||||||
Body(volumeSnapshot).
|
|
||||||
Do().
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update takes the representation of a volumeSnapshot and updates it. Returns the server's representation of the volumeSnapshot, and an error, if there is any.
|
|
||||||
func (c *volumeSnapshots) Update(volumeSnapshot *v1beta1.VolumeSnapshot) (result *v1beta1.VolumeSnapshot, err error) {
|
|
||||||
result = &v1beta1.VolumeSnapshot{}
|
|
||||||
err = c.client.Put().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("volumesnapshots").
|
|
||||||
Name(volumeSnapshot.Name).
|
|
||||||
Body(volumeSnapshot).
|
|
||||||
Do().
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpdateStatus was generated because the type contains a Status member.
|
|
||||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
|
||||||
|
|
||||||
func (c *volumeSnapshots) UpdateStatus(volumeSnapshot *v1beta1.VolumeSnapshot) (result *v1beta1.VolumeSnapshot, err error) {
|
|
||||||
result = &v1beta1.VolumeSnapshot{}
|
|
||||||
err = c.client.Put().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("volumesnapshots").
|
|
||||||
Name(volumeSnapshot.Name).
|
|
||||||
SubResource("status").
|
|
||||||
Body(volumeSnapshot).
|
|
||||||
Do().
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete takes name of the volumeSnapshot and deletes it. Returns an error if one occurs.
|
|
||||||
func (c *volumeSnapshots) Delete(name string, options *v1.DeleteOptions) error {
|
|
||||||
return c.client.Delete().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("volumesnapshots").
|
|
||||||
Name(name).
|
|
||||||
Body(options).
|
|
||||||
Do().
|
|
||||||
Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteCollection deletes a collection of objects.
|
|
||||||
func (c *volumeSnapshots) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
|
||||||
var timeout time.Duration
|
|
||||||
if listOptions.TimeoutSeconds != nil {
|
|
||||||
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
|
|
||||||
}
|
|
||||||
return c.client.Delete().
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("volumesnapshots").
|
|
||||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
|
||||||
Timeout(timeout).
|
|
||||||
Body(options).
|
|
||||||
Do().
|
|
||||||
Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Patch applies the patch and returns the patched volumeSnapshot.
|
|
||||||
func (c *volumeSnapshots) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.VolumeSnapshot, err error) {
|
|
||||||
result = &v1beta1.VolumeSnapshot{}
|
|
||||||
err = c.client.Patch(pt).
|
|
||||||
Namespace(c.ns).
|
|
||||||
Resource("volumesnapshots").
|
|
||||||
SubResource(subresources...).
|
|
||||||
Name(name).
|
|
||||||
Body(data).
|
|
||||||
Do().
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
@@ -1,99 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2019 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by client-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package v1beta1
|
|
||||||
|
|
||||||
import (
|
|
||||||
v1beta1 "github.com/kubernetes-csi/external-snapshotter/v2/pkg/apis/volumesnapshot/v1beta1"
|
|
||||||
"github.com/kubernetes-csi/external-snapshotter/v2/pkg/client/clientset/versioned/scheme"
|
|
||||||
rest "k8s.io/client-go/rest"
|
|
||||||
)
|
|
||||||
|
|
||||||
type SnapshotV1beta1Interface interface {
|
|
||||||
RESTClient() rest.Interface
|
|
||||||
VolumeSnapshotsGetter
|
|
||||||
VolumeSnapshotClassesGetter
|
|
||||||
VolumeSnapshotContentsGetter
|
|
||||||
}
|
|
||||||
|
|
||||||
// SnapshotV1beta1Client is used to interact with features provided by the snapshot.storage.k8s.io group.
|
|
||||||
type SnapshotV1beta1Client struct {
|
|
||||||
restClient rest.Interface
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *SnapshotV1beta1Client) VolumeSnapshots(namespace string) VolumeSnapshotInterface {
|
|
||||||
return newVolumeSnapshots(c, namespace)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *SnapshotV1beta1Client) VolumeSnapshotClasses() VolumeSnapshotClassInterface {
|
|
||||||
return newVolumeSnapshotClasses(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *SnapshotV1beta1Client) VolumeSnapshotContents() VolumeSnapshotContentInterface {
|
|
||||||
return newVolumeSnapshotContents(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewForConfig creates a new SnapshotV1beta1Client for the given config.
|
|
||||||
func NewForConfig(c *rest.Config) (*SnapshotV1beta1Client, error) {
|
|
||||||
config := *c
|
|
||||||
if err := setConfigDefaults(&config); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
client, err := rest.RESTClientFor(&config)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return &SnapshotV1beta1Client{client}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewForConfigOrDie creates a new SnapshotV1beta1Client for the given config and
|
|
||||||
// panics if there is an error in the config.
|
|
||||||
func NewForConfigOrDie(c *rest.Config) *SnapshotV1beta1Client {
|
|
||||||
client, err := NewForConfig(c)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
return client
|
|
||||||
}
|
|
||||||
|
|
||||||
// New creates a new SnapshotV1beta1Client for the given RESTClient.
|
|
||||||
func New(c rest.Interface) *SnapshotV1beta1Client {
|
|
||||||
return &SnapshotV1beta1Client{c}
|
|
||||||
}
|
|
||||||
|
|
||||||
func setConfigDefaults(config *rest.Config) error {
|
|
||||||
gv := v1beta1.SchemeGroupVersion
|
|
||||||
config.GroupVersion = &gv
|
|
||||||
config.APIPath = "/apis"
|
|
||||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
|
||||||
|
|
||||||
if config.UserAgent == "" {
|
|
||||||
config.UserAgent = rest.DefaultKubernetesUserAgent()
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// RESTClient returns a RESTClient that is used to communicate
|
|
||||||
// with API server by this client implementation.
|
|
||||||
func (c *SnapshotV1beta1Client) RESTClient() rest.Interface {
|
|
||||||
if c == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return c.restClient
|
|
||||||
}
|
|
||||||
@@ -1,164 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2019 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by client-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package v1beta1
|
|
||||||
|
|
||||||
import (
|
|
||||||
"time"
|
|
||||||
|
|
||||||
v1beta1 "github.com/kubernetes-csi/external-snapshotter/v2/pkg/apis/volumesnapshot/v1beta1"
|
|
||||||
scheme "github.com/kubernetes-csi/external-snapshotter/v2/pkg/client/clientset/versioned/scheme"
|
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
|
||||||
watch "k8s.io/apimachinery/pkg/watch"
|
|
||||||
rest "k8s.io/client-go/rest"
|
|
||||||
)
|
|
||||||
|
|
||||||
// VolumeSnapshotClassesGetter has a method to return a VolumeSnapshotClassInterface.
|
|
||||||
// A group's client should implement this interface.
|
|
||||||
type VolumeSnapshotClassesGetter interface {
|
|
||||||
VolumeSnapshotClasses() VolumeSnapshotClassInterface
|
|
||||||
}
|
|
||||||
|
|
||||||
// VolumeSnapshotClassInterface has methods to work with VolumeSnapshotClass resources.
|
|
||||||
type VolumeSnapshotClassInterface interface {
|
|
||||||
Create(*v1beta1.VolumeSnapshotClass) (*v1beta1.VolumeSnapshotClass, error)
|
|
||||||
Update(*v1beta1.VolumeSnapshotClass) (*v1beta1.VolumeSnapshotClass, error)
|
|
||||||
Delete(name string, options *v1.DeleteOptions) error
|
|
||||||
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
|
|
||||||
Get(name string, options v1.GetOptions) (*v1beta1.VolumeSnapshotClass, error)
|
|
||||||
List(opts v1.ListOptions) (*v1beta1.VolumeSnapshotClassList, error)
|
|
||||||
Watch(opts v1.ListOptions) (watch.Interface, error)
|
|
||||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.VolumeSnapshotClass, err error)
|
|
||||||
VolumeSnapshotClassExpansion
|
|
||||||
}
|
|
||||||
|
|
||||||
// volumeSnapshotClasses implements VolumeSnapshotClassInterface
|
|
||||||
type volumeSnapshotClasses struct {
|
|
||||||
client rest.Interface
|
|
||||||
}
|
|
||||||
|
|
||||||
// newVolumeSnapshotClasses returns a VolumeSnapshotClasses
|
|
||||||
func newVolumeSnapshotClasses(c *SnapshotV1beta1Client) *volumeSnapshotClasses {
|
|
||||||
return &volumeSnapshotClasses{
|
|
||||||
client: c.RESTClient(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get takes name of the volumeSnapshotClass, and returns the corresponding volumeSnapshotClass object, and an error if there is any.
|
|
||||||
func (c *volumeSnapshotClasses) Get(name string, options v1.GetOptions) (result *v1beta1.VolumeSnapshotClass, err error) {
|
|
||||||
result = &v1beta1.VolumeSnapshotClass{}
|
|
||||||
err = c.client.Get().
|
|
||||||
Resource("volumesnapshotclasses").
|
|
||||||
Name(name).
|
|
||||||
VersionedParams(&options, scheme.ParameterCodec).
|
|
||||||
Do().
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// List takes label and field selectors, and returns the list of VolumeSnapshotClasses that match those selectors.
|
|
||||||
func (c *volumeSnapshotClasses) List(opts v1.ListOptions) (result *v1beta1.VolumeSnapshotClassList, err error) {
|
|
||||||
var timeout time.Duration
|
|
||||||
if opts.TimeoutSeconds != nil {
|
|
||||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
|
||||||
}
|
|
||||||
result = &v1beta1.VolumeSnapshotClassList{}
|
|
||||||
err = c.client.Get().
|
|
||||||
Resource("volumesnapshotclasses").
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Timeout(timeout).
|
|
||||||
Do().
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Watch returns a watch.Interface that watches the requested volumeSnapshotClasses.
|
|
||||||
func (c *volumeSnapshotClasses) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
|
||||||
var timeout time.Duration
|
|
||||||
if opts.TimeoutSeconds != nil {
|
|
||||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
|
||||||
}
|
|
||||||
opts.Watch = true
|
|
||||||
return c.client.Get().
|
|
||||||
Resource("volumesnapshotclasses").
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Timeout(timeout).
|
|
||||||
Watch()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create takes the representation of a volumeSnapshotClass and creates it. Returns the server's representation of the volumeSnapshotClass, and an error, if there is any.
|
|
||||||
func (c *volumeSnapshotClasses) Create(volumeSnapshotClass *v1beta1.VolumeSnapshotClass) (result *v1beta1.VolumeSnapshotClass, err error) {
|
|
||||||
result = &v1beta1.VolumeSnapshotClass{}
|
|
||||||
err = c.client.Post().
|
|
||||||
Resource("volumesnapshotclasses").
|
|
||||||
Body(volumeSnapshotClass).
|
|
||||||
Do().
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update takes the representation of a volumeSnapshotClass and updates it. Returns the server's representation of the volumeSnapshotClass, and an error, if there is any.
|
|
||||||
func (c *volumeSnapshotClasses) Update(volumeSnapshotClass *v1beta1.VolumeSnapshotClass) (result *v1beta1.VolumeSnapshotClass, err error) {
|
|
||||||
result = &v1beta1.VolumeSnapshotClass{}
|
|
||||||
err = c.client.Put().
|
|
||||||
Resource("volumesnapshotclasses").
|
|
||||||
Name(volumeSnapshotClass.Name).
|
|
||||||
Body(volumeSnapshotClass).
|
|
||||||
Do().
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete takes name of the volumeSnapshotClass and deletes it. Returns an error if one occurs.
|
|
||||||
func (c *volumeSnapshotClasses) Delete(name string, options *v1.DeleteOptions) error {
|
|
||||||
return c.client.Delete().
|
|
||||||
Resource("volumesnapshotclasses").
|
|
||||||
Name(name).
|
|
||||||
Body(options).
|
|
||||||
Do().
|
|
||||||
Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteCollection deletes a collection of objects.
|
|
||||||
func (c *volumeSnapshotClasses) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
|
||||||
var timeout time.Duration
|
|
||||||
if listOptions.TimeoutSeconds != nil {
|
|
||||||
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
|
|
||||||
}
|
|
||||||
return c.client.Delete().
|
|
||||||
Resource("volumesnapshotclasses").
|
|
||||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
|
||||||
Timeout(timeout).
|
|
||||||
Body(options).
|
|
||||||
Do().
|
|
||||||
Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Patch applies the patch and returns the patched volumeSnapshotClass.
|
|
||||||
func (c *volumeSnapshotClasses) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.VolumeSnapshotClass, err error) {
|
|
||||||
result = &v1beta1.VolumeSnapshotClass{}
|
|
||||||
err = c.client.Patch(pt).
|
|
||||||
Resource("volumesnapshotclasses").
|
|
||||||
SubResource(subresources...).
|
|
||||||
Name(name).
|
|
||||||
Body(data).
|
|
||||||
Do().
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
@@ -1,180 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2019 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by client-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package v1beta1
|
|
||||||
|
|
||||||
import (
|
|
||||||
"time"
|
|
||||||
|
|
||||||
v1beta1 "github.com/kubernetes-csi/external-snapshotter/v2/pkg/apis/volumesnapshot/v1beta1"
|
|
||||||
scheme "github.com/kubernetes-csi/external-snapshotter/v2/pkg/client/clientset/versioned/scheme"
|
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
|
||||||
watch "k8s.io/apimachinery/pkg/watch"
|
|
||||||
rest "k8s.io/client-go/rest"
|
|
||||||
)
|
|
||||||
|
|
||||||
// VolumeSnapshotContentsGetter has a method to return a VolumeSnapshotContentInterface.
|
|
||||||
// A group's client should implement this interface.
|
|
||||||
type VolumeSnapshotContentsGetter interface {
|
|
||||||
VolumeSnapshotContents() VolumeSnapshotContentInterface
|
|
||||||
}
|
|
||||||
|
|
||||||
// VolumeSnapshotContentInterface has methods to work with VolumeSnapshotContent resources.
|
|
||||||
type VolumeSnapshotContentInterface interface {
|
|
||||||
Create(*v1beta1.VolumeSnapshotContent) (*v1beta1.VolumeSnapshotContent, error)
|
|
||||||
Update(*v1beta1.VolumeSnapshotContent) (*v1beta1.VolumeSnapshotContent, error)
|
|
||||||
UpdateStatus(*v1beta1.VolumeSnapshotContent) (*v1beta1.VolumeSnapshotContent, error)
|
|
||||||
Delete(name string, options *v1.DeleteOptions) error
|
|
||||||
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
|
|
||||||
Get(name string, options v1.GetOptions) (*v1beta1.VolumeSnapshotContent, error)
|
|
||||||
List(opts v1.ListOptions) (*v1beta1.VolumeSnapshotContentList, error)
|
|
||||||
Watch(opts v1.ListOptions) (watch.Interface, error)
|
|
||||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.VolumeSnapshotContent, err error)
|
|
||||||
VolumeSnapshotContentExpansion
|
|
||||||
}
|
|
||||||
|
|
||||||
// volumeSnapshotContents implements VolumeSnapshotContentInterface
|
|
||||||
type volumeSnapshotContents struct {
|
|
||||||
client rest.Interface
|
|
||||||
}
|
|
||||||
|
|
||||||
// newVolumeSnapshotContents returns a VolumeSnapshotContents
|
|
||||||
func newVolumeSnapshotContents(c *SnapshotV1beta1Client) *volumeSnapshotContents {
|
|
||||||
return &volumeSnapshotContents{
|
|
||||||
client: c.RESTClient(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get takes name of the volumeSnapshotContent, and returns the corresponding volumeSnapshotContent object, and an error if there is any.
|
|
||||||
func (c *volumeSnapshotContents) Get(name string, options v1.GetOptions) (result *v1beta1.VolumeSnapshotContent, err error) {
|
|
||||||
result = &v1beta1.VolumeSnapshotContent{}
|
|
||||||
err = c.client.Get().
|
|
||||||
Resource("volumesnapshotcontents").
|
|
||||||
Name(name).
|
|
||||||
VersionedParams(&options, scheme.ParameterCodec).
|
|
||||||
Do().
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// List takes label and field selectors, and returns the list of VolumeSnapshotContents that match those selectors.
|
|
||||||
func (c *volumeSnapshotContents) List(opts v1.ListOptions) (result *v1beta1.VolumeSnapshotContentList, err error) {
|
|
||||||
var timeout time.Duration
|
|
||||||
if opts.TimeoutSeconds != nil {
|
|
||||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
|
||||||
}
|
|
||||||
result = &v1beta1.VolumeSnapshotContentList{}
|
|
||||||
err = c.client.Get().
|
|
||||||
Resource("volumesnapshotcontents").
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Timeout(timeout).
|
|
||||||
Do().
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Watch returns a watch.Interface that watches the requested volumeSnapshotContents.
|
|
||||||
func (c *volumeSnapshotContents) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
|
||||||
var timeout time.Duration
|
|
||||||
if opts.TimeoutSeconds != nil {
|
|
||||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
|
||||||
}
|
|
||||||
opts.Watch = true
|
|
||||||
return c.client.Get().
|
|
||||||
Resource("volumesnapshotcontents").
|
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
|
||||||
Timeout(timeout).
|
|
||||||
Watch()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create takes the representation of a volumeSnapshotContent and creates it. Returns the server's representation of the volumeSnapshotContent, and an error, if there is any.
|
|
||||||
func (c *volumeSnapshotContents) Create(volumeSnapshotContent *v1beta1.VolumeSnapshotContent) (result *v1beta1.VolumeSnapshotContent, err error) {
|
|
||||||
result = &v1beta1.VolumeSnapshotContent{}
|
|
||||||
err = c.client.Post().
|
|
||||||
Resource("volumesnapshotcontents").
|
|
||||||
Body(volumeSnapshotContent).
|
|
||||||
Do().
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update takes the representation of a volumeSnapshotContent and updates it. Returns the server's representation of the volumeSnapshotContent, and an error, if there is any.
|
|
||||||
func (c *volumeSnapshotContents) Update(volumeSnapshotContent *v1beta1.VolumeSnapshotContent) (result *v1beta1.VolumeSnapshotContent, err error) {
|
|
||||||
result = &v1beta1.VolumeSnapshotContent{}
|
|
||||||
err = c.client.Put().
|
|
||||||
Resource("volumesnapshotcontents").
|
|
||||||
Name(volumeSnapshotContent.Name).
|
|
||||||
Body(volumeSnapshotContent).
|
|
||||||
Do().
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpdateStatus was generated because the type contains a Status member.
|
|
||||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
|
||||||
|
|
||||||
func (c *volumeSnapshotContents) UpdateStatus(volumeSnapshotContent *v1beta1.VolumeSnapshotContent) (result *v1beta1.VolumeSnapshotContent, err error) {
|
|
||||||
result = &v1beta1.VolumeSnapshotContent{}
|
|
||||||
err = c.client.Put().
|
|
||||||
Resource("volumesnapshotcontents").
|
|
||||||
Name(volumeSnapshotContent.Name).
|
|
||||||
SubResource("status").
|
|
||||||
Body(volumeSnapshotContent).
|
|
||||||
Do().
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete takes name of the volumeSnapshotContent and deletes it. Returns an error if one occurs.
|
|
||||||
func (c *volumeSnapshotContents) Delete(name string, options *v1.DeleteOptions) error {
|
|
||||||
return c.client.Delete().
|
|
||||||
Resource("volumesnapshotcontents").
|
|
||||||
Name(name).
|
|
||||||
Body(options).
|
|
||||||
Do().
|
|
||||||
Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteCollection deletes a collection of objects.
|
|
||||||
func (c *volumeSnapshotContents) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
|
||||||
var timeout time.Duration
|
|
||||||
if listOptions.TimeoutSeconds != nil {
|
|
||||||
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
|
|
||||||
}
|
|
||||||
return c.client.Delete().
|
|
||||||
Resource("volumesnapshotcontents").
|
|
||||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
|
||||||
Timeout(timeout).
|
|
||||||
Body(options).
|
|
||||||
Do().
|
|
||||||
Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Patch applies the patch and returns the patched volumeSnapshotContent.
|
|
||||||
func (c *volumeSnapshotContents) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.VolumeSnapshotContent, err error) {
|
|
||||||
result = &v1beta1.VolumeSnapshotContent{}
|
|
||||||
err = c.client.Patch(pt).
|
|
||||||
Resource("volumesnapshotcontents").
|
|
||||||
SubResource(subresources...).
|
|
||||||
Name(name).
|
|
||||||
Body(data).
|
|
||||||
Do().
|
|
||||||
Into(result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
@@ -1,180 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2019 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by informer-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package externalversions
|
|
||||||
|
|
||||||
import (
|
|
||||||
reflect "reflect"
|
|
||||||
sync "sync"
|
|
||||||
time "time"
|
|
||||||
|
|
||||||
versioned "github.com/kubernetes-csi/external-snapshotter/v2/pkg/client/clientset/versioned"
|
|
||||||
internalinterfaces "github.com/kubernetes-csi/external-snapshotter/v2/pkg/client/informers/externalversions/internalinterfaces"
|
|
||||||
volumesnapshot "github.com/kubernetes-csi/external-snapshotter/v2/pkg/client/informers/externalversions/volumesnapshot"
|
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
|
||||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
|
||||||
cache "k8s.io/client-go/tools/cache"
|
|
||||||
)
|
|
||||||
|
|
||||||
// SharedInformerOption defines the functional option type for SharedInformerFactory.
|
|
||||||
type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory
|
|
||||||
|
|
||||||
type sharedInformerFactory struct {
|
|
||||||
client versioned.Interface
|
|
||||||
namespace string
|
|
||||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
|
||||||
lock sync.Mutex
|
|
||||||
defaultResync time.Duration
|
|
||||||
customResync map[reflect.Type]time.Duration
|
|
||||||
|
|
||||||
informers map[reflect.Type]cache.SharedIndexInformer
|
|
||||||
// startedInformers is used for tracking which informers have been started.
|
|
||||||
// This allows Start() to be called multiple times safely.
|
|
||||||
startedInformers map[reflect.Type]bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// WithCustomResyncConfig sets a custom resync period for the specified informer types.
|
|
||||||
func WithCustomResyncConfig(resyncConfig map[v1.Object]time.Duration) SharedInformerOption {
|
|
||||||
return func(factory *sharedInformerFactory) *sharedInformerFactory {
|
|
||||||
for k, v := range resyncConfig {
|
|
||||||
factory.customResync[reflect.TypeOf(k)] = v
|
|
||||||
}
|
|
||||||
return factory
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// WithTweakListOptions sets a custom filter on all listers of the configured SharedInformerFactory.
|
|
||||||
func WithTweakListOptions(tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerOption {
|
|
||||||
return func(factory *sharedInformerFactory) *sharedInformerFactory {
|
|
||||||
factory.tweakListOptions = tweakListOptions
|
|
||||||
return factory
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// WithNamespace limits the SharedInformerFactory to the specified namespace.
|
|
||||||
func WithNamespace(namespace string) SharedInformerOption {
|
|
||||||
return func(factory *sharedInformerFactory) *sharedInformerFactory {
|
|
||||||
factory.namespace = namespace
|
|
||||||
return factory
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces.
|
|
||||||
func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory {
|
|
||||||
return NewSharedInformerFactoryWithOptions(client, defaultResync)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewFilteredSharedInformerFactory constructs a new instance of sharedInformerFactory.
|
|
||||||
// Listers obtained via this SharedInformerFactory will be subject to the same filters
|
|
||||||
// as specified here.
|
|
||||||
// Deprecated: Please use NewSharedInformerFactoryWithOptions instead
|
|
||||||
func NewFilteredSharedInformerFactory(client versioned.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerFactory {
|
|
||||||
return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions))
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options.
|
|
||||||
func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory {
|
|
||||||
factory := &sharedInformerFactory{
|
|
||||||
client: client,
|
|
||||||
namespace: v1.NamespaceAll,
|
|
||||||
defaultResync: defaultResync,
|
|
||||||
informers: make(map[reflect.Type]cache.SharedIndexInformer),
|
|
||||||
startedInformers: make(map[reflect.Type]bool),
|
|
||||||
customResync: make(map[reflect.Type]time.Duration),
|
|
||||||
}
|
|
||||||
|
|
||||||
// Apply all options
|
|
||||||
for _, opt := range options {
|
|
||||||
factory = opt(factory)
|
|
||||||
}
|
|
||||||
|
|
||||||
return factory
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start initializes all requested informers.
|
|
||||||
func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) {
|
|
||||||
f.lock.Lock()
|
|
||||||
defer f.lock.Unlock()
|
|
||||||
|
|
||||||
for informerType, informer := range f.informers {
|
|
||||||
if !f.startedInformers[informerType] {
|
|
||||||
go informer.Run(stopCh)
|
|
||||||
f.startedInformers[informerType] = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// WaitForCacheSync waits for all started informers' cache were synced.
|
|
||||||
func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool {
|
|
||||||
informers := func() map[reflect.Type]cache.SharedIndexInformer {
|
|
||||||
f.lock.Lock()
|
|
||||||
defer f.lock.Unlock()
|
|
||||||
|
|
||||||
informers := map[reflect.Type]cache.SharedIndexInformer{}
|
|
||||||
for informerType, informer := range f.informers {
|
|
||||||
if f.startedInformers[informerType] {
|
|
||||||
informers[informerType] = informer
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return informers
|
|
||||||
}()
|
|
||||||
|
|
||||||
res := map[reflect.Type]bool{}
|
|
||||||
for informType, informer := range informers {
|
|
||||||
res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced)
|
|
||||||
}
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
|
|
||||||
// InternalInformerFor returns the SharedIndexInformer for obj using an internal
|
|
||||||
// client.
|
|
||||||
func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer {
|
|
||||||
f.lock.Lock()
|
|
||||||
defer f.lock.Unlock()
|
|
||||||
|
|
||||||
informerType := reflect.TypeOf(obj)
|
|
||||||
informer, exists := f.informers[informerType]
|
|
||||||
if exists {
|
|
||||||
return informer
|
|
||||||
}
|
|
||||||
|
|
||||||
resyncPeriod, exists := f.customResync[informerType]
|
|
||||||
if !exists {
|
|
||||||
resyncPeriod = f.defaultResync
|
|
||||||
}
|
|
||||||
|
|
||||||
informer = newFunc(f.client, resyncPeriod)
|
|
||||||
f.informers[informerType] = informer
|
|
||||||
|
|
||||||
return informer
|
|
||||||
}
|
|
||||||
|
|
||||||
// SharedInformerFactory provides shared informers for resources in all known
|
|
||||||
// API group versions.
|
|
||||||
type SharedInformerFactory interface {
|
|
||||||
internalinterfaces.SharedInformerFactory
|
|
||||||
ForResource(resource schema.GroupVersionResource) (GenericInformer, error)
|
|
||||||
WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool
|
|
||||||
|
|
||||||
Snapshot() volumesnapshot.Interface
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *sharedInformerFactory) Snapshot() volumesnapshot.Interface {
|
|
||||||
return volumesnapshot.New(f, f.namespace, f.tweakListOptions)
|
|
||||||
}
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2019 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by informer-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package externalversions
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
v1beta1 "github.com/kubernetes-csi/external-snapshotter/v2/pkg/apis/volumesnapshot/v1beta1"
|
|
||||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
|
||||||
cache "k8s.io/client-go/tools/cache"
|
|
||||||
)
|
|
||||||
|
|
||||||
// GenericInformer is type of SharedIndexInformer which will locate and delegate to other
|
|
||||||
// sharedInformers based on type
|
|
||||||
type GenericInformer interface {
|
|
||||||
Informer() cache.SharedIndexInformer
|
|
||||||
Lister() cache.GenericLister
|
|
||||||
}
|
|
||||||
|
|
||||||
type genericInformer struct {
|
|
||||||
informer cache.SharedIndexInformer
|
|
||||||
resource schema.GroupResource
|
|
||||||
}
|
|
||||||
|
|
||||||
// Informer returns the SharedIndexInformer.
|
|
||||||
func (f *genericInformer) Informer() cache.SharedIndexInformer {
|
|
||||||
return f.informer
|
|
||||||
}
|
|
||||||
|
|
||||||
// Lister returns the GenericLister.
|
|
||||||
func (f *genericInformer) Lister() cache.GenericLister {
|
|
||||||
return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ForResource gives generic access to a shared informer of the matching type
|
|
||||||
// TODO extend this to unknown resources with a client pool
|
|
||||||
func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) {
|
|
||||||
switch resource {
|
|
||||||
// Group=snapshot.storage.k8s.io, Version=v1beta1
|
|
||||||
case v1beta1.SchemeGroupVersion.WithResource("volumesnapshots"):
|
|
||||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Snapshot().V1beta1().VolumeSnapshots().Informer()}, nil
|
|
||||||
case v1beta1.SchemeGroupVersion.WithResource("volumesnapshotclasses"):
|
|
||||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Snapshot().V1beta1().VolumeSnapshotClasses().Informer()}, nil
|
|
||||||
case v1beta1.SchemeGroupVersion.WithResource("volumesnapshotcontents"):
|
|
||||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Snapshot().V1beta1().VolumeSnapshotContents().Informer()}, nil
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, fmt.Errorf("no informer found for %v", resource)
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2019 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by informer-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package internalinterfaces
|
|
||||||
|
|
||||||
import (
|
|
||||||
time "time"
|
|
||||||
|
|
||||||
versioned "github.com/kubernetes-csi/external-snapshotter/v2/pkg/client/clientset/versioned"
|
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
|
||||||
cache "k8s.io/client-go/tools/cache"
|
|
||||||
)
|
|
||||||
|
|
||||||
// NewInformerFunc takes versioned.Interface and time.Duration to return a SharedIndexInformer.
|
|
||||||
type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer
|
|
||||||
|
|
||||||
// SharedInformerFactory a small interface to allow for adding an informer without an import cycle
|
|
||||||
type SharedInformerFactory interface {
|
|
||||||
Start(stopCh <-chan struct{})
|
|
||||||
InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer
|
|
||||||
}
|
|
||||||
|
|
||||||
// TweakListOptionsFunc is a function that transforms a v1.ListOptions.
|
|
||||||
type TweakListOptionsFunc func(*v1.ListOptions)
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2019 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by informer-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package volumesnapshot
|
|
||||||
|
|
||||||
import (
|
|
||||||
internalinterfaces "github.com/kubernetes-csi/external-snapshotter/v2/pkg/client/informers/externalversions/internalinterfaces"
|
|
||||||
v1beta1 "github.com/kubernetes-csi/external-snapshotter/v2/pkg/client/informers/externalversions/volumesnapshot/v1beta1"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Interface provides access to each of this group's versions.
|
|
||||||
type Interface interface {
|
|
||||||
// V1beta1 provides access to shared informers for resources in V1beta1.
|
|
||||||
V1beta1() v1beta1.Interface
|
|
||||||
}
|
|
||||||
|
|
||||||
type group struct {
|
|
||||||
factory internalinterfaces.SharedInformerFactory
|
|
||||||
namespace string
|
|
||||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
|
||||||
}
|
|
||||||
|
|
||||||
// New returns a new Interface.
|
|
||||||
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
|
|
||||||
return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
|
|
||||||
}
|
|
||||||
|
|
||||||
// V1beta1 returns a new v1beta1.Interface.
|
|
||||||
func (g *group) V1beta1() v1beta1.Interface {
|
|
||||||
return v1beta1.New(g.factory, g.namespace, g.tweakListOptions)
|
|
||||||
}
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2019 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by informer-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package v1beta1
|
|
||||||
|
|
||||||
import (
|
|
||||||
internalinterfaces "github.com/kubernetes-csi/external-snapshotter/v2/pkg/client/informers/externalversions/internalinterfaces"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Interface provides access to all the informers in this group version.
|
|
||||||
type Interface interface {
|
|
||||||
// VolumeSnapshots returns a VolumeSnapshotInformer.
|
|
||||||
VolumeSnapshots() VolumeSnapshotInformer
|
|
||||||
// VolumeSnapshotClasses returns a VolumeSnapshotClassInformer.
|
|
||||||
VolumeSnapshotClasses() VolumeSnapshotClassInformer
|
|
||||||
// VolumeSnapshotContents returns a VolumeSnapshotContentInformer.
|
|
||||||
VolumeSnapshotContents() VolumeSnapshotContentInformer
|
|
||||||
}
|
|
||||||
|
|
||||||
type version struct {
|
|
||||||
factory internalinterfaces.SharedInformerFactory
|
|
||||||
namespace string
|
|
||||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
|
||||||
}
|
|
||||||
|
|
||||||
// New returns a new Interface.
|
|
||||||
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
|
|
||||||
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
|
|
||||||
}
|
|
||||||
|
|
||||||
// VolumeSnapshots returns a VolumeSnapshotInformer.
|
|
||||||
func (v *version) VolumeSnapshots() VolumeSnapshotInformer {
|
|
||||||
return &volumeSnapshotInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
|
||||||
}
|
|
||||||
|
|
||||||
// VolumeSnapshotClasses returns a VolumeSnapshotClassInformer.
|
|
||||||
func (v *version) VolumeSnapshotClasses() VolumeSnapshotClassInformer {
|
|
||||||
return &volumeSnapshotClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
|
|
||||||
}
|
|
||||||
|
|
||||||
// VolumeSnapshotContents returns a VolumeSnapshotContentInformer.
|
|
||||||
func (v *version) VolumeSnapshotContents() VolumeSnapshotContentInformer {
|
|
||||||
return &volumeSnapshotContentInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
|
|
||||||
}
|
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2019 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by informer-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package v1beta1
|
|
||||||
|
|
||||||
import (
|
|
||||||
time "time"
|
|
||||||
|
|
||||||
volumesnapshotv1beta1 "github.com/kubernetes-csi/external-snapshotter/v2/pkg/apis/volumesnapshot/v1beta1"
|
|
||||||
versioned "github.com/kubernetes-csi/external-snapshotter/v2/pkg/client/clientset/versioned"
|
|
||||||
internalinterfaces "github.com/kubernetes-csi/external-snapshotter/v2/pkg/client/informers/externalversions/internalinterfaces"
|
|
||||||
v1beta1 "github.com/kubernetes-csi/external-snapshotter/v2/pkg/client/listers/volumesnapshot/v1beta1"
|
|
||||||
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"
|
|
||||||
)
|
|
||||||
|
|
||||||
// VolumeSnapshotInformer provides access to a shared informer and lister for
|
|
||||||
// VolumeSnapshots.
|
|
||||||
type VolumeSnapshotInformer interface {
|
|
||||||
Informer() cache.SharedIndexInformer
|
|
||||||
Lister() v1beta1.VolumeSnapshotLister
|
|
||||||
}
|
|
||||||
|
|
||||||
type volumeSnapshotInformer struct {
|
|
||||||
factory internalinterfaces.SharedInformerFactory
|
|
||||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
|
||||||
namespace string
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewVolumeSnapshotInformer constructs a new informer for VolumeSnapshot 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 NewVolumeSnapshotInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
|
||||||
return NewFilteredVolumeSnapshotInformer(client, namespace, resyncPeriod, indexers, nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewFilteredVolumeSnapshotInformer constructs a new informer for VolumeSnapshot 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 NewFilteredVolumeSnapshotInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
|
||||||
return cache.NewSharedIndexInformer(
|
|
||||||
&cache.ListWatch{
|
|
||||||
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
|
||||||
if tweakListOptions != nil {
|
|
||||||
tweakListOptions(&options)
|
|
||||||
}
|
|
||||||
return client.SnapshotV1beta1().VolumeSnapshots(namespace).List(options)
|
|
||||||
},
|
|
||||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
|
||||||
if tweakListOptions != nil {
|
|
||||||
tweakListOptions(&options)
|
|
||||||
}
|
|
||||||
return client.SnapshotV1beta1().VolumeSnapshots(namespace).Watch(options)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
&volumesnapshotv1beta1.VolumeSnapshot{},
|
|
||||||
resyncPeriod,
|
|
||||||
indexers,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *volumeSnapshotInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
|
||||||
return NewFilteredVolumeSnapshotInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *volumeSnapshotInformer) Informer() cache.SharedIndexInformer {
|
|
||||||
return f.factory.InformerFor(&volumesnapshotv1beta1.VolumeSnapshot{}, f.defaultInformer)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *volumeSnapshotInformer) Lister() v1beta1.VolumeSnapshotLister {
|
|
||||||
return v1beta1.NewVolumeSnapshotLister(f.Informer().GetIndexer())
|
|
||||||
}
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2019 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by informer-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package v1beta1
|
|
||||||
|
|
||||||
import (
|
|
||||||
time "time"
|
|
||||||
|
|
||||||
volumesnapshotv1beta1 "github.com/kubernetes-csi/external-snapshotter/v2/pkg/apis/volumesnapshot/v1beta1"
|
|
||||||
versioned "github.com/kubernetes-csi/external-snapshotter/v2/pkg/client/clientset/versioned"
|
|
||||||
internalinterfaces "github.com/kubernetes-csi/external-snapshotter/v2/pkg/client/informers/externalversions/internalinterfaces"
|
|
||||||
v1beta1 "github.com/kubernetes-csi/external-snapshotter/v2/pkg/client/listers/volumesnapshot/v1beta1"
|
|
||||||
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"
|
|
||||||
)
|
|
||||||
|
|
||||||
// VolumeSnapshotClassInformer provides access to a shared informer and lister for
|
|
||||||
// VolumeSnapshotClasses.
|
|
||||||
type VolumeSnapshotClassInformer interface {
|
|
||||||
Informer() cache.SharedIndexInformer
|
|
||||||
Lister() v1beta1.VolumeSnapshotClassLister
|
|
||||||
}
|
|
||||||
|
|
||||||
type volumeSnapshotClassInformer struct {
|
|
||||||
factory internalinterfaces.SharedInformerFactory
|
|
||||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewVolumeSnapshotClassInformer constructs a new informer for VolumeSnapshotClass 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 NewVolumeSnapshotClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
|
||||||
return NewFilteredVolumeSnapshotClassInformer(client, resyncPeriod, indexers, nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewFilteredVolumeSnapshotClassInformer constructs a new informer for VolumeSnapshotClass 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 NewFilteredVolumeSnapshotClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
|
||||||
return cache.NewSharedIndexInformer(
|
|
||||||
&cache.ListWatch{
|
|
||||||
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
|
||||||
if tweakListOptions != nil {
|
|
||||||
tweakListOptions(&options)
|
|
||||||
}
|
|
||||||
return client.SnapshotV1beta1().VolumeSnapshotClasses().List(options)
|
|
||||||
},
|
|
||||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
|
||||||
if tweakListOptions != nil {
|
|
||||||
tweakListOptions(&options)
|
|
||||||
}
|
|
||||||
return client.SnapshotV1beta1().VolumeSnapshotClasses().Watch(options)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
&volumesnapshotv1beta1.VolumeSnapshotClass{},
|
|
||||||
resyncPeriod,
|
|
||||||
indexers,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *volumeSnapshotClassInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
|
||||||
return NewFilteredVolumeSnapshotClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *volumeSnapshotClassInformer) Informer() cache.SharedIndexInformer {
|
|
||||||
return f.factory.InformerFor(&volumesnapshotv1beta1.VolumeSnapshotClass{}, f.defaultInformer)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *volumeSnapshotClassInformer) Lister() v1beta1.VolumeSnapshotClassLister {
|
|
||||||
return v1beta1.NewVolumeSnapshotClassLister(f.Informer().GetIndexer())
|
|
||||||
}
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2019 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by informer-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package v1beta1
|
|
||||||
|
|
||||||
import (
|
|
||||||
time "time"
|
|
||||||
|
|
||||||
volumesnapshotv1beta1 "github.com/kubernetes-csi/external-snapshotter/v2/pkg/apis/volumesnapshot/v1beta1"
|
|
||||||
versioned "github.com/kubernetes-csi/external-snapshotter/v2/pkg/client/clientset/versioned"
|
|
||||||
internalinterfaces "github.com/kubernetes-csi/external-snapshotter/v2/pkg/client/informers/externalversions/internalinterfaces"
|
|
||||||
v1beta1 "github.com/kubernetes-csi/external-snapshotter/v2/pkg/client/listers/volumesnapshot/v1beta1"
|
|
||||||
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"
|
|
||||||
)
|
|
||||||
|
|
||||||
// VolumeSnapshotContentInformer provides access to a shared informer and lister for
|
|
||||||
// VolumeSnapshotContents.
|
|
||||||
type VolumeSnapshotContentInformer interface {
|
|
||||||
Informer() cache.SharedIndexInformer
|
|
||||||
Lister() v1beta1.VolumeSnapshotContentLister
|
|
||||||
}
|
|
||||||
|
|
||||||
type volumeSnapshotContentInformer struct {
|
|
||||||
factory internalinterfaces.SharedInformerFactory
|
|
||||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewVolumeSnapshotContentInformer constructs a new informer for VolumeSnapshotContent 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 NewVolumeSnapshotContentInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
|
||||||
return NewFilteredVolumeSnapshotContentInformer(client, resyncPeriod, indexers, nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewFilteredVolumeSnapshotContentInformer constructs a new informer for VolumeSnapshotContent 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 NewFilteredVolumeSnapshotContentInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
|
||||||
return cache.NewSharedIndexInformer(
|
|
||||||
&cache.ListWatch{
|
|
||||||
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
|
||||||
if tweakListOptions != nil {
|
|
||||||
tweakListOptions(&options)
|
|
||||||
}
|
|
||||||
return client.SnapshotV1beta1().VolumeSnapshotContents().List(options)
|
|
||||||
},
|
|
||||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
|
||||||
if tweakListOptions != nil {
|
|
||||||
tweakListOptions(&options)
|
|
||||||
}
|
|
||||||
return client.SnapshotV1beta1().VolumeSnapshotContents().Watch(options)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
&volumesnapshotv1beta1.VolumeSnapshotContent{},
|
|
||||||
resyncPeriod,
|
|
||||||
indexers,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *volumeSnapshotContentInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
|
||||||
return NewFilteredVolumeSnapshotContentInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *volumeSnapshotContentInformer) Informer() cache.SharedIndexInformer {
|
|
||||||
return f.factory.InformerFor(&volumesnapshotv1beta1.VolumeSnapshotContent{}, f.defaultInformer)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *volumeSnapshotContentInformer) Lister() v1beta1.VolumeSnapshotContentLister {
|
|
||||||
return v1beta1.NewVolumeSnapshotContentLister(f.Informer().GetIndexer())
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2019 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by lister-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package v1beta1
|
|
||||||
|
|
||||||
// VolumeSnapshotListerExpansion allows custom methods to be added to
|
|
||||||
// VolumeSnapshotLister.
|
|
||||||
type VolumeSnapshotListerExpansion interface{}
|
|
||||||
|
|
||||||
// VolumeSnapshotNamespaceListerExpansion allows custom methods to be added to
|
|
||||||
// VolumeSnapshotNamespaceLister.
|
|
||||||
type VolumeSnapshotNamespaceListerExpansion interface{}
|
|
||||||
|
|
||||||
// VolumeSnapshotClassListerExpansion allows custom methods to be added to
|
|
||||||
// VolumeSnapshotClassLister.
|
|
||||||
type VolumeSnapshotClassListerExpansion interface{}
|
|
||||||
|
|
||||||
// VolumeSnapshotContentListerExpansion allows custom methods to be added to
|
|
||||||
// VolumeSnapshotContentLister.
|
|
||||||
type VolumeSnapshotContentListerExpansion interface{}
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2019 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by lister-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package v1beta1
|
|
||||||
|
|
||||||
import (
|
|
||||||
v1beta1 "github.com/kubernetes-csi/external-snapshotter/v2/pkg/apis/volumesnapshot/v1beta1"
|
|
||||||
"k8s.io/apimachinery/pkg/api/errors"
|
|
||||||
"k8s.io/apimachinery/pkg/labels"
|
|
||||||
"k8s.io/client-go/tools/cache"
|
|
||||||
)
|
|
||||||
|
|
||||||
// VolumeSnapshotLister helps list VolumeSnapshots.
|
|
||||||
type VolumeSnapshotLister interface {
|
|
||||||
// List lists all VolumeSnapshots in the indexer.
|
|
||||||
List(selector labels.Selector) (ret []*v1beta1.VolumeSnapshot, err error)
|
|
||||||
// VolumeSnapshots returns an object that can list and get VolumeSnapshots.
|
|
||||||
VolumeSnapshots(namespace string) VolumeSnapshotNamespaceLister
|
|
||||||
VolumeSnapshotListerExpansion
|
|
||||||
}
|
|
||||||
|
|
||||||
// volumeSnapshotLister implements the VolumeSnapshotLister interface.
|
|
||||||
type volumeSnapshotLister struct {
|
|
||||||
indexer cache.Indexer
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewVolumeSnapshotLister returns a new VolumeSnapshotLister.
|
|
||||||
func NewVolumeSnapshotLister(indexer cache.Indexer) VolumeSnapshotLister {
|
|
||||||
return &volumeSnapshotLister{indexer: indexer}
|
|
||||||
}
|
|
||||||
|
|
||||||
// List lists all VolumeSnapshots in the indexer.
|
|
||||||
func (s *volumeSnapshotLister) List(selector labels.Selector) (ret []*v1beta1.VolumeSnapshot, err error) {
|
|
||||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
|
||||||
ret = append(ret, m.(*v1beta1.VolumeSnapshot))
|
|
||||||
})
|
|
||||||
return ret, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// VolumeSnapshots returns an object that can list and get VolumeSnapshots.
|
|
||||||
func (s *volumeSnapshotLister) VolumeSnapshots(namespace string) VolumeSnapshotNamespaceLister {
|
|
||||||
return volumeSnapshotNamespaceLister{indexer: s.indexer, namespace: namespace}
|
|
||||||
}
|
|
||||||
|
|
||||||
// VolumeSnapshotNamespaceLister helps list and get VolumeSnapshots.
|
|
||||||
type VolumeSnapshotNamespaceLister interface {
|
|
||||||
// List lists all VolumeSnapshots in the indexer for a given namespace.
|
|
||||||
List(selector labels.Selector) (ret []*v1beta1.VolumeSnapshot, err error)
|
|
||||||
// Get retrieves the VolumeSnapshot from the indexer for a given namespace and name.
|
|
||||||
Get(name string) (*v1beta1.VolumeSnapshot, error)
|
|
||||||
VolumeSnapshotNamespaceListerExpansion
|
|
||||||
}
|
|
||||||
|
|
||||||
// volumeSnapshotNamespaceLister implements the VolumeSnapshotNamespaceLister
|
|
||||||
// interface.
|
|
||||||
type volumeSnapshotNamespaceLister struct {
|
|
||||||
indexer cache.Indexer
|
|
||||||
namespace string
|
|
||||||
}
|
|
||||||
|
|
||||||
// List lists all VolumeSnapshots in the indexer for a given namespace.
|
|
||||||
func (s volumeSnapshotNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.VolumeSnapshot, err error) {
|
|
||||||
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
|
|
||||||
ret = append(ret, m.(*v1beta1.VolumeSnapshot))
|
|
||||||
})
|
|
||||||
return ret, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get retrieves the VolumeSnapshot from the indexer for a given namespace and name.
|
|
||||||
func (s volumeSnapshotNamespaceLister) Get(name string) (*v1beta1.VolumeSnapshot, error) {
|
|
||||||
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if !exists {
|
|
||||||
return nil, errors.NewNotFound(v1beta1.Resource("volumesnapshot"), name)
|
|
||||||
}
|
|
||||||
return obj.(*v1beta1.VolumeSnapshot), nil
|
|
||||||
}
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2019 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by lister-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package v1beta1
|
|
||||||
|
|
||||||
import (
|
|
||||||
v1beta1 "github.com/kubernetes-csi/external-snapshotter/v2/pkg/apis/volumesnapshot/v1beta1"
|
|
||||||
"k8s.io/apimachinery/pkg/api/errors"
|
|
||||||
"k8s.io/apimachinery/pkg/labels"
|
|
||||||
"k8s.io/client-go/tools/cache"
|
|
||||||
)
|
|
||||||
|
|
||||||
// VolumeSnapshotClassLister helps list VolumeSnapshotClasses.
|
|
||||||
type VolumeSnapshotClassLister interface {
|
|
||||||
// List lists all VolumeSnapshotClasses in the indexer.
|
|
||||||
List(selector labels.Selector) (ret []*v1beta1.VolumeSnapshotClass, err error)
|
|
||||||
// Get retrieves the VolumeSnapshotClass from the index for a given name.
|
|
||||||
Get(name string) (*v1beta1.VolumeSnapshotClass, error)
|
|
||||||
VolumeSnapshotClassListerExpansion
|
|
||||||
}
|
|
||||||
|
|
||||||
// volumeSnapshotClassLister implements the VolumeSnapshotClassLister interface.
|
|
||||||
type volumeSnapshotClassLister struct {
|
|
||||||
indexer cache.Indexer
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewVolumeSnapshotClassLister returns a new VolumeSnapshotClassLister.
|
|
||||||
func NewVolumeSnapshotClassLister(indexer cache.Indexer) VolumeSnapshotClassLister {
|
|
||||||
return &volumeSnapshotClassLister{indexer: indexer}
|
|
||||||
}
|
|
||||||
|
|
||||||
// List lists all VolumeSnapshotClasses in the indexer.
|
|
||||||
func (s *volumeSnapshotClassLister) List(selector labels.Selector) (ret []*v1beta1.VolumeSnapshotClass, err error) {
|
|
||||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
|
||||||
ret = append(ret, m.(*v1beta1.VolumeSnapshotClass))
|
|
||||||
})
|
|
||||||
return ret, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get retrieves the VolumeSnapshotClass from the index for a given name.
|
|
||||||
func (s *volumeSnapshotClassLister) Get(name string) (*v1beta1.VolumeSnapshotClass, error) {
|
|
||||||
obj, exists, err := s.indexer.GetByKey(name)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if !exists {
|
|
||||||
return nil, errors.NewNotFound(v1beta1.Resource("volumesnapshotclass"), name)
|
|
||||||
}
|
|
||||||
return obj.(*v1beta1.VolumeSnapshotClass), nil
|
|
||||||
}
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2019 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by lister-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package v1beta1
|
|
||||||
|
|
||||||
import (
|
|
||||||
v1beta1 "github.com/kubernetes-csi/external-snapshotter/v2/pkg/apis/volumesnapshot/v1beta1"
|
|
||||||
"k8s.io/apimachinery/pkg/api/errors"
|
|
||||||
"k8s.io/apimachinery/pkg/labels"
|
|
||||||
"k8s.io/client-go/tools/cache"
|
|
||||||
)
|
|
||||||
|
|
||||||
// VolumeSnapshotContentLister helps list VolumeSnapshotContents.
|
|
||||||
type VolumeSnapshotContentLister interface {
|
|
||||||
// List lists all VolumeSnapshotContents in the indexer.
|
|
||||||
List(selector labels.Selector) (ret []*v1beta1.VolumeSnapshotContent, err error)
|
|
||||||
// Get retrieves the VolumeSnapshotContent from the index for a given name.
|
|
||||||
Get(name string) (*v1beta1.VolumeSnapshotContent, error)
|
|
||||||
VolumeSnapshotContentListerExpansion
|
|
||||||
}
|
|
||||||
|
|
||||||
// volumeSnapshotContentLister implements the VolumeSnapshotContentLister interface.
|
|
||||||
type volumeSnapshotContentLister struct {
|
|
||||||
indexer cache.Indexer
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewVolumeSnapshotContentLister returns a new VolumeSnapshotContentLister.
|
|
||||||
func NewVolumeSnapshotContentLister(indexer cache.Indexer) VolumeSnapshotContentLister {
|
|
||||||
return &volumeSnapshotContentLister{indexer: indexer}
|
|
||||||
}
|
|
||||||
|
|
||||||
// List lists all VolumeSnapshotContents in the indexer.
|
|
||||||
func (s *volumeSnapshotContentLister) List(selector labels.Selector) (ret []*v1beta1.VolumeSnapshotContent, err error) {
|
|
||||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
|
||||||
ret = append(ret, m.(*v1beta1.VolumeSnapshotContent))
|
|
||||||
})
|
|
||||||
return ret, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get retrieves the VolumeSnapshotContent from the index for a given name.
|
|
||||||
func (s *volumeSnapshotContentLister) Get(name string) (*v1beta1.VolumeSnapshotContent, error) {
|
|
||||||
obj, exists, err := s.indexer.GetByKey(name)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if !exists {
|
|
||||||
return nil, errors.NewNotFound(v1beta1.Resource("volumesnapshotcontent"), name)
|
|
||||||
}
|
|
||||||
return obj.(*v1beta1.VolumeSnapshotContent), nil
|
|
||||||
}
|
|
||||||
10
vendor/modules.txt
vendored
10
vendor/modules.txt
vendored
@@ -337,16 +337,6 @@ github.com/kubernetes-csi/external-snapshotter/client/v3/informers/externalversi
|
|||||||
github.com/kubernetes-csi/external-snapshotter/client/v3/informers/externalversions/volumesnapshot
|
github.com/kubernetes-csi/external-snapshotter/client/v3/informers/externalversions/volumesnapshot
|
||||||
github.com/kubernetes-csi/external-snapshotter/client/v3/informers/externalversions/volumesnapshot/v1beta1
|
github.com/kubernetes-csi/external-snapshotter/client/v3/informers/externalversions/volumesnapshot/v1beta1
|
||||||
github.com/kubernetes-csi/external-snapshotter/client/v3/listers/volumesnapshot/v1beta1
|
github.com/kubernetes-csi/external-snapshotter/client/v3/listers/volumesnapshot/v1beta1
|
||||||
# github.com/kubernetes-csi/external-snapshotter/v2 v2.1.3
|
|
||||||
github.com/kubernetes-csi/external-snapshotter/v2/pkg/apis/volumesnapshot/v1beta1
|
|
||||||
github.com/kubernetes-csi/external-snapshotter/v2/pkg/client/clientset/versioned
|
|
||||||
github.com/kubernetes-csi/external-snapshotter/v2/pkg/client/clientset/versioned/scheme
|
|
||||||
github.com/kubernetes-csi/external-snapshotter/v2/pkg/client/clientset/versioned/typed/volumesnapshot/v1beta1
|
|
||||||
github.com/kubernetes-csi/external-snapshotter/v2/pkg/client/informers/externalversions
|
|
||||||
github.com/kubernetes-csi/external-snapshotter/v2/pkg/client/informers/externalversions/internalinterfaces
|
|
||||||
github.com/kubernetes-csi/external-snapshotter/v2/pkg/client/informers/externalversions/volumesnapshot
|
|
||||||
github.com/kubernetes-csi/external-snapshotter/v2/pkg/client/informers/externalversions/volumesnapshot/v1beta1
|
|
||||||
github.com/kubernetes-csi/external-snapshotter/v2/pkg/client/listers/volumesnapshot/v1beta1
|
|
||||||
# github.com/kubesphere/sonargo v0.0.2 => github.com/kubesphere/sonargo v0.0.2
|
# github.com/kubesphere/sonargo v0.0.2 => github.com/kubesphere/sonargo v0.0.2
|
||||||
github.com/kubesphere/sonargo/sonar
|
github.com/kubesphere/sonargo/sonar
|
||||||
# github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de => github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de
|
# github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de => github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de
|
||||||
|
|||||||
Reference in New Issue
Block a user