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

Refactor Kustomize components (service-accounts, shopping-assistant) #2488

Merged
merged 6 commits into from
Apr 17, 2024

Conversation

bourgeoisor
Copy link
Member

@bourgeoisor bourgeoisor commented Apr 15, 2024

This PR:

  • Embeds the service-accounts components directly in the services' respective manifest files
  • Removes the disable-shopping-assistant component
  • To replace it with a shopping-assistant component
  • Toggles the default frontend "enable assistant" env from true to false

Note that this means the shopping assistant is no longer with the other services, but rather as part of a separate component.

Fixes #2468

Testing

I tested this by deploying with the following two components uncommented:

- ../kustomize/components/alloydb
- ../kustomize/components/shopping-assistant

Which deployed successfully with a working shopping assistant. And then I deployed with the two components commented out (the default state) which successfully deployed without the shopping assistant, as intended:

~ k get pods
NAME                                     READY   STATUS    RESTARTS   AGE
adservice-576758649-z4q4p                1/1     Running   0          2m13s
cartservice-6df4d5975f-7jhns             1/1     Running   0          2m13s
checkoutservice-985cc4c8-spcdk           1/1     Running   0          2m13s
currencyservice-cbc8b6f68-h9ltr          1/1     Running   0          2m13s
emailservice-6899dc7cb7-ddw6z            1/1     Running   0          2m13s
frontend-79fdcd47dc-rcdvp                1/1     Running   0          2m12s
loadgenerator-6b98d85996-t6ffx           1/1     Running   0          85s
paymentservice-59f4f479fc-gn9zk          1/1     Running   0          2m12s
productcatalogservice-55f98f957f-6nb2l   1/1     Running   0          2m12s
recommendationservice-6bb4576fd4-mdtxs   1/1     Running   0          2m11s
redis-cart-868cd7dff-pr4xs               1/1     Running   0          2m11s
shippingservice-8645b4d89d-nw95n         1/1     Running   0          2m11s

@bourgeoisor bourgeoisor requested review from yoshi-approver and a team as code owners April 15, 2024 19:17
Copy link

🚲 PR staged at http://104.154.159.254

Copy link

🚲 PR staged at http://104.154.159.254

Copy link

@moficodes moficodes left a comment

Choose a reason for hiding this comment

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

It looks good but I think we can improve the sed experience with a kustomize overflow.

sed -i "s/ALLOYDB_DATABASE_NAME_VAL/${ALLOYDB_PRODUCTS_DATABASE_NAME}/g" kubernetes-manifests/shoppingassistantservice.yaml
sed -i "s/ALLOYDB_TABLE_NAME_VAL/${ALLOYDB_PRODUCTS_TABLE_NAME}/g" kubernetes-manifests/shoppingassistantservice.yaml
sed -i "s/ALLOYDB_SECRET_NAME_VAL/${ALLOYDB_SECRET_NAME}/g" kubernetes-manifests/shoppingassistantservice.yaml
# Substitute environment values (kustomize/components/shopping-assistant/shoppingassistantservice.yaml)

Choose a reason for hiding this comment

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

Instead all these seds should we just add a overlay for these values?

Copy link
Member Author

@bourgeoisor bourgeoisor Apr 16, 2024

Choose a reason for hiding this comment

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

The vars are in overlays already. Sed is just doing the var substitution with values.

If we have another overlays explicitly just for variables, then we still have to sed that overlay so we're back at square one. We can't hardcode those values in the overlay because they're dynamic, like the name of the GSA or the Google Cloud project ID.

Either way I spin it in my head, we need to either:
a) sed something; or
b) ask the user to manually replace vars somewhere (which is more friction than sed)

Unless I'm misunderstanding what you mean?

@moficodes
Copy link

/lgtm

@bourgeoisor bourgeoisor merged commit 20585fa into main Apr 17, 2024
12 checks passed
@bourgeoisor bourgeoisor deleted the issue-2468-refactor-kustomize-components branch April 17, 2024 19:34
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.

Refactor ShoppingAssistantService kustomize components
2 participants