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

2022-03-03

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

示例1:
namespace_controller_test.go开发语言: Go项目名称: amygdala代码行数: 282
41		Spec: api.NamespaceSpec{
42			Finalizers: []api.FinalizerName{"a", "b"},
43		},
47	}
48	testNamespace.Spec.Finalizers = []api.FinalizerName{}
49	if !finalized(testNamespace) {
61		Spec: api.NamespaceSpec{
62			Finalizers: []api.FinalizerName{"kubernetes", "other"},
63		},
91		Spec: api.NamespaceSpec{
92			Finalizers: []api.FinalizerName{"kubernetes"},
93		},
220		Spec: api.NamespaceSpec{
221			Finalizers: []api.FinalizerName{"kubernetes"},
222		},
示例2:
namespace_controller_utils.go开发语言: Go项目名称: amygdala代码行数: 480
108// finalizeNamespaceFunc returns a function that knows how to finalize a namespace for specified token.
109func finalizeNamespaceFunc(finalizerToken api.FinalizerName) updateNamespaceFunc {
110	return func(kubeClient clientset.Interface, namespace *api.Namespace) (*api.Namespace, error) {
115// finalizeNamespace removes the specified finalizerToken and finalizes the namespace
116func finalizeNamespace(kubeClient clientset.Interface, namespace *api.Namespace, finalizerToken api.FinalizerName) (*api.Namespace, error) {
117	namespaceFinalize := api.Namespace{}
125	}
126	namespaceFinalize.Spec.Finalizers = make([]api.FinalizerName, 0, len(finalizerSet))
127	for _, value := range finalizerSet.List() {
128		namespaceFinalize.Spec.Finalizers = append(namespaceFinalize.Spec.Finalizers, api.FinalizerName(value))
129	}
338	namespace *api.Namespace,
339	finalizerToken api.FinalizerName,
340) error {
示例3:
storage_test.go开发语言: Go项目名称: bparees代码行数: 620
160		Spec: api.NamespaceSpec{
161			Finalizers: []api.FinalizerName{api.FinalizerKubernetes},
162		},
197		Spec: api.NamespaceSpec{
198			Finalizers: []api.FinalizerName{},
199		},
231		Spec: api.NamespaceSpec{
232			Finalizers: []api.FinalizerName{api.FinalizerKubernetes},
233		},
306		Spec: api.NamespaceSpec{
307			Finalizers: []api.FinalizerName{api.FinalizerKubernetes},
308		},
350		Spec: api.NamespaceSpec{
351			Finalizers: []api.FinalizerName{api.FinalizerKubernetes},
352		},
示例4:
storage_test.go开发语言: Go项目名称: byxorna代码行数: 620
160		Spec: api.NamespaceSpec{
161			Finalizers: []api.FinalizerName{api.FinalizerKubernetes},
162		},
197		Spec: api.NamespaceSpec{
198			Finalizers: []api.FinalizerName{},
199		},
231		Spec: api.NamespaceSpec{
232			Finalizers: []api.FinalizerName{api.FinalizerKubernetes},
233		},
306		Spec: api.NamespaceSpec{
307			Finalizers: []api.FinalizerName{api.FinalizerKubernetes},
308		},
350		Spec: api.NamespaceSpec{
351			Finalizers: []api.FinalizerName{api.FinalizerKubernetes},
352		},
示例5:
storage_test.go开发语言: Go项目名称: csrwng代码行数: 605
157		Spec: api.NamespaceSpec{
158			Finalizers: []api.FinalizerName{api.FinalizerKubernetes},
159		},
188		Spec: api.NamespaceSpec{
189			Finalizers: []api.FinalizerName{},
190		},
222		Spec: api.NamespaceSpec{
223			Finalizers: []api.FinalizerName{api.FinalizerKubernetes},
224		},
294		Spec: api.NamespaceSpec{
295			Finalizers: []api.FinalizerName{api.FinalizerKubernetes},
296		},
335		Spec: api.NamespaceSpec{
336			Finalizers: []api.FinalizerName{api.FinalizerKubernetes},
337		},
示例6:
strategy_test.go开发语言: Go项目名称: ddysher代码行数: 143
78		ObjectMeta: metav1.ObjectMeta{Name: "foo", ResourceVersion: "10", DeletionTimestamp: &now},
79		Spec:       api.NamespaceSpec{Finalizers: []api.FinalizerName{"kubernetes"}},
80		Status:     api.NamespaceStatus{Phase: api.NamespaceActive},
111		ObjectMeta: metav1.ObjectMeta{Name: "foo", ResourceVersion: "10"},
112		Spec:       api.NamespaceSpec{Finalizers: []api.FinalizerName{"kubernetes", "example.com/org"}},
113		Status:     api.NamespaceStatus{Phase: api.NamespaceActive},
116		ObjectMeta: metav1.ObjectMeta{Name: "foo", ResourceVersion: "9"},
117		Spec:       api.NamespaceSpec{Finalizers: []api.FinalizerName{"example.com/foo"}},
118		Status:     api.NamespaceStatus{Phase: api.NamespaceTerminating},
示例7:
strategy_test.go开发语言: Go项目名称: detiber代码行数: 143
78		ObjectMeta: metav1.ObjectMeta{Name: "foo", ResourceVersion: "10", DeletionTimestamp: &now},
79		Spec:       api.NamespaceSpec{Finalizers: []api.FinalizerName{"kubernetes"}},
80		Status:     api.NamespaceStatus{Phase: api.NamespaceActive},
111		ObjectMeta: metav1.ObjectMeta{Name: "foo", ResourceVersion: "10"},
112		Spec:       api.NamespaceSpec{Finalizers: []api.FinalizerName{"kubernetes", "example.com/org"}},
113		Status:     api.NamespaceStatus{Phase: api.NamespaceActive},
116		ObjectMeta: metav1.ObjectMeta{Name: "foo", ResourceVersion: "9"},
117		Spec:       api.NamespaceSpec{Finalizers: []api.FinalizerName{"example.com/foo"}},
118		Status:     api.NamespaceStatus{Phase: api.NamespaceTerminating},
示例8:
namespace_controller_test.go开发语言: Go项目名称: cjcullen代码行数: 286
43		Spec: api.NamespaceSpec{
44			Finalizers: []api.FinalizerName{"a", "b"},
45		},
49	}
50	testNamespace.Spec.Finalizers = []api.FinalizerName{}
51	if !finalized(testNamespace) {
63		Spec: api.NamespaceSpec{
64			Finalizers: []api.FinalizerName{"kubernetes", "other"},
65		},
93		Spec: api.NamespaceSpec{
94			Finalizers: []api.FinalizerName{"kubernetes"},
95		},
223		Spec: api.NamespaceSpec{
224			Finalizers: []api.FinalizerName{"kubernetes"},
225		},
示例9:
namespace_controller_utils.go开发语言: Go项目名称: cjcullen代码行数: 517
126// finalizeNamespaceFunc returns a function that knows how to finalize a namespace for specified token.
127func finalizeNamespaceFunc(finalizerToken api.FinalizerName) updateNamespaceFunc {
128	return func(kubeClient clientset.Interface, namespace *api.Namespace) (*api.Namespace, error) {
133// finalizeNamespace removes the specified finalizerToken and finalizes the namespace
134func finalizeNamespace(kubeClient clientset.Interface, namespace *api.Namespace, finalizerToken api.FinalizerName) (*api.Namespace, error) {
135	namespaceFinalize := api.Namespace{}
143	}
144	namespaceFinalize.Spec.Finalizers = make([]api.FinalizerName, 0, len(finalizerSet))
145	for _, value := range finalizerSet.List() {
146		namespaceFinalize.Spec.Finalizers = append(namespaceFinalize.Spec.Finalizers, api.FinalizerName(value))
147	}
375	namespace *api.Namespace,
376	finalizerToken api.FinalizerName,
377) error {
示例10:
namespace_controller_test.go开发语言: Go项目名称: cloud-zuiwanyuan代码行数: 285
42		Spec: api.NamespaceSpec{
43			Finalizers: []api.FinalizerName{"a", "b"},
44		},
48	}
49	testNamespace.Spec.Finalizers = []api.FinalizerName{}
50	if !finalized(testNamespace) {
62		Spec: api.NamespaceSpec{
63			Finalizers: []api.FinalizerName{"kubernetes", "other"},
64		},
92		Spec: api.NamespaceSpec{
93			Finalizers: []api.FinalizerName{"kubernetes"},
94		},
222		Spec: api.NamespaceSpec{
223			Finalizers: []api.FinalizerName{"kubernetes"},
224		},

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