From 924f1e7871485cabd8c6c53a4b466e3878a21557 Mon Sep 17 00:00:00 2001 From: m1sk9 Date: Tue, 7 Nov 2023 15:04:57 +0900 Subject: [PATCH 1/4] 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" From 97c148207119ad5cf2cff5f23639c4920eda10d8 Mon Sep 17 00:00:00 2001 From: m1sk9 Date: Tue, 7 Nov 2023 20:28:16 +0900 Subject: [PATCH 2/4] fix: don't use latest tag --- .../apps/seichi-minecraft/idea-reaction/idea-reaction.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index 49ffed0d1..a4eaa130c 100644 --- 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 @@ -16,7 +16,7 @@ spec: app: idea-reaction spec: - name: idea-reaction - image: ghcr.io/giganticminecraft/idea-reaction:latest + image: ghcr.io/giganticminecraft/idea-reaction:42a57b77637240c64672a6a64cc909a0c50509fa resources: requests: cpu: 250m From 652be0acd33901723c19f69e03d7055aff16cc34 Mon Sep 17 00:00:00 2001 From: m1sk9 Date: Fri, 10 Nov 2023 19:57:16 +0900 Subject: [PATCH 3/4] fix: use volumes --- .../seichi-minecraft/idea-reaction/idea-reaction.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 index a4eaa130c..e8d515a2b 100644 --- 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 @@ -24,6 +24,9 @@ spec: limits: cpu: 500m memory: 256Mi + volumeMounts: + - name: idea-reaction-config-volume + mountPath: /home/idea-reaction/assets/config.yaml env: - name: TARGET_CHANNEL_ID value: "959292335177486367" @@ -37,6 +40,7 @@ spec: secretKeyRef: name: idea-reaction-discord-token key: IDEA_REACTION_DISCORD_TOKEN - envFrom: - - configMapRef: + volumes: + - name: idea-reaction-config-volume + configMap: name: idea-reaction-config From 5ce1bb919d97d4d6cd326ef7ca3b46da2404409b Mon Sep 17 00:00:00 2001 From: m1sk9 Date: Fri, 10 Nov 2023 20:08:05 +0900 Subject: [PATCH 4/4] chore: change memory amount --- .../apps/seichi-minecraft/idea-reaction/idea-reaction.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 index e8d515a2b..258e5ac6f 100644 --- 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 @@ -20,10 +20,10 @@ spec: resources: requests: cpu: 250m - memory: 128Mi + memory: 16Mi limits: cpu: 500m - memory: 256Mi + memory: 32Mi volumeMounts: - name: idea-reaction-config-volume mountPath: /home/idea-reaction/assets/config.yaml