You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-32Lines changed: 17 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,8 +7,8 @@ A Crossplane Composition Function for implementing manual approval workflows.
7
7
The `function-approve` provides a serverless approval mechanism at the Crossplane level that:
8
8
9
9
1. Tracks changes to a specified field by computing a hash
10
-
2.Pauses reconciliation when changes are detected (using either pause annotation or Synced=False condition)
11
-
3. Requires explicit approval before allowing reconciliation to continue
10
+
2.When changes need approval, overwrites Desired state with Observed state to prevent changes
11
+
3. Requires explicit approval before allowing changes to proceed
12
12
4. Prevents drift by storing previously approved state
13
13
14
14
This function implements the approval workflow using entirely Crossplane-native mechanisms without external dependencies, making it lightweight and reliable.
@@ -30,9 +30,9 @@ spec:
30
30
31
31
1. When a resource is created or updated, `function-approve` calculates a hash of the monitored field (e.g., `spec.resources`).
32
32
2. The function stores this hash in `status.newHash` (or specified field).
33
-
3. If there's a previous approved hash (`status.oldHash`) and it doesn't match the new hash, reconciliation is paused.
33
+
3. If there's a previous approved hash (`status.oldHash`) and it doesn't match the new hash, the function replaces Desired state with Observed state.
34
34
4. An operator must approve the change by setting `status.approved = true`.
35
-
5. After approval, the new hash is stored as the approved hash, the approval flag is reset, and reconciliation resumes.
35
+
5. After approval, the new hash is stored as the approved hash, the approval flag is reset, and changes are allowed to proceed.
36
36
6. If a customer modifies an existing claim after approval, this will generate a new hash, requiring another approval.
37
37
38
38
## Example
@@ -70,10 +70,8 @@ spec:
70
70
| `approvalField` | string | Status field to check for approval. Default: `status.approved`|
71
71
| `oldHashField` | string | Status field to store previously approved hash. Default: `status.oldHash`|
72
72
| `newHashField` | string | Status field to store current hash. Default: `status.newHash`|
73
-
| `pauseAnnotation` | string | Annotation to use for pausing reconciliation. Default: `crossplane.io/paused`|
74
73
| `detailedCondition` | bool | Whether to add detailed information to conditions. Default: `true`|
75
74
| `approvalMessage` | string | Message to display when approval is required. Default: `Changes detected. Approval required.`|
76
-
| `setSyncedFalse` | bool | Use Synced=False condition instead of pause annotation. Default: `false`|
77
75
78
76
## Using with Custom Resources
79
77
@@ -119,16 +117,15 @@ spec:
119
117
120
118
## Approving Changes
121
119
122
-
When changes are detected, the resource's reconciliation is paused, and its condition will show `ApprovalRequired` status. To approve the changes, patch the resource's status:
120
+
When changes are detected, the Desired state is replaced with Observed state (preventing any changes from being applied), and the resource will show an `ApprovalRequired` condition. To approve the changes, patch the resource's status:
123
121
124
122
```yaml
125
123
kubectl patch xapproval example --type=merge --subresource=status -p '{"status":{"approved":true}}'
126
124
```
127
125
128
126
After approval, the function will:
129
127
1. Record the new state as the approved state
130
-
2. Remove the pause annotation
131
-
3. Allow reconciliation to continue
128
+
2. Allow the changes to proceed normally without overwriting the Desired state
0 commit comments