/Openshift-Telegram-Bot

Deploy your applications on Openshift without any interaction with the Openshift Web Console/CLI

Primary LanguageGoMIT LicenseMIT

Bot logo

Openshift Telegram Bot

Status License


🤖 Deploy your applications on Openshift without any interaction with the Openshift Web Console/CLI ✨
📮 Send your Container Image and get back the 🚀 Live Application URL! 📡


💭 How it works

First, it asks the user to enter the Cluster URL. The bot then checks if the URL is valid.
Then asks the user to enter the API Token. To fetch the API Token, the bot generates a link which redirects the user to the Display Token Page of the Openshift Cluster.
The user then has to login with their credentials, copy the token and send it to the bot.

The bot then uses the token to authenticate itself with the Openshift Cluster.

Once authenticated, the bot asks the user to send the Container Image and the PORT of the application to be deployed.

In the background, the bot then creates a new deployment, service and route in the Openshift Cluster and returns the Live Application URL to the user!

The bot uses the telegram-bot-api package to interact with the Telegram Bot API and the kubernetes/client-go package to interact with the Openshift Cluster.

The entire bot is written in Golang 1.20 🚀


🎥 Demo

Will Upload Soon!!!


🎈 Usage

To start the Bot:

/start

Follow the Instructions to authenticate the bot with your Openshift Cluster.

To deploy a container image on Openshift:

/image <container-image-name> | <PORT>

To change the default namespace and user:
(Default: namespace = "default", user = "kube:admin")

/default <namespace> | <user>

🏁 Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

- You need to have a Telegram Account. 
- Register a new bot with BotFather. 
- Pass the TELEGRAM_BOT_TOKEN received in a .env file in the root directory.

- You would need a Openshift Cluster to test this bot. 
(You can get a free cluster from Developer Sandbox for Red Hat OpenShift!)

Click here to create your free account in Developer Sandbox

Running Locally

go run cmd/main.go

⛏️ Built Using

  • telegram-bot-api - Golang bindings for the Telegram Bot API
  • kubernetes/client-go - Golang bindings for Kubernetes
  • Openshift - PaaS hosting platform

✍️ Authors


🎉 Acknowledgements

  • @RedHatOfficial for promoting and organizing hackathons as part of the work culture 🎉
  • Inspired by the popular Telegram Bots I use everyday!