This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 遍历数组,给重复出现的元素标号 | |
// 可直接复制到浏览器F12运行 | |
(function () { | |
// 返回需要判断重复出现的字段 | |
var getKey = function (obj) { | |
return obj.id | |
} | |
// 当出现次数大于1时的回调,需要返回处理后的对象 | |
// item: 需要处理的对象 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// get k8s version in pod with client-go 通过client-go在pod中获取k8s版本 | |
// refer: https://stackoverflow.com/questions/69446495/how-should-i-retrieve-the-current-kubernetes-server-version-via-golang-codes | |
import ( | |
"k8s.io/client-go/discovery" | |
"k8s.io/client-go/rest" | |
) | |
func getKubernetesVersion(cfg *rest.Config) { | |
cli, err := discovery.NewDiscoveryClientForConfig(cfg) |