Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions api/core/v1alpha1/acl_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ type AccessControlListStatus struct {
// +kubebuilder:printcolumn:name="Device",type=string,JSONPath=`.spec.deviceRef.name`
// +kubebuilder:printcolumn:name="Entries",type=string,JSONPath=`.status.entriesSummary`,priority=1
// +kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].status`
// +kubebuilder:printcolumn:name="Configured",type=string,JSONPath=`.status.conditions[?(@.type=="Configured")].status`,priority=1
// +kubebuilder:printcolumn:name="Paused",type=string,JSONPath=`.status.conditions[?(@.type=="Paused")].status`,priority=1
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 6 additions & 7 deletions internal/controller/core/acl_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func (r *AccessControlListReconciler) Reconcile(ctx context.Context, req ctrl.Re
return ctrl.Result{}, nil
}

if conditions.InitializeConditions(obj, v1alpha1.ReadyCondition) {
if conditions.InitializeConditions(obj, v1alpha1.ReadyCondition, v1alpha1.ConfiguredCondition) {
log.V(1).Info("Initializing status conditions")
return ctrl.Result{}, r.Status().Update(ctx, obj)
}
Expand Down Expand Up @@ -263,6 +263,7 @@ type aclScope struct {
}

func (r *AccessControlListReconciler) reconcile(ctx context.Context, s *aclScope) (reterr error) {
defer conditions.RecomputeReady(s.ACL)
if s.ACL.Labels == nil {
s.ACL.Labels = make(map[string]string)
}
Expand Down Expand Up @@ -298,8 +299,6 @@ func (r *AccessControlListReconciler) reconcile(ctx context.Context, s *aclScope
})

cond := conditions.FromError(err)
// As this resource is configuration only, we use the Configured condition as top-level Ready condition.
cond.Type = v1alpha1.ReadyCondition
conditions.Set(s.ACL, cond)

return err
Expand Down Expand Up @@ -341,11 +340,11 @@ func (r *AccessControlListReconciler) deviceToAccessControlLists(ctx context.Con
}

requests := make([]ctrl.Request, 0, len(list.Items))
for _, i := range list.Items {
log.V(2).Info("Enqueuing AccessControlList for reconciliation", "AccessControlList", klog.KObj(&i))
for i := range list.Items {
log.V(2).Info("Enqueuing AccessControlList for reconciliation", "AccessControlList", klog.KObj(&list.Items[i]))
requests = append(requests, ctrl.Request{
Name: i.Name,
Namespace: i.Namespace,
Name: list.Items[i].Name,
Namespace: list.Items[i].Namespace,
})
}

Expand Down
8 changes: 5 additions & 3 deletions internal/controller/core/acl_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,13 @@ var _ = Describe("AccessControlList Controller", func() {
Eventually(func(g Gomega) {
resource := &v1alpha1.AccessControlList{}
g.Expect(k8sClient.Get(ctx, key, resource)).To(Succeed())
g.Expect(resource.Status.Conditions).To(HaveLen(2))
g.Expect(resource.Status.Conditions).To(HaveLen(3))
g.Expect(resource.Status.Conditions[0].Type).To(Equal(v1alpha1.ReadyCondition))
g.Expect(resource.Status.Conditions[0].Status).To(Equal(metav1.ConditionTrue))
g.Expect(resource.Status.Conditions[1].Type).To(Equal(v1alpha1.PausedCondition))
g.Expect(resource.Status.Conditions[1].Status).To(Equal(metav1.ConditionFalse))
g.Expect(resource.Status.Conditions[1].Type).To(Equal(v1alpha1.ConfiguredCondition))
g.Expect(resource.Status.Conditions[1].Status).To(Equal(metav1.ConditionTrue))
g.Expect(resource.Status.Conditions[2].Type).To(Equal(v1alpha1.PausedCondition))
g.Expect(resource.Status.Conditions[2].Status).To(Equal(metav1.ConditionFalse))
}).Should(Succeed())

By("Ensuring the resource is created in the provider")
Expand Down
Loading