mkr-gcloud-auto-retirement の設計
ne-sachirou/mkr-gcloud-auto-retirement: Mackerel の Google Cloud インテグレーションから Compute Engine instance を自動退役します
2022/6 の設計
Compute EngineCompute Engine.icon→Google Cloud LoggingGoogle Cloud Logging.icon→Cloud Logging Sync→Google Cloud Pub/SubGoogle Cloud Pub/Sub.icon→Google Cloud RunGoogle Cloud Run.icon
HashiCorp TerraformHashiCorp Terraform.iconにしてぇなぁ
Cloud Logging Sync
code:Cloud Logging Sync の包含 filter.sql
resource.type="gce_instance"
severity=NOTICE
protoPayload.methodName="v1.compute.instances.delete"
operation.last="true"
.resource.labels.instance_id に Compute Engine の instance ID が入ってゐる
code:2022-06 動作.mmd
sequenceDiagram
participant Cloud Pub/Sub
actor app
participant Mackerel
Cloud Pub/Sub->>app : instance 削除完了
app->>Mackerel : GET /api/v0/hosts
Mackerel-->>app : hosts
app->>app : host 檢索
app->>Mackerel : POST /api/v0/hosts/<hostId>/retire
Google Cloud Pub/SubGoogle Cloud Pub/Sub.icon からだうやって處理を起こす?
managed FaaS
Google Cloud FunctionsGoogle Cloud Functions.icon は檢討しない
Google Cloud RunGoogle Cloud Run.icon
Cloud Run とは  |  Cloud Run のドキュメント  |  Google Cloud
KnativeKnative.icon base ではあるらしいがどこまで同じなのか?
Google Cloud RunGoogle Cloud Run.icon にするか
self-hosted FaaS
KEDAKEDA.icon は檢討しない
KnativeKnative.icon
Knative Eventing overview - Knative
CloudPubSubSource Example
導入と Google Cloud Pub/SubGoogle Cloud Pub/Sub.icon への接續が簡單ならこれにしたい
Argo EventsArgo.icon
GCP Pub/Sub - Argo Events - The Event-Based Dependency Manager for Kubernetes
self-hosted server
Pod から Google Cloud Pub/SubGoogle Cloud Pub/Sub.icon を polling
2021/12 の設計
Mackerel の Google Cloud インテグレーションから、Compute Engine instance を自動退役する - c4se記:さっちゃんですよ☆
code:2021-12 動作.mmd
sequenceDiagram
participant K8s
actor app
participant Compute Engine
participant Mackerel
K8s->>app : CronJob
app->>Compute Engine : GET instances
Compute Engine-->>app : instances
app->>Mackerel : GET /api/v0/hosts?service=<service>&role=<role>
Mackerel-->>app : hosts
app->>app : host 有無比較
app->>Mackerel : POST /api/v0/hosts/<hostId>/retire
app->>Mackerel : POST /api/v0/hosts/<hostId>/retire