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: docs/gko/4.9/overview/custom-resource-definitions/README.md
+139-1Lines changed: 139 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,4 +25,142 @@ The `Application` custom resource represents the configuration for an applicatio
25
25
26
26
Finally, the purpose of the `ManagementContext` is to provide a connection from GKO to your Gravitee API Management installation. GKO uses this connection to synchronize the resources it manages (APIs, applications, ...) with the Gravitee Console, Developer Portal, and Gateway.
27
27
28
-
In the following sections, we run through each CRD one by one.
28
+
# Custom Resource Definition (CRD) Status
29
+
When you deploy Custom Resources (CRDs) with the Gravitee Kubernetes Operator (GKO), the `status` field is populated with the latest information about the resource's state within the cluster. The 4.9 version of GKO introduces enhancements to the CRD status fields, providing clearer insights, streamlined troubleshooting, and improved support for GitOps workflows.
30
+
31
+
These enhancements include more structured, descriptive status information that aligns with best practices and offers consistent conventions across CRDs. This enables tighter integration with tools like ArgoCD and simplifies operational management for platform teams.
32
+
33
+
34
+
Prerequisites
35
+
- Gravitee Kubernetes Operator version 4.9.0 or above
36
+
- A Kubernetes cluster with the GKO installed. For more information about installing GKO, see [https://documentation.gravitee.io/gravitee-kubernetes-operator-gko/getting-started/quickstart-guide](Quick Start Guide)
37
+
- Access to view CRDs with `kubectl get` commands
38
+
39
+
## Viewing CRD Status
40
+
1. Get a list of deployed V4 APIs using the following command:
41
+
42
+
```bash
43
+
kubectl get apiv4definitions.gravitee.io
44
+
```
45
+
46
+
2. Inspect the `status` section of an API V4 CRD using the following command:
47
+
48
+
```bash
49
+
kubectl get apiv4definitions.gravitee.io <api-name> -o yaml
50
+
```
51
+
52
+
There is an organized `status` section with the following fields:
53
+
54
+
```yaml
55
+
status:
56
+
conditions:
57
+
- lastTransitionTime: "2025-10-03T09:20:04Z"
58
+
message: Successfully reconciled
59
+
observedGeneration: 1
60
+
reason: Accepted
61
+
status: "True"
62
+
type: Accepted
63
+
- lastTransitionTime: "2025-10-03T09:20:04Z"
64
+
message: All References successfully resolved
65
+
observedGeneration: 1
66
+
reason: ResolvedRefs
67
+
status: "True"
68
+
type: ResolvedRefs
69
+
crossId: 8905ba8d-79b9-c446-5cee-71ab8c6ea6f9
70
+
environmentId: DEFAULT
71
+
errors: {}
72
+
id: 3872738b-0aa6-ed7e-1f7b-386d80125412
73
+
organizationId: DEFAULT
74
+
plans:
75
+
KeyLess: d50628d2-cb86-01bc-0393-cdc0a0ce32e4
76
+
processingStatus: Completed
77
+
state: STARTED
78
+
```
79
+
The `conditions` array captures key lifecycle states and potential issues, while top-level fields like `state` and `environmentId` provide an operational summary.
80
+
81
+
82
+
Also, the Application's status is organized with the following fields:
83
+
84
+
```bash
85
+
kubectl get applications.gravitee.io <app-name> -o yaml
86
+
```
87
+
88
+
```yaml
89
+
status:
90
+
conditions:
91
+
- lastTransitionTime: "2025-10-03T09:25:22Z"
92
+
message: Successfully reconciled
93
+
observedGeneration: 1
94
+
reason: Accepted
95
+
status: "True"
96
+
type: Accepted
97
+
- lastTransitionTime: "2025-10-03T09:25:22Z"
98
+
message: All References successfully resolved
99
+
observedGeneration: 1
100
+
reason: ResolvedRefs
101
+
status: "True"
102
+
type: ResolvedRefs
103
+
environmentId: DEFAULT
104
+
errors: {}
105
+
id: 011b0a6b-59d8-452b-95a4-30db51783b83
106
+
organizationId: DEFAULT
107
+
processingStatus: Completed
108
+
```
109
+
## Possible CRD conditions
110
+
When a Custom Resource Definition (CRD) is successfully applied without issues, your CRD's status section displays conditions like the following example:
111
+
```yaml
112
+
status:
113
+
conditions:
114
+
- lastTransitionTime: "2025-10-03T09:25:22Z"
115
+
message: Successfully reconciled
116
+
observedGeneration: 1
117
+
reason: Accepted
118
+
status: "True"
119
+
type: Accepted
120
+
- lastTransitionTime: "2025-10-03T09:25:22Z"
121
+
message: All References successfully resolved
122
+
observedGeneration: 1
123
+
reason: ResolvedRefs
124
+
status: "True"
125
+
type: ResolvedRefs
126
+
```
127
+
128
+
If GKO encounters issues resolving resources referenced within your CRD such as ManagementContext, Secrets, Groups, andAPIs, the conditions reflect a failure like the following example:
129
+
```yaml
130
+
status:
131
+
conditions:
132
+
- lastTransitionTime: "2025-10-03T09:25:22Z"
133
+
message: ReconcileFailed
134
+
observedGeneration: 1
135
+
reason: Accepted
136
+
status: "False"
137
+
type: Accepted
138
+
- lastTransitionTime: "2025-10-03T09:25:22Z"
139
+
message: "can not find Management Context [dev-ctx]"
140
+
observedGeneration: 1
141
+
reason: ResolvedRefs
142
+
status: "False"
143
+
type: ResolvedRefs
144
+
```
145
+
146
+
Common Causes of Unaccepted CRDs
147
+
- Unresolved References: GKO is unable to resolve references within your CRD, such as Management Contexts, Shared Policy Groups, or APIs.
148
+
- Runtime Errors: Errors occurring during runtime, such as invalid values or misconfigurations passed when importing your API into APIM.
149
+
150
+
## Leveraging Status with GitOps
151
+
152
+
The improved structured status output allows for tighter integration with GitOps tools that watch Kubernetes events.
153
+
154
+
For example, when using ArgoCD:
155
+
156
+
1. Define an ArgoCD Application that monitors the GKO namespace.
157
+
2. ArgoCD detects any drifts between the desired state (Git repo) and the current status fields.
158
+
3. Based on the CRD status messages, ArgoCD takes the appropriate actions:
159
+
- Apply resources if creation failed (`*Accepted` condition false)
160
+
- Set the resource as "Degraded" if operations failed (`*ResolvedRefs` false)
161
+
- Trigger notifications based on configured events
162
+
163
+
The standardized schema lets you create cleaner, more automated GitOps workflows around the full API lifecycle on Kubernetes.
0 commit comments