-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
Switch away from gcloud deprecated flags in compute resource listings #50398
Conversation
Hi @pci. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with I understand the commands that are listed here. 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. I understand the commands that are listed here. |
4fa18d5
to
60825f9
Compare
/unassign |
/unassign |
/ok-to-test |
/cc @shyamjvs |
/assign @ixdy |
cluster/gce/list-resources.sh
Outdated
@@ -75,10 +75,10 @@ echo "Provider: ${KUBERNETES_PROVIDER:-}" | |||
# provided. | |||
gcloud-compute-list instance-templates --regexp="${INSTANCE_PREFIX}.*" | |||
gcloud-compute-list instance-groups ${ZONE:+"--zones=${ZONE}"} --regexp="${INSTANCE_PREFIX}.*" | |||
gcloud-compute-list instances ${ZONE:+"--zones=${ZONE}"} --regexp="${INSTANCE_PREFIX}.*" | |||
gcloud-compute-list instances --filter="${ZONE:+"zone=(${ZONE}) AND"} name ~ '${INSTANCE_PREFIX}.*'" |
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.
Are you sure this works with the first double apostrophe closed by the immediate next one?
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.
Here are the tests I ran:
$ test="${ZONE:+"zone=(${ZONE}) AND"} name ~ '${INSTANCE_PREFIX}.*'"; echo $test
name ~ '.*'
$ ZONE=foo; test="${ZONE:+"zone=(${ZONE}) AND"} name ~ '${INSTANCE_PREFIX}.*'"; echo $test
zone=(foo) AND name ~ '.*'
$ INSTANCE_PREFIX=bar; test="${ZONE:+"zone=(${ZONE}) AND"} name ~ '${INSTANCE_PREFIX}.*'"; echo $test
name ~ 'bar.*'
$ ZONE=foo;INSTANCE_PREFIX=bar; test="${ZONE:+"zone=(${ZONE}) AND"} name ~ '${INSTANCE_PREFIX}.*'"; echo $test
zone=(foo) AND name ~ 'bar.*'
run on my local machine:
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin16)
Copyright (C) 2007 Free Software Foundation, Inc.
test/e2e/framework/ingress_utils.go
Outdated
@@ -761,9 +761,20 @@ func (cont *GCEIngressController) deleteStaticIPs() error { | |||
func gcloudComputeResourceList(resource, regex, project string, out interface{}) { | |||
// gcloud prints a message to stderr if it has an available update | |||
// so we only look at stdout. | |||
var regexFlag string |
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.
nit: s/regexFlag/regexpFlag/
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.
Absolutely, sorry for the typo.
Also as this is my first kubernetes' PR, do reviewers prefer changes as a second commit, or squashed into the first and rebased on an up-to-date master ?
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.
Usually it's better to add a new commit on each review round, so previous comments are not lost and also it's easier to verify if comments have been addressed.
However, it's ok to squash for simple PRs.
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.
If an additional commit is the standard way, I'll go with that.
Update pushed, I realised filterFlag
is a better name for the flag given it's the flag applying the filter and not always a regex.
test/e2e/framework/ingress_utils.go
Outdated
@@ -761,9 +761,20 @@ func (cont *GCEIngressController) deleteStaticIPs() error { | |||
func gcloudComputeResourceList(resource, regex, project string, out interface{}) { | |||
// gcloud prints a message to stderr if it has an available update | |||
// so we only look at stdout. | |||
var regexFlag string | |||
|
|||
// --regex flag is deprecated for these resources: |
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.
--regexp
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.
👍 Same as above
Also there are usages of the regexp flag in cluster/gce/util.sh. Can you fix them also? |
@shyamjvs How did I miss those?! My Will the automated tests cover these lines or is there some manual testing I could do? |
The automated tests should likely cover it (though I'm not sure if they'd pass as the gcloud version currently being used for those tests has been pinned at 163.0.0). |
@shyamjvs Ah, thanks. The logs looked like a timeout. |
/lgtm |
/retest |
/test pull-kubernetes-e2e-gce-etcd3 (failed due to "Backend Error" in |
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 for taking this on!
--zones "${ZONE}" --project "${PROJECT}" \ | ||
--regexp "${NODE_INSTANCE_PREFIX}-.+" \ | ||
--project "${PROJECT}" \ | ||
--filter "name ~ '${NODE_INSTANCE_PREFIX}-.+' AND zone:(${ZONE})" \ |
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 is it sometimes zone:(${ZONE})
and sometimes zone=(${ZONE})
?
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.
ah, I guess :(
matches patterns, whereas =(
matches exactly, per https://cloud.google.com/sdk/gcloud/reference/topic/filters.
this is probably fine, though I'm guessing =(
is maybe more correct?
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.
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.
@ixdy Very sorry - I missed one zone here I'll fix that
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.
ok, there now shouldn't be any occurrences of zone=
inside a filter
/lgtm |
/test pull-kubernetes-e2e-gce-bazel |
/approve |
@ixdy No problem, thank you (and shyamjvs & roberthbailey) for your efforts in reviewing and moving this forward. |
d1a0820
to
697f92a
Compare
@ixdy @shyamjvs @roberthbailey Once again my apologies - There was still a Famous last words but I hope that's the last one. |
ok, so |
@ixdy that definitely seems to be the case, although the deprecation warning is the only documentation I've found on it! Even if they fix the behaviour of |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ixdy, pci, roberthbailey, shyamjvs Associated issue: 49673 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
/test pull-kubernetes-e2e-gce-bazel Failed with "no such file" |
yeah. :\ the good news is that gce-bazel isn't blocking at the moment. |
Automatic merge from submit-queue (batch tested with PRs 47054, 50398, 51541, 51535, 51545) |
Woo! Thanks all. I'll look to open the cherry-pick PRs to 1.7, 1.6 and 1.5 tonight (UK time), let me know if that isn't the right next step. |
What is fixed
Remove deprecated
gcloud compute
flags, see linked issue.Which issue this PR fixes:
fixes #49673
Special notes for your reviewer:
The change in
gcloudComputeResourceList
intest/e2e/framework/ingress_utils.go
isn't strictly needed as currently no affected resources are called on within that file, however the function has the potential to access affected resources so I covered it as well. Happy to change if deemed unnecessary.Release note: