<p>I am trying to write some python service that will be deployed on kubernetes that does something similar to a cloud function triggered by <code>google.storage.object.finalize</code> action and listening on a bucket. In essence I need to replace a cloud function that was created with the following parameters:</p>
<pre><code>--trigger-resource YOUR_TRIGGER_BUCKET_NAME 
--trigger-event google.storage.object.finalize
</code></pre>
<p>however I can't find online any resource on how to do this. What would be the best way for some python script deployed in kubernetes to observe actions performed on a bucket and do something when a new file gets written into it? Thank you</p>

DarioB
<p>You just need to enable pubsub notifications on the bucket to publish to a pub/sub topic: <a href="https://cloud.google.com/storage/docs/pubsub-notifications" rel="nofollow noreferrer">https://cloud.google.com/storage/docs/pubsub-notifications</a></p>
<p>And then have you python application listen to a subscription on the topic that you picked, either in a pull or push setup: <a href="https://cloud.google.com/pubsub/docs/pull" rel="nofollow noreferrer">https://cloud.google.com/pubsub/docs/pull</a>.</p>
