當前位置: 首頁>>代碼示例>>Golang>>正文


Golang api.FinalizerName函數代碼示例

本文整理匯總了Golang中k8s/io/kubernetes/pkg/api.FinalizerName函數的典型用法代碼示例。如果您正苦於以下問題:Golang FinalizerName函數的具體用法?Golang FinalizerName怎麽用?Golang FinalizerName使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了FinalizerName函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: autoConvert_v1_ProjectSpec_To_api_ProjectSpec

func autoConvert_v1_ProjectSpec_To_api_ProjectSpec(in *ProjectSpec, out *project_api.ProjectSpec, s conversion.Scope) error {
	if in.Finalizers != nil {
		in, out := &in.Finalizers, &out.Finalizers
		*out = make([]api.FinalizerName, len(*in))
		for i := range *in {
			(*out)[i] = api.FinalizerName((*in)[i])
		}
	} else {
		out.Finalizers = nil
	}
	return nil
}
開發者ID:Xmagicer,項目名稱:origin,代碼行數:12,代碼來源:conversion_generated.go

示例2: autoConvert_v1_ProjectSpec_To_api_ProjectSpec

func autoConvert_v1_ProjectSpec_To_api_ProjectSpec(in *ProjectSpec, out *project_api.ProjectSpec, s conversion.Scope) error {
	if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
		defaulting.(func(*ProjectSpec))(in)
	}
	if in.Finalizers != nil {
		in, out := &in.Finalizers, &out.Finalizers
		*out = make([]api.FinalizerName, len(*in))
		for i := range *in {
			(*out)[i] = api.FinalizerName((*in)[i])
		}
	} else {
		out.Finalizers = nil
	}
	return nil
}
開發者ID:RomainVabre,項目名稱:origin,代碼行數:15,代碼來源:conversion_generated.go

示例3: finalizeNamespaceFunc

// finalize will finalize the namespace for kubernetes
func finalizeNamespaceFunc(kubeClient client.Interface, namespace *api.Namespace) (*api.Namespace, error) {
	namespaceFinalize := api.Namespace{}
	namespaceFinalize.ObjectMeta = namespace.ObjectMeta
	namespaceFinalize.Spec = namespace.Spec
	finalizerSet := sets.NewString()
	for i := range namespace.Spec.Finalizers {
		if namespace.Spec.Finalizers[i] != api.FinalizerKubernetes {
			finalizerSet.Insert(string(namespace.Spec.Finalizers[i]))
		}
	}
	namespaceFinalize.Spec.Finalizers = make([]api.FinalizerName, 0, len(finalizerSet))
	for _, value := range finalizerSet.List() {
		namespaceFinalize.Spec.Finalizers = append(namespaceFinalize.Spec.Finalizers, api.FinalizerName(value))
	}
	return kubeClient.Namespaces().Finalize(&namespaceFinalize)
}
開發者ID:pologood,項目名稱:kubernetes,代碼行數:17,代碼來源:namespace_controller.go

示例4: NamespaceSpec

func NamespaceSpec(namespaceSpecs []interface{}) api.NamespaceSpec {
	if len(namespaceSpecs) == 0 {
		return api.NamespaceSpec{}
	}
	userNamespaceSpec := namespaceSpecs[0].(map[string]interface{})

	namespaceSpec := api.NamespaceSpec{}

	if _, ok := userNamespaceSpec["finalizers"]; ok {
		strFinalizers := convertListToStringArray(userNamespaceSpec["finalizers"].([]interface{}))
		var finalizers []api.FinalizerName
		for _, f := range strFinalizers {
			finalizers = append(finalizers, api.FinalizerName(f))
		}
		namespaceSpec.Finalizers = finalizers
	}

	return namespaceSpec
}
開發者ID:brendangibat,項目名稱:terraform-provider-kubernetes,代碼行數:19,代碼來源:namespace.go

示例5: finalizeInternal

// finalizeInternal will update the namespace finalizer list to either have or not have origin finalizer
func finalizeInternal(kubeClient kclient.Interface, namespace *kapi.Namespace, withOrigin bool) (*kapi.Namespace, error) {
	namespaceFinalize := kapi.Namespace{}
	namespaceFinalize.ObjectMeta = namespace.ObjectMeta
	namespaceFinalize.Spec = namespace.Spec

	finalizerSet := util.NewStringSet()
	for i := range namespace.Spec.Finalizers {
		finalizerSet.Insert(string(namespace.Spec.Finalizers[i]))
	}

	if withOrigin {
		finalizerSet.Insert(string(api.FinalizerOrigin))
	} else {
		finalizerSet.Delete(string(api.FinalizerOrigin))
	}

	namespaceFinalize.Spec.Finalizers = make([]kapi.FinalizerName, 0, len(finalizerSet))
	for _, value := range finalizerSet.List() {
		namespaceFinalize.Spec.Finalizers = append(namespaceFinalize.Spec.Finalizers, kapi.FinalizerName(value))
	}
	return kubeClient.Namespaces().Finalize(&namespaceFinalize)
}
開發者ID:jhadvig,項目名稱:origin,代碼行數:23,代碼來源:util.go

示例6: finalizeNamespace

// finalizeNamespace removes the specified finalizerToken and finalizes the namespace
func finalizeNamespace(kubeClient clientset.Interface, namespace *api.Namespace, finalizerToken api.FinalizerName) (*api.Namespace, error) {
	namespaceFinalize := api.Namespace{}
	namespaceFinalize.ObjectMeta = namespace.ObjectMeta
	namespaceFinalize.Spec = namespace.Spec
	finalizerSet := sets.NewString()
	for i := range namespace.Spec.Finalizers {
		if namespace.Spec.Finalizers[i] != finalizerToken {
			finalizerSet.Insert(string(namespace.Spec.Finalizers[i]))
		}
	}
	namespaceFinalize.Spec.Finalizers = make([]api.FinalizerName, 0, len(finalizerSet))
	for _, value := range finalizerSet.List() {
		namespaceFinalize.Spec.Finalizers = append(namespaceFinalize.Spec.Finalizers, api.FinalizerName(value))
	}
	namespace, err := kubeClient.Core().Namespaces().Finalize(&namespaceFinalize)
	if err != nil {
		// it was removed already, so life is good
		if errors.IsNotFound(err) {
			return namespace, nil
		}
	}
	return namespace, err
}
開發者ID:jeremyeder,項目名稱:kubernetes,代碼行數:24,代碼來源:namespace_controller_utils.go


注:本文中的k8s/io/kubernetes/pkg/api.FinalizerName函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。