当前位置: 首页>>代码示例>>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;未经允许,请勿转载。