Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Telegram long polling #2250

Merged
merged 20 commits into from
Aug 24, 2023
Merged

Telegram long polling #2250

merged 20 commits into from
Aug 24, 2023

Conversation

alexintech
Copy link
Contributor

@alexintech alexintech commented Jun 15, 2023

What this PR does

Runs Telegram long polling to get updates.
It's enabled by setting FEATURE_TELEGRAM_LONG_POLLING_ENABLED=True. That will disable webhook and run separate deployment for telegram long polling.

Telegram long polling is not very HA mode, but it does not need to expose webhook url to internet and simplifies telegram integration.

Which issue(s) this PR fixes

closes #561

Checklist

  • Unit, integration, and e2e (if applicable) tests updated
  • Documentation added (or pr:no public docs PR label added if not required)
  • CHANGELOG.md updated (or pr:no changelog PR label added if not required)

@alexintech alexintech requested a review from a team June 15, 2023 11:23
engine/settings/base.py Outdated Show resolved Hide resolved
Makefile Show resolved Hide resolved
@alexintech alexintech requested a review from joeyorlando June 28, 2023 10:17
@alexintech
Copy link
Contributor Author

👀

@joeyorlando
Copy link
Contributor

@alexintech thanks for the contribution (again 😄).

I'm not very familiar w/ Telegram. I'll ask around and see if someone else more familiar can review this.

@Sammyant
Copy link

Sammyant commented Aug 2, 2023

Hi everyone. what about this MR?
we so need this cool feature to avoid publishing our grafana on call

@joeyorlando joeyorlando requested a review from a team August 2, 2023 07:17
@gproxyz
Copy link

gproxyz commented Aug 9, 2023

Hi everyone.
We need this PR.
pls

@EsDmitrii
Copy link

EsDmitrii commented Aug 9, 2023

Hi!
Awesome feature! When do you plan to release this?
We need that :)

@joeyorlando ?

# Conflicts:
#	CHANGELOG.md
#	engine/apps/base/utils.py
#	helm/oncall/tests/telegram_env_test.yaml
#	helm/oncall/tests/wait_for_db_test.yaml
#	helm/oncall/values.yaml
@alexintech alexintech requested a review from a team as a code owner August 17, 2023 12:12
Copy link
Contributor

@matiasb matiasb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍 , minor comments added.

Maybe @iskhakov can take a look at the helm updates? (they make sense to me, but to get another couple of eyes)

engine/settings/base.py Outdated Show resolved Hide resolved
helm/oncall/templates/_env.tpl Show resolved Hide resolved
Copy link
Contributor

@joeyorlando joeyorlando left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@matiasb helm changes lgtm 👍

@alexintech thanks for this contribution 🙂 some minor comments. you'll need to re-merge dev into your branch to resolve some recent merge conflicts.

Comment on lines 16 to 59
- containsDocument:
kind: Deployment
apiVersion: apps/v1
name: oncall-telegram-polling
- isSubset:
path: metadata.labels
content:
app.kubernetes.io/component: telegram-polling
app.kubernetes.io/instance: oncall
app.kubernetes.io/name: oncall
- isSubset:
path: spec.selector.matchLabels
content:
app.kubernetes.io/component: telegram-polling
app.kubernetes.io/instance: oncall
app.kubernetes.io/name: oncall
- isSubset:
path: spec.template.metadata.labels
content:
app.kubernetes.io/component: telegram-polling
app.kubernetes.io/instance: oncall
app.kubernetes.io/name: oncall
# Should contain only one replica to avoid Conflict while polling Telegram updates
- equal:
path: spec.replicas
value: 1
- equal:
path: spec.template.spec.serviceAccountName
value: oncall
- contains:
path: spec.template.spec.initContainers
content:
name: wait-for-db
any: true
- equal:
path: spec.template.spec.containers[0].name
value: telegram-polling
- equal:
path: spec.template.spec.containers[0].command
value: ['sh', '-c', 'python manage.py start_telegram_polling']
- notExists:
path: spec.template.spec.containers[0].resources
- matchSnapshot:
path: spec.template.spec.containers[0].env
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit what about using a matchSnapshot assertion? That should assert the same thing as these, without the need to explicitly type all of this out.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to use matchSnapshot for containers. I don't want to use snapshot for spec as in that case snapshot will be too big. I think very big snapshots are difficult to read and to understand, if you need for some reason.

helm/oncall/templates/telegram-polling/deployment.yaml Outdated Show resolved Hide resolved
helm/oncall/templates/telegram-polling/deployment.yaml Outdated Show resolved Hide resolved
helm/oncall/templates/telegram-polling/deployment.yaml Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@joeyorlando joeyorlando self-assigned this Aug 23, 2023
# Conflicts:
#	CHANGELOG.md
#	helm/oncall/tests/extra_env_test.yaml
#	helm/oncall/tests/mysql_env_test.yaml
#	helm/oncall/tests/mysql_password_env_test.yaml
#	helm/oncall/tests/postgres_env_test.yaml
#	helm/oncall/tests/postgres_password_env_test.yaml
#	helm/oncall/tests/telegram_env_test.yaml
@alexintech alexintech requested a review from joeyorlando August 24, 2023 05:54
@joeyorlando joeyorlando enabled auto-merge August 24, 2023 06:43
@joeyorlando joeyorlando disabled auto-merge August 24, 2023 07:12
@joeyorlando joeyorlando merged commit ec028eb into grafana:dev Aug 24, 2023
@alexintech alexintech deleted the telegram-long-polling branch September 1, 2023 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

telegram polling protocol environment
6 participants