上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 41 下一页

2024年2月5日

go ticker源码分析

摘要: 结构体定义 Timer是一次性定时器,Ticker是周期性定时器,实现相同,系统协程处理所有定时器。 Ticker结构体 C是容量1的channel,如果里面数据没被取走,那么丢失下一个周期事件。 runtimeTimer结构体 这里的回调函数是,向C中存入当前时间。 timersBuckets 数 阅读全文

posted @ 2024-02-05 17:07 王景迁 阅读(5) 评论(0) 推荐(0) 编辑

2024年2月4日

go dns解析参数配置

摘要: // lookup_dns.go package main import ( "net" "time" "k8s.io/klog/v2" ) func main() { dns := "kubernetes.default" if _, err := net.LookupHost(dns); err 阅读全文

posted @ 2024-02-04 23:14 王景迁 阅读(38) 评论(0) 推荐(0) 编辑

informer增加过滤标签

摘要: labelOptions := informers.WithTweakListOptions(func(opts *metav1.ListOptions) { opts.LabelSelector = "a=b" }) informerFactory := informers.NewSharedIn 阅读全文

posted @ 2024-02-04 22:02 王景迁 阅读(20) 评论(0) 推荐(0) 编辑

2024年1月31日

分析go域名解析过程

摘要: package main import ( "net" "k8s.io/klog/v2" ) func main() { dns := "cn.bing.com" if ip, err := net.LookupHost(dns); err != nil { klog.Errorf("lookup 阅读全文

posted @ 2024-01-31 08:11 王景迁 阅读(20) 评论(0) 推荐(0) 编辑

2024年1月30日

client-go list性能提升

摘要: k8s v1.19.0 staging\src\k8s.io\apiserver\pkg\storage\cacher\cacher.go List方法 staging\src\k8s.io\apiserver\pkg\storage\etcd3\api_object_versioner.go Pa 阅读全文

posted @ 2024-01-30 22:21 王景迁 阅读(33) 评论(0) 推荐(0) 编辑

informer cache自定义索引

摘要: informer cache默认通过namespace/name作为key把对象保存到map中。条件查询时一般通过labels.Selector来过滤,但这需要遍历所有元素,informer cache可以类似于MySQL那样建立索引,来提高查询速度。 // map根据指定的key来给对象分类 // 阅读全文

posted @ 2024-01-30 21:26 王景迁 阅读(32) 评论(0) 推荐(0) 编辑

2024年1月28日

main.go无法引用同目录下其他文件的函数和变量以及常量

摘要: // main_call_other_file_const_define.go package main const ( Num = 10 ) // main_call_other_file_const.go package main import "fmt" func main() { fmt.P 阅读全文

posted @ 2024-01-28 11:27 王景迁 阅读(89) 评论(0) 推荐(0) 编辑

多个cni插件共存时kubelet调用哪个

摘要: k8s v1.19.0 默认情况下,k8s不支持多个cni插件混用。在/etc/cni/net.d存在多个cni配置时,dockershim只会加载按字母顺序排序的第1个插件。 cmd/kubelet/app/options/container_runtime.goNewContainerRunti 阅读全文

posted @ 2024-01-28 10:46 王景迁 阅读(43) 评论(0) 推荐(0) 编辑

C++类指针未初始化导致访问成员变量时报段错误

摘要: # 安装gcc和g++ yum install gcc yum install gcc-c++.x86_64 // a.cpp #include <iostream> #include <unistd.h> using namespace std; class Test { public: void 阅读全文

posted @ 2024-01-28 10:04 王景迁 阅读(20) 评论(0) 推荐(0) 编辑

2024年1月25日

client-go令牌桶限流配置

摘要: func addListWatchCfgAndClient() { cfg, err := clientcmd.BuildConfigFromFlags("", "/root/.kube/config") if err != nil { klog.Fatalf("Error building kub 阅读全文

posted @ 2024-01-25 13:32 王景迁 阅读(52) 评论(0) 推荐(0) 编辑

上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 41 下一页

导航