--
You received this message because you are subscribed to the Google Groups "kubernetes-sig-architecture" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-sig-arch...@googlegroups.com.
To post to this group, send email to kubernetes-si...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kubernetes-sig-architecture/CAO_RewaAx6gRmwyL5nipr7wL5Pvu86xzrFCPjD-0W%3D%3DpKa%2BKVw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
podIP is in status, so the main concern is readers rather than writers.Something similar was discussed with nodeSelector, but wasn't implemented:
On Mon, Jul 16, 2018 at 10:58 PM Brian Grant <brian...@google.com> wrote:podIP is in status, so the main concern is readers rather than writers.Something similar was discussed with nodeSelector, but wasn't implemented:Looking at the podIP case, it seems like the additional IPs all need to be aliases for the same interface, so a new field called podIPAliases or some such would make sense. The ipv4 address, if any, would go into the existing field, and an ipv6 address would go into the aliases field, as it's effectively a new feature.
Multiple interfaces would need some kind of structure that would permit association of addresses and interfaces.More generally, old external clients and configuration must be able to be oblivious to new fields and still be able to work. If a client utilizes new fields, it also needs to understand pre-existing fields.We assume that spec fields may be written explicitly by programmatic clients, may be part of read-modify-write sequences, and may be applied (as in kubectl apply) as declarative configuration specified by the user. The system cannot change the manner in which fields are specified by the user. And representing the same information in multiple ways in the spec in the same API version is impossible to make work.Status fields are written by controllers and read by other clients. For pluggable controllers (e.g. the scheduler), status fields may be written by external clients, but we put the burden of compatibility on controller authors, since otherwise evolution would be practically impossible.Interoperation of multiple clients can be hard in the case of inter-related fields. Introduction of new fields that change the meanings of existing fields are highly problematic. Technically pre-existing optional fields may be omitted, but practically may break clients if they've so far always been present.Since it's so challenging to maintain strict backward compatibility, we've typically had to make judgement calls of risk/value on a case-by-case basis.
Are there other fields we need to consider?
On Thu, Jul 12, 2018 at 12:47 PM 'Tim Hockin' via kubernetes-sig-architecture <kubernetes-si...@googlegroups.com> wrote:
--Since I will be out for the next 3 sig-arch meetings, I am putting this here instead of on the agenda.context: https://github.com/kubernetes/community/pull/2254We have an existing field `Pod.spec.podIP` which holds a single value. The proposal is to support dual-stack networking (IPv6 and IPv4 at the same time, very common), which requires that a pod report multiple IP addresses.Our API changes doc (https://github.com/kubernetes/community/blob/master/contributors/devel/api_changes.md#on-compatibility) talks about adding a second field for "extra values", e.g. `extraPodIPs`. The point of debate here is how to do this is a maximally compatible and safe way in the face of version skew, and what guarantees can be made.If we demand that the new field (the plural) is exclusive of the singular field, we face a compat problem. Older clients might not know to update the plural. Consider an existing pod with `PodIP = "X"` and `PodIPs" = [ "Y", "Z" ]`. If we have a client that only knows `PodIP`, and it updates that field to "Z", the exclusivity invariant is violated.That effectively means that a new field has changed the meaning of an old field, and a client operation which used to work will no longer work. Bad.If we demand that the new field (the plural) is inclusive of the singular field, we face a similar problem in the other direction. Consider `PodIP = "X"` and `PodIPs" = [ "X", "Y" ]`. If an older client updates `podIP` field to "Z", the inclusivity invariant is violated. Again, a new field has changed the meaning of an old field.So we're basically forced to make it an optionally-inclusive relationship. And now we have to answer situations like this: Consider `PodIP = "X"` and `PodIPs" = [ "X", "Y" ]`. If an older client updates `podIP` field to "Z", should "X" be removed from the plural field?It gets a little more complex because we want to include metadata about IPs in the plural structure, so simple replacement is more nuanced.There are other options like making the fields more "linked" (e.g. one piece of metadata is "is-primary" which is always in sync with the singular field (and defaulting / validation could maybe handle the corner cases). This crosses boundaries of changing user-provided data in ways that we don't generally approve of.Other ideas are welcome.I wanted to put this in from of the sig-arch group for consideration, since I suspect this will happen again as APIs evolve. This could set a precedent.Tim
You received this message because you are subscribed to the Google Groups "kubernetes-sig-architecture" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-sig-architecture+unsub...@googlegroups.com.
On Tuesday, July 17, 2018 at 12:45:17 PM UTC-4, Brian Grant wrote:On Mon, Jul 16, 2018 at 10:58 PM Brian Grant <brian...@google.com> wrote:podIP is in status, so the main concern is readers rather than writers.Something similar was discussed with nodeSelector, but wasn't implemented:Looking at the podIP case, it seems like the additional IPs all need to be aliases for the same interface, so a new field called podIPAliases or some such would make sense. The ipv4 address, if any, would go into the existing field, and an ipv6 address would go into the aliases field, as it's effectively a new feature.A small, but important correction to your statement...As of v1.9, the existing field could have an IPv4 address or an IPv6 address. One could have a network with each pod only having an IPv6 address (the IPv6 only case).
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-sig-arch...@googlegroups.com.
To post to this group, send email to kubernetes-si...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kubernetes-sig-architecture/CAO_RewaAx6gRmwyL5nipr7wL5Pvu86xzrFCPjD-0W%3D%3DpKa%2BKVw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "kubernetes-sig-architecture" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-sig-arch...@googlegroups.com.
To post to this group, send email to kubernetes-si...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kubernetes-sig-architecture/4160a123-7fa2-47d9-ba36-bb4cabd180c1%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kubernetes-sig-architecture/CAKCBhs62JcKiWxT8eSd7qwzmGtZxfOUwUJvHKPDZtV3nsUpKFw%40mail.gmail.com.
The existing field can be either v4 or v6, but is singular. The proposal at hand is to support both v4 and v6, though I think that any design that doesn't extend to multiple addresses of the same family will be trouble in the not very distant future anyway, so we're better off so solve this at the same time.And these are not necessarily aliases, they could be multiple interfaces in a pod.
The number or kind of interfaces should not be part of the conversation, if we can avoid it. The construct is connectivity - can a pod reach X. Whether that is multi-network or multi-family or link-local addressing or something else.What issue do you see for multi-interface?NB we may want to list interface name in the metadata (or not, TBD) but it's not required.
We do have to address that, though a large portion of those problems should be handled by simple IP routing. The idea of "why" is part of the metadata proposed in the KEP (or in the comments thereof).
The existing field can be either v4 or v6, but is singular. The proposal at hand is to support both v4 and v6, though I think that any design that doesn't extend to multiple addresses of the same family will be trouble in the not very distant future anyway, so we're better off so solve this at the same time.And these are not necessarily aliases, they could be multiple interfaces in a pod.That said, I agree that there's almost certainly only one writer of this info (kubelet), so the discussion here is mostly academic.Perhaps the "clean" answer is to link the fields. If a client provides the singular form only, we clear the plural form. If a client provides only the plural, it must be inclusive (or exclusive, but inclusive seems more useful with metadata) of the singular (validated statically).
Does that address your concerns on that topic?
// Default IP address allocated to the pod. Routable at least within the
// cluster. Empty if not yet allocated.
PodIP string `json:"podIP,omitempty" protobuf:"bytes,6,opt,name=podIP"`
// IP address information. Each entry includes:
// IP: An IP address allocated to the pod. Routable at least within
// the cluster.
// Properties: Arbitrary metadata associated with the allocated IP.
// This list is inclusive, i.e. it includes the default IP stored in the
// "PodIP" field. It is empty if no IPs have been allocated yet.
type PodIPInfo struct {
IP string
Properties map[string]string
}
// IP addresses allocated to the pod with associated metadata.
PodIPs []PodIPInfo `json:"podIPs,omitempty" protobuf:"bytes,6,opt,name=podIPs"`
Since I will be out for the next 3 sig-arch meetings, I am putting this here instead of on the agenda.context: https://github.com/kubernetes/community/pull/2254We have an existing field `Pod.spec.podIP` which holds a single value. The proposal is to support dual-stack networking (IPv6 and IPv4 at the same time, very common), which requires that a pod report multiple IP addresses.Our API changes doc (https://github.com/kubernetes/community/blob/master/contributors/devel/api_changes.md#on-compatibility) talks about adding a second field for "extra values", e.g. `extraPodIPs`. The point of debate here is how to do this is a maximally compatible and safe way in the face of version skew, and what guarantees can be made.If we demand that the new field (the plural) is exclusive of the singular field, we face a compat problem. Older clients might not know to update the plural. Consider an existing pod with `PodIP = "X"` and `PodIPs" = [ "Y", "Z" ]`. If we have a client that only knows `PodIP`, and it updates that field to "Z", the exclusivity invariant is violated.That effectively means that a new field has changed the meaning of an old field, and a client operation which used to work will no longer work. Bad.If we demand that the new field (the plural) is inclusive of the singular field, we face a similar problem in the other direction. Consider `PodIP = "X"` and `PodIPs" = [ "X", "Y" ]`. If an older client updates `podIP` field to "Z", the inclusivity invariant is violated. Again, a new field has changed the meaning of an old field.
I am proposing to establish the following as a convention for cases of an existing field which needs to be pluralized.
Given an existing field `widget`, and a desire to add support for multiple values:
* Add a new optional field, e.g. `widgets`.
* The new plural field, if specified, is inclusive of the old singular value
* If a client writes only the old singular field, the new plural field is cleared
* If a client writes the new plural field, they must also write the singular field
- the client may omit the singular field if and only if the value would not have changed
- the inclusive property must be maintained
* Validation logic must enforce these rules synchronously - bad API requests must fail
I would be fine requiring "new" clients to set both singular and plural. I was offering a minor shortcut for cases where no change to the primary IP is needed.Another twist could be to have "is primary" as metadata in the new field. new clients" would set the plural field, which would (server-side) sync the primary to the singular field. Old clients would set the singular field which would clear the plural field. Any update which set both singular and plural would have to agree on primary.
On Fri, Aug 3, 2018 at 4:39 PM Daniel Smith <dbs...@google.com> wrote:
>> * If a client writes only the old singular field, the new plural field is cleared
>
>
> I think this is not necessary, though it may be expedient.
If we don't do this, we can't guarantee the inclusivity. We can't
simply add singular to plural because we don't know the intention.
E.g.
Singular: X
Plural: [X, Y]
User sets Singular=Z
Did they want [X, Y, Z] or [Y, Z] or [Z, Y]?
What if plural carries metadata?
We can't necessarily infer it. Easier to just nuke plural
in that case
- client used teh old API which only afforded for a
single value.
>> * If a client writes the new plural field, they must also write the singular field
>> - the client may omit the singular field if and only if the value would not have changed
>> - the inclusive property must be maintained
>
>
> This kind of breaks apply.
Explain? Think of it this way - the update verifier will verify
inclusivity. If a patch maintains inclusivity, it should be OK?
> I think I would have a different set of rules.
>
> 1) The client must specify only the old or the new field and omit the other; it may send both fields only if they match.
> 2) The server must include a defaulting function which fixes it up in either direction.
This could work, but it would involve changing fields that were
previously user-set. How does that map to apply and patch and teh
saved snapshots?
E.g.
T0: User sets singular to X
T1: User sets plural to [Y, Z] ; server changes singular to Y (plural[0])
Is that OK?
Circling back on this before I take a little break from keyboards.I am proposing to establish the following as a convention for cases of an existing field which needs to be pluralized.Given an existing field `widget`, and a desire to add support for multiple values:* Add a new optional field, e.g. `widgets`.* The new plural field, if specified, is inclusive of the old singular value* If a client writes only the old singular field, the new plural field is cleared
* If a client writes the new plural field, they must also write the singular field- the client may omit the singular field if and only if the value would not have changed
On Thu, Jul 12, 2018 at 12:47 PM 'Tim Hockin' via kubernetes-sig-architecture <kubernetes-si...@googlegroups.com> wrote:Since I will be out for the next 3 sig-arch meetings, I am putting this here instead of on the agenda.context: https://github.com/kubernetes/community/pull/2254We have an existing field `Pod.spec.podIP` which holds a single value. The proposal is to support dual-stack networking (IPv6 and IPv4 at the same time, very common), which requires that a pod report multiple IP addresses.Our API changes doc (https://github.com/kubernetes/community/blob/master/contributors/devel/api_changes.md#on-compatibility) talks about adding a second field for "extra values", e.g. `extraPodIPs`. The point of debate here is how to do this is a maximally compatible and safe way in the face of version skew, and what guarantees can be made.If we demand that the new field (the plural) is exclusive of the singular field, we face a compat problem. Older clients might not know to update the plural. Consider an existing pod with `PodIP = "X"` and `PodIPs" = [ "Y", "Z" ]`. If we have a client that only knows `PodIP`, and it updates that field to "Z", the exclusivity invariant is violated.That effectively means that a new field has changed the meaning of an old field, and a client operation which used to work will no longer work. Bad.If we demand that the new field (the plural) is inclusive of the singular field, we face a similar problem in the other direction. Consider `PodIP = "X"` and `PodIPs" = [ "X", "Y" ]`. If an older client updates `podIP` field to "Z", the inclusivity invariant is violated. Again, a new field has changed the meaning of an old field.I have not read the rest of this thread, maybe it is covered, but this is wrong. The old client--for most values of old clients--will also completely omit the PodIPs field, so it is not ambiguous at the server what happened: PodIPs[0] should be automatically changed. We can actually do it the other way, too-- if PodIPs is present and PodIP is not, we can automatically update PodIP. The only ambiguous case is when a client sends both PodIP AND PodIPs, AND PodIP != PodIPs[0]. We can send an error on that case, as clients have to go out of their way to actually do that.
... at least that is how it should work. Until the apply work is finished, some server-side special casing would be needed to make e.g. PATCH do the right thing.OK, I skipped ahead to the end of the thread.I am proposing to establish the following as a convention for cases of an existing field which needs to be pluralized.
Given an existing field `widget`, and a desire to add support for multiple values:
* Add a new optional field, e.g. `widgets`.
* The new plural field, if specified, is inclusive of the old singular valueYes.* If a client writes only the old singular field, the new plural field is clearedI think this is not necessary, though it may be expedient.* If a client writes the new plural field, they must also write the singular field
- the client may omit the singular field if and only if the value would not have changed
- the inclusive property must be maintainedThis kind of breaks apply.
* Validation logic must enforce these rules synchronously - bad API requests must failI think I would have a different set of rules.1) The client must specify only the old or the new field and omit the other; it may send both fields only if they match.2) The server must include a defaulting function which fixes it up in either direction.
The losers in this situation are "dynamic" clients which GET the entire object and use PUT to modify the field instead of PATCH.
(Clients with static types compiled in will drop the unknown fields and work fine.)
We can, with more work, make even these clients work by comparing old and new objects in the PUT handler: for this we'd require, instead of 1) above, that if the client sends both PodIP and PodIPs, it must change at most one of those fields-- we require one of them to exactly match the prior object in order to determine which the user changed.
--
You received this message because you are subscribed to the Google Groups "kubernetes-sig-architecture" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-sig-arch...@googlegroups.com.
To post to this group, send email to kubernetes-si...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kubernetes-sig-architecture/CAB_J3bZ%2B08eR%3DG3XvOL9CnNav7xntYynqd_tQbEjT1tqoMyEQQ%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "kubernetes-sig-architecture" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-sig-arch...@googlegroups.com.
To post to this group, send email to kubernetes-si...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kubernetes-sig-architecture/CAO_RewZ6EpQ1t8dQ4%2Bcui%2Bpa3gCZ4gPjXYXYpLc7U78ALMMb5Q%40mail.gmail.com.
On Mon, Aug 13, 2018 at 11:20 AM Tim Hockin <tho...@google.com> wrote:On Fri, Aug 3, 2018 at 4:39 PM Daniel Smith <dbs...@google.com> wrote:
>> * If a client writes only the old singular field, the new plural field is cleared
>
>
> I think this is not necessary, though it may be expedient.
If we don't do this, we can't guarantee the inclusivity. We can't
simply add singular to plural because we don't know the intention.
E.g.
Singular: X
Plural: [X, Y]
User sets Singular=Z
Did they want [X, Y, Z] or [Y, Z] or [Z, Y]?IMO it's completely unambiguous that they want [Z, Y]. They deleted X and added Z.
What if plural carries metadata?Metadata for X should be cleared.We can't necessarily infer it. Easier to just nuke plural
in that caseThey did not ask to delete Y, so it is wrong to do so.(Note: I am assuming this is an associative list. If it is an atomic list then I agree it's correct to delete the whole thing, as definitionally merging it is not possible. But I think an expansion resulting in an atomic list will happen rarely or never.)- client used teh old API which only afforded for a
single value.
>> * If a client writes the new plural field, they must also write the singular field
>> - the client may omit the singular field if and only if the value would not have changed
>> - the inclusive property must be maintained
>
>
> This kind of breaks apply.
Explain? Think of it this way - the update verifier will verify
inclusivity. If a patch maintains inclusivity, it should be OK?It makes it impossible to maintain a desired state object that only expresses an opinion on the new field.
> I think I would have a different set of rules.
>
> 1) The client must specify only the old or the new field and omit the other; it may send both fields only if they match.
> 2) The server must include a defaulting function which fixes it up in either direction.
This could work, but it would involve changing fields that were
previously user-set. How does that map to apply and patch and teh
saved snapshots?
E.g.
T0: User sets singular to X
T1: User sets plural to [Y, Z] ; server changes singular to Y (plural[0])
Is that OK?Emphatically yes. It should generate all the standard errors/warnings when acquiring ownership of a new field, of course. Apply must support ownership acquisition and relinquishment.> The losers in this situation are "dynamic" clients which GET the entire object and use PUT to modify the field instead of PATCH. (Clients with static types compiled in will drop the unknown fields and work fine.)
>
> We can, with more work, make even these clients work by comparing old and new objects in the PUT handler: for this we'd require, instead of 1) above, that if the client sends both PodIP and PodIPs, it must change at most one of those fields-- we require one of them to exactly match the prior object in order to determine which the user changed.
I want to write this case down - it's come up a few times and people
are not thinking it through well enough or consistently.
--
You received this message because you are subscribed to the Google Groups "kubernetes-sig-architecture" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-sig-arch...@googlegroups.com.
To post to this group, send email to kubernetes-si...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kubernetes-sig-architecture/CAB_J3bb-b9h5nZqevSGc6fhgpYHEoEwVOtiEEgQaB9-6DRshdA%40mail.gmail.com.
On Mon, Aug 13, 2018 at 11:38 AM 'Daniel Smith' via kubernetes-sig-architecture <kubernetes-si...@googlegroups.com> wrote:On Mon, Aug 13, 2018 at 11:20 AM Tim Hockin <tho...@google.com> wrote:On Fri, Aug 3, 2018 at 4:39 PM Daniel Smith <dbs...@google.com> wrote:
>> * If a client writes only the old singular field, the new plural field is cleared
>
>
> I think this is not necessary, though it may be expedient.
If we don't do this, we can't guarantee the inclusivity. We can't
simply add singular to plural because we don't know the intention.
E.g.
Singular: X
Plural: [X, Y]
User sets Singular=Z
Did they want [X, Y, Z] or [Y, Z] or [Z, Y]?IMO it's completely unambiguous that they want [Z, Y]. They deleted X and added Z.I disagree. They should have also specified [Z, Y], which is what an auto-generated patch would contain.
On Fri, Aug 3, 2018 at 4:39 PM 'Daniel Smith' via kubernetes-sig-architecture <kubernetes-si...@googlegroups.com> wrote:On Thu, Jul 12, 2018 at 12:47 PM 'Tim Hockin' via kubernetes-sig-architecture <kubernetes-si...@googlegroups.com> wrote:Since I will be out for the next 3 sig-arch meetings, I am putting this here instead of on the agenda.context: https://github.com/kubernetes/community/pull/2254We have an existing field `Pod.spec.podIP` which holds a single value. The proposal is to support dual-stack networking (IPv6 and IPv4 at the same time, very common), which requires that a pod report multiple IP addresses.Our API changes doc (https://github.com/kubernetes/community/blob/master/contributors/devel/api_changes.md#on-compatibility) talks about adding a second field for "extra values", e.g. `extraPodIPs`. The point of debate here is how to do this is a maximally compatible and safe way in the face of version skew, and what guarantees can be made.If we demand that the new field (the plural) is exclusive of the singular field, we face a compat problem. Older clients might not know to update the plural. Consider an existing pod with `PodIP = "X"` and `PodIPs" = [ "Y", "Z" ]`. If we have a client that only knows `PodIP`, and it updates that field to "Z", the exclusivity invariant is violated.That effectively means that a new field has changed the meaning of an old field, and a client operation which used to work will no longer work. Bad.If we demand that the new field (the plural) is inclusive of the singular field, we face a similar problem in the other direction. Consider `PodIP = "X"` and `PodIPs" = [ "X", "Y" ]`. If an older client updates `podIP` field to "Z", the inclusivity invariant is violated. Again, a new field has changed the meaning of an old field.I have not read the rest of this thread, maybe it is covered, but this is wrong. The old client--for most values of old clients--will also completely omit the PodIPs field, so it is not ambiguous at the server what happened: PodIPs[0] should be automatically changed. We can actually do it the other way, too-- if PodIPs is present and PodIP is not, we can automatically update PodIP. The only ambiguous case is when a client sends both PodIP AND PodIPs, AND PodIP != PodIPs[0]. We can send an error on that case, as clients have to go out of their way to actually do that.Problem with that approach:Old client does a GET, patches PodIP (but not PodIPs) on the client side, and PUT.
This kind of breaks apply.Why? Clients that understand both need to deal with both. We already impose that rule on apply for fields that have default values set by other fields.
* Validation logic must enforce these rules synchronously - bad API requests must failI think I would have a different set of rules.1) The client must specify only the old or the new field and omit the other; it may send both fields only if they match.2) The server must include a defaulting function which fixes it up in either direction.Why is this better?
The losers in this situation are "dynamic" clients which GET the entire object and use PUT to modify the field instead of PATCH.Right.(Clients with static types compiled in will drop the unknown fields and work fine.)A case where upgrading client-go can actually break client behavior, not just require coping with signature changes.
>> It makes it impossible to maintain a desired state object that only expresses an opinion on the new field.
>
>
> Yes, that's true, for that API version.
Yeah, and I am saying that's OK. Clients just need to know that.
It's fugly, but the alternative is to assume that plural[0] ===
singular, with the corollary that any plural-associated metadata must
be totally optional or inferable.
I still feel that clearing the plural is the right thing to do. If I
have a client that is managing a resource, and it gets rolled back to
a version that only writes the singular field, I do not think the
plural fields should be retained - they hold data that is no longer
being actively managed or understood.
In this specific case, the IP addresses could (conceptually) change on
the host (think DHCP) and they won't get updated in the API because
the client doesn't know to update the plural field.
Minor revision on my previous statement. I propose that this become
the guidance for pluralizing:
Given an existing field `widget`, and a new desire to add support for
multiple values:
* Add a new optional field, e.g. `widgets`.
* The new plural field, if specified, must be inclusive of the old
singular value
- if the old singular field is not included in the new plural field,
the API operation must fail
* If a client writes only the old singular field, the new plural field
is cleared and populated with the old value
- any metadata in the new plural field must be defaultable in this case
* If a client writes the new plural field, they must ensure that it is
inclusive of the old singular field
- if the old singular field is not included in the new plural field,
the API operation must fail
I am explicitly pushing this back on the client. It might be OK to
say that defaulting logic (do we run defaults on updates?) is allowed
I have a PR started, but I was looking to find an alternate example of
changing the API in a compatible way that wasn't adding a new field or
pluralizing.
Below is the short form. I want to work up a rationale based on this
conversation.
```
Given an existing field `widget`, and a new desire to add support for
multiple values:
* Add a new plural field, e.g. `widgets[]`.
* This new field MUST be inclusive of the singular field
* On an API create or patch operation:
- if only `widget` is specified, API logic must populate
`widgets[0]` from `widget`
- if only `widgets[]` is specified, API logic must populate `widget`
from `widgets[0]`
- if both `widget` and `widgets[]` are specified, API logic must
validate that `widget` matches `widgets[0]`
* On an API update operation:
- if `widget` is changed but `widgets[]` is not, API logic must
populate `widgets[0]` from `widget`
- if `widgets[]` is changed and `widget` is not, API logic must
populate `widget` from `widgets[0]`
- if both `widget` and `widgets[]` are changed, API logic must
validate that `widget` matches `widgets[0]`
```
I am not sure the distinction is necessary, if we define "is
specified" to mean "is present in a create or patch or is changed in
an update.
I am not sure the distinction is necessary, if we define "is specified" to mean "is present in a create or patch or is changed in an update.
A controller that only knows about the former version (with only widget) and that oscillates between A and B, would create a long widgets list: [A, B, A, B, ...].
what if I set widgets[] and unset widget in my update, should it fail the validation or should it just set widget to widgets[0]?
To view this discussion on the web visit https://groups.google.com/d/msgid/kubernetes-sig-architecture/CAO_RewaNfDoVb4pwOeAZ152BAf81JmDYPTvr%3Dzj2eByOMKTFJA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/kubernetes-sig-architecture/CANw6fcFoS6cQguX_70b9adqFW%3DxkGnP5Rura34eArmW85yx6Mg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kubernetes-sig-architecture/CAO_RewYSP0%3DYr8Kc0bc6CJosvw%3DDMtrfp60np9QFRAA3HX-W0w%40mail.gmail.com.