k8s/io/kubernetes/pkg/api.PersistentVolume 示例代码

2022-03-03

以下示例是关于golang中包含api.PersistentVolume用法的示例代码,想了解api.PersistentVolume的具体用法?api.PersistentVolume怎么用?api.PersistentVolume使用的例子?那么可以参考以下10个相关示例代码来学习它的具体使用方法。

示例1:
persistentvolume_claim_binder_controller.go开发语言: Go项目名称: amygdala代码行数: 522
484	UpdatePersistentVolumeClaim(claim *api.PersistentVolumeClaim) (*api.PersistentVolumeClaim, error)
485	UpdatePersistentVolumeClaimStatus(claim *api.PersistentVolumeClaim) (*api.PersistentVolumeClaim, error)
486}
499
500func (c *realBinderClient) UpdatePersistentVolume(volume *api.PersistentVolume) (*api.PersistentVolume, error) {
501	return c.client.Core().PersistentVolumes().Update(volume)
507
508func (c *realBinderClient) UpdatePersistentVolumeStatus(volume *api.PersistentVolume) (*api.PersistentVolume, error) {
509	return c.client.Core().PersistentVolumes().UpdateStatus(volume)
515
516func (c *realBinderClient) UpdatePersistentVolumeClaim(claim *api.PersistentVolumeClaim) (*api.PersistentVolumeClaim, error) {
517	return c.client.Core().PersistentVolumeClaims(claim.Namespace).Update(claim)
519
520func (c *realBinderClient) UpdatePersistentVolumeClaimStatus(claim *api.PersistentVolumeClaim) (*api.PersistentVolumeClaim, error) {
521	return c.client.Core().PersistentVolumeClaims(claim.Namespace).UpdateStatus(claim)
示例2:
persistentvolume_provisioner_controller.go开发语言: Go项目名称: amygdala代码行数: 536
384type controllerClient interface {
385	CreatePersistentVolume(pv *api.PersistentVolume) (*api.PersistentVolume, error)
386	ListPersistentVolumes(options api.ListOptions) (*api.PersistentVolumeList, error)
428
429func (c *realControllerClient) UpdatePersistentVolume(volume *api.PersistentVolume) (*api.PersistentVolume, error) {
430	return c.client.Core().PersistentVolumes().Update(volume)
436
437func (c *realControllerClient) UpdatePersistentVolumeStatus(volume *api.PersistentVolume) (*api.PersistentVolume, error) {
438	return c.client.Core().PersistentVolumes().UpdateStatus(volume)
452
453func (c *realControllerClient) UpdatePersistentVolumeClaim(claim *api.PersistentVolumeClaim) (*api.PersistentVolumeClaim, error) {
454	return c.client.Core().PersistentVolumeClaims(claim.Namespace).Update(claim)
456
457func (c *realControllerClient) UpdatePersistentVolumeClaimStatus(claim *api.PersistentVolumeClaim) (*api.PersistentVolumeClaim, error) {
458	return c.client.Core().PersistentVolumeClaims(claim.Namespace).UpdateStatus(claim)
示例3:
persistentvolume_recycler_controller.go开发语言: Go项目名称: amygdala代码行数: 410
196// volume (Released / Failed).
197func (recycler *PersistentVolumeRecycler) handleReleaseFailure(pv *api.PersistentVolume) api.PersistentVolumePhase {
198	status, found := recycler.releasedVolumes[pv.Name]
340	GetPersistentVolume(name string) (*api.PersistentVolume, error)
341	UpdatePersistentVolume(volume *api.PersistentVolume) (*api.PersistentVolume, error)
342	DeletePersistentVolume(volume *api.PersistentVolume) error
343	UpdatePersistentVolumeStatus(volume *api.PersistentVolume) (*api.PersistentVolume, error)
344}
357
358func (c *realRecyclerClient) UpdatePersistentVolume(volume *api.PersistentVolume) (*api.PersistentVolume, error) {
359	return c.client.Core().PersistentVolumes().Update(volume)
365
366func (c *realRecyclerClient) UpdatePersistentVolumeStatus(volume *api.PersistentVolume) (*api.PersistentVolume, error) {
367	return c.client.Core().PersistentVolumes().UpdateStatus(volume)
示例4:
persistentvolume.go开发语言: Go项目名称: ddysher代码行数: 161
36	Create(*api.PersistentVolume) (*api.PersistentVolume, error)
37	Update(*api.PersistentVolume) (*api.PersistentVolume, error)
38	UpdateStatus(*api.PersistentVolume) (*api.PersistentVolume, error)
43	Watch(opts v1.ListOptions) (watch.Interface, error)
44	Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *api.PersistentVolume, err error)
45	PersistentVolumeExpansion
60// Create takes the representation of a persistentVolume and creates it.  Returns the server's representation of the persistentVolume, and an error, if there is any.
61func (c *persistentVolumes) Create(persistentVolume *api.PersistentVolume) (result *api.PersistentVolume, err error) {
62	result = &api.PersistentVolume{}
71// Update takes the representation of a persistentVolume and updates it. Returns the server's representation of the persistentVolume, and an error, if there is any.
72func (c *persistentVolumes) Update(persistentVolume *api.PersistentVolume) (result *api.PersistentVolume, err error) {
73	result = &api.PersistentVolume{}
85
86func (c *persistentVolumes) UpdateStatus(persistentVolume *api.PersistentVolume) (result *api.PersistentVolume, err error) {
87	result = &api.PersistentVolume{}
示例5:
persistentvolume.go开发语言: Go项目名称: detiber代码行数: 161
36	Create(*api.PersistentVolume) (*api.PersistentVolume, error)
37	Update(*api.PersistentVolume) (*api.PersistentVolume, error)
38	UpdateStatus(*api.PersistentVolume) (*api.PersistentVolume, error)
43	Watch(opts v1.ListOptions) (watch.Interface, error)
44	Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *api.PersistentVolume, err error)
45	PersistentVolumeExpansion
60// Create takes the representation of a persistentVolume and creates it.  Returns the server's representation of the persistentVolume, and an error, if there is any.
61func (c *persistentVolumes) Create(persistentVolume *api.PersistentVolume) (result *api.PersistentVolume, err error) {
62	result = &api.PersistentVolume{}
71// Update takes the representation of a persistentVolume and updates it. Returns the server's representation of the persistentVolume, and an error, if there is any.
72func (c *persistentVolumes) Update(persistentVolume *api.PersistentVolume) (result *api.PersistentVolume, err error) {
73	result = &api.PersistentVolume{}
85
86func (c *persistentVolumes) UpdateStatus(persistentVolume *api.PersistentVolume) (result *api.PersistentVolume, err error) {
87	result = &api.PersistentVolume{}
示例6:
persistentvolume.go开发语言: Go项目名称: amygdala代码行数: 139
32	Create(*api.PersistentVolume) (*api.PersistentVolume, error)
33	Update(*api.PersistentVolume) (*api.PersistentVolume, error)
34	UpdateStatus(*api.PersistentVolume) (*api.PersistentVolume, error)
37	Get(name string) (*api.PersistentVolume, error)
38	List(opts api.ListOptions) (*api.PersistentVolumeList, error)
39	Watch(opts api.ListOptions) (watch.Interface, error)
55// Create takes the representation of a persistentVolume and creates it.  Returns the server's representation of the persistentVolume, and an error, if there is any.
56func (c *persistentVolumes) Create(persistentVolume *api.PersistentVolume) (result *api.PersistentVolume, err error) {
57	result = &api.PersistentVolume{}
66// Update takes the representation of a persistentVolume and updates it. Returns the server's representation of the persistentVolume, and an error, if there is any.
67func (c *persistentVolumes) Update(persistentVolume *api.PersistentVolume) (result *api.PersistentVolume, err error) {
68	result = &api.PersistentVolume{}
77
78func (c *persistentVolumes) UpdateStatus(persistentVolume *api.PersistentVolume) (result *api.PersistentVolume, err error) {
79	result = &api.PersistentVolume{}
示例7:
fake_persistentvolume.go开发语言: Go项目名称: ddysher代码行数: 121
37
38func (c *FakePersistentVolumes) Create(persistentVolume *api.PersistentVolume) (result *api.PersistentVolume, err error) {
39	obj, err := c.Fake.
46
47func (c *FakePersistentVolumes) Update(persistentVolume *api.PersistentVolume) (result *api.PersistentVolume, err error) {
48	obj, err := c.Fake.
49		Invokes(testing.NewRootUpdateAction(persistentvolumesResource, persistentVolume), &api.PersistentVolume{})
50	if obj == nil {
55
56func (c *FakePersistentVolumes) UpdateStatus(persistentVolume *api.PersistentVolume) (*api.PersistentVolume, error) {
57	obj, err := c.Fake.
73
74	_, err := c.Fake.Invokes(action, &api.PersistentVolumeList{})
75	return err
示例8:
fake_persistentvolume.go开发语言: Go项目名称: detiber代码行数: 121
37
38func (c *FakePersistentVolumes) Create(persistentVolume *api.PersistentVolume) (result *api.PersistentVolume, err error) {
39	obj, err := c.Fake.
46
47func (c *FakePersistentVolumes) Update(persistentVolume *api.PersistentVolume) (result *api.PersistentVolume, err error) {
48	obj, err := c.Fake.
49		Invokes(testing.NewRootUpdateAction(persistentvolumesResource, persistentVolume), &api.PersistentVolume{})
50	if obj == nil {
55
56func (c *FakePersistentVolumes) UpdateStatus(persistentVolume *api.PersistentVolume) (*api.PersistentVolume, error) {
57	obj, err := c.Fake.
73
74	_, err := c.Fake.Invokes(action, &api.PersistentVolumeList{})
75	return err
示例9:
fake_persistentvolume.go开发语言: Go项目名称: amygdala代码行数: 104
30
31func (c *FakePersistentVolumes) Create(persistentVolume *api.PersistentVolume) (result *api.PersistentVolume, err error) {
32	obj, err := c.Fake.
39
40func (c *FakePersistentVolumes) Update(persistentVolume *api.PersistentVolume) (result *api.PersistentVolume, err error) {
41	obj, err := c.Fake.
42		Invokes(core.NewRootUpdateAction("persistentvolumes", persistentVolume), &api.PersistentVolume{})
43	if obj == nil {
48
49func (c *FakePersistentVolumes) UpdateStatus(persistentVolume *api.PersistentVolume) (*api.PersistentVolume, error) {
50	obj, err := c.Fake.
59	_, err := c.Fake.
60		Invokes(core.NewRootDeleteAction("persistentvolumes", name), &api.PersistentVolume{})
61	return err
示例10:
strategy.go开发语言: Go项目名称: ddysher代码行数: 130
50func (persistentvolumeStrategy) PrepareForCreate(ctx genericapirequest.Context, obj runtime.Object) {
51	pv := obj.(*api.PersistentVolume)
52	pv.Status = api.PersistentVolumeStatus{}
55func (persistentvolumeStrategy) Validate(ctx genericapirequest.Context, obj runtime.Object) field.ErrorList {
56	persistentvolume := obj.(*api.PersistentVolume)
57	errorList := validation.ValidatePersistentVolume(persistentvolume)
71	newPv := obj.(*api.PersistentVolume)
72	oldPv := old.(*api.PersistentVolume)
73	newPv.Status = oldPv.Status
76func (persistentvolumeStrategy) ValidateUpdate(ctx genericapirequest.Context, obj, old runtime.Object) field.ErrorList {
77	newPv := obj.(*api.PersistentVolume)
78	errorList := validation.ValidatePersistentVolume(newPv)
100func (persistentvolumeStatusStrategy) ValidateUpdate(ctx genericapirequest.Context, obj, old runtime.Object) field.ErrorList {
101	return validation.ValidatePersistentVolumeStatusUpdate(obj.(*api.PersistentVolume), old.(*api.PersistentVolume))
102}

本文地址:https://www.itbaoku.cn/snippets/415661.html