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

Introduce Istio/ASM Kustomize component #1601

Merged
merged 11 commits into from
Mar 17, 2023

Conversation

gbrayut
Copy link
Member

@gbrayut gbrayut commented Mar 13, 2023

Background

The current service mesh instructions only include the OSS Istio installation instructions and does not mention the preferred approach for GKE, which is ASM via Fleet API. The instruction also are not using Kustomize components, which is now the preferred approach for demo variants.

Fixes

Fixes #1203

Change Summary

  1. Move istio-manifests to kustomize/components/service-mesh-istio
  2. Create test for Istio kustomize component
  3. Update hack/make-release-artifacts.sh and kustomize/kustomization.yaml
  4. Move instructions into the README on kustomize component

Additional Notes

Remaining Tasks for this PR:

  • update kustomize/components/service-mesh-istio/README.md
  • update microservices-demo README.md and /docs/cloudshell-tutorial.md
  • incorporate any PR feedback

Testing Procedure

Install Anthos Service Mesh or Istio OSS, setup an Istio Ingress Gateway, and make sure sidecar injection is enabled in target namespace.

Then from the kustomize/ folder at the root level of this repository:

kustomize edit add component components/service-accounts
kustomize edit add component components/service-mesh-istio
kubectl apply -k .

@gbrayut gbrayut requested a review from a team as a code owner March 13, 2023 17:23
@gbrayut
Copy link
Member Author

gbrayut commented Mar 13, 2023

@NimJay I finished the first draft of the new README (see rendered version here) and this should now be ready for review.

I forgot that changing from istio-ingressgateway to Kubernetes Gateway API also means changing from Istio CRDs to the Gateway CRDs. Those are still "The Future" of ASM/Istio, but may be more disruptive if other demos still rely on the Istio way of configuring things.

But it does eliminate a lot of steps like having to deploy the istio-ingress namespace/deployment/service resources. Take a look at the frontend-gateway.yaml and if you think that is too much change right now I can try separating the Gateway API stuff into another component.

@NimJay
Copy link
Collaborator

NimJay commented Mar 15, 2023

Will Review Soon

Just so you're not left in the dark: I plan on reviewing this tomorrow.
Overall (based on my quick skim), this looks amazing!

@gbrayut
Copy link
Member Author

gbrayut commented Mar 15, 2023

No worries, take all the time you need. Also, the more I think about it, the more I feel it probably is not best to fully replace the Istio classic resources (Istio Gateway and VirtualService CRDs) with the new Kubernetes Gateway and HTTPRoute method of configuring the service mesh. I think a better approach would be keeping the service-mesh-istio component as it currently stands and then:

  • add a new standalone service-mesh-istio-classic component that uses the previous Istio CRDs so anyone using those resources can use that component instead
  • switch the hack script to use the classic component for rendering the release/istio-manifest.yaml file
  • optionally could create a new istio-httproute-manifest for the other component, but since using kustomize is preferred I'm fine with omitting this and only having the static manifest for istio classic

The classic CRDs won't ever go away, and if adoption of the new gateway/HTTPRoute picks up and becomes preferred the static manifest could be updated. But removing those entirely right now is probably not great.

Happy to add that to this PR... let me know your thoughts.

NimJay added a commit to NimJay/cloud-ops-sandbox that referenced this pull request Mar 16, 2023
Online Boutique is introducing a new Kustomize Component for Anthos Service Mesh.
See pull-request: GoogleCloudPlatform/microservices-demo#1601

The 3 files inside the /istio-manifests folder will eventually be deleted.
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.

Thanks again, @gbrayut, for creating this pull-request!
Things are looking good.
I've left a few comments.

Kubernetes Gateway API

You mentioned

"I feel it probably is not best to fully replace the Istio classic resources (Istio Gateway and VirtualService CRDs) with the new Kubernetes Gateway and HTTPRoute"

I think Online Boutique should embrace the new "Kubernetes Gateway and HTTPRoute" way of deploying Istio resources. Reasons:

  • Istio intends to make it the default API for traffic management [source].
  • I want to avoid having to maintain multiple manifests doing the same thing.
  • I worry it could confuse users. Online Boutique should pick a single approach and imply "this is how it should be done".

Related note:

@@ -124,8 +124,7 @@ The [`/terraform` folder](terraform) contains instructions for using [Terraform]

## Other deployment variations

- **Istio**: [See these instructions.](docs/service-mesh.md)
- **Anthos Service Mesh**: [See these instructions](/docs/service-mesh.md)
- **Istio/Anthos Service Mesh**: [See these instructions.](/kustomize/components/service-mesh-istio/README.md)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Praise: Thanks for thoroughly updating the surrounding documentation!

hack/make-release-artifacts.sh Show resolved Hide resolved
- ../../components/google-cloud-operations
- ../../components/network-policies
- ../../components/service-accounts
- ../../components/service-mesh-istio
Copy link
Collaborator

Choose a reason for hiding this comment

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

Praise: Thanks for pro-actively adding this test.

# - components/spanner
# - components/service-mesh-istio
# - components/without-loadgenerator
Copy link
Collaborator

Choose a reason for hiding this comment

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

Question:
Should we remove the

# - components/native-grpc-health-check
# - components/without-loadgenerator

