Skip to content

Commit d255c33

Browse files
authored
feat: add observedgeneration to status object of all crds (#1930)
* feat: add observedgeneration to status object of all crds Signed-off-by: sandert-k8s <sandert98@gmail.com> * chore(api): rename rulestatusspec to rulestatusstatus Signed-off-by: sandert-k8s <sandert98@gmail.com> --------- Signed-off-by: sandert-k8s <sandert98@gmail.com>
1 parent eaee317 commit d255c33

30 files changed

Lines changed: 350 additions & 7 deletions

api/v1beta2/capsuleconfiguration_status.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import (
99

1010
// CapsuleConfigurationStatus defines the Capsule configuration status.
1111
type CapsuleConfigurationStatus struct {
12+
// ObservedGeneration is the most recent generation the controller has observed.
13+
// +optional
14+
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
1215
// Users which are considered Capsule Users and are bound to the Capsule Tenant construct.
1316
Users rbac.UserListSpec `json:"users,omitempty"`
1417
}

api/v1beta2/customquota_status.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ import (
1414

1515
// CustomQuotaStatus defines the observed state of GlobalResourceQuota.
1616
type CustomQuotaStatus struct {
17+
// ObservedGeneration is the most recent generation the controller has observed.
18+
// +optional
19+
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
1720
// Usage measurements
1821
// +optional
1922
Usage CustomQuotaStatusUsage `json:"usage,omitempty"`

api/v1beta2/resourcepool_status.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ import (
1313

1414
// GlobalResourceQuotaStatus defines the observed state of GlobalResourceQuota.
1515
type ResourcePoolStatus struct {
16+
// ObservedGeneration is the most recent generation the controller has observed.
17+
// +optional
18+
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
1619
// How many namespaces are considered
1720
// +kubebuilder:default=0
1821
NamespaceSize uint `json:"namespaceCount,omitempty"`

api/v1beta2/resourcepoolclaim_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ type ResourcePoolClaimSpec struct {
2121

2222
// ResourceQuotaClaimStatus defines the observed state of ResourceQuotaClaim.
2323
type ResourcePoolClaimStatus struct {
24+
// ObservedGeneration is the most recent generation the controller has observed.
25+
// +optional
26+
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
2427
// Reference to the GlobalQuota being claimed from
2528
// +optional
2629
Pool meta.LocalRFC1123ObjectReferenceWithUID `json:"pool,omitzero"`

api/v1beta2/rule_status_type.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ import (
1212

1313
// RuleStatus contains the accumulated rules applying to namespace it's deployed in.
1414
// +kubebuilder:object:generate=true
15-
type RuleStatusSpec struct {
15+
type RuleStatusStatus struct {
16+
// ObservedGeneration is the most recent generation the controller has observed.
17+
// +optional
18+
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
1619
// Managed Enforcement properties per Namespace (aggregated from rules)
1720
//+optional
1821
Rule api.NamespaceRuleBodyNamespace `json:"rule,omitzero"`
@@ -34,7 +37,7 @@ type RuleStatus struct {
3437
Spec []*api.NamespaceRuleBodyNamespace `json:"spec,omitzero"`
3538

3639
// +optional
37-
Status RuleStatusSpec `json:"status,omitzero"`
40+
Status RuleStatusStatus `json:"status,omitzero"`
3841
}
3942

4043
// +kubebuilder:object:root=true

api/v1beta2/tenant_status.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ type TenantStatus struct {
2525
// Allowed Cluster Objects within Tenant
2626
TenantAvailableStatus `json:",inline"`
2727

28+
// ObservedGeneration is the most recent generation the controller has observed.
29+
// +optional
30+
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
31+
2832
// Collected owners for this tenant
2933
Owners rbac.OwnerStatusListSpec `json:"owners,omitempty"`
3034
// Promoted ServiceAccounts across the Tenant

api/v1beta2/tenantowner_types.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ type TenantOwnerSpec struct {
2222
}
2323

2424
// TenantOwnerStatus defines the observed state of TenantOwner.
25-
type TenantOwnerStatus struct{}
25+
type TenantOwnerStatus struct {
26+
// ObservedGeneration is the most recent generation the controller has observed.
27+
// +optional
28+
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
29+
}
2630

2731
// +kubebuilder:object:root=true
2832
// +kubebuilder:subresource:status

api/v1beta2/tenantresource_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ import (
1313
)
1414

1515
type TenantResourceCommonStatus struct {
16+
// ObservedGeneration is the most recent generation the controller has observed.
17+
// +optional
18+
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
1619
// Condition of the GlobalTenantResource.
1720
Conditions meta.ConditionList `json:"conditions,omitempty"`
1821

api/v1beta2/zz_generated.deepcopy.go

Lines changed: 4 additions & 4 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_capsuleconfigurations.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,6 +1250,11 @@ spec:
12501250
description: CapsuleConfigurationStatus defines the Capsule configuration
12511251
status.
12521252
properties:
1253+
observedGeneration:
1254+
description: ObservedGeneration is the most recent generation the
1255+
controller has observed.
1256+
format: int64
1257+
type: integer
12531258
users:
12541259
description: Users which are considered Capsule Users and are bound
12551260
to the Capsule Tenant construct.

0 commit comments

Comments
 (0)