Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Use kubectl describe foo name #196

Merged
merged 1 commit into from
Oct 19, 2018
Merged

Use kubectl describe foo name #196

merged 1 commit into from
Oct 19, 2018

Conversation

fejta
Copy link
Contributor

@fejta fejta commented Oct 18, 2018

If we do not include the -o name then the command output includes a (dry run) suffix.

/assign @smukherj1 @nlopezgi

This seems to be causing issues in recent kubectl versions (#193 (comment)).

  • Formatting fixes while I'm in these files
  • Run delete || true before running create, in case zombie resources exist from a prior run.
  • Logging the steps before they run to assist debugging

@erain
Copy link
Contributor

erain commented Oct 18, 2018

I thought kubectl get foo name is more commonly used than kubectl get foo/name? Example: kubectl Cheat Sheet

@fejta
Copy link
Contributor Author

fejta commented Oct 18, 2018

Maybe kubectl get foo name and kubectl get foo/name are both fine, but it doesn't like kubectl get foo foo/name

@fejta
Copy link
Contributor Author

fejta commented Oct 18, 2018

Looks like the problem is in the actual bazel rules... Let me see if I can figure this out...

@fejta
Copy link
Contributor Author

fejta commented Oct 18, 2018

Think this is the problematic bit:

RESOURCE_NAME=$(kubectl create --dry-run -f "%{unresolved}" | cut -d'"' -f 2)
kubectl --cluster="%{cluster}" --context="%{context}" --user="%{user}" %{namespace_arg} describe %{kind} \
"${RESOURCE_NAME}"

@fejta fejta changed the title Use kubectl get foo/name not get foo name Use kubectl describe foo name Oct 18, 2018
@fejta
Copy link
Contributor Author

fejta commented Oct 18, 2018

/retest

@fejta
Copy link
Contributor Author

fejta commented Oct 18, 2018

These e2e tests are the WORST 😅

@fejta
Copy link
Contributor Author

fejta commented Oct 18, 2018

Okay I think I have it!

Looks like the problem here is that kubectl create --dry-run -f "%{unresolved}" now outputs (dry run):
deployment.apps/hello-grpc-staging created (dry run)
But we want the name without the (dry run) suffix:
deployment.apps/hello-grpc-staging created

We can fix this by adding an -o name flag.

@fejta
Copy link
Contributor Author

fejta commented Oct 18, 2018

/retest

@fejta
Copy link
Contributor Author

fejta commented Oct 18, 2018

These e2e tests are the WORST 😅

Dear e2e tests, please stop editing .go, .java, .py, .js files when I run you, which I don't notice and wind up including in this PR. kthxbye!

@fejta
Copy link
Contributor Author

fejta commented Oct 18, 2018

/retest

@fejta
Copy link
Contributor Author

fejta commented Oct 18, 2018

PASS! 🎆 🍾 🎊

Copy link
Contributor

@chrislovecnm chrislovecnm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just bash nit picks ... look great otherwise :)

echo "Success, substitution failed."
return 0
else
echo "Bad substitution should fail!"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I am a grammar critic it could read a tad better, but a nit pick

@@ -40,33 +41,35 @@ check_msg() {
}

edit() {
./examples/hellohttp/${LANGUAGE}/edit.sh "$1"
echo Setting $LANGUAGE to "$1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please quote language var. We might want to lint with shellcheck

@@ -24,44 +24,49 @@ if [[ -z "${1:-}" ]]; then
fi

get_lb_ip() {
kubectl --namespace=${USER} get service hello-grpc-staging \
-o jsonpath='{.status.loadBalancer.ingress[0].ip}'
kubectl --namespace=${USER} get service hello-grpc-staging \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put quotes around all variables

kubectl --namespace=${USER} get service hello-grpc-staging \
-o jsonpath='{.status.loadBalancer.ingress[0].ip}'
kubectl --namespace=${USER} get service hello-grpc-staging \
-o jsonpath='{.status.loadBalancer.ingress[0].ip}'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again missing quotes around a bash var

@chrislovecnm
Copy link
Contributor

/assign

@chrislovecnm
Copy link
Contributor

Well that did not work 😂😂

Copy link
Contributor

@erain erain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Maybe quote the vars as Chris required?

@chrislovecnm
Copy link
Contributor

chrislovecnm commented Oct 19, 2018

I can do a follow-up PR as well. @fejta thoughts?

@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chrislovecnm, erain

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@chrislovecnm
Copy link
Contributor

@fejta I removed my blocking review, so up to you if you want to fix my recommendations or not. I can do a follow-up PR as I mentioned.

@chrislovecnm
Copy link
Contributor

This is blocking testing big time. @erain / @fejta / @nlopezgi can someone merge?

@smukherj1 smukherj1 merged commit b9bc187 into bazelbuild:master Oct 19, 2018
@fejta fejta deleted the fix branch October 19, 2018 20:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants