Skip to content

Commit 8a93fe0

Browse files
committed
feat(api): add conditions field to status
Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>
1 parent 4916b8f commit 8a93fe0

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed

api/v1beta2/tenant_status.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
package v1beta2
55

6+
import (
7+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
8+
)
9+
610
// +kubebuilder:validation:Enum=Cordoned;Active
711
type tenantState string
812

@@ -20,4 +24,16 @@ type TenantStatus struct {
2024
Size uint `json:"size"`
2125
// List of namespaces assigned to the Tenant.
2226
Namespaces []string `json:"namespaces,omitempty"`
27+
// Conditions represent the latest available observations of an object's state.
28+
Conditions []metav1.Condition `json:"conditions,omitempty"`
29+
}
30+
31+
// GetConditions returns the status conditions of the object.
32+
func (in Tenant) GetConditions() []metav1.Condition {
33+
return in.Status.Conditions
34+
}
35+
36+
// SetConditions sets the status conditions on the object.
37+
func (in *Tenant) SetConditions(conditions []metav1.Condition) {
38+
in.Status.Conditions = conditions
2339
}

api/v1beta2/zz_generated.deepcopy.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/capsule/crds/capsule.clastix.io_tenants.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2300,6 +2300,64 @@ spec:
23002300
status:
23012301
description: Returns the observed state of the Tenant.
23022302
properties:
2303+
conditions:
2304+
description: Conditions represent the latest available observations
2305+
of an object's state.
2306+
items:
2307+
description: Condition contains details for one aspect of the current
2308+
state of this API Resource.
2309+
properties:
2310+
lastTransitionTime:
2311+
description: |-
2312+
lastTransitionTime is the last time the condition transitioned from one status to another.
2313+
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
2314+
format: date-time
2315+
type: string
2316+
message:
2317+
description: |-
2318+
message is a human readable message indicating details about the transition.
2319+
This may be an empty string.
2320+
maxLength: 32768
2321+
type: string
2322+
observedGeneration:
2323+
description: |-
2324+
observedGeneration represents the .metadata.generation that the condition was set based upon.
2325+
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
2326+
with respect to the current state of the instance.
2327+
format: int64
2328+
minimum: 0
2329+
type: integer
2330+
reason:
2331+
description: |-
2332+
reason contains a programmatic identifier indicating the reason for the condition's last transition.
2333+
Producers of specific condition types may define expected values and meanings for this field,
2334+
and whether the values are considered a guaranteed API.
2335+
The value should be a CamelCase string.
2336+
This field may not be empty.
2337+
maxLength: 1024
2338+
minLength: 1
2339+
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
2340+
type: string
2341+
status:
2342+
description: status of the condition, one of True, False, Unknown.
2343+
enum:
2344+
- "True"
2345+
- "False"
2346+
- Unknown
2347+
type: string
2348+
type:
2349+
description: type of condition in CamelCase or in foo.example.com/CamelCase.
2350+
maxLength: 316
2351+
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
2352+
type: string
2353+
required:
2354+
- lastTransitionTime
2355+
- message
2356+
- reason
2357+
- status
2358+
- type
2359+
type: object
2360+
type: array
23032361
namespaces:
23042362
description: List of namespaces assigned to the Tenant.
23052363
items:

0 commit comments

Comments
 (0)