GKE Cluster Upgrade Notification fails
👓 What did you see?
When we get a UpgradeAvailableEvent, the gcp-pubsub-to-ms-teams cloud function is crashing with an invalid JSON error.
✅ What did you expect to see?
What should happen is a MS Team notification should occur with details of the upgrade.
💻 Where does this happen?
This is happening in gitlab-runner-infrastructure production environment.
🔬 How do I recreate this?
This can be recreated by doing the following in gitlab-runner-infrastructure:
- Publish the following message to topic `pubsub2teams-xxxxxx'
- Click "PUBLISH MESSAGE" button in the GCP console
- Message body=
New node version "1.17.15-gke.800" is available for upgrade in the REGULAR channel. - Then add the following 5 attributes using the "ADD AN ATTRIBUTE" button
- project_id=777998843057
- cluster_location=europe-west2
- cluster_name=cluster
- type_url=type.googleapis.com/google.container.v1beta1.UpgradeAvailableEvent
- payload=
{
"version": "1.17.15-gke.800",
"resourceType": "MASTER",
"releaseChannel": {
"channel": "REGULAR"
}
}
- Click the "PUBLISH" button
📚 Any additional information?
This is caused by the data message containing quotes which the code isn't encoding, so invalid JSON is generated.