当前位置: 首页>>代码示例>>Golang>>正文


Golang ObjectMeta.OwnerReferences方法代码示例

本文整理汇总了Golang中k8s/io/kubernetes/pkg/api/v1.ObjectMeta.OwnerReferences方法的典型用法代码示例。如果您正苦于以下问题:Golang ObjectMeta.OwnerReferences方法的具体用法?Golang ObjectMeta.OwnerReferences怎么用?Golang ObjectMeta.OwnerReferences使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在k8s/io/kubernetes/pkg/api/v1.ObjectMeta的用法示例。


在下文中一共展示了ObjectMeta.OwnerReferences方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: ObjectMetaIsEquivalent

/*
ObjectMetaIsEquivalent determines whether two ObjectMeta's (typically one from a federated API object,
and the other from a cluster object) are equivalent.
*/
func ObjectMetaIsEquivalent(m1, m2 v1.ObjectMeta) bool {
	// First make all of the read-only fields equal, then perform a deep equality comparison
	m1.SelfLink = m2.SelfLink                   // Might be different in different cluster contexts.
	m1.UID = m2.UID                             // Definitely different in different cluster contexts
	m1.ResourceVersion = m2.ResourceVersion     // Definitely different in different cluster contexts
	m1.Generation = m2.Generation               // Might be different in different cluster contexts.
	m1.CreationTimestamp = m2.CreationTimestamp // Definitely different in different cluster contexts.
	m1.DeletionTimestamp = m2.DeletionTimestamp // Might be different in different cluster contexts.
	m1.OwnerReferences = nil                    // Might be different in different cluster contexts.
	m2.OwnerReferences = nil
	m1.Finalizers = nil // Might be different in different cluster contexts.
	m2.Finalizers = nil

	return reflect.DeepEqual(m1, m2)
}
开发者ID:cheld,项目名称:kubernetes,代码行数:19,代码来源:util.go


注:本文中的k8s/io/kubernetes/pkg/api/v1.ObjectMeta.OwnerReferences方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。