Skip to content
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

improvement: add cluster, pod and zonal details to the page footer #636

Merged
merged 6 commits into from
Nov 26, 2021

Conversation

Shabirmean
Copy link
Member

@Shabirmean Shabirmean commented Nov 25, 2021

Background

  • It was requested that we show the pod placement details like - Cluster, Zone, Hostname of Pod - in the pages of the Online Boutique just like how we have with Bank of Anthos. This is mainly for demos which include multi cluster setups - so we can see that different clusters and regional pods are responding to requests from different locations.

Fixes #628 #631

Change Summary

  • Add a new utility method in the handlers package to get the deployment details
  • Use the cloud.google.com/go/compute/metadata package to retreive the Zone and Clustername information
  • Use the os.hostname() function to get the Pod name
  • Use the utility method in all the places where the template rendering is called
  • Update the footer template to include the deployment details

Additional Notes

  • N/A

Testing Procedure

  • Navigate to all the pages of the staged website to see if you see the details
  • Verify that those details match the ones on the Google Cloud Console
  • Check if there are any errors in the staged (or your own deployment)
  • Stretch test - Check if you can setup a multi cluster setup like explained for Bank of Anthos, and accessing the website from two VMs located in different regions (or via a VPN) and if the deployment details are different.

Related PRs or Issues #628 #631

image

@Shabirmean Shabirmean requested a review from a team as a code owner November 25, 2021 20:24
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Nov 25, 2021
@github-actions
Copy link

🚲 PR staged at http://34.138.181.102

@github-actions
Copy link

🚲 PR staged at http://34.138.181.102

Copy link
Collaborator

@NimJay NimJay left a comment

Choose a reason for hiding this comment

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

Things are looking good, Shabir. And thanks for working on this.
I left a few comments.

I wonder how this would work on non GKE clusters. I'm guessing we'd just see these error logs:

Failed to fetch the name of the cluster in which the pod is running
Failed to fetch the Zone of the node where the pod is scheduled

And we'd see the postHostname being displayed.
If you think this is the case, all good!

src/frontend/templates/footer.html Outdated Show resolved Hide resolved
src/frontend/handlers.go Outdated Show resolved Hide resolved
src/frontend/handlers.go Show resolved Hide resolved
src/frontend/handlers.go Show resolved Hide resolved
@Shabirmean
Copy link
Member Author

Things are looking good, Shabir. And thanks for working on this. I left a few comments.

I wonder how this would work on non GKE clusters. I'm guessing we'd just see these error logs:

Failed to fetch the name of the cluster in which the pod is running
Failed to fetch the Zone of the node where the pod is scheduled

And we'd see the postHostname being displayed. If you think this is the case, all good!

So yeah, we will see the logs in the pods. The fields in the UI will be blank

Cluster:
Zone:
Pod:

@github-actions
Copy link

🚲 PR staged at http://34.138.181.102

@github-actions
Copy link

🚲 PR staged at http://34.138.181.102

Copy link
Collaborator

@NimJay NimJay left a comment

Choose a reason for hiding this comment

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

Everything looks good.
I was also able to skaffold dev into my own GKE cluster.
Approved.

@Shabirmean Shabirmean merged commit 09956ca into master Nov 26, 2021
@Shabirmean Shabirmean deleted the issue-628 branch November 26, 2021 15:14
sitaramkm pushed a commit to sitaramkm/microservices-demo that referenced this pull request Mar 27, 2022
…oogleCloudPlatform#636)

* improvement: add zone, cluster and pod details to footer

* improvment: add the dep details to all pages

* cleanup: revert changes to hide loadgen

* cleanup: pr comment cleanup

* fix: br tag fix

* fix: extra br tag fix
D-Mwanth pushed a commit to D-Mwanth/microservices-demo that referenced this pull request Mar 6, 2024
…oogleCloudPlatform#636)

* improvement: add zone, cluster and pod details to footer

* improvment: add the dep details to all pages

* cleanup: revert changes to hide loadgen

* cleanup: pr comment cleanup

* fix: br tag fix

* fix: extra br tag fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Indicate Cloud Region/Location in Front-end
3 participants