From e2874c944c3f733fedd1af8f3fbde50d0c189624 Mon Sep 17 00:00:00 2001 From: outductor Date: Sat, 16 Sep 2023 16:34:54 +0900 Subject: [PATCH 1/7] add blank kustomization --- .../overlays/base/kustomization.yaml | 0 .../overlays/develop/kustomization.yaml | 0 .../review-pr/review-pr.yaml | 48 +++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/overlays/base/kustomization.yaml create mode 100644 seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/overlays/develop/kustomization.yaml create mode 100644 seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/review-pr.yaml diff --git a/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/overlays/base/kustomization.yaml b/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/overlays/base/kustomization.yaml new file mode 100644 index 000000000..e69de29bb diff --git a/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/overlays/develop/kustomization.yaml b/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/overlays/develop/kustomization.yaml new file mode 100644 index 000000000..e69de29bb diff --git a/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/review-pr.yaml b/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/review-pr.yaml new file mode 100644 index 000000000..bd3fb685c --- /dev/null +++ b/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/review-pr.yaml @@ -0,0 +1,48 @@ +apiVersion: argoproj.io/v1alpha1 +kind: ApplicationSet +metadata: + name: review-pr + namespace: argocd +spec: + generators: + - pullRequest: + github: + owner: GiganticMinecraft + repo: SeichiAssist + # tokenRef: + # secretName: git-creds + # key: password + labels: + - ready-for-review + requeueAfterSeconds: 1800 + template: + metadata: + name: "review-{{number}}" + annotations: + notifications.argoproj.io/subscribe.on-deployed.github: "" + notifications.argoproj.io/subscribe.on-health-degraded.github: "" + github.repoURL: https://github.com/GiganticMinecraft/SeichiAssist + github.revision: "{{head_sha}}" + spec: + project: review-pr + source: + repoURL: https://github.com/GiganticMinecraft/seichi_infra.git + targetRevision: main + path: seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/overlays/develop + plugin: + name: kustomize-with-replacements + env: + - name: FQDN + value: "review-{{number}}.play-debug.seichi-click" + - name: NAMESPACE + value: "review-{{number}}" + - name: IMAGES + value: >- + revision={{head_sha}} + destination: + server: https://kubernetes.default.svc + namespace: "review-{{number}}" + syncPolicy: + automated: + prune: true + selfHeal: true From d93b86ada722f355f96841b0e5b5190fb00878ce Mon Sep 17 00:00:00 2001 From: outductor Date: Sat, 16 Sep 2023 18:26:39 +0900 Subject: [PATCH 2/7] wip --- .../review-pr/overlays/develop/kustomization.yaml | 0 .../apps/cluster-wide-apps/review-pr/review-pr.yaml | 2 +- .../{overlays/base/kustomization.yaml => template/.gitkeep} | 0 3 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/overlays/develop/kustomization.yaml rename seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/{overlays/base/kustomization.yaml => template/.gitkeep} (100%) diff --git a/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/overlays/develop/kustomization.yaml b/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/overlays/develop/kustomization.yaml deleted file mode 100644 index e69de29bb..000000000 diff --git a/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/review-pr.yaml b/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/review-pr.yaml index bd3fb685c..b371e784a 100644 --- a/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/review-pr.yaml +++ b/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/review-pr.yaml @@ -28,7 +28,7 @@ spec: source: repoURL: https://github.com/GiganticMinecraft/seichi_infra.git targetRevision: main - path: seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/overlays/develop + path: seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/template plugin: name: kustomize-with-replacements env: diff --git a/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/overlays/base/kustomization.yaml b/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/template/.gitkeep similarity index 100% rename from seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/overlays/base/kustomization.yaml rename to seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/template/.gitkeep From 6d10c033448192314308e6fd082e9682744d5791 Mon Sep 17 00:00:00 2001 From: outductor Date: Sat, 16 Sep 2023 18:27:27 +0900 Subject: [PATCH 3/7] wip --- .../review-pr/template/kustomization.yaml | 4 + .../review-pr/template/stateful-set.yaml | 195 ++++++++++++++++++ 2 files changed, 199 insertions(+) create mode 100644 seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/template/kustomization.yaml create mode 100644 seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/template/stateful-set.yaml diff --git a/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/template/kustomization.yaml b/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/template/kustomization.yaml new file mode 100644 index 000000000..aecf30d1a --- /dev/null +++ b/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/template/kustomization.yaml @@ -0,0 +1,4 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: +- stateful-set.yaml diff --git a/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/template/stateful-set.yaml b/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/template/stateful-set.yaml new file mode 100644 index 000000000..3bfce7234 --- /dev/null +++ b/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/template/stateful-set.yaml @@ -0,0 +1,195 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + annotations: + reloader.stakater.com/auto: "true" + labels: + app: mcserver + mcserver: debug-s18 + name: mcserver--debug-s18 +spec: + replicas: 1 + serviceName: "mcserver--debug-s1" + selector: + matchLabels: + app: mcserver--debug-s18 + mcserver: debug-s18 + template: + metadata: + labels: + app: mcserver--debug-s18 + mcserver: debug-s18 + spec: + initContainers: + - name: mod-downloader + image: ghcr.io/giganticminecraft/mod-downloader:sha-39a89de + env: + - name: MINIO_ENDPOINT + value: seichi-private-plugin-blackhole-minio.minio:9000 + - name: MINIO_ACCESS_KEY + value: + - name: MINIO_ACCESS_SECRET + value: + - name: BUCKET_NAME + value: seichi-plugins + - name: BUCKET_PREFIX_NAME + value: deb-1-18-2 + - name: DOWNLOAD_TARGET_DIR_PATH + value: /tmp/plugins + volumeMounts: + - name: mod-downloader-volume + mountPath: /tmp/plugins + - name: jmx-exporter-downloader + image: busybox:1.36.0 + env: + - name: JMX_EXPORTER_URL + value: "https://repo1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/0.18.0/jmx_prometheus_javaagent-0.18.0.jar" + volumeMounts: + - name: jmx-exporter-download-volume + mountPath: /root/jmx-exporter-download + command: + - "sh" + - "-c" + - 'wget -O /root/jmx-exporter-download/jmx-exporter-javaagent.jar "${JMX_EXPORTER_URL}"' + + containers: + - resources: + requests: + memory: 2100Mi + env: + - name: MEMORY + value: 2048m + - name: TYPE + value: PAPER + - name: VERSION + value: "1.18.2" + - name: EULA + value: "TRUE" + + - name: REMOVE_OLD_MODS + value: "TRUE" + + - name: MODS + # DiscordSRV: + # https://github.com/DiscordSRV/DiscordSRV/releases/download/v1.24.0/DiscordSRV-Build-1.24.0.jar + # LunaChat: + # https://github.com/ucchyocean/LunaChat/releases/download/v3.0.16/LunaChat.jar + # ViaBackwards: + # https://github.com/ViaVersion/ViaBackwards/releases/download/4.6.1/ViaBackwards-4.6.1.jar + # ViaVersion: + # https://github.com/ViaVersion/ViaVersion/releases/download/4.6.2/ViaVersion-4.6.2.jar + value: >- + https://github.com/DiscordSRV/DiscordSRV/releases/download/v1.24.0/DiscordSRV-Build-1.24.0.jar, + https://github.com/ucchyocean/LunaChat/releases/download/v3.0.16/LunaChat.jar, + https://github.com/ViaVersion/ViaBackwards/releases/download/4.6.1/ViaBackwards-4.6.1.jar, + https://github.com/ViaVersion/ViaVersion/releases/download/4.6.2/ViaVersion-4.6.2.jar, + - name: JVM_OPTS + value: >- + -javaagent:/jmx-exporter/jmx-exporter-javaagent.jar=18321:/jmx-exporter/jmx-exporter-config.yaml + - name: COPY_CONFIG_DEST + # /config をサーバーディレクトリにコピーするようにする + # https://github.com/itzg/docker-minecraft-server/tree/9458005b5bd78b8139e13e66c29a449a12dd6218#optional-plugins-mods-and-config-attach-points + value: /data + + # 設定ファイル内の ${CFG_*} の形をした部分を置き換える + # https://github.com/itzg/docker-minecraft-server/tree/9458005b5bd78b8139e13e66c29a449a12dd6218#replacing-variables-inside-configs + - name: REPLACE_ENV_VARIABLE_PREFIX + value: CFG_ + + - name: CFG_DISCORDSRV_TOKEN + valueFrom: + secretKeyRef: + name: mcserver--common--config-secrets + key: DISCORDSRV_TOKEN + + - name: CFG_DISCORDSRV_GLOBAL_CHANNEL_ID + value: "1054159992447570032" + + - name: CFG_DISCORDSRV_CONSOLE_CHANNEL_ID + value: "1054159676964622426" + + image: itzg/minecraft-server:2023.3.0-java17-jdk + name: minecraft + ports: + - containerPort: 25565 + name: minecraft + - containerPort: 18321 + name: jmx-metrics + + startupProbe: + tcpSocket: + port: 25565 + # 最大120秒待つ + failureThreshold: 6 + periodSeconds: 20 + + volumeMounts: + # itzg/minecraft-server は /config に設定ファイルをマウントしておけばコピーをしてくれる。 + # 環境変数の置き換えはPrefix等の設定が必要なので、必要になったら設定するように。 + # https://github.com/itzg/docker-minecraft-server/tree/9458005b5bd78b8139e13e66c29a449a12dd6218#replacing-variables-inside-configs + + # 普通にマウントすると、auto-update (常に最新のvolume内容がコンテナ内から見える) の挙動を + # 提供するために symlink による一時ディレクトリがマウントされることになるが、 + # itzg/minecraft-server が利用するファイル同期の仕組み (itzg/mc-image-helper) は + # symlink を展開してしまうため、設定ファイルのパスが壊れてしまう。 + # + # subPathを利用してマウントすればsymlinkが作られることを回避できるためそのようにしている。 + # 参考: https://stackoverflow.com/a/63114800 + # 参考: https://stackoverflow.com/a/50687707 + + # サーバーの設定ファイル + - name: common-mcserver-configs + mountPath: /config/bukkit.yml + subPath: bukkit.yml + - name: common-mcserver-configs + mountPath: /config/paper.yml + subPath: paper.yml + - name: common-mcserver-configs + mountPath: /config/server.properties + subPath: server.properties + - name: common-mcserver-configs + mountPath: /config/spigot.yml + subPath: spigot.yml + + # DiscordSRV プラグインの設定ファイル + - name: common-mcserver-plugin-configs + mountPath: /plugins/DiscordSRV/config.yml + subPath: DiscordSRV-config.yml + - name: common-mcserver-plugin-configs + mountPath: /plugins/DiscordSRV/messages.yml + subPath: DiscordSRV-messages.yml + + # MorningGlorySeeds プラグインの設定ファイル + - name: common-mcserver-plugin-configs + mountPath: /plugins/MorningGlorySeeds/config.yml + subPath: MorningGlorySeeds-config.yml + + # LunaChat プラグインの設定ファイル + - name: common-mcserver-plugin-configs + mountPath: /plugins/LunaChat/config.yml + subPath: LunaChat-config.yml + + # JMX exporter 周りのファイルが入ったボリューム達のマウント設定 + - name: jmx-exporter-download-volume + mountPath: /jmx-exporter/jmx-exporter-javaagent.jar + subPath: jmx-exporter-javaagent.jar + - name: common-jmx-exporter-config + mountPath: /jmx-exporter/jmx-exporter-config.yaml + subPath: jmx-exporter-config.yaml + + volumes: + - name: common-mcserver-configs + configMap: + name: common-mcserver-configs + - name: common-mcserver-plugin-configs + configMap: + name: common-mcserver-plugin-configs + + # JMX exporterをinitContainerでダウンロードしてBugneeCordに受け渡すためのvolume + - name: jmx-exporter-download-volume + emptyDir: {} + - name: mod-downloader-volume + emptyDir: {} + - name: common-jmx-exporter-config + configMap: + name: common-jmx-exporter-config From 45be3bed6f2d3e0c06fb5b514212e6cc863e354f Mon Sep 17 00:00:00 2001 From: Kory Date: Mon, 18 Sep 2023 10:12:10 +0900 Subject: [PATCH 4/7] fix: add and use AppProject --- .../review-pr/review-pr.yaml | 26 +++++-------------- .../review-pr/template/.gitkeep | 0 .../seichi-kubernetes/apps/root/projects.yaml | 16 ++++++++++++ 3 files changed, 23 insertions(+), 19 deletions(-) delete mode 100644 seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/template/.gitkeep diff --git a/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/review-pr.yaml b/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/review-pr.yaml index b371e784a..215e0923f 100644 --- a/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/review-pr.yaml +++ b/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/review-pr.yaml @@ -1,7 +1,7 @@ apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: - name: review-pr + name: seichi-debug-minecrafts-on-seichiassist-prs namespace: argocd spec: generators: @@ -9,39 +9,27 @@ spec: github: owner: GiganticMinecraft repo: SeichiAssist - # tokenRef: - # secretName: git-creds - # key: password labels: - ready-for-review - requeueAfterSeconds: 1800 + requeueAfterSeconds: 120 template: metadata: - name: "review-{{number}}" + name: "seichi-debug-minecraft-on-seichiassist-pr-{{number}}" annotations: notifications.argoproj.io/subscribe.on-deployed.github: "" notifications.argoproj.io/subscribe.on-health-degraded.github: "" github.repoURL: https://github.com/GiganticMinecraft/SeichiAssist + github.pullRequestNumber: "{{number}}" github.revision: "{{head_sha}}" spec: - project: review-pr + project: seichi-debug-minecrafts-on-seichiassist-prs source: repoURL: https://github.com/GiganticMinecraft/seichi_infra.git targetRevision: main - path: seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/template - plugin: - name: kustomize-with-replacements - env: - - name: FQDN - value: "review-{{number}}.play-debug.seichi-click" - - name: NAMESPACE - value: "review-{{number}}" - - name: IMAGES - value: >- - revision={{head_sha}} + path: seichi-onp-k8s/manifests/seichi-kubernetes/seichi-debug-minecraft-on-seichiassist-pr-template destination: server: https://kubernetes.default.svc - namespace: "review-{{number}}" + namespace: "seichi-debug-minecraft-on-seichiassist-pr-{{number}}" syncPolicy: automated: prune: true diff --git a/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/template/.gitkeep b/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/template/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/seichi-onp-k8s/manifests/seichi-kubernetes/apps/root/projects.yaml b/seichi-onp-k8s/manifests/seichi-kubernetes/apps/root/projects.yaml index 8cb0a7566..04c5ed6fd 100644 --- a/seichi-onp-k8s/manifests/seichi-kubernetes/apps/root/projects.yaml +++ b/seichi-onp-k8s/manifests/seichi-kubernetes/apps/root/projects.yaml @@ -133,6 +133,22 @@ spec: --- apiVersion: argoproj.io/v1alpha1 kind: AppProject +metadata: + name: seichi-game-debug-envs-on-seichiassist-prs + namespace: argocd +spec: + description: The project of debug minecraft systems (on pull requests demand) for the seichi-network + sourceRepos: + - "*" + destinations: + - namespace: "*" + server: https://kubernetes.default.svc + clusterResourceWhitelist: + - group: "*" + kind: "*" +--- +apiVersion: argoproj.io/v1alpha1 +kind: AppProject metadata: name: seichi-minecraft namespace: argocd From c5f31cc3d3ebbd38f66f849b253cce011777b7a0 Mon Sep 17 00:00:00 2001 From: Kory Date: Mon, 18 Sep 2023 10:17:31 +0900 Subject: [PATCH 5/7] refactor: move ApplicationSet / template to appropriate directories --- .../seichi-debug-minecrafts-on-seichiassist-prs.yaml} | 0 .../template/kustomization.yaml | 0 .../template/stateful-set.yaml | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/{review-pr/review-pr.yaml => app-of-other-apps/seichi-debug-minecrafts-on-seichiassist-prs.yaml} (100%) rename seichi-onp-k8s/manifests/seichi-kubernetes/{apps/cluster-wide-apps/review-pr => seichi-debug-minecraft-on-seichiassist-pr-template}/template/kustomization.yaml (100%) rename seichi-onp-k8s/manifests/seichi-kubernetes/{apps/cluster-wide-apps/review-pr => seichi-debug-minecraft-on-seichiassist-pr-template}/template/stateful-set.yaml (100%) diff --git a/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/review-pr.yaml b/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/app-of-other-apps/seichi-debug-minecrafts-on-seichiassist-prs.yaml similarity index 100% rename from seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/review-pr.yaml rename to seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/app-of-other-apps/seichi-debug-minecrafts-on-seichiassist-prs.yaml diff --git a/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/template/kustomization.yaml b/seichi-onp-k8s/manifests/seichi-kubernetes/seichi-debug-minecraft-on-seichiassist-pr-template/template/kustomization.yaml similarity index 100% rename from seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/template/kustomization.yaml rename to seichi-onp-k8s/manifests/seichi-kubernetes/seichi-debug-minecraft-on-seichiassist-pr-template/template/kustomization.yaml diff --git a/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/template/stateful-set.yaml b/seichi-onp-k8s/manifests/seichi-kubernetes/seichi-debug-minecraft-on-seichiassist-pr-template/template/stateful-set.yaml similarity index 100% rename from seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/review-pr/template/stateful-set.yaml rename to seichi-onp-k8s/manifests/seichi-kubernetes/seichi-debug-minecraft-on-seichiassist-pr-template/template/stateful-set.yaml From e12e9a4f20110b9f3f2800f31de191e7ef0f7cb0 Mon Sep 17 00:00:00 2001 From: Kory Date: Mon, 18 Sep 2023 10:34:30 +0900 Subject: [PATCH 6/7] feat: add helm chart containing SeichiAssistDebugEnvRequest --- .../Chart.yaml | 5 + .../template/debug-env-request.yaml | 9 + .../template/kustomization.yaml | 4 - .../template/stateful-set.yaml | 195 ------------------ .../values.yaml | 5 + 5 files changed, 19 insertions(+), 199 deletions(-) create mode 100644 seichi-onp-k8s/manifests/seichi-kubernetes/seichi-debug-minecraft-on-seichiassist-pr-template/Chart.yaml create mode 100644 seichi-onp-k8s/manifests/seichi-kubernetes/seichi-debug-minecraft-on-seichiassist-pr-template/template/debug-env-request.yaml delete mode 100644 seichi-onp-k8s/manifests/seichi-kubernetes/seichi-debug-minecraft-on-seichiassist-pr-template/template/kustomization.yaml delete mode 100644 seichi-onp-k8s/manifests/seichi-kubernetes/seichi-debug-minecraft-on-seichiassist-pr-template/template/stateful-set.yaml create mode 100644 seichi-onp-k8s/manifests/seichi-kubernetes/seichi-debug-minecraft-on-seichiassist-pr-template/values.yaml diff --git a/seichi-onp-k8s/manifests/seichi-kubernetes/seichi-debug-minecraft-on-seichiassist-pr-template/Chart.yaml b/seichi-onp-k8s/manifests/seichi-kubernetes/seichi-debug-minecraft-on-seichiassist-pr-template/Chart.yaml new file mode 100644 index 000000000..f1d3e5f98 --- /dev/null +++ b/seichi-onp-k8s/manifests/seichi-kubernetes/seichi-debug-minecraft-on-seichiassist-pr-template/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: "seichi-debug-minecraft-on-seichiassist-pr-template" +version: "0.1.0" +maintainers: + - name: GiganticMinecraft diff --git a/seichi-onp-k8s/manifests/seichi-kubernetes/seichi-debug-minecraft-on-seichiassist-pr-template/template/debug-env-request.yaml b/seichi-onp-k8s/manifests/seichi-kubernetes/seichi-debug-minecraft-on-seichiassist-pr-template/template/debug-env-request.yaml new file mode 100644 index 000000000..ac6fddfaa --- /dev/null +++ b/seichi-onp-k8s/manifests/seichi-kubernetes/seichi-debug-minecraft-on-seichiassist-pr-template/template/debug-env-request.yaml @@ -0,0 +1,9 @@ +apiVersion: seichi.click/v1alpha1 +kind: SeichiAssistDebugEnvRequest +metadata: + labels: + app.kubernetes.io/part-of: seichi-gateway-operator + app.kubernetes.io/created-by: seichi-gateway-operator + name: seichireviewgateway-sample +spec: + pullRequestNo: {{ .SeichiAssistPullRequestNumber }} diff --git a/seichi-onp-k8s/manifests/seichi-kubernetes/seichi-debug-minecraft-on-seichiassist-pr-template/template/kustomization.yaml b/seichi-onp-k8s/manifests/seichi-kubernetes/seichi-debug-minecraft-on-seichiassist-pr-template/template/kustomization.yaml deleted file mode 100644 index aecf30d1a..000000000 --- a/seichi-onp-k8s/manifests/seichi-kubernetes/seichi-debug-minecraft-on-seichiassist-pr-template/template/kustomization.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: -- stateful-set.yaml diff --git a/seichi-onp-k8s/manifests/seichi-kubernetes/seichi-debug-minecraft-on-seichiassist-pr-template/template/stateful-set.yaml b/seichi-onp-k8s/manifests/seichi-kubernetes/seichi-debug-minecraft-on-seichiassist-pr-template/template/stateful-set.yaml deleted file mode 100644 index 3bfce7234..000000000 --- a/seichi-onp-k8s/manifests/seichi-kubernetes/seichi-debug-minecraft-on-seichiassist-pr-template/template/stateful-set.yaml +++ /dev/null @@ -1,195 +0,0 @@ -apiVersion: apps/v1 -kind: StatefulSet -metadata: - annotations: - reloader.stakater.com/auto: "true" - labels: - app: mcserver - mcserver: debug-s18 - name: mcserver--debug-s18 -spec: - replicas: 1 - serviceName: "mcserver--debug-s1" - selector: - matchLabels: - app: mcserver--debug-s18 - mcserver: debug-s18 - template: - metadata: - labels: - app: mcserver--debug-s18 - mcserver: debug-s18 - spec: - initContainers: - - name: mod-downloader - image: ghcr.io/giganticminecraft/mod-downloader:sha-39a89de - env: - - name: MINIO_ENDPOINT - value: seichi-private-plugin-blackhole-minio.minio:9000 - - name: MINIO_ACCESS_KEY - value: - - name: MINIO_ACCESS_SECRET - value: - - name: BUCKET_NAME - value: seichi-plugins - - name: BUCKET_PREFIX_NAME - value: deb-1-18-2 - - name: DOWNLOAD_TARGET_DIR_PATH - value: /tmp/plugins - volumeMounts: - - name: mod-downloader-volume - mountPath: /tmp/plugins - - name: jmx-exporter-downloader - image: busybox:1.36.0 - env: - - name: JMX_EXPORTER_URL - value: "https://repo1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/0.18.0/jmx_prometheus_javaagent-0.18.0.jar" - volumeMounts: - - name: jmx-exporter-download-volume - mountPath: /root/jmx-exporter-download - command: - - "sh" - - "-c" - - 'wget -O /root/jmx-exporter-download/jmx-exporter-javaagent.jar "${JMX_EXPORTER_URL}"' - - containers: - - resources: - requests: - memory: 2100Mi - env: - - name: MEMORY - value: 2048m - - name: TYPE - value: PAPER - - name: VERSION - value: "1.18.2" - - name: EULA - value: "TRUE" - - - name: REMOVE_OLD_MODS - value: "TRUE" - - - name: MODS - # DiscordSRV: - # https://github.com/DiscordSRV/DiscordSRV/releases/download/v1.24.0/DiscordSRV-Build-1.24.0.jar - # LunaChat: - # https://github.com/ucchyocean/LunaChat/releases/download/v3.0.16/LunaChat.jar - # ViaBackwards: - # https://github.com/ViaVersion/ViaBackwards/releases/download/4.6.1/ViaBackwards-4.6.1.jar - # ViaVersion: - # https://github.com/ViaVersion/ViaVersion/releases/download/4.6.2/ViaVersion-4.6.2.jar - value: >- - https://github.com/DiscordSRV/DiscordSRV/releases/download/v1.24.0/DiscordSRV-Build-1.24.0.jar, - https://github.com/ucchyocean/LunaChat/releases/download/v3.0.16/LunaChat.jar, - https://github.com/ViaVersion/ViaBackwards/releases/download/4.6.1/ViaBackwards-4.6.1.jar, - https://github.com/ViaVersion/ViaVersion/releases/download/4.6.2/ViaVersion-4.6.2.jar, - - name: JVM_OPTS - value: >- - -javaagent:/jmx-exporter/jmx-exporter-javaagent.jar=18321:/jmx-exporter/jmx-exporter-config.yaml - - name: COPY_CONFIG_DEST - # /config をサーバーディレクトリにコピーするようにする - # https://github.com/itzg/docker-minecraft-server/tree/9458005b5bd78b8139e13e66c29a449a12dd6218#optional-plugins-mods-and-config-attach-points - value: /data - - # 設定ファイル内の ${CFG_*} の形をした部分を置き換える - # https://github.com/itzg/docker-minecraft-server/tree/9458005b5bd78b8139e13e66c29a449a12dd6218#replacing-variables-inside-configs - - name: REPLACE_ENV_VARIABLE_PREFIX - value: CFG_ - - - name: CFG_DISCORDSRV_TOKEN - valueFrom: - secretKeyRef: - name: mcserver--common--config-secrets - key: DISCORDSRV_TOKEN - - - name: CFG_DISCORDSRV_GLOBAL_CHANNEL_ID - value: "1054159992447570032" - - - name: CFG_DISCORDSRV_CONSOLE_CHANNEL_ID - value: "1054159676964622426" - - image: itzg/minecraft-server:2023.3.0-java17-jdk - name: minecraft - ports: - - containerPort: 25565 - name: minecraft - - containerPort: 18321 - name: jmx-metrics - - startupProbe: - tcpSocket: - port: 25565 - # 最大120秒待つ - failureThreshold: 6 - periodSeconds: 20 - - volumeMounts: - # itzg/minecraft-server は /config に設定ファイルをマウントしておけばコピーをしてくれる。 - # 環境変数の置き換えはPrefix等の設定が必要なので、必要になったら設定するように。 - # https://github.com/itzg/docker-minecraft-server/tree/9458005b5bd78b8139e13e66c29a449a12dd6218#replacing-variables-inside-configs - - # 普通にマウントすると、auto-update (常に最新のvolume内容がコンテナ内から見える) の挙動を - # 提供するために symlink による一時ディレクトリがマウントされることになるが、 - # itzg/minecraft-server が利用するファイル同期の仕組み (itzg/mc-image-helper) は - # symlink を展開してしまうため、設定ファイルのパスが壊れてしまう。 - # - # subPathを利用してマウントすればsymlinkが作られることを回避できるためそのようにしている。 - # 参考: https://stackoverflow.com/a/63114800 - # 参考: https://stackoverflow.com/a/50687707 - - # サーバーの設定ファイル - - name: common-mcserver-configs - mountPath: /config/bukkit.yml - subPath: bukkit.yml - - name: common-mcserver-configs - mountPath: /config/paper.yml - subPath: paper.yml - - name: common-mcserver-configs - mountPath: /config/server.properties - subPath: server.properties - - name: common-mcserver-configs - mountPath: /config/spigot.yml - subPath: spigot.yml - - # DiscordSRV プラグインの設定ファイル - - name: common-mcserver-plugin-configs - mountPath: /plugins/DiscordSRV/config.yml - subPath: DiscordSRV-config.yml - - name: common-mcserver-plugin-configs - mountPath: /plugins/DiscordSRV/messages.yml - subPath: DiscordSRV-messages.yml - - # MorningGlorySeeds プラグインの設定ファイル - - name: common-mcserver-plugin-configs - mountPath: /plugins/MorningGlorySeeds/config.yml - subPath: MorningGlorySeeds-config.yml - - # LunaChat プラグインの設定ファイル - - name: common-mcserver-plugin-configs - mountPath: /plugins/LunaChat/config.yml - subPath: LunaChat-config.yml - - # JMX exporter 周りのファイルが入ったボリューム達のマウント設定 - - name: jmx-exporter-download-volume - mountPath: /jmx-exporter/jmx-exporter-javaagent.jar - subPath: jmx-exporter-javaagent.jar - - name: common-jmx-exporter-config - mountPath: /jmx-exporter/jmx-exporter-config.yaml - subPath: jmx-exporter-config.yaml - - volumes: - - name: common-mcserver-configs - configMap: - name: common-mcserver-configs - - name: common-mcserver-plugin-configs - configMap: - name: common-mcserver-plugin-configs - - # JMX exporterをinitContainerでダウンロードしてBugneeCordに受け渡すためのvolume - - name: jmx-exporter-download-volume - emptyDir: {} - - name: mod-downloader-volume - emptyDir: {} - - name: common-jmx-exporter-config - configMap: - name: common-jmx-exporter-config diff --git a/seichi-onp-k8s/manifests/seichi-kubernetes/seichi-debug-minecraft-on-seichiassist-pr-template/values.yaml b/seichi-onp-k8s/manifests/seichi-kubernetes/seichi-debug-minecraft-on-seichiassist-pr-template/values.yaml new file mode 100644 index 000000000..6f6ff6c4e --- /dev/null +++ b/seichi-onp-k8s/manifests/seichi-kubernetes/seichi-debug-minecraft-on-seichiassist-pr-template/values.yaml @@ -0,0 +1,5 @@ +# この環境がデバッグすることを目的とする SeichiAssist pull request の PR 番号 +SeichiAssistPullRequestNumber: null + +# seichiAssistPullRequestNumber で指定される Pull Request の Head SHA +PullRequestBranchHeadSha: null From 4dda2aefded80d9ba7da0a4fb97b6883dae65ed0 Mon Sep 17 00:00:00 2001 From: Kory Date: Mon, 18 Sep 2023 10:36:35 +0900 Subject: [PATCH 7/7] feat: pass values --- .../seichi-debug-minecrafts-on-seichiassist-prs.yaml | 5 +++++ .../values.yaml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/app-of-other-apps/seichi-debug-minecrafts-on-seichiassist-prs.yaml b/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/app-of-other-apps/seichi-debug-minecrafts-on-seichiassist-prs.yaml index 215e0923f..6863f7652 100644 --- a/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/app-of-other-apps/seichi-debug-minecrafts-on-seichiassist-prs.yaml +++ b/seichi-onp-k8s/manifests/seichi-kubernetes/apps/cluster-wide-apps/app-of-other-apps/seichi-debug-minecrafts-on-seichiassist-prs.yaml @@ -27,6 +27,11 @@ spec: repoURL: https://github.com/GiganticMinecraft/seichi_infra.git targetRevision: main path: seichi-onp-k8s/manifests/seichi-kubernetes/seichi-debug-minecraft-on-seichiassist-pr-template + helm: + releaseName: seichi-debug-minecraft-on-seichiassist-pr-{{number}} + values: | + SeichiAssistPullRequestNumber: "{{number}}" + PullRequestBranchHeadSHA: "{{head_sha}}" destination: server: https://kubernetes.default.svc namespace: "seichi-debug-minecraft-on-seichiassist-pr-{{number}}" diff --git a/seichi-onp-k8s/manifests/seichi-kubernetes/seichi-debug-minecraft-on-seichiassist-pr-template/values.yaml b/seichi-onp-k8s/manifests/seichi-kubernetes/seichi-debug-minecraft-on-seichiassist-pr-template/values.yaml index 6f6ff6c4e..dd804e318 100644 --- a/seichi-onp-k8s/manifests/seichi-kubernetes/seichi-debug-minecraft-on-seichiassist-pr-template/values.yaml +++ b/seichi-onp-k8s/manifests/seichi-kubernetes/seichi-debug-minecraft-on-seichiassist-pr-template/values.yaml @@ -2,4 +2,4 @@ SeichiAssistPullRequestNumber: null # seichiAssistPullRequestNumber で指定される Pull Request の Head SHA -PullRequestBranchHeadSha: null +PullRequestBranchHeadSHA: null