Update go dependencies
This commit is contained in:
parent
e0561ddeb9
commit
88a2751234
1970 changed files with 413928 additions and 222867 deletions
105
vendor/k8s.io/kubernetes/pkg/volume/plugins.go
generated
vendored
105
vendor/k8s.io/kubernetes/pkg/volume/plugins.go
generated
vendored
|
|
@ -23,14 +23,15 @@ import (
|
|||
"sync"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
utilerrors "k8s.io/apimachinery/pkg/util/errors"
|
||||
"k8s.io/apimachinery/pkg/util/validation"
|
||||
"k8s.io/kubernetes/pkg/api/v1"
|
||||
"k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
|
||||
"k8s.io/kubernetes/pkg/cloudprovider"
|
||||
"k8s.io/kubernetes/pkg/types"
|
||||
utilerrors "k8s.io/kubernetes/pkg/util/errors"
|
||||
"k8s.io/kubernetes/pkg/util/io"
|
||||
"k8s.io/kubernetes/pkg/util/mount"
|
||||
"k8s.io/kubernetes/pkg/util/validation"
|
||||
)
|
||||
|
||||
// VolumeOptions contains option information about a volume.
|
||||
|
|
@ -40,15 +41,17 @@ type VolumeOptions struct {
|
|||
// many kinds of provisioners.
|
||||
|
||||
// Reclamation policy for a persistent volume
|
||||
PersistentVolumeReclaimPolicy api.PersistentVolumeReclaimPolicy
|
||||
// PV.Name of the appropriate PersistentVolume. Used to generate cloud
|
||||
// volume name.
|
||||
PersistentVolumeReclaimPolicy v1.PersistentVolumeReclaimPolicy
|
||||
// Suggested PV.Name of the PersistentVolume to provision.
|
||||
// This is a generated name guaranteed to be unique in Kubernetes cluster.
|
||||
// If you choose not to use it as volume name, ensure uniqueness by either
|
||||
// combining it with your value or create unique values of your own.
|
||||
PVName string
|
||||
// PVC is reference to the claim that lead to provisioning of a new PV.
|
||||
// Provisioners *must* create a PV that would be matched by this PVC,
|
||||
// i.e. with required capacity, accessMode, labels matching PVC.Selector and
|
||||
// so on.
|
||||
PVC *api.PersistentVolumeClaim
|
||||
PVC *v1.PersistentVolumeClaim
|
||||
// Unique name of Kubernetes cluster.
|
||||
ClusterName string
|
||||
// Tags to attach to the real volume in the cloud provider - e.g. AWS EBS
|
||||
|
|
@ -90,12 +93,12 @@ type VolumePlugin interface {
|
|||
|
||||
// NewMounter creates a new volume.Mounter from an API specification.
|
||||
// Ownership of the spec pointer in *not* transferred.
|
||||
// - spec: The api.Volume spec
|
||||
// - spec: The v1.Volume spec
|
||||
// - pod: The enclosing pod
|
||||
NewMounter(spec *Spec, podRef *api.Pod, opts VolumeOptions) (Mounter, error)
|
||||
NewMounter(spec *Spec, podRef *v1.Pod, opts VolumeOptions) (Mounter, error)
|
||||
|
||||
// NewUnmounter creates a new volume.Unmounter from recoverable state.
|
||||
// - name: The volume name, as per the api.Volume spec.
|
||||
// - name: The volume name, as per the v1.Volume spec.
|
||||
// - podUID: The UID of the enclosing pod
|
||||
NewUnmounter(name string, podUID types.UID) (Unmounter, error)
|
||||
|
||||
|
|
@ -104,6 +107,16 @@ type VolumePlugin interface {
|
|||
// information from input. This function is used by volume manager to reconstruct
|
||||
// volume spec by reading the volume directories from disk
|
||||
ConstructVolumeSpec(volumeName, mountPath string) (*Spec, error)
|
||||
|
||||
// SupportsMountOption returns true if volume plugins supports Mount options
|
||||
// Specifying mount options in a volume plugin that doesn't support
|
||||
// user specified mount options will result in error creating persistent volumes
|
||||
SupportsMountOption() bool
|
||||
|
||||
// SupportsBulkVolumeVerification checks if volume plugin type is capable
|
||||
// of enabling bulk polling of all nodes. This can speed up verification of
|
||||
// attached volumes by quite a bit, but underlying pluging must support it.
|
||||
SupportsBulkVolumeVerification() bool
|
||||
}
|
||||
|
||||
// PersistentVolumePlugin is an extended interface of VolumePlugin and is used
|
||||
|
|
@ -111,7 +124,7 @@ type VolumePlugin interface {
|
|||
type PersistentVolumePlugin interface {
|
||||
VolumePlugin
|
||||
// GetAccessModes describes the ways a given volume can be accessed/mounted.
|
||||
GetAccessModes() []api.PersistentVolumeAccessMode
|
||||
GetAccessModes() []v1.PersistentVolumeAccessMode
|
||||
}
|
||||
|
||||
// RecyclableVolumePlugin is an extended interface of VolumePlugin and is used
|
||||
|
|
@ -119,12 +132,13 @@ type PersistentVolumePlugin interface {
|
|||
// again to new claims
|
||||
type RecyclableVolumePlugin interface {
|
||||
VolumePlugin
|
||||
// NewRecycler creates a new volume.Recycler which knows how to reclaim this
|
||||
// resource after the volume's release from a PersistentVolumeClaim. The
|
||||
// recycler will use the provided recorder to write any events that might be
|
||||
|
||||
// Recycle knows how to reclaim this
|
||||
// resource after the volume's release from a PersistentVolumeClaim.
|
||||
// Recycle will use the provided recorder to write any events that might be
|
||||
// interesting to user. It's expected that caller will pass these events to
|
||||
// the PV being recycled.
|
||||
NewRecycler(pvName string, spec *Spec, eventRecorder RecycleEventRecorder) (Recycler, error)
|
||||
Recycle(pvName string, spec *Spec, eventRecorder RecycleEventRecorder) error
|
||||
}
|
||||
|
||||
// DeletableVolumePlugin is an extended interface of VolumePlugin and is used
|
||||
|
|
@ -142,6 +156,8 @@ const (
|
|||
// Name of a volume in external cloud that is being provisioned and thus
|
||||
// should be ignored by rest of Kubernetes.
|
||||
ProvisionedVolumeName = "placeholder-for-provisioning"
|
||||
// Mount options annotations
|
||||
MountOptionAnnotation = "volume.beta.kubernetes.io/mount-options"
|
||||
)
|
||||
|
||||
// ProvisionableVolumePlugin is an extended interface of VolumePlugin and is
|
||||
|
|
@ -190,7 +206,7 @@ type VolumeHost interface {
|
|||
// the provided spec. This is used to implement volume plugins which
|
||||
// "wrap" other plugins. For example, the "secret" volume is
|
||||
// implemented in terms of the "emptyDir" volume.
|
||||
NewWrapperMounter(volName string, spec Spec, pod *api.Pod, opts VolumeOptions) (Mounter, error)
|
||||
NewWrapperMounter(volName string, spec Spec, pod *v1.Pod, opts VolumeOptions) (Mounter, error)
|
||||
|
||||
// NewWrapperUnmounter finds an appropriate plugin with which to handle
|
||||
// the provided spec. See comments on NewWrapperMounter for more
|
||||
|
|
@ -212,8 +228,11 @@ type VolumeHost interface {
|
|||
// Returns host IP or nil in the case of error.
|
||||
GetHostIP() (net.IP, error)
|
||||
|
||||
// Returns node allocatable
|
||||
GetNodeAllocatable() (api.ResourceList, error)
|
||||
// Returns node allocatable.
|
||||
GetNodeAllocatable() (v1.ResourceList, error)
|
||||
|
||||
// Returns a function that returns a secret.
|
||||
GetSecretFunc() func(namespace, name string) (*v1.Secret, error)
|
||||
}
|
||||
|
||||
// VolumePluginMgr tracks registered plugins.
|
||||
|
|
@ -224,8 +243,8 @@ type VolumePluginMgr struct {
|
|||
|
||||
// Spec is an internal representation of a volume. All API volume types translate to Spec.
|
||||
type Spec struct {
|
||||
Volume *api.Volume
|
||||
PersistentVolume *api.PersistentVolume
|
||||
Volume *v1.Volume
|
||||
PersistentVolume *v1.PersistentVolume
|
||||
ReadOnly bool
|
||||
}
|
||||
|
||||
|
|
@ -269,7 +288,7 @@ type VolumeConfig struct {
|
|||
// which override specific properties of the pod in accordance with that
|
||||
// plugin. See NewPersistentVolumeRecyclerPodTemplate for the properties
|
||||
// that are expected to be overridden.
|
||||
RecyclerPodTemplate *api.Pod
|
||||
RecyclerPodTemplate *v1.Pod
|
||||
|
||||
// RecyclerMinimumTimeout is the minimum amount of time in seconds for the
|
||||
// recycler pod's ActiveDeadlineSeconds attribute. Added to the minimum
|
||||
|
|
@ -296,15 +315,15 @@ type VolumeConfig struct {
|
|||
ProvisioningEnabled bool
|
||||
}
|
||||
|
||||
// NewSpecFromVolume creates an Spec from an api.Volume
|
||||
func NewSpecFromVolume(vs *api.Volume) *Spec {
|
||||
// NewSpecFromVolume creates an Spec from an v1.Volume
|
||||
func NewSpecFromVolume(vs *v1.Volume) *Spec {
|
||||
return &Spec{
|
||||
Volume: vs,
|
||||
}
|
||||
}
|
||||
|
||||
// NewSpecFromPersistentVolume creates an Spec from an api.PersistentVolume
|
||||
func NewSpecFromPersistentVolume(pv *api.PersistentVolume, readOnly bool) *Spec {
|
||||
// NewSpecFromPersistentVolume creates an Spec from an v1.PersistentVolume
|
||||
func NewSpecFromPersistentVolume(pv *v1.PersistentVolume, readOnly bool) *Spec {
|
||||
return &Spec{
|
||||
PersistentVolume: pv,
|
||||
ReadOnly: readOnly,
|
||||
|
|
@ -526,32 +545,32 @@ func (pm *VolumePluginMgr) FindAttachablePluginByName(name string) (AttachableVo
|
|||
// before failing. Recommended. Default is 60 seconds.
|
||||
//
|
||||
// See HostPath and NFS for working recycler examples
|
||||
func NewPersistentVolumeRecyclerPodTemplate() *api.Pod {
|
||||
func NewPersistentVolumeRecyclerPodTemplate() *v1.Pod {
|
||||
timeout := int64(60)
|
||||
pod := &api.Pod{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
pod := &v1.Pod{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
GenerateName: "pv-recycler-",
|
||||
Namespace: api.NamespaceDefault,
|
||||
Namespace: metav1.NamespaceDefault,
|
||||
},
|
||||
Spec: api.PodSpec{
|
||||
Spec: v1.PodSpec{
|
||||
ActiveDeadlineSeconds: &timeout,
|
||||
RestartPolicy: api.RestartPolicyNever,
|
||||
Volumes: []api.Volume{
|
||||
RestartPolicy: v1.RestartPolicyNever,
|
||||
Volumes: []v1.Volume{
|
||||
{
|
||||
Name: "vol",
|
||||
// IMPORTANT! All plugins using this template MUST
|
||||
// override pod.Spec.Volumes[0].VolumeSource Recycler
|
||||
// implementations without a valid VolumeSource will fail.
|
||||
VolumeSource: api.VolumeSource{},
|
||||
VolumeSource: v1.VolumeSource{},
|
||||
},
|
||||
},
|
||||
Containers: []api.Container{
|
||||
Containers: []v1.Container{
|
||||
{
|
||||
Name: "pv-recycler",
|
||||
Image: "gcr.io/google_containers/busybox",
|
||||
Command: []string{"/bin/sh"},
|
||||
Args: []string{"-c", "test -e /scrub && rm -rf /scrub/..?* /scrub/.[!.]* /scrub/* && test -z \"$(ls -A /scrub)\" || exit 1"},
|
||||
VolumeMounts: []api.VolumeMount{
|
||||
VolumeMounts: []v1.VolumeMount{
|
||||
{
|
||||
Name: "vol",
|
||||
MountPath: "/scrub",
|
||||
|
|
@ -563,3 +582,15 @@ func NewPersistentVolumeRecyclerPodTemplate() *api.Pod {
|
|||
}
|
||||
return pod
|
||||
}
|
||||
|
||||
// Check validity of recycle pod template
|
||||
// List of checks:
|
||||
// - at least one volume is defined in the recycle pod template
|
||||
// If successful, returns nil
|
||||
// if unsuccessful, returns an error.
|
||||
func ValidateRecyclerPodTemplate(pod *v1.Pod) error {
|
||||
if len(pod.Spec.Volumes) < 1 {
|
||||
return fmt.Errorf("does not contain any volume(s)")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue