当前位置:网站首页>client-go gin的简单整合六-list-watch二(关于Rs与Pod以及Deployment的完善)
client-go gin的简单整合六-list-watch二(关于Rs与Pod以及Deployment的完善)
2022-06-10 12:40:00 【51CTO】
背景:
前面完成了 client-go gin的简单整合五-list-watch deployment应用,进一步把 Rs Pod也实现list-watch!
前面少写的:
/src/core/deployment_init.go
忘记了Store数据…depmap.data.Store(dep.Namespace, list)!
client-go gin的简单整合六-list-watch二(关于Rs与Pod)
关于Rs list-watch
/src/core/rs_init.go
关于Pod list-watch
先写一个util方法(就为了判断两个label是否相同!):
/src/core/Util.go
基本copy自deployment_init.go:
/src/core/pod_int.go
deployment informer AddEventHandler
/src/core/deployment_init.go
Pod.go
/src/service/Pod.go
deployment.go的修改
deployment.go也要修改一下(上次没有将GetPodsByDep等方法修改为list-wath!)
/src/service/deployment.go:
运行main.go
运行main.go 看是否能访问pod列表?
http://127.0.0.1:8080/pods?ns=default
deployments下的坑…
运行main.go也顺便看了一眼deployment是否正常:
http://127.0.0.1:8080/deployments?ns=default
what…deployment的pod串了!想一下也是的:GetRsLabelsByDeployment的时候并没有判断rc与pod的关系,pod的label判断还是不精确的,没有想到好的办法,偷了一个懒:
/src/core/rs_int.go
模仿GetRsLabelsByDeployment写了一个**GetRsLabelsByDeploymentname方法,**恩返回rc的name 等于pod的OwnerReferences字段中的name字段!
/src/service/deployment.go
运行mai.go,访问http://127.0.0.1:8080/deployments?ns=default
算是精准匹配了,还不知道会不会有什么坑…
总结:
总结一下这过程学到的:
- deployment rs pod之间的关系
- OwnerReferences的匹配
- 下面还是继续crud吧…这个地方让我理解的有点长list-watch
边栏推荐
- How can the team be dissolved...
- Don't mistake "it informatization" for "super project"
- MYSQL 主库操作大表DDL ,从库崩溃与系统参数错误设置
- Tensorflow2.0进阶学习-图像 (十一)
- Unity3d uses URP rendering pipeline to realize ar shadow (shadow casting and transparent ground)
- 别把“IT信息化”不当“超级工程”
- MySQL master database operation large table DDL, slave database crash and system parameter error setting
- Tidb elementary course experience 8 (cluster management and maintenance, adding a tikv node)
- [raise bar C #] how to call the base of the interface
- 2022年浙江省赛
猜你喜欢

如何才能把团队给带解散。。。

Summary of Kitti related information
![[flinlk] dynamic Kerberos authentication in Flink pit](/img/ba/3a85df364ae0bcfca38e5f26366c03.png)
[flinlk] dynamic Kerberos authentication in Flink pit

Ant financial services Yang Jun: evolution of ant data analysis platform and application of data analysis methods

谷歌提出超强预训练模型CoCa,在ImageNet上微调Top-1准确率达91%!在多个下游任务上SOTA!

Minimalist random music player

Case sharing and implementation introduction of SAP field service management and wechat integration

Tidb Primary course experience 8 (Management Maintenance of Clusters, add a tikv Node)

(6) Classes and objects, object initialization and copy constructors (3)

Recommended learning materials for Altium Designer
随机推荐
Start with interpreting the code automatically generated by BDC, and explain the program components of sapgui
JS use the Icheck plug-in to listen and get the value of the checkbox
JS array to JSON, JSON to array. Array to comma separated string, string to array
Vdo-slam source code reading notes [1] dynamic obj part in track()
Xshell 评估期已过怎么办? 按照以下步骤即可解决!
Office technical lecture: punctuation - Chinese - vertical
Tidb elementary course experience 8 (cluster management and maintenance, adding a tikv node)
Element close and destroy the pop-up box: clear the data cache in the pop-up box (organize)
Today, a couple won the largest e-commerce IPO in Hong Kong
Ad-pcb schematic diagram learning (1)
Example of full page sliding screen at mobile terminal (sliding the whole screen up and down) (sorting)
CVPR2022|AConvNetforthe2020s&如何设计神经网络总结
Wei Lai: "pinches" the data and "pinches" the future
STM32 learning notes (2) -usart (basic application 1)
Stm32f407 clock tree and system clock learning notes
蔚来:“拿捏”了数据,“扭捏”着未来
Mobile phone manufacturers "go back to their ancestors", only apple said no
MySQL master database operation large table DDL, slave database crash and system parameter error setting
Yet Another Palindrome Partitioning
Give root password for maintenace (or press Control-D to continue):解决方法