mirror of
https://github.com/weaveworks/scope.git
synced 2026-08-23 22:36:24 +00:00
Merge pull request #3355 from openebs/volume-snapshot
Add volume snapshot and clone support
This commit is contained in:
+10
-1
@@ -10,6 +10,7 @@ import (
|
||||
"time"
|
||||
|
||||
"context"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
@@ -55,6 +56,14 @@ var (
|
||||
{Value: "hide", Label: "Hide storage", filter: render.IsPodComponent, filterPseudo: false},
|
||||
},
|
||||
}
|
||||
snapshotFilter = APITopologyOptionGroup{
|
||||
ID: "snapshot",
|
||||
Default: "hide",
|
||||
Options: []APITopologyOption{
|
||||
{Value: "show", Label: "Show snapshots", filter: nil, filterPseudo: false},
|
||||
{Value: "hide", Label: "Hide snapshots", filter: render.IsNonSnapshotComponent, filterPseudo: false},
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
// namespaceFilters generates a namespace selector option group based on the given namespaces
|
||||
@@ -237,7 +246,7 @@ func MakeRegistry() *Registry {
|
||||
renderer: render.PodRenderer,
|
||||
Name: "Pods",
|
||||
Rank: 3,
|
||||
Options: []APITopologyOptionGroup{storageFilter, unmanagedFilter},
|
||||
Options: []APITopologyOptionGroup{snapshotFilter, storageFilter, unmanagedFilter},
|
||||
HideIfEmpty: true,
|
||||
},
|
||||
APITopologyDesc{
|
||||
|
||||
@@ -6,10 +6,8 @@ import { enterEdge, leaveEdge } from '../actions/app-actions';
|
||||
import { encodeIdAttribute, decodeIdAttribute } from '../utils/dom-utils';
|
||||
|
||||
function isStorageComponent(id) {
|
||||
if (id === '<persistent_volume>' || id === '<storage_class>' || id === '<persistent_volume_claim>') {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
const storageComponents = ['<persistent_volume>', '<storage_class>', '<persistent_volume_claim>', '<volume_snapshot>', '<volume_snapshot_data>'];
|
||||
return storageComponents.includes(id);
|
||||
}
|
||||
|
||||
// getAdjacencyClass takes id which contains information about edge as a topology
|
||||
|
||||
@@ -60,6 +60,7 @@ class NodeContainer extends React.Component {
|
||||
<GraphNode
|
||||
id={this.props.id}
|
||||
shape={this.props.shape}
|
||||
tag={this.props.tag}
|
||||
label={this.props.label}
|
||||
labelMinor={this.props.labelMinor}
|
||||
labelOffset={labelOffset}
|
||||
|
||||
@@ -162,6 +162,7 @@ class NodesChartElements extends React.Component {
|
||||
focused={node.get('focused')}
|
||||
highlighted={node.get('highlighted')}
|
||||
shape={shape}
|
||||
tag={node.get('tag')}
|
||||
stacked={node.get('stack')}
|
||||
key={node.get('id')}
|
||||
id={node.get('id')}
|
||||
|
||||
@@ -59,3 +59,11 @@ rules:
|
||||
- podsecuritypolicies
|
||||
verbs:
|
||||
- use
|
||||
- apiGroups:
|
||||
- volumesnapshot.external-storage.k8s.io
|
||||
resources:
|
||||
- volumesnapshots
|
||||
- volumesnapshotdatas
|
||||
verbs:
|
||||
- list
|
||||
- watch
|
||||
+135
-2
@@ -1,13 +1,18 @@
|
||||
package kubernetes
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/weaveworks/common/backoff"
|
||||
|
||||
snapshotv1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/apis/volumesnapshot/v1"
|
||||
snapshot "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned"
|
||||
"github.com/pborman/uuid"
|
||||
log "github.com/sirupsen/logrus"
|
||||
apiappsv1beta1 "k8s.io/api/apps/v1beta1"
|
||||
apibatchv1 "k8s.io/api/batch/v1"
|
||||
@@ -17,6 +22,7 @@ import (
|
||||
apiextensionsv1beta1 "k8s.io/api/extensions/v1beta1"
|
||||
storagev1 "k8s.io/api/storage/v1"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/fields"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
@@ -41,11 +47,16 @@ type Client interface {
|
||||
WalkPersistentVolumes(f func(PersistentVolume) error) error
|
||||
WalkPersistentVolumeClaims(f func(PersistentVolumeClaim) error) error
|
||||
WalkStorageClasses(f func(StorageClass) error) error
|
||||
WalkVolumeSnapshots(f func(VolumeSnapshot) error) error
|
||||
WalkVolumeSnapshotData(f func(VolumeSnapshotData) error) error
|
||||
|
||||
WatchPods(f func(Event, Pod))
|
||||
|
||||
CloneVolumeSnapshot(namespaceID, volumeSnapshotID, persistentVolumeClaimID, capacity string) error
|
||||
CreateVolumeSnapshot(namespaceID, persistentVolumeClaimID, capacity string) error
|
||||
GetLogs(namespaceID, podID string, containerNames []string) (io.ReadCloser, error)
|
||||
DeletePod(namespaceID, podID string) error
|
||||
DeleteVolumeSnapshot(namespaceID, volumeSnapshotID string) error
|
||||
ScaleUp(resource, namespaceID, id string) error
|
||||
ScaleDown(resource, namespaceID, id string) error
|
||||
}
|
||||
@@ -53,6 +64,7 @@ type Client interface {
|
||||
type client struct {
|
||||
quit chan struct{}
|
||||
client *kubernetes.Clientset
|
||||
snapshotClient *snapshot.Clientset
|
||||
podStore cache.Store
|
||||
serviceStore cache.Store
|
||||
deploymentStore cache.Store
|
||||
@@ -65,6 +77,8 @@ type client struct {
|
||||
persistentVolumeStore cache.Store
|
||||
persistentVolumeClaimStore cache.Store
|
||||
storageClassStore cache.Store
|
||||
volumeSnapshotStore cache.Store
|
||||
volumeSnapshotDataStore cache.Store
|
||||
|
||||
podWatchesMutex sync.Mutex
|
||||
podWatches []func(Event, Pod)
|
||||
@@ -133,9 +147,15 @@ func NewClient(config ClientConfig) (Client, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
sc, err := snapshot.NewForConfig(restConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
result := &client{
|
||||
quit: make(chan struct{}),
|
||||
client: c,
|
||||
quit: make(chan struct{}),
|
||||
client: c,
|
||||
snapshotClient: sc,
|
||||
}
|
||||
|
||||
result.podStore = NewEventStore(result.triggerPodWatches, cache.MetaNamespaceKeyFunc)
|
||||
@@ -152,6 +172,8 @@ func NewClient(config ClientConfig) (Client, error) {
|
||||
result.persistentVolumeStore = result.setupStore("persistentvolumes")
|
||||
result.persistentVolumeClaimStore = result.setupStore("persistentvolumeclaims")
|
||||
result.storageClassStore = result.setupStore("storageclasses")
|
||||
result.volumeSnapshotStore = result.setupStore("volumesnapshots")
|
||||
result.volumeSnapshotDataStore = result.setupStore("volumesnapshotdatas")
|
||||
|
||||
return result, nil
|
||||
}
|
||||
@@ -204,6 +226,10 @@ func (c *client) clientAndType(resource string) (rest.Interface, interface{}, er
|
||||
return c.client.BatchV1().RESTClient(), &apibatchv1.Job{}, nil
|
||||
case "statefulsets":
|
||||
return c.client.AppsV1beta1().RESTClient(), &apiappsv1beta1.StatefulSet{}, nil
|
||||
case "volumesnapshots":
|
||||
return c.snapshotClient.VolumesnapshotV1().RESTClient(), &snapshotv1.VolumeSnapshot{}, nil
|
||||
case "volumesnapshotdatas":
|
||||
return c.snapshotClient.VolumesnapshotV1().RESTClient(), &snapshotv1.VolumeSnapshotData{}, nil
|
||||
case "cronjobs":
|
||||
ok, err := c.isResourceSupported(c.client.BatchV1beta1().RESTClient().APIVersion(), resource)
|
||||
if err != nil {
|
||||
@@ -388,6 +414,109 @@ func (c *client) WalkNamespaces(f func(NamespaceResource) error) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) WalkVolumeSnapshots(f func(VolumeSnapshot) error) error {
|
||||
for _, m := range c.volumeSnapshotStore.List() {
|
||||
volumeSnapshot := m.(*snapshotv1.VolumeSnapshot)
|
||||
if err := f(NewVolumeSnapshot(volumeSnapshot)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) WalkVolumeSnapshotData(f func(VolumeSnapshotData) error) error {
|
||||
for _, m := range c.volumeSnapshotDataStore.List() {
|
||||
volumeSnapshotData := m.(*snapshotv1.VolumeSnapshotData)
|
||||
if err := f(NewVolumeSnapshotData(volumeSnapshotData)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) CloneVolumeSnapshot(namespaceID, volumeSnapshotID, persistentVolumeClaimID, capacity string) error {
|
||||
var scName string
|
||||
var claimSize string
|
||||
UID := strings.Split(uuid.New(), "-")
|
||||
scProvisionerName := "volumesnapshot.external-storage.k8s.io/snapshot-promoter"
|
||||
scList, err := c.client.StorageV1().StorageClasses().List(metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Retrieve the first snapshot-promoter storage class
|
||||
for _, sc := range scList.Items {
|
||||
if sc.Provisioner == scProvisionerName {
|
||||
scName = sc.Name
|
||||
break
|
||||
}
|
||||
}
|
||||
if scName == "" {
|
||||
return errors.New("snapshot-promoter storage class is not present")
|
||||
}
|
||||
volumeSnapshot, _ := c.snapshotClient.VolumesnapshotV1().VolumeSnapshots(namespaceID).Get(volumeSnapshotID, metav1.GetOptions{})
|
||||
if volumeSnapshot.Spec.PersistentVolumeClaimName != "" {
|
||||
persistentVolumeClaim, err := c.client.CoreV1().PersistentVolumeClaims(namespaceID).Get(volumeSnapshot.Spec.PersistentVolumeClaimName, metav1.GetOptions{})
|
||||
if err == nil {
|
||||
storage := persistentVolumeClaim.Spec.Resources.Requests[apiv1.ResourceStorage]
|
||||
if storage.String() != "" {
|
||||
claimSize = storage.String()
|
||||
}
|
||||
}
|
||||
}
|
||||
// Set default volume size to the one stored in volume snapshot annotation,
|
||||
// if unable to get PVC size.
|
||||
if claimSize == "" {
|
||||
claimSize = capacity
|
||||
}
|
||||
|
||||
persistentVolumeClaim := &apiv1.PersistentVolumeClaim{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "clone-" + persistentVolumeClaimID + "-" + UID[1],
|
||||
Namespace: namespaceID,
|
||||
Annotations: map[string]string{
|
||||
"snapshot.alpha.kubernetes.io/snapshot": volumeSnapshotID,
|
||||
},
|
||||
},
|
||||
Spec: apiv1.PersistentVolumeClaimSpec{
|
||||
StorageClassName: &scName,
|
||||
AccessModes: []apiv1.PersistentVolumeAccessMode{
|
||||
apiv1.ReadWriteOnce,
|
||||
},
|
||||
Resources: apiv1.ResourceRequirements{
|
||||
Requests: apiv1.ResourceList{
|
||||
apiv1.ResourceName(apiv1.ResourceStorage): resource.MustParse(claimSize),
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
_, err = c.client.CoreV1().PersistentVolumeClaims(namespaceID).Create(persistentVolumeClaim)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) CreateVolumeSnapshot(namespaceID, persistentVolumeClaimID, capacity string) error {
|
||||
UID := strings.Split(uuid.New(), "-")
|
||||
volumeSnapshot := &snapshotv1.VolumeSnapshot{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "snapshot-" + time.Now().Format("20060102150405") + "-" + UID[1],
|
||||
Namespace: namespaceID,
|
||||
Annotations: map[string]string{
|
||||
"capacity": capacity,
|
||||
},
|
||||
},
|
||||
Spec: snapshotv1.VolumeSnapshotSpec{
|
||||
PersistentVolumeClaimName: persistentVolumeClaimID,
|
||||
},
|
||||
}
|
||||
_, err := c.snapshotClient.VolumesnapshotV1().VolumeSnapshots(namespaceID).Create(volumeSnapshot)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) GetLogs(namespaceID, podID string, containerNames []string) (io.ReadCloser, error) {
|
||||
readClosersWithLabel := map[io.ReadCloser]string{}
|
||||
for _, container := range containerNames {
|
||||
@@ -416,6 +545,10 @@ func (c *client) DeletePod(namespaceID, podID string) error {
|
||||
return c.client.CoreV1().Pods(namespaceID).Delete(podID, &metav1.DeleteOptions{})
|
||||
}
|
||||
|
||||
func (c *client) DeleteVolumeSnapshot(namespaceID, volumeSnapshotID string) error {
|
||||
return c.snapshotClient.VolumesnapshotV1().VolumeSnapshots(namespaceID).Delete(volumeSnapshotID, &metav1.DeleteOptions{})
|
||||
}
|
||||
|
||||
func (c *client) ScaleUp(resource, namespaceID, id string) error {
|
||||
return c.modifyScale(resource, namespaceID, id, func(scale *apiextensionsv1beta1.Scale) {
|
||||
scale.Spec.Replicas++
|
||||
|
||||
@@ -11,10 +11,13 @@ import (
|
||||
|
||||
// Control IDs used by the kubernetes integration.
|
||||
const (
|
||||
GetLogs = report.KubernetesGetLogs
|
||||
DeletePod = report.KubernetesDeletePod
|
||||
ScaleUp = report.KubernetesScaleUp
|
||||
ScaleDown = report.KubernetesScaleDown
|
||||
CloneVolumeSnapshot = report.KubernetesCloneVolumeSnapshot
|
||||
CreateVolumeSnapshot = report.KubernetesCreateVolumeSnapshot
|
||||
GetLogs = report.KubernetesGetLogs
|
||||
DeletePod = report.KubernetesDeletePod
|
||||
DeleteVolumeSnapshot = report.KubernetesDeleteVolumeSnapshot
|
||||
ScaleUp = report.KubernetesScaleUp
|
||||
ScaleDown = report.KubernetesScaleDown
|
||||
)
|
||||
|
||||
// GetLogs is the control to get the logs for a kubernetes pod
|
||||
@@ -43,6 +46,22 @@ func (r *Reporter) GetLogs(req xfer.Request, namespaceID, podID string, containe
|
||||
}
|
||||
}
|
||||
|
||||
func (r *Reporter) cloneVolumeSnapshot(req xfer.Request, namespaceID, volumeSnapshotID, persistentVolumeClaimID, capacity string) xfer.Response {
|
||||
err := r.client.CloneVolumeSnapshot(namespaceID, volumeSnapshotID, persistentVolumeClaimID, capacity)
|
||||
if err != nil {
|
||||
return xfer.ResponseError(err)
|
||||
}
|
||||
return xfer.Response{}
|
||||
}
|
||||
|
||||
func (r *Reporter) createVolumeSnapshot(req xfer.Request, namespaceID, persistentVolumeClaimID, capacity string) xfer.Response {
|
||||
err := r.client.CreateVolumeSnapshot(namespaceID, persistentVolumeClaimID, capacity)
|
||||
if err != nil {
|
||||
return xfer.ResponseError(err)
|
||||
}
|
||||
return xfer.Response{}
|
||||
}
|
||||
|
||||
func (r *Reporter) deletePod(req xfer.Request, namespaceID, podID string, _ []string) xfer.Response {
|
||||
if err := r.client.DeletePod(namespaceID, podID); err != nil {
|
||||
return xfer.ResponseError(err)
|
||||
@@ -52,6 +71,15 @@ func (r *Reporter) deletePod(req xfer.Request, namespaceID, podID string, _ []st
|
||||
}
|
||||
}
|
||||
|
||||
func (r *Reporter) deleteVolumeSnapshot(req xfer.Request, namespaceID, volumeSnapshotID, _, _ string) xfer.Response {
|
||||
if err := r.client.DeleteVolumeSnapshot(namespaceID, volumeSnapshotID); err != nil {
|
||||
return xfer.ResponseError(err)
|
||||
}
|
||||
return xfer.Response{
|
||||
RemovedNode: req.NodeID,
|
||||
}
|
||||
}
|
||||
|
||||
// CapturePod is exported for testing
|
||||
func (r *Reporter) CapturePod(f func(xfer.Request, string, string, []string) xfer.Response) func(xfer.Request) xfer.Response {
|
||||
return func(req xfer.Request) xfer.Response {
|
||||
@@ -95,6 +123,50 @@ func (r *Reporter) CaptureDeployment(f func(xfer.Request, string, string) xfer.R
|
||||
}
|
||||
}
|
||||
|
||||
// CapturePersistentVolumeClaim will return name, namespace and capacity of PVC
|
||||
func (r *Reporter) CapturePersistentVolumeClaim(f func(xfer.Request, string, string, string) xfer.Response) func(xfer.Request) xfer.Response {
|
||||
return func(req xfer.Request) xfer.Response {
|
||||
uid, ok := report.ParsePersistentVolumeClaimNodeID(req.NodeID)
|
||||
if !ok {
|
||||
return xfer.ResponseErrorf("Invalid ID: %s", req.NodeID)
|
||||
}
|
||||
// find persistentVolumeClaim by UID
|
||||
var persistentVolumeClaim PersistentVolumeClaim
|
||||
r.client.WalkPersistentVolumeClaims(func(p PersistentVolumeClaim) error {
|
||||
if p.UID() == uid {
|
||||
persistentVolumeClaim = p
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if persistentVolumeClaim == nil {
|
||||
return xfer.ResponseErrorf("Persistent volume claim not found: %s", uid)
|
||||
}
|
||||
return f(req, persistentVolumeClaim.Namespace(), persistentVolumeClaim.Name(), persistentVolumeClaim.GetCapacity())
|
||||
}
|
||||
}
|
||||
|
||||
// CaptureVolumeSnapshot will return name, pvc name, namespace and capacity of volume snapshot
|
||||
func (r *Reporter) CaptureVolumeSnapshot(f func(xfer.Request, string, string, string, string) xfer.Response) func(xfer.Request) xfer.Response {
|
||||
return func(req xfer.Request) xfer.Response {
|
||||
uid, ok := report.ParseVolumeSnapshotNodeID(req.NodeID)
|
||||
if !ok {
|
||||
return xfer.ResponseErrorf("Invalid ID: %s", req.NodeID)
|
||||
}
|
||||
// find volume snapshot by UID
|
||||
var volumeSnapshot VolumeSnapshot
|
||||
r.client.WalkVolumeSnapshots(func(p VolumeSnapshot) error {
|
||||
if p.UID() == uid {
|
||||
volumeSnapshot = p
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if volumeSnapshot == nil {
|
||||
return xfer.ResponseErrorf("Volume snapshot not found: %s", uid)
|
||||
}
|
||||
return f(req, volumeSnapshot.Namespace(), volumeSnapshot.Name(), volumeSnapshot.GetVolumeName(), volumeSnapshot.GetCapacity())
|
||||
}
|
||||
}
|
||||
|
||||
// ScaleUp is the control to scale up a deployment
|
||||
func (r *Reporter) ScaleUp(req xfer.Request, namespace, id string) xfer.Response {
|
||||
return xfer.ResponseError(r.client.ScaleUp(report.Deployment, namespace, id))
|
||||
@@ -107,18 +179,24 @@ func (r *Reporter) ScaleDown(req xfer.Request, namespace, id string) xfer.Respon
|
||||
|
||||
func (r *Reporter) registerControls() {
|
||||
controls := map[string]xfer.ControlHandlerFunc{
|
||||
GetLogs: r.CapturePod(r.GetLogs),
|
||||
DeletePod: r.CapturePod(r.deletePod),
|
||||
ScaleUp: r.CaptureDeployment(r.ScaleUp),
|
||||
ScaleDown: r.CaptureDeployment(r.ScaleDown),
|
||||
CloneVolumeSnapshot: r.CaptureVolumeSnapshot(r.cloneVolumeSnapshot),
|
||||
CreateVolumeSnapshot: r.CapturePersistentVolumeClaim(r.createVolumeSnapshot),
|
||||
GetLogs: r.CapturePod(r.GetLogs),
|
||||
DeletePod: r.CapturePod(r.deletePod),
|
||||
DeleteVolumeSnapshot: r.CaptureVolumeSnapshot(r.deleteVolumeSnapshot),
|
||||
ScaleUp: r.CaptureDeployment(r.ScaleUp),
|
||||
ScaleDown: r.CaptureDeployment(r.ScaleDown),
|
||||
}
|
||||
r.handlerRegistry.Batch(nil, controls)
|
||||
}
|
||||
|
||||
func (r *Reporter) deregisterControls() {
|
||||
controls := []string{
|
||||
CloneVolumeSnapshot,
|
||||
CreateVolumeSnapshot,
|
||||
GetLogs,
|
||||
DeletePod,
|
||||
DeleteVolumeSnapshot,
|
||||
ScaleUp,
|
||||
ScaleDown,
|
||||
}
|
||||
|
||||
@@ -17,8 +17,9 @@ const (
|
||||
type PersistentVolumeClaim interface {
|
||||
Meta
|
||||
Selector() (labels.Selector, error)
|
||||
GetNode() report.Node
|
||||
GetNode(string) report.Node
|
||||
GetStorageClass() string
|
||||
GetCapacity() string
|
||||
}
|
||||
|
||||
// persistentVolumeClaim represents kubernetes Persistent Volume Claims
|
||||
@@ -47,14 +48,32 @@ func (p *persistentVolumeClaim) GetStorageClass() string {
|
||||
return storageClassName
|
||||
}
|
||||
|
||||
// GetCapacity returns the storage size of PVC
|
||||
func (p *persistentVolumeClaim) GetCapacity() string {
|
||||
capacity := p.Spec.Resources.Requests[apiv1.ResourceStorage]
|
||||
if capacity.String() != "" {
|
||||
return capacity.String()
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// GetNode returns Persistent Volume Claim as Node
|
||||
func (p *persistentVolumeClaim) GetNode() report.Node {
|
||||
return p.MetaNode(report.MakePersistentVolumeClaimNodeID(p.UID())).WithLatests(map[string]string{
|
||||
NodeType: "Persistent Volume Claim",
|
||||
Status: string(p.Status.Phase),
|
||||
VolumeName: p.Spec.VolumeName,
|
||||
StorageClassName: p.GetStorageClass(),
|
||||
})
|
||||
func (p *persistentVolumeClaim) GetNode(probeID string) report.Node {
|
||||
latests := map[string]string{
|
||||
NodeType: "Persistent Volume Claim",
|
||||
Status: string(p.Status.Phase),
|
||||
VolumeName: p.Spec.VolumeName,
|
||||
StorageClassName: p.GetStorageClass(),
|
||||
report.ControlProbeID: probeID,
|
||||
}
|
||||
|
||||
if p.GetCapacity() != "" {
|
||||
latests[VolumeCapacity] = p.GetCapacity()
|
||||
}
|
||||
|
||||
return p.MetaNode(report.MakePersistentVolumeClaimNodeID(p.UID())).
|
||||
WithLatests(latests).
|
||||
WithLatestActiveControls(CreateVolumeSnapshot)
|
||||
}
|
||||
|
||||
// Selector returns all Persistent Volume Claim selector
|
||||
|
||||
@@ -34,6 +34,9 @@ const (
|
||||
VolumeName = report.KubernetesVolumeName
|
||||
Provisioner = report.KubernetesProvisioner
|
||||
StorageDriver = report.KubernetesStorageDriver
|
||||
VolumeSnapshotName = report.KubernetesVolumeSnapshotName
|
||||
SnapshotData = report.KubernetesSnapshotData
|
||||
VolumeCapacity = report.KubernetesVolumeCapacity
|
||||
)
|
||||
|
||||
// Exposed for testing
|
||||
@@ -122,6 +125,7 @@ var (
|
||||
Status: {ID: Status, Label: "Status", From: report.FromLatest, Priority: 3},
|
||||
VolumeName: {ID: VolumeName, Label: "Volume", From: report.FromLatest, Priority: 4},
|
||||
StorageClassName: {ID: StorageClassName, Label: "Storage class", From: report.FromLatest, Priority: 5},
|
||||
VolumeCapacity: {ID: VolumeCapacity, Label: "Capacity", From: report.FromLatest, Priority: 6},
|
||||
}
|
||||
|
||||
StorageClassMetadataTemplates = report.MetadataTemplates{
|
||||
@@ -130,6 +134,19 @@ var (
|
||||
Provisioner: {ID: Provisioner, Label: "Provisioner", From: report.FromLatest, Priority: 3},
|
||||
}
|
||||
|
||||
VolumeSnapshotMetadataTemplates = report.MetadataTemplates{
|
||||
NodeType: {ID: NodeType, Label: "Type", From: report.FromLatest, Priority: 1},
|
||||
Namespace: {ID: Namespace, Label: "Name", From: report.FromLatest, Priority: 2},
|
||||
VolumeClaim: {ID: VolumeClaim, Label: "Persistent volume claim", From: report.FromLatest, Priority: 3},
|
||||
SnapshotData: {ID: SnapshotData, Label: "Volume snapshot data", From: report.FromLatest, Priority: 4},
|
||||
}
|
||||
|
||||
VolumeSnapshotDataMetadataTemplates = report.MetadataTemplates{
|
||||
NodeType: {ID: NodeType, Label: "Type", From: report.FromLatest, Priority: 1},
|
||||
VolumeName: {ID: VolumeName, Label: "Persistent volume", From: report.FromLatest, Priority: 2},
|
||||
VolumeSnapshotName: {ID: VolumeSnapshotName, Label: "Volume snapshot", From: report.FromLatest, Priority: 3},
|
||||
}
|
||||
|
||||
TableTemplates = report.TableTemplates{
|
||||
LabelPrefix: {
|
||||
ID: LabelPrefix,
|
||||
@@ -304,6 +321,14 @@ func (r *Reporter) Report() (report.Report, error) {
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
volumeSnapshotTopology, _, err := r.volumeSnapshotTopology()
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
volumeSnapshotDataTopology, _, err := r.volumeSnapshotDataTopology()
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
result.Pod = result.Pod.Merge(podTopology)
|
||||
result.Service = result.Service.Merge(serviceTopology)
|
||||
result.Host = result.Host.Merge(hostTopology)
|
||||
@@ -315,6 +340,8 @@ func (r *Reporter) Report() (report.Report, error) {
|
||||
result.PersistentVolume = result.PersistentVolume.Merge(persistentVolumeTopology)
|
||||
result.PersistentVolumeClaim = result.PersistentVolumeClaim.Merge(persistentVolumeClaimTopology)
|
||||
result.StorageClass = result.StorageClass.Merge(storageClassTopology)
|
||||
result.VolumeSnapshot = result.VolumeSnapshot.Merge(volumeSnapshotTopology)
|
||||
result.VolumeSnapshotData = result.VolumeSnapshotData.Merge(volumeSnapshotDataTopology)
|
||||
return result, nil
|
||||
}
|
||||
|
||||
@@ -442,8 +469,14 @@ func (r *Reporter) persistentVolumeClaimTopology() (report.Topology, []Persisten
|
||||
result := report.MakeTopology().
|
||||
WithMetadataTemplates(PersistentVolumeClaimMetadataTemplates).
|
||||
WithTableTemplates(TableTemplates)
|
||||
result.Controls.AddControl(report.Control{
|
||||
ID: CreateVolumeSnapshot,
|
||||
Human: "Create snapshot",
|
||||
Icon: "fa-camera",
|
||||
Rank: 0,
|
||||
})
|
||||
err := r.client.WalkPersistentVolumeClaims(func(p PersistentVolumeClaim) error {
|
||||
result.AddNode(p.GetNode())
|
||||
result.AddNode(p.GetNode(r.probeID))
|
||||
persistentVolumeClaims = append(persistentVolumeClaims, p)
|
||||
return nil
|
||||
})
|
||||
@@ -463,6 +496,44 @@ func (r *Reporter) storageClassTopology() (report.Topology, []StorageClass, erro
|
||||
return result, storageClasses, err
|
||||
}
|
||||
|
||||
func (r *Reporter) volumeSnapshotTopology() (report.Topology, []VolumeSnapshot, error) {
|
||||
volumeSnapshots := []VolumeSnapshot{}
|
||||
result := report.MakeTopology().
|
||||
WithMetadataTemplates(VolumeSnapshotMetadataTemplates).
|
||||
WithTableTemplates(TableTemplates)
|
||||
result.Controls.AddControl(report.Control{
|
||||
ID: CloneVolumeSnapshot,
|
||||
Human: "Clone snapshot",
|
||||
Icon: "fa-clone",
|
||||
Rank: 0,
|
||||
})
|
||||
result.Controls.AddControl(report.Control{
|
||||
ID: DeleteVolumeSnapshot,
|
||||
Human: "Delete",
|
||||
Icon: "fa-trash-o",
|
||||
Rank: 1,
|
||||
})
|
||||
err := r.client.WalkVolumeSnapshots(func(p VolumeSnapshot) error {
|
||||
result.AddNode(p.GetNode(r.probeID))
|
||||
volumeSnapshots = append(volumeSnapshots, p)
|
||||
return nil
|
||||
})
|
||||
return result, volumeSnapshots, err
|
||||
}
|
||||
|
||||
func (r *Reporter) volumeSnapshotDataTopology() (report.Topology, []VolumeSnapshotData, error) {
|
||||
volumeSnapshotData := []VolumeSnapshotData{}
|
||||
result := report.MakeTopology().
|
||||
WithMetadataTemplates(VolumeSnapshotDataMetadataTemplates).
|
||||
WithTableTemplates(TableTemplates)
|
||||
err := r.client.WalkVolumeSnapshotData(func(p VolumeSnapshotData) error {
|
||||
result.AddNode(p.GetNode(r.probeID))
|
||||
volumeSnapshotData = append(volumeSnapshotData, p)
|
||||
return nil
|
||||
})
|
||||
return result, volumeSnapshotData, err
|
||||
}
|
||||
|
||||
type labelledChild interface {
|
||||
Labels() map[string]string
|
||||
AddParent(string, string)
|
||||
|
||||
@@ -164,6 +164,12 @@ func (c *mockClient) WalkPersistentVolumeClaims(f func(kubernetes.PersistentVolu
|
||||
func (c *mockClient) WalkStorageClasses(f func(kubernetes.StorageClass) error) error {
|
||||
return nil
|
||||
}
|
||||
func (c *mockClient) WalkVolumeSnapshots(f func(kubernetes.VolumeSnapshot) error) error {
|
||||
return nil
|
||||
}
|
||||
func (c *mockClient) WalkVolumeSnapshotData(f func(kubernetes.VolumeSnapshotData) error) error {
|
||||
return nil
|
||||
}
|
||||
func (*mockClient) WatchPods(func(kubernetes.Event, kubernetes.Pod)) {}
|
||||
func (c *mockClient) GetLogs(namespaceID, podName string, _ []string) (io.ReadCloser, error) {
|
||||
r, ok := c.logs[namespaceID+";"+podName]
|
||||
@@ -181,6 +187,15 @@ func (c *mockClient) ScaleUp(resource, namespaceID, id string) error {
|
||||
func (c *mockClient) ScaleDown(resource, namespaceID, id string) error {
|
||||
return nil
|
||||
}
|
||||
func (c *mockClient) CloneVolumeSnapshot(namespaceID, VolumeSnapshotID, persistentVolumeClaimID, capacity string) error {
|
||||
return nil
|
||||
}
|
||||
func (c *mockClient) CreateVolumeSnapshot(namespaceID, persistentVolumeClaimID, capacity string) error {
|
||||
return nil
|
||||
}
|
||||
func (c *mockClient) DeleteVolumeSnapshot(namespaceID, VolumeSnapshotID string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
type mockPipeClient map[string]xfer.Pipe
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package kubernetes
|
||||
|
||||
import (
|
||||
snapshotv1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/apis/volumesnapshot/v1"
|
||||
"github.com/weaveworks/scope/report"
|
||||
)
|
||||
|
||||
// SnapshotPVName is the label key which provides PV name
|
||||
const (
|
||||
SnapshotPVName = "SnapshotMetadata-PVName"
|
||||
)
|
||||
|
||||
// Capacity is the annotation key which provides the storage size
|
||||
const (
|
||||
Capacity = "capacity"
|
||||
)
|
||||
|
||||
// VolumeSnapshot represent kubernetes VolumeSnapshot interface
|
||||
type VolumeSnapshot interface {
|
||||
Meta
|
||||
GetNode(probeID string) report.Node
|
||||
GetVolumeName() string
|
||||
GetCapacity() string
|
||||
}
|
||||
|
||||
// volumeSnapshot represents kubernetes volume snapshots
|
||||
type volumeSnapshot struct {
|
||||
*snapshotv1.VolumeSnapshot
|
||||
Meta
|
||||
}
|
||||
|
||||
// NewVolumeSnapshot returns new Volume Snapshot type
|
||||
func NewVolumeSnapshot(p *snapshotv1.VolumeSnapshot) VolumeSnapshot {
|
||||
return &volumeSnapshot{VolumeSnapshot: p, Meta: meta{p.ObjectMeta}}
|
||||
}
|
||||
|
||||
// GetVolumeName returns the PVC name for volume snapshot
|
||||
func (p *volumeSnapshot) GetVolumeName() string {
|
||||
return p.Spec.PersistentVolumeClaimName
|
||||
}
|
||||
|
||||
// GetCapacity returns the capacity of the source PVC stored in annotation
|
||||
func (p *volumeSnapshot) GetCapacity() string {
|
||||
capacity := p.GetAnnotations()[Capacity]
|
||||
if capacity != "" {
|
||||
return capacity
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// GetNode returns VolumeSnapshot as Node
|
||||
func (p *volumeSnapshot) GetNode(probeID string) report.Node {
|
||||
return p.MetaNode(report.MakeVolumeSnapshotNodeID(p.UID())).WithLatests(map[string]string{
|
||||
report.ControlProbeID: probeID,
|
||||
NodeType: "Volume Snapshot",
|
||||
VolumeClaim: p.GetVolumeName(),
|
||||
SnapshotData: p.Spec.SnapshotDataName,
|
||||
VolumeName: p.GetLabels()[SnapshotPVName],
|
||||
}).WithLatestActiveControls(CloneVolumeSnapshot, DeleteVolumeSnapshot)
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package kubernetes
|
||||
|
||||
import (
|
||||
snapshotv1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/apis/volumesnapshot/v1"
|
||||
"github.com/weaveworks/scope/report"
|
||||
)
|
||||
|
||||
// VolumeSnapshotData represent kubernetes VolumeSnapshotData interface
|
||||
type VolumeSnapshotData interface {
|
||||
Meta
|
||||
GetNode(probeID string) report.Node
|
||||
}
|
||||
|
||||
// volumeSnapshotData represents kubernetes volume snapshot data
|
||||
type volumeSnapshotData struct {
|
||||
*snapshotv1.VolumeSnapshotData
|
||||
Meta
|
||||
}
|
||||
|
||||
// NewVolumeSnapshotData returns new Volume Snapshot Data type
|
||||
func NewVolumeSnapshotData(p *snapshotv1.VolumeSnapshotData) VolumeSnapshotData {
|
||||
return &volumeSnapshotData{VolumeSnapshotData: p, Meta: meta{p.ObjectMeta}}
|
||||
}
|
||||
|
||||
// GetNode returns VolumeSnapshotData as Node
|
||||
func (p *volumeSnapshotData) GetNode(probeID string) report.Node {
|
||||
return p.MetaNode(report.MakeVolumeSnapshotDataNodeID(p.UID())).WithLatests(map[string]string{
|
||||
report.ControlProbeID: probeID,
|
||||
NodeType: "Volume Snapshot Data",
|
||||
VolumeName: p.Spec.PersistentVolumeRef.Name,
|
||||
VolumeSnapshotName: p.Spec.VolumeSnapshotRef.Name,
|
||||
})
|
||||
}
|
||||
@@ -206,6 +206,20 @@ var nodeSummaryGroupSpecs = []struct {
|
||||
Columns: []Column{},
|
||||
},
|
||||
},
|
||||
{
|
||||
topologyID: report.VolumeSnapshot,
|
||||
NodeSummaryGroup: NodeSummaryGroup{
|
||||
Label: "Volume Snapshots",
|
||||
Columns: []Column{},
|
||||
},
|
||||
},
|
||||
{
|
||||
topologyID: report.VolumeSnapshotData,
|
||||
NodeSummaryGroup: NodeSummaryGroup{
|
||||
Label: "Volume Snapshot Data",
|
||||
Columns: []Column{},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
func children(rc RenderContext, n report.Node) []NodeSummaryGroup {
|
||||
|
||||
@@ -48,6 +48,7 @@ func TestMakeDetailedHostNode(t *testing.T) {
|
||||
Rank: "hostname.com",
|
||||
Pseudo: false,
|
||||
Shape: "circle",
|
||||
Tag: "",
|
||||
},
|
||||
Adjacency: report.MakeIDList(fixture.ServerHostNodeID),
|
||||
Metadata: []report.MetadataRow{
|
||||
@@ -192,6 +193,7 @@ func TestMakeDetailedContainerNode(t *testing.T) {
|
||||
LabelMinor: "server.hostname.com",
|
||||
Rank: fixture.ServerContainerImageName,
|
||||
Shape: "hexagon",
|
||||
Tag: "",
|
||||
Pseudo: false,
|
||||
},
|
||||
Metadata: []report.MetadataRow{
|
||||
@@ -321,6 +323,7 @@ func TestMakeDetailedPodNode(t *testing.T) {
|
||||
LabelMinor: "1 container",
|
||||
Rank: "ping/pong-b",
|
||||
Shape: "heptagon",
|
||||
Tag: "",
|
||||
Pseudo: false,
|
||||
},
|
||||
Metadata: []report.MetadataRow{
|
||||
|
||||
@@ -49,6 +49,7 @@ type BasicNodeSummary struct {
|
||||
LabelMinor string `json:"labelMinor"`
|
||||
Rank string `json:"rank"`
|
||||
Shape string `json:"shape,omitempty"`
|
||||
Tag string `json:"tag,omitempty"`
|
||||
Stack bool `json:"stack,omitempty"`
|
||||
Pseudo bool `json:"pseudo,omitempty"`
|
||||
}
|
||||
@@ -83,6 +84,8 @@ var renderers = map[string]func(BasicNodeSummary, report.Node) BasicNodeSummary{
|
||||
report.PersistentVolume: persistentVolumeNodeSummary,
|
||||
report.PersistentVolumeClaim: persistentVolumeClaimNodeSummary,
|
||||
report.StorageClass: storageClassNodeSummary,
|
||||
report.VolumeSnapshot: volumeSnapshotNodeSummary,
|
||||
report.VolumeSnapshotData: volumeSnapshotDataNodeSummary,
|
||||
}
|
||||
|
||||
// For each report.Topology, map to a 'primary' API topology. This can then be used in a variety of places.
|
||||
@@ -103,6 +106,8 @@ var primaryAPITopology = map[string]string{
|
||||
report.PersistentVolume: "pods",
|
||||
report.PersistentVolumeClaim: "pods",
|
||||
report.StorageClass: "pods",
|
||||
report.VolumeSnapshot: "pods",
|
||||
report.VolumeSnapshotData: "pods",
|
||||
}
|
||||
|
||||
// MakeBasicNodeSummary returns a basic summary of a node, if
|
||||
@@ -115,6 +120,7 @@ func MakeBasicNodeSummary(r report.Report, n report.Node) (BasicNodeSummary, boo
|
||||
}
|
||||
if t, ok := r.Topology(n.Topology); ok {
|
||||
summary.Shape = t.GetShape()
|
||||
summary.Tag = t.Tag
|
||||
}
|
||||
|
||||
// Do we have a renderer for the topology?
|
||||
@@ -392,6 +398,16 @@ func storageClassNodeSummary(base BasicNodeSummary, n report.Node) BasicNodeSumm
|
||||
return base
|
||||
}
|
||||
|
||||
func volumeSnapshotNodeSummary(base BasicNodeSummary, n report.Node) BasicNodeSummary {
|
||||
base = addKubernetesLabelAndRank(base, n)
|
||||
return base
|
||||
}
|
||||
|
||||
func volumeSnapshotDataNodeSummary(base BasicNodeSummary, n report.Node) BasicNodeSummary {
|
||||
base = addKubernetesLabelAndRank(base, n)
|
||||
return base
|
||||
}
|
||||
|
||||
// groupNodeSummary renders the summary for a group node. n.Topology is
|
||||
// expected to be of the form: group:container:hostname
|
||||
func groupNodeSummary(base BasicNodeSummary, r report.Report, n report.Node) BasicNodeSummary {
|
||||
@@ -399,6 +415,7 @@ func groupNodeSummary(base BasicNodeSummary, r report.Report, n report.Node) Bas
|
||||
if topology, _, ok := render.ParseGroupNodeTopology(n.Topology); ok {
|
||||
if t, ok := r.Topology(topology); ok {
|
||||
base.Shape = t.GetShape()
|
||||
base.Tag = t.Tag
|
||||
if t.Label != "" {
|
||||
base.LabelMinor = pluralize(n.Counters, topology, t.Label, t.LabelPlural)
|
||||
}
|
||||
|
||||
@@ -110,6 +110,7 @@ func TestMakeNodeSummary(t *testing.T) {
|
||||
LabelMinor: "client.hostname.com (10001)",
|
||||
Rank: fixture.Client1Name,
|
||||
Shape: "square",
|
||||
Tag: "",
|
||||
},
|
||||
Metadata: []report.MetadataRow{
|
||||
{ID: process.PID, Label: "PID", Value: fixture.Client1PID, Priority: 1, Datatype: report.Number},
|
||||
@@ -128,6 +129,7 @@ func TestMakeNodeSummary(t *testing.T) {
|
||||
LabelMinor: fixture.ClientHostName,
|
||||
Rank: fixture.ClientContainerImageName,
|
||||
Shape: "hexagon",
|
||||
Tag: "",
|
||||
},
|
||||
Metadata: []report.MetadataRow{
|
||||
{ID: docker.ImageName, Label: "Image name", Value: fixture.ClientContainerImageName, Priority: 2},
|
||||
@@ -147,6 +149,7 @@ func TestMakeNodeSummary(t *testing.T) {
|
||||
LabelMinor: "1 container",
|
||||
Rank: fixture.ClientContainerImageName,
|
||||
Shape: "hexagon",
|
||||
Tag: "",
|
||||
Stack: true,
|
||||
},
|
||||
Metadata: []report.MetadataRow{
|
||||
@@ -166,6 +169,7 @@ func TestMakeNodeSummary(t *testing.T) {
|
||||
LabelMinor: "hostname.com",
|
||||
Rank: "hostname.com",
|
||||
Shape: "circle",
|
||||
Tag: "",
|
||||
},
|
||||
Metadata: []report.MetadataRow{
|
||||
{ID: host.HostName, Label: "Hostname", Value: fixture.ClientHostName, Priority: 11},
|
||||
@@ -184,6 +188,7 @@ func TestMakeNodeSummary(t *testing.T) {
|
||||
LabelMinor: "1 process",
|
||||
Rank: "apache",
|
||||
Shape: "square",
|
||||
Tag: "",
|
||||
Stack: true,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -44,6 +44,8 @@ var (
|
||||
persistentVolume = node(report.PersistentVolume)
|
||||
persistentVolumeClaim = node(report.PersistentVolumeClaim)
|
||||
StorageClass = node(report.StorageClass)
|
||||
volumeSnapshot = node(report.VolumeSnapshot)
|
||||
volumeSnapshotData = node(report.VolumeSnapshotData)
|
||||
|
||||
UnknownPseudoNode1ID = render.MakePseudoNodeID(fixture.UnknownClient1IP)
|
||||
UnknownPseudoNode2ID = render.MakePseudoNodeID(fixture.UnknownClient3IP)
|
||||
@@ -282,7 +284,7 @@ var (
|
||||
kubernetes.StorageClassName: "standard",
|
||||
}).WithChild(report.MakeNode(fixture.PersistentVolumeNodeID).WithTopology(report.PersistentVolume)),
|
||||
|
||||
fixture.PersistentVolumeNodeID: persistentVolume(fixture.PersistentVolumeNodeID).
|
||||
fixture.PersistentVolumeNodeID: persistentVolume(fixture.PersistentVolumeNodeID, fixture.VolumeSnapshotNodeID).
|
||||
WithLatests(map[string]string{
|
||||
kubernetes.Name: "pongvolume",
|
||||
kubernetes.Namespace: "ping",
|
||||
@@ -291,7 +293,7 @@ var (
|
||||
kubernetes.AccessModes: "ReadWriteOnce",
|
||||
kubernetes.StorageClassName: "standard",
|
||||
kubernetes.StorageDriver: "iSCSI",
|
||||
}),
|
||||
}).WithChild(report.MakeNode(fixture.VolumeSnapshotNodeID).WithTopology(report.VolumeSnapshot)),
|
||||
|
||||
fixture.StorageClassNodeID: StorageClass(fixture.StorageClassNodeID, fixture.PersistentVolumeClaimNodeID).
|
||||
WithLatests(map[string]string{
|
||||
@@ -299,6 +301,22 @@ var (
|
||||
kubernetes.Provisioner: "pong",
|
||||
}).WithChild(report.MakeNode(fixture.PersistentVolumeClaimNodeID).WithTopology(report.PersistentVolumeClaim)),
|
||||
|
||||
fixture.VolumeSnapshotNodeID: volumeSnapshot(fixture.VolumeSnapshotNodeID, fixture.VolumeSnapshotDataNodeID).
|
||||
WithLatests(map[string]string{
|
||||
kubernetes.Name: "vs-1234",
|
||||
kubernetes.Namespace: "ping",
|
||||
kubernetes.VolumeClaim: "pvc-6124",
|
||||
kubernetes.SnapshotData: "vsd-1234",
|
||||
kubernetes.VolumeName: "pongvolume",
|
||||
}).WithChild(report.MakeNode(fixture.VolumeSnapshotDataNodeID).WithTopology(report.VolumeSnapshotData)),
|
||||
|
||||
fixture.VolumeSnapshotDataNodeID: volumeSnapshotData(fixture.VolumeSnapshotDataNodeID).
|
||||
WithLatests(map[string]string{
|
||||
kubernetes.Name: "vsd-1234",
|
||||
kubernetes.VolumeName: "pongvolume",
|
||||
kubernetes.VolumeSnapshotName: "vs-1234",
|
||||
}),
|
||||
|
||||
UnmanagedServerID: unmanagedServerNode,
|
||||
render.IncomingInternetID: theIncomingInternetNode(fixture.ServerPodNodeID),
|
||||
render.OutgoingInternetID: theOutgoingInternetNode,
|
||||
|
||||
@@ -138,6 +138,14 @@ func IsPodComponent(node report.Node) bool {
|
||||
return ok
|
||||
}
|
||||
|
||||
// IsNonSnapshotComponent checks whether given node is everything but Volume Snapshot, Volume Snapshot Data
|
||||
func IsNonSnapshotComponent(node report.Node) bool {
|
||||
if node.Topology == "volume_snapshot" || node.Topology == "volume_snapshot_data" {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// connected returns the node ids of nodes which have edges to/from
|
||||
// them, excluding edges to/from themselves.
|
||||
func connected(nodes report.Nodes) map[string]struct{} {
|
||||
|
||||
@@ -11,6 +11,8 @@ var KubernetesVolumesRenderer = MakeReduce(
|
||||
VolumesRenderer,
|
||||
PodToVolumeRenderer,
|
||||
PVCToStorageClassRenderer,
|
||||
PVToSnapshotRenderer,
|
||||
VolumeSnapshotRenderer,
|
||||
)
|
||||
|
||||
// VolumesRenderer is a Renderer which produces a renderable kubernetes PV & PVC
|
||||
@@ -25,13 +27,12 @@ func (v volumesRenderer) Render(rpt report.Report) Nodes {
|
||||
nodes := make(report.Nodes)
|
||||
for id, n := range rpt.PersistentVolumeClaim.Nodes {
|
||||
volume, _ := n.Latest.Lookup(kubernetes.VolumeName)
|
||||
for pvNodeID, p := range rpt.PersistentVolume.Nodes {
|
||||
for _, p := range rpt.PersistentVolume.Nodes {
|
||||
volumeName, _ := p.Latest.Lookup(kubernetes.Name)
|
||||
if volume == volumeName {
|
||||
n.Adjacency = n.Adjacency.Add(p.ID)
|
||||
n.Children = n.Children.Add(p)
|
||||
}
|
||||
nodes[pvNodeID] = p
|
||||
}
|
||||
nodes[id] = n
|
||||
}
|
||||
@@ -86,3 +87,51 @@ func (v pvcToStorageClassRenderer) Render(rpt report.Report) Nodes {
|
||||
}
|
||||
return Nodes{Nodes: nodes}
|
||||
}
|
||||
|
||||
//PVToSnapshotRenderer is a Renderer which produces a renderable kubernetes PV
|
||||
var PVToSnapshotRenderer = pvToSnapshotRenderer{}
|
||||
|
||||
//pvToSnapshotRenderer is a Renderer to render PV & Snapshot.
|
||||
type pvToSnapshotRenderer struct{}
|
||||
|
||||
//Render renders the PV & Snapshot nodes with adjacency.
|
||||
func (v pvToSnapshotRenderer) Render(rpt report.Report) Nodes {
|
||||
nodes := make(report.Nodes)
|
||||
for pvNodeID, p := range rpt.PersistentVolume.Nodes {
|
||||
volumeName, _ := p.Latest.Lookup(kubernetes.Name)
|
||||
for _, volumeSnapshotNode := range rpt.VolumeSnapshot.Nodes {
|
||||
snapshotPVName, _ := volumeSnapshotNode.Latest.Lookup(kubernetes.VolumeName)
|
||||
if volumeName == snapshotPVName {
|
||||
p.Adjacency = p.Adjacency.Add(volumeSnapshotNode.ID)
|
||||
p.Children = p.Children.Add(volumeSnapshotNode)
|
||||
}
|
||||
}
|
||||
nodes[pvNodeID] = p
|
||||
}
|
||||
return Nodes{Nodes: nodes}
|
||||
}
|
||||
|
||||
// VolumeSnapshotRenderer is a renderer which produces a renderable Kubernetes Volume Snapshot and Volume Snapshot Data
|
||||
var VolumeSnapshotRenderer = volumeSnapshotRenderer{}
|
||||
|
||||
// volumeSnapshotRenderer is a render to volume snapshot & volume snapshot data
|
||||
type volumeSnapshotRenderer struct{}
|
||||
|
||||
// Render renders the volumeSnapshots & volumeSnapshotData with adjacency
|
||||
// It checks for the volumeSnapshotData name in volumeSnapshot, adjacency is created by matching the volumeSnapshotData name.
|
||||
func (v volumeSnapshotRenderer) Render(rpt report.Report) Nodes {
|
||||
nodes := make(report.Nodes)
|
||||
for volumeSnapshotID, volumeSnapshotNode := range rpt.VolumeSnapshot.Nodes {
|
||||
snapshotData, _ := volumeSnapshotNode.Latest.Lookup(kubernetes.SnapshotData)
|
||||
for volumeSnapshotDataID, volumeSnapshotDataNode := range rpt.VolumeSnapshotData.Nodes {
|
||||
snapshotDataName, _ := volumeSnapshotDataNode.Latest.Lookup(kubernetes.Name)
|
||||
if snapshotDataName == snapshotData {
|
||||
volumeSnapshotNode.Adjacency = volumeSnapshotNode.Adjacency.Add(volumeSnapshotDataNode.ID)
|
||||
volumeSnapshotNode.Children = volumeSnapshotNode.Children.Add(volumeSnapshotDataNode)
|
||||
}
|
||||
nodes[volumeSnapshotDataID] = volumeSnapshotDataNode
|
||||
}
|
||||
nodes[volumeSnapshotID] = volumeSnapshotNode
|
||||
}
|
||||
return Nodes{Nodes: nodes}
|
||||
}
|
||||
|
||||
@@ -35,4 +35,6 @@ var (
|
||||
SelectPersistentVolume = TopologySelector(report.PersistentVolume)
|
||||
SelectPersistentVolumeClaim = TopologySelector(report.PersistentVolumeClaim)
|
||||
SelectStorageClass = TopologySelector(report.StorageClass)
|
||||
SelectVolumeSnapshot = TopologySelector(report.VolumeSnapshot)
|
||||
SelectVolumeSnapshotData = TopologySelector(report.VolumeSnapshotData)
|
||||
)
|
||||
|
||||
@@ -175,6 +175,18 @@ var (
|
||||
|
||||
// ParseStorageClassNodeID parses a storage class node ID
|
||||
ParseStorageClassNodeID = parseSingleComponentID("storage_class")
|
||||
|
||||
// MakeVolumeSnapshotNodeID produces a volume snapshot node ID from its composite parts.
|
||||
MakeVolumeSnapshotNodeID = makeSingleComponentID("volume_snapshot")
|
||||
|
||||
// ParseVolumeSnapshotNodeID parses a volume snapshot node ID
|
||||
ParseVolumeSnapshotNodeID = parseSingleComponentID("volume_snapshot")
|
||||
|
||||
// MakeVolumeSnapshotDataNodeID produces a volume snapshot data node ID from its composite parts.
|
||||
MakeVolumeSnapshotDataNodeID = makeSingleComponentID("volume_snapshot_data")
|
||||
|
||||
// ParseVolumeSnapshotDataNodeID parses a volume snapshot data node ID
|
||||
ParseVolumeSnapshotDataNodeID = parseSingleComponentID("volume_snapshot_data")
|
||||
)
|
||||
|
||||
// makeSingleComponentID makes a single-component node id encoder
|
||||
|
||||
@@ -81,6 +81,12 @@ const (
|
||||
KubernetesVolumeName = "kubernetes_volume_name"
|
||||
KubernetesProvisioner = "kubernetes_provisioner"
|
||||
KubernetesStorageDriver = "kubernetes_storage_driver"
|
||||
KubernetesVolumeSnapshotName = "kubernetes_volume_snapshot_name"
|
||||
KubernetesSnapshotData = "kuberneets_snapshot_data"
|
||||
KubernetesCreateVolumeSnapshot = "kubernetes_create_volume_snapshot"
|
||||
KubernetesVolumeCapacity = "kubernetes_volume_capacity"
|
||||
KubernetesCloneVolumeSnapshot = "kubernetes_clone_volume_snapshot"
|
||||
KubernetesDeleteVolumeSnapshot = "kubernetes_delete_volume_snapshot"
|
||||
// probe/awsecs
|
||||
ECSCluster = "ecs_cluster"
|
||||
ECSCreatedAt = "ecs_created_at"
|
||||
@@ -116,6 +122,8 @@ var commonKeys = map[string]string{
|
||||
PersistentVolume: PersistentVolume,
|
||||
PersistentVolumeClaim: PersistentVolumeClaim,
|
||||
StorageClass: StorageClass,
|
||||
VolumeSnapshot: VolumeSnapshot,
|
||||
VolumeSnapshotData: VolumeSnapshotData,
|
||||
|
||||
HostNodeID: HostNodeID,
|
||||
ControlProbeID: ControlProbeID,
|
||||
|
||||
@@ -31,6 +31,8 @@ const (
|
||||
PersistentVolume = "persistent_volume"
|
||||
PersistentVolumeClaim = "persistent_volume_claim"
|
||||
StorageClass = "storage_class"
|
||||
VolumeSnapshot = "volume_snapshot"
|
||||
VolumeSnapshotData = "volume_snapshot_data"
|
||||
|
||||
// Shapes used for different nodes
|
||||
Circle = "circle"
|
||||
@@ -44,6 +46,7 @@ const (
|
||||
Cylinder = "cylinder"
|
||||
DottedCylinder = "dottedcylinder"
|
||||
StorageSheet = "sheet"
|
||||
Camera = "camera"
|
||||
|
||||
// Used when counting the number of containers
|
||||
ContainersKey = "containers"
|
||||
@@ -71,6 +74,8 @@ var topologyNames = []string{
|
||||
PersistentVolume,
|
||||
PersistentVolumeClaim,
|
||||
StorageClass,
|
||||
VolumeSnapshot,
|
||||
VolumeSnapshotData,
|
||||
}
|
||||
|
||||
// Report is the core data type. It's produced by probes, and consumed and
|
||||
@@ -171,6 +176,12 @@ type Report struct {
|
||||
// Metadata is limited for now, more to come later.
|
||||
StorageClass Topology
|
||||
|
||||
// VolumeSnapshot represent all Kubernetes Volume Snapshots on hosts running probes.
|
||||
VolumeSnapshot Topology
|
||||
|
||||
// VolumeSnapshotData represent all Kubernetes Volume Snapshot Data on hosts running probes.
|
||||
VolumeSnapshotData Topology
|
||||
|
||||
DNS DNSRecords
|
||||
|
||||
// Sampling data for this report.
|
||||
@@ -276,6 +287,16 @@ func MakeReport() Report {
|
||||
WithShape(StorageSheet).
|
||||
WithLabel("storage class", "storage classes"),
|
||||
|
||||
VolumeSnapshot: MakeTopology().
|
||||
WithShape(DottedCylinder).
|
||||
WithTag(Camera).
|
||||
WithLabel("volume snapshot", "volume snapshots"),
|
||||
|
||||
VolumeSnapshotData: MakeTopology().
|
||||
WithShape(Cylinder).
|
||||
WithTag(Camera).
|
||||
WithLabel("volume snapshot data", "volume snapshot data"),
|
||||
|
||||
DNS: DNSRecords{},
|
||||
|
||||
Sampling: Sampling{},
|
||||
@@ -388,6 +409,10 @@ func (r *Report) topology(name string) *Topology {
|
||||
return &r.PersistentVolumeClaim
|
||||
case StorageClass:
|
||||
return &r.StorageClass
|
||||
case VolumeSnapshot:
|
||||
return &r.VolumeSnapshot
|
||||
case VolumeSnapshotData:
|
||||
return &r.VolumeSnapshotData
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
// in the Node struct.
|
||||
type Topology struct {
|
||||
Shape string `json:"shape,omitempty"`
|
||||
Tag string `json:"tag,omitempty"`
|
||||
Label string `json:"label,omitempty"`
|
||||
LabelPlural string `json:"label_plural,omitempty"`
|
||||
Nodes Nodes `json:"nodes"`
|
||||
@@ -32,6 +33,7 @@ func MakeTopology() Topology {
|
||||
func (t Topology) WithMetadataTemplates(other MetadataTemplates) Topology {
|
||||
return Topology{
|
||||
Shape: t.Shape,
|
||||
Tag: t.Tag,
|
||||
Label: t.Label,
|
||||
LabelPlural: t.LabelPlural,
|
||||
Nodes: t.Nodes.Copy(),
|
||||
@@ -47,6 +49,7 @@ func (t Topology) WithMetadataTemplates(other MetadataTemplates) Topology {
|
||||
func (t Topology) WithMetricTemplates(other MetricTemplates) Topology {
|
||||
return Topology{
|
||||
Shape: t.Shape,
|
||||
Tag: t.Tag,
|
||||
Label: t.Label,
|
||||
LabelPlural: t.LabelPlural,
|
||||
Nodes: t.Nodes.Copy(),
|
||||
@@ -62,6 +65,7 @@ func (t Topology) WithMetricTemplates(other MetricTemplates) Topology {
|
||||
func (t Topology) WithTableTemplates(other TableTemplates) Topology {
|
||||
return Topology{
|
||||
Shape: t.Shape,
|
||||
Tag: t.Tag,
|
||||
Label: t.Label,
|
||||
LabelPlural: t.LabelPlural,
|
||||
Nodes: t.Nodes.Copy(),
|
||||
@@ -76,6 +80,22 @@ func (t Topology) WithTableTemplates(other TableTemplates) Topology {
|
||||
func (t Topology) WithShape(shape string) Topology {
|
||||
return Topology{
|
||||
Shape: shape,
|
||||
Tag: t.Tag,
|
||||
Label: t.Label,
|
||||
LabelPlural: t.LabelPlural,
|
||||
Nodes: t.Nodes.Copy(),
|
||||
Controls: t.Controls.Copy(),
|
||||
MetadataTemplates: t.MetadataTemplates.Copy(),
|
||||
MetricTemplates: t.MetricTemplates.Copy(),
|
||||
TableTemplates: t.TableTemplates.Copy(),
|
||||
}
|
||||
}
|
||||
|
||||
// WithTag sets the tag of nodes from this topology, returning a new topology.
|
||||
func (t Topology) WithTag(tag string) Topology {
|
||||
return Topology{
|
||||
Shape: t.Shape,
|
||||
Tag: tag,
|
||||
Label: t.Label,
|
||||
LabelPlural: t.LabelPlural,
|
||||
Nodes: t.Nodes.Copy(),
|
||||
@@ -90,6 +110,7 @@ func (t Topology) WithShape(shape string) Topology {
|
||||
func (t Topology) WithLabel(label, labelPlural string) Topology {
|
||||
return Topology{
|
||||
Shape: t.Shape,
|
||||
Tag: t.Tag,
|
||||
Label: label,
|
||||
LabelPlural: labelPlural,
|
||||
Nodes: t.Nodes.Copy(),
|
||||
@@ -130,6 +151,7 @@ func (t Topology) GetShape() string {
|
||||
func (t Topology) Copy() Topology {
|
||||
return Topology{
|
||||
Shape: t.Shape,
|
||||
Tag: t.Tag,
|
||||
Label: t.Label,
|
||||
LabelPlural: t.LabelPlural,
|
||||
Nodes: t.Nodes.Copy(),
|
||||
@@ -151,8 +173,13 @@ func (t Topology) Merge(other Topology) Topology {
|
||||
if label == "" {
|
||||
label, labelPlural = other.Label, other.LabelPlural
|
||||
}
|
||||
tag := t.Tag
|
||||
if tag == "" {
|
||||
tag = other.Tag
|
||||
}
|
||||
return Topology{
|
||||
Shape: shape,
|
||||
Tag: tag,
|
||||
Label: label,
|
||||
LabelPlural: labelPlural,
|
||||
Nodes: t.Nodes.Merge(other.Nodes),
|
||||
@@ -171,6 +198,9 @@ func (t *Topology) UnsafeMerge(other Topology) {
|
||||
if t.Label == "" {
|
||||
t.Label, t.LabelPlural = other.Label, other.LabelPlural
|
||||
}
|
||||
if t.Tag == "" {
|
||||
t.Tag = other.Tag
|
||||
}
|
||||
t.Nodes.UnsafeMerge(other.Nodes)
|
||||
t.Controls = t.Controls.Merge(other.Controls)
|
||||
t.MetadataTemplates = t.MetadataTemplates.Merge(other.MetadataTemplates)
|
||||
|
||||
@@ -107,6 +107,10 @@ var (
|
||||
PersistentVolumeClaimNodeID = report.MakePersistentVolumeClaimNodeID(PersistentVolumeClaimUID)
|
||||
StorageClassUID = "sc1234"
|
||||
StorageClassNodeID = report.MakeStorageClassNodeID(StorageClassUID)
|
||||
VolumeSnapshotUID = "vs1234"
|
||||
VolumeSnapshotNodeID = report.MakeVolumeSnapshotNodeID(VolumeSnapshotUID)
|
||||
VolumeSnapshotDataUID = "vsd1234"
|
||||
VolumeSnapshotDataNodeID = report.MakeVolumeSnapshotDataNodeID(VolumeSnapshotDataUID)
|
||||
|
||||
ClientProcess1CPUMetric = report.MakeSingletonMetric(Now.Add(-1*time.Second), 0.01)
|
||||
ClientProcess1MemoryMetric = report.MakeSingletonMetric(Now.Add(-2*time.Second), 0.02)
|
||||
@@ -396,6 +400,34 @@ var (
|
||||
WithTopology(report.StorageClass),
|
||||
},
|
||||
}.WithShape(report.StorageSheet).WithLabel("storage class", "storage classes"),
|
||||
VolumeSnapshot: report.Topology{
|
||||
Nodes: report.Nodes{
|
||||
VolumeSnapshotNodeID: report.MakeNodeWith(
|
||||
|
||||
VolumeSnapshotNodeID, map[string]string{
|
||||
kubernetes.Name: "vs-1234",
|
||||
kubernetes.Namespace: "ping",
|
||||
kubernetes.VolumeClaim: "pvc-6124",
|
||||
kubernetes.SnapshotData: "vsd-1234",
|
||||
kubernetes.VolumeName: "pongvolume",
|
||||
}).
|
||||
WithTopology(report.VolumeSnapshot),
|
||||
},
|
||||
}.WithShape(report.DottedCylinder).WithLabel("volume snapshot", "volume snapshots").
|
||||
WithTag(report.Camera),
|
||||
VolumeSnapshotData: report.Topology{
|
||||
Nodes: report.Nodes{
|
||||
VolumeSnapshotDataNodeID: report.MakeNodeWith(
|
||||
|
||||
VolumeSnapshotDataNodeID, map[string]string{
|
||||
kubernetes.Name: "vsd-1234",
|
||||
kubernetes.VolumeName: "pongvolume",
|
||||
kubernetes.VolumeSnapshotName: "vs-1234",
|
||||
}).
|
||||
WithTopology(report.VolumeSnapshotData),
|
||||
},
|
||||
}.WithShape(report.Cylinder).WithLabel("volume snapshot data", "volume snapshot data").
|
||||
WithTag(report.Camera),
|
||||
Sampling: report.Sampling{
|
||||
Count: 1024,
|
||||
Total: 4096,
|
||||
|
||||
+201
@@ -0,0 +1,201 @@
|
||||
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.
|
||||
Generated
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
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,register
|
||||
|
||||
// Package v1 is the v1 version of the API.
|
||||
// +groupName=volumesnapshot.external-storage.k8s.io
|
||||
package v1
|
||||
Generated
Vendored
+59
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1
|
||||
|
||||
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 = "volumesnapshot.external-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: "v1"}
|
||||
)
|
||||
|
||||
// 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,
|
||||
&VolumeSnapshot{},
|
||||
&VolumeSnapshotList{},
|
||||
&VolumeSnapshotData{},
|
||||
&VolumeSnapshotDataList{},
|
||||
)
|
||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||
return nil
|
||||
}
|
||||
Generated
Vendored
+291
@@ -0,0 +1,291 @@
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
core_v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
const (
|
||||
// VolumeSnapshotDataResourcePlural is "volumesnapshotdatas"
|
||||
VolumeSnapshotDataResourcePlural = "volumesnapshotdatas"
|
||||
// VolumeSnapshotResourcePlural is "volumesnapshots"
|
||||
VolumeSnapshotResourcePlural = "volumesnapshots"
|
||||
)
|
||||
|
||||
// VolumeSnapshotStatus is the status of the VolumeSnapshot
|
||||
type VolumeSnapshotStatus struct {
|
||||
// The time the snapshot was successfully created
|
||||
// +optional
|
||||
CreationTimestamp metav1.Time `json:"creationTimestamp" protobuf:"bytes,1,opt,name=creationTimestamp"`
|
||||
|
||||
// Represent the latest available observations about the volume snapshot
|
||||
Conditions []VolumeSnapshotCondition `json:"conditions" protobuf:"bytes,2,rep,name=conditions"`
|
||||
}
|
||||
|
||||
// VolumeSnapshotConditionType is the type of VolumeSnapshot conditions
|
||||
type VolumeSnapshotConditionType string
|
||||
|
||||
// These are valid conditions of a volume snapshot.
|
||||
const (
|
||||
// VolumeSnapshotConditionPending means the snapshot is cut and the application
|
||||
// can resume accessing data if core_v1.ConditionStatus is True. It corresponds
|
||||
// to "Uploading" in GCE PD or "Pending" in AWS and core_v1.ConditionStatus is True.
|
||||
// It also corresponds to "Creating" in OpenStack Cinder and core_v1.ConditionStatus
|
||||
// is Unknown.
|
||||
VolumeSnapshotConditionPending VolumeSnapshotConditionType = "Pending"
|
||||
// VolumeSnapshotConditionReady is added when the snapshot has been successfully created and is ready to be used.
|
||||
VolumeSnapshotConditionReady VolumeSnapshotConditionType = "Ready"
|
||||
// VolumeSnapshotConditionError means an error occurred during snapshot creation.
|
||||
VolumeSnapshotConditionError VolumeSnapshotConditionType = "Error"
|
||||
)
|
||||
|
||||
// VolumeSnapshotCondition describes the state of a volume snapshot at a certain point.
|
||||
type VolumeSnapshotCondition struct {
|
||||
// Type of replication controller condition.
|
||||
Type VolumeSnapshotConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=VolumeSnapshotConditionType"`
|
||||
// Status of the condition, one of True, False, Unknown.
|
||||
Status core_v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=ConditionStatus"`
|
||||
// The last time the condition transitioned from one status to another.
|
||||
// +optional
|
||||
LastTransitionTime metav1.Time `json:"lastTransitionTime" protobuf:"bytes,3,opt,name=lastTransitionTime"`
|
||||
// The reason for the condition's last transition.
|
||||
// +optional
|
||||
Reason string `json:"reason" protobuf:"bytes,4,opt,name=reason"`
|
||||
// A human readable message indicating details about the transition.
|
||||
// +optional
|
||||
Message string `json:"message" protobuf:"bytes,5,opt,name=message"`
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// VolumeSnapshot is the volume snapshot object accessible to the user. Upon succesful creation of the actual
|
||||
// snapshot by the volume provider it is bound to the corresponding VolumeSnapshotData through
|
||||
// the VolumeSnapshotSpec
|
||||
type VolumeSnapshot struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata"`
|
||||
|
||||
// Spec represents the desired state of the snapshot
|
||||
// +optional
|
||||
Spec VolumeSnapshotSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"`
|
||||
|
||||
// Status represents the latest observer state of the snapshot
|
||||
// +optional
|
||||
Status VolumeSnapshotStatus `json:"status" 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"`
|
||||
metav1.ListMeta `json:"metadata"`
|
||||
Items []VolumeSnapshot `json:"items"`
|
||||
}
|
||||
|
||||
// VolumeSnapshotSpec is the desired state of the volume snapshot
|
||||
type VolumeSnapshotSpec struct {
|
||||
// PersistentVolumeClaimName is the name of the PVC being snapshotted
|
||||
// +optional
|
||||
PersistentVolumeClaimName string `json:"persistentVolumeClaimName" protobuf:"bytes,1,opt,name=persistentVolumeClaimName"`
|
||||
|
||||
// SnapshotDataName binds the VolumeSnapshot object with the VolumeSnapshotData
|
||||
// +optional
|
||||
SnapshotDataName string `json:"snapshotDataName" protobuf:"bytes,2,opt,name=snapshotDataName"`
|
||||
}
|
||||
|
||||
// VolumeSnapshotDataStatus is the actual state of the volume snapshot
|
||||
type VolumeSnapshotDataStatus struct {
|
||||
// The time the snapshot was successfully created
|
||||
// +optional
|
||||
CreationTimestamp metav1.Time `json:"creationTimestamp" protobuf:"bytes,1,opt,name=creationTimestamp"`
|
||||
|
||||
// Representes the lates available observations about the volume snapshot
|
||||
Conditions []VolumeSnapshotDataCondition `json:"conditions" protobuf:"bytes,2,rep,name=conditions"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// VolumeSnapshotDataList is a list of VolumeSnapshotData objects
|
||||
type VolumeSnapshotDataList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata"`
|
||||
Items []VolumeSnapshotData `json:"items"`
|
||||
}
|
||||
|
||||
// VolumeSnapshotDataConditionType is the type of the VolumeSnapshotData condition
|
||||
type VolumeSnapshotDataConditionType string
|
||||
|
||||
// These are valid conditions of a volume snapshot.
|
||||
const (
|
||||
// VolumeSnapshotDataReady is added when the on-disk snapshot has been successfully created.
|
||||
VolumeSnapshotDataConditionReady VolumeSnapshotDataConditionType = "Ready"
|
||||
// VolumeSnapshotDataPending is added when the on-disk snapshot has been successfully created but is not available to use.
|
||||
VolumeSnapshotDataConditionPending VolumeSnapshotDataConditionType = "Pending"
|
||||
// VolumeSnapshotDataError is added but the on-disk snapshot is failed to created
|
||||
VolumeSnapshotDataConditionError VolumeSnapshotDataConditionType = "Error"
|
||||
)
|
||||
|
||||
// VolumeSnapshotDataCondition describes the state of a volume snapshot at a certain point.
|
||||
type VolumeSnapshotDataCondition struct {
|
||||
// Type of volume snapshot condition.
|
||||
Type VolumeSnapshotDataConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=VolumeSnapshotDataConditionType"`
|
||||
// Status of the condition, one of True, False, Unknown.
|
||||
Status core_v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=ConditionStatus"`
|
||||
// The last time the condition transitioned from one status to another.
|
||||
// +optional
|
||||
LastTransitionTime metav1.Time `json:"lastTransitionTime" protobuf:"bytes,3,opt,name=lastTransitionTime"`
|
||||
// The reason for the condition's last transition.
|
||||
// +optional
|
||||
Reason string `json:"reason" protobuf:"bytes,4,opt,name=reason"`
|
||||
// A human readable message indicating details about the transition.
|
||||
// +optional
|
||||
Message string `json:"message" protobuf:"bytes,5,opt,name=message"`
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +genclient:nonNamespaced
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// VolumeSnapshotData represents the actual "on-disk" snapshot object
|
||||
type VolumeSnapshotData struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata"`
|
||||
|
||||
// Spec represents the desired state of the snapshot
|
||||
// +optional
|
||||
Spec VolumeSnapshotDataSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"`
|
||||
|
||||
// Status represents the latest observed state of the snapshot
|
||||
// +optional
|
||||
Status VolumeSnapshotDataStatus `json:"status" protobuf:"bytes,3,opt,name=status"`
|
||||
}
|
||||
|
||||
// VolumeSnapshotDataSpec is the spec of the volume snapshot data
|
||||
type VolumeSnapshotDataSpec struct {
|
||||
// Source represents the location and type of the volume snapshot
|
||||
VolumeSnapshotDataSource `json:",inline" protobuf:"bytes,1,opt,name=volumeSnapshotDataSource"`
|
||||
|
||||
// VolumeSnapshotRef is part of bi-directional binding between VolumeSnapshot
|
||||
// and VolumeSnapshotData
|
||||
// +optional
|
||||
VolumeSnapshotRef *core_v1.ObjectReference `json:"volumeSnapshotRef" protobuf:"bytes,2,opt,name=volumeSnapshotRef"`
|
||||
|
||||
// PersistentVolumeRef represents the PersistentVolume that the snapshot has been
|
||||
// taken from
|
||||
// +optional
|
||||
PersistentVolumeRef *core_v1.ObjectReference `json:"persistentVolumeRef" protobuf:"bytes,3,opt,name=persistentVolumeRef"`
|
||||
}
|
||||
|
||||
// HostPathVolumeSnapshotSource is HostPath volume snapshot source
|
||||
type HostPathVolumeSnapshotSource struct {
|
||||
// Path represents a tar file that stores the HostPath volume source
|
||||
Path string `json:"snapshot"`
|
||||
}
|
||||
|
||||
// GlusterVolumeSnapshotSource is Gluster volume snapshot source
|
||||
type GlusterVolumeSnapshotSource struct {
|
||||
// UniqueID represents a snapshot resource.
|
||||
SnapshotID string `json:"snapshotId"`
|
||||
}
|
||||
|
||||
// AWSElasticBlockStoreVolumeSnapshotSource is AWS EBS volume snapshot source
|
||||
type AWSElasticBlockStoreVolumeSnapshotSource struct {
|
||||
// Unique id of the persistent disk snapshot resource. Used to identify the disk snapshot in AWS
|
||||
SnapshotID string `json:"snapshotId"`
|
||||
}
|
||||
|
||||
// CinderVolumeSnapshotSource is Cinder volume snapshot source
|
||||
type CinderVolumeSnapshotSource struct {
|
||||
// Unique id of the cinder volume snapshot resource. Used to identify the snapshot in OpenStack
|
||||
SnapshotID string `json:"snapshotId"`
|
||||
}
|
||||
|
||||
// GCEPersistentDiskSnapshotSource is GCE PD volume snapshot source
|
||||
type GCEPersistentDiskSnapshotSource struct {
|
||||
// Unique id of the persistent disk snapshot resource. Used to identify the disk snapshot in GCE
|
||||
SnapshotName string `json:"snapshotId"`
|
||||
}
|
||||
|
||||
// VolumeSnapshotDataSource represents the actual location and type of the snapshot. Only one of its members may be specified.
|
||||
type VolumeSnapshotDataSource struct {
|
||||
// HostPath represents a directory on the host.
|
||||
// Provisioned by a developer or tester.
|
||||
// This is useful for single-node development and testing only!
|
||||
// On-host storage is not supported in any way and WILL NOT WORK in a multi-node cluster.
|
||||
// More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath
|
||||
// +optional
|
||||
HostPath *HostPathVolumeSnapshotSource `json:"hostPath,omitempty"`
|
||||
// AWSElasticBlockStore represents an AWS Disk resource that is attached to a
|
||||
// kubelet's host machine and then exposed to the pod.
|
||||
// More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore
|
||||
// +optional
|
||||
//GlusterSnapshotSource represents a gluster snapshot resource
|
||||
GlusterSnapshotVolume *GlusterVolumeSnapshotSource `json:"glusterSnapshotVolume,omitempty"`
|
||||
// +optional
|
||||
AWSElasticBlockStore *AWSElasticBlockStoreVolumeSnapshotSource `json:"awsElasticBlockStore,omitempty"`
|
||||
// GCEPersistentDiskSnapshotSource represents an GCE PD snapshot resource
|
||||
// +optional
|
||||
GCEPersistentDiskSnapshot *GCEPersistentDiskSnapshotSource `json:"gcePersistentDisk,omitempty"`
|
||||
// CinderVolumeSnapshotSource represents Cinder snapshot resource
|
||||
// +optional
|
||||
CinderSnapshot *CinderVolumeSnapshotSource `json:"cinderVolume,omitempty"`
|
||||
}
|
||||
|
||||
// GetSupportedVolumeFromPVSpec gets supported volume from PV spec
|
||||
func GetSupportedVolumeFromPVSpec(spec *core_v1.PersistentVolumeSpec) string {
|
||||
if spec.HostPath != nil {
|
||||
return "hostPath"
|
||||
}
|
||||
if spec.AWSElasticBlockStore != nil {
|
||||
return "aws_ebs"
|
||||
}
|
||||
if spec.GCEPersistentDisk != nil {
|
||||
return "gce-pd"
|
||||
}
|
||||
if spec.Cinder != nil {
|
||||
return "cinder"
|
||||
}
|
||||
if spec.Glusterfs != nil {
|
||||
return "glusterfs"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// GetSupportedVolumeFromSnapshotDataSpec gets supported volume from snapshot data spec
|
||||
func GetSupportedVolumeFromSnapshotDataSpec(spec *VolumeSnapshotDataSpec) string {
|
||||
if spec.HostPath != nil {
|
||||
return "hostPath"
|
||||
}
|
||||
if spec.AWSElasticBlockStore != nil {
|
||||
return "aws_ebs"
|
||||
}
|
||||
if spec.GCEPersistentDiskSnapshot != nil {
|
||||
return "gce-pd"
|
||||
}
|
||||
if spec.CinderSnapshot != nil {
|
||||
return "cinder"
|
||||
}
|
||||
if spec.GlusterSnapshotVolume != nil {
|
||||
return "glusterfs"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
Generated
Vendored
+421
@@ -0,0 +1,421 @@
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
// Code generated by deepcopy-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
core_v1 "k8s.io/api/core/v1"
|
||||
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 *AWSElasticBlockStoreVolumeSnapshotSource) DeepCopyInto(out *AWSElasticBlockStoreVolumeSnapshotSource) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSElasticBlockStoreVolumeSnapshotSource.
|
||||
func (in *AWSElasticBlockStoreVolumeSnapshotSource) DeepCopy() *AWSElasticBlockStoreVolumeSnapshotSource {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(AWSElasticBlockStoreVolumeSnapshotSource)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *CinderVolumeSnapshotSource) DeepCopyInto(out *CinderVolumeSnapshotSource) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CinderVolumeSnapshotSource.
|
||||
func (in *CinderVolumeSnapshotSource) DeepCopy() *CinderVolumeSnapshotSource {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(CinderVolumeSnapshotSource)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *GCEPersistentDiskSnapshotSource) DeepCopyInto(out *GCEPersistentDiskSnapshotSource) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCEPersistentDiskSnapshotSource.
|
||||
func (in *GCEPersistentDiskSnapshotSource) DeepCopy() *GCEPersistentDiskSnapshotSource {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(GCEPersistentDiskSnapshotSource)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *GlusterVolumeSnapshotSource) DeepCopyInto(out *GlusterVolumeSnapshotSource) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GlusterVolumeSnapshotSource.
|
||||
func (in *GlusterVolumeSnapshotSource) DeepCopy() *GlusterVolumeSnapshotSource {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(GlusterVolumeSnapshotSource)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *HostPathVolumeSnapshotSource) DeepCopyInto(out *HostPathVolumeSnapshotSource) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HostPathVolumeSnapshotSource.
|
||||
func (in *HostPathVolumeSnapshotSource) DeepCopy() *HostPathVolumeSnapshotSource {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(HostPathVolumeSnapshotSource)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// 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)
|
||||
out.Spec = in.Spec
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
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 *VolumeSnapshotCondition) DeepCopyInto(out *VolumeSnapshotCondition) {
|
||||
*out = *in
|
||||
in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotCondition.
|
||||
func (in *VolumeSnapshotCondition) DeepCopy() *VolumeSnapshotCondition {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(VolumeSnapshotCondition)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *VolumeSnapshotData) DeepCopyInto(out *VolumeSnapshotData) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotData.
|
||||
func (in *VolumeSnapshotData) DeepCopy() *VolumeSnapshotData {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(VolumeSnapshotData)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *VolumeSnapshotData) 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 *VolumeSnapshotDataCondition) DeepCopyInto(out *VolumeSnapshotDataCondition) {
|
||||
*out = *in
|
||||
in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotDataCondition.
|
||||
func (in *VolumeSnapshotDataCondition) DeepCopy() *VolumeSnapshotDataCondition {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(VolumeSnapshotDataCondition)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *VolumeSnapshotDataList) DeepCopyInto(out *VolumeSnapshotDataList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
out.ListMeta = in.ListMeta
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]VolumeSnapshotData, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotDataList.
|
||||
func (in *VolumeSnapshotDataList) DeepCopy() *VolumeSnapshotDataList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(VolumeSnapshotDataList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *VolumeSnapshotDataList) 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 *VolumeSnapshotDataSource) DeepCopyInto(out *VolumeSnapshotDataSource) {
|
||||
*out = *in
|
||||
if in.HostPath != nil {
|
||||
in, out := &in.HostPath, &out.HostPath
|
||||
if *in == nil {
|
||||
*out = nil
|
||||
} else {
|
||||
*out = new(HostPathVolumeSnapshotSource)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
if in.GlusterSnapshotVolume != nil {
|
||||
in, out := &in.GlusterSnapshotVolume, &out.GlusterSnapshotVolume
|
||||
if *in == nil {
|
||||
*out = nil
|
||||
} else {
|
||||
*out = new(GlusterVolumeSnapshotSource)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
if in.AWSElasticBlockStore != nil {
|
||||
in, out := &in.AWSElasticBlockStore, &out.AWSElasticBlockStore
|
||||
if *in == nil {
|
||||
*out = nil
|
||||
} else {
|
||||
*out = new(AWSElasticBlockStoreVolumeSnapshotSource)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
if in.GCEPersistentDiskSnapshot != nil {
|
||||
in, out := &in.GCEPersistentDiskSnapshot, &out.GCEPersistentDiskSnapshot
|
||||
if *in == nil {
|
||||
*out = nil
|
||||
} else {
|
||||
*out = new(GCEPersistentDiskSnapshotSource)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
if in.CinderSnapshot != nil {
|
||||
in, out := &in.CinderSnapshot, &out.CinderSnapshot
|
||||
if *in == nil {
|
||||
*out = nil
|
||||
} else {
|
||||
*out = new(CinderVolumeSnapshotSource)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotDataSource.
|
||||
func (in *VolumeSnapshotDataSource) DeepCopy() *VolumeSnapshotDataSource {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(VolumeSnapshotDataSource)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *VolumeSnapshotDataSpec) DeepCopyInto(out *VolumeSnapshotDataSpec) {
|
||||
*out = *in
|
||||
in.VolumeSnapshotDataSource.DeepCopyInto(&out.VolumeSnapshotDataSource)
|
||||
if in.VolumeSnapshotRef != nil {
|
||||
in, out := &in.VolumeSnapshotRef, &out.VolumeSnapshotRef
|
||||
if *in == nil {
|
||||
*out = nil
|
||||
} else {
|
||||
*out = new(core_v1.ObjectReference)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
if in.PersistentVolumeRef != nil {
|
||||
in, out := &in.PersistentVolumeRef, &out.PersistentVolumeRef
|
||||
if *in == nil {
|
||||
*out = nil
|
||||
} else {
|
||||
*out = new(core_v1.ObjectReference)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotDataSpec.
|
||||
func (in *VolumeSnapshotDataSpec) DeepCopy() *VolumeSnapshotDataSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(VolumeSnapshotDataSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *VolumeSnapshotDataStatus) DeepCopyInto(out *VolumeSnapshotDataStatus) {
|
||||
*out = *in
|
||||
in.CreationTimestamp.DeepCopyInto(&out.CreationTimestamp)
|
||||
if in.Conditions != nil {
|
||||
in, out := &in.Conditions, &out.Conditions
|
||||
*out = make([]VolumeSnapshotDataCondition, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotDataStatus.
|
||||
func (in *VolumeSnapshotDataStatus) DeepCopy() *VolumeSnapshotDataStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(VolumeSnapshotDataStatus)
|
||||
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
|
||||
out.ListMeta = in.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 *VolumeSnapshotSpec) DeepCopyInto(out *VolumeSnapshotSpec) {
|
||||
*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
|
||||
in.CreationTimestamp.DeepCopyInto(&out.CreationTimestamp)
|
||||
if in.Conditions != nil {
|
||||
in, out := &in.Conditions, &out.Conditions
|
||||
*out = make([]VolumeSnapshotCondition, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
Generated
Vendored
+97
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package versioned
|
||||
|
||||
import (
|
||||
volumesnapshotv1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/typed/volumesnapshot/v1"
|
||||
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
|
||||
VolumesnapshotV1() volumesnapshotv1.VolumesnapshotV1Interface
|
||||
// Deprecated: please explicitly pick a version if possible.
|
||||
Volumesnapshot() volumesnapshotv1.VolumesnapshotV1Interface
|
||||
}
|
||||
|
||||
// Clientset contains the clients for groups. Each group has exactly one
|
||||
// version included in a Clientset.
|
||||
type Clientset struct {
|
||||
*discovery.DiscoveryClient
|
||||
volumesnapshotV1 *volumesnapshotv1.VolumesnapshotV1Client
|
||||
}
|
||||
|
||||
// VolumesnapshotV1 retrieves the VolumesnapshotV1Client
|
||||
func (c *Clientset) VolumesnapshotV1() volumesnapshotv1.VolumesnapshotV1Interface {
|
||||
return c.volumesnapshotV1
|
||||
}
|
||||
|
||||
// Deprecated: Volumesnapshot retrieves the default version of VolumesnapshotClient.
|
||||
// Please explicitly pick a version.
|
||||
func (c *Clientset) Volumesnapshot() volumesnapshotv1.VolumesnapshotV1Interface {
|
||||
return c.volumesnapshotV1
|
||||
}
|
||||
|
||||
// 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.
|
||||
func NewForConfig(c *rest.Config) (*Clientset, error) {
|
||||
configShallowCopy := *c
|
||||
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
|
||||
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
|
||||
}
|
||||
var cs Clientset
|
||||
var err error
|
||||
cs.volumesnapshotV1, err = volumesnapshotv1.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.volumesnapshotV1 = volumesnapshotv1.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.volumesnapshotV1 = volumesnapshotv1.New(c)
|
||||
|
||||
cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
|
||||
return &cs
|
||||
}
|
||||
Generated
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
// This package has the automatically generated clientset.
|
||||
package versioned
|
||||
Generated
Vendored
+81
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
clientset "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned"
|
||||
volumesnapshotv1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/typed/volumesnapshot/v1"
|
||||
fakevolumesnapshotv1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/typed/volumesnapshot/v1/fake"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
"k8s.io/client-go/discovery"
|
||||
fakediscovery "k8s.io/client-go/discovery/fake"
|
||||
"k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
// NewSimpleClientset returns a clientset that will respond with the provided objects.
|
||||
// It's backed by a very simple object tracker that processes creates, updates and deletions as-is,
|
||||
// without applying any validations and/or defaults. It shouldn't be considered a replacement
|
||||
// for a real clientset and is mostly useful in simple unit tests.
|
||||
func NewSimpleClientset(objects ...runtime.Object) *Clientset {
|
||||
o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder())
|
||||
for _, obj := range objects {
|
||||
if err := o.Add(obj); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
cs := &Clientset{}
|
||||
cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake}
|
||||
cs.AddReactor("*", "*", testing.ObjectReaction(o))
|
||||
cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
|
||||
gvr := action.GetResource()
|
||||
ns := action.GetNamespace()
|
||||
watch, err := o.Watch(gvr, ns)
|
||||
if err != nil {
|
||||
return false, nil, err
|
||||
}
|
||||
return true, watch, nil
|
||||
})
|
||||
|
||||
return cs
|
||||
}
|
||||
|
||||
// Clientset implements clientset.Interface. Meant to be embedded into a
|
||||
// struct to get a default implementation. This makes faking out just the method
|
||||
// you want to test easier.
|
||||
type Clientset struct {
|
||||
testing.Fake
|
||||
discovery *fakediscovery.FakeDiscovery
|
||||
}
|
||||
|
||||
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
|
||||
return c.discovery
|
||||
}
|
||||
|
||||
var _ clientset.Interface = &Clientset{}
|
||||
|
||||
// VolumesnapshotV1 retrieves the VolumesnapshotV1Client
|
||||
func (c *Clientset) VolumesnapshotV1() volumesnapshotv1.VolumesnapshotV1Interface {
|
||||
return &fakevolumesnapshotv1.FakeVolumesnapshotV1{Fake: &c.Fake}
|
||||
}
|
||||
|
||||
// Volumesnapshot retrieves the VolumesnapshotV1Client
|
||||
func (c *Clientset) Volumesnapshot() volumesnapshotv1.VolumesnapshotV1Interface {
|
||||
return &fakevolumesnapshotv1.FakeVolumesnapshotV1{Fake: &c.Fake}
|
||||
}
|
||||
Generated
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
// This package has the automatically generated fake clientset.
|
||||
package fake
|
||||
Generated
Vendored
+53
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
volumesnapshotv1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/apis/volumesnapshot/v1"
|
||||
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"
|
||||
)
|
||||
|
||||
var scheme = runtime.NewScheme()
|
||||
var codecs = serializer.NewCodecFactory(scheme)
|
||||
var parameterCodec = runtime.NewParameterCodec(scheme)
|
||||
|
||||
func init() {
|
||||
v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"})
|
||||
AddToScheme(scheme)
|
||||
}
|
||||
|
||||
// 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.
|
||||
func AddToScheme(scheme *runtime.Scheme) {
|
||||
volumesnapshotv1.AddToScheme(scheme)
|
||||
}
|
||||
Generated
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
// This package contains the scheme of the automatically generated clientset.
|
||||
package scheme
|
||||
Generated
Vendored
+53
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package scheme
|
||||
|
||||
import (
|
||||
volumesnapshotv1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/apis/volumesnapshot/v1"
|
||||
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"
|
||||
)
|
||||
|
||||
var Scheme = runtime.NewScheme()
|
||||
var Codecs = serializer.NewCodecFactory(Scheme)
|
||||
var ParameterCodec = runtime.NewParameterCodec(Scheme)
|
||||
|
||||
func init() {
|
||||
v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"})
|
||||
AddToScheme(Scheme)
|
||||
}
|
||||
|
||||
// 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.
|
||||
func AddToScheme(scheme *runtime.Scheme) {
|
||||
volumesnapshotv1.AddToScheme(scheme)
|
||||
}
|
||||
Generated
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
// This package has the automatically generated typed clients.
|
||||
package v1
|
||||
Generated
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
// Package fake has the automatically generated clients.
|
||||
package fake
|
||||
Generated
Vendored
+139
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
volumesnapshot_v1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/apis/volumesnapshot/v1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
// FakeVolumeSnapshots implements VolumeSnapshotInterface
|
||||
type FakeVolumeSnapshots struct {
|
||||
Fake *FakeVolumesnapshotV1
|
||||
ns string
|
||||
}
|
||||
|
||||
var volumesnapshotsResource = schema.GroupVersionResource{Group: "volumesnapshot.external-storage.k8s.io", Version: "v1", Resource: "volumesnapshots"}
|
||||
|
||||
var volumesnapshotsKind = schema.GroupVersionKind{Group: "volumesnapshot.external-storage.k8s.io", Version: "v1", Kind: "VolumeSnapshot"}
|
||||
|
||||
// Get takes name of the volumeSnapshot, and returns the corresponding volumeSnapshot object, and an error if there is any.
|
||||
func (c *FakeVolumeSnapshots) Get(name string, options v1.GetOptions) (result *volumesnapshot_v1.VolumeSnapshot, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(volumesnapshotsResource, c.ns, name), &volumesnapshot_v1.VolumeSnapshot{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*volumesnapshot_v1.VolumeSnapshot), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of VolumeSnapshots that match those selectors.
|
||||
func (c *FakeVolumeSnapshots) List(opts v1.ListOptions) (result *volumesnapshot_v1.VolumeSnapshotList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(volumesnapshotsResource, volumesnapshotsKind, c.ns, opts), &volumesnapshot_v1.VolumeSnapshotList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &volumesnapshot_v1.VolumeSnapshotList{ListMeta: obj.(*volumesnapshot_v1.VolumeSnapshotList).ListMeta}
|
||||
for _, item := range obj.(*volumesnapshot_v1.VolumeSnapshotList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested volumeSnapshots.
|
||||
func (c *FakeVolumeSnapshots) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(volumesnapshotsResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// 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 *FakeVolumeSnapshots) Create(volumeSnapshot *volumesnapshot_v1.VolumeSnapshot) (result *volumesnapshot_v1.VolumeSnapshot, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(volumesnapshotsResource, c.ns, volumeSnapshot), &volumesnapshot_v1.VolumeSnapshot{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*volumesnapshot_v1.VolumeSnapshot), err
|
||||
}
|
||||
|
||||
// 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 *FakeVolumeSnapshots) Update(volumeSnapshot *volumesnapshot_v1.VolumeSnapshot) (result *volumesnapshot_v1.VolumeSnapshot, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(volumesnapshotsResource, c.ns, volumeSnapshot), &volumesnapshot_v1.VolumeSnapshot{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*volumesnapshot_v1.VolumeSnapshot), err
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *FakeVolumeSnapshots) UpdateStatus(volumeSnapshot *volumesnapshot_v1.VolumeSnapshot) (*volumesnapshot_v1.VolumeSnapshot, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(volumesnapshotsResource, "status", c.ns, volumeSnapshot), &volumesnapshot_v1.VolumeSnapshot{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*volumesnapshot_v1.VolumeSnapshot), err
|
||||
}
|
||||
|
||||
// Delete takes name of the volumeSnapshot and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeVolumeSnapshots) Delete(name string, options *v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteAction(volumesnapshotsResource, c.ns, name), &volumesnapshot_v1.VolumeSnapshot{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeVolumeSnapshots) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(volumesnapshotsResource, c.ns, listOptions)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &volumesnapshot_v1.VolumeSnapshotList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched volumeSnapshot.
|
||||
func (c *FakeVolumeSnapshots) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *volumesnapshot_v1.VolumeSnapshot, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(volumesnapshotsResource, c.ns, name, data, subresources...), &volumesnapshot_v1.VolumeSnapshot{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*volumesnapshot_v1.VolumeSnapshot), err
|
||||
}
|
||||
Generated
Vendored
+43
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
v1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/typed/volumesnapshot/v1"
|
||||
rest "k8s.io/client-go/rest"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
type FakeVolumesnapshotV1 struct {
|
||||
*testing.Fake
|
||||
}
|
||||
|
||||
func (c *FakeVolumesnapshotV1) VolumeSnapshots(namespace string) v1.VolumeSnapshotInterface {
|
||||
return &FakeVolumeSnapshots{c, namespace}
|
||||
}
|
||||
|
||||
func (c *FakeVolumesnapshotV1) VolumeSnapshotDatas() v1.VolumeSnapshotDataInterface {
|
||||
return &FakeVolumeSnapshotDatas{c}
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *FakeVolumesnapshotV1) RESTClient() rest.Interface {
|
||||
var ret *rest.RESTClient
|
||||
return ret
|
||||
}
|
||||
Generated
Vendored
+130
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
volumesnapshot_v1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/apis/volumesnapshot/v1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
// FakeVolumeSnapshotDatas implements VolumeSnapshotDataInterface
|
||||
type FakeVolumeSnapshotDatas struct {
|
||||
Fake *FakeVolumesnapshotV1
|
||||
}
|
||||
|
||||
var volumesnapshotdatasResource = schema.GroupVersionResource{Group: "volumesnapshot.external-storage.k8s.io", Version: "v1", Resource: "volumesnapshotdatas"}
|
||||
|
||||
var volumesnapshotdatasKind = schema.GroupVersionKind{Group: "volumesnapshot.external-storage.k8s.io", Version: "v1", Kind: "VolumeSnapshotData"}
|
||||
|
||||
// Get takes name of the volumeSnapshotData, and returns the corresponding volumeSnapshotData object, and an error if there is any.
|
||||
func (c *FakeVolumeSnapshotDatas) Get(name string, options v1.GetOptions) (result *volumesnapshot_v1.VolumeSnapshotData, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootGetAction(volumesnapshotdatasResource, name), &volumesnapshot_v1.VolumeSnapshotData{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*volumesnapshot_v1.VolumeSnapshotData), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of VolumeSnapshotDatas that match those selectors.
|
||||
func (c *FakeVolumeSnapshotDatas) List(opts v1.ListOptions) (result *volumesnapshot_v1.VolumeSnapshotDataList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootListAction(volumesnapshotdatasResource, volumesnapshotdatasKind, opts), &volumesnapshot_v1.VolumeSnapshotDataList{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &volumesnapshot_v1.VolumeSnapshotDataList{ListMeta: obj.(*volumesnapshot_v1.VolumeSnapshotDataList).ListMeta}
|
||||
for _, item := range obj.(*volumesnapshot_v1.VolumeSnapshotDataList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested volumeSnapshotDatas.
|
||||
func (c *FakeVolumeSnapshotDatas) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewRootWatchAction(volumesnapshotdatasResource, opts))
|
||||
}
|
||||
|
||||
// Create takes the representation of a volumeSnapshotData and creates it. Returns the server's representation of the volumeSnapshotData, and an error, if there is any.
|
||||
func (c *FakeVolumeSnapshotDatas) Create(volumeSnapshotData *volumesnapshot_v1.VolumeSnapshotData) (result *volumesnapshot_v1.VolumeSnapshotData, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootCreateAction(volumesnapshotdatasResource, volumeSnapshotData), &volumesnapshot_v1.VolumeSnapshotData{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*volumesnapshot_v1.VolumeSnapshotData), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a volumeSnapshotData and updates it. Returns the server's representation of the volumeSnapshotData, and an error, if there is any.
|
||||
func (c *FakeVolumeSnapshotDatas) Update(volumeSnapshotData *volumesnapshot_v1.VolumeSnapshotData) (result *volumesnapshot_v1.VolumeSnapshotData, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootUpdateAction(volumesnapshotdatasResource, volumeSnapshotData), &volumesnapshot_v1.VolumeSnapshotData{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*volumesnapshot_v1.VolumeSnapshotData), err
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *FakeVolumeSnapshotDatas) UpdateStatus(volumeSnapshotData *volumesnapshot_v1.VolumeSnapshotData) (*volumesnapshot_v1.VolumeSnapshotData, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootUpdateSubresourceAction(volumesnapshotdatasResource, "status", volumeSnapshotData), &volumesnapshot_v1.VolumeSnapshotData{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*volumesnapshot_v1.VolumeSnapshotData), err
|
||||
}
|
||||
|
||||
// Delete takes name of the volumeSnapshotData and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeVolumeSnapshotDatas) Delete(name string, options *v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewRootDeleteAction(volumesnapshotdatasResource, name), &volumesnapshot_v1.VolumeSnapshotData{})
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeVolumeSnapshotDatas) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||
action := testing.NewRootDeleteCollectionAction(volumesnapshotdatasResource, listOptions)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &volumesnapshot_v1.VolumeSnapshotDataList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched volumeSnapshotData.
|
||||
func (c *FakeVolumeSnapshotDatas) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *volumesnapshot_v1.VolumeSnapshotData, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootPatchSubresourceAction(volumesnapshotdatasResource, name, data, subresources...), &volumesnapshot_v1.VolumeSnapshotData{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*volumesnapshot_v1.VolumeSnapshotData), err
|
||||
}
|
||||
Generated
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
type VolumeSnapshotExpansion interface{}
|
||||
|
||||
type VolumeSnapshotDataExpansion interface{}
|
||||
Generated
Vendored
+173
@@ -0,0 +1,173 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
v1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/apis/volumesnapshot/v1"
|
||||
scheme "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/scheme"
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// 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(*v1.VolumeSnapshot) (*v1.VolumeSnapshot, error)
|
||||
Update(*v1.VolumeSnapshot) (*v1.VolumeSnapshot, error)
|
||||
UpdateStatus(*v1.VolumeSnapshot) (*v1.VolumeSnapshot, error)
|
||||
Delete(name string, options *meta_v1.DeleteOptions) error
|
||||
DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error
|
||||
Get(name string, options meta_v1.GetOptions) (*v1.VolumeSnapshot, error)
|
||||
List(opts meta_v1.ListOptions) (*v1.VolumeSnapshotList, error)
|
||||
Watch(opts meta_v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.VolumeSnapshot, err error)
|
||||
VolumeSnapshotExpansion
|
||||
}
|
||||
|
||||
// volumeSnapshots implements VolumeSnapshotInterface
|
||||
type volumeSnapshots struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newVolumeSnapshots returns a VolumeSnapshots
|
||||
func newVolumeSnapshots(c *VolumesnapshotV1Client, 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 meta_v1.GetOptions) (result *v1.VolumeSnapshot, err error) {
|
||||
result = &v1.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 meta_v1.ListOptions) (result *v1.VolumeSnapshotList, err error) {
|
||||
result = &v1.VolumeSnapshotList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("volumesnapshots").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested volumeSnapshots.
|
||||
func (c *volumeSnapshots) Watch(opts meta_v1.ListOptions) (watch.Interface, error) {
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("volumesnapshots").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
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 *v1.VolumeSnapshot) (result *v1.VolumeSnapshot, err error) {
|
||||
result = &v1.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 *v1.VolumeSnapshot) (result *v1.VolumeSnapshot, err error) {
|
||||
result = &v1.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 *v1.VolumeSnapshot) (result *v1.VolumeSnapshot, err error) {
|
||||
result = &v1.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 *meta_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 *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("volumesnapshots").
|
||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||
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 *v1.VolumeSnapshot, err error) {
|
||||
result = &v1.VolumeSnapshot{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("volumesnapshots").
|
||||
SubResource(subresources...).
|
||||
Name(name).
|
||||
Body(data).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
Generated
Vendored
+94
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
v1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/apis/volumesnapshot/v1"
|
||||
"github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/scheme"
|
||||
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
type VolumesnapshotV1Interface interface {
|
||||
RESTClient() rest.Interface
|
||||
VolumeSnapshotsGetter
|
||||
VolumeSnapshotDatasGetter
|
||||
}
|
||||
|
||||
// VolumesnapshotV1Client is used to interact with features provided by the volumesnapshot.external-storage.k8s.io group.
|
||||
type VolumesnapshotV1Client struct {
|
||||
restClient rest.Interface
|
||||
}
|
||||
|
||||
func (c *VolumesnapshotV1Client) VolumeSnapshots(namespace string) VolumeSnapshotInterface {
|
||||
return newVolumeSnapshots(c, namespace)
|
||||
}
|
||||
|
||||
func (c *VolumesnapshotV1Client) VolumeSnapshotDatas() VolumeSnapshotDataInterface {
|
||||
return newVolumeSnapshotDatas(c)
|
||||
}
|
||||
|
||||
// NewForConfig creates a new VolumesnapshotV1Client for the given config.
|
||||
func NewForConfig(c *rest.Config) (*VolumesnapshotV1Client, error) {
|
||||
config := *c
|
||||
if err := setConfigDefaults(&config); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client, err := rest.RESTClientFor(&config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &VolumesnapshotV1Client{client}, nil
|
||||
}
|
||||
|
||||
// NewForConfigOrDie creates a new VolumesnapshotV1Client for the given config and
|
||||
// panics if there is an error in the config.
|
||||
func NewForConfigOrDie(c *rest.Config) *VolumesnapshotV1Client {
|
||||
client, err := NewForConfig(c)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return client
|
||||
}
|
||||
|
||||
// New creates a new VolumesnapshotV1Client for the given RESTClient.
|
||||
func New(c rest.Interface) *VolumesnapshotV1Client {
|
||||
return &VolumesnapshotV1Client{c}
|
||||
}
|
||||
|
||||
func setConfigDefaults(config *rest.Config) error {
|
||||
gv := v1.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs}
|
||||
|
||||
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 *VolumesnapshotV1Client) RESTClient() rest.Interface {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
return c.restClient
|
||||
}
|
||||
Generated
Vendored
+162
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
v1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/apis/volumesnapshot/v1"
|
||||
scheme "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned/scheme"
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// VolumeSnapshotDatasGetter has a method to return a VolumeSnapshotDataInterface.
|
||||
// A group's client should implement this interface.
|
||||
type VolumeSnapshotDatasGetter interface {
|
||||
VolumeSnapshotDatas() VolumeSnapshotDataInterface
|
||||
}
|
||||
|
||||
// VolumeSnapshotDataInterface has methods to work with VolumeSnapshotData resources.
|
||||
type VolumeSnapshotDataInterface interface {
|
||||
Create(*v1.VolumeSnapshotData) (*v1.VolumeSnapshotData, error)
|
||||
Update(*v1.VolumeSnapshotData) (*v1.VolumeSnapshotData, error)
|
||||
UpdateStatus(*v1.VolumeSnapshotData) (*v1.VolumeSnapshotData, error)
|
||||
Delete(name string, options *meta_v1.DeleteOptions) error
|
||||
DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error
|
||||
Get(name string, options meta_v1.GetOptions) (*v1.VolumeSnapshotData, error)
|
||||
List(opts meta_v1.ListOptions) (*v1.VolumeSnapshotDataList, error)
|
||||
Watch(opts meta_v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.VolumeSnapshotData, err error)
|
||||
VolumeSnapshotDataExpansion
|
||||
}
|
||||
|
||||
// volumeSnapshotDatas implements VolumeSnapshotDataInterface
|
||||
type volumeSnapshotDatas struct {
|
||||
client rest.Interface
|
||||
}
|
||||
|
||||
// newVolumeSnapshotDatas returns a VolumeSnapshotDatas
|
||||
func newVolumeSnapshotDatas(c *VolumesnapshotV1Client) *volumeSnapshotDatas {
|
||||
return &volumeSnapshotDatas{
|
||||
client: c.RESTClient(),
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the volumeSnapshotData, and returns the corresponding volumeSnapshotData object, and an error if there is any.
|
||||
func (c *volumeSnapshotDatas) Get(name string, options meta_v1.GetOptions) (result *v1.VolumeSnapshotData, err error) {
|
||||
result = &v1.VolumeSnapshotData{}
|
||||
err = c.client.Get().
|
||||
Resource("volumesnapshotdatas").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of VolumeSnapshotDatas that match those selectors.
|
||||
func (c *volumeSnapshotDatas) List(opts meta_v1.ListOptions) (result *v1.VolumeSnapshotDataList, err error) {
|
||||
result = &v1.VolumeSnapshotDataList{}
|
||||
err = c.client.Get().
|
||||
Resource("volumesnapshotdatas").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested volumeSnapshotDatas.
|
||||
func (c *volumeSnapshotDatas) Watch(opts meta_v1.ListOptions) (watch.Interface, error) {
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Resource("volumesnapshotdatas").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Watch()
|
||||
}
|
||||
|
||||
// Create takes the representation of a volumeSnapshotData and creates it. Returns the server's representation of the volumeSnapshotData, and an error, if there is any.
|
||||
func (c *volumeSnapshotDatas) Create(volumeSnapshotData *v1.VolumeSnapshotData) (result *v1.VolumeSnapshotData, err error) {
|
||||
result = &v1.VolumeSnapshotData{}
|
||||
err = c.client.Post().
|
||||
Resource("volumesnapshotdatas").
|
||||
Body(volumeSnapshotData).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a volumeSnapshotData and updates it. Returns the server's representation of the volumeSnapshotData, and an error, if there is any.
|
||||
func (c *volumeSnapshotDatas) Update(volumeSnapshotData *v1.VolumeSnapshotData) (result *v1.VolumeSnapshotData, err error) {
|
||||
result = &v1.VolumeSnapshotData{}
|
||||
err = c.client.Put().
|
||||
Resource("volumesnapshotdatas").
|
||||
Name(volumeSnapshotData.Name).
|
||||
Body(volumeSnapshotData).
|
||||
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 *volumeSnapshotDatas) UpdateStatus(volumeSnapshotData *v1.VolumeSnapshotData) (result *v1.VolumeSnapshotData, err error) {
|
||||
result = &v1.VolumeSnapshotData{}
|
||||
err = c.client.Put().
|
||||
Resource("volumesnapshotdatas").
|
||||
Name(volumeSnapshotData.Name).
|
||||
SubResource("status").
|
||||
Body(volumeSnapshotData).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the volumeSnapshotData and deletes it. Returns an error if one occurs.
|
||||
func (c *volumeSnapshotDatas) Delete(name string, options *meta_v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Resource("volumesnapshotdatas").
|
||||
Name(name).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *volumeSnapshotDatas) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error {
|
||||
return c.client.Delete().
|
||||
Resource("volumesnapshotdatas").
|
||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||
Body(options).
|
||||
Do().
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched volumeSnapshotData.
|
||||
func (c *volumeSnapshotDatas) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.VolumeSnapshotData, err error) {
|
||||
result = &v1.VolumeSnapshotData{}
|
||||
err = c.client.Patch(pt).
|
||||
Resource("volumesnapshotdatas").
|
||||
SubResource(subresources...).
|
||||
Name(name).
|
||||
Body(data).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
Generated
Vendored
+179
@@ -0,0 +1,179 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package externalversions
|
||||
|
||||
import (
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
time "time"
|
||||
|
||||
versioned "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned"
|
||||
internalinterfaces "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/informers/externalversions/internalinterfaces"
|
||||
volumesnapshot "github.com/openebs/k8s-snapshot-client/snapshot/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
|
||||
|
||||
Volumesnapshot() volumesnapshot.Interface
|
||||
}
|
||||
|
||||
func (f *sharedInformerFactory) Volumesnapshot() volumesnapshot.Interface {
|
||||
return volumesnapshot.New(f, f.namespace, f.tweakListOptions)
|
||||
}
|
||||
Generated
Vendored
+63
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package externalversions
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
v1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/apis/volumesnapshot/v1"
|
||||
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=volumesnapshot.external-storage.k8s.io, Version=v1
|
||||
case v1.SchemeGroupVersion.WithResource("volumesnapshots"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Volumesnapshot().V1().VolumeSnapshots().Informer()}, nil
|
||||
case v1.SchemeGroupVersion.WithResource("volumesnapshotdatas"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Volumesnapshot().V1().VolumeSnapshotDatas().Informer()}, nil
|
||||
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("no informer found for %v", resource)
|
||||
}
|
||||
Generated
Vendored
+37
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package internalinterfaces
|
||||
|
||||
import (
|
||||
time "time"
|
||||
|
||||
versioned "github.com/openebs/k8s-snapshot-client/snapshot/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"
|
||||
)
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
type TweakListOptionsFunc func(*v1.ListOptions)
|
||||
Generated
Vendored
+45
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package volumesnapshot
|
||||
|
||||
import (
|
||||
internalinterfaces "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/informers/externalversions/internalinterfaces"
|
||||
v1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/informers/externalversions/volumesnapshot/v1"
|
||||
)
|
||||
|
||||
// Interface provides access to each of this group's versions.
|
||||
type Interface interface {
|
||||
// V1 provides access to shared informers for resources in V1.
|
||||
V1() v1.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}
|
||||
}
|
||||
|
||||
// V1 returns a new v1.Interface.
|
||||
func (g *group) V1() v1.Interface {
|
||||
return v1.New(g.factory, g.namespace, g.tweakListOptions)
|
||||
}
|
||||
Generated
Vendored
+51
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
internalinterfaces "github.com/openebs/k8s-snapshot-client/snapshot/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
|
||||
// VolumeSnapshotDatas returns a VolumeSnapshotDataInformer.
|
||||
VolumeSnapshotDatas() VolumeSnapshotDataInformer
|
||||
}
|
||||
|
||||
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}
|
||||
}
|
||||
|
||||
// VolumeSnapshotDatas returns a VolumeSnapshotDataInformer.
|
||||
func (v *version) VolumeSnapshotDatas() VolumeSnapshotDataInformer {
|
||||
return &volumeSnapshotDataInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
Generated
Vendored
+88
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
time "time"
|
||||
|
||||
volumesnapshot_v1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/apis/volumesnapshot/v1"
|
||||
versioned "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned"
|
||||
internalinterfaces "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/informers/externalversions/internalinterfaces"
|
||||
v1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/listers/volumesnapshot/v1"
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// VolumeSnapshotInformer provides access to a shared informer and lister for
|
||||
// VolumeSnapshots.
|
||||
type VolumeSnapshotInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() v1.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 meta_v1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.VolumesnapshotV1().VolumeSnapshots(namespace).List(options)
|
||||
},
|
||||
WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.VolumesnapshotV1().VolumeSnapshots(namespace).Watch(options)
|
||||
},
|
||||
},
|
||||
&volumesnapshot_v1.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(&volumesnapshot_v1.VolumeSnapshot{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *volumeSnapshotInformer) Lister() v1.VolumeSnapshotLister {
|
||||
return v1.NewVolumeSnapshotLister(f.Informer().GetIndexer())
|
||||
}
|
||||
Generated
Vendored
+87
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
time "time"
|
||||
|
||||
volumesnapshot_v1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/apis/volumesnapshot/v1"
|
||||
versioned "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/clientset/versioned"
|
||||
internalinterfaces "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/informers/externalversions/internalinterfaces"
|
||||
v1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/client/listers/volumesnapshot/v1"
|
||||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// VolumeSnapshotDataInformer provides access to a shared informer and lister for
|
||||
// VolumeSnapshotDatas.
|
||||
type VolumeSnapshotDataInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() v1.VolumeSnapshotDataLister
|
||||
}
|
||||
|
||||
type volumeSnapshotDataInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
}
|
||||
|
||||
// NewVolumeSnapshotDataInformer constructs a new informer for VolumeSnapshotData 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 NewVolumeSnapshotDataInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredVolumeSnapshotDataInformer(client, resyncPeriod, indexers, nil)
|
||||
}
|
||||
|
||||
// NewFilteredVolumeSnapshotDataInformer constructs a new informer for VolumeSnapshotData 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 NewFilteredVolumeSnapshotDataInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||
return cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.VolumesnapshotV1().VolumeSnapshotDatas().List(options)
|
||||
},
|
||||
WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.VolumesnapshotV1().VolumeSnapshotDatas().Watch(options)
|
||||
},
|
||||
},
|
||||
&volumesnapshot_v1.VolumeSnapshotData{},
|
||||
resyncPeriod,
|
||||
indexers,
|
||||
)
|
||||
}
|
||||
|
||||
func (f *volumeSnapshotDataInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredVolumeSnapshotDataInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *volumeSnapshotDataInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&volumesnapshot_v1.VolumeSnapshotData{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *volumeSnapshotDataInformer) Lister() v1.VolumeSnapshotDataLister {
|
||||
return v1.NewVolumeSnapshotDataLister(f.Informer().GetIndexer())
|
||||
}
|
||||
Generated
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
// Code generated by lister-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
// VolumeSnapshotListerExpansion allows custom methods to be added to
|
||||
// VolumeSnapshotLister.
|
||||
type VolumeSnapshotListerExpansion interface{}
|
||||
|
||||
// VolumeSnapshotNamespaceListerExpansion allows custom methods to be added to
|
||||
// VolumeSnapshotNamespaceLister.
|
||||
type VolumeSnapshotNamespaceListerExpansion interface{}
|
||||
|
||||
// VolumeSnapshotDataListerExpansion allows custom methods to be added to
|
||||
// VolumeSnapshotDataLister.
|
||||
type VolumeSnapshotDataListerExpansion interface{}
|
||||
Generated
Vendored
+93
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
// Code generated by lister-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
v1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/apis/volumesnapshot/v1"
|
||||
"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 []*v1.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 []*v1.VolumeSnapshot, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1.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 []*v1.VolumeSnapshot, err error)
|
||||
// Get retrieves the VolumeSnapshot from the indexer for a given namespace and name.
|
||||
Get(name string) (*v1.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 []*v1.VolumeSnapshot, err error) {
|
||||
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1.VolumeSnapshot))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Get retrieves the VolumeSnapshot from the indexer for a given namespace and name.
|
||||
func (s volumeSnapshotNamespaceLister) Get(name string) (*v1.VolumeSnapshot, error) {
|
||||
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(v1.Resource("volumesnapshot"), name)
|
||||
}
|
||||
return obj.(*v1.VolumeSnapshot), nil
|
||||
}
|
||||
Generated
Vendored
+64
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
// Code generated by lister-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
v1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/apis/volumesnapshot/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// VolumeSnapshotDataLister helps list VolumeSnapshotDatas.
|
||||
type VolumeSnapshotDataLister interface {
|
||||
// List lists all VolumeSnapshotDatas in the indexer.
|
||||
List(selector labels.Selector) (ret []*v1.VolumeSnapshotData, err error)
|
||||
// Get retrieves the VolumeSnapshotData from the index for a given name.
|
||||
Get(name string) (*v1.VolumeSnapshotData, error)
|
||||
VolumeSnapshotDataListerExpansion
|
||||
}
|
||||
|
||||
// volumeSnapshotDataLister implements the VolumeSnapshotDataLister interface.
|
||||
type volumeSnapshotDataLister struct {
|
||||
indexer cache.Indexer
|
||||
}
|
||||
|
||||
// NewVolumeSnapshotDataLister returns a new VolumeSnapshotDataLister.
|
||||
func NewVolumeSnapshotDataLister(indexer cache.Indexer) VolumeSnapshotDataLister {
|
||||
return &volumeSnapshotDataLister{indexer: indexer}
|
||||
}
|
||||
|
||||
// List lists all VolumeSnapshotDatas in the indexer.
|
||||
func (s *volumeSnapshotDataLister) List(selector labels.Selector) (ret []*v1.VolumeSnapshotData, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1.VolumeSnapshotData))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Get retrieves the VolumeSnapshotData from the index for a given name.
|
||||
func (s *volumeSnapshotDataLister) Get(name string) (*v1.VolumeSnapshotData, error) {
|
||||
obj, exists, err := s.indexer.GetByKey(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(v1.Resource("volumesnapshotdata"), name)
|
||||
}
|
||||
return obj.(*v1.VolumeSnapshotData), nil
|
||||
}
|
||||
Vendored
+8
@@ -1650,6 +1650,14 @@
|
||||
"path": "vendor/golang.org/x/sys/windows",
|
||||
"notests": true
|
||||
},
|
||||
{
|
||||
"importpath": "github.com/openebs/k8s-snapshot-client",
|
||||
"repository": "https://github.com/openebs/k8s-snapshot-client",
|
||||
"vcs": "git",
|
||||
"revision": "a6506305fb16b003487392c8199452b01161866e",
|
||||
"branch": "master",
|
||||
"notests": true
|
||||
},
|
||||
{
|
||||
"importpath": "github.com/opentracing-contrib/go-stdlib/nethttp",
|
||||
"repository": "https://github.com/opentracing-contrib/go-stdlib",
|
||||
|
||||
Reference in New Issue
Block a user