LastAsyncOperation isn't cleared after async success: should it read previousAsyncOperation ?
- Dominant language
- Go
- Stars
- 481
- Forks
- 131
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 11
Description
### What happened?
The following conditions are not friendly for crossplane users: the `LastAsyncOperation` condition reports a failure however a more recent `AsyncOperation` reports a success. This is confusing as this may be interpreted as an error. Does the condition `LastAsyncOperation` rather aims at describing the `previousAsyncOperation` ?
```yaml
conditions:
- lastTransitionTime: "2023-07-04T14:16:16Z"
reason: Available
status: "True"
type: Ready
- lastTransitionTime: "2023-07-04T14:16:15Z"
reason: ReconcileSuccess
status: "True"
type: Synced
- lastTransitionTime: "2023-07-04T13:36:06Z"
message: 'apply failed: Error, failed to create instance kuttl-medium-mysql-instance-6q268-6gs5q:
googleapi: Error 400: Invalid request: Invalid label: Label value ''a-string-with-dot-.-which-is-invalid-char'
violates format constraints. The value can only contain lowercase letters, numeric
characters, underscores and dashes. The value can be at most 63 characters long.
International characters are allowed.., invalid: '
reason: ApplyFailure
status: "False"
type: LastAsyncOperation
- lastTransitionTime: "2023-07-04T14:16:16Z"
reason: Finished
status: "True"
type: AsyncOperation
```
here is the current declaration for this condition
https://github.com/upbound/upjet/blob/018e6404baef55366ddd86d8d9cbf04c9bcb2426/pkg/resource/conditions.go#L30-L40
It was previously named AsyncOperationFinished into https://github.com/upbound/upjet/commit/3953d888f446fcde583b19731ef379eb09b773cc
### How can we reproduce it?
First provision a gcp cloud sql with an invalid label
```yaml
apiVersion: sql.gcp.upbound.io/v1beta1
kind: DatabaseInstance
metadata:
name: kuttl-medium-mysql-instance-6q268-6gs5q
spec:
forProvider:
[...]
databaseVersion: MYSQL_8_0_28
settings:
[...]
userLabels:
k8s_cluster_api: a-string-with-dot-.-which-is-invalid-char
```
Then fix it
```yaml
apiVersion: sql.gcp.upbound.io/v1beta1
kind: DatabaseInstance
metadata:
name: kuttl-medium-mysql-instance-6q268-6gs5q
spec:
forProvider:
[...]
databaseVersion: MYSQL_8_0_28
settings:
[...]
userLabels:
k8s_cluster_api: a-valid-string-without-invalid-chars
```
Contributor guide
Assessment
This issue has not been assessed yet.