Handle pre-existing resources
メンテナーはふだん 3 日以内に返信
@niyomukiza-mechack がすでに取り組んでいます。
2026年10月19日 から。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 15/100
- issue の種類
- 機能追加
- 明瞭さ
- 説明が足りない
- 活発さ
- 活発
- 技術スタック
- go, kubernetes
調査の方向性
This is a design discussion, not a code task: the issue weighs an AdoptedResource CRD against an resource-operator.temporal.io/adoption-policy annotation for adopt and adopt-or-create. Read the ACK adoption references it links to, and the GitOps trade-offs it describes, before forming a view. Done means a maintainer records which approach is chosen and the adoption semantics are agreed, and only then can implementation start.
索引モデルが issue の本文から書いたものです。
説明
One of the first dilemmas builders of Kubernetes operators that interface with cloud APIs must face is how to handle "adoption" of a pre-existing cloud resource by the Kubernetes operator.
There are two primary use cases that resource "adoption" aims to address:
- Manual
adoptoperation: this is for when a user is starting to use the Temporal Resource Operator for managing their Temporal Cloud resources but they already have existing Temporal Cloud resources and just want to instruct the Temporal Resource Operator to take ownership of the desired state of the resource. - Idempotent
adopt-or-createoperation: this is for when a user doesn't know (or care) whether the identified Temporal Cloud resource already exists. They want to be able tokubectl applythe custom resource manifest and have the Temporal Resource Operator create the resource if it does not exist OR take ownership of the desired state of the resource if it does exist.
There are generally two solutions to handling pre-existing resources: use a distinct AdoptedResource custom resource OR use annotations on the custom resources.
Use a distinct AdoptedResource custom resource
With this solution, a common AdoptedResource custom resource definition allows the user to explicitly instruct the Temporal Resource Operator to take ownership of a pre-existing Temporal Cloud resource.
The AdoptedResource custom resource definition might look something like this:
apiVersion: cloud.temporal.io/v1alpha1
kind: AdoptedResource
meta:
name: my-temporal-cloud-namespace
namespace: temporal-resource-operator
spec:
# this field contains override values for fields in the actual `cloud.temporal.io.Namespace`
# custom resource that will be created by Temporal Resource Operator when discovering
# the pre-existing resource and taking ownership of it.
kubernetes:
apiVersion: cloud.temporal.io/v1alpha1
kind: Namespace
metadata:
labels:
temporal.io/account: "<ACCOUNT_ID>"
temporal:
account: "<ACCOUNT_ID>"
project: "<PROJECT_ID>"
id: "<RESOURCE_ID>"
And the Temporal Resource Operator would have a reconciler embedded within it that would look for new AdoptedResource CRs, communicate with the Temporal Cloud API to check if the resource with the specified ID exists and create a CR of the Kind specified in the spec.kubernetes.kind field that contains the definition of the pre-existing Temporal Cloud resource.
Benefits:
- The adoption process is explicit and deliberate. The user would call
kubectl apply -f <adopted_resource_manifest>to manually bring the resource under the Temporal Resource Operator's ownership. - Because there is a separate
AdoptedResourceCRD, the status of the resource adoption operation can be put in theAdoptedResource.Statusfield, making debugging of the adoption process easier than if the adoption operation log lines are mixed in with log lines for "normal" lifecycle operations. - Because there is a separate controller that handles CRs of that Kind, we don't need to copy/paste adoption-related code into every
controller/$resourcesubpackage. Note that we could put common adoption-related code into thekube-temporalrepository to partially alleviate this concern.
Drawbacks:
- Requires users to know ahead of time that a resource already exists. In a GitOps-based fully-declarative configuration management system, the GitOps controller examines the Git config repo to determine the latest desired state of the environment. Having the
AdoptedResourcecontroller create custom resources means that the creation of custom resources handles outside that Git config repo, which means for GitOps-driven systems you would need some script or automation that would essentially dokubectl get <resource> -oyaml > $git_config_repo/$kind/$name.yml && git commitin order for the GitOps controller to have an accurate view of the latest desired state of the system.
Use annotations on the custom resources
This solution uses a couple annotations on the main custom resources managed by Temporal Resource Operator to instruct the operator how to handle a pre-existing resources.
These annotations might look like this:
apiVersion: cloud.temporal.io/v1alpha1
kind: Namespace
meta:
name: my-temporal-cloud-namespace
namespace: temporal-resource-operator
annotations:
resource-operator.temporal.io/adoption-policy: "adopt-or-create" # or just "adopt"
spec: {}
Temporal Resource Operator would populate the values of the custom resource's Spec field with the latest observed state read from the Temporal Cloud API for that resource.
The resource-operator.temporal.io/adoption-policy annotation would instruct Temporal Resource Operator how to handle pre-existing resources. When the annotation value is adopt, Temporal Resource Operator would expect a Temporal Cloud resource to exist and return an error when it did not. When the annotation value is adopt-or-create, Temporal Resource Operator would create the Temporal Cloud resource as specified in the applied custom resource's Spec if it did not already exist.
Benefits:
- No need for another CRD.
Drawbacks:
- Controllers should generally never update the
Specfield of a resource that it manages (by "manages", I'm referring to the controller specifying that resource in the controller-runtime'sTypedBuilder.For()method) - Because the Temporal Resource Operator updates the
Spec(desired state) of a resource that it adopts, this can interfere with a GitOps-driven system. In a GitOps-based fully-declarative configuration management system, the GitOps controller examines the Git config repo to determine the latest desired state of the environment. Having the controller update theSpecof custom resources means that the source of desired resource state is now outside that Git config repo, which means for GitOps-driven systems you would need some script or automation that would essentially dokubectl get <resource> -oyaml > $git_config_repo/$kind/$name.yml && git commitin order for the GitOps controller to have an accurate view of the latest desired state of the system.
ACK
ACK originally used the separate AdoptedResource approach but switched to using annotations in late 2024 and into 2025. They totally rewrote the AdoptedResource functionality. Here is the original AdoptedResource proposal. This GH issue from July 2022 is the impetus for using annotations for adoption instead of the separate AdoptedResource CRD. The final Adopt-or-Create feature was merged in April 2025 and the official docs now recommend using annotations.
- 主要言語
- Go
- スター
- 1
- フォーク
- 0
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 7
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
temporalio/cloud-operator のほかの issue
-
Kustomize Installオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
temporalio/cloud-operator#19 ·
メンテナーはふだん 3 日以内に返信
-
Prepare notes for Demo対応中かも @ericbriffa が 4 日前に担当しました。 オープンdocumentation
temporalio/cloud-operator#31 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 3 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
temporalio/cloud-operator#29 ·
メンテナーはふだん 3 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
temporalio/cloud-operator#28 ·
メンテナーはふだん 3 日以内に返信
-
Helm chartオープン
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
temporalio/cloud-operator#21 ·
メンテナーはふだん 3 日以内に返信
temporalio/cloud-operator の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
[flaky test] TestValidatorCommitterDropsEmptyStatusBatch: submits to the mock VC before its stream is registered対応中かも @liran-funaro が今日担当しました。 オープンcoordinator flaky-test race-condition testing
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
hyperledger/fabric-x-committer#876 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
garethgeorge/backrest#1426 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 1 日以内に返信
-
enhancement nav-pilot
難易度 2/5 半日 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信