구성 커넥터를 사용하면 '변경할 수 없지만 선택적' resourceID 필드를 사용하여 Google Cloud 리소스의 리소스 ID를 명시적으로 지정하여 리소스를 만들거나 가져옵니다. '변경할 수 있지만 선택적'이라 함은 resourceID 필드를 지정하거나 지정하지 않을 수 있지만 클러스터에 매니페스트를 적용한 후 resourceID 필드 값을 변경할 수 없음을 의미합니다.
resourceID 필드는 사용자 지정 리소스 ID를 포함하는 Google Cloud 리소스의 이름 지정을 보다 유연하게 할 수 있도록 지원합니다. Config Connecter 리소스에서 resourceID 필드를 사용하면 동일한 네임스페이스 내의 서로 다른 프로젝트, 폴더, 조직 또는 상위 리소스에서 동일한 Google Cloud 리소스 이름으로 동일한 종류의 여러 구성 커넥터 리소스를 정의할 수 있습니다. Google Cloud 리소스 이름은 Kubernetes 객체 이름의 이름 지정 규칙에 의한 제한을 받지 않습니다. 또한 resourceID 필드를 사용하면 서비스 생성 리소스 ID가 포함된 Google Cloud 리소스를 가져올 수 있습니다.
구성 커넥터는 네임스페이스를 리소스의 '소유자'로 지정하여 다른 소유자가 가져가지 못하도록 방지합니다. 그러나 resourceID 필드를 사용하는 경우 동일한 네임스페이스 내에서 생성되었으며 동일한 Google Cloud 리소스 이름을 가진 리소스가 여러 개 있을 수 있습니다. 이러한 리소스로 인해 구성 커넥터가 관리할 수 없는 충돌이 발생합니다. 해당 충돌은 수동으로 해결해야 합니다.
리소스 ID 유형
구성 커넥터에서 리소스 ID는 사용자 지정 또는 서비스 생성일 수 있습니다.
사용자 지정 리소스 ID
리소스 생성 전에 사용자가 결정, 지정, 및 전달하는 리소스 ID입니다. resourceID 필드를 사용하여 사용자 지정 리소스 ID가 포함된 리소스를 만들거나 가져올 수 있습니다.
서비스 생성 리소스 ID
리소스 생성 시에 서비스에서 생성한 리소스 ID입니다.
리소스를 성공적으로 만든 후 사용자가 이를 검색할 수 있습니다. resourceID 필드를 사용하여 서비스 생성 리소스 ID가 포함된 리소스를 가져올 수 있습니다. 서비스 생성 리소스 ID가 포함된 새 리소스를 만들려면 필드를 지정하지 마세요. 서비스 생성 리소스 ID가 포함된 리소스 목록을 참조하세요.
resourceID 필드 지정
리소스의 spec에서 resourceID 필드를 지정할 수 있습니다.
다음 매니페스트는 Pub/Sub 주제의 resourceID 필드를 지정하는 방법을 설명합니다. 구성 커넥터 리소스의 이름은 pubsub-topic-sample이고 Pub/Sub 주제의 이름은 pubsub-topic-id입니다.
resourceID 필드로 Google Cloud 리소스를 관리할 때 구성 커넥터는 다음과 같은 경우에 리소스를 가져옵니다.
리소스에 사용자 지정 리소스 ID가 있고, 매니페스트와 리소스 이름의 값이 기존 리소스와 일치합니다. 또는
리소스에 서비스 생성 리소스 ID가 있습니다.
폴더 가져오기
구성 커넥터에서 resourceID 필드를 사용하여 폴더를 획득하려면 다음 단계를 완료하세요.
다음 내용을 folder.yaml 파일에 복사합니다.
apiVersion:resourcemanager.cnrm.cloud.google.com/v1beta1kind:Foldermetadata:annotations:cnrm.cloud.google.com/organization-id:ORG_ID# Remove the deletion-policy annotation if it is safe to delete the# folder when the resource is deleted from your cluster.cnrm.cloud.google.com/deletion-policy:"abandon"name:folder-sample-for-acquisitionspec:resourceID:ACQUIRED_FOLDER_IDdisplayName:ACQUIRED_FOLDER_DISPLAY_NAME
다음을 바꿉니다.
ORG_ID를 조직의 숫자 ID로 바꿉니다.
ACQUIRED_FOLDER_ID를 획득할 폴더의 숫자 ID로 바꿉니다.
ACQUIRED_FOLDER_DISPLAY_NAME을 획득할 폴더의 표시 이름으로 바꿉니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2024-12-21(UTC)"],[[["\u003cp\u003eThe \u003ccode\u003eresourceID\u003c/code\u003e field in Config Connector allows you to explicitly specify the resource ID of a Google Cloud resource, offering flexibility in naming.\u003c/p\u003e\n"],["\u003cp\u003eUsing \u003ccode\u003eresourceID\u003c/code\u003e, you can manage multiple Config Connector resources with the same Google Cloud resource name across different projects, folders, or organizations within a namespace.\u003c/p\u003e\n"],["\u003cp\u003eResource IDs can be user-specified, defined by the user, or service-generated, determined by the service during resource creation.\u003c/p\u003e\n"],["\u003cp\u003eSpecifying \u003ccode\u003eresourceID\u003c/code\u003e enables both the creation of new resources and the acquisition of existing ones, with the system attempting acquisition if the resource has a service-generated ID.\u003c/p\u003e\n"],["\u003cp\u003eWhile \u003ccode\u003eresourceID\u003c/code\u003e provides flexibility, it can also lead to conflicts with multiple resources sharing the same name in a namespace, requiring manual conflict resolution.\u003c/p\u003e\n"]]],[],null,["# Managing resources with the resourceID field\n============================================\n\n*** ** * ** ***\n\nThis page explains how to manage resources with the `resourceID` field.\n\nConfig Connector lets you explicitly specify the [resource\nID](/apis/design/resource_names#resource_id) of a Google Cloud\nresource using the immutable but optional *`resourceID` field* to create or\nacquire the resource. \"Immutable, but optional\" means that you can choose to\nspecify or not specify the `resourceID` field, but you can't make any changes to\nthe value of the `resourceID` field after applying the manifest to your cluster.\n\nThe `resourceID` field increases the flexibility of naming a Google Cloud\nresource that has a\n[user-specified resource ID](#types_of_resource_ids). Using the `resourceID`\nfield in your Config Connector resources, you can define multiple\nConfig Connector resources of the same kind with the same Google Cloud\nresource name under different projects, folders, organizations or parent\nresources within the same namespace. The Google Cloud resource name is\nalso not restricted by the\n[naming convention](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-subdomain-names)\nof a Kubernetes object name. In addition, the `resourceID` field enables the\nacquisition of a Google Cloud resource that has a [service-generated\nresource ID](#types_of_resource_ids).\n\nConfig Connector makes the namespace the \"owner\" of a resource to prevent it\nfrom being taken by another owner. However, if you are using the `resourceID` field,\nthere can be multiple resources with the same Google Cloud resource name,\ncreated under the same namespace. These resources create conflicts that Config Connector\ncannot [manage](/config-connector/docs/concepts/managing-conflicts). You need to\nresolve any conflicts manually.\n\nTypes of resource IDs\n---------------------\n\nIn Config Connector, resource IDs can be *user-specified* or\n*service-generated*.\n\nUser-specified resource IDs\n: A resource ID that is determined, specified, and passed in by the user before\n the resource creation. You can create or acquire a resource that has a\n user-specified resource ID with the `resourceID` field.\n\nService-generated resource IDs\n: A resource ID that is generated by the service during the resource creation.\n It can be retrieved by the user after the resource is successfully created. You\n can acquire a resource that has a service-generated resource ID with the\n `resourceID` field. Leave the field unspecified if you want to create a new\n resource that has a service-generated resource ID. See the list of [Resources with a service-generated resource\n ID](/config-connector/docs/how-to/managing-deleting-resources#service-generated-resource-id).\n\nSpecifying the resourceID field\n-------------------------------\n\nYou can specify the `resourceID` field in the resource's `spec`.\n\nThe following manifest describes how to specify the `resourceID` field for a\nPub/Sub topic. The name of the Config Connector resource is\n`pubsub-topic-sample` and the name of the Pub/Sub topic is\n`pubsub-topic-id`. \n\n apiVersion: pubsub.cnrm.cloud.google.com/v1beta1\n kind: PubSubTopic\n metadata:\n name: pubsub-topic-sample\n spec:\n resourceID: pubsub-topic-id\n\nCreating a resource with the resourceID field\n---------------------------------------------\n\n| **Note:** When you manage a Google Cloud resource with the `resourceID` field, if the resource has a service-generated resource ID, Config Connector assumes the resource already exists and tries to acquire the resource.\n\n### Creating a BigQuery dataset\n\nIn this example, you create a new BigQuery dataset using\nConfig Connector with the `resourceID` field. The value of the `resourceID`\nfield should follow the\n[naming convention for the `datasetId` field](https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets#datasetreference)\nof the BigQuery dataset.\n\n1. Copy the following contents into a file named `bigquery-dataset.yaml`.\n\n apiVersion: bigquery.cnrm.cloud.google.com/v1beta1\n kind: BigQueryDataset\n metadata:\n name: bigquerydataset-sample-for-creation\n spec:\n resourceID: bigquerydataset_sample_with_resourceid\n defaultTableExpirationMs: 3600000\n description: \"BigQuery Dataset Sample with the ResourceID Field\"\n friendlyName: bigquerydataset-sample-with-resourceid\n location: US\n\n2. Apply the YAML file to your cluster.\n\n ```\n kubectl apply --namespace CC_NAMESPACE -f bigquery-dataset.yaml\n ```\n\n Replace \u003cvar translate=\"no\"\u003eCC_NAMESPACE\u003c/var\u003e with the namespace Config Connector\n manages resources from.\n3. Use `kubectl describe` to see details on the dataset.\n\n ```\n kubectl describe --namespace CC_NAMESPACE bigquerydataset bigquerydataset-sample-for-creation\n ```\n\n Replace \u003cvar translate=\"no\"\u003eCC_NAMESPACE\u003c/var\u003e with the namespace Config Connector\n manages resources from.\n\nAcquiring a resource with the resourceID field\n----------------------------------------------\n\nWhen you manage a Google Cloud resource with the `resourceID` field,\nConfig Connector acquires the resource if:\n\n- The resource has a user-specified resource ID, and the values in the manifest and the resource name match an existing resource; Or,\n- The resource has a service-generated resource ID.\n\n### Acquiring a folder\n\nTo acquire a folder using Config Connector with the `resourceID` field, complete\nthe following steps:\n\n1. Copy the following contents into a file named `folder.yaml`.\n\n apiVersion: resourcemanager.cnrm.cloud.google.com/v1beta1\n kind: Folder\n metadata:\n annotations:\n cnrm.cloud.google.com/organization-id: \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eORG_ID\u003c/span\u003e\u003c/var\u003e\n # Remove the deletion-policy annotation if it is safe to delete the\n # folder when the resource is deleted from your cluster.\n cnrm.cloud.google.com/deletion-policy: \"abandon\"\n name: folder-sample-for-acquisition\n spec:\n resourceID: \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eACQUIRED_FOLDER_ID\u003c/span\u003e\u003c/var\u003e\n displayName: \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eACQUIRED_FOLDER_DISPLAY_NAME\u003c/span\u003e\u003c/var\u003e\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eORG_ID\u003c/var\u003e with the numeric ID for your organization.\n - \u003cvar translate=\"no\"\u003eACQUIRED_FOLDER_ID\u003c/var\u003e with the numeric ID for the folder to be acquired.\n - \u003cvar translate=\"no\"\u003eACQUIRED_FOLDER_DISPLAY_NAME\u003c/var\u003e with the display name for the folder to be acquired.\n2. Apply the YAML file to your cluster.\n\n ```\n kubectl apply --namespace CC_NAMESPACE -f folder.yaml\n ```\n\n Replace \u003cvar translate=\"no\"\u003eCC_NAMESPACE\u003c/var\u003e with the namespace Config Connector\n manages resources from.\n3. Use `kubectl describe` to see details on the folder.\n\n ```\n kubectl describe --namespace CC_NAMESPACE folder folder-sample-for-acquisition\n ```\n\n Replace \u003cvar translate=\"no\"\u003eCC_NAMESPACE\u003c/var\u003e with the namespace Config Connector\n manages resources from.\n\nWhat's next\n-----------\n\nReview the [Resource reference](/config-connector/docs/reference/resources) to\nlearn about the resources Config Connector supports."]]