#!/bin/bashKIND=RESOURCE_KINDNAMESPACE=RESOURCE_NAMESPACEANNOTATION_KEY="cnrm.cloud.google.com/reconcile-interval-in-seconds"ANNOTATION_VALUE=RECONCILE_INTERVAL
kubectlannotate--overwrite--all${KIND}${ANNOTATION_KEY}=${ANNOTATION_VALUE}-n${NAMESPACE}echo"Annotation added to all ${KIND} RESOURCE"
Warning UpdateFailed 37m (x643 over 15d) computeinstance-controller Update call failed: the desired mutation for the following field(s) is invalid: [bootDisk.0.InitializeParams.0.Image networkInterface.0.NetworkIp]
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-04 (世界標準時間)。"],[[["\u003cp\u003eConfig Connector uses a reconciliation strategy to maintain the desired state of resources, automatically adjusting them to match the declared configuration.\u003c/p\u003e\n"],["\u003cp\u003eThe time it takes for resources to reach consistency varies, depending on the type of resource and whether they are already created, with changes to a GKE cluster generally completing within seconds, while Google Cloud resources might require more time.\u003c/p\u003e\n"],["\u003cp\u003eYou can configure the average reconciliation interval for resources using the \u003ccode\u003ecnrm.cloud.google.com/reconcile-interval-in-seconds\u003c/code\u003e annotation, allowing for adjustments to frequency and control, while setting the interval to 0 will stop all reconciliations once it reaches an "UpToDate" status.\u003c/p\u003e\n"],["\u003cp\u003eMutable but unreadable fields (e.g., passwords) are only updated when the custom resource is modified, and immutable fields that can't be reconciled will trigger an "UpdatedFailed" event, requiring manual deletion and recreation of the resource.\u003c/p\u003e\n"],["\u003cp\u003eReconciliation retries, in case of an error, are set with an exponential backoff, and are capped at a maximum of two minutes.\u003c/p\u003e\n"]]],[],null,["# Reconciliation strategy\n=======================\n\n*** ** * ** ***\n\nWith declarative configuration, you define the desired state of the system. The\nsystem then works constantly to remain as close as possible to this state. See\n[Declarative management of Kubernetes objects using configuration files](https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/)\nfor more information.\n\nWith Config Connector, you can create and update resources in any order,\nregardless of dependency relationships. GKE moves your declared\nconfiguration towards\n[eventual consistency](https://en.wikipedia.org/wiki/Eventual_consistency)\nwith the desired state.\n\nFor example, if you create a `PubSubSubscription` before the corresponding\n`PubSubTopic`, Config Connector waits until the topic is created before\ncreating the associated subscription.\n\nThe duration your Config Connector installation remains inconsistent depends on\nthe number and types of resources it manages. Changes to a GKE\ncluster are typically executed in seconds. However, the time to create\nGoogle Cloud resources can vary based on the type of resource. For\nexample, a single `PubSubTopic` takes seconds to create. Google Cloud\nresources do not reach consistency until they are created. For example, when\ncreating an `SQLInstance` and an `SQLDatabase`, the system is inconsistent for a\nperiod of minutes while the database is created.\n\nGKE and Config Connector reconcile each resource with every\nupdate or after a jitter period with an average based on the preconfigured default\ninterval. You can find the default interval in \"Config Connector Default Average\nReconcile Interval In Seconds\" from each resource's reference page.\nFor links to each resource, see the [Resource overview](/config-connector/docs/reference/overview).\nWhen there is an\nerror in reconciling, Config Connector retries with exponential backoff where\nmaximum backoff is two minutes. You can view any errors in the\n[Events](/config-connector/docs/how-to/monitoring-your-resources#viewing_events)\nof a given resource.\n\nConfiguring the reconciliation interval\n---------------------------------------\n\nStarting from Config Connector [1.102](/config-connector/docs/release-notes#March_30_2023), you can configure the average reconcile interval for resources managed by Config Connector with the `cnrm.cloud.google.com/reconcile-interval-in-seconds` annotation. The value of the annotation overwrites the default value of \"Config Connector Default Average\nReconcile Interval In Seconds\" from the [resource reference](/config-connector/docs/reference/overview)\npage.\nThe value of the annotation should be a non-negative integer representing time in seconds. If the value is set to 0, Config Connector stops initiating reconciliations for the resource once it reaches the [UpToDate](/config-connector/docs/how-to/monitoring-your-resources#-specific_events) status.\n\nFor example, if you want Config Connector to reconcile a resource less frequently to avoid hitting underlying Google Cloud\n[API quota issues](/config-connector/docs/best-practices#quota-limits), you can set the average reconciliation interval value to 1 hour. \n\n cnrm.cloud.google.com/reconcile-interval-in-seconds: \"3600\"\n\nIf you want Config Connector to reconcile a resource more frequently to correct drifts sooner, you can set the annotation with a small value.\n\nYou can annotate all resources of a particular type that shares the same Group Version Kind (GVK) with the following script:\n**Note:** If you are using a GitOps-style workflow, for example with [Config Sync](/anthos-config-management/docs/config-sync-overview), the following script may not be applicable. Instead, you must update the YAML files with the annotation set in your source of truth. \n\n #!/bin/bash\n\n KIND=\u003cvar translate=\"no\"\u003eRESOURCE_KIND\u003c/var\u003e\n NAMESPACE=\u003cvar translate=\"no\"\u003eRESOURCE_NAMESPACE\u003c/var\u003e\n ANNOTATION_KEY=\"cnrm.cloud.google.com/reconcile-interval-in-seconds\"\n ANNOTATION_VALUE=\u003cvar translate=\"no\"\u003eRECONCILE_INTERVAL\u003c/var\u003e\n\n kubectl annotate --overwrite --all ${KIND} ${ANNOTATION_KEY}=${ANNOTATION_VALUE} -n ${NAMESPACE}\n echo \"Annotation added to all ${KIND} RESOURCE\"\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eRESOURCE_KIND\u003c/var\u003e: the resource kind that you want to annotate.\n- \u003cvar translate=\"no\"\u003eRESOURCE_NAMESPACE\u003c/var\u003e: the namespace that contains the resources that you want to annotate.\n- \u003cvar translate=\"no\"\u003eRECONCILE_INTERVAL\u003c/var\u003e: the reconcile interval in seconds.\n\nYou can set the reconciliation interval to 0 to disable drift correction for a resource, but it does not disable resource actuation. If you make changes to the resource [`Spec`](/config-connector/docs/concepts/resources#spec_and_status), the resource will be reconciled again.\n\nSetting the reconciliation interval to 0 is irreversible. This means changing the value back to a non-zero number does not make Config Connector reconcile the resource again.\n\nIf you want to revert the 0 reconciliation interval, you have the following options:\n\n- Modify the resource spec with the reconciliation interval value to enable new reconciliations.\n- Abandon the resource by setting the annotation `cnrm.cloud.google.com/deletion-policy: \"abandon\"` and recreate the resource with a reconciliation interval value other than 0.\n\nMutable but unreadable fields are actuated on change only\n---------------------------------------------------------\n\nSome APIs expose fields that are not readable, but are mutable (for example, the\npassword for a SQL user). Due to the inability to see if these fields have been\nmodified, mutable but unreadable fields are updated only when the custom\nresource is modified.\n\nResources are not recreated when modifying immutable fields\n-----------------------------------------------------------\n\nSome fields in a resource are immutable, and can't be reconciled without\ndeleting, then re-creating the target resource.\n\nIn these situations, Config Connector emits an \"UpdatedFailed\" Kubernetes event\nfor the resource rather than perform this re-creation. You must then delete and\nre-create the resource.\n\nExample event: \n\n Warning UpdateFailed 37m (x643 over 15d) computeinstance-controller Update call failed: the desired mutation for the following field(s) is invalid: [bootDisk.0.InitializeParams.0.Image networkInterface.0.NetworkIp]"]]