-
Notifications
You must be signed in to change notification settings - Fork 261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
By default, set Image
to the image of the prev. revision by digest
#373
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sixolet: 8 warnings.
In response to this:
Fixes #280
Proposed Changes
By default, when the user does not request an image change, the running code should not change.
- Set the Image on a non-image service update to the image by digest of the previous revision
- Add a
--no-lock-to-digest
flag to disable this behavior (for CI systems &c)
- Implement setting Image
- Add user image annotation
- Display user image annotation as image in describe and list
- Tests for service update
- Tests for user image annotation display
- Unit tests
Release Note
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
@@ -128,6 +128,21 @@ func UpdateImage(template *servingv1alpha1.RevisionTemplateSpec, image string) e | |||
return nil | |||
} | |||
|
|||
func FreezeImageToDigest(template *servingv1alpha1.RevisionTemplateSpec, baseRevision *servingv1alpha1.Revision) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Golint comments: exported function FreezeImageToDigest should have comment or be unexported. More info.
pkg/serving/config_changes.go
Outdated
return err | ||
} | ||
if currentContainer.Image != baseContainer.Image { | ||
return fmt.Errorf("Could not freeze image to digest since current revision contains unexpected image.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Golint errors: error strings should not be capitalized or end with punctuation or a newline. More info.
@@ -230,6 +240,62 @@ func (cl *knClient) GetRevision(name string) (*v1alpha1.Revision, error) { | |||
return revision, nil | |||
} | |||
|
|||
type NoBaseRevisionError struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Golint comments: exported type NoBaseRevisionError should have comment or be unexported. More info.
pkg/serving/v1alpha1/client_mock.go
Outdated
@@ -194,6 +194,10 @@ func (r *Recorder) GetConfiguration(name string, config *v1alpha1.Configuration, | |||
|
|||
} | |||
|
|||
func (cl *MockKnClient) GetBaseRevision(service *v1alpha1.Service) (*v1alpha1.Revision, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Golint naming: receiver name cl should be consistent with previous receiver name c for MockKnClient. More info.
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
1 similar comment
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
if we do this can we PLEASE make the default to not change the user's spec on them? I think that should require an explicit request. I don't think it's appropriate to modify the user's input by default. |
The alternative is modifying the user's running code. The spec is harmless and cosmetic compared to that.
… On Aug 16, 2019, at 7:16 PM, Doug Davis ***@***.***> wrote:
if we do this can we PLEASE make the default to not change the user's spec on them? I think that should require an explicit request. I don't think it's appropriate to modify the user's input by default.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Not sure about that since that's what the user asked for. Right now there's already a flag that allows people to control whether their image is "locked down" or not - it's the "image" property. If they provide a static "tag" or a digest then they're asking for things to be locked down. If they provide a dynamic "tag" then they're not. The introduction of this flag now adds a third variant to this boolean choice - meaning, the previous "do not lock down" is now split into "implied lock down" and "not locked down but only if they specify I'd like to step back and look at the higher-level feature request because I don't think it's a If we believe that updating the env vars should not cause us to re-get the digest then that should be true for all CLIs and this should be solved at the server/API level so we have a consistent UX no matter how people talk to KnServing. Some folks have mentioned that this is a challenge due to there not being a good way for a user to "poke" the re-getting of the digest but there are ways to do this, we've even talked about some, but to toss up our hands and force a Also, modifying the user provided spec data (w/o them asking) is bad form in Kubernertes. Yes there are some examples where this happens today, but I believe those are rare. So, the act of converting an image name:tag into a digest should be an explicit request from the user and I think it would be better to be done on the initial specification of the non-digest image name rather than during a subsequent request - which could be very surprising if someone thinks they're just update an env var and end's up modifying some other part of the spec. So, a Finally, regardless of which way things are defaulted (if we do this at all), it would be nice if this were set just once on a per-service basis. If people like this "map to digest for me" feature, but they don't want it for all of their services (meaning a config file option isn't a good choice for them) then asking them to set it on all interactions with the service can be quite tedious and risky since they may forget which service needs this auto-mapping and which do not. It would be better if they could set a flag once per service (perhaps as an annotation) and then the mapping would happen (or not) for them on that service forever. This would also allow us to implement this on the server side and all CLIs would get the benefit. |
There have been literally hours of conversation about this in the serving working group, and "the client should set the image to the digest" was our conclusion. Having the moral equivalent of an image pull policy was too confusing, having a flag you have to set and remember to unset the next time that told you to pull the image was too tricky. I promise you we considered alternatives.
… On Aug 19, 2019, at 6:29 AM, Doug Davis ***@***.***> wrote:
The alternative is modifying the user's running code. The spec is harmless and cosmetic compared to that.
Not sure about that since that's what the user asked for.
Right now there's already a flag that allows people to control whether their image is "locked down" or not - it's the "image" property. If they provide a static "tag" or a digest then they're asking for things to be locked down. If they provide a dynamic "tag" then they're not. The introduction of this flag now adds a third variant to this boolean choice - meaning, the previous "do not lock down" is now split into "implied lock down" and "not locked down but only if they specify --yes-I-really-want-this on each and every service update. We're forcing people to jump through hoops unnecessary.
I'd like to step back and look at the higher-level feature request because I don't think it's a kn specific issue. I've heard people talk about how the KnService model is a delta model - meaning people should not be required to provide the entire new version of the Service they want to deploy next, rather just the small deltas. If this is really the case then this should apply regardless of the CLI being used - meaning it should be true even when using kubectl. My point is that this isn't a CLI issue, rather it's a server issue.
If we believe that updating the env vars should not cause us to re-get the digest then that should be true for all CLIs and this should be solved at the server/API level so we have a consistent UX no matter how people talk to KnServing. Some folks have mentioned that this is a challenge due to there not being a good way for a user to "poke" the re-getting of the digest but there are ways to do this, we've even talked about some, but to toss up our hands and force a --really-do-what-I-asked-for flag on the user is not a good alternative.
Also, modifying the user provided spec data (w/o them asking) is bad form in Kubernertes. Yes there are some examples where this happens today, but I believe those are rare. So, the act of converting an image name:tag into a digest should be an explicit request from the user and I think it would be better to be done on the initial specification of the non-digest image name rather than during a subsequent request - which could be very surprising if someone thinks they're just update an env var and end's up modifying some other part of the spec. So, a --to-digest (or --lock-image) flag would give the user the ability to explicitly ask for us to do this mapping on their behalf.
Finally, regardless of which way things are defaulted (if we do this at all), it would be nice if this were set just once on a per-service basis. If people like this "map to digest for me" feature, but they don't want it for all of their services (meaning a config file option isn't a good choice for them) then asking them to set it on all interactions with the service can be quite tedious and risky since they may forget which service needs this auto-mapping and which do not. It would be better if they could set a flag once per service (perhaps as an annotation) and then the mapping would happen (or not) for them on that service forever.
This would also allow us to implement this on the server side and all CLIs would get the benefit.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I agree with "set this behavior once", but it's more on a per-org basis. If you never mutate tags, you don't need it. So let's put it into the kn config file — set it how your org wants, move on.
… On Aug 19, 2019, at 6:29 AM, Doug Davis ***@***.***> wrote:
The alternative is modifying the user's running code. The spec is harmless and cosmetic compared to that.
Not sure about that since that's what the user asked for.
Right now there's already a flag that allows people to control whether their image is "locked down" or not - it's the "image" property. If they provide a static "tag" or a digest then they're asking for things to be locked down. If they provide a dynamic "tag" then they're not. The introduction of this flag now adds a third variant to this boolean choice - meaning, the previous "do not lock down" is now split into "implied lock down" and "not locked down but only if they specify --yes-I-really-want-this on each and every service update. We're forcing people to jump through hoops unnecessary.
I'd like to step back and look at the higher-level feature request because I don't think it's a kn specific issue. I've heard people talk about how the KnService model is a delta model - meaning people should not be required to provide the entire new version of the Service they want to deploy next, rather just the small deltas. If this is really the case then this should apply regardless of the CLI being used - meaning it should be true even when using kubectl. My point is that this isn't a CLI issue, rather it's a server issue.
If we believe that updating the env vars should not cause us to re-get the digest then that should be true for all CLIs and this should be solved at the server/API level so we have a consistent UX no matter how people talk to KnServing. Some folks have mentioned that this is a challenge due to there not being a good way for a user to "poke" the re-getting of the digest but there are ways to do this, we've even talked about some, but to toss up our hands and force a --really-do-what-I-asked-for flag on the user is not a good alternative.
Also, modifying the user provided spec data (w/o them asking) is bad form in Kubernertes. Yes there are some examples where this happens today, but I believe those are rare. So, the act of converting an image name:tag into a digest should be an explicit request from the user and I think it would be better to be done on the initial specification of the non-digest image name rather than during a subsequent request - which could be very surprising if someone thinks they're just update an env var and end's up modifying some other part of the spec. So, a --to-digest (or --lock-image) flag would give the user the ability to explicitly ask for us to do this mapping on their behalf.
Finally, regardless of which way things are defaulted (if we do this at all), it would be nice if this were set just once on a per-service basis. If people like this "map to digest for me" feature, but they don't want it for all of their services (meaning a config file option isn't a good choice for them) then asking them to set it on all interactions with the service can be quite tedious and risky since they may forget which service needs this auto-mapping and which do not. It would be better if they could set a flag once per service (perhaps as an annotation) and then the mapping would happen (or not) for them on that service forever.
This would also allow us to implement this on the server side and all CLIs would get the benefit.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
/restest |
I'm sure I'm not alone in this... I don't have a single org I work with. Nor will there always be a single CLI/user per service. So you run the risk of different users applying (or not) this setting to the same service and getting it wrong. This type of setting really needs to be stored with the service itself so it can be applied consistently regardless of who might tweak it. |
Is this a setting which might be best applied on a per-namespace basis?
…On Mon, Aug 19, 2019 at 12:03 PM Doug Davis ***@***.***> wrote:
but it's more on a per-org basis.
I'm sure I'm not alone in this... I don't have a single org I work with.
Nor will there always be a single CLI/user per service. So you run the risk
of different users applying (or not) this setting to the same service and
getting it wrong. This type of setting really needs to be stored with the
service itself so it can be applied consistently regardless of who might
tweak it.
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#373?email_source=notifications&email_token=AB4XEN4SWADSIUMKOJSDOI3QFLVB7A5CNFSM4IMNJAQKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4T7JRY#issuecomment-522712263>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AB4XENZ6QXVCDKA4NDHNKN3QFLVB7ANCNFSM4IMNJAQA>
.
--
Evan Anderson <[email protected]>
|
Yeah namespace does sound like a good scope. Is a Namespace object kosher to query for a label though?
… On Aug 19, 2019, at 1:43 PM, Evan Anderson ***@***.***> wrote:
Is this a setting which might be best applied on a per-namespace basis?
On Mon, Aug 19, 2019 at 12:03 PM Doug Davis ***@***.***>
wrote:
> but it's more on a per-org basis.
>
> I'm sure I'm not alone in this... I don't have a single org I work with.
> Nor will there always be a single CLI/user per service. So you run the risk
> of different users applying (or not) this setting to the same service and
> getting it wrong. This type of setting really needs to be stored with the
> service itself so it can be applied consistently regardless of who might
> tweak it.
>
> —
> You are receiving this because your review was requested.
> Reply to this email directly, view it on GitHub
> <#373?email_source=notifications&email_token=AB4XEN4SWADSIUMKOJSDOI3QFLVB7A5CNFSM4IMNJAQKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4T7JRY#issuecomment-522712263>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AB4XENZ6QXVCDKA4NDHNKN3QFLVB7ANCNFSM4IMNJAQA>
> .
>
--
Evan Anderson ***@***.***>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Talking with various people in Seattle (Dan, Matt, and Neil), I think it might be most natural to be able to store this information as an annotation on the Service object -- possibly even using the kn create --lock-to-digest docker.io/awesome/i-am-awesome:latest
# Creates the Service with client.knative.dev/user-image annotation set to ":latest"
kn deploy --no-lock-to-digest docker.io/awesome/i-am-awesome:latest
# Removes the client.knative.dev/user-image annotation, causing future deploys to "float" forward |
That's a pretty good compromise. Now we just have to pick a default for service creation.
… On Aug 19, 2019, at 3:52 PM, Evan Anderson ***@***.***> wrote:
Talking with various people in Seattle (Dan, Matt, and Neil), I think it might be most natural to be able to store this information as an annotation on the Service object -- possibly even using the client.knative.dev/user-image as the hint as to whether the label should be continuously re-resolved or not. This also allows initial deploy to set a policy for future deploys, e.g.
kn create --lock-to-digest docker.io/awesome/i-am-awesome:latest
# Creates the Service with client.knative.dev/user-image annotation set to ":latest"
kn deploy --no-lock-to-digest docker.io/awesome/i-am-awesome:latest
# Removes the client.knative.dev/user-image annotation, causing future deploys to "float" forward
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
You know how I feel :-) do what the user asked for - meaning if they gave a floating tag then stick with a floating tag. If they want us to twiddle their input data then they should ask for it. |
The following is the coverage report on pkg/.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jimcurtis, sixolet The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Bonus: linted dep-collector's `README.md`.
Fixes #280
Proposed Changes
By default, when the user does not request an image change, the running code should not change.
--no-lock-to-digest
flag to disable this behavior (for CI systems &c)Release Note