Kubernetes API调用是秘密更新还是configmap更新原子调用? [英] Are Kubernetes API calls secret update and configmap update atomic calls?

查看:130
本文介绍了Kubernetes API调用是秘密更新还是configmap更新原子调用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

client.Secrets(命名空间).Update(秘密)是原子调用吗?如果此调用以某种方式失败,那么存储在Kubernetes API服务器中的原始机密是否会损坏?

Is client.Secrets(namespace).Update(secret) an atomic call? If this call fails somehow, does the original secret stored in Kubernetes API server get corrupted?

https://github.com/kubernetes/client-go/blob/d1b30110f1abd3b2fb21c5c2daad4345ede8a9fc/kubernetes/typed/core/v1/secret.go#L41

类似地,core.ConfigMaps(namespace).Update(configmap)是原子调用吗?如果此调用失败,则现有的configmap是否会损坏?

Similarly, is core.ConfigMaps(namespace).Update(configmap) an atomic call? If this call fails, does the existing configmap get corrupted?

推荐答案

client-go UPDATE 是HTTP PUT,因此它将替换对象,并且是原子操作.但是,在进行此操作时需要考虑一些情况,例如如果有多个客户端在同一个对象上进行操作...,您应该在此链接的客户端执行示例中找到替代解决方案:

client-go UPDATE is an HTTP PUT, so it will replace the object, and is an atomic operation. However there is circumstances to think about when doing this, e.g. if there is multiple clients operating on the same object... you should look in this linked client-go example with alternative solutions:

https://github.com/kubernetes/client-go/blob/master/examples/create-update-delete-deployment/main.go#L109-L123

这篇关于Kubernetes API调用是秘密更新还是configmap更新原子调用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