gpt4 book ai didi

kubernetes - Kubernetes-使用特定的ConfigMap版本控制

转载 作者:行者123 更新时间:2023-12-02 12:07:23 24 4
gpt4 key购买 nike

关于configMap版本控制,我有几个问题。

  • 是否可以在部署文件中使用configMap的特定版本?
  • 我没有看到任何API来获取版本列表。如何获取版本列表?
  • 是否可以比较configMap的黑白版本?
  • 如何控制版本数?

  • 谢谢

    最佳答案

    Is it possible to use a specific version of a configMap in the deployment file?



    并不是的。
    “版本”的最接近概念是resourceVersion,但这不是让用户直接采取行动。

    参见 API conventions: concurrency control and consistency:

    Kubernetes leverages the concept of resource versions to achieve optimistic concurrency. All Kubernetes resources have a "resourceVersion" field as part of their metadata. This resourceVersion is a string that identifies the internal version of an object that can be used by clients to determine when objects have changed.
    When a record is about to be updated, it's version is checked against a pre-saved value, and if it doesn't match, the update fails with a StatusConflict (HTTP status code 409).

    The resourceVersion is changed by the server every time an object is modified. If resourceVersion is included with the PUT operation the system will verify that there have not been other successful mutations to the resource during a read/modify/write cycle, by verifying that the current value of resourceVersion matches the specified value.

    The resourceVersion is currently backed by etcd's modifiedIndex.
    However, it's important to note that the application should not rely on the implementation details of the versioning system maintained by Kubernetes. We may change the implementation of resourceVersion in the future, such as to change it to a timestamp or per-object counter.

    The only way for a client to know the expected value of resourceVersion is to have received it from the server in response to a prior operation, typically a GET. This value MUST be treated as opaque by clients and passed unmodified back to the server.
    Clients should not assume that the resource version has meaning across namespaces, different kinds of resources, or different servers.
    Currently, the value of resourceVersion is set to match etcd's sequencer. You could think of it as a logical clock the API server can use to order requests. However, we expect the implementation of resourceVersion to change in the future, such as in the case we shard the state by kind and/or namespace, or port to another storage system.

    In the case of a conflict, the correct client action at this point is to GET the resource again, apply the changes afresh, and try submitting again.
    This mechanism can be used to prevent races like the following:


    Client #1                                  Client #2
    GET Foo GET Foo
    Set Foo.Bar = "one" Set Foo.Baz = "two"
    PUT Foo PUT Foo

    When these sequences occur in parallel, either the change to Foo.Bar or the change to Foo.Baz can be lost.

    On the other hand, when specifying the resourceVersion, one of the PUTs will fail, since whichever write succeeds changes the resourceVersion for Foo.

    resourceVersion may be used as a precondition for other operations (e.g., GET, DELETE) in the future, such as for read-after-write consistency in the presence of caching.

    "Watch" operations specify resourceVersion using a query parameter. It is used to specify the point at which to begin watching the specified resources.
    This may be used to ensure that no mutations are missed between a GET of a resource (or list of resources) and a subsequent Watch, even if the current version of the resource is more recent.
    This is currently the main reason that list operations (GET on a collection) return resourceVersion.

    关于kubernetes - Kubernetes-使用特定的ConfigMap版本控制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50050107/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com