To showcase how to connect up third party software using a gateway function which accepts a call, formats it, adds a message to a topic which then is subscribed to and handled by a different component. Allowing highly composable components.
First up, enable pubsub on your gcp project.
The topics and subscriptions will be created using the google deployments in deployment/base.yaml
.
Once this is done you also need to get the service account json and store it in this local folder as service-account.json
. These secrets would normally be injected using KMS or similar secret stores but it's outside the scope of what I'm trying to do here so.
Run the deployment (or preview by adding --preview
at the end).
gcloud deployment-manager deployments create article-pubsub-poc --config deployment/base.yaml
or to update if it is already created:
gcloud deployment-manager deployments update article-pubsub-poc --config deployment/base.yaml
Templates to use can be found here.
To deploy the app using helm + skaffold:
export GCP_PROJECT=david-266106
./set-context.sh ${GCP_PROJECT}
skaffold run --default-repo gcr.io/${GCP_PROJECT}
You should now be able to see both pods running under:
kubectl get pods
stern -l app=pubsub-poc
Then you can try putting something on the topic:
curl <your-public-ip>/test
After playing with this, it's advisable to clean up, simply remove the entire deployment:
gcloud deployment-manager deployments delete article-pubsub-poc