apiserver icon indicating copy to clipboard operation
apiserver copied to clipboard

Query on ContinueToken

Open mehvaibh opened this issue 2 years ago • 6 comments

Hello, I have a query on comment of continueToken struct.

// continueToken is a simple structured object for encoding the state of a continue token. // TODO: if we change the version of the encoded from, we can't start encoding the new version // until all other servers are upgraded (i.e. we need to support rolling schema) // This is a public API struct and cannot change. type continueToken struct { APIVersion string json:"v" ResourceVersion int64 json:"rv" StartKey string json:"start" } https://github.com/kubernetes/apiserver/blob/master/pkg/storage/continue.go#L35-L43

I wanted to check on above comment specially "This is a public API struct and cannot change."

It seems like this structure in Marshaled/UnMarshaled using json econding and from the doc it seems adding a new field to struct is backward compatible.

I tried testing this by adding a new field to this continueToken. The token generated by new API Server (with new extra field) is parsable by old API server and vice versa. This makes adding new field in this struct both roll-forward and roll-back compatible.

As I may not know all the details and use cases for this token other than it is primarily used to encode ETCD related meta data like key prefix, revision number etc (sorry If i missed critical details). So wanted to confirm is this the only restriction to enforce no changes or there are some other use cases which I missed(thanks for enlightening me in this case)

mehvaibh avatar Aug 31 '23 19:08 mehvaibh