I have a very simple go application that works fine under Windows and Mac. (I am a golang newbie btw). The purpose of the application is to subscribe to a google cloud pubsub subscription and forward the messages to another application using REST.
The code looks like:
func getOrCreateTopic() {
log.Infof("1")
ctx := context.Background()
log.Infof("2")
topicName := viper.GetString("gce.pubsub.topic")
log.Infof("3")
topic = client.Topic(topicName)
log.Infof("4")
exists, _ := topic.Exists(ctx)
log.Infof("5")
if topic == nil || !exists {
topic, err = client.CreateTopic(ctx, topicName)
if err != nil {
log.Errorf("Failed to create topic %s: %v", topicName, err)
os.Exit(2)
}
}
}
func main() {
...
getOrCreateTopic();
...
}
I created a docker container and published it to our kubernetes cluster in google cloud. What I see in the logs is everything until "4" and then nothing more. But the process is still shown as running in kubernetes.
I am lost, it seems like the call to the API just hangs.