From 924f1e7871485cabd8c6c53a4b466e3878a21557 Mon Sep 17 00:00:00 2001 From: m1sk9 Date: Tue, 7 Nov 2023 15:04:57 +0900 Subject: [PATCH] feat: added idea-reaction pod --- .../common-configs/idea-reaction-config.yaml | 7 ++++ .../idea-reaction/idea-reaction.yaml | 42 +++++++++++++++++++ terraform/main.tf | 6 +++ terraform/onp_cluster_minecraft_secrets.tf | 5 ++- 4 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 seichi-onp-k8s/manifests/seichi-kubernetes/apps/seichi-minecraft/common-configs/idea-reaction-config.yaml create mode 100644 seichi-onp-k8s/manifests/seichi-kubernetes/apps/seichi-minecraft/idea-reaction/idea-reaction.yaml diff --git a/seichi-onp-k8s/manifests/seichi-kubernetes/apps/seichi-minecraft/common-configs/idea-reaction-config.yaml b/seichi-onp-k8s/manifests/seichi-kubernetes/apps/seichi-minecraft/common-configs/idea-reaction-config.yaml new file mode 100644 index 000000000..054107ed4 --- /dev/null +++ b/seichi-onp-k8s/manifests/seichi-kubernetes/apps/seichi-minecraft/common-configs/idea-reaction-config.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: ConfigMap +matadata: + name: idea-reaction-config +data: + config.yaml: | + reactions: ["👍", "👎"] diff --git a/seichi-onp-k8s/manifests/seichi-kubernetes/apps/seichi-minecraft/idea-reaction/idea-reaction.yaml b/seichi-onp-k8s/manifests/seichi-kubernetes/apps/seichi-minecraft/idea-reaction/idea-reaction.yaml new file mode 100644 index 000000000..49ffed0d1 --- /dev/null +++ b/seichi-onp-k8s/manifests/seichi-kubernetes/apps/seichi-minecraft/idea-reaction/idea-reaction.yaml @@ -0,0 +1,42 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: idea-reaction + namespace: seichi-minecraft + labels: + app: idea-reaction +spec: + replicas: 1 + selector: + matchLabels: + app: idea-reaction + template: + metadata: + labels: + app: idea-reaction + spec: + - name: idea-reaction + image: ghcr.io/giganticminecraft/idea-reaction:latest + resources: + requests: + cpu: 250m + memory: 128Mi + limits: + cpu: 500m + memory: 256Mi + env: + - name: TARGET_CHANNEL_ID + value: "959292335177486367" + # Webhook ID は Webhook た UserId べ搌侀ぼため, ć…Źé–‹æƒ…ć ±ă«ăȘる. + - name: TARGET_WEBHOOK_ID + value: "959307225413845072" + - name: TARGET_GUILD_ID + value: "237758724121427969" + - name: DISCORD_TOKEN + valueFrom: + secretKeyRef: + name: idea-reaction-discord-token + key: IDEA_REACTION_DISCORD_TOKEN + envFrom: + - configMapRef: + name: idea-reaction-config diff --git a/terraform/main.tf b/terraform/main.tf index ff2d4cc77..277e9e95d 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -286,6 +286,12 @@ variable "minecraft__prod_game_db__password" { sensitive = true } +variable "minecraft__idea_reaction_discord_token" { + description = "Token set to the production idea-reaction" + type = string + sensitive = true +} + #endregion #region env variables for Cloudflare Pages projects diff --git a/terraform/onp_cluster_minecraft_secrets.tf b/terraform/onp_cluster_minecraft_secrets.tf index 25dc63bbb..b173dae53 100644 --- a/terraform/onp_cluster_minecraft_secrets.tf +++ b/terraform/onp_cluster_minecraft_secrets.tf @@ -22,8 +22,9 @@ resource "kubernetes_secret" "onp_minecraft_prod_secrets" { } data = { - DISCORDSRV_TOKEN = var.minecraft__discordsrv_bot_token - GAME_DB_PASSWORD = var.minecraft__prod_game_db__password + DISCORDSRV_TOKEN = var.minecraft__discordsrv_bot_token + GAME_DB_PASSWORD = var.minecraft__prod_game_db__password + IDEA_REACTION_DISCORD_TOKEN = var.minecraft__idea_reaction_discord_token } type = "Opaque"