Auto-sync: 2026-04-20 00:02

This commit is contained in:
2026-04-20 00:02:56 +08:00
parent 8341ee6cc4
commit 6ab2838935
104 changed files with 4077 additions and 31 deletions

View File

@@ -0,0 +1,34 @@
---
title: "Idempotent Operation"
type: concept
tags: [DevOps, GitOps, 基础概念]
sources: [ctp-topic-33-an-introduction-to-gitops.md]
last_updated: 2026-04-19
---
## Definition
Idempotent Operation幂等操作是指可以多次执行而不会改变超出初始应用结果的操作。无论执行多少次最终状态都与执行一次相同。
## Examples
- Kubernetes 部署:多次 apply 相同配置不会导致重复创建
- Terraform apply重复执行会产生相同的基础设施状态
- 文件权限设置:重复 chmod 相同权限
- 数据库 UPSERT重复插入或更新
## Non-Idempotent Examples
- `curl` 请求:每次执行都会创建新资源
- 计数器递增:每次执行都会改变值
- 文件追加:重复执行会累积内容
## Importance in GitOps
- 确保部署过程可重复执行
- 支持自动重试和恢复
- 简化故障处理和调试
## Related Concepts
- [[GitOps]]
- [[Declarative Configuration]]
- [[Infrastructure as Code (IaC)]]
## Related Sources
- [[ctp-topic-33-an-introduction-to-gitops]] — GitOps 入门介绍