-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Enables status subresource in order to fix generation bumping #786
Enables status subresource in order to fix generation bumping #786
Conversation
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
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.
Thanks, this looks good.
@@ -122,14 +116,6 @@ type ConfigurationList struct { | |||
Items []Configuration `json:"items"` | |||
} | |||
|
|||
func (r *Configuration) GetGeneration() int64 { | |||
return r.Spec.Generation |
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.
You could have left these and moved them to point to the ObjectMeta instead.
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.
You don't need to since metav1.ObjectMeta
has it here: https://github.com/kubernetes/apimachinery/blob/master/pkg/apis/meta/v1/meta.go#L141
And metav1.ObjectMeta
is inlined in Configuration here: https://github.com/pivotal-cf-experimental/elafros/blob/fda19f760c672e4b0f99f6efb20f71a8b5444d9c/pkg/apis/ela/v1alpha1/configuration_types.go#L39
isReady: false, | ||
}, | ||
} | ||
cases := []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.
Can we add a test that 'gofmt' is a no-op on all our go files? Somehow these got checked in with 2 spaces rather than tabs earlier.
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.
yeah :(
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.
@evankanderson @jonjohnsonjr @dprotaso It looks like the relevant issue is #582 - prow has a /lint
command but there are obstacles to running automatically.
If you don't mind waiting I'm looking into something related which might help with this 😇
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.
and then i never did anything about it :(
@@ -265,7 +265,7 @@ func (c *Controller) syncHandler(key string) error { | |||
if config.GetGeneration() == config.Status.ObservedGeneration { | |||
// TODO(vaikas): Check to see if Status.LatestCreatedRevisionName is ready and update Status.LatestReady | |||
glog.Infof("Skipping reconcile since already reconciled %d == %d", | |||
config.Spec.Generation, config.Status.ObservedGeneration) | |||
config.Generation, config.Status.ObservedGeneration) |
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.
Why isn't this config.ObjectMeta.Generation
, like Annotations, below?
mostly just curious.
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.
metav1.ObjectMeta
being inlined - you could used config.Annotations
directly actually. Might be worth a separate issue to define a convention.
@@ -361,25 +361,12 @@ func (c *Controller) syncHandler(key string) error { | |||
} | |||
|
|||
func generateRevisionName(u *v1alpha1.Configuration) (string, error) { | |||
// TODO: consider making sure the length of the | |||
// string will not cause problems down the stack | |||
if u.Spec.Generation == 0 { |
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.
I'm assuming that this is now handled by the normal k8s machinery? This was really annoying before.
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.
Yup. Though, like it's mentioned in the PR/commit message, it requires v1.10 and the feature gate.
pkg/controller/route/route.go
Outdated
if config.Labels == nil { | ||
config.Labels = make(map[string]string) | ||
} else if _, ok := config.Labels[ela.RouteLabelKey]; ok { | ||
if _, ok := config.Labels[ela.RouteLabelKey]; ok { |
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.
We didn't need the previous check because "A nil map behaves like an empty map when reading, but attempts to write to a nil map will cause a runtime panic; don't do that.", right?
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.
Yup - see example here: https://play.golang.org/p/Q5GRlc2ceES
You needed the make(map)
before this PR since it was going to insert something into the map
pkg/controller/route/route.go
Outdated
routeName, | ||
configName string) error { | ||
|
||
pathPart := strings.Replace(ela.RouteLabelKey, "/", "~1", -1) |
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.
What's the output here? The "~1" is confusing to me. Might be worth a comment.
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.
Once this is PR merged in jsonpath we'll change this to be
patch := []jsonpatch.JsonPatchOperation{
{
Operation: "add",
Path: jsonpath.MakePath("metadata/labels", ela.RouteLabelKey),
Value: routeName,
},
]}
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.
+1 to comment, probably linking to the PR.
}(), | ||
Patch: patchBytes, | ||
Allowed: true, | ||
PatchType: &patchType, |
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.
For my own curiosity, why doesn't &admissionv1beta1.PatchTypeJSONPatch
work, and we need to make a local copy instead?
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.
Go doesn't allow it see: https://stackoverflow.com/questions/35146286/find-address-of-constant-in-go
The inline function was doing the same thing before - this is more obvious in my opinion
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.
+1 I prefer the local over the function.
/approve You may need to chime in that everything is happy with CLAs (and it looks like our tests are unhappy on this PR for some reason). A sample error from the conformance test:
|
@evankanderson the google bot is having issues when @bsnchan and I co-author commits/PRs. It's getting pretty annoying at this point. The failing test is probably because the k8s test environment prow? is using kubernetes 1.9.6 vs. 1.10 with the feature-gate |
That was my guess for the latter.
For the CLA case, I don't know if having you do a single commit into the
repo directly will convince the CLA-bot that everything is okay. If not, it
may be worth filing an issue with @mchmarny to see if we can whitelist you
somehow.
…On Mon, Apr 30, 2018 at 4:53 PM David Protasowski ***@***.***> wrote:
@evankanderson <https://github.com/evankanderson> the google bot is
having issues when @bsnchan <https://github.com/bsnchan> and I co-author
commits/PRs. It's getting pretty annoying at this point.
The failing test is probably because the k8s test environment prow? is
using kubernetes 1.9.6 vs. 1.10 with the feature-gate
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#786 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AHlyN03-psFWZp0Y4dLmRgoxMbZ_IXvKks5tt6QDgaJpZM4TtFxh>
.
--
Evan Anderson <argent@google.com>
|
I think it's more about @bsnchan opening PRs which have me as co-author. I type /approve nm - it worked |
fda19f7
to
ef71832
Compare
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
/retest |
cfdc7fe
to
75f3655
Compare
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bsnchan, dprotaso, evankanderson 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 |
* This requires k8s 1.10 with CustomResourceSubresources feature gate enabled * Patching is used instead of update when adding labels - prevents bumping the generation since nested specs have a k8s Time struct which, during serialization, are not omitted when empty knative/serving#642 Signed-off-by: Brenda Chan <brchan@pivotal.io>
Signed-off-by: Brenda Chan <brchan@pivotal.io>
Signed-off-by: Dave Protasowski <dprotaso@gmail.com>
* This is required to enable CustomResourceSubresources knative/serving#642
75f3655
to
642ee1c
Compare
The following is the coverage report on pkg/. Say
*TestCoverage feature is being tested, do not rely on any info here yet |
The following is the coverage report on pkg/. Say
*TestCoverage feature is being tested, do not rely on any info here yet |
@mattmoor this should be good to go! @dprotaso already approved the CLA business in this comment. |
@mattmoor @vaikas-google can we mark this one blocked on k8s 1.11 when the subresource feature gate moves to beta. |
To record for posterity the conversation as I know it: The subresource support in k8s 1.10 is an Alpha feature locked behind a feature flag. Many k8s providers do not provide any access to alpha features, and requiring an alpha feature is likely to make it difficult to run the We're going to hold this PR for 1.11 (maybe plus a week or two?) when CRD subresources should be a beta feature. Once we commit this to the repo and cut a release containing it, our customers will need to upgrade to k8s 1.11 in order to continue using the |
/hold As @evankanderson said. |
As such, if there are parts where we can factor out the actual subresource call and flag-protect it (e.g. replace the subresource call with a PATCH on the parent for now), we could land this sooner. We'd probably have to keep the Generation in the object specs for now, but many of the helpers could go in now, and we could phase in the two write paths in a follow-on PR if this one gets too unwieldy. |
/label k8s-1.11 |
/label k8s 1.11 |
/label "k8s 1.11" |
Should we revisit this since Kubernetes 1.11 has been out for 3 months and Kubernetes 1.12 has since been released? Or would we like to hold off requiring Kubernetes 1.11 for the next release of Serving? |
@bbrowning yup it's on me |
GKE now has 1.11 - so our the Prow CI/CD can test the changes |
Fixes #642
Proposed Changes
metadata.generation
instead ofspec.generation
Time struct which, during serialization, are not omitted
when empty
Release Note
cc @dprotaso