上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 53 下一页

2024年9月7日

Etcd集群备份恢复

摘要: 安装Etcd集群 docker pull quay.io/coreos/etcd:v3.3.1 docker run -d --name etcd1 quay.io/coreos/etcd:v3.3.1 etcd -name etcd1 -advertise-client-urls http://1 阅读全文

posted @ 2024-09-07 17:48 王景迁 阅读(19) 评论(0) 推荐(0)

curl命令更新k8s cr status

摘要: 因为status是cr的subresource,所以不支持使用kubectl直接更新cr status,由controller来更新status。在KubeBuilder框架中,使用xxx.Status().Update(xxx)方式来更新status。在ClientSet中,通过UpdateSta 阅读全文

posted @ 2024-09-07 15:29 王景迁 阅读(186) 评论(0) 推荐(0)

go 使用grpc和grpcurl

摘要: 安装依赖和工具 # ubuntu安装protobuf apt install libprotobuf-dev protobuf-compiler protoc-gen-go protoc-gen-go-grpc -y # 查看protobuf版本 protoc --version # 安装grpcu 阅读全文

posted @ 2024-09-07 10:12 王景迁 阅读(207) 评论(0) 推荐(0)

2024年9月3日

multus实现自定义网卡名字

摘要: 安装环境 cat <<EOF | kind create cluster --name test --config - kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 networking: kubeProxyMode: iptables disab 阅读全文

posted @ 2024-09-03 09:18 王景迁 阅读(47) 评论(0) 推荐(0)

2024年8月28日

go 结构体列表比较是否相等

摘要: 使用reflect的DeepEqual方法 场景1:结构体列表按顺序匹配(直接比较) package main import ( "fmt" "reflect" ) type Student struct { Age int Score int } func main() { s1 := []Stu 阅读全文

posted @ 2024-08-28 21:15 王景迁 阅读(22) 评论(0) 推荐(0)

go 结构体切片自定义排序

摘要: 常见类型的默认排序实现 go sort包默认支持int(sort.Ints(x []int))、float64s(sort.Float64s(x []float64))、string(sort.Strings(x []string))从小到大排序,反序使用类似于sort.Sort(sort.Reve 阅读全文

posted @ 2024-08-28 20:58 王景迁 阅读(71) 评论(0) 推荐(0)

2024年8月27日

vscode常用开发配置

摘要: 1. 显示运行按钮 扩展中搜索code runner并安装 2. 自动保存 file->preferences->settings->搜索auto save->延迟100ms保存 3. 保存时自动格式化 file->preferences->settings->搜索format on save->勾 阅读全文

posted @ 2024-08-27 08:57 王景迁 阅读(36) 评论(0) 推荐(0)

2024年8月20日

获取shell函数返回值

摘要: 根据调用函数的字符串参数,判断字符串是否为空,来返回结果。 function f1() { if [ -z $1 ] then return 1 else return 0 fi } f1 "" echo $? f1 "a" echo $? shell函数返回值只能是整数,0表示成功,其他值表示失败 阅读全文

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

2024年8月13日

eBPF 代答arp请求

摘要: eBPF代答veth口arp请求 在cilium中,eBPF tc ingress负责代答容器网卡的arp请求,回复的mac地址是容器网卡对端veth口mac地址,与当前逻辑类似,这里只是回复了假mac。在kube-ovn中,ovs br-int网桥上xxx_h负责响应容器网卡的arp请求,没有ge 阅读全文

posted @ 2024-08-13 06:59 王景迁 阅读(124) 评论(0) 推荐(0)

2024年8月4日

vscode问题汇总

摘要: 问题现象1(vscode中cpptools-srv内存占用过多) vscode报错OOM。 问题分析 # top按照占用内存排序 top -o +%MEM cpptools-srv占用最高,达到890MB左右。 解决方法 打开vscode,文件->首选项->设置,搜索C_Cpp.intelliSen 阅读全文

posted @ 2024-08-04 09:51 王景迁 阅读(1163) 评论(0) 推荐(1)

上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 53 下一页

导航