本文整理汇总了Golang中k8s/io/kubernetes/pkg/util/sets.String.Union方法的典型用法代码示例。如果您正苦于以下问题:Golang String.Union方法的具体用法?Golang String.Union怎么用?Golang String.Union使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类k8s/io/kubernetes/pkg/util/sets.String
的用法示例。
在下文中一共展示了String.Union方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: RefreshWhitelist
// RefreshWhitelist updates the whitelist, re-getting the list of committers.
func (config *SubmitQueueConfig) RefreshWhitelist() sets.String {
if config.additionalUserWhitelist == nil {
users, err := loadWhitelist(config.Whitelist)
if err != nil {
glog.Fatalf("error loading user whitelist: %v", err)
}
config.additionalUserWhitelist = &users
}
if config.committerList == nil {
committerList, err := loadWhitelist(config.Committers)
if err != nil {
glog.Fatalf("error loading committers whitelist: %v", err)
}
config.committerList = &committerList
}
allUsers := sets.String{}
// We must use the values on disk in case it has users which don't have
// explicit "pull" permission in the API
allUsers = allUsers.Union(*config.additionalUserWhitelist)
if pushUsers, pullUsers, err := config.UsersWithAccess(); err != nil {
glog.Info("Falling back to static committers list.")
allUsers = allUsers.Union(*config.committerList)
} else {
allUsers = allUsers.Union(pushUsers)
allUsers = allUsers.Union(pullUsers)
}
config.userWhitelist = &allUsers
return allUsers
}