lines at the bottom (since we've just moved it up)?

Also, thanks for catching this!

Copy link
Member Author

Choose a reason for hiding this comment

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

I removed the duplicate without-loadgenerator and confirmed they work in the listed order. native-grpc-health-check was not duplicated and I think it needs to be at the end since it also modifies the image tags. But I could be wrong there.

Copy link
Collaborator

Choose a reason for hiding this comment

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

"confirmed they work in the listed order"

Thank you for being so thorough!

"native-grpc-health-check ... needs to be at the end since it also modifies the image tags"

Ah, that's a good thought!
If I had to guess the order, it would be:

# - components/container-images-tag
# - components/native-grpc-health-check
# - components/container-images-tag-suffix
# - components/container-images-registry

Reason for my guess: Both native-grpc-health-check and container-images-tag use the newTag field, so they should be in the same position.

But I doubt anyone using native-grpc-health-check would use any of: container-images-tags, container-images-tag-suffix, or container-images-registry. So let's let it be. :)

kustomize/components/service-mesh-istio/README.md Outdated Show resolved Hide resolved

# Configure Managed Data Plane (automatic restart of workloads when envoy sidecar is updated)
kubectl annotate --overwrite namespace default \
mesh.cloud.google.com/proxy='{"managed":"false"}'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nitpick: For readability and consistency:

Suggested change
mesh.cloud.google.com/proxy='{"managed":"false"}'
mesh.cloud.google.com/proxy='{"managed":"false"}'


# Update firewall rule (or create a new one) to allow webhook port 15017
gcloud compute firewall-rules update gke-onlineboutique-c94d71e8-master \
--allow tcp:10250,tcp:443,tcp:15017
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nitpick: For readability and consistency:

Suggested change
--allow tcp:10250,tcp:443,tcp:15017
--allow tcp:10250,tcp:443,tcp:15017

Copy link
Collaborator

@NimJay NimJay Mar 16, 2023

Choose a reason for hiding this comment

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

Issue:
Please bring back these files:

  • istio-manifests/frontend.yaml
  • istio-manifests/frontend-gateway.yaml
  • istio-manifests/allow-egress-googleapis.yaml

I realized that it's currently being used in https://github.com/GoogleCloudPlatform/cloud-ops-sandbox/blob/milestone/0.9/provisioning/kustomize/online-boutique/no-loadgenerator/with-ingress/kustomization.yaml.
I will eventually delete them from Online Boutique once I fix GoogleCloudPlatform/cloud-ops-sandbox#1012.

You made a good point about preserving git history (via git mv).
But that's okay — we can live without the git history attached to the new files.
Hopefully, anyone investigating the git history will come across this pull-request. :)

virtualservice.networking.istio.io/frontend created
```

## Deploy via `istio-manifests.yaml`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggestion (feel free to ignore):
Let's remove this "Deploy via istio-manifests.yaml".
Ideally, we would stop supporting this method — for ease of maintenance.

@NimJay NimJay changed the title Move istio-manifests to kustomize component Add istio-manifests to kustomize component Mar 16, 2023
@NimJay NimJay changed the title Add istio-manifests to kustomize component Introduce Istio/ASM Kustomize component Mar 16, 2023
@gbrayut
Copy link
Member Author

gbrayut commented Mar 16, 2023

Branch updated with requested changes and should be ready for final review. I assume you'll handle the "out-of-date with base" and/or do a squash commit. Also it looks like your gmail (which gets used for the recommended changes) doesn't pass the CLA check, so I had to force-push that commit out of the branch.

image

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.

Thank you for addressing my comments so quickly, @gbrayut!
Everything looks good.
You did an incredible job here. 🤯
Approved!

CLA issue with my personal email

Ah, yes, I noticed that my suggestion's commits use my personal email.
I'll look into fixing this issue (either force GitHub to use my Google email for suggestion commits or CLA-approve my personal email).
(Tip: we can also use go/gh-prinfo to override the CLA check.)

@@ -23,11 +23,11 @@ components:
# - components/network-policies
# - components/non-public-frontend
# - components/service-accounts
# - components/alloydb
Copy link
Collaborator

Choose a reason for hiding this comment

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

FYI: While merging conflicts, I put components/alloydb under components/service-accounts. This is intentional. components/alloydb modifies the cartservice ServiceAccount — so it needs to come after (to avoid Kustomize errors). :)

@NimJay NimJay merged commit 34da24c into GoogleCloudPlatform:main Mar 17, 2023
mrcrgl pushed a commit to fiberfjord/microservices-demo that referenced this pull request Sep 11, 2023
* Move istio-manifests to kustomize/components/service-mesh-istio

* Create Istio kustomize component

* Create test for Istio kustomize component

* update hack/make-release-artifacts.sh and kustomize/kustomization.yaml

* Move docs/service-mesh.md to kustomize/components/service-mesh-istio/README.md

* Update README.md and cloudshell-tutorial.md references to previous service-mesh.md

* Convert frontend-gateway.yaml from Istio CRDs to Kubernetes Gateway CRDs

* Draft updates to service-mesh-istio/README.md

* Restore istio-manifests (cannot be deleted yet)

* fixup pr comments

---------

Co-authored-by: Nim Jayawardena <[email protected]>
D-Mwanth pushed a commit to D-Mwanth/microservices-demo that referenced this pull request Mar 6, 2024
* Move istio-manifests to kustomize/components/service-mesh-istio

* Create Istio kustomize component

* Create test for Istio kustomize component

* update hack/make-release-artifacts.sh and kustomize/kustomization.yaml

* Move docs/service-mesh.md to kustomize/components/service-mesh-istio/README.md

* Update README.md and cloudshell-tutorial.md references to previous service-mesh.md

* Convert frontend-gateway.yaml from Istio CRDs to Kubernetes Gateway CRDs

* Draft updates to service-mesh-istio/README.md

* Restore istio-manifests (cannot be deleted yet)

* fixup pr comments

---------

Co-authored-by: Nim Jayawardena <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Review the Service Mesh doc
2 participants